设备预约

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

@ -1,5 +1,6 @@
import 'package:common_utils/common_utils.dart'; import 'package:common_utils/common_utils.dart';
import 'package:equatable/equatable.dart'; import 'package:equatable/equatable.dart';
import 'package:intl/intl.dart';
import 'package:json_annotation/json_annotation.dart'; import 'package:json_annotation/json_annotation.dart';
import '../../model/common/img_model.dart'; import '../../model/common/img_model.dart';
@ -16,9 +17,9 @@ class FacilityTypeDetailModel extends Equatable {
final String openEndDate; final String openEndDate;
final List<ImgModel>? imgList; 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({ FacilityTypeDetailModel({
required this.id, required this.id,

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

@ -1,11 +1,22 @@
import 'package:aku_new_community/constants/saas_api.dart'; 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/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/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 '../../../utils/network/net_util.dart';
import '../../../widget/buttons/bee_check_radio.dart'; import '../../../widget/buttons/bee_check_radio.dart';
class FacilityPreorderDatePicker extends StatefulWidget { class FacilityPreorderDatePicker extends StatefulWidget {
const FacilityPreorderDatePicker({Key? key}) : super(key: key); FacilityTypeDetailModel typeModel;
FacilityPreorderDatePicker({Key? key, required this.typeModel})
: super(key: key);
@override @override
State<FacilityPreorderDatePicker> createState() => State<FacilityPreorderDatePicker> createState() =>
@ -13,46 +24,100 @@ class FacilityPreorderDatePicker extends StatefulWidget {
} }
class _FacilityPreorderDatePickerState extends State<FacilityPreorderDatePicker> { class _FacilityPreorderDatePickerState extends State<FacilityPreorderDatePicker> {
List<int> get _num => List.generate(48, (index) => index + 1); List<int> get _num => List.generate(
List? _models; getNum(widget.typeModel.openEndDT!) -
getNum(widget.typeModel.openStartDT!),
(index) => index + 1);
DateTime? start;
List<int> models=[];
@override static Future<List<int>> getPreorderData(int id) async {
void initState() async{ BaseModel model =
var base =
await NetUtil().get(SAASAPI.facilities.allAppointmentPeriod, params: { await NetUtil().get(SAASAPI.facilities.allAppointmentPeriod, params: {
'facilitiesManageId': widget, 'facilitiesManageId': id,
'todayDate': DateTime.now(), 'todayDate': DateTime.now(),
}); });
if (base.success) { if (model.success) {
_models = (base.data as List).toList(); return (model.data as List<int>).toList();
} }
super.initState(); return [];
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListView( return BeeChooseDatePicker(
children: _num height: 700.h,
.map((e) => Center( onPressed: () {
child: Padding( Get.back();
padding: EdgeInsets.symmetric(horizontal: 20.w), },
child: body: Container(
Text(e.toString() + '', textAlign: TextAlign.center), 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(); child:Row(
return Row( crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
BeeCheckRadio( BeeCheckRadio(
value: _num, value: getNum(start)+index,
// groupValue: SAASAPI.facilities.allAppointmentPeriod, 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/models/facility/facility_type_detail_model.dart';
import 'package:aku_new_community/provider/app_provider.dart'; import 'package:aku_new_community/provider/app_provider.dart';
import 'package:aku_new_community/provider/user_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_type_detail_page.dart';
import 'package:aku_new_community/ui/community/facility/facility_order_date_list_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'; 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 '../../../constants/saas_api.dart';
import '../../../models/facility/facility_type_model.dart'; import '../../../models/facility/facility_type_model.dart';
import '../../../widget/picker/bee_choose_date_picker.dart';
import '../../../widget/picker/bee_day_picker.dart'; import '../../../widget/picker/bee_day_picker.dart';
import '../../manager/advice/advice_house_page.dart'; import '../../manager/advice/advice_house_page.dart';
@ -98,7 +100,7 @@ class _FacilityPreorderPageState extends State<FacilityPreorderPage> {
height: 120.w, height: 120.w,
onPressed: () async { onPressed: () async {
DateTime? date = await BeeDayPicker.pick(DateTime.now()); DateTime? date = await BeeDayPicker.pick(DateTime.now());
BeeDayPicker.pick(DateTime.now()); await Get.bottomSheet(FacilityPreorderDatePicker(typeModel: widget.typeModel,));
if (date != null) { if (date != null) {
startDate = date; startDate = date;
setState(() {}); setState(() {});

@ -39,11 +39,12 @@ class FacilityTypeDetailCard extends StatelessWidget {
child:FadeInImage.assetNetwork( child:FadeInImage.assetNetwork(
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image: SAASAPI.image(ImgModel.first(model.imgList)), image: SAASAPI.image(ImgModel.first(model.imgList)),
height: 120.h, height: 150.h,
width: 150.w, width: 200.w,
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
), ),
30.wb,
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -55,7 +56,7 @@ class FacilityTypeDetailCard extends StatelessWidget {
), ),
), ),
15.hb, 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 .text
.size(20.sp) .size(20.sp)
.make(), .make(),

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

Loading…
Cancel
Save