Commit b4a0c01a4680733cf52f0e5128c5c43ea696740f

Authored by wdn127929
1 parent 584151c0

可预订时段更改(0、15、30、45)后,导致到店时间半小时间隔函数死循环 修复

... ... @@ -213,6 +213,22 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
int beginHour = int.parse(tempHour[0]);
/*获取开始分钟*/
int beginMinute = int.parse(tempHour[1]);
if (beginMinute == 15) {
beginMinute = 30;
} else if (beginMinute == 45) {
beginHour++;
beginMinute = 0;
}
List endTemp = endDate.split(':');
/*获取结束小时*/
int endHour = int.parse(endTemp[0]);
/*获取结束分钟*/
int endMinute = int.parse(endTemp[1]);
if (endMinute == 15) {
endDate = '${endHour}:00';
} else if (endMinute == 45) {
endDate = '${endHour}:30';
}
List res = [];
bool tempLimit = true;
while (tempLimit) {
... ... @@ -2613,48 +2629,46 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
// .length ==
// 0
// ?
Expanded(
flex: 1,
child: InkWell(
onTap: () {
NavigatorUtil
.goOrderAdvanceHomePage(
context,
detailEntity,
widget.rid);
},
child: Container(
margin: EdgeInsets.only(
right: ScreenUtil()
.setWidth(20)),
decoration: BoxDecoration(
Expanded(
flex: 1,
child: InkWell(
onTap: () {
NavigatorUtil
.goOrderAdvanceHomePage(
context,
detailEntity,
widget.rid);
},
child: Container(
margin: EdgeInsets.only(
right: ScreenUtil()
.setWidth(20)),
decoration: BoxDecoration(
color:
MyColours.color_ffffff,
border: Border.all(
width: w(1),
color: MyColours
.color_ffffff,
border: Border.all(
width: w(1),
.color_438E93),
borderRadius:
BorderRadius.circular(
ScreenUtil()
.setWidth(10)),
),
child: Align(
alignment: Alignment.center,
child: Text('预点菜',
style: TextStyle(
color: MyColours
.color_438E93),
borderRadius:
BorderRadius.circular(
.color_438E93,
fontSize:
ScreenUtil()
.setWidth(
10)),
),
child: Align(
alignment:
Alignment.center,
child: Text('预点菜',
style: TextStyle(
color: MyColours
.color_438E93,
fontSize:
ScreenUtil()
.setSp(
34))),
),
),
)),
// : SizedBox(),
.setSp(
34))),
),
),
)),
// : SizedBox(),
Expanded(
flex: 2,
child: InkWell(
... ...
... ... @@ -122,6 +122,23 @@ class SelectTableFPageState extends State<SelectTableFPage> {
int beginHour = int.parse(tempHour[0]);
/*获取开始分钟*/
int beginMinute = int.parse(tempHour[1]);
if (beginMinute == 15) {
beginMinute = 30;
} else if (beginMinute == 45) {
beginHour++;
beginMinute = 0;
}
List endTemp = endDate.split(':');
/*获取结束小时*/
int endHour = int.parse(endTemp[0]);
/*获取结束分钟*/
int endMinute = int.parse(endTemp[1]);
if (endMinute == 15) {
endDate = '${endHour}:00';
} else if (endMinute == 45) {
endDate = '${endHour}:30';
}
List res = [];
bool tempLimit = true;
while (tempLimit) {
... ...
... ... @@ -565,6 +565,23 @@ class InvicationPageState extends State<InvicationPage>
int beginHour = int.parse(tempHour[0]);
/*获取开始分钟*/
int beginMinute = int.parse(tempHour[1]);
if (beginMinute == 15) {
beginMinute = 30;
} else if (beginMinute == 45) {
beginHour++;
beginMinute = 0;
}
List endTemp = endDate.split(':');
/*获取结束小时*/
int endHour = int.parse(endTemp[0]);
/*获取结束分钟*/
int endMinute = int.parse(endTemp[1]);
if (endMinute == 15) {
endDate = '${endHour}:00';
} else if (endMinute == 45) {
endDate = '${endHour}:30';
}
List<String> res = [];
bool tempLimit = true;
while (tempLimit) {
... ... @@ -613,6 +630,23 @@ class InvicationPageState extends State<InvicationPage>
// int beginHour = int.parse(tempHour[0]);
// /*获取开始分钟*/
// int beginMinute = int.parse(tempHour[1]);
// if (beginMinute == 15) {
// beginMinute = 30;
// } else if (beginMinute == 45) {
// beginHour++;
// beginMinute = 0;
// }
// List endTemp = endDate.split(':');
// /*获取结束小时*/
// int endHour = int.parse(endTemp[0]);
// /*获取结束分钟*/
// int endMinute = int.parse(endTemp[1]);
// if (endMinute == 15) {
// endDate = '${endHour}:00';
// } else if (endMinute == 45) {
// endDate = '${endHour}:30';
// }
// List res = [];
// bool tempLimit = true;
// while (tempLimit) {
... ...
... ... @@ -107,41 +107,41 @@ class _MarketingCenterHomePageState extends State<MarketingCenterHomePage> {
child: SingleChildScrollView(
child: Column(
children: [
// InkWell(
// onTap: () {
// NavigatorUtil.goRechargeHomePage(context);
// },
// child: Padding(
// padding: EdgeInsets.only(
// left: w(16),
// top: w(12),
// bottom: w(12),
// right: w(12)),
// child: Row(
// children: [
// Text(
// '会员充值优惠活动',
// style: TextStyle(
// color: MyColours.color_515151,
// fontSize: ScreenUtil().setWidth(32)),
// ),
// Spacer(),
// Container(
// padding: EdgeInsets.symmetric(
// horizontal: w(7), vertical: w(4)),
// child: Image.asset(
// "assets/arrow_right_new.png",
// width: ScreenUtil().setWidth(18),
// height: ScreenUtil().setWidth(32),
// ),
// )
// ],
// ))),
// Padding(
// padding: EdgeInsets.only(left: w(16)),
// child: MyDivider(double.infinity, w(0.5),
// color: MyColours.color_E7E7E7)),
// VEmptyView(24),
InkWell(
onTap: () {
NavigatorUtil.goRechargeHomePage(context);
},
child: Padding(
padding: EdgeInsets.only(
left: w(16),
top: w(12),
bottom: w(12),
right: w(12)),
child: Row(
children: [
Text(
'会员充值优惠活动',
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setWidth(32)),
),
Spacer(),
Container(
padding: EdgeInsets.symmetric(
horizontal: w(7), vertical: w(4)),
child: Image.asset(
"assets/arrow_right_new.png",
width: ScreenUtil().setWidth(18),
height: ScreenUtil().setWidth(32),
),
)
],
))),
Padding(
padding: EdgeInsets.only(left: w(16)),
child: MyDivider(double.infinity, w(0.5),
color: MyColours.color_E7E7E7)),
VEmptyView(24),
InkWell(
onTap: () {
setState(() {
... ...
import 'dart:convert';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_picker/Picker.dart';
... ... @@ -61,6 +63,8 @@ class _RechargeEditPageState extends State<RechargeEditPage> {
bool giveScoreSwich = false;
bool giveCouponsSwich = false;
List<CouponSunModel> couponsData = [];
@override
void initState() {
super.initState();
... ... @@ -636,12 +640,15 @@ class _RechargeEditPageState extends State<RechargeEditPage> {
object['couponsid'] != null) {
List<CouponSunModel> data =
object['couponsdata'];
couponsData = [];
//
selectIDs = object['couponsid'];
coupons = [];
data.forEach((element) {
if (element.isCheck) {
coupons.add(element.aname);
couponsData.add(element);
}
});
setState(() {});
... ... @@ -871,6 +878,74 @@ class _RechargeEditPageState extends State<RechargeEditPage> {
isBold: false,
fontSize: 28,
onPressed: () async {
//优惠活动
if (givePriceSwich && givePriceC.text.trim().length == 0) {
Utils.showToast('请输入赠送金额!');
return;
}
if (giveScoreSwich && giveScoreC.text.trim().length == 0) {
Utils.showToast('请输入赠送积分!');
return;
}
if (giveCouponsSwich && couponsData.length == 0) {
Utils.showToast('请选择赠送的优惠券!');
return;
}
//有效期
if (fixdate) {
//固定时间段
if (fromDate == '点击设置开始日期') {
Utils.showToast('请设置开始日期!');
return;
}
if (endDate == '点击设置结束日期') {
Utils.showToast('请设置结束日期!');
return;
}
if (DateUtil.getDateTime(endDate)
.compareTo(DateUtil.getDateTime(fromDate)) <
0) {
Utils.showToast('有效期结束日期不能早于开始日期!');
return;
}
}
if (weekly && weekShow == '点击设置可用日期') {
Utils.showToast('请设置可用日期!');
return;
}
Map discounts = {
'is_price': givePriceSwich ? '1' : '0', //优惠活动,赠送金额
'is_score': giveScoreSwich ? '1' : '0', //赠送积分
'is_coupons': giveCouponsSwich ? '1' : '0', //赠送优惠券
'price': givePriceC.text,
'score': giveScoreC.text,
'coupons': couponsData,
'coupons_ids': selectIDs,
'coupons_names': coupons
};
String discountsStr = json.encode(discounts);
print(discountsStr);
Map date = {
'is_fix': fixdate ? '1' : '0',
'is_week': weekly ? '1' : '0',
'is_birthday': birthday ? '1' : '0',
'fix_sdate': fixdate ? fromDate : '', // 开始时间
'fix_edate': fixdate ? endDate : '', //结束时间
'week_date_show': weekly ? weekShow : '',
'week_date_data': weekly ? weekData : ''
};
String dateStr = json.encode(date);
print(dateStr);
// "stime": fromDate == '点击选择'
// ? ""
// : '${DateUtil.getDateMsByTimeStr(fromDate) / 1000}',
... ...
... ... @@ -133,6 +133,23 @@ class PhotoManagerPageState extends State<PhotoManagerPage> {
int beginHour = int.parse(tempHour[0]);
/*获取开始分钟*/
int beginMinute = int.parse(tempHour[1]);
if (beginMinute == 15) {
beginMinute = 30;
} else if (beginMinute == 45) {
beginHour++;
beginMinute = 0;
}
List endTemp = endDate.split(':');
/*获取结束小时*/
int endHour = int.parse(endTemp[0]);
/*获取结束分钟*/
int endMinute = int.parse(endTemp[1]);
if (endMinute == 15) {
endDate = '${endHour}:00';
} else if (endMinute == 45) {
endDate = '${endHour}:30';
}
List res = [];
bool tempLimit = true;
while (tempLimit) {
... ...
... ... @@ -144,6 +144,23 @@ class MergeTableSelectPageState extends State<MergeTableSelectPage> {
// int beginHour = int.parse(tempHour[0]);
// /*获取开始分钟*/
// int beginMinute = int.parse(tempHour[1]);
// if (beginMinute == 15) {
// beginMinute = 30;
// } else if (beginMinute == 45) {
// beginHour++;
// beginMinute = 0;
// }
// List endTemp = endDate.split(':');
// /*获取结束小时*/
// int endHour = int.parse(endTemp[0]);
// /*获取结束分钟*/
// int endMinute = int.parse(endTemp[1]);
// if (endMinute == 15) {
// endDate = '${endHour}:00';
// } else if (endMinute == 45) {
// endDate = '${endHour}:30';
// }
// List res = [];
// bool tempLimit = true;
// while (tempLimit) {
... ...
... ... @@ -242,6 +242,7 @@ class CustomerProvider extends ChangeNotifier {
}
}
});
if (baseResp == null) return [];
if (baseResp.code == Constant.status_success) {
couponListSelect = CouponModel.fromJson(baseResp.responseData).data;
notifyListeners();
... ...
... ... @@ -322,6 +322,22 @@ class EnterModel with ChangeNotifier {
int beginHour = int.parse(tempHour[0]);
/*获取开始分钟*/
int beginMinute = int.parse(tempHour[1]);
if (beginMinute == 15) {
beginMinute = 30;
} else if (beginMinute == 45) {
beginHour++;
beginMinute = 0;
}
List endTemp = endDate.split(':');
/*获取结束小时*/
int endHour = int.parse(endTemp[0]);
/*获取结束分钟*/
int endMinute = int.parse(endTemp[1]);
if (endMinute == 15) {
endDate = '${endHour}:00';
} else if (endMinute == 45) {
endDate = '${endHour}:30';
}
List res = [];
bool tempLimit = true;
while (tempLimit) {
... ...
... ... @@ -205,6 +205,23 @@ class HomeEnterModel with ChangeNotifier {
int beginHour = int.parse(tempHour[0]);
/*获取开始分钟*/
int beginMinute = int.parse(tempHour[1]);
if (beginMinute == 15) {
beginMinute = 30;
} else if (beginMinute == 45) {
beginHour++;
beginMinute = 0;
}
List endTemp = endDate.split(':');
/*获取结束小时*/
int endHour = int.parse(endTemp[0]);
/*获取结束分钟*/
int endMinute = int.parse(endTemp[1]);
if (endMinute == 15) {
endDate = '${endHour}:00';
} else if (endMinute == 45) {
endDate = '${endHour}:30';
}
List res = [];
bool tempLimit = true;
while (tempLimit) {
... ...
... ... @@ -224,6 +224,22 @@ class NotebookDetailChangeModel with ChangeNotifier {
int beginHour = int.parse(tempHour[0]);
/*获取开始分钟*/
int beginMinute = int.parse(tempHour[1]);
if (beginMinute == 15) {
beginMinute = 30;
} else if (beginMinute == 45) {
beginHour++;
beginMinute = 0;
}
List endTemp = endDate.split(':');
/*获取结束小时*/
int endHour = int.parse(endTemp[0]);
/*获取结束分钟*/
int endMinute = int.parse(endTemp[1]);
if (endMinute == 15) {
endDate = '${endHour}:00';
} else if (endMinute == 45) {
endDate = '${endHour}:30';
}
List res = [];
bool tempLimit = true;
while (tempLimit) {
... ...
... ... @@ -266,7 +266,7 @@ class TableManagerModel with ChangeNotifier {
return ddateStr.substring(0, 10);
}
//根据获取时间 11:00-12:30 获取30分钟间隔组装的数组
//根据获取时间 11:00-12:30 获取30分钟间隔组装的数组 16:00-23:15
_getHourAndMinute(String hourAndMinuteStr, int mnd) {
List tempDate = hourAndMinuteStr.split("-");
String beginDate = tempDate[0];
... ... @@ -276,11 +276,30 @@ class TableManagerModel with ChangeNotifier {
int beginHour = int.parse(tempHour[0]);
/*获取开始分钟*/
int beginMinute = int.parse(tempHour[1]);
if (beginMinute == 15) {
beginMinute = 30;
} else if (beginMinute == 45) {
beginHour++;
beginMinute = 0;
}
List endTemp = endDate.split(':');
/*获取结束小时*/
int endHour = int.parse(endTemp[0]);
/*获取结束分钟*/
int endMinute = int.parse(endTemp[1]);
if (endMinute == 15) {
endDate = '${endHour}:00';
} else if (endMinute == 45) {
endDate = '${endHour}:30';
}
List<String> res = [];
bool tempLimit = true;
while (tempLimit) {
String temp = _dealTime(beginHour, beginMinute);
res.add(temp);
print(res);
if (temp == endDate) {
tempLimit = false;
break;
... ... @@ -790,7 +809,7 @@ class TableManagerModel with ChangeNotifier {
table.sign = notebook.status;
table.notebookId = notebook.id;
table.reserver = notebook.rnameStr;
table.phone = notebook.phone;
table.phone = notebook.phone;
table.pnum = notebook.actual_pnum;
table.nickName = notebook.nick_name;
table.label = notebook.className;
... ...
... ... @@ -1566,7 +1566,7 @@ class Utils {
title: _title,
path: _path,
description: _description,
// miniProgramType: WXMiniProgramType.PREVIEW, //体验版
miniProgramType: WXMiniProgramType.PREVIEW, //体验版
// miniProgramType: WXMiniProgramType.RELEASE //正式版
// miniProgramType: WXMiniProgramType.TEST //开发版
// thumbnail: WeChatImage.binary(source)
... ...
... ... @@ -106,6 +106,22 @@ class SetTimeWidget {
int beginHour = int.parse(tempHour[0]);
/*获取开始分钟*/
int beginMinute = int.parse(tempHour[1]);
if (beginMinute == 15) {
beginMinute = 30;
} else if (beginMinute == 45) {
beginHour++;
beginMinute = 0;
}
List endTemp = endDate.split(':');
/*获取结束小时*/
int endHour = int.parse(endTemp[0]);
/*获取结束分钟*/
int endMinute = int.parse(endTemp[1]);
if (endMinute == 15) {
endDate = '${endHour}:00';
} else if (endMinute == 45) {
endDate = '${endHour}:30';
}
List res = [];
bool tempLimit = true;
while (tempLimit) {
... ...