设备预约

pull/1/head
戴余标 3 years ago
parent 14c196f071
commit 458b847a21

@ -1,5 +1,6 @@
import 'package:common_utils/common_utils.dart';
import 'package:equatable/equatable.dart';
import 'package:intl/intl.dart';
import 'package:json_annotation/json_annotation.dart';
import '../../model/common/img_model.dart';
@ -16,9 +17,9 @@ class FacilityTypeDetailModel extends Equatable {
final String openEndDate;
final List<ImgModel>? imgList;
DateTime? get openStartDt => DateUtil.getDateTime(openStartDate);
DateTime? get openStartDT => DateFormat('HH:mm:ss').parse(openStartDate);
DateTime? get openEndDt => DateUtil.getDateTime(openEndDate);
DateTime? get openEndDT => DateFormat('HH:mm:ss').parse(openEndDate);
FacilityTypeDetailModel({
required this.id,

@ -18,8 +18,6 @@ class _PrivacyPageState extends State<PrivacyPage> {
padding: EdgeInsets.all(16.sp),
child: Text(
'''
2022420
 
使App40-11使使使使访便
@ -62,7 +60,7 @@ class _PrivacyPageState extends State<PrivacyPage> {
2
使使
   使使IP使访
   使使MACIMEI/Android ID/IDFA/OpenUDID/GUID/SIM IMSI IP GPSWLAN
    使使1MAC2IMEI/Android ID/IDFA/OpenUDID/GUID/SIM IMSI 3IP GPSWLANSDK4app
使使
3
使

@ -1,11 +1,22 @@
import 'package:aku_new_community/constants/saas_api.dart';
import 'package:aku_new_community/models/facility/facility_type_detail_model.dart';
import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/widget/picker/bee_choose_date_picker.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:get/get_core/src/get_main.dart';
import 'package:intl/intl.dart';
import '../../../utils/network/base_model.dart';
import '../../../utils/network/net_util.dart';
import '../../../widget/buttons/bee_check_radio.dart';
class FacilityPreorderDatePicker extends StatefulWidget {
const FacilityPreorderDatePicker({Key? key}) : super(key: key);
FacilityTypeDetailModel typeModel;
FacilityPreorderDatePicker({Key? key, required this.typeModel})
: super(key: key);
@override
State<FacilityPreorderDatePicker> createState() =>
@ -13,46 +24,100 @@ class FacilityPreorderDatePicker extends StatefulWidget {
}
class _FacilityPreorderDatePickerState extends State<FacilityPreorderDatePicker> {
List<int> get _num => List.generate(48, (index) => index + 1);
List? _models;
List<int> get _num => List.generate(
getNum(widget.typeModel.openEndDT!) -
getNum(widget.typeModel.openStartDT!),
(index) => index + 1);
DateTime? start;
List<int> models=[];
@override
void initState() async{
var base =
static Future<List<int>> getPreorderData(int id) async {
BaseModel model =
await NetUtil().get(SAASAPI.facilities.allAppointmentPeriod, params: {
'facilitiesManageId': widget,
'facilitiesManageId': id,
'todayDate': DateTime.now(),
});
if (base.success) {
_models = (base.data as List).toList();
if (model.success) {
return (model.data as List<int>).toList();
}
super.initState();
return [];
}
@override
Widget build(BuildContext context) {
return ListView(
children: _num
.map((e) => Center(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 20.w),
child:
Text(e.toString() + '', textAlign: TextAlign.center),
return BeeChooseDatePicker(
height: 700.h,
onPressed: () {
Get.back();
},
body: Container(
height: 600.h,
child: ListView.separated(
padding: EdgeInsets.all(32.w),
itemBuilder: (context, index) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
_datesList(index),
20.hb,
Divider(height: 1.0,color: Colors.black12,),
],
);
},
separatorBuilder: (context, index) => 32.hb,
itemCount: _num.length,
),
))
.toList());
),
);
}
Widget _datesList(int index) {
DateTime start=widget.typeModel.openStartDT!;
()async{
BaseModel model =
await NetUtil().get(SAASAPI.facilities.allAppointmentPeriod, params: {
'facilitiesManageId': widget.typeModel.id,
'todayDate': DateTime.now(),
});
if (model.success) {
models=(model.data as List<int>).toList();
}
};
return GestureDetector(
onTap: (){
Widget _datesList() {
DateTime date=DateTime.now();
return Row(
},
child:Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
BeeCheckRadio(
value: _num,
// groupValue: SAASAPI.facilities.allAppointmentPeriod,
value: getNum(start)+index,
groupValue: models,
backColor: start.isAfter(DateTime.now())?Colors.grey:Colors.white,
),
30.wb,
Text(
'${DateUtil.formatDate(start.add(Duration(minutes: 30*index)),format: 'HH:mm')}'
'~${DateUtil.formatDate(start.add(Duration(minutes: 30*(index+1))),format: 'HH:mm')}',
style: TextStyle(
fontSize: 30.sp,
),
),
Text('${date}~${date.add(Duration(minutes: 30))}'),
Spacer(),
start.isAfter(DateTime.now())?'已过期'.text.size(30.sp).color(Colors.black.withOpacity(0.45)).make():
models.contains(getNum(start))?'已被他人预约'.text.size(30.sp).color(Colors.black.withOpacity(0.45)).make():SizedBox(),
],
),
);
}
}
int getNum(DateTime dateTime) {
int hour, minute;
hour = dateTime.hour;
minute = dateTime.minute;
if (minute > 0) {
return hour * 2 + 1;
}
return hour * 2;
}

@ -4,6 +4,7 @@ import 'package:aku_new_community/constants/app_theme.dart';
import 'package:aku_new_community/models/facility/facility_type_detail_model.dart';
import 'package:aku_new_community/provider/app_provider.dart';
import 'package:aku_new_community/provider/user_provider.dart';
import 'package:aku_new_community/ui/community/facility/facility_preorder_date_picker.dart';
import 'package:aku_new_community/ui/community/facility/facility_type_detail_page.dart';
import 'package:aku_new_community/ui/community/facility/facility_order_date_list_page.dart';
import 'package:aku_new_community/ui/profile/house/pick_my_house_page.dart';
@ -22,6 +23,7 @@ import 'package:provider/provider.dart';
import '../../../constants/saas_api.dart';
import '../../../models/facility/facility_type_model.dart';
import '../../../widget/picker/bee_choose_date_picker.dart';
import '../../../widget/picker/bee_day_picker.dart';
import '../../manager/advice/advice_house_page.dart';
@ -98,7 +100,7 @@ class _FacilityPreorderPageState extends State<FacilityPreorderPage> {
height: 120.w,
onPressed: () async {
DateTime? date = await BeeDayPicker.pick(DateTime.now());
BeeDayPicker.pick(DateTime.now());
await Get.bottomSheet(FacilityPreorderDatePicker(typeModel: widget.typeModel,));
if (date != null) {
startDate = date;
setState(() {});

@ -39,11 +39,12 @@ class FacilityTypeDetailCard extends StatelessWidget {
child:FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: SAASAPI.image(ImgModel.first(model.imgList)),
height: 120.h,
width: 150.w,
height: 150.h,
width: 200.w,
fit: BoxFit.cover,
),
),
30.wb,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -55,7 +56,7 @@ class FacilityTypeDetailCard extends StatelessWidget {
),
),
15.hb,
'${model.openStartDate.substring(0, model.openStartDate.length - 3)}-${model.openEndDate.substring(0, model.openEndDate.length - 3)} 开放'
'${DateUtil.formatDate(model.openStartDT,format: 'HH:mm')}-${DateUtil.formatDate(model.openEndDT,format: 'HH:mm')} 开放'
.text
.size(20.sp)
.make(),

@ -760,6 +760,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.11"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
meta:
dependency: transitive
description:
@ -1207,7 +1214,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.3"
version: "0.4.8"
time:
dependency: transitive
description:

Loading…
Cancel
Save