Commit f25bdcccdf257fb3e25762b14220a796f09e3872

Authored by weixin_45529955
1 parent 7937c37b

确定变更预订之前提示变更前变更后信息

... ... @@ -111,6 +111,9 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> {
bool isSetOver = true;
bool isReserveOver = true;
bool cancelCan = true;
String oldInfo = '';
@override
void initState() {
super.initState();
... ... @@ -307,6 +310,9 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> {
_notebookDetailChangeModel.initSexList();
DateTime createtime = DateTime.fromMillisecondsSinceEpoch(
int.parse(detailEntity!.ddate.toString() + '000'));
await _initDateList(detailEntity!); //获取到订单时间
currTimeIndex = int.parse(detailEntity!.ddate_solt!);
_initData();
... ... @@ -316,6 +322,25 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> {
detailEntity!.ddate_solt,
detailEntity!.pnum,
detailEntity!.tables);
oldInfo = _returnOldDayDateWeek(createtime);
oldInfo += ' ${detailEntity!.mname!}';
String result = '';
detailEntity!.tables!.forEach((element) {
result += element!.name! + '、';
});
if (result.endsWith('、')) {
result = result.substring(0, result.length - 1);
}
oldInfo += ' ${result}';
// oldInfo = detailEntity!.ddateYMD + detailEntity!.tableinfoStr;
print(oldInfo);
}
/// 早市、午市、晚市对应的半个小时间隔时间段
... ... @@ -400,6 +425,31 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> {
return date;
}
String _returnOldDayDateWeek(DateTime day) {
String date = '';
DateTime dateNow = DateTime.now();
dateShowNow = "";
// if (Utils.isOneDay(day, dateNow)) {
// dateShowNow = "今天 ";
// } else if (Utils.isOneDay(day, dateNow.add(Duration(days: 1)))) {
// dateShowNow = "明天 ";
// } else if (Utils.isOneDay(day, dateNow.add(Duration(days: 2)))) {
// dateShowNow = "后天 ";
// }
String ymd = "${day.year}年" +
Utils.addZeroNumber(day.month) +
"月" +
Utils.addZeroNumber(day.day) +
'日';
date += ymd;
// date += ' ';
// date += Utils.lunarCalendarHolidays(day)!;
// date += ' ';
date += "星期${Utils.formatWeekDayNum(day.weekday)}";
return date;
}
@override
void dispose() {
_nameNode.unfocus();
... ... @@ -2365,132 +2415,184 @@ class _NoteBookChangeFPageOnlyState extends State<NoteBookChangeFPageOnly> {
return;
}
}
//提示客户是否确定变更
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
print(detailEntity!.uid);
String? times = '00:00-00:00';
String newInfo = '';
newInfo = _returnOldDayDateWeek(dateTime);
//找到当前餐段对应的时间段
int index = storeBaseIndoProvider.dayDateData!
.indexWhere((element) =>
element.ddateSolt ==
'${currTimeIndex}');
String mname = '';
if (index != -1) {
times = storeBaseIndoProvider
.dayDateData![index].mdate;
mname = storeBaseIndoProvider
.dayDateData![index].mname ??
'';
}
newInfo += ' ${mname}';
String result = '';
_notebookDetailChangeModel.tableListOrReserve!
.forEach((element) {
result += element.name! + '、';
});
if (result.endsWith('、')) {
result =
result.substring(0, result.length - 1);
}
SunReserveInfoModel? _model =
_notebookDetailChangeModel
.detailEntity!.type ==
"1"
? //判断是否在线预订
await _notebookDetailChangeModel
.updateOnlineReserveInfoOnly(
context,
nameStr,
detailEntity!.uid,
currTimeIndex,
dateTime,
times)
: await _notebookDetailChangeModel
.setReserveInfoOnly(
context,
nameStr,
detailEntity!.uid,
currTimeIndex,
dateTime,
times);
if (_model != null) {
if (ObjectUtil.isNotEmpty(_model.row) ||
ObjectUtil.isNotEmpty(_model.row!.id)) {
print('成功');
// _notebookDetailChangeModel.clearData();
bus.emit("refresh_detail");
bus.emit("refresh_book_list"); //刷新已预订列表
if (widget.back!) {
EventBus().emit(
"refresh_invitaion_info"); //刷新预订安排页面
if (Navigator.canPop(context)) {
Navigator.pop(context);
newInfo += ' ${result}';
// oldInfo = detailEntity!.ddateYMD + detailEntity!.tableinfoStr;
print(newInfo);
DialogUtil.cupertinoAlertDialogChangeReseve(
context,
title: '',
// content1:
// '确定要将${oldInfo}的预订 变更为 ${newInfo}?',
contentold: oldInfo,
contentnew: newInfo,
lTitle: '取消',
lCallback: () {},
rTitle: '确定变更', rCallback: () async {
print(detailEntity!.uid);
String? times = '00:00-00:00';
//找到当前餐段对应的时间段
int index = storeBaseIndoProvider.dayDateData!
.indexWhere((element) =>
element.ddateSolt ==
'${currTimeIndex}');
if (index != -1) {
times = storeBaseIndoProvider
.dayDateData![index].mdate;
}
SunReserveInfoModel? _model =
_notebookDetailChangeModel
.detailEntity!.type ==
"1"
? //判断是否在线预订
await _notebookDetailChangeModel
.updateOnlineReserveInfoOnly(
context,
nameStr,
detailEntity!.uid,
currTimeIndex,
dateTime,
times)
: await _notebookDetailChangeModel
.setReserveInfoOnly(
context,
nameStr,
detailEntity!.uid,
currTimeIndex,
dateTime,
times);
if (_model != null) {
if (ObjectUtil.isNotEmpty(_model.row) ||
ObjectUtil.isNotEmpty(_model.row!.id)) {
print('成功');
// _notebookDetailChangeModel.clearData();
bus.emit("refresh_detail");
bus.emit("refresh_book_list"); //刷新已预订列表
if (widget.back!) {
EventBus().emit(
"refresh_invitaion_info"); //刷新预订安排页面
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
} else {
// String ddate_solt = '';
// if (_model.row!.isSetDdate == '1') {
// String createtime =
// _model.row!.ddate.toString() +
// '000';
// DateTime createTime =
// DateTime.fromMillisecondsSinceEpoch(
// int.parse(createtime));
// // ddate_solt = DateUtil.formatDate(
// // createTime,
// // format: DateFormats.h_m);
// } else {
// // if (_model.row!.ddateSolt == '1') {
// // ddate_solt = '早餐';
// // } else if (_model.row!.ddateSolt ==
// // '2') {
// // ddate_solt = '午餐';
// // } else if (_model.row!.ddateSolt ==
// // '3') {
// // ddate_solt = '晚餐';
// // }
// }
List<dynamic> tableinfo = convert
.jsonDecode(_model.row!.tableinfo!);
print(tableinfo);
// if (tableinfo.length > 1) {
// _nameStr =
// t.TableList.fromJson(tableinfo[0]).name +
// '等${tableinfo.length}桌';
// }
String _nameStr = '';
String _tid = '';
for (int i = 0;
i < tableinfo.length;
i++) {
_nameStr +=
'${t.TableList.fromJson(tableinfo[i]).name},';
_tid +=
'${t.TableList.fromJson(tableinfo[i]).id},';
}
if (_tid.endsWith(',')) {
_tid = _tid.substring(
0, _tid.length - 1);
}
if (_nameStr.endsWith(',')) {
_nameStr = _nameStr.substring(
0, _nameStr.length - 1);
}
LogUtil.v(_nameStr);
NavigatorUtil.goInvicationPage(
context, _model.row!.id,
// _nameStr,
// _model.row.ddate,
// ddate_solt,
// _model.row.phone,
// _model.row.ddateSolt,
// _model.row.rname == null
// ? ''
// : _model.row.rname,
// _model.row.sex == null ? '' : _model.row.sex,
// _model.row.cusdem,
// tid: _tid,
replace: true);
}
EventBus()
.emit("refresh_tablemanager"); //刷新桌位
EventBus()
.emit("refresh_detail"); //刷新订座详情页
EventBus()
.emit("refresh_action_log"); //获取变更记录
} else {
// String ddate_solt = '';
// if (_model.row!.isSetDdate == '1') {
// String createtime =
// _model.row!.ddate.toString() +
// '000';
// DateTime createTime =
// DateTime.fromMillisecondsSinceEpoch(
// int.parse(createtime));
// // ddate_solt = DateUtil.formatDate(
// // createTime,
// // format: DateFormats.h_m);
// } else {
// // if (_model.row!.ddateSolt == '1') {
// // ddate_solt = '早餐';
// // } else if (_model.row!.ddateSolt ==
// // '2') {
// // ddate_solt = '午餐';
// // } else if (_model.row!.ddateSolt ==
// // '3') {
// // ddate_solt = '晚餐';
// // }
// }
List<dynamic> tableinfo = convert
.jsonDecode(_model.row!.tableinfo!);
print(tableinfo);
// if (tableinfo.length > 1) {
// _nameStr =
// t.TableList.fromJson(tableinfo[0]).name +
// '等${tableinfo.length}桌';
// }
String _nameStr = '';
String _tid = '';
for (int i = 0;
i < tableinfo.length;
i++) {
_nameStr +=
'${t.TableList.fromJson(tableinfo[i]).name},';
_tid +=
'${t.TableList.fromJson(tableinfo[i]).id},';
}
if (_tid.endsWith(',')) {
_tid =
_tid.substring(0, _tid.length - 1);
}
if (_nameStr.endsWith(',')) {
_nameStr = _nameStr.substring(
0, _nameStr.length - 1);
}
LogUtil.v(_nameStr);
NavigatorUtil.goInvicationPage(
context, _model.row!.id,
// _nameStr,
// _model.row.ddate,
// ddate_solt,
// _model.row.phone,
// _model.row.ddateSolt,
// _model.row.rname == null
// ? ''
// : _model.row.rname,
// _model.row.sex == null ? '' : _model.row.sex,
// _model.row.cusdem,
// tid: _tid,
replace: true);
Utils.showToast(detailEntity!.id == "-1"
? "录入预订订单失败,请重试!"
: "变更预订订单失败,请重试!");
}
EventBus()
.emit("refresh_tablemanager"); //刷新桌位
EventBus().emit("refresh_detail"); //刷新订座详情页
EventBus()
.emit("refresh_action_log"); //获取变更记录
} else {
Utils.showToast(detailEntity!.id == "-1"
? "录入预订订单失败,请重试!"
: "变更预订订单失败,请重试!");
}
}
});
},
),
HEmptyView(30),
... ...
... ... @@ -11821,6 +11821,89 @@ class DialogUtil {
);
}
static cupertinoAlertDialogChangeReseve(BuildContext context,
{String title = "",
String contentold = "内容",
String contentnew = "内容",
String lTitle = "取消",
String rTitle = "确定",
Color rColor = MyColours.color_438E93,
bool isBold = false,
bool isBoldContent = false,
bool showlTitle = true,
Color contentColor = MyColours.color_99000000,
VoidCallback? lCallback,
TextAlign textAlign = TextAlign.center,
VoidCallback? rCallback}) {
showCupertinoDialog(
context: context,
builder: (context) {
return CupertinoAlertDialog(
title: title != ''
? Text(title,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_E6000000))
: SizedBox(),
content: RichText(
text: TextSpan(
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
),
children: [
TextSpan(
text: '确定要将', style: TextStyle(color: contentColor)),
TextSpan(
text: contentold,
style: TextStyle(color: MyColours.color_438E93)),
TextSpan(text: '的预订变更为', style: TextStyle(color: contentColor)),
TextSpan(
text: contentnew,
style: TextStyle(color: MyColours.color_438E93)),
TextSpan(text: '?', style: TextStyle(color: contentColor)),
])),
// content: Text(content,
// textAlign: textAlign,
// style: TextStyle(
// fontWeight:
// isBoldContent ? FontWeight.bold : FontWeight.normal,
// fontSize: ScreenUtil().setSp(30),
// color: contentColor)),
actions: [
if (showlTitle)
CupertinoDialogAction(
child: Text(lTitle,
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_E6000000)),
onPressed: () {
Navigator.of(context).pop();
if (lCallback != null) {
lCallback();
}
},
),
CupertinoDialogAction(
child: Text(rTitle,
style: TextStyle(
fontWeight: isBold ? FontWeight.bold : FontWeight.normal,
fontSize: ScreenUtil().setSp(32),
color: rColor)),
onPressed: () {
Navigator.of(context).pop();
if (rCallback != null) {
rCallback();
}
},
),
],
);
},
);
}
static Future festivalAlertDialog(
BuildContext context, String name, double height,
{CustomCallBack? rCallback,
... ... @@ -12196,7 +12279,8 @@ class DialogUtil {
.getYear()
.toString();
monthStr = currentLunarTime
.getMonth().abs()
.getMonth()
.abs()
.toString();
dayStr = currentLunarTime
.getDay()
... ...