Showing
5 changed files
with
396 additions
and
73 deletions
| @@ -63,6 +63,13 @@ class GetDzSellerConfSunModel { | @@ -63,6 +63,13 @@ class GetDzSellerConfSunModel { | ||
| 63 | String storePushMeg; | 63 | String storePushMeg; |
| 64 | String storePushSms; | 64 | String storePushSms; |
| 65 | 65 | ||
| 66 | + String pcNotPhone; | ||
| 67 | + String isCustomerCancel; | ||
| 68 | + | ||
| 69 | + String isAddOver; //是否允许新建过去订单 | ||
| 70 | + String isSetOver; //是否允许修改过去订单 | ||
| 71 | + String isReserveOver; //是否允许变更订单到过去餐段 | ||
| 72 | + | ||
| 66 | GetDzSellerConfSunModel( | 73 | GetDzSellerConfSunModel( |
| 67 | {this.id, | 74 | {this.id, |
| 68 | this.sid, | 75 | this.sid, |
| @@ -93,7 +100,12 @@ class GetDzSellerConfSunModel { | @@ -93,7 +100,12 @@ class GetDzSellerConfSunModel { | ||
| 93 | this.depositPrice, | 100 | this.depositPrice, |
| 94 | this.liteStyle, | 101 | this.liteStyle, |
| 95 | this.storePushMeg, | 102 | this.storePushMeg, |
| 96 | - this.storePushSms}); | 103 | + this.storePushSms, |
| 104 | + this.pcNotPhone, | ||
| 105 | + this.isCustomerCancel, | ||
| 106 | + this.isAddOver, | ||
| 107 | + this.isSetOver, | ||
| 108 | + this.isReserveOver}); | ||
| 97 | 109 | ||
| 98 | GetDzSellerConfSunModel.fromJson(Map<String, dynamic> json) { | 110 | GetDzSellerConfSunModel.fromJson(Map<String, dynamic> json) { |
| 99 | id = json['id']; | 111 | id = json['id']; |
| @@ -139,6 +151,12 @@ class GetDzSellerConfSunModel { | @@ -139,6 +151,12 @@ class GetDzSellerConfSunModel { | ||
| 139 | 151 | ||
| 140 | storePushMeg = json['store_push_meg']; | 152 | storePushMeg = json['store_push_meg']; |
| 141 | storePushSms = json['store_push_sms']; | 153 | storePushSms = json['store_push_sms']; |
| 154 | + | ||
| 155 | + pcNotPhone = json['pc_not_phone']; | ||
| 156 | + isCustomerCancel = json['is_customer_cancel']; | ||
| 157 | + isAddOver = json['is_add_over']; | ||
| 158 | + isSetOver = json['is_set_over']; | ||
| 159 | + isReserveOver = json['is_reserve_over']; | ||
| 142 | } | 160 | } |
| 143 | 161 | ||
| 144 | Map<String, dynamic> toJson() { | 162 | Map<String, dynamic> toJson() { |
| @@ -175,6 +193,13 @@ class GetDzSellerConfSunModel { | @@ -175,6 +193,13 @@ class GetDzSellerConfSunModel { | ||
| 175 | data['lite_style'] = this.liteStyle; | 193 | data['lite_style'] = this.liteStyle; |
| 176 | data['store_push_meg'] = this.storePushMeg; | 194 | data['store_push_meg'] = this.storePushMeg; |
| 177 | data['store_push_sms'] = this.storePushSms; | 195 | data['store_push_sms'] = this.storePushSms; |
| 196 | + data['pc_not_phone'] = this.pcNotPhone; | ||
| 197 | + data['is_customer_cancel'] = this.isCustomerCancel; | ||
| 198 | + | ||
| 199 | + data['is_add_over'] = this.isAddOver; | ||
| 200 | + data['is_set_over'] = this.isSetOver; | ||
| 201 | + data['is_reserve_over'] = this.isReserveOver; | ||
| 202 | + | ||
| 178 | return data; | 203 | return data; |
| 179 | } | 204 | } |
| 180 | } | 205 | } |
| 1 | +import 'dart:convert'; | ||
| 2 | + | ||
| 1 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
| 2 | import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart'; | 4 | import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart'; |
| 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 5 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| @@ -12,6 +14,7 @@ import 'package:one_key/widgets/system_app_bar.dart'; | @@ -12,6 +14,7 @@ import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 12 | import 'package:one_key/widgets/v_empty_view.dart'; | 14 | import 'package:one_key/widgets/v_empty_view.dart'; |
| 13 | import 'package:provider/provider.dart'; | 15 | import 'package:provider/provider.dart'; |
| 14 | 16 | ||
| 17 | +import '../../../../provider/marketing_center_provider.dart'; | ||
| 15 | import '../../../../utils/screen_util.dart'; | 18 | import '../../../../utils/screen_util.dart'; |
| 16 | import '../../../../widgets/h_empty_view.dart'; | 19 | import '../../../../widgets/h_empty_view.dart'; |
| 17 | import '../../../../widgets/round_button.dart'; | 20 | import '../../../../widgets/round_button.dart'; |
| @@ -30,17 +33,44 @@ class _CustomerSettingPageState extends State<CustomerSettingPage> { | @@ -30,17 +33,44 @@ class _CustomerSettingPageState extends State<CustomerSettingPage> { | ||
| 30 | String memberShow = ''; | 33 | String memberShow = ''; |
| 31 | bool showLabel = false; | 34 | bool showLabel = false; |
| 32 | 35 | ||
| 36 | + MarketingCenterProvider marketingCenterProvider; | ||
| 37 | + | ||
| 33 | @override | 38 | @override |
| 34 | void initState() { | 39 | void initState() { |
| 35 | WidgetsBinding.instance.addPostFrameCallback((_) async { | 40 | WidgetsBinding.instance.addPostFrameCallback((_) async { |
| 36 | // _getContantData(); | 41 | // _getContantData(); |
| 37 | _sellerGuestGet(); | 42 | _sellerGuestGet(); |
| 38 | _getLabelBySellerid(); | 43 | _getLabelBySellerid(); |
| 44 | + getDzSellerConf(); | ||
| 39 | }); | 45 | }); |
| 40 | } | 46 | } |
| 41 | 47 | ||
| 48 | + getDzSellerConf() async { | ||
| 49 | + bool success = await marketingCenterProvider.getDzSellerConf(context); | ||
| 50 | + if (success && marketingCenterProvider.dzSellerConfModel != null) { | ||
| 51 | + customerProvider.ispcphone = | ||
| 52 | + marketingCenterProvider.dzSellerConfModel.pcNotPhone == '1' | ||
| 53 | + ? true | ||
| 54 | + : false; | ||
| 55 | + customerProvider.isAddOver = | ||
| 56 | + marketingCenterProvider.dzSellerConfModel.isAddOver == '1' | ||
| 57 | + ? true | ||
| 58 | + : false; | ||
| 59 | + customerProvider.isSetOver = | ||
| 60 | + marketingCenterProvider.dzSellerConfModel.isSetOver == '1' | ||
| 61 | + ? true | ||
| 62 | + : false; | ||
| 63 | + customerProvider.isReserveOver = | ||
| 64 | + marketingCenterProvider.dzSellerConfModel.isReserveOver == '1' | ||
| 65 | + ? true | ||
| 66 | + : false; | ||
| 67 | + } | ||
| 68 | + setState(() {}); | ||
| 69 | + } | ||
| 70 | + | ||
| 42 | ///修改客情配置 | 71 | ///修改客情配置 |
| 43 | - _sellerGuestSet() async { | 72 | + |
| 73 | + Future<bool> _sellerGuestSet() async { | ||
| 44 | Map<String, String> params = { | 74 | Map<String, String> params = { |
| 45 | "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, | 75 | "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, |
| 46 | 'is_additional': customerProvider.isrepair ? "1" : "0", | 76 | 'is_additional': customerProvider.isrepair ? "1" : "0", |
| @@ -48,12 +78,55 @@ class _CustomerSettingPageState extends State<CustomerSettingPage> { | @@ -48,12 +78,55 @@ class _CustomerSettingPageState extends State<CustomerSettingPage> { | ||
| 48 | }; | 78 | }; |
| 49 | bool success = await customerProvider.setSellerGuest(context, params, | 79 | bool success = await customerProvider.setSellerGuest(context, params, |
| 50 | showLoading: true); | 80 | showLoading: true); |
| 51 | - if (success) {} | 81 | + if (success) { |
| 82 | + return true; | ||
| 83 | + } else { | ||
| 84 | + return false; | ||
| 85 | + } | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + _saveData() async { | ||
| 89 | + Future.wait<bool>([ | ||
| 90 | + _setConfings(), | ||
| 91 | + _sellerGuestSet(), | ||
| 92 | + ]).then((results) async { | ||
| 93 | + print(results[0]); | ||
| 94 | + if (results[0] && results[1]) { | ||
| 95 | + // 全部保存成功 | ||
| 96 | + Utils.showToast('保存成功!'); | ||
| 97 | + } else if (results[0]) { | ||
| 98 | + Utils.showToast('保存失败,请重试'); | ||
| 99 | + } else if (results[1]) { | ||
| 100 | + Utils.showToast('保存失败,请重试'); | ||
| 101 | + } else { | ||
| 102 | + //都失败 | ||
| 103 | + Utils.showToast('保存失败,请重试'); | ||
| 104 | + } | ||
| 105 | + }); | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + Future<bool> _setConfings() async { | ||
| 109 | + Map<String, dynamic> data = { | ||
| 110 | + "pc_not_phone": customerProvider.ispcphone ? '1' : '0', | ||
| 111 | + "is_add_over": customerProvider.isAddOver?'1':'0', | ||
| 112 | + "is_set_over": customerProvider.isSetOver ? '1' : '0', | ||
| 113 | + "is_reserve_over": customerProvider.isReserveOver ? '1' : '0' | ||
| 114 | + }; | ||
| 115 | + Map<String, String> params = { | ||
| 116 | + 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 117 | + 'data': jsonEncode(data), | ||
| 118 | + }; | ||
| 119 | + bool success = await marketingCenterProvider.setConfings(context, params, | ||
| 120 | + needToast: false); | ||
| 121 | + if (success) { | ||
| 122 | + return true; | ||
| 123 | + } else { | ||
| 124 | + return false; | ||
| 125 | + } | ||
| 52 | } | 126 | } |
| 53 | 127 | ||
| 54 | ///获取客情配置 | 128 | ///获取客情配置 |
| 55 | _sellerGuestGet() async { | 129 | _sellerGuestGet() async { |
| 56 | - | ||
| 57 | bool success = await customerProvider.getSellerGuest(context); | 130 | bool success = await customerProvider.getSellerGuest(context); |
| 58 | 131 | ||
| 59 | // if (success) { | 132 | // if (success) { |
| @@ -215,6 +288,8 @@ class _CustomerSettingPageState extends State<CustomerSettingPage> { | @@ -215,6 +288,8 @@ class _CustomerSettingPageState extends State<CustomerSettingPage> { | ||
| 215 | @override | 288 | @override |
| 216 | Widget build(BuildContext context) { | 289 | Widget build(BuildContext context) { |
| 217 | customerProvider = Provider.of<CustomerProvider>(context, listen: true); | 290 | customerProvider = Provider.of<CustomerProvider>(context, listen: true); |
| 291 | + marketingCenterProvider = | ||
| 292 | + Provider.of<MarketingCenterProvider>(context, listen: true); | ||
| 218 | return KeyboardDismissOnTap( | 293 | return KeyboardDismissOnTap( |
| 219 | child: Scaffold( | 294 | child: Scaffold( |
| 220 | backgroundColor: MyColours.color_ffffff, | 295 | backgroundColor: MyColours.color_ffffff, |
| @@ -318,6 +393,162 @@ class _CustomerSettingPageState extends State<CustomerSettingPage> { | @@ -318,6 +393,162 @@ class _CustomerSettingPageState extends State<CustomerSettingPage> { | ||
| 318 | w(1), | 393 | w(1), |
| 319 | color: MyColours.color_E7E7E7, | 394 | color: MyColours.color_E7E7E7, |
| 320 | )), | 395 | )), |
| 396 | + VEmptyView(24), | ||
| 397 | + InkWell( | ||
| 398 | + onTap: () { | ||
| 399 | + setState(() { | ||
| 400 | + customerProvider.ispcphone = !customerProvider.ispcphone; | ||
| 401 | + }); | ||
| 402 | + }, | ||
| 403 | + child: Container( | ||
| 404 | + padding: EdgeInsets.symmetric( | ||
| 405 | + vertical: w(8), horizontal: w(14)), | ||
| 406 | + child: Row( | ||
| 407 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 408 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 409 | + children: [ | ||
| 410 | + Text('PC端预订允许不录入客户电话', | ||
| 411 | + style: TextStyle( | ||
| 412 | + color: MyColours.color_515151, | ||
| 413 | + fontSize: ScreenUtil().setSp(28))), | ||
| 414 | + Image.asset( | ||
| 415 | + customerProvider.ispcphone | ||
| 416 | + ? Utils.getImgPath('swich_on') | ||
| 417 | + : Utils.getImgPath('swich_off'), | ||
| 418 | + width: ScreenUtil().setWidth(88), | ||
| 419 | + // height: ScreenUtil().setWidth(82), | ||
| 420 | + ), | ||
| 421 | + ], | ||
| 422 | + ), | ||
| 423 | + )), | ||
| 424 | + Padding( | ||
| 425 | + padding: EdgeInsets.only(left: w(14), right: w(10)), | ||
| 426 | + child: MyDivider( | ||
| 427 | + double.infinity, | ||
| 428 | + w(1), | ||
| 429 | + color: MyColours.color_E7E7E7, | ||
| 430 | + )), | ||
| 431 | + VEmptyView(48), | ||
| 432 | + Container( | ||
| 433 | + padding: EdgeInsets.symmetric(vertical: w(8)), | ||
| 434 | + child: Text('历史订单', | ||
| 435 | + style: TextStyle( | ||
| 436 | + color: MyColours.color_515151, | ||
| 437 | + fontSize: ScreenUtil().setSp(32)))), | ||
| 438 | + VEmptyView(22), | ||
| 439 | + MyDivider( | ||
| 440 | + double.infinity, | ||
| 441 | + w(1), | ||
| 442 | + color: MyColours.color_E7E7E7, | ||
| 443 | + ), | ||
| 444 | + VEmptyView(24), | ||
| 445 | + InkWell( | ||
| 446 | + onTap: () { | ||
| 447 | + setState(() { | ||
| 448 | + customerProvider.isAddOver = !customerProvider.isAddOver; | ||
| 449 | + }); | ||
| 450 | + // _sellerGuestSet(); | ||
| 451 | + }, | ||
| 452 | + child: Container( | ||
| 453 | + padding: EdgeInsets.symmetric( | ||
| 454 | + vertical: w(8), horizontal: w(14)), | ||
| 455 | + child: Row( | ||
| 456 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 457 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 458 | + children: [ | ||
| 459 | + Text('允许新建过去餐段的订单', | ||
| 460 | + style: TextStyle( | ||
| 461 | + color: MyColours.color_515151, | ||
| 462 | + fontSize: ScreenUtil().setSp(28))), | ||
| 463 | + Image.asset( | ||
| 464 | + customerProvider.isAddOver | ||
| 465 | + ? Utils.getImgPath('swich_on') | ||
| 466 | + : Utils.getImgPath('swich_off'), | ||
| 467 | + width: ScreenUtil().setWidth(88), | ||
| 468 | + // height: ScreenUtil().setWidth(82), | ||
| 469 | + ), | ||
| 470 | + ], | ||
| 471 | + )), | ||
| 472 | + ), | ||
| 473 | + Padding( | ||
| 474 | + padding: EdgeInsets.only(left: w(14), right: w(10)), | ||
| 475 | + child: MyDivider( | ||
| 476 | + double.infinity, | ||
| 477 | + w(1), | ||
| 478 | + color: MyColours.color_E7E7E7, | ||
| 479 | + )), | ||
| 480 | + VEmptyView(24), | ||
| 481 | + InkWell( | ||
| 482 | + onTap: () { | ||
| 483 | + setState(() { | ||
| 484 | + customerProvider.isSetOver = | ||
| 485 | + !customerProvider.isSetOver; | ||
| 486 | + }); | ||
| 487 | + }, | ||
| 488 | + child: Container( | ||
| 489 | + padding: EdgeInsets.symmetric( | ||
| 490 | + vertical: w(8), horizontal: w(14)), | ||
| 491 | + child: Row( | ||
| 492 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 493 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 494 | + children: [ | ||
| 495 | + Text('允许变更过去餐段订单的时间', | ||
| 496 | + style: TextStyle( | ||
| 497 | + color: MyColours.color_515151, | ||
| 498 | + fontSize: ScreenUtil().setSp(28))), | ||
| 499 | + Image.asset( | ||
| 500 | + customerProvider.isSetOver | ||
| 501 | + ? Utils.getImgPath('swich_on') | ||
| 502 | + : Utils.getImgPath('swich_off'), | ||
| 503 | + width: ScreenUtil().setWidth(88), | ||
| 504 | + // height: ScreenUtil().setWidth(82), | ||
| 505 | + ), | ||
| 506 | + ], | ||
| 507 | + ), | ||
| 508 | + )), | ||
| 509 | + Padding( | ||
| 510 | + padding: EdgeInsets.only(left: w(14), right: w(10)), | ||
| 511 | + child: MyDivider( | ||
| 512 | + double.infinity, | ||
| 513 | + w(1), | ||
| 514 | + color: MyColours.color_E7E7E7, | ||
| 515 | + )), | ||
| 516 | + VEmptyView(24), | ||
| 517 | + InkWell( | ||
| 518 | + onTap: () { | ||
| 519 | + setState(() { | ||
| 520 | + customerProvider.isReserveOver = | ||
| 521 | + !customerProvider.isReserveOver; | ||
| 522 | + }); | ||
| 523 | + }, | ||
| 524 | + child: Container( | ||
| 525 | + padding: EdgeInsets.symmetric( | ||
| 526 | + vertical: w(8), horizontal: w(14)), | ||
| 527 | + child: Row( | ||
| 528 | + mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
| 529 | + crossAxisAlignment: CrossAxisAlignment.center, | ||
| 530 | + children: [ | ||
| 531 | + Text('允许变更订单到过去餐段', | ||
| 532 | + style: TextStyle( | ||
| 533 | + color: MyColours.color_515151, | ||
| 534 | + fontSize: ScreenUtil().setSp(28))), | ||
| 535 | + Image.asset( | ||
| 536 | + customerProvider.isReserveOver | ||
| 537 | + ? Utils.getImgPath('swich_on') | ||
| 538 | + : Utils.getImgPath('swich_off'), | ||
| 539 | + width: ScreenUtil().setWidth(88), | ||
| 540 | + // height: ScreenUtil().setWidth(82), | ||
| 541 | + ), | ||
| 542 | + ], | ||
| 543 | + ), | ||
| 544 | + )), | ||
| 545 | + Padding( | ||
| 546 | + padding: EdgeInsets.only(left: w(14), right: w(10)), | ||
| 547 | + child: MyDivider( | ||
| 548 | + double.infinity, | ||
| 549 | + w(1), | ||
| 550 | + color: MyColours.color_E7E7E7, | ||
| 551 | + )), | ||
| 321 | VEmptyView(48), | 552 | VEmptyView(48), |
| 322 | Text('店内自定义标签', | 553 | Text('店内自定义标签', |
| 323 | style: TextStyle( | 554 | style: TextStyle( |
| @@ -360,7 +591,7 @@ class _CustomerSettingPageState extends State<CustomerSettingPage> { | @@ -360,7 +591,7 @@ class _CustomerSettingPageState extends State<CustomerSettingPage> { | ||
| 360 | fontSize: 28, | 591 | fontSize: 28, |
| 361 | textColor: MyColours.color_ffffff, | 592 | textColor: MyColours.color_ffffff, |
| 362 | onPressed: () { | 593 | onPressed: () { |
| 363 | - _sellerGuestSet(); | 594 | + _saveData(); |
| 364 | }, | 595 | }, |
| 365 | ), | 596 | ), |
| 366 | ) | 597 | ) |
| @@ -53,6 +53,7 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -53,6 +53,7 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 53 | bool isLink = false; //充值优惠活动链接 | 53 | bool isLink = false; //充值优惠活动链接 |
| 54 | bool isCoupon = false; // 代金券 | 54 | bool isCoupon = false; // 代金券 |
| 55 | bool isRecharge = false; //充值券 | 55 | bool isRecharge = false; //充值券 |
| 56 | + bool isCustomerCancel = true; //向客人开放取消预订功能 | ||
| 56 | 57 | ||
| 57 | RechargeListSunModel rechargeData; | 58 | RechargeListSunModel rechargeData; |
| 58 | String rechargeContent = ''; | 59 | String rechargeContent = ''; |
| @@ -71,6 +72,7 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -71,6 +72,7 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 71 | // _couponNetworkData(); | 72 | // _couponNetworkData(); |
| 72 | _getNewRechargeList(); | 73 | _getNewRechargeList(); |
| 73 | getSellerTemplateConf(); | 74 | getSellerTemplateConf(); |
| 75 | + getDzSellerConf(); | ||
| 74 | // bus.on('refresh_marketting_page', (arg) { | 76 | // bus.on('refresh_marketting_page', (arg) { |
| 75 | // _couponNetworkData(); | 77 | // _couponNetworkData(); |
| 76 | // }); | 78 | // }); |
| @@ -129,6 +131,17 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -129,6 +131,17 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 129 | } | 131 | } |
| 130 | } | 132 | } |
| 131 | 133 | ||
| 134 | + getDzSellerConf() async { | ||
| 135 | + bool success = await marketingCenterProvider.getDzSellerConf(context); | ||
| 136 | + if (success && marketingCenterProvider.dzSellerConfModel != null) { | ||
| 137 | + isCustomerCancel = | ||
| 138 | + marketingCenterProvider.dzSellerConfModel.isCustomerCancel == '1' | ||
| 139 | + ? true | ||
| 140 | + : false; | ||
| 141 | + } | ||
| 142 | + setState(() {}); | ||
| 143 | + } | ||
| 144 | + | ||
| 132 | getSellerTemplateConf() async { | 145 | getSellerTemplateConf() async { |
| 133 | bool success = await marketingCenterProvider.getSellerTemplateConf(context); | 146 | bool success = await marketingCenterProvider.getSellerTemplateConf(context); |
| 134 | if (success && marketingCenterProvider.markDataModel.marketing != null) { | 147 | if (success && marketingCenterProvider.markDataModel.marketing != null) { |
| @@ -286,8 +299,8 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -286,8 +299,8 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 286 | if (need) { | 299 | if (need) { |
| 287 | file = File(compressedFile.absolute.path); | 300 | file = File(compressedFile.absolute.path); |
| 288 | } | 301 | } |
| 289 | - UploadImageUtil() | ||
| 290 | - .startUploadOnly(context, file, 4, true, _uploadImageProvider,(){}); | 302 | + UploadImageUtil().startUploadOnly( |
| 303 | + context, file, 4, true, _uploadImageProvider, () {}); | ||
| 291 | } | 304 | } |
| 292 | } | 305 | } |
| 293 | } | 306 | } |
| @@ -968,6 +981,103 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -968,6 +981,103 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 968 | // return couponsDesc; | 981 | // return couponsDesc; |
| 969 | // } | 982 | // } |
| 970 | 983 | ||
| 984 | + _saveData() async { | ||
| 985 | + Future.wait<bool>([ | ||
| 986 | + _setConfings(), | ||
| 987 | + _setIntavition(), | ||
| 988 | + ]).then((results) async { | ||
| 989 | + print(results[0]); | ||
| 990 | + if (results[0] && results[1]) { | ||
| 991 | + // 全部保存成功 | ||
| 992 | + Utils.showToast('保存成功!'); | ||
| 993 | + Navigator.pop(context); | ||
| 994 | + } else if (results[0]) { | ||
| 995 | + Utils.showToast('保存失败,请重试'); | ||
| 996 | + } else if (results[1]) { | ||
| 997 | + Utils.showToast('保存失败,请重试'); | ||
| 998 | + } else { | ||
| 999 | + //都失败 | ||
| 1000 | + Utils.showToast('保存失败,请重试'); | ||
| 1001 | + } | ||
| 1002 | + }); | ||
| 1003 | + } | ||
| 1004 | + | ||
| 1005 | + Future<bool> _setConfings() async { | ||
| 1006 | + Map<String, dynamic> data = { | ||
| 1007 | + "is_customer_cancel": isCustomerCancel ? '1' : '0', | ||
| 1008 | + }; | ||
| 1009 | + Map<String, String> params = { | ||
| 1010 | + 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 1011 | + 'data': jsonEncode(data), | ||
| 1012 | + }; | ||
| 1013 | + bool success = await marketingCenterProvider.setConfings(context, params, | ||
| 1014 | + needToast: false); | ||
| 1015 | + if (success) { | ||
| 1016 | + return true; | ||
| 1017 | + } else { | ||
| 1018 | + return false; | ||
| 1019 | + } | ||
| 1020 | + } | ||
| 1021 | + | ||
| 1022 | + Future<bool> _setIntavition() async { | ||
| 1023 | + // FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 1024 | + // if (_uploadImageProvider.firstImage.qiniuUrl == null) { | ||
| 1025 | + // Utils.showToast('请上传餐厅logo!'); | ||
| 1026 | + // return false; | ||
| 1027 | + // } | ||
| 1028 | + | ||
| 1029 | + // if (_uploadImageProvider.firstImage.process < 1) { | ||
| 1030 | + // Utils.showToast('正在上传餐厅logo!,请稍等'); | ||
| 1031 | + // return false; | ||
| 1032 | + // } | ||
| 1033 | + // if (welcomeTextC.text.trim().length == 0) { | ||
| 1034 | + // Utils.showToast('请输入输入餐厅欢迎语!'); | ||
| 1035 | + // return false; | ||
| 1036 | + // } | ||
| 1037 | + Map marketing = {}; | ||
| 1038 | + if (marketingCenterProvider.markDataModel != null && | ||
| 1039 | + marketingCenterProvider.markDataModel.marketing != null) { | ||
| 1040 | + marketing = marketingCenterProvider.markDataModel.marketing.toJson(); | ||
| 1041 | + } | ||
| 1042 | + | ||
| 1043 | + print(marketing); | ||
| 1044 | + marketing['is_transpond'] = isTranspond ? '1' : '0'; //转发同行客人 | ||
| 1045 | + marketing['is_online_book'] = isOnlineBook ? '1' : '0'; //在线预订 | ||
| 1046 | + marketing['is_arrival'] = isArrival ? '1' : '0'; //确认到店 | ||
| 1047 | + | ||
| 1048 | + // //接口 | ||
| 1049 | + // Map marketingData = { | ||
| 1050 | + // // 'isTranspond': isTranspond ? '1' : '0', //转发同行客人 | ||
| 1051 | + // 'is_transpond': '1', //转发同行客人 | ||
| 1052 | + // 'is_arrival': isArrival ? '1' : '0', //确认到店 | ||
| 1053 | + // 'is_online_book': isOnlineBook ? '1' : '0', //在线预订 | ||
| 1054 | + // 'is_order': isOrder ? '1' : '0', //去点餐 | ||
| 1055 | + // 'is_coupon': isCoupon ? '1' : '0', //代金券暂时 | ||
| 1056 | + // 'is_recharge': isRecharge ? '1' : '0', //充值券暂时 | ||
| 1057 | + // 'is_link': isLink ? '1' : '0', | ||
| 1058 | + // // 'is_link': '0', | ||
| 1059 | + // 'wecomle': welcomeTextC.text ?? '', | ||
| 1060 | + // 'logo': _uploadImageProvider.firstImage.qiniuUrl, | ||
| 1061 | + // 'recharge_data': rechargeData, | ||
| 1062 | + // 'coupon_data': json.encode(couponDataList), | ||
| 1063 | + // 'is_comments': isComments ? '1' : '0', | ||
| 1064 | + // 'is_comments_coupon': isCommentsCoupon ? '1' : '0', | ||
| 1065 | + // 'coupon_data_comments': json.encode(couponDataListComments), | ||
| 1066 | + // }; | ||
| 1067 | + Map<String, String> params = { | ||
| 1068 | + 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 1069 | + 'marketing': json.encode(marketing) | ||
| 1070 | + }; | ||
| 1071 | + | ||
| 1072 | + bool success = await marketingCenterProvider | ||
| 1073 | + .setSellerTemplateConf(context, params, showLoading: true); | ||
| 1074 | + if (success) { | ||
| 1075 | + return true; | ||
| 1076 | + } else { | ||
| 1077 | + return false; | ||
| 1078 | + } | ||
| 1079 | + } | ||
| 1080 | + | ||
| 971 | @override | 1081 | @override |
| 972 | Widget build(BuildContext context) { | 1082 | Widget build(BuildContext context) { |
| 973 | couponProvider = Provider.of<CouponProvider>(context, listen: true); | 1083 | couponProvider = Provider.of<CouponProvider>(context, listen: true); |
| @@ -999,6 +1109,13 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -999,6 +1109,13 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 999 | isTranspond = !isTranspond; | 1109 | isTranspond = !isTranspond; |
| 1000 | }); | 1110 | }); |
| 1001 | }, select: isTranspond), | 1111 | }, select: isTranspond), |
| 1112 | + _storeItemWidget('向客人开放“取消预订”功能。', | ||
| 1113 | + '客人可以在预订安排小程序卡片中,通过“取消预订”按钮取消订单,无需通过电话跟商家联系。为了避免客人误操作,在正式取消前,系统会通过弹窗提醒客人确认。', | ||
| 1114 | + onTap: () { | ||
| 1115 | + setState(() { | ||
| 1116 | + isCustomerCancel = !isCustomerCancel; | ||
| 1117 | + }); | ||
| 1118 | + }, select: isCustomerCancel), | ||
| 1002 | // _storeItemWidget('向被邀请客人开放“确认到店”功能。', | 1119 | // _storeItemWidget('向被邀请客人开放“确认到店”功能。', |
| 1003 | // '被邀客人点击确认到店后,方便请客人了解被邀客人是否确认,同时,被邀客人的信息会加入到餐厅客户池中,方便餐厅维护客户。', | 1120 | // '被邀客人点击确认到店后,方便请客人了解被邀客人是否确认,同时,被邀客人的信息会加入到餐厅客户池中,方便餐厅维护客户。', |
| 1004 | // onTap: () { | 1121 | // onTap: () { |
| @@ -1110,65 +1227,7 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -1110,65 +1227,7 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 1110 | height: w(40), | 1227 | height: w(40), |
| 1111 | isBold: true, | 1228 | isBold: true, |
| 1112 | onPressed: () async { | 1229 | onPressed: () async { |
| 1113 | - // FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 1114 | - // if (_uploadImageProvider.firstImage.qiniuUrl == null) { | ||
| 1115 | - // Utils.showToast('请上传餐厅logo!'); | ||
| 1116 | - // return false; | ||
| 1117 | - // } | ||
| 1118 | - | ||
| 1119 | - // if (_uploadImageProvider.firstImage.process < 1) { | ||
| 1120 | - // Utils.showToast('正在上传餐厅logo!,请稍等'); | ||
| 1121 | - // return false; | ||
| 1122 | - // } | ||
| 1123 | - // if (welcomeTextC.text.trim().length == 0) { | ||
| 1124 | - // Utils.showToast('请输入输入餐厅欢迎语!'); | ||
| 1125 | - // return false; | ||
| 1126 | - // } | ||
| 1127 | - Map marketing = {}; | ||
| 1128 | - if (marketingCenterProvider.markDataModel != null && | ||
| 1129 | - marketingCenterProvider.markDataModel.marketing != null) { | ||
| 1130 | - marketing = marketingCenterProvider.markDataModel.marketing | ||
| 1131 | - .toJson(); | ||
| 1132 | - } | ||
| 1133 | - | ||
| 1134 | - print(marketing); | ||
| 1135 | - marketing['is_transpond'] = isTranspond ? '1' : '0'; //转发同行客人 | ||
| 1136 | - marketing['is_online_book'] = isOnlineBook ? '1' : '0'; //在线预订 | ||
| 1137 | - marketing['is_arrival'] = isArrival ? '1' : '0'; //确认到店 | ||
| 1138 | - | ||
| 1139 | - // //接口 | ||
| 1140 | - // Map marketingData = { | ||
| 1141 | - // // 'isTranspond': isTranspond ? '1' : '0', //转发同行客人 | ||
| 1142 | - // 'is_transpond': '1', //转发同行客人 | ||
| 1143 | - // 'is_arrival': isArrival ? '1' : '0', //确认到店 | ||
| 1144 | - // 'is_online_book': isOnlineBook ? '1' : '0', //在线预订 | ||
| 1145 | - // 'is_order': isOrder ? '1' : '0', //去点餐 | ||
| 1146 | - // 'is_coupon': isCoupon ? '1' : '0', //代金券暂时 | ||
| 1147 | - // 'is_recharge': isRecharge ? '1' : '0', //充值券暂时 | ||
| 1148 | - // 'is_link': isLink ? '1' : '0', | ||
| 1149 | - // // 'is_link': '0', | ||
| 1150 | - // 'wecomle': welcomeTextC.text ?? '', | ||
| 1151 | - // 'logo': _uploadImageProvider.firstImage.qiniuUrl, | ||
| 1152 | - // 'recharge_data': rechargeData, | ||
| 1153 | - // 'coupon_data': json.encode(couponDataList), | ||
| 1154 | - // 'is_comments': isComments ? '1' : '0', | ||
| 1155 | - // 'is_comments_coupon': isCommentsCoupon ? '1' : '0', | ||
| 1156 | - // 'coupon_data_comments': json.encode(couponDataListComments), | ||
| 1157 | - // }; | ||
| 1158 | - Map<String, String> params = { | ||
| 1159 | - 'sid': Provider.of<UserModel>(context, listen: false) | ||
| 1160 | - .user | ||
| 1161 | - .sellerid, | ||
| 1162 | - 'marketing': json.encode(marketing) | ||
| 1163 | - }; | ||
| 1164 | - | ||
| 1165 | - bool success = await marketingCenterProvider | ||
| 1166 | - .setSellerTemplateConf(context, params, | ||
| 1167 | - showLoading: true); | ||
| 1168 | - if (success) { | ||
| 1169 | - Utils.showToast('保存成功'); | ||
| 1170 | - Navigator.pop(context); | ||
| 1171 | - } | 1230 | + _saveData(); |
| 1172 | }, | 1231 | }, |
| 1173 | ), | 1232 | ), |
| 1174 | ) | 1233 | ) |
| @@ -124,6 +124,10 @@ class CustomerProvider extends ChangeNotifier { | @@ -124,6 +124,10 @@ class CustomerProvider extends ChangeNotifier { | ||
| 124 | 124 | ||
| 125 | bool isrepair = false; | 125 | bool isrepair = false; |
| 126 | bool isselfphone = false; | 126 | bool isselfphone = false; |
| 127 | + bool ispcphone = true; | ||
| 128 | + bool isAddOver = true; | ||
| 129 | + bool isSetOver = true; | ||
| 130 | + bool isReserveOver = true; | ||
| 127 | 131 | ||
| 128 | List<MarketingSmsTemplateSunModel> marketingSmsData = []; | 132 | List<MarketingSmsTemplateSunModel> marketingSmsData = []; |
| 129 | 133 | ||
| @@ -897,10 +901,11 @@ class CustomerProvider extends ChangeNotifier { | @@ -897,10 +901,11 @@ class CustomerProvider extends ChangeNotifier { | ||
| 897 | } | 901 | } |
| 898 | 902 | ||
| 899 | // 获取客户详情 | 903 | // 获取客户详情 |
| 900 | - getGuestInfo(BuildContext context, Map<String, String> params,{bool selfDismiss = false }) async { | 904 | + getGuestInfo(BuildContext context, Map<String, String> params, |
| 905 | + {bool selfDismiss = false}) async { | ||
| 901 | BaseResp<dynamic> baseResp = await DioUtil() | 906 | BaseResp<dynamic> baseResp = await DioUtil() |
| 902 | .request<dynamic>(context, Method.post, HttpUrl.get_guest_info, | 907 | .request<dynamic>(context, Method.post, HttpUrl.get_guest_info, |
| 903 | - data: params, showLoading: false,selfDismiss: selfDismiss) | 908 | + data: params, showLoading: false, selfDismiss: selfDismiss) |
| 904 | .catchError((error) { | 909 | .catchError((error) { |
| 905 | print(error.toString()); | 910 | print(error.toString()); |
| 906 | if (error is MyError) { | 911 | if (error is MyError) { |
| @@ -2007,8 +2012,8 @@ class CustomerProvider extends ChangeNotifier { | @@ -2007,8 +2012,8 @@ class CustomerProvider extends ChangeNotifier { | ||
| 2007 | // guestReserveSunModel = | 2012 | // guestReserveSunModel = |
| 2008 | // GuestReserveModel.fromJson(baseResp.responseData).data; | 2013 | // GuestReserveModel.fromJson(baseResp.responseData).data; |
| 2009 | if (baseResp.responseData['data'] is Map || | 2014 | if (baseResp.responseData['data'] is Map || |
| 2010 | - baseResp.responseData['data'] == 1) { | ||
| 2011 | - Utils.showToast("设置成功!"); | 2015 | + baseResp.responseData['data'] == 1 || baseResp.responseData['data'] == 0) { |
| 2016 | + // Utils.showToast("设置成功!"); | ||
| 2012 | return true; | 2017 | return true; |
| 2013 | } | 2018 | } |
| 2014 | return false; | 2019 | return false; |
| @@ -2068,13 +2073,13 @@ class CustomerProvider extends ChangeNotifier { | @@ -2068,13 +2073,13 @@ class CustomerProvider extends ChangeNotifier { | ||
| 2068 | 2073 | ||
| 2069 | //获取商家客情设置 | 2074 | //获取商家客情设置 |
| 2070 | Future<bool> getSellerGuest(BuildContext context, | 2075 | Future<bool> getSellerGuest(BuildContext context, |
| 2071 | - {bool showLoading = false,bool selfDismiss = false}) async { | 2076 | + {bool showLoading = false, bool selfDismiss = false}) async { |
| 2072 | Map<String, String> params = { | 2077 | Map<String, String> params = { |
| 2073 | "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, | 2078 | "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid, |
| 2074 | }; | 2079 | }; |
| 2075 | BaseResp<dynamic> baseResp = await DioUtil() | 2080 | BaseResp<dynamic> baseResp = await DioUtil() |
| 2076 | .request<dynamic>(context, Method.post, HttpUrl.seller_guest_get, | 2081 | .request<dynamic>(context, Method.post, HttpUrl.seller_guest_get, |
| 2077 | - data: params, showLoading: showLoading,selfDismiss:selfDismiss) | 2082 | + data: params, showLoading: showLoading, selfDismiss: selfDismiss) |
| 2078 | .catchError((error) { | 2083 | .catchError((error) { |
| 2079 | print(error.toString()); | 2084 | print(error.toString()); |
| 2080 | if (error is MyError) {} | 2085 | if (error is MyError) {} |
| @@ -1534,8 +1534,11 @@ var myCustomerListPageSimHandle = new Handler( | @@ -1534,8 +1534,11 @@ var myCustomerListPageSimHandle = new Handler( | ||
| 1534 | var customerSettingPageHandle = new Handler( | 1534 | var customerSettingPageHandle = new Handler( |
| 1535 | handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { | 1535 | handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { |
| 1536 | // String idstr = params["idstr"].first; | 1536 | // String idstr = params["idstr"].first; |
| 1537 | + | ||
| 1538 | + | ||
| 1537 | return ChangeNotifierProvider<CustomerProvider>( | 1539 | return ChangeNotifierProvider<CustomerProvider>( |
| 1538 | - create: (_) => CustomerProvider(), child: CustomerSettingPage()); | 1540 | + create: (_) => CustomerProvider(), child: ChangeNotifierProvider<MarketingCenterProvider>( |
| 1541 | + create: (_) => MarketingCenterProvider(), child: CustomerSettingPage())); | ||
| 1539 | }); | 1542 | }); |
| 1540 | 1543 | ||
| 1541 | ///全店营销记录 | 1544 | ///全店营销记录 |
-
Please register or login to post a comment