|
...
|
...
|
@@ -87,6 +87,7 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
SmsInfoData smsInfoData;
|
|
|
|
MyModel myModel;
|
|
|
|
|
|
|
|
String smsErro = '';
|
|
|
|
String showErro = '';
|
|
|
|
|
|
|
|
// ScrollController _scrollCrl = ScrollController();
|
|
...
|
...
|
@@ -121,6 +122,10 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
///刷新图片显示
|
|
|
|
_refreshTablePhoto();
|
|
|
|
});
|
|
|
|
EventBus().on("refresh_table_m_coupon", (arg) {
|
|
|
|
///刷新优惠券
|
|
|
|
_couponNetworkData();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -130,17 +135,22 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
super.dispose();
|
|
|
|
EventBus().off("refresh_tablemanager");
|
|
|
|
EventBus().off("refresh_tablePhoto");
|
|
|
|
EventBus().off("refresh_table_m_coupon");
|
|
|
|
}
|
|
|
|
|
|
|
|
///获取短信余量
|
|
|
|
_getSmsInfo(context) async {
|
|
|
|
smsInfoData = await myModel.getSmsInfo(context);
|
|
|
|
if (myModel.smsInfo.isEmpty) {
|
|
|
|
if (myModel.smsInfo == '0') {
|
|
|
|
setState(() {
|
|
|
|
showErro = '短信余额不足,请充值短信条数';
|
|
|
|
smsErro = '短信余额不足,请充值短信条数';
|
|
|
|
showErro = smsErro;
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
showErro = '';
|
|
|
|
setState(() {
|
|
|
|
smsErro = '';
|
|
|
|
showErro = '';
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// setState(() {
|
|
...
|
...
|
@@ -827,6 +837,9 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
if (value != null) {
|
|
|
|
sexSelectIndex = value.first;
|
|
|
|
sexStr = list[sexSelectIndex];
|
|
|
|
if (nameStr != null && nameStr != '') {
|
|
|
|
_addNameSuffix(nameStr, sexStr);
|
|
|
|
}
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
}, selecteds: [sexSelectIndex])
|
|
...
|
...
|
@@ -917,6 +930,7 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
title: '人数',
|
|
|
|
selecteds:
|
|
|
|
actualPnumIndex ==
|
|
|
|
null
|
|
...
|
...
|
@@ -983,6 +997,7 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
title: '到店时间',
|
|
|
|
selecteds:
|
|
|
|
ddateIndex == null
|
|
|
|
? []
|
|
...
|
...
|
@@ -1236,19 +1251,53 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
color: Colors.transparent),
|
|
|
|
child: _buttonChoose(youhui, (value) {
|
|
|
|
if (couponsCan == null || couponsCan.length == 0) {
|
|
|
|
Utils.showToast('暂无优惠券!');
|
|
|
|
Utils.showToast('暂无优惠券,请创建新优惠');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
|
|
|
|
DialogUtil.showSelectCusmanDialog(context, couponsCan,
|
|
|
|
DialogUtil.showSelectCusmanDialog(
|
|
|
|
context,
|
|
|
|
couponsCan,
|
|
|
|
(value) {
|
|
|
|
if (value != null) {
|
|
|
|
setState(() {
|
|
|
|
couponSelectIndex = value.first;
|
|
|
|
youhui = couponsCan[couponSelectIndex];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
if (value != null) {
|
|
|
|
setState(() {
|
|
|
|
couponSelectIndex = value.first;
|
|
|
|
youhui = couponsCan[couponSelectIndex];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
title: '选择优惠',
|
|
|
|
cancelText: '新增优惠',
|
|
|
|
cancelTextColor: MyColours.color_438E93,
|
|
|
|
onCancel: () async {
|
|
|
|
UserModel userModel = Provider.of<UserModel>(
|
|
|
|
context,
|
|
|
|
listen: false);
|
|
|
|
if (userModel.user.role_name == '管理员' ||
|
|
|
|
userModel.user.role_name == '店长') {
|
|
|
|
NavigatorUtil.goCouponCreateSelectTypePage(
|
|
|
|
context);
|
|
|
|
} else {
|
|
|
|
bool needRefresh =
|
|
|
|
await NavigatorUtil.goCouponEditPage(
|
|
|
|
context);
|
|
|
|
print(needRefresh);
|
|
|
|
if (needRefresh != null && needRefresh) {
|
|
|
|
_couponNetworkData();
|
|
|
|
//刷新页面数据
|
|
|
|
// _controller.callRefresh();
|
|
|
|
// _couponNetworkData(tabController.index);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// NavigatorUtil.goMarketingRecordsDetailPage(context);
|
|
|
|
// bool needRefresh = await NavigatorUtil.goCouponEditPage(context);
|
|
|
|
// print(needRefresh);
|
|
|
|
// if (needRefresh != null && needRefresh) {
|
|
|
|
// //刷新页面数据
|
|
|
|
// // _controller.callRefresh();
|
|
|
|
// _couponNetworkData();
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
selecteds: couponSelectIndex == null
|
|
|
|
? []
|
|
|
|
: [couponSelectIndex])
|
|
...
|
...
|
@@ -1430,6 +1479,7 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
in tableManagerModel.tablesShow) {
|
|
|
|
if (item.id == table.id) {
|
|
|
|
item.selected = false;
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (t.Table item
|
|
...
|
...
|
@@ -1439,9 +1489,9 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
.name]) {
|
|
|
|
if (item.id == table.id) {
|
|
|
|
item.selected = false;
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
// color: Colors.red,
|
|
...
|
...
|
@@ -1674,9 +1724,12 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
radius: ScreenUtil().setWidth(8),
|
|
|
|
isBold: false,
|
|
|
|
onPressed: () async {
|
|
|
|
if (myModel.smsInfo.isEmpty) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// if (myModel.smsInfo == '0') {
|
|
|
|
// setState(() {
|
|
|
|
// showErro = smsErro;
|
|
|
|
// });
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
if ((_baseIndoProvider.phoneController.text
|
|
|
|
.trim()
|
|
|
|
.isEmpty ||
|
|
...
|
...
|
@@ -1735,9 +1788,52 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
params['Strtext'] = user.sellername;
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
Guest guest = Guest(
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null);
|
|
|
|
if (widget.guest == null) {
|
|
|
|
guest.phone =
|
|
|
|
_baseIndoProvider.phoneController.text; //预订人电话
|
|
|
|
|
|
|
|
if (nameStr != null && nameStr.trim().length > 0) {
|
|
|
|
String sex = '1';
|
|
|
|
if (sexStr == '女士') {
|
|
|
|
sex = '2';
|
|
|
|
} else if (sexStr == '公司') {
|
|
|
|
sex = '3';
|
|
|
|
}
|
|
|
|
guest.rname = nameStr; //预订人姓名
|
|
|
|
guest.sex = sex; //预订人性别:1:男 2:女
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
String pnum;
|
|
|
|
if (actualPnum != '选填') {
|
|
|
|
pnum = actualPnum;
|
|
|
|
}
|
|
|
|
SunReserveInfoModel _model =
|
|
|
|
await tableManagerModel.setReserveInfo(context,
|
|
|
|
needKeep: true, guest: widget.guest);
|
|
|
|
needKeep: true,
|
|
|
|
pnum: pnum,
|
|
|
|
tempTime: ddateHm == '选填' ? null : ddateHm,
|
|
|
|
guest: widget.guest == null
|
|
|
|
? guest
|
|
|
|
: widget.guest);
|
|
|
|
if (_model != null &&
|
|
|
|
ObjectUtil.isNotEmpty(_model.row) &&
|
|
|
|
ObjectUtil.isNotEmpty(_model.row.id)) {
|
|
...
|
...
|
@@ -1746,15 +1842,40 @@ class TableManagerPageState extends State<TableManagerPage> { |
|
|
|
// _homeEnterModel.clearData();
|
|
|
|
bus.emit("refresh_tablemanager"); //刷新当前页面
|
|
|
|
bus.emit("refresh_book_list"); //刷新已预订列表
|
|
|
|
UserModel userModel =
|
|
|
|
Provider.of<UserModel>(context, listen: false);
|
|
|
|
Map<String, String> params = {
|
|
|
|
"rid": _model.row.id,
|
|
|
|
"sid": userModel.user.sellerid
|
|
|
|
};
|
|
|
|
bool success = await couponProvider
|
|
|
|
.sendSMSWxSendSms(context, params);
|
|
|
|
print(success);
|
|
|
|
if (youhui != '选择优惠') {
|
|
|
|
Map<String, String> params = {
|
|
|
|
"rid": _model.row.id,
|
|
|
|
"aid":
|
|
|
|
'${couponProvider.couponListSelect[couponSelectIndex].id}'
|
|
|
|
};
|
|
|
|
bool isSuc = await couponProvider
|
|
|
|
.setActivityAsReserve(context, params);
|
|
|
|
if (isSuc) {
|
|
|
|
couponProvider.hasModify = true;
|
|
|
|
UserModel userModel = Provider.of<UserModel>(
|
|
|
|
context,
|
|
|
|
listen: false);
|
|
|
|
Map<String, String> params = {
|
|
|
|
"rid": _model.row.id,
|
|
|
|
"sid": userModel.user.sellerid
|
|
|
|
};
|
|
|
|
bool success = await couponProvider
|
|
|
|
.sendSMSWxSendSms(context, params);
|
|
|
|
print(success);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
UserModel userModel = Provider.of<UserModel>(
|
|
|
|
context,
|
|
|
|
listen: false);
|
|
|
|
Map<String, String> params = {
|
|
|
|
"rid": _model.row.id,
|
|
|
|
"sid": userModel.user.sellerid
|
|
|
|
};
|
|
|
|
bool success = await couponProvider
|
|
|
|
.sendSMSWxSendSms(context, params);
|
|
|
|
print(success);
|
|
|
|
}
|
|
|
|
|
|
|
|
// if (success) {
|
|
|
|
// Utils.showToast('短信已经发送成功!');
|
|
|
|
// } else {
|
...
|
...
|
|