|
...
|
...
|
@@ -103,166 +103,163 @@ class _BookTimeSettingListPageState extends State<BookTimeSettingListPage> { |
|
|
|
Widget build(BuildContext context) {
|
|
|
|
storeBaseInfoP = Provider.of<StoreBaseIndoProvider>(context, listen: false);
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: MyColours.color_f3f3f3,
|
|
|
|
appBar: SystemAppBar('多时段预订'),
|
|
|
|
body: Consumer<StoreBaseIndoProvider>(builder: (context, model, _) {
|
|
|
|
if (model.pageState != PageState.Success) {
|
|
|
|
return ExceptionPage(
|
|
|
|
pageState: model.pageState,
|
|
|
|
callback: () {
|
|
|
|
getSellerMealSection();
|
|
|
|
},
|
|
|
|
emptyMsg: "暂时没有信息哦",
|
|
|
|
emptyImg: "empty_search",
|
|
|
|
showMsg: "加载中,请稍后...",
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return Column(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: ListView.builder(
|
|
|
|
padding: EdgeInsets.only(top: w(16)),
|
|
|
|
itemCount: storeBaseInfoP.mealListData.length,
|
|
|
|
shrinkWrap: true,
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
MealListSunModel sunModel =
|
|
|
|
storeBaseInfoP.mealListData[index];
|
|
|
|
String dateSel = sunModel.type == '1'
|
|
|
|
? sunModel.dateSel.split(',').map((e) {
|
|
|
|
String str = e.replaceAll(' ', '');
|
|
|
|
List strlist = str.split('-');
|
|
|
|
backgroundColor: MyColours.color_f3f3f3,
|
|
|
|
appBar: SystemAppBar('多时段预订'),
|
|
|
|
body: Column(
|
|
|
|
children: [
|
|
|
|
Expanded(child:
|
|
|
|
Consumer<StoreBaseIndoProvider>(builder: (context, model, _) {
|
|
|
|
if (model.pageState != PageState.Success) {
|
|
|
|
return ExceptionPage(
|
|
|
|
pageState: model.pageState,
|
|
|
|
callback: () {
|
|
|
|
getSellerMealSection();
|
|
|
|
},
|
|
|
|
emptyMsg: "暂时没有信息哦",
|
|
|
|
emptyImg: "empty_search",
|
|
|
|
showMsg: "加载中,请稍后...",
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return ListView.builder(
|
|
|
|
padding: EdgeInsets.only(top: w(16)),
|
|
|
|
itemCount: storeBaseInfoP.mealListData.length,
|
|
|
|
shrinkWrap: true,
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
MealListSunModel sunModel =
|
|
|
|
storeBaseInfoP.mealListData[index];
|
|
|
|
String dateSel = sunModel.type == '1'
|
|
|
|
? sunModel.dateSel.split(',').map((e) {
|
|
|
|
String str = e.replaceAll(' ', '');
|
|
|
|
List strlist = str.split('-');
|
|
|
|
|
|
|
|
return str +
|
|
|
|
' ${Utils.lunarCalendarHolidaysShow(DateTime(int.parse(strlist[0]), int.parse(strlist[1]), int.parse(strlist[2])))}';
|
|
|
|
}).join(' ')
|
|
|
|
: sunModel.dateSel
|
|
|
|
.split(',')
|
|
|
|
.map((e) => Utils.intToWeek(int.parse(e)))
|
|
|
|
.join(' ');
|
|
|
|
return str +
|
|
|
|
' ${Utils.lunarCalendarHolidaysShow(DateTime(int.parse(strlist[0]), int.parse(strlist[1]), int.parse(strlist[2])))}';
|
|
|
|
}).join(' ')
|
|
|
|
: sunModel.dateSel
|
|
|
|
.split(',')
|
|
|
|
.map((e) => Utils.intToWeek(int.parse(e)))
|
|
|
|
.join(' ');
|
|
|
|
|
|
|
|
return InkWell(
|
|
|
|
onTap: () {
|
|
|
|
NavigatorUtil.goBookTimeSettingEditPage(context,
|
|
|
|
sunModel: sunModel);
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
left: w(20), right: w(20), bottom: w(10)),
|
|
|
|
return InkWell(
|
|
|
|
onTap: () {
|
|
|
|
NavigatorUtil.goBookTimeSettingEditPage(context,
|
|
|
|
sunModel: sunModel);
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
left: w(20), right: w(20), bottom: w(10)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
offset: Offset(0, w(4)),
|
|
|
|
blurRadius: r(4),
|
|
|
|
color: MyColours.color_40000000)
|
|
|
|
],
|
|
|
|
borderRadius: BorderRadius.circular(r(8))),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
padding:
|
|
|
|
EdgeInsets.symmetric(horizontal: w(12)),
|
|
|
|
height: w(33),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
boxShadow: [
|
|
|
|
BoxShadow(
|
|
|
|
offset: Offset(0, w(4)),
|
|
|
|
blurRadius: r(4),
|
|
|
|
color: MyColours.color_40000000)
|
|
|
|
],
|
|
|
|
borderRadius: BorderRadius.circular(r(8))),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
color: sunModel.status == '1'
|
|
|
|
? MyColours.color_438E93
|
|
|
|
: MyColours.color_999999,
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
topLeft: Radius.circular(r(8)),
|
|
|
|
topRight: Radius.circular(r(8)),
|
|
|
|
)),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: w(12)),
|
|
|
|
height: w(33),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: sunModel.status == '1'
|
|
|
|
? MyColours.color_438E93
|
|
|
|
: MyColours.color_999999,
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
topLeft: Radius.circular(r(8)),
|
|
|
|
topRight: Radius.circular(r(8)),
|
|
|
|
)),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
sunModel.type == '1'
|
|
|
|
? '指定日期'
|
|
|
|
: '每周固定',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: font(18),
|
|
|
|
color: MyColours.color_ffffff),
|
|
|
|
),
|
|
|
|
RoundButton(
|
|
|
|
width: w(32),
|
|
|
|
height: w(19),
|
|
|
|
radius: r(5),
|
|
|
|
text: sunModel.status == '1'
|
|
|
|
? '停用'
|
|
|
|
: '启用',
|
|
|
|
fontSize: 24,
|
|
|
|
textColor: MyColours.color_ffffff,
|
|
|
|
gradientStart: Colors.transparent,
|
|
|
|
gradientEnd: Colors.transparent,
|
|
|
|
borderColor: MyColours.color_ffffff,
|
|
|
|
onPressed: () async {
|
|
|
|
String status = '';
|
|
|
|
if (sunModel.status == '1') {
|
|
|
|
status = '0';
|
|
|
|
} else {
|
|
|
|
status = '1';
|
|
|
|
}
|
|
|
|
Map<String, String> params = {
|
|
|
|
'id': sunModel.id,
|
|
|
|
'sellerid': sunModel.sellerid,
|
|
|
|
'type': sunModel.type,
|
|
|
|
'status': status
|
|
|
|
};
|
|
|
|
|
|
|
|
bool sucess = await storeBaseInfoP
|
|
|
|
.setSellerMealSection(
|
|
|
|
context, params);
|
|
|
|
if (sucess) {
|
|
|
|
getSellerMealSection();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// onPressed: widget.onPressedSwich,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Text(
|
|
|
|
sunModel.type == '1' ? '指定日期' : '每周固定',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: font(18),
|
|
|
|
color: MyColours.color_ffffff),
|
|
|
|
),
|
|
|
|
VEmptyView(16),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: w(12)),
|
|
|
|
child: Text(
|
|
|
|
dateSel,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: font(10),
|
|
|
|
color: MyColours.color_515151),
|
|
|
|
)
|
|
|
|
// Wrap(
|
|
|
|
// spacing: w(5),
|
|
|
|
// children: listWidget(),
|
|
|
|
// )
|
|
|
|
),
|
|
|
|
VEmptyView(16),
|
|
|
|
Column(
|
|
|
|
children:
|
|
|
|
listWidgetTime(sunModel.dateStr),
|
|
|
|
RoundButton(
|
|
|
|
width: w(32),
|
|
|
|
height: w(19),
|
|
|
|
radius: r(5),
|
|
|
|
text:
|
|
|
|
sunModel.status == '1' ? '停用' : '启用',
|
|
|
|
fontSize: 24,
|
|
|
|
textColor: MyColours.color_ffffff,
|
|
|
|
gradientStart: Colors.transparent,
|
|
|
|
gradientEnd: Colors.transparent,
|
|
|
|
borderColor: MyColours.color_ffffff,
|
|
|
|
onPressed: () async {
|
|
|
|
String status = '';
|
|
|
|
if (sunModel.status == '1') {
|
|
|
|
status = '0';
|
|
|
|
} else {
|
|
|
|
status = '1';
|
|
|
|
}
|
|
|
|
Map<String, String> params = {
|
|
|
|
'id': sunModel.id,
|
|
|
|
'sellerid': sunModel.sellerid,
|
|
|
|
'type': sunModel.type,
|
|
|
|
'status': status
|
|
|
|
};
|
|
|
|
|
|
|
|
bool sucess = await storeBaseInfoP
|
|
|
|
.setSellerMealSection(
|
|
|
|
context, params);
|
|
|
|
if (sucess) {
|
|
|
|
getSellerMealSection();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// onPressed: widget.onPressedSwich,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
));
|
|
|
|
})),
|
|
|
|
Container(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
left: w(45), top: w(12), bottom: w(25), right: w(45)),
|
|
|
|
child: RoundButton(
|
|
|
|
text: '创建新的多时段预订规则',
|
|
|
|
// width: ScreenUtil().setWidth(280 * 2),
|
|
|
|
height: w(41),
|
|
|
|
radius: r(5),
|
|
|
|
isBold: true,
|
|
|
|
fontSize: 32,
|
|
|
|
onPressed: () {
|
|
|
|
NavigatorUtil.goBookTimeSettingEditPage(context);
|
|
|
|
}))
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
),
|
|
|
|
VEmptyView(16),
|
|
|
|
Padding(
|
|
|
|
padding:
|
|
|
|
EdgeInsets.symmetric(horizontal: w(12)),
|
|
|
|
child: Text(
|
|
|
|
dateSel,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: font(10),
|
|
|
|
color: MyColours.color_515151),
|
|
|
|
)
|
|
|
|
// Wrap(
|
|
|
|
// spacing: w(5),
|
|
|
|
// children: listWidget(),
|
|
|
|
// )
|
|
|
|
),
|
|
|
|
VEmptyView(16),
|
|
|
|
Column(
|
|
|
|
children: listWidgetTime(sunModel.dateStr),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
})),
|
|
|
|
Container(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
left: w(45), top: w(12), bottom: w(25), right: w(45)),
|
|
|
|
child: RoundButton(
|
|
|
|
text: '创建新的多时段预订规则',
|
|
|
|
// width: ScreenUtil().setWidth(280 * 2),
|
|
|
|
height: w(41),
|
|
|
|
radius: r(5),
|
|
|
|
isBold: true,
|
|
|
|
fontSize: 32,
|
|
|
|
onPressed: () {
|
|
|
|
NavigatorUtil.goBookTimeSettingEditPage(context);
|
|
|
|
}))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|