Commit 9162d451ee3833cdae83ff7df5e938e9613443f6

Authored by wdn127929
1 parent b4ea73ff

10道必点菜移动

@@ -573,4 +573,8 @@ class HttpUrl { @@ -573,4 +573,8 @@ class HttpUrl {
573 static const set_store_wine_sai_you_text = 573 static const set_store_wine_sai_you_text =
574 "?service=App.Reserve.SetStoreWineSaiYouText"; // 配置商家存酒短信可变内容 574 "?service=App.Reserve.SetStoreWineSaiYouText"; // 配置商家存酒短信可变内容
575 575
  576 + static const set_cookbook_order_markeclass =
  577 + "?service=App.Cookbook.SetCookbookOrderMarkeclass"; // 设置营销菜品移动
  578 +
  579 +
576 } 580 }
@@ -191,6 +191,22 @@ class _MenuManagePageState extends State<MenuManagePage> { @@ -191,6 +191,22 @@ class _MenuManagePageState extends State<MenuManagePage> {
191 } 191 }
192 } 192 }
193 193
  194 + _setCookbookOrderMarkeclass(String id, String upid) async {
  195 + Map<String, String> params = {
  196 + // "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  197 + "id": id,
  198 + 'upid': upid
  199 + };
  200 + print(params);
  201 + bool sucess = await menuManageProvider
  202 + .setCookbookOrderMarkeclass(context, params, showLoading: true);
  203 + if (sucess) {
  204 + Utils.showToast('修改成功!');
  205 + //刷新列表数据
  206 + _getCookbookByClass(showLoading: true);
  207 + }
  208 + }
  209 +
194 ///处理数据 210 ///处理数据
195 _handleData({isMove = false}) { 211 _handleData({isMove = false}) {
196 if (menuManageProvider.menuModel != null) { 212 if (menuManageProvider.menuModel != null) {
@@ -717,8 +733,8 @@ class _MenuManagePageState extends State<MenuManagePage> { @@ -717,8 +733,8 @@ class _MenuManagePageState extends State<MenuManagePage> {
717 } 733 }
718 734
719 _onLongPress(MenuSunModel model, int indexOut) async { 735 _onLongPress(MenuSunModel model, int indexOut) async {
720 - List<MenuSunModel> cookbooklist =  
721 - menuManageProvider.menuModel[indexOut].cookbooklist; 736 + MenuModel menumodel = menuManageProvider.menuModel[indexOut];
  737 + List<MenuSunModel> cookbooklist = menumodel.cookbooklist;
722 Map object = await DialogUtil.menuMagageAlertDialog( 738 Map object = await DialogUtil.menuMagageAlertDialog(
723 context, 739 context,
724 model.nameTypeList, 740 model.nameTypeList,
@@ -747,7 +763,14 @@ class _MenuManagePageState extends State<MenuManagePage> { @@ -747,7 +763,14 @@ class _MenuManagePageState extends State<MenuManagePage> {
747 // model.id 763 // model.id
748 //上一个id 764 //上一个id
749 // cookbooklist[model.indexNew-1].id 765 // cookbooklist[model.indexNew-1].id
750 - _setCookbookOrder(model.id, cookbooklist[model.indexNew - 1].id); 766 +
  767 + if (menumodel.classType == '1') {
  768 + //10道必点菜
  769 + _setCookbookOrderMarkeclass(
  770 + model.id, cookbooklist[model.indexNew - 1].id);
  771 + } else {
  772 + _setCookbookOrder(model.id, cookbooklist[model.indexNew - 1].id);
  773 + }
751 774
752 // var child = menuManageProvider.menuModel[indexOut].cookbooklist 775 // var child = menuManageProvider.menuModel[indexOut].cookbooklist
753 // .removeAt(model.indexNew); 776 // .removeAt(model.indexNew);
@@ -766,7 +789,13 @@ class _MenuManagePageState extends State<MenuManagePage> { @@ -766,7 +789,13 @@ class _MenuManagePageState extends State<MenuManagePage> {
766 //下一个id 789 //下一个id
767 // cookbooklist[model.indexNew+1].id 790 // cookbooklist[model.indexNew+1].id
768 791
769 - _setCookbookOrder(model.id, cookbooklist[model.indexNew + 1].id); 792 + if (menumodel.classType == '1') {
  793 + //10道必点菜
  794 + _setCookbookOrderMarkeclass(
  795 + model.id, cookbooklist[model.indexNew + 1].id);
  796 + } else {
  797 + _setCookbookOrder(model.id, cookbooklist[model.indexNew + 1].id);
  798 + }
770 // var child = menuManageProvider.menuModel[indexOut].cookbooklist 799 // var child = menuManageProvider.menuModel[indexOut].cookbooklist
771 // .removeAt(model.indexNew); 800 // .removeAt(model.indexNew);
772 801
@@ -483,6 +483,30 @@ class MenuManageProvider extends ChangeNotifier { @@ -483,6 +483,30 @@ class MenuManageProvider extends ChangeNotifier {
483 return false; 483 return false;
484 } 484 }
485 485
  486 +
  487 + /// 设置营销菜品移动
  488 + Future<bool> setCookbookOrderMarkeclass(
  489 + BuildContext context, Map<String, String> params,
  490 + {showLoading = false}) async {
  491 + BaseResp<dynamic> baseResp = await DioUtil()
  492 + .request<dynamic>(context, Method.post, HttpUrl.set_cookbook_order_markeclass,
  493 + data: params, showLoading: showLoading)
  494 + .catchError((error) {
  495 + print(error.toString());
  496 + Utils.showToast('移动失败,请重试!');
  497 + });
  498 +
  499 + if (baseResp != null && baseResp.code == Constant.status_success) {
  500 + if (baseResp.data == true) {
  501 + return true;
  502 + }
  503 + } else {
  504 + Utils.showToast(baseResp.msg ?? "");
  505 + }
  506 + return false;
  507 + }
  508 +
  509 +
486 ///修改菜品 510 ///修改菜品
487 Future<bool> setCookbookById(BuildContext context, Map<String, String> params, 511 Future<bool> setCookbookById(BuildContext context, Map<String, String> params,
488 {showLoading = false}) async { 512 {showLoading = false}) async {