Commit 9162d451ee3833cdae83ff7df5e938e9613443f6

Authored by wdn127929
1 parent b4ea73ff

10道必点菜移动

... ... @@ -573,4 +573,8 @@ class HttpUrl {
static const set_store_wine_sai_you_text =
"?service=App.Reserve.SetStoreWineSaiYouText"; // 配置商家存酒短信可变内容
static const set_cookbook_order_markeclass =
"?service=App.Cookbook.SetCookbookOrderMarkeclass"; // 设置营销菜品移动
}
... ...
... ... @@ -191,6 +191,22 @@ class _MenuManagePageState extends State<MenuManagePage> {
}
}
_setCookbookOrderMarkeclass(String id, String upid) async {
Map<String, String> params = {
// "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
"id": id,
'upid': upid
};
print(params);
bool sucess = await menuManageProvider
.setCookbookOrderMarkeclass(context, params, showLoading: true);
if (sucess) {
Utils.showToast('修改成功!');
//刷新列表数据
_getCookbookByClass(showLoading: true);
}
}
///处理数据
_handleData({isMove = false}) {
if (menuManageProvider.menuModel != null) {
... ... @@ -717,8 +733,8 @@ class _MenuManagePageState extends State<MenuManagePage> {
}
_onLongPress(MenuSunModel model, int indexOut) async {
List<MenuSunModel> cookbooklist =
menuManageProvider.menuModel[indexOut].cookbooklist;
MenuModel menumodel = menuManageProvider.menuModel[indexOut];
List<MenuSunModel> cookbooklist = menumodel.cookbooklist;
Map object = await DialogUtil.menuMagageAlertDialog(
context,
model.nameTypeList,
... ... @@ -747,7 +763,14 @@ class _MenuManagePageState extends State<MenuManagePage> {
// model.id
//上一个id
// cookbooklist[model.indexNew-1].id
_setCookbookOrder(model.id, cookbooklist[model.indexNew - 1].id);
if (menumodel.classType == '1') {
//10道必点菜
_setCookbookOrderMarkeclass(
model.id, cookbooklist[model.indexNew - 1].id);
} else {
_setCookbookOrder(model.id, cookbooklist[model.indexNew - 1].id);
}
// var child = menuManageProvider.menuModel[indexOut].cookbooklist
// .removeAt(model.indexNew);
... ... @@ -766,7 +789,13 @@ class _MenuManagePageState extends State<MenuManagePage> {
//下一个id
// cookbooklist[model.indexNew+1].id
_setCookbookOrder(model.id, cookbooklist[model.indexNew + 1].id);
if (menumodel.classType == '1') {
//10道必点菜
_setCookbookOrderMarkeclass(
model.id, cookbooklist[model.indexNew + 1].id);
} else {
_setCookbookOrder(model.id, cookbooklist[model.indexNew + 1].id);
}
// var child = menuManageProvider.menuModel[indexOut].cookbooklist
// .removeAt(model.indexNew);
... ...
... ... @@ -483,6 +483,30 @@ class MenuManageProvider extends ChangeNotifier {
return false;
}
/// 设置营销菜品移动
Future<bool> setCookbookOrderMarkeclass(
BuildContext context, Map<String, String> params,
{showLoading = false}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.post, HttpUrl.set_cookbook_order_markeclass,
data: params, showLoading: showLoading)
.catchError((error) {
print(error.toString());
Utils.showToast('移动失败,请重试!');
});
if (baseResp != null && baseResp.code == Constant.status_success) {
if (baseResp.data == true) {
return true;
}
} else {
Utils.showToast(baseResp.msg ?? "");
}
return false;
}
///修改菜品
Future<bool> setCookbookById(BuildContext context, Map<String, String> params,
{showLoading = false}) async {
... ...