Commit d561a492e1ab38482cf43126b3060b6ba62dd508

Authored by wdn127929
1 parent c1199eb2

桌位选中widget

... ... @@ -104,6 +104,8 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
// bus.emit('refresh_coupon_list');
EventBus().emit('refresh_coupon_invitation');
bus.emit('refresh_coupon_list_f');
bus.emit('refresh_table_m_coupon');
Navigator.pop(context, true);
}
}
... ...
... ... @@ -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 {
... ...
... ... @@ -277,7 +277,7 @@ class TableManagerModel with ChangeNotifier {
///录入更改内部预订
Future<SunReserveInfoModel> setReserveInfo(BuildContext context,
{needKeep = false, Guest guest}) async {
{needKeep = false, Guest guest, String pnum, String tempTime}) async {
if (selectTables.length == 0) {
Utils.showToast('请选择桌位');
return null;
... ... @@ -287,14 +287,16 @@ class TableManagerModel with ChangeNotifier {
if (sucess) {
UserModel userModel = Provider.of<UserModel>(context, listen: false);
//
String tempTime;
if (currTimeIndex == 1) {
tempTime = '08:00';
} else if (currTimeIndex == 2) {
tempTime = '12:00';
} else if (currTimeIndex == 3) {
tempTime = '18:00';
if (tempTime == null) {
if (currTimeIndex == 1) {
tempTime = '08:00';
} else if (currTimeIndex == 2) {
tempTime = '12:00';
} else if (currTimeIndex == 3) {
tempTime = '18:00';
}
}
String ymd = DateUtil.formatDate(dateTime, format: DateFormats.y_mo_d);
String timeStr = ymd + ' ' + tempTime + ':00';
// int start = DateUtil.getDateMsByTimeStr(timeStr);
... ... @@ -353,6 +355,10 @@ class TableManagerModel with ChangeNotifier {
// 'phone': '',
// "cusdem": ''
};
if (pnum != null && pnum != '') {
// params["actual_pum"] = pnum; //预定用餐人数
params["pnum"] = pnum; //预定用餐人数
}
if (guest != null) {
if (guest.rnameStr != '') {
params['rname'] = guest.rnameStr;
... ...
... ... @@ -3965,23 +3965,55 @@ class DialogUtil {
//显示选择客户经理弹框
static Future<List<int>> showSelectCusmanDialog(
BuildContext context, List<dynamic> data, ValueChanged valueChanged,
{List<int> selecteds}) {
{List<int> selecteds,
Color cancelTextColor = const Color.fromRGBO(0, 0, 0, 0.6),
String title = '',
VoidCallback onCancel,
String cancelText = '取消'}) {
return Picker(
selecteds: selecteds,
adapter: PickerDataAdapter<String>(pickerdata: data),
height: ScreenUtil().setWidth(480),
hideHeader: false,
cancelText: "取消",
cancelTextStyle: TextStyle(
color: MyColours.color_828282, fontSize: ScreenUtil().setSp(36)),
headerDecoration: BoxDecoration(
color: MyColours.color_ffffff,
border: Border(
bottom: BorderSide(
width: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7),
)),
title: Text(
title,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Color.fromRGBO(0, 0, 0, 0.9),
fontSize: ScreenUtil().setSp(32)),
),
cancelText: cancelText,
cancelTextStyle:
TextStyle(color: cancelTextColor, fontSize: ScreenUtil().setSp(32)),
confirmText: "确定",
itemExtent: ScreenUtil().setWidth(90),
confirmTextStyle: TextStyle(
color: MyColours.color_2bb5b7, fontSize: ScreenUtil().setSp(36)),
color: MyColours.color_438E93, fontSize: ScreenUtil().setSp(32)),
selectedTextStyle: TextStyle(
color: MyColours.color_199095, fontSize: ScreenUtil().setSp(32)),
color: Color.fromRGBO(0, 0, 0, 0.9),
fontSize: ScreenUtil().setSp(32)),
textStyle: TextStyle(
color: MyColours.color_353535, fontSize: ScreenUtil().setSp(32)),
color: Color.fromRGBO(0, 0, 0, 0.26),
fontSize: ScreenUtil().setSp(32)),
selectionOverlay: Container(
height: ScreenUtil().setWidth(80),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7),
top: BorderSide(
width: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7))),
),
onCancel: onCancel,
onConfirm: (Picker picker, List value) {
print(value.toString());
if (valueChanged != null) {
... ...