diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js index 38586b9..bf8cbfe 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js @@ -4687,6 +4687,11 @@ Page({ s.my_warnning("还未登录!", 0, this); return; } + + wx.showLoading({ + mask:true + }); + var e = this, th = e, o = this.data.sele_g; @@ -4698,6 +4703,7 @@ Page({ //---判断商品是否超出限购--- if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) { + wx.hideLoading(); wx.showModal({ title: '提示', content: '超出商品限购' @@ -4718,7 +4724,9 @@ Page({ sto_sele_name: "" }); - if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); + if (th.data.sto_sele_name == ""){ + wx.hideLoading();return s.my_warnning("请选择门店", 0, th); + } //--------------此时操作的数据------------ var newd = { @@ -4789,8 +4797,8 @@ Page({ th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) { if (CanOutQty) { - if (CanOutQty < e.data.goodsInputNum) { + wx.hideLoading(); wx.showToast({ title: '库存不足!', icon: 'none', @@ -4800,6 +4808,7 @@ Page({ th.by_next_func(newd); } else { + wx.hideLoading(); wx.showToast({ title: '库存不足!', icon: 'none', @@ -4810,6 +4819,7 @@ Page({ } else { if (o.store_count <= 0) { + wx.hideLoading(); wx.showToast({ title: '库存已为空!', icon: 'none', @@ -4819,6 +4829,7 @@ Page({ } if (o.store_count < e.data.goodsInputNum) { + wx.hideLoading(); wx.showToast({ title: '库存不足!', icon: 'none', diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index 53d715b..7ade854 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -1389,7 +1389,9 @@ Page({ return false; } - + wx.showLoading({ + mask:true + }) //如果是秒杀的话,要看redis够不够 if (this.data.prom_type == 1 || this.data.prom_type == 2) { @@ -1403,7 +1405,7 @@ Page({ this.getactLen(function (num) { if (num < th.data.goodsInputNum) { - + wx.hideLoading(); // getApp().my_warnning("活动库存不足!", 0, th); wx.showToast({ title: '活动库存不足!', @@ -1583,10 +1585,12 @@ Page({ add_cart_func: function (t) { var i = getApp().request; if (oo.user_id == null) { + wx.hideLoading(); return s.my_warnning("还未登录!", 0, this); } if (!getApp().globalData.userInfo) { + wx.hideLoading(); return s.my_warnning("还未登录!", 0, this); } @@ -1601,6 +1605,7 @@ Page({ //---判断商品是否超出限购--- if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) { + wx.hideLoading(); wx.showToast({ title: '超出商品限购', icon: 'none', @@ -1612,6 +1617,7 @@ Page({ //---判断商品是否超出活动限购--- if ((th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0) && !th.data.is_normal) { if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) { + wx.hideLoading(); wx.showToast({ title: '超出商品活动限购', icon: 'none', @@ -1621,12 +1627,16 @@ Page({ } } - if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th); + if (th.data.goodsInputNum <= 0){ + wx.hideLoading();return s.my_warnning("商品数量不能为0", 0, th); + } if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) th.setData({ sto_sele_name: "" }); - if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); + if (th.data.sto_sele_name == ""){ + wx.hideLoading();return s.my_warnning("请选择门店", 0, th); + } //--------------此时操作的数据------------ var newd = { @@ -1703,6 +1713,7 @@ Page({ th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) { if (CanOutQty) { if (CanOutQty < e.data.goodsInputNum) { + wx.hideLoading(); wx.showToast({ title: '库存不足!', icon: 'none', @@ -1712,6 +1723,7 @@ Page({ th.add_cart_next(e, t, a, o, newd, CanOutQty); } else { + wx.hideLoading(); wx.showToast({ title: '库存不足!', icon: 'none', @@ -1723,47 +1735,48 @@ Page({ } else { if (o.store_count <= 0) { + wx.hideLoading(); wx.showToast({ title: '库存已为空!', icon: 'none' }); return false; - }; + } if (o.store_count < e.data.goodsInputNum) { + wx.hideLoading(); wx.showToast({ title: '库存不足!', icon: 'none', }); return false; // return s.my_warnning("库存不足!", 0, th); - }; + } th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 }; - return false; } newd.goods_price = th.data.prom_price; newd.member_goods_price = th.data.prom_price, - newd.prom_type = th.data.prom_type; + newd.prom_type = th.data.prom_type; newd.prom_id = th.data.prom_id; if (o.store_count <= 0) { + wx.hideLoading(); wx.showToast({ title: '库存已为空!', icon: 'none', }); return false; - //return s.my_warnning("库存已为空!", 0, th); - }; + } if (o.store_count < e.data.goodsInputNum) { + wx.hideLoading(); wx.showToast({ title: '库存不足!', icon: 'none', }); return false; - }; - + } th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 } else if (o.prom_type == 7) { @@ -1776,6 +1789,7 @@ Page({ newd.prom_id = th.data.sele_g.act.id; newd.prom_type = 7; if (o.store_count <= 0) { + wx.hideLoading(); wx.showToast({ title: '库存已为空!', icon: 'none', @@ -1783,6 +1797,7 @@ Page({ return false; }; if (o.store_count < e.data.goodsInputNum) { + wx.hideLoading(); wx.showToast({ title: '库存不足!', icon: 'none', @@ -1801,6 +1816,7 @@ Page({ if (CanOutQty) { if (CanOutQty < e.data.goodsInputNum) { + wx.hideLoading(); wx.showToast({ title: '库存不足!', icon: 'none', @@ -1810,6 +1826,7 @@ Page({ th.add_cart_next(e, t, a, o, newd, CanOutQty); } else { + wx.hideLoading(); wx.showToast({ title: '库存不足!', icon: 'none', @@ -1820,6 +1837,7 @@ Page({ } else { if (o.store_count <= 0) { + wx.hideLoading(); wx.showToast({ title: '库存已为空!', icon: 'none', @@ -1828,6 +1846,7 @@ Page({ //return s.my_warnning("库存已为空!", 0, th); }; if (o.store_count < e.data.goodsInputNum) { + wx.hideLoading(); wx.showToast({ title: '库存不足!', icon: 'none', @@ -1854,6 +1873,7 @@ Page({ if (CanOutQty) { if (CanOutQty < e.data.goodsInputNum) { + wx.hideLoading(); wx.showToast({ title: '库存不足!', icon: 'none', @@ -1863,6 +1883,7 @@ Page({ th.add_cart_next(e, t, a, o, newd, CanOutQty); } else { + wx.hideLoading(); wx.showToast({ title: '库存不足!', icon: 'none', @@ -1873,6 +1894,7 @@ Page({ } else { if (o.store_count <= 0) { + wx.hideLoading(); wx.showToast({ title: '库存已为空!', icon: 'none', @@ -1881,13 +1903,14 @@ Page({ //return s.my_warnning("库存已为空!", 0, th); }; if (o.store_count < e.data.goodsInputNum) { + wx.hideLoading(); wx.showToast({ title: '库存不足!', icon: 'none', }); return false; //return s.my_warnning("库存不足!", 0, th); - }; + } th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 } } @@ -1899,6 +1922,8 @@ Page({ //---加入购物车的最后一步--- add_cart_next(e, t, a, o, newd, CanOutQty) { + + if (getApp().globalData.groupchat_id) { newd.groupchat_id = getApp().globalData.groupchat_id } @@ -1988,6 +2013,7 @@ Page({ //判断数量,要看下购物车中有没有该商品 if (CanOutQty) { if (item.goods_num + th.data.goodsInputNum > CanOutQty) { + wx.hideLoading(); wx.showToast({ title: '库存不足!', icon: 'none', @@ -1997,6 +2023,7 @@ Page({ } } else { if (item.goods_num + th.data.goodsInputNum > o.store_count) { + wx.hideLoading(); wx.showToast({ title: '库存不足!', icon: 'none', @@ -2007,6 +2034,7 @@ Page({ //秒杀有限购的时候,同时不是普通购买 if ( item.goods_num + th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit && th.data.prom_buy_limit>0 && !newd.is_pd_normal && (th.data.prom_type == 1 || th.data.prom_type == 2)) { + wx.hideLoading(); wx.showToast({ title: '此商品已在购物车,去购物车结算!', icon: 'none', @@ -2047,6 +2075,7 @@ Page({ getApp().request.put("/api/weshop/cart/update", { data: updata, success: function (t) { + wx.hideLoading(); getApp().my_warnning('加入购物车成功', 1, th, 450); var c_num = th.data.cartGoodsNum + th.data.goodsInputNum; th.setData({ @@ -2059,6 +2088,7 @@ Page({ getApp().request.post("/api/weshop/cart/save", { data: newd, success: function (t) { + wx.hideLoading(); getApp().my_warnning('加入购物车成功', 1, th, 450); var c_num = th.data.cartGoodsNum + e.data.goodsInputNum; th.setData({ @@ -5241,12 +5271,18 @@ Page({ o = this.data.sele_g; + wx.showLoading({ + mask:true + }) + //----------添加到购物车时,要判断限购数量,-------- e.get_buy_num(o, async function (ee) { //---判断商品是否超出限购--- if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) { + + wx.hideLoading(); wx.showToast({ title: '超出商品限购', icon: 'none', @@ -5264,6 +5300,7 @@ Page({ //---判断商品是否超出活动限购,拼团的普通购买不计算活动的限购--- if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && th.data.is_normal != 1) { if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) { + wx.hideLoading(); wx.showToast({ title: '超出商品活动限购', icon: 'none', @@ -5283,6 +5320,7 @@ Page({ if (th.data.is_normal != 1) { if (o.store_count <= 0) { + wx.hideLoading(); wx.showToast({ title: '库存已为空!', icon: 'none', @@ -5298,6 +5336,7 @@ Page({ }) if (th.data.goodsInputNum > redis_num) { + wx.hideLoading(); wx.showToast({ title: '超出商品活动库存', icon: 'none', @@ -5311,6 +5350,7 @@ Page({ } } else { if (o.store_count <= 0) { + wx.hideLoading(); wx.showToast({ title: '库存已为空!', icon: 'none', @@ -5321,6 +5361,7 @@ Page({ } if (th.data.goodsInputNum <= 0) { + wx.hideLoading(); wx.showToast({ title: '商品数量不能为0', icon: 'none', @@ -5330,9 +5371,7 @@ Page({ }; if (th.data.goodsInputNum > o.store_count) { - // th.setData({ - // goodsInputNum: o.store_count - // }) + wx.hideLoading(); wx.showToast({ title: '超出商品库存', icon: 'none', @@ -5345,7 +5384,10 @@ Page({ th.setData({ sto_sele_name: "" }); - if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); + if (th.data.sto_sele_name == ""){ + wx.hideLoading(); + return s.my_warnning("请选择门店", 0, th); + } //--------------此时操作的数据------------ var newd = { goods_id: o.goods_id,