pull/1/head
张萌 3 years ago
commit 1b58992085

@ -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,

@ -19,8 +19,6 @@ class _PrivacyPageState extends State<PrivacyPage> {
padding: EdgeInsets.all(16.sp),
child: Text(
'''
2022420
 
使App40-11使使使使访便
@ -63,7 +61,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,12 +1,24 @@
import 'package:flutter/cupertino.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/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() =>
@ -14,46 +26,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() {
DateTime date=DateTime.now();
return Row(
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: (){
},
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;
}

@ -10,6 +10,8 @@ import 'package:aku_new_community/base/base_style.dart';
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/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/community/facility/facility_type_detail_page.dart';
import 'package:aku_new_community/utils/headers.dart';
@ -20,6 +22,7 @@ import 'package:aku_new_community/widget/buttons/bottom_button.dart';
import 'package:aku_new_community/widget/picker/bee_date_picker.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';
@ -96,7 +99,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(() {});

@ -38,11 +38,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: [
@ -54,7 +55,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(),

Loading…
Cancel
Save