From 4006285e0f0e935f1c8412d03d4c2d0ce247ab8f Mon Sep 17 00:00:00 2001 From: banche Date: Fri, 18 Mar 2022 20:41:10 +0800 Subject: [PATCH] fix:修改购物车检测库存 --- pages/cart/cart/cart.js | 51 ++++++++++++++++++++++----------------------------- 1 file changed, 22 insertions(+), 29 deletions(-) diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js index 610ce3c..2748cbb 100644 --- a/pages/cart/cart/cart.js +++ b/pages/cart/cart/cart.js @@ -2037,7 +2037,7 @@ Page({ // 检测库存 if(redis_num == 0) { wx.showModal({ - title: '超出活动库存1', + title: '超出活动库存', }); th.setData({[txt]: redis_num}); return false; @@ -2135,36 +2135,29 @@ Page({ }; // 个人限购 - //----获取用户活动购买数---- - await getApp().request.get("/api/weshop/rechargeServicelist/getUserBuyGoodsNum", { - data: { - store_id: t.store_id, - user_id: getApp().globalData.user_id, - card_id: t.goods_id, - prom_type: t.prom_type, - prom_id: t.prom_id - }, - //-----获取----- - success: function (tt) { - if (tt.data.code == 0) { - th.setData({ - promcardbuynum: tt.data.data.promcardbuynum, - cardbuynum: tt.data.data.cardbuynum, - }); - }; - }, - - }); + //----获取用户活动购买数---- + await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum?store_id="+t.store_id+"&user_id="+getApp().globalData.user_id+"&card_id="+t.goods_id+"&prom_type="+t.prom_type+"&prom_id="+t.prom_id, { + }).then(tt => { + if (tt.data.code == 0) { + th.setData({ + promcardbuynum: tt.data.data.promcardbuynum, + cardbuynum: tt.data.data.cardbuynum, + }); + }; + }); + + var buylimit = 0 - await getApp().request.get("/api/ms/flash_sale/getNew/" + t.store_id + "/" + getApp().globalData.user_id + "/" + t.prom_id, { - success: function (res) { - if(res.data.code == 0) { - th.data.sele_g = res.data.data; - th.data.sele_g.viplimited = res.data.data.buy_limit; - buylimit = res.data.data.buy_limit; - }; - }, + await getApp().request.promiseGet("/api/ms/flash_sale/getNew/" + t.store_id + "/" + getApp().globalData.user_id + "/" + t.prom_id, { + + }).then(res => { + if(res.data.code == 0) { + + th.data.sele_g = res.data.data; + th.data.sele_g.viplimited = res.data.data.buy_limit; + buylimit = res.data.data.buy_limit; + }; }); -- libgit2 0.21.4