From b661d29e076fee34cf77f236c5440dfefe3b48fc Mon Sep 17 00:00:00 2001 From: yvan.ni Date: Mon, 28 Aug 2023 16:47:26 +0800 Subject: [PATCH] 购物车控制指定门店销售 --- pages/cart/cart/cart.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+), 0 deletions(-) diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js index 6c8fffa..37a3917 100644 --- a/pages/cart/cart/cart.js +++ b/pages/cart/cart/cart.js @@ -797,6 +797,30 @@ Page({ continue; } + //把活动写入 + item.prom=prom; + + //判断团购的限购 + if (item.goods_num + promgoodsbuynum > prom.buy_limit && prom.buy_limit > 0) { + var cbuy = prom.buy_limit - promgoodsbuynum; + if (cbuy <= 0) { + // var url = '/api/weshop/cart/del/' + oo.stoid + '/' + item.id; + // a.delete(url, {}); + th.disInvalid(item, 2); + continue; + } + //-- 购物车更新 -- + var updata1 = { + id: item.id, + goods_num: cbuy, + store_id: os.stoid, + user_id: getApp().globalData.userInfo.user_id + }; + getApp().request.put("/api/weshop/cart/update", { + data: updata1, + }) + item.goods_num = cbuy; + } } -- libgit2 0.21.4