|
|
|
import 'dart:convert';
|
|
|
|
|
|
|
|
import 'package:common_utils/common_utils.dart';
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
...
|
...
|
@@ -5,6 +7,7 @@ import 'package:flutter_easyrefresh/easy_refresh.dart'; |
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:one_key/app.dart';
|
|
|
|
import 'package:one_key/constant/state.dart';
|
|
|
|
import 'package:one_key/models/meal_day_date_model.dart';
|
|
|
|
|
|
|
|
import 'package:one_key/pages/notebook/notebook_item_f.dart';
|
|
|
|
import 'package:one_key/pages/notebook/notebook_item_f_simple.dart';
|
|
...
|
...
|
@@ -28,11 +31,17 @@ import 'package:provider/provider.dart'; |
|
|
|
import 'package:table_calendar/table_calendar.dart';
|
|
|
|
|
|
|
|
import '../../models/note_book_only_model.dart';
|
|
|
|
import '../../models/reserve_deposit_model.dart';
|
|
|
|
import '../../provider/collect_store_provider.dart';
|
|
|
|
import '../../provider/marketing_center_provider.dart';
|
|
|
|
import '../../provider/notebook_detail_model.dart';
|
|
|
|
import '../../provider/store_base_info_provider.dart';
|
|
|
|
import '../../provider/table_manage_model.dart';
|
|
|
|
import '../../utils/screen_util.dart';
|
|
|
|
import '../../widgets/loading.dart';
|
|
|
|
import '../../widgets/round_button.dart';
|
|
|
|
|
|
|
|
typedef void CancelCallback(String reseon);
|
|
|
|
|
|
|
|
class NoteBookPage extends StatefulWidget {
|
|
|
|
final int tabIndex;
|
|
...
|
...
|
@@ -88,7 +97,9 @@ class NoteBookPageState extends State<NoteBookPage> { |
|
|
|
DateTime? date;
|
|
|
|
|
|
|
|
String? solt;
|
|
|
|
|
|
|
|
late StateSetter _cancelState;
|
|
|
|
late NotebookDetailModel detailModel
|
|
|
|
;
|
|
|
|
|
|
|
|
// String? roleName =
|
|
|
|
// Provider.of<UserModel>(context, listen: false).user!.role_name;
|
|
...
|
...
|
@@ -98,12 +109,8 @@ class NoteBookPageState extends State<NoteBookPage> { |
|
|
|
// TODO: implement initState
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
|
|
|
|
date = widget.date;
|
|
|
|
date = widget.date;
|
|
|
|
solt = widget.solt;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// tabIndex = widget.tabIndex;
|
|
|
|
if (widget.tabIndex == 1) {
|
|
...
|
...
|
@@ -184,8 +191,6 @@ class NoteBookPageState extends State<NoteBookPage> { |
|
|
|
super.dispose();
|
|
|
|
bus.off("refresh_book_list");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// _calendarController.dispose();
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -669,6 +674,823 @@ class NoteBookPageState extends State<NoteBookPage> { |
|
|
|
getCheckValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
///处理在线预订
|
|
|
|
setReserveStatus(String status, NoteBookOnlySunModel notebook,
|
|
|
|
{String? desc}) async {
|
|
|
|
// bus.emit("remove_untreated_message",widget.mid);
|
|
|
|
UserModel userModel = Provider.of<UserModel>(context, listen: false);
|
|
|
|
|
|
|
|
Map<String, String?> params = {
|
|
|
|
"rid": notebook.id,
|
|
|
|
"status": status, //5安排包间 2:确认到店(到店),3:用餐完成(离店),4:取消预定,5:分配包间:6:拒单
|
|
|
|
// "uid": userModel.user.openid,
|
|
|
|
'uid': notebook.uid
|
|
|
|
};
|
|
|
|
if (status == '4') {
|
|
|
|
Map<String, String?> causeMap = {
|
|
|
|
"uid": userModel.user!.openid,
|
|
|
|
"uname": userModel.user!.nickName,
|
|
|
|
"desc": desc,
|
|
|
|
};
|
|
|
|
params["cause"] = json.encode(causeMap);
|
|
|
|
}
|
|
|
|
params['note_name'] = userModel.user!.account;
|
|
|
|
|
|
|
|
bool success = await detailModel.setReserveStatusOnly(context, params,
|
|
|
|
ifPush: false, notebook: notebook);
|
|
|
|
if (success) {
|
|
|
|
bus.emit("refresh_book_list");
|
|
|
|
if (status == "4" && notebook.phone != null && notebook.phone != '') {
|
|
|
|
getDzSellerConf(notebook.id);
|
|
|
|
// //取消预订
|
|
|
|
// bus.emit("refresh_tablemanager"); //刷新桌位
|
|
|
|
}
|
|
|
|
// if (status == "4") {
|
|
|
|
// //取消预订
|
|
|
|
// bus.emit("refresh_tablemanager"); //刷新桌位
|
|
|
|
// }
|
|
|
|
// _getReserveDetail();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
getDzSellerConf(String? rid) async {
|
|
|
|
MarketingCenterProvider marketingCenterProvider =
|
|
|
|
Provider.of<MarketingCenterProvider>(context, listen: false);
|
|
|
|
bool success = await marketingCenterProvider.getDzSellerConf(context);
|
|
|
|
if (success && marketingCenterProvider.dzSellerConfModel != null) {
|
|
|
|
bool selectSms =
|
|
|
|
marketingCenterProvider.dzSellerConfModel!.isOpenCancel == '1'
|
|
|
|
? true
|
|
|
|
: false;
|
|
|
|
|
|
|
|
if (selectSms) {
|
|
|
|
Map<String, String?> pramas = {
|
|
|
|
'rid': rid,
|
|
|
|
'sid': Provider.of<UserModel>(context, listen: false).user!.sellerid,
|
|
|
|
};
|
|
|
|
|
|
|
|
detailModel.wxSendCancelSms(context, pramas);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget _depositWidget(
|
|
|
|
List<ReserveDepositSunModel> reserveDepositList,
|
|
|
|
List<Map<String, dynamic>> depositReasonList,
|
|
|
|
FocusNode _depositNode,
|
|
|
|
TextEditingController _depositController,
|
|
|
|
CancelCallback callback) {
|
|
|
|
return Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: w(24)),
|
|
|
|
height: ScreenUtil().setWidth(48),
|
|
|
|
child: Text(
|
|
|
|
'请选择预订订金走向',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
decoration: TextDecoration.none,
|
|
|
|
color: MyColours.color_E5000000),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
VEmptyView(40),
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: w(24)),
|
|
|
|
child: Wrap(
|
|
|
|
runSpacing: w(20),
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
children: depositReasonList.map((value) {
|
|
|
|
return GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
FocusScope.of(context).requestFocus(new FocusNode());
|
|
|
|
for (var item in depositReasonList) {
|
|
|
|
item['select'] = false;
|
|
|
|
// isShowTF = false;
|
|
|
|
|
|
|
|
if (item['title'] == value['title']) {
|
|
|
|
item['select'] = true;
|
|
|
|
callback(item['title']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_cancelState(() {});
|
|
|
|
},
|
|
|
|
child: Row(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
value['select']
|
|
|
|
? 'assets/select.png'
|
|
|
|
: 'assets/unselect.png',
|
|
|
|
width: ScreenUtil().setWidth(48)),
|
|
|
|
HEmptyView(16),
|
|
|
|
value['title'] == '其他原因'
|
|
|
|
? Expanded(
|
|
|
|
child: Container(
|
|
|
|
// height: w(42),
|
|
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: MyColours.color_f3f3f3,
|
|
|
|
borderRadius: BorderRadius.circular(r(4))),
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
left: w(8), top: w(10), bottom: w(10)),
|
|
|
|
child: TextField(
|
|
|
|
maxLines: 1,
|
|
|
|
controller: _depositController,
|
|
|
|
focusNode: _depositNode,
|
|
|
|
|
|
|
|
// textAlignVertical:
|
|
|
|
// TextAlignVertical
|
|
|
|
// .bottom,
|
|
|
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
isCollapsed: true,
|
|
|
|
contentPadding: EdgeInsets.zero,
|
|
|
|
hintText: "其他",
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(30),
|
|
|
|
),
|
|
|
|
border: InputBorder.none,
|
|
|
|
),
|
|
|
|
onChanged: (value) {
|
|
|
|
// if (depositReasonList[4]['select']) {
|
|
|
|
// callback(value);
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
onEditingComplete: () {
|
|
|
|
print('fff');
|
|
|
|
_depositNode.unfocus();
|
|
|
|
},
|
|
|
|
// keyboardType: TextInputType.numberWithOptions(decimal: true),
|
|
|
|
),
|
|
|
|
))
|
|
|
|
: Container(
|
|
|
|
width: w(100),
|
|
|
|
child: Text(value['title'],
|
|
|
|
style: TextStyle(
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
fontWeight: FontWeight.normal,
|
|
|
|
decoration: TextDecoration.none,
|
|
|
|
color: MyColours.color_E5000000)))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}).toList(),
|
|
|
|
)),
|
|
|
|
VEmptyView(34),
|
|
|
|
// MyDivider(double.infinity, w(1), color: MyColours.color_E7E7E7)
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///取消预订弹框
|
|
|
|
_showCancelWidget(context, NoteBookOnlySunModel notebook,
|
|
|
|
List<ReserveDepositSunModel> reserveDepositList) {
|
|
|
|
List<Map<String, dynamic>> cancelReasonList = [
|
|
|
|
{'title': '顾客取消', 'select': false},
|
|
|
|
{'title': '顾客行程有变', 'select': false},
|
|
|
|
{'title': '操作失误', 'select': false},
|
|
|
|
{'title': '信息填写有误', 'select': false},
|
|
|
|
{'title': '其他原因', 'select': false},
|
|
|
|
];
|
|
|
|
List<Map<String, dynamic>> depositReasonList = [
|
|
|
|
{'title': '订金已退', 'select': false},
|
|
|
|
{'title': '充入会员卡', 'select': false},
|
|
|
|
{'title': '留下次使用', 'select': false},
|
|
|
|
{'title': '抵做餐费用', 'select': false},
|
|
|
|
{'title': '其他原因', 'select': false},
|
|
|
|
];
|
|
|
|
FocusNode _depositNode = FocusNode();
|
|
|
|
TextEditingController _depositController = TextEditingController();
|
|
|
|
ScrollController _scrollController = ScrollController();
|
|
|
|
|
|
|
|
FocusNode _cancelNode = FocusNode();
|
|
|
|
TextEditingController _cancelController = TextEditingController();
|
|
|
|
String? desc2 = '';
|
|
|
|
showGeneralDialog(
|
|
|
|
context: context,
|
|
|
|
barrierDismissible: false,
|
|
|
|
barrierLabel:
|
|
|
|
MaterialLocalizations.of(context).modalBarrierDismissLabel,
|
|
|
|
transitionDuration: const Duration(milliseconds: 150),
|
|
|
|
pageBuilder: (BuildContext context, Animation animation,
|
|
|
|
Animation secondaryAnimation) {
|
|
|
|
return StatefulBuilder(builder: (context, state) {
|
|
|
|
_cancelState = state;
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
body: Center(
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(40)),
|
|
|
|
// height: ScreenUtil().setWidth(421 * 2),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius.circular(ScreenUtil().setWidth(16))),
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: Card(
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(
|
|
|
|
ScreenUtil().setWidth(10)))), //设置圆角
|
|
|
|
child: Container(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
children: [
|
|
|
|
VEmptyView(48),
|
|
|
|
// Stack(
|
|
|
|
// children: [
|
|
|
|
|
|
|
|
// VEmptyView(40),
|
|
|
|
SingleChildScrollView(
|
|
|
|
controller: _scrollController,
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: w(24)),
|
|
|
|
height: ScreenUtil().setWidth(48),
|
|
|
|
child: Text(
|
|
|
|
'请选择取消原因',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
decoration: TextDecoration.none,
|
|
|
|
color: MyColours.color_E5000000),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
VEmptyView(40),
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: w(24)),
|
|
|
|
child: Wrap(
|
|
|
|
runSpacing: w(20),
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
children:
|
|
|
|
cancelReasonList.map((value) {
|
|
|
|
return GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
FocusScope.of(context)
|
|
|
|
.requestFocus(
|
|
|
|
new FocusNode());
|
|
|
|
for (var item
|
|
|
|
in cancelReasonList) {
|
|
|
|
item['select'] = false;
|
|
|
|
// isShowTF = false;
|
|
|
|
|
|
|
|
if (item['title'] ==
|
|
|
|
value['title']) {
|
|
|
|
item['select'] = true;
|
|
|
|
// if (item['title'] ==
|
|
|
|
// '其他原因') {
|
|
|
|
// isShowTF = true;
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
state(() {});
|
|
|
|
},
|
|
|
|
child: Row(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
children: [
|
|
|
|
Image.asset(
|
|
|
|
value['select']
|
|
|
|
? 'assets/select.png'
|
|
|
|
: 'assets/unselect.png',
|
|
|
|
width: ScreenUtil()
|
|
|
|
.setWidth(48)),
|
|
|
|
HEmptyView(16),
|
|
|
|
value['title'] == '其他原因'
|
|
|
|
? Expanded(
|
|
|
|
child: Container(
|
|
|
|
// height: w(42),
|
|
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: MyColours
|
|
|
|
.color_f3f3f3,
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius
|
|
|
|
.circular(
|
|
|
|
r(4))),
|
|
|
|
padding:
|
|
|
|
EdgeInsets.only(
|
|
|
|
left: w(8),
|
|
|
|
top: w(10),
|
|
|
|
bottom:
|
|
|
|
w(10)),
|
|
|
|
child: TextField(
|
|
|
|
maxLines: 1,
|
|
|
|
controller:
|
|
|
|
_cancelController,
|
|
|
|
focusNode:
|
|
|
|
_cancelNode,
|
|
|
|
|
|
|
|
// textAlignVertical:
|
|
|
|
// TextAlignVertical
|
|
|
|
// .bottom,
|
|
|
|
|
|
|
|
decoration:
|
|
|
|
InputDecoration(
|
|
|
|
isCollapsed: true,
|
|
|
|
contentPadding:
|
|
|
|
EdgeInsets
|
|
|
|
.zero,
|
|
|
|
hintText: "其他",
|
|
|
|
hintStyle:
|
|
|
|
TextStyle(
|
|
|
|
color: MyColours
|
|
|
|
.color_999999,
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil()
|
|
|
|
.setSp(
|
|
|
|
30),
|
|
|
|
),
|
|
|
|
border:
|
|
|
|
InputBorder
|
|
|
|
.none,
|
|
|
|
),
|
|
|
|
onChanged: (_) {},
|
|
|
|
onEditingComplete:
|
|
|
|
() {
|
|
|
|
print('fff');
|
|
|
|
_cancelNode
|
|
|
|
.unfocus();
|
|
|
|
},
|
|
|
|
// keyboardType: TextInputType.numberWithOptions(decimal: true),
|
|
|
|
),
|
|
|
|
))
|
|
|
|
: Container(
|
|
|
|
width: w(100),
|
|
|
|
child: Text(
|
|
|
|
value['title'],
|
|
|
|
style: TextStyle(
|
|
|
|
overflow:
|
|
|
|
TextOverflow
|
|
|
|
.ellipsis,
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil()
|
|
|
|
.setSp(
|
|
|
|
32),
|
|
|
|
fontWeight:
|
|
|
|
FontWeight
|
|
|
|
.normal,
|
|
|
|
decoration:
|
|
|
|
TextDecoration
|
|
|
|
.none,
|
|
|
|
color: MyColours
|
|
|
|
.color_E5000000)))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}).toList(),
|
|
|
|
)),
|
|
|
|
VEmptyView(34),
|
|
|
|
if (reserveDepositList.length > 0)
|
|
|
|
_depositWidget(
|
|
|
|
reserveDepositList,
|
|
|
|
depositReasonList,
|
|
|
|
_depositNode,
|
|
|
|
_depositController, (value) {
|
|
|
|
//定金走向
|
|
|
|
desc2 = value;
|
|
|
|
}),
|
|
|
|
MyDivider(double.infinity, w(1),
|
|
|
|
color: MyColours.color_E7E7E7)
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
// VEmptyView(15),
|
|
|
|
|
|
|
|
Row(
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
RoundButton(
|
|
|
|
text: '取消',
|
|
|
|
width: (ScreenUtil().screenWidth -
|
|
|
|
ScreenUtil().setWidth(62) * 2) /
|
|
|
|
2,
|
|
|
|
height: ScreenUtil().setWidth(112),
|
|
|
|
// radius: ScreenUtil().setWidth(10),
|
|
|
|
gradientStart: Colors.transparent,
|
|
|
|
gradientEnd: Colors.transparent,
|
|
|
|
textColor: MyColours.color_E6000000,
|
|
|
|
isBold: false,
|
|
|
|
fontSize: 34,
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
}),
|
|
|
|
MyDivider(ScreenUtil().setWidth(2),
|
|
|
|
ScreenUtil().setWidth(112),
|
|
|
|
color: MyColours.color_DBDBDB),
|
|
|
|
RoundButton(
|
|
|
|
text: '确定',
|
|
|
|
width: (ScreenUtil().screenWidth -
|
|
|
|
ScreenUtil().setWidth(62) * 2) /
|
|
|
|
2,
|
|
|
|
height: ScreenUtil().setWidth(112),
|
|
|
|
// radius: ScreenUtil().setWidth(10),
|
|
|
|
gradientStart: Colors.transparent,
|
|
|
|
gradientEnd: Colors.transparent,
|
|
|
|
textColor: MyColours.color_438E93,
|
|
|
|
fontSize: 34,
|
|
|
|
onPressed: () async {
|
|
|
|
String? desc = '';
|
|
|
|
for (var value in cancelReasonList) {
|
|
|
|
if (value['select'] == true) {
|
|
|
|
desc = value['title'];
|
|
|
|
if (value['title'] == '其他原因') {
|
|
|
|
desc =
|
|
|
|
_cancelController.text.trim();
|
|
|
|
if (desc.isEmpty) {
|
|
|
|
Utils.showToast("请填写取消原因");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (desc == '') {
|
|
|
|
Utils.showToast('请选择取消原因');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (reserveDepositList.length > 0) {
|
|
|
|
// for (var value in depositReasonList) {
|
|
|
|
// if (value['select'] == true) {
|
|
|
|
// desc2 = value['title'];
|
|
|
|
// if (value['title'] == '其他原因') {
|
|
|
|
// desc2 = _depositController.text
|
|
|
|
// .trim();
|
|
|
|
// if (desc2.isEmpty) {
|
|
|
|
// Utils.showToast("请填写预订订金走向");
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
if (desc2 == '') {
|
|
|
|
Utils.showToast('请选择预订订金走向');
|
|
|
|
return;
|
|
|
|
} else if (desc2 == '其他原因' &&
|
|
|
|
_depositController.text
|
|
|
|
.trim()
|
|
|
|
.length ==
|
|
|
|
0) {
|
|
|
|
Utils.showToast('请填写预订订金走向');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
Loading.showLoading(context);
|
|
|
|
|
|
|
|
await setReserveStatus(
|
|
|
|
'4',
|
|
|
|
notebook,
|
|
|
|
desc: desc,
|
|
|
|
);
|
|
|
|
|
|
|
|
if (reserveDepositList.length > 0) {
|
|
|
|
Map<String, String?> pramas = {
|
|
|
|
'rid': notebook.id,
|
|
|
|
'cancel': desc2 == '其他原因'
|
|
|
|
? _depositController.text
|
|
|
|
: desc2
|
|
|
|
};
|
|
|
|
|
|
|
|
await detailModel.setReserveDeposit(
|
|
|
|
context, pramas);
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// ///取消预订弹框
|
|
|
|
// _showCancelWidget(context, NoteBookOnlySunModel notebook) {
|
|
|
|
// // _scrollController = ScrollController();
|
|
|
|
// FocusNode _cancelNode = FocusNode();
|
|
|
|
// TextEditingController _cancelController = TextEditingController();
|
|
|
|
|
|
|
|
// /// 初始化取消原因数据
|
|
|
|
// List cancelReasonList = [];
|
|
|
|
// cancelReasonList = [
|
|
|
|
// {'title': '顾客取消', 'select': false},
|
|
|
|
// {'title': '顾客行程有变', 'select': false},
|
|
|
|
// {'title': '信息填写有误', 'select': false},
|
|
|
|
// {'title': '操作失误', 'select': false},
|
|
|
|
// {'title': '其他原因', 'select': false},
|
|
|
|
// ];
|
|
|
|
// showGeneralDialog(
|
|
|
|
// context: context,
|
|
|
|
// barrierDismissible: false,
|
|
|
|
// barrierLabel:
|
|
|
|
// MaterialLocalizations.of(context).modalBarrierDismissLabel,
|
|
|
|
// transitionDuration: const Duration(milliseconds: 150),
|
|
|
|
// barrierColor: Color.fromRGBO(0, 0, 0, 0.25),
|
|
|
|
// pageBuilder: (BuildContext context, Animation animation,
|
|
|
|
// Animation secondaryAnimation) {
|
|
|
|
// return Scaffold(
|
|
|
|
// backgroundColor: Color.fromRGBO(0, 0, 0, 0.25),
|
|
|
|
// body: StatefulBuilder(builder: (context, state) {
|
|
|
|
// // _cancelState = state;
|
|
|
|
// return GestureDetector(
|
|
|
|
// behavior: HitTestBehavior.opaque,
|
|
|
|
// // onTap: () {
|
|
|
|
// // Navigator.of(context).pop();
|
|
|
|
// // },
|
|
|
|
// child: Center(
|
|
|
|
// child: Container(
|
|
|
|
// margin: EdgeInsets.symmetric(
|
|
|
|
// horizontal: ScreenUtil().setWidth(28 * 2)),
|
|
|
|
// padding: EdgeInsets.symmetric(
|
|
|
|
// horizontal: ScreenUtil().setWidth(32)),
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
// color: Colors.white,
|
|
|
|
// borderRadius:
|
|
|
|
// BorderRadius.circular(ScreenUtil().setWidth(10)),
|
|
|
|
// ),
|
|
|
|
// height: ScreenUtil().setWidth(355 * 2),
|
|
|
|
// child: Column(
|
|
|
|
// // mainAxisSize: MainAxisSize.min,
|
|
|
|
// children: [
|
|
|
|
// // Stack(
|
|
|
|
// // children: [
|
|
|
|
// VEmptyView(48),
|
|
|
|
// Container(
|
|
|
|
// height: ScreenUtil().setWidth(48),
|
|
|
|
// child: Text(
|
|
|
|
// '是否确定取消预订',
|
|
|
|
// style: TextStyle(
|
|
|
|
// fontSize: ScreenUtil().setSp(32),
|
|
|
|
// fontWeight: FontWeight.bold,
|
|
|
|
// decoration: TextDecoration.none,
|
|
|
|
// color: Color.fromRGBO(0, 0, 0, 0.9)),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// // Positioned(
|
|
|
|
// // top: ScreenUtil().setWidth(8),
|
|
|
|
// // right: ScreenUtil().setWidth(0),
|
|
|
|
// // child: GestureDetector(
|
|
|
|
// // onTap: () {
|
|
|
|
// // _initCancel();
|
|
|
|
// // Navigator.of(context).pop();
|
|
|
|
// // },
|
|
|
|
// // child: Container(
|
|
|
|
// // padding: EdgeInsets.only(left: 20),
|
|
|
|
// // child: Image.asset(
|
|
|
|
// // 'assets/close.png',
|
|
|
|
// // width: ScreenUtil().setWidth(32),
|
|
|
|
// // height: ScreenUtil().setWidth(32),
|
|
|
|
// // ),
|
|
|
|
// // )))
|
|
|
|
// // ],
|
|
|
|
// // ),
|
|
|
|
// VEmptyView(40),
|
|
|
|
// Container(
|
|
|
|
// child: Column(
|
|
|
|
// // mainAxisSize: MainAxisSize.min,
|
|
|
|
// children: cancelReasonList.map((value) {
|
|
|
|
// return value['title'] == '其他原因'
|
|
|
|
// ? SizedBox()
|
|
|
|
// : GestureDetector(
|
|
|
|
// onTap: () {
|
|
|
|
// for (var item in cancelReasonList) {
|
|
|
|
// item['select'] = false;
|
|
|
|
// // isShowTF = false;
|
|
|
|
// // paddingBottom =
|
|
|
|
// // ScreenUtil().screenHeight.ceil() -
|
|
|
|
// // 138 -
|
|
|
|
// // 340;
|
|
|
|
// if (item['title'] ==
|
|
|
|
// value['title']) {
|
|
|
|
// item['select'] = true;
|
|
|
|
// // if (item['title'] == '其他原因') {
|
|
|
|
// // // isShowTF = true;
|
|
|
|
// // // paddingBottom = 130;
|
|
|
|
// // // paddingBottom =
|
|
|
|
// // // ScreenUtil().screenHeight.ceil() -
|
|
|
|
// // // 138 -
|
|
|
|
// // // 340 -
|
|
|
|
// // // 46;
|
|
|
|
// // }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// state(() {});
|
|
|
|
// },
|
|
|
|
// child: Container(
|
|
|
|
// height: ScreenUtil().setWidth(48),
|
|
|
|
// margin: EdgeInsets.only(
|
|
|
|
// bottom:
|
|
|
|
// ScreenUtil().setWidth(40)),
|
|
|
|
// child: Row(
|
|
|
|
// children: [
|
|
|
|
// Image.asset(
|
|
|
|
// value['select']
|
|
|
|
// ? 'assets/select.png'
|
|
|
|
// : 'assets/unselect.png',
|
|
|
|
// width: ScreenUtil()
|
|
|
|
// .setWidth(42)),
|
|
|
|
// HEmptyView(20),
|
|
|
|
// Container(
|
|
|
|
// child: Text(value['title'],
|
|
|
|
// style: TextStyle(
|
|
|
|
// fontSize: ScreenUtil()
|
|
|
|
// .setSp(32),
|
|
|
|
// fontWeight:
|
|
|
|
// FontWeight.normal,
|
|
|
|
// decoration:
|
|
|
|
// TextDecoration
|
|
|
|
// .none,
|
|
|
|
// color: MyColours
|
|
|
|
// .color_333333)))
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// );
|
|
|
|
// }).toList(),
|
|
|
|
// )),
|
|
|
|
// Material(
|
|
|
|
// child: Container(
|
|
|
|
// color: Colors.white,
|
|
|
|
// height: ScreenUtil().setWidth(42 * 2),
|
|
|
|
// child: Row(children: [
|
|
|
|
// InkWell(
|
|
|
|
// onTap: () {
|
|
|
|
// for (var item in cancelReasonList) {
|
|
|
|
// item['select'] = false;
|
|
|
|
// }
|
|
|
|
// cancelReasonList[4]['select'] =
|
|
|
|
// true;
|
|
|
|
// state(() {});
|
|
|
|
// },
|
|
|
|
// child: Padding(
|
|
|
|
// padding: EdgeInsets.only(
|
|
|
|
// right: ScreenUtil()
|
|
|
|
// .setWidth(20)),
|
|
|
|
// child: Image.asset(
|
|
|
|
// cancelReasonList[4]['select']
|
|
|
|
// ? 'assets/select.png'
|
|
|
|
// : 'assets/unselect.png',
|
|
|
|
// width: ScreenUtil()
|
|
|
|
// .setWidth(44)))),
|
|
|
|
// Expanded(
|
|
|
|
// child: Container(
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
// color: Color.fromRGBO(
|
|
|
|
// 240, 240, 240, 1),
|
|
|
|
// borderRadius: BorderRadius.circular(
|
|
|
|
// ScreenUtil().setWidth(8))),
|
|
|
|
// // height: ScreenUtil().setWidth(42 * 2),
|
|
|
|
// padding: EdgeInsets.symmetric(
|
|
|
|
// horizontal:
|
|
|
|
// ScreenUtil().setWidth(16)),
|
|
|
|
// child: TextField(
|
|
|
|
// maxLines: 1,
|
|
|
|
// controller: _cancelController,
|
|
|
|
// focusNode: _cancelNode,
|
|
|
|
// style: TextStyle(
|
|
|
|
// textBaseline:
|
|
|
|
// TextBaseline.alphabetic),
|
|
|
|
// textAlignVertical:
|
|
|
|
// TextAlignVertical.center,
|
|
|
|
// decoration: InputDecoration(
|
|
|
|
// contentPadding: EdgeInsets.zero,
|
|
|
|
// hintText: "其他",
|
|
|
|
// // focusColor: Color.fromRGBO(0, 0, 0, 0.4),
|
|
|
|
// hintStyle: TextStyle(
|
|
|
|
// color:
|
|
|
|
// Color.fromRGBO(0, 0, 0, 0.4),
|
|
|
|
// fontSize: ScreenUtil().setSp(32),
|
|
|
|
// ),
|
|
|
|
// enabledBorder: OutlineInputBorder(
|
|
|
|
// borderSide: BorderSide(
|
|
|
|
// width: 0,
|
|
|
|
// color: Colors.transparent)),
|
|
|
|
// border: OutlineInputBorder(
|
|
|
|
// borderSide: BorderSide(
|
|
|
|
// width: 0,
|
|
|
|
// color: Colors.transparent)),
|
|
|
|
// focusedBorder: OutlineInputBorder(
|
|
|
|
// borderSide: BorderSide(
|
|
|
|
// width: 0,
|
|
|
|
// color: Colors.transparent)),
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// // border: InputBorder.none,
|
|
|
|
|
|
|
|
// onChanged: (_) {
|
|
|
|
// setState(() {});
|
|
|
|
// },
|
|
|
|
// onEditingComplete: () {
|
|
|
|
// print('fff');
|
|
|
|
// _cancelNode.unfocus();
|
|
|
|
// },
|
|
|
|
// // keyboardType: TextInputType.numberWithOptions(decimal: true),
|
|
|
|
// ),
|
|
|
|
// ))
|
|
|
|
// ]))),
|
|
|
|
|
|
|
|
// VEmptyView(15),
|
|
|
|
// Material(
|
|
|
|
// child: RoundButton(
|
|
|
|
// onPressed: () {
|
|
|
|
// String? desc = '';
|
|
|
|
// for (var value in cancelReasonList) {
|
|
|
|
// if (value['select'] == true) {
|
|
|
|
// desc = value['title'];
|
|
|
|
// if (value['title'] == '其他原因') {
|
|
|
|
// desc = _cancelController.text.trim();
|
|
|
|
// if (desc.isEmpty) {
|
|
|
|
// Utils.showToast("请填写原因");
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
// if (desc == '') {
|
|
|
|
// Utils.showToast('请选择原因');
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
// Loading.showLoading(context);
|
|
|
|
|
|
|
|
// setReserveStatus(
|
|
|
|
// '4',
|
|
|
|
// notebook,
|
|
|
|
// desc: desc,
|
|
|
|
// );
|
|
|
|
// },
|
|
|
|
// text: '确认',
|
|
|
|
// height: ScreenUtil().setWidth(80),
|
|
|
|
// width: ScreenUtil().setWidth(300),
|
|
|
|
// radius: ScreenUtil().setWidth(10),
|
|
|
|
// ),
|
|
|
|
// )
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ));
|
|
|
|
// }));
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
|
|
|
|
_getIsReserveCancel(bool isCancel, NoteBookOnlySunModel notebook) {
|
|
|
|
//判断时间是否可变更
|
|
|
|
|
|
|
|
bool reserveCancel = true; //默认允许变更过去餐段订单的时间
|
|
|
|
//如果不允许变更过去餐段订单的时间,则开始判断
|
|
|
|
//连个条件同时成立: 1.订单的时间是过去 2. 时间改变
|
|
|
|
if (!isCancel) {
|
|
|
|
//找到当前餐段对应的时间段
|
|
|
|
|
|
|
|
String? times = storeBaseIndoProvider.dayDateData!
|
|
|
|
.where((element) => element.ddateSolt == notebook.ddateSolt)
|
|
|
|
.first
|
|
|
|
.mdate ??
|
|
|
|
'00:00-23:59';
|
|
|
|
|
|
|
|
//组装时间戳
|
|
|
|
List<String> datas = times.split('-');
|
|
|
|
// DateTime selectStime = DateTime.parse('${dateTimeSelect.year}' +
|
|
|
|
// '-' +
|
|
|
|
// '${dateTimeSelect.month}' +
|
|
|
|
// '-' +
|
|
|
|
// '${dateTimeSelect.day}' +
|
|
|
|
// ' ${datas[0]}:00'); //选中餐段开始时间戳
|
|
|
|
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(
|
|
|
|
int.parse(notebook.ddate!) * 1000);
|
|
|
|
DateTime selectEtime = DateTime.parse('${dateTime.year}' +
|
|
|
|
'-' +
|
|
|
|
Utils.addZeroNumber(dateTime.month) +
|
|
|
|
'-' +
|
|
|
|
Utils.addZeroNumber(dateTime.day) +
|
|
|
|
' ${datas[1]}:00'); //选中餐段结束时间戳
|
|
|
|
// 过去的餐段界定
|
|
|
|
if (selectEtime.isBefore(DateTime.now())) {
|
|
|
|
// 属于过去餐段
|
|
|
|
reserveCancel = false;
|
|
|
|
} else {
|
|
|
|
// 属于未来餐段
|
|
|
|
reserveCancel = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return reserveCancel;
|
|
|
|
}
|
|
|
|
|
|
|
|
List<Widget> dsoltWidget() {
|
|
|
|
List<Widget> data = [];
|
|
|
|
storeBaseIndoProvider.dayDateData!.forEach((element) {
|
|
...
|
...
|
@@ -747,6 +1569,105 @@ class NoteBookPageState extends State<NoteBookPage> { |
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 通过预订ID查收订金详情
|
|
|
|
_getReserveDepositByRid(String rid) async {
|
|
|
|
|
|
|
|
Map<String, String> params = {
|
|
|
|
'rid': rid,
|
|
|
|
};
|
|
|
|
|
|
|
|
await detailModel.getReserveDepositByRid(context, params,
|
|
|
|
showLoading: true);
|
|
|
|
List<ReserveDepositSunModel> reserveDepositList = [];
|
|
|
|
detailModel.reserveDepositList!.forEach((element) {
|
|
|
|
if (element.payType != '微信预订通知') {
|
|
|
|
reserveDepositList.add(element);
|
|
|
|
} else if (element.payType == '微信预订通知' &&
|
|
|
|
element.tradeState == 'SUCCESS') {
|
|
|
|
reserveDepositList.add(element);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return reserveDepositList;
|
|
|
|
}
|
|
|
|
|
|
|
|
_cancelReaserve(NoteBookOnlySunModel notebook) async {
|
|
|
|
bool isCancel = _getIsReserveCancel(isReserveCancel, notebook);
|
|
|
|
|
|
|
|
if (isCancel) {
|
|
|
|
bool cancelCan = false;
|
|
|
|
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(
|
|
|
|
int.parse(notebook.ddate!) * 1000);
|
|
|
|
String roleName =
|
|
|
|
Provider.of<UserModel>(context, listen: false).user!.role_name ?? '';
|
|
|
|
|
|
|
|
if (roleName == '管理员' || roleName == '前台') {
|
|
|
|
cancelCan = true;
|
|
|
|
} else if (roleName == '店长') {
|
|
|
|
if (cancelShopowner) {
|
|
|
|
cancelCan = true;
|
|
|
|
} else {
|
|
|
|
//临餐不可以取消
|
|
|
|
|
|
|
|
//比较相差的天数
|
|
|
|
|
|
|
|
int differenceSeconds = dateTime.difference(DateTime.now()).inSeconds;
|
|
|
|
|
|
|
|
if (int.parse(cancelDay!) != 0 &&
|
|
|
|
differenceSeconds < int.parse(cancelDay!) * 24 * 60 * 60) {
|
|
|
|
// 临餐时间内
|
|
|
|
cancelCan = false;
|
|
|
|
} else {
|
|
|
|
cancelCan = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (roleName == '客户经理') {
|
|
|
|
if (cancelManager) {
|
|
|
|
cancelCan = true;
|
|
|
|
} else {
|
|
|
|
//临餐不可以取消
|
|
|
|
|
|
|
|
//比较相差的天数
|
|
|
|
int differenceSeconds = dateTime.difference(DateTime.now()).inSeconds;
|
|
|
|
|
|
|
|
if (int.parse(cancelDay!) != 0 &&
|
|
|
|
differenceSeconds < int.parse(cancelDay!) * 24 * 60 * 60) {
|
|
|
|
// 临餐时间内
|
|
|
|
cancelCan = false;
|
|
|
|
} else {
|
|
|
|
cancelCan = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (cancelOther) {
|
|
|
|
cancelCan = true;
|
|
|
|
} else {
|
|
|
|
//临餐不可以取消
|
|
|
|
|
|
|
|
//比较相差的天数
|
|
|
|
|
|
|
|
int differenceSeconds = dateTime.difference(DateTime.now()).inSeconds;
|
|
|
|
|
|
|
|
if (int.parse(cancelDay!) != 0 &&
|
|
|
|
differenceSeconds < int.parse(cancelDay!) * 24 * 60 * 60) {
|
|
|
|
// 临餐时间内
|
|
|
|
cancelCan = false;
|
|
|
|
} else {
|
|
|
|
cancelCan = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (cancelCan) {
|
|
|
|
List<ReserveDepositSunModel> reserveDepositList =
|
|
|
|
await _getReserveDepositByRid(notebook.id!);
|
|
|
|
_showCancelWidget(context, notebook, reserveDepositList);
|
|
|
|
} else {
|
|
|
|
Utils.showToast('临餐不可取消预订!请与前台联系取消。');
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
Utils.showToast('过去餐段的订单不可取消预订!请与前台联系取消。');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
// TODO: implement build
|
|
...
|
...
|
@@ -756,6 +1677,8 @@ class NoteBookPageState extends State<NoteBookPage> { |
|
|
|
Provider.of<StoreBaseIndoProvider>(context, listen: true);
|
|
|
|
collectStoreProvider =
|
|
|
|
Provider.of<CollectStoreProvider>(context, listen: true);
|
|
|
|
|
|
|
|
detailModel = Provider.of<NotebookDetailModel>(context, listen: true);
|
|
|
|
// int sum = 3;
|
|
|
|
// int hide = 0;
|
|
|
|
// int btnNum = 0;
|
|
...
|
...
|
@@ -1303,28 +2226,47 @@ class NoteBookPageState extends State<NoteBookPage> { |
|
|
|
child: model.notebooksSort![index].issimple
|
|
|
|
? NoteBookItemSimple(
|
|
|
|
index, model.notebooksSort![index],
|
|
|
|
() {
|
|
|
|
onTapChange: () {
|
|
|
|
_itemChangeSimple(
|
|
|
|
model.notebooksSort![index]);
|
|
|
|
},
|
|
|
|
cancelDay,
|
|
|
|
cancelShopowner,
|
|
|
|
cancelManager,
|
|
|
|
cancelOther,
|
|
|
|
isReserveCancel)
|
|
|
|
}, onTapLeave: () {
|
|
|
|
Loading.showLoading(context);
|
|
|
|
setReserveStatus(
|
|
|
|
'3', model.notebooksSort![index]);
|
|
|
|
}, onTapReach: () {
|
|
|
|
Loading.showLoading(context);
|
|
|
|
setReserveStatus(
|
|
|
|
'2', model.notebooksSort![index]);
|
|
|
|
}, onTapCancel: () {
|
|
|
|
_cancelReaserve(
|
|
|
|
model.notebooksSort![index]);
|
|
|
|
})
|
|
|
|
: NoteBookItemF(
|
|
|
|
index,
|
|
|
|
model.notebooksSort![index],
|
|
|
|
collectStoreProvider.sellerPreserve,
|
|
|
|
() {
|
|
|
|
onTapChange: () {
|
|
|
|
_itemChangeSimple(
|
|
|
|
model.notebooksSort![index]);
|
|
|
|
},
|
|
|
|
cancelDay,
|
|
|
|
cancelShopowner,
|
|
|
|
cancelManager,
|
|
|
|
cancelOther,
|
|
|
|
isReserveCancel),
|
|
|
|
}, onTapLeave: () {
|
|
|
|
Loading.showLoading(context);
|
|
|
|
setReserveStatus(
|
|
|
|
'3', model.notebooksSort![index]);
|
|
|
|
}, onTapReach: () {
|
|
|
|
Loading.showLoading(context);
|
|
|
|
setReserveStatus(
|
|
|
|
'2', model.notebooksSort![index]);
|
|
|
|
}, onTapCancel: () {
|
|
|
|
_cancelReaserve(
|
|
|
|
model.notebooksSort![index]);
|
|
|
|
}
|
|
|
|
|
|
|
|
// cancelDay,
|
|
|
|
// cancelShopowner,
|
|
|
|
// cancelManager,
|
|
|
|
// cancelOther,
|
|
|
|
// isReserveCancel
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}, childCount: model.notebooksSort!.length),
|
|
|
|
// itemExtent: ScreenUtil().setWidth(112),
|
...
|
...
|
|