|
...
|
...
|
@@ -24,6 +24,9 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
|
|
TextEditingController customController = TextEditingController(); //客户要求
|
|
|
|
List sexList = []; // 先生、女士、公司
|
|
|
|
Map dailyMap = {}; // 早市对应半点钟,午市对应半点钟、晚市对应半点钟
|
|
|
|
List<String> mornings=[];//早市时间段
|
|
|
|
List<String> noons=[];//午市时间段
|
|
|
|
List<String> nights=[];//晚市时间段
|
|
|
|
String ddateStr = ''; //16:30
|
|
|
|
NotebookDetail detailEntity;
|
|
|
|
List<TableList> tableList = [];
|
|
...
|
...
|
@@ -141,10 +144,11 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
|
|
'isSelect': ddateSolt == '3' ? true : false
|
|
|
|
});
|
|
|
|
}
|
|
|
|
initHourAndMinuteSelect();
|
|
|
|
notifyListeners();
|
|
|
|
}
|
|
|
|
|
|
|
|
//人数
|
|
|
|
//人数
|
|
|
|
_initPersonNumList() {
|
|
|
|
String pnum = detailEntity.pnum;
|
|
|
|
if (int.parse(pnum) < 6 || int.parse(pnum) > 10) {
|
|
...
|
...
|
@@ -229,25 +233,26 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
|
|
|
|
|
|
/// 早市、午市、晚市对应的半个小时间隔时间段
|
|
|
|
initDateHourMinuteList(BuildContext context) async {
|
|
|
|
SunSellerInfoModel model = await getManagersInfo(context);
|
|
|
|
model.daily.morning == ''
|
|
|
|
UserModel userModel=Provider.of<UserModel>(context);
|
|
|
|
userModel.user.morning == ''
|
|
|
|
? dailyMap.putIfAbsent('morning', () => '')
|
|
|
|
: dailyMap.putIfAbsent(
|
|
|
|
'morning', () => _getHourAndMinute(model.daily.morning, 1, model));
|
|
|
|
model.daily.noon == ''
|
|
|
|
'morning', () => _getHourAndMinute(userModel.user.morning, 1));
|
|
|
|
userModel.user.noon == ''
|
|
|
|
? dailyMap.putIfAbsent('noon', () => '')
|
|
|
|
: dailyMap.putIfAbsent(
|
|
|
|
'noon', () => _getHourAndMinute(model.daily.noon, 2, model));
|
|
|
|
model.daily.night == ''
|
|
|
|
'noon', () => _getHourAndMinute(userModel.user.noon, 2));
|
|
|
|
userModel.user.night == ''
|
|
|
|
? dailyMap.putIfAbsent('night', () => '')
|
|
|
|
: dailyMap.putIfAbsent(
|
|
|
|
'night', () => _getHourAndMinute(model.daily.night, 3, model));
|
|
|
|
_initSunDateList(model.daily.morning, model.daily.noon, model.daily.night);
|
|
|
|
'night', () => _getHourAndMinute(userModel.user.night, 3));
|
|
|
|
|
|
|
|
_initSunDateList(userModel.user.morning, userModel.user.noon, userModel.user.night);
|
|
|
|
}
|
|
|
|
|
|
|
|
//根据获取时间 11:00-12:30 获取30分钟间隔组装的数组
|
|
|
|
_getHourAndMinute(
|
|
|
|
String hourAndMinuteStr, int mnd, SunSellerInfoModel model) {
|
|
|
|
String hourAndMinuteStr, int mnd) {
|
|
|
|
List tempDate = hourAndMinuteStr.split("-");
|
|
|
|
String beginDate = tempDate[0];
|
|
|
|
String endDate = tempDate[1];
|
|
...
|
...
|
@@ -262,6 +267,13 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
|
|
bool tempLimit = true;
|
|
|
|
while (tempLimit) {
|
|
|
|
String temp = _dealTime(beginHour, beginMinute);
|
|
|
|
if(mnd==1){//早市
|
|
|
|
mornings.add(temp);
|
|
|
|
}else if(mnd==2){//午市
|
|
|
|
noons.add(temp);
|
|
|
|
}else if(mnd==3){//晚市
|
|
|
|
nights.add(temp);
|
|
|
|
}
|
|
|
|
bool tempSelect = false;
|
|
|
|
if (int.parse(isSetDate) == 1) //设置预订时间
|
|
|
|
{
|
|
...
|
...
|
@@ -283,7 +295,6 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Map tempMap = {'title': temp, 'select': tempSelect};
|
|
|
|
res.add(tempMap);
|
|
|
|
if (temp == endDate) {
|
|
...
|
...
|
@@ -301,6 +312,77 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
//初始化早市午市晚市选中时间
|
|
|
|
initHourAndMinuteSelect(){
|
|
|
|
int timeMillsNow=DateTime.now().millisecondsSinceEpoch;
|
|
|
|
//当前选中 月 日string
|
|
|
|
String mdStr = '';
|
|
|
|
//今天 明天 其他天
|
|
|
|
for (var item in dateList) {
|
|
|
|
if (item['select'] == true) {
|
|
|
|
mdStr = item['title'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String timeNowYear = DateUtil.formatDate(DateTime.now(), format: 'yyyy');
|
|
|
|
String ymyStr = timeNowYear + '-' + mdStr; //年月日
|
|
|
|
String timeStr = ymyStr+' 00:00:00';
|
|
|
|
LogUtil.v(timeStr);
|
|
|
|
DateTime dateTime=DateUtil.getDateTime(timeStr);//当前年月日
|
|
|
|
for(var sunDate in sunDateList){
|
|
|
|
if(sunDate['isSelect']==false)continue;
|
|
|
|
switch(sunDate['key']){
|
|
|
|
case "morning"://选中早市
|
|
|
|
bool select=false;
|
|
|
|
for(var temp in dailyMap['morning']){//早市选中距离当前时间最近
|
|
|
|
temp['select']=false;
|
|
|
|
if(select)continue;//只选中第一个
|
|
|
|
if(timeMillsNow<=DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "${temp['title']}:00"))){
|
|
|
|
temp['select']=true;
|
|
|
|
select=true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case "noon"://选中午市
|
|
|
|
bool select=false;
|
|
|
|
for(var temp in dailyMap['noon']){//午市选中12:30
|
|
|
|
temp['select']=false;
|
|
|
|
if(select)continue;
|
|
|
|
if(noons.contains("12:30")&&timeMillsNow<=DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "12:30:00"))){
|
|
|
|
if(temp['title']=="12:30"){
|
|
|
|
temp['select']=true;
|
|
|
|
select=true;
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
if(timeMillsNow<=DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "${temp['title']}:00"))){
|
|
|
|
temp['select']=true;
|
|
|
|
select=true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case "night"://选中晚市
|
|
|
|
bool select=false;
|
|
|
|
for(var temp in dailyMap['night']){//晚市选中18:30
|
|
|
|
temp['select']=false;
|
|
|
|
if(select)continue;
|
|
|
|
if(nights.contains("18:30")&&timeMillsNow<=DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "18:30:00"))){
|
|
|
|
if(temp['title']=="18:30"){
|
|
|
|
temp['select']=true;
|
|
|
|
select=true;
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
if(timeMillsNow<=DateUtil.getDateMsByTimeStr(DateUtil.formatDate(dateTime).replaceRange(11,19, "${temp['title']}:00"))){
|
|
|
|
temp['select']=true;
|
|
|
|
select=true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
LogUtil.v(dailyMap);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 根据时间和分钟组装 格式:11:00
|
|
|
|
_dealTime(int begin, int mm) {
|
|
|
|
String sb = '';
|
|
...
|
...
|
@@ -559,6 +641,7 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
|
|
'type':"0",//内部预订
|
|
|
|
"rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time)
|
|
|
|
"ddate": '${ddate}'.substring(0, 10), //到店时间
|
|
|
|
'is_set_ddate':"1"
|
|
|
|
};
|
|
|
|
if(detailEntity.id.isNotEmpty&&detailEntity.id!="-1"){
|
|
|
|
params['rid']=detailEntity.id;
|
|
...
|
...
|
@@ -662,6 +745,7 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
|
|
}
|
|
|
|
}
|
|
|
|
Map<String, String> params = {
|
|
|
|
"rid":detailEntity.id,
|
|
|
|
'is_set_ddate': isSetDate,
|
|
|
|
"sid": userModel.user.sellerid, //商家ID
|
|
|
|
"tid": tableSelectInfo, //桌子ID: 格式 2,3,4
|
|
...
|
...
|
@@ -670,7 +754,7 @@ class NotebookDetailChangeModel with ChangeNotifier { |
|
|
|
"sex": sex, //预订人姓名:1:男 2:女
|
|
|
|
"phone": phoneController.text, //预订人电话
|
|
|
|
"cusdem": customController.text, //预订人需求:25汉字
|
|
|
|
'type':"1",//在线预订
|
|
|
|
"type":"0",
|
|
|
|
"rdate": rdate, //预定用餐时间范围:时间戳 开始时间戳(time)-结束时间戳(time)
|
|
|
|
"ddate": '${ddate}'.substring(0, 10), //到店时间
|
|
|
|
"ddate_solt": ddateSolt
|
...
|
...
|
|