From f65a3916327d2a645ea0b474f2469ee91964a016 Mon Sep 17 00:00:00 2001 From: yvan.ni Date: Fri, 10 Feb 2023 09:14:56 +0800 Subject: [PATCH] 跳转的优化 --- pages/cart/cart/cart.wxml | 2 +- pages/goods/goodsInfo/goodsInfo.js | 93 +++++++++++++++++++++++---------------------------------------------------------------------- pages/goods/goodsInfo/goodsInfo.wxml | 2 +- 3 files changed, 25 insertions(+), 72 deletions(-) diff --git a/pages/cart/cart/cart.wxml b/pages/cart/cart/cart.wxml index 144a4e6..60e8fab 100644 --- a/pages/cart/cart/cart.wxml +++ b/pages/cart/cart/cart.wxml @@ -88,7 +88,7 @@ - {{items.goods_name}} + {{items.goods_name}} diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index 0207e7c..fb86ab6 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -261,6 +261,7 @@ Page({ hiddenCS: true, is_retail_price: 0, + is_no_new:0 }, //------初始化加载---------- @@ -1422,7 +1423,6 @@ Page({ icon: 'none', }); return false; - // return s.my_warnning("库存已为空!", 0, th); }; if (o.store_count < e.data.goodsInputNum) { wx.showToast({ @@ -1610,7 +1610,6 @@ Page({ icon: 'none' }); return false; - // s.my_warnning("库存已为空!", 0, th); }; if (o.store_count < e.data.goodsInputNum) { wx.showToast({ @@ -1632,7 +1631,7 @@ Page({ newd.prom_type = th.data.prom_type; newd.prom_id = th.data.prom_id; - if (o.store_count <= 0) { + if (o.store_count <= 0 && th.data.is_no_new) { wx.showToast({ title: '库存已为空!', icon: 'none', @@ -1640,13 +1639,12 @@ Page({ return false; //return s.my_warnning("库存已为空!", 0, th); }; - if (o.store_count < e.data.goodsInputNum) { + if (o.store_count < e.data.goodsInputNum && th.data.is_no_new) { wx.showToast({ title: '库存不足!', icon: 'none', }); return false; - // return s.my_warnning("库存不足!", 0, th); }; th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 @@ -1666,7 +1664,6 @@ Page({ icon: 'none', }); return false; - //return s.my_warnning("库存已为空!", 0, th); }; if (o.store_count < e.data.goodsInputNum) { wx.showToast({ @@ -1682,62 +1679,6 @@ Page({ //---如果是线下门店销售的时候--- if (th.data.sales_rules >= 2) { var pick = th.get_pick_from_list(th.data.sto_sele_id) - //---通过接口获取门店的线下库存信息-- - // getApp().request.get("/api/weshop/goods/getWareStorages", { - // data: { - // storageNos: pick.pickup_no, - // wareIds: encodeURIComponent(th.data.sele_g.erpwareid), - // storeId: os.stoid - // }, - // success: function (res) { - // if (res.data.code == 0) { - // if (res.data.data.pageData.length > 0) { - // var CanOutQty = res.data.data.pageData[0].CanOutQty; - // if (CanOutQty < e.data.goodsInputNum) { - // wx.showToast({ - // title: '库存不足!', - // icon: 'none', - // }); - // return false; - // //return s.my_warnning("库存不足!", 0, th); - // } - // //在调一次接口,读取商品的预出库的数量,lock - // getApp().request.get("/api/weshop/order/ware/lock/page", { - // data: { - // store_id: os.stoid, - // wareId: th.data.sele_g.goods_id, - // storageId: pick.pickup_id, - // pageSize: 1000 - // }, - // success: function (res_data) { - // if (res_data.data.code == 0 && res_data.data.data.total > 0) { - // - // var lock = 0; - // for (var i in res_data.data.data.pageData) { - // lock += res_data.data.data.pageData[i].outQty; - // } - // - // if (CanOutQty <= lock) { - // wx.showToast({ - // title: '库存不足!', - // icon: 'none', - // }); - // return false; - // //return s.my_warnning("库存不足!", 0, th); - // } - // th.add_cart_next(e, t, a, o, newd, CanOutQty - lock); - // } else { - // th.add_cart_next(e, t, a, o, newd, CanOutQty); - // } - // } - // }) - // } else { - // return s.my_warnning("库存不足!", 0, th); - // } - // - // } - // } - // }) th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) { if (CanOutQty) { @@ -4869,14 +4810,7 @@ Page({ var e = this, th = e, o = this.data.sele_g; - if (o.store_count <= 0) { - wx.showToast({ - title: '库存已为空!', - icon: 'none', - }); - return false; - // return s.my_warnning("库存已为空!", 0, th); - }; + //----------添加到购物车时,要判断限购数量,-------- e.get_buy_num(o, async function (ee) { @@ -4917,6 +4851,15 @@ Page({ var redis_num = 0 //不是普通购买的时候 if (th.data.is_normal != 1) { + + if (o.store_count <= 0 && th.data.is_no_new) { + wx.showToast({ + title: '库存已为空!', + icon: 'none', + }); + return false; + }; + //-------判断活动是否抢光--------- await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/6/" + th.data.sele_g.prom_id, { 1: 1 @@ -4937,6 +4880,16 @@ Page({ return false; } } + else{ + if (o.store_count <= 0) { + wx.showToast({ + title: '库存已为空!', + icon: 'none', + }); + return false; + }; + + } if (th.data.goodsInputNum <= 0) { wx.showToast({ diff --git a/pages/goods/goodsInfo/goodsInfo.wxml b/pages/goods/goodsInfo/goodsInfo.wxml index 49dbab7..9162c61 100644 --- a/pages/goods/goodsInfo/goodsInfo.wxml +++ b/pages/goods/goodsInfo/goodsInfo.wxml @@ -1398,7 +1398,7 @@ - + 库存不足 -- libgit2 0.21.4