diff --git a/app.js b/app.js index ad6b2b7..e674963 100644 --- a/app.js +++ b/app.js @@ -51,7 +51,7 @@ App({ config: null, //门店参数 config2: null, //门店配置 code: null, - user_id:16072538,//6520390,//6520352 + user_id:null,//6520390,//6520352 // user_id:6520314,// qa-6519858,// // user_id:14148118,// qa-6519858,// buy_now: null, diff --git a/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml b/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml index 38120f6..00a4994 100644 --- a/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml +++ b/packageC/pages/luckyGo/luckyGo_goodsInfo/buy_pt.wxml @@ -25,15 +25,14 @@ 已售:{{sele_g.sales_sum}} - - - 可售:{{def_pick_store.CanOutQty}} - 可售:0 + + 可售:{{def_pick_store.CanOutQty}} + 可售:0 + 可售:{{sele_g.store_count}} - - + - + 库存不足 @@ -1202,7 +1202,7 @@ - + 库存不足 diff --git a/packageE/pages/cart/cart2/cart2.js b/packageE/pages/cart/cart2/cart2.js index ff6be9e..b15a1fe 100644 --- a/packageE/pages/cart/cart2/cart2.js +++ b/packageE/pages/cart/cart2/cart2.js @@ -4069,7 +4069,7 @@ Page({ if ([0,3,5,7,10].indexOf(goods.prom_type)>-1){ if(mo_num>goods.goods_num){ - getApp().confirmBox(goods.goods_name + "的未到达起订数量"); + getApp().confirmBox(goods.goods_name + "的未达到起订数量"); th.data.is_summit_ing = 0; return false; } @@ -4452,7 +4452,7 @@ Page({ if ([0,3,5,7,10].indexOf(goods.prom_type)>-1){ if(mo_num>goods.goods_num){ - getApp().confirmBox(goods.goods_name + "的未到达起订数量"); + getApp().confirmBox(goods.goods_name + "的未达到起订数量"); th.data.is_summit_ing = 0; return false; } diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js index d172506..a67d003 100644 --- a/pages/cart/cart/cart.js +++ b/pages/cart/cart/cart.js @@ -1559,9 +1559,9 @@ Page({ valueToNum: function (t) { if (!this.data.is_load) return false; //控制住,避免事件响应冲突,只有input有输入的时候,才刷新 - if (this.data.btn_click) { - return false; - } + // if (this.data.btn_click) { + // return false; + // } this.data.btn_click = 1; var a = t.currentTarget.dataset.item; @@ -1848,7 +1848,7 @@ Page({ //-- 判断起购数量 -- if(!e.data.checkAllToggle){ //判断是不是有促销活动 - var act=await getApp().get_has_cx_act(gd_info.goods_id); + var act=await getApp().get_has_cx_act(obj.goods_id); th.click_set_limit(obj,i,j,act); } @@ -2102,7 +2102,7 @@ Page({ th.click_set_limit(gd_info,pitems,i,act) } - if (!gd_info.whsle_id && [1, 2, 4, 6, 8, 9].indexOf(gd_info.prom_type) == -1 && !gd_info.selected) { + if(!gd_info.whsle_id && [1, 2, 4, 6, 8, 9].indexOf(gd_info.prom_type) == -1 && !gd_info.selected && th.data.sales_rules >= 2 ) { var ob = {}; await th.check_down_line_next(gd_info, pitems, i, gd_info.erpwareid, function (res) { ob = res; @@ -2599,58 +2599,56 @@ Page({ }); }, - //----------------------更新购物数量,加减,调用接口--------------------- - postCardList: function (t, item, pitem) { - var e = this, - th = e, - user_id = getApp().globalData.user_id; - - function normal_check(store_count, goodsinfo, wareIds,cx_arr) { - - - // getApp().my_warnning('购买数量超出商品库存', 0, th); - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - //-- 要判断是不是起订量不购 -- - if([0,3,5,7,10].indexOf(goodsinfo.prom_type)>-1){ - var mo_num=getApp().get_limit_qty(goodsinfo,cx_arr.length); - var steep=getApp().get_limit_qty(goodsinfo,cx_arr.length,1); - if(mo_num>1 && t.goods_num1 && t.goods_num>mo_num && (t.goods_num-mo_num)%steep!=0 ){ - - wx.showToast({ - title: '购买数量必须是起订量的倍数', - icon: 'none', - }); - t.goods_num =mo_num+parseInt((t.goods_num-mo_num)/steep+'')*steep+steep; + //-- 循环汇总其他门店,其他活动有此商品的购买数量的汇总,不包含赠品 -- + get_goods_other(item, pitem,only){ + var goods_id = this.data.requestData[pitem].goods[item].goods_id; + var prom_type = this.data.requestData[pitem].goods[item].prom_type; + var prom_id = this.data.requestData[pitem].goods[item].prom_id; + + var num=0; + //-- 相同活动的商品汇总,秒杀,团购 -- + if(only==2){ + for (let j = 0; j < this.data.requestData.length;j++){ + if(j!=pitem){ + var goods=this.data.requestData[j].goods; + for (let k = 0; k = 2 && !goodsinfo.whsle_id) { - th.check_down_line(t, pitem, item, wareIds); - } else { - if (t.goods_num > store_count) { - wx.showToast({ - title: '购买数量超出商品库存', - icon: 'none', - }); - e.setData({ - [txt]: store_count - }); - e.doCheckAll(); - t.goods_num = store_count; + for (let i = 0; i < this.data.requestData[pitem].goods.length; i++) { + var t_item=this.data.requestData[pitem].goods[i] + if(i!=item && t_item.goods_id==goods_id && t_item.is_gift==0){ + num+=t_item.goods_num + } + } + if(only) return num; + for (let j = 0; j < this.data.requestData.length;j++){ + if(j!=pitem){ + var goods=this.data.requestData[j].goods; + for (let k = 0; k by ty // var buyed_mum2 = t.goods_num + goodsbuynum; var buyed_mum2 = t.goods_num; //<-- + // 判断当前预购买的数量是否超过可购买的数量,限购还要考虑到商品的库存 + if (limit > 0) { - // 判断当前预购买的数量是否超过可购买的数量 - if (buyed_mum2 > (limit - goodsbuynum) && limit > 0) { - wx.showToast({ - title: '购买数量超出商品限购', - icon: 'none', - }); //getApp().my_warnning('购买数量超出商品限购', 0, th); var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - - //--> by ty - var cbuy = limit - goodsbuynum; - // var cbuy = limit - buyed_mum2 + 1; - //<-- - - e.setData({ - // [txt]: cbuy > 0 ? cbuy : 0, - [txt]: cbuy > 0 ? cbuy : limit, - }); - e.doCheckAll(); - - t.goods_num = cbuy > 0 ? cbuy : limit; - - if([0,3,5,7,10].indexOf(goodsinfo.prom_type)>-1){ - - //-- 判断商品是不是 -- - var cx_arr=await getApp().get_has_cx_act(goodsinfo.goods_id); - - var mo_num=getApp().get_limit_qty(goodsinfo,cx_arr.length); - var steep=getApp().get_limit_qty(goodsinfo,cx_arr.length,1); - - if(mo_num>1 && t.goods_num1 && t.goods_num>mo_num && (t.goods_num-mo_num)%steep!=0 ){ - - wx.showToast({ - title: '购买数量必须是起订量的倍数', - icon: 'none', - }); - - t.goods_num=mo_num+parseInt((t.goods_num-mo_num)/steep+'')*steep - } + limit = limit - goodsbuynum; + if(limit<0) limit=0; + + if(buyed_mum2>limit){ + wx.showToast({ + title: '购买数量超出商品限购', + icon: 'none', + }); + is_showing=1; } - // t.goods_num = cbuy > 0 ? cbuy : 0, - e.update_cart(t, pitem, item); - return false; - } + // e.setData({ + // // [txt]: cbuy > 0 ? cbuy : 0, + // [txt]: cbuy > 0 ? cbuy : limit, + // }); + //e.doCheckAll(); + // t.goods_num = cbuy > 0 ? cbuy : limit; + // + // if([0,3,5,7,10].indexOf(goodsinfo.prom_type)>-1){ + // + // //-- 判断商品是不是 -- + // var cx_arr=await getApp().get_has_cx_act(goodsinfo.goods_id); + // var mo_num=getApp().get_limit_qty(goodsinfo,cx_arr.length); + // var steep=getApp().get_limit_qty(goodsinfo,cx_arr.length,1); + // + // if(mo_num>1 && t.goods_num1 && t.goods_num>mo_num && (t.goods_num-mo_num)%steep!=0 ){ + // + // wx.showToast({ + // title: '购买数量必须是起订量的倍数', + // icon: 'none', + // }); + // + // t.goods_num=mo_num+parseInt((t.goods_num-mo_num)/steep+'')*steep + // } + // } + // // t.goods_num = cbuy > 0 ? cbuy : 0, + // e.update_cart(t, pitem, item); + // return false; + } + else limit=100000; switch (goodsinfo.prom_type) { case 1: - //-- 读取秒杀 -- - rq.get("/api/ms/flash_sale/getFlashSaleOne/" + oo.stoid + "/" + goodsinfo.prom_id, { - isShowLoading: 0, - success: function (res_d) { - if (res_d.data.code == 0 && res_d.data.data) { - if (t.goods_num > store_count) { - // wx.showModal({ - // title: '提示', - // content: '购买数量超出商品库存' - // }); + //-- 读取秒杀 -- + var res_d= await getApp().promiseGet("/api/ms/flash_sale/getFlashSaleOne/" + oo.stoid + "/" + goodsinfo.prom_id, {}); + if (res_d.data.code == 0 && res_d.data.data) { + + var cbuy=limit; + if (t.goods_num> store_count && !is_showing) { wx.showToast({ title: '购买数量超出商品库存', icon: 'none', }); - // getApp().my_warnning('购买数量超出商品库存', 0, th); - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - e.setData({ - [txt]: store_count - }); - e.doCheckAll(); - - t.goods_num = store_count; - e.update_cart(t, pitem, item); - - return false; + is_showing=1; } + //一直都要给一个最小值,和库存比较 + if(cbuy>store_count) cbuy=store_count; var false_data = res_d.data.data; //--判断库存-- - if (t.goods_num > false_data.goods_num - false_data.buy_num) { - // wx.showModal({ - // title: '提示', - // content: '购买数量超出活动库存' - // }); + if (t.goods_num > false_data.goods_num - false_data.buy_num && !is_showing) { wx.showToast({ title: '购买数量超出活动库存', icon: 'none', }); - // getApp().my_warnning('购买数量超出活动库存', 0, th); - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - e.setData({ - [txt]: false_data.goods_num - false_data.buy_num - }); - e.doCheckAll(); - - t.goods_num = false_data.goods_num - false_data.buy_num; - e.update_cart(t, pitem, item); - - return false; + is_showing=1; } + //一直都要给一个最小值,和活动库存比较 + if(cbuy>false_data.goods_num - false_data.buy_num) + cbuy=false_data.goods_num - false_data.buy_num; + //--判断redis数量是否已经超出-- - if (t.goods_num > false_data.redisnum) { - // wx.showModal({ - // title: '提示', - // content: '购买数量超出商品库存' - // }); + if (t.goods_num > false_data.redisnum && !is_showing) { wx.showToast({ title: '购买数量超出商品库存', icon: 'none', }); - //getApp().my_warnning('购买数量超出商品库存', 0, th); - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - e.setData({ - [txt]: false_data.redisnum - }); - e.doCheckAll(); - - t.goods_num = false_data.redisnum; - e.update_cart(t, pitem, item); - return false; + is_showing=1; } + //一直都要给一个最小值,和活动库存比较 + if(cbuy>false_data.redisnum) cbuy=false_data.redisnum; + //--活动的限购是不是要判断-- - if (t.goods_num + promgoodsbuynum > false_data.buy_limit && false_data.buy_limit > 0) { - // wx.showModal({ - // title: '提示', - // content: '购买数量超出秒杀限购' - // }); - wx.showToast({ - title: '购买数量超出秒杀限购', - icon: 'none', - }); - // getApp().my_warnning('购买数量超出秒杀限购', 0, th); - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - e.setData({ - [txt]: false_data.buy_limit - }); - e.doCheckAll(); - t.goods_num = (false_data.buy_limit - promgoodsbuynum) ? false_data.buy_limit - promgoodsbuynum : 0; - e.update_cart(t, pitem, item); - return false; + if(false_data.buy_limit > 0) { + if(t.goods_num + promgoodsbuynum > false_data.buy_limit && !is_showing){ + wx.showToast({ + title: '购买数量超出秒杀限购', + icon: 'none', + }); + } + var act_limit=false_data.buy_limit-promgoodsbuynum; + if(!act_limit) act_limit=0; + if(cbuy>act_limit) cbuy=act_limit; + } + + if(t.goods_num>cbuy) t.goods_num=cbuy; + e.update_cart(t, pitem, item); - } else { - normal_check(store_count, goodsinfo, wareIds); - } - } - }) - break; + } else { + e.normal_check(t, item, pitem,store_count,limit,goodsinfo, wareIds); //普通商品的调用和计算 + } + break; case 2: - getApp().request.promiseGet("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + goodsinfo.goods_id + "/" + goodsinfo.prom_id, {}).then(res => { + + //-- 读取团购 -- + var res= await getApp().promiseGet("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + goodsinfo.goods_id + "/" + goodsinfo.prom_id, {}); if (res.data.code == 0 && res.data.data) { - if (t.goods_num > store_count) { - // wx.showModal({ - // title: '提示', - // content: '购买数量超出商品库存' - // }); + + var cbuy=limit; + if (t.goods_num > store_count && !is_showing) { wx.showToast({ title: '购买数量超出商品库存', icon: 'none', }); - // getApp().my_warnning('购买数量超出商品库存', 0, th); - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - e.setData({ - [txt]: store_count - }); - e.doCheckAll(); - - t.goods_num = store_count; - e.update_cart(t, pitem, item); - - return false; + is_showing=1; } + //一直都要给一个最小值,和库存比较 + if(cbuy>store_count) cbuy=store_count; var gr_data = res.data.data; //--判断库存-- - if (t.goods_num > gr_data.goods_num - gr_data.buy_num) { - // wx.showModal({ - // title: '提示', - // content: '购买数量超出活动库存' - // }); + if (t.goods_num > gr_data.goods_num - gr_data.buy_num && !is_showing) { wx.showToast({ title: '购买数量超出活动库存', icon: 'none', }); - // getApp().my_warnning('购买数量超出活动库存', 0, th); - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - e.setData({ - [txt]: gr_data.goods_num - gr_data.buy_num - }); - e.doCheckAll(); - - t.goods_num = gr_data.goods_num - gr_data.buy_num; - e.update_cart(t, pitem, item); - - return false; + is_showing=1; } + //一直都要给一个最小值,和库存比较 + if(cbuy>gr_data.goods_num - gr_data.buy_num ) cbuy=gr_data.goods_num - gr_data.buy_num; //--判断redis数量是否已经超出-- - if (t.goods_num > gr_data.redisnum) { - // wx.showModal({ - // title: '提示', - // content: '购买数量超出商品库存' - // }); + if (t.goods_num > gr_data.redisnum && !is_showing) { wx.showToast({ title: '购买数量超出商品库存', icon: 'none', }); - // getApp().my_warnning('购买数量超出商品库存', 0, th); - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - e.setData({ - [txt]: gr_data.redisnum - }); - e.doCheckAll(); - - t.goods_num = gr_data.redisnum; - e.update_cart(t, pitem, item); - return false; + is_showing=1; } + if(cbuy>gr_data.redisnum) cbuy=gr_data.redisnum; //--活动的限购是不是要判断-- - if (t.goods_num + promgoodsbuynum > gr_data.buy_limit && gr_data.buy_limit > 0) { - // wx.showModal({ - // title: '提示', - // content: '购买数量超出团购限购' - // }); - wx.showToast({ - title: '购买数量超出团购限购', - icon: 'none', - }); - // getApp().my_warnning('购买数量超出团购限购', 0, th); - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - e.setData({ - [txt]: gr_data.buy_limit - }); - e.doCheckAll(); + if (gr_data.buy_limit > 0) { + if(t.goods_num + promgoodsbuynum > gr_data.buy_limit && !is_showing){ + wx.showToast({ + title: '购买数量超出团购限购', + icon: 'none', + }); + is_showing=1; + } - t.goods_num = (gr_data.buy_limit - promgoodsbuynum) ? gr_data.buy_limit - promgoodsbuynum : 0; - e.update_cart(t, pitem, item); - return false; + var act_limit=gr_data.buy_limit-promgoodsbuynum; + if(!act_limit) act_limit=0; + + if(cbuy>act_limit) cbuy=act_limit; } + + if(t.goods_num>cbuy) t.goods_num=cbuy; + e.update_cart(t, pitem, item); } else { - normal_check(store_count, goodsinfo, wareIds); + e.normal_check(t, item, pitem,store_count,limit,goodsinfo, wareIds); //普通商品的调用和计算 } - }) - break; + break; default: - var cx_arr=await getApp().get_has_cx_act(goodsinfo.goods_id); - normal_check(store_count, goodsinfo, wareIds,cx_arr); + e.normal_check(t, item, pitem,store_count,limit,goodsinfo, wareIds); //普通商品的调用和计算 break } } }); }, + //-- 这个函数在计算的时候,要包含限购的那一部分 -- + async normal_check(t, item, pitem,store_count,limit,goodsinfo, wareIds){ + + var cx_arr=await getApp().get_has_cx_act(goodsinfo.goods_id); + + var th=this; + // getApp().my_warnning('购买数量超出商品库存', 0, th); + var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; + + + var cQty=store_count; + //--- 看一下是不是线下库存 --- + if (th.data.sales_rules >= 2 && !goodsinfo.whsle_id) { + //th.check_down_line(t, pitem, item, wareIds,limit); + var ob = {}; + await th.check_down_line_next(t, pitem, item, wareIds, function (res) { + ob = res; + }); + cQty=ob.CanOutQty; + //-- 只获取相同门店,2的时候,因为是线下不同的门店,所以库存再不同门店是不一样的 -- + if(th.data.sales_rules== 2) other_gd_num=th.get_goods_other(item, pitem,1); + } + + var is_showing=0; + var cbuy=limit; + if (t.goods_num > limit) { + wx.showToast({ + title: '购买数量超出商品限购', + icon: 'none', + }); + is_showing=1; + } + + if (t.goods_num > cQty) { + if(!is_showing){ + wx.showToast({ + title: '购买数量超出商品库存', + icon: 'none', + }); + is_showing=1; + } + } + if(cbuy>cQty) cbuy=cQty; + + if(t.goods_num>cbuy) t.goods_num=cbuy; + + if([0,3,5,7,10].indexOf(goodsinfo.prom_type)>-1){ + var mo_num=getApp().get_limit_qty(goodsinfo,cx_arr.length); + var steep=getApp().get_limit_qty(goodsinfo,cx_arr.length,1); + + if(mo_num>1 && t.goods_num1 && t.goods_num>mo_num && (t.goods_num-mo_num)%steep!=0){ + if(!is_showing) { + wx.showToast({ + title: '购买数量必须是起订量的倍数', + icon: 'none', + }); + } + if(t.goods_num= 2 && this_obj.selected) { var goods_id = this_obj.goods_id; - var num = 0; for (let i = 0; i < this.data.requestData.length; i++) { @@ -3257,17 +3247,15 @@ Page({ return false; } - - } } - - this.update_cart(t, pitem, item); }, + + //---检验线下库存的数量的子函数--- async check_down_line_next(t, pitem, item, erpwareid, func) { @@ -3408,7 +3396,6 @@ Page({ //--------------去结算------------ async checkout() { - if (getApp().is_sp_hao()) { wx.showToast({ title: "视频号不支持购物车购买", @@ -3511,7 +3498,7 @@ Page({ if([0,3,5,7,10].indexOf(py_type)>-1){ if(mo_num>i_arr[j].goods_num){ - getApp().confirmBox(i_arr[j].goods_name + "的未到达起订数量"); + getApp().confirmBox(i_arr[j].goods_name + "的未达到起订数量"); wx.hideLoading(); return false; } @@ -3534,7 +3521,6 @@ Page({ } - //--普通商品,如果有开启线下库存的功能,要调用线下库存进行计算,赠品不要进行调用线下库存--- if ((i_arr[j].prom_type == 0 || i_arr[j].prom_type == 3 || i_arr[j].prom_type == 5 || i_arr[j].prom_type == 7 || i_arr[j].prom_type == 10 || i_arr[j].need_downlow_num) && th.data.sales_rules >= 2 && i_arr[j].is_gift != 1 && !i_arr[j].whsle_id) { @@ -3644,9 +3630,6 @@ Page({ return false } - - - if (checkArr7.length > 0) { let checkStr = [] checkArr7.map(item => { diff --git a/pages/goods/goodsInfo/buy_com_pop.wxml b/pages/goods/goodsInfo/buy_com_pop.wxml index 80fd82f..9dd9a1c 100644 --- a/pages/goods/goodsInfo/buy_com_pop.wxml +++ b/pages/goods/goodsInfo/buy_com_pop.wxml @@ -141,7 +141,7 @@ - 库存不足 @@ -156,7 +156,7 @@ - + 库存不足 diff --git a/pages/goods/goodsInfo/buy_integral.wxml b/pages/goods/goodsInfo/buy_integral.wxml index cf62a58..4e47ae6 100644 --- a/pages/goods/goodsInfo/buy_integral.wxml +++ b/pages/goods/goodsInfo/buy_integral.wxml @@ -48,7 +48,7 @@ (配送不匹配) - (库存不足) + (库存不足) diff --git a/pages/goods/goodsInfo/buy_pt.wxml b/pages/goods/goodsInfo/buy_pt.wxml index 00c864b..896489e 100644 --- a/pages/goods/goodsInfo/buy_pt.wxml +++ b/pages/goods/goodsInfo/buy_pt.wxml @@ -183,7 +183,7 @@ - + 库存不足 @@ -194,7 +194,7 @@ - + 库存不足 diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index b9ef2cb..3d9f94b 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -2407,12 +2407,18 @@ Page({ }, //----------减少购买数量----------- subCartNum: function (t) { - var add_num=1; var p_type=parseInt(this.data.prom_type) if([1,2,4,6,8,9].indexOf(p_type)==-1 || this.data.openSpecModal_inte_normal == 1 || this.data.is_normal == 1){ add_num = getApp().get_limit_qty(this.data.sele_g, this.data.is_act, 1); - + var mo_num = getApp().get_limit_qty(this.data.sele_g, this.data.is_act); + if(this.data.goodsInputNum - add_num 0) { @@ -2453,13 +2462,16 @@ Page({ title: '超出商品限购', icon: 'none', }); + + is_show_bs=1; + // s.my_warnning('超出商品限购', 0, th); - var num = th.data.sele_g.viplimited - gd_buy_num; - if (num < 0) num = 0; - th.setData({ - goodsInputNum: num - }) - return false; + l_num = th.data.sele_g.viplimited - gd_buy_num; + if (l_num < 0) l_num = 0; + // th.setData({ + // goodsInputNum: num + // }) + // return false; } } @@ -2527,25 +2539,47 @@ Page({ } } + //-- 限购数量也要进行计算一下 -- + if(l_num>-1){ + if(e>l_num) e=l_num; + } + //--- 促销活动也不控制起订量, 这里很重要的一个控制,起订量的 ---- if([0,3,5,7,10].indexOf(p_type)>-1 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1){ - if(tmo_num && (t-mo_num)%steep!=0){ - wx.showToast({ - title: '购买数必须是起订量的倍数', - icon: 'none', - }); + + if(!is_show_bs){ + wx.showToast({ + title: '购买数必须是起订量的倍数', + icon: 'none', + }); + } + t=mo_num+ parseInt((t-mo_num)/steep)*steep+steep; + is_show_bs=1; } } if (!e) e = 0; //库存不足,不增加 if (e < t) { - wx.showToast({ - title: '库存不足', - icon: 'none', - }); + if(!is_show_bs){ + wx.showToast({ + title: '库存不足', + icon: 'none', + }); + } + // wx.showModal({title: '库存不足',}); if (e < 0) e = 0; @@ -3362,6 +3396,18 @@ Page({ }) } + //拼团在点击回来的时候,还是只能是立即购买,不能有购物车的情况 + if(this.data.base_nor_prom_type==6 && parseInt(gid+'')==parseInt(this.data.base_nor_goods_id+'')){ + this.setData({ + openSpecModal_pt:1, + openSpecModal:0, + sku_g:this.data.sku_g_pt, + is_normal:1 + }) + nor=1; + } + + //that.data.change=1; var item = null; for (var i in sku_g) { @@ -3392,10 +3438,12 @@ Page({ }); + if (nor) that.get_sto(1); else that.get_sto(); - if (!item.whsle_id && [1,2,4,6].indexOf(item.prom_type)==-1) that.check_is_youhui(gid, that.data.is_normal); + if (!item.whsle_id && ([1,2,4,6].indexOf(item.prom_type)==-1 || this.data.is_normal==1)) + that.check_is_youhui(gid, that.data.is_normal); //默认门店要拿下门店库存 if (that.data.sales_rules >= 2 && that.data.def_pick_store && !that.data.sele_g.whsle_id && [1,2,4,6].indexOf(item.prom_type)==-1) { @@ -5131,9 +5179,10 @@ 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.showToast({ - title: '超出商品限购', - icon: 'none', + title: '超出商品限购', + icon: 'none', }); + // s.my_warnning('超出商品限购', 0, th); var num = th.data.prom_buy_limit - th.data.prom_buy_num; if (num < 0) num = 0; @@ -5212,9 +5261,10 @@ Page({ // return s.my_warnning("商品数量不能为0", 0, th); }; if (th.data.goodsInputNum > o.store_count) { - th.setData({ - goodsInputNum: o.store_count - }) + + // th.setData({ + // goodsInputNum: o.store_count + // }) wx.showToast({ title: '超出商品库存', icon: 'none', @@ -7561,6 +7611,9 @@ Page({ this.data.is_act=1; } + console.log("11111111-gd"); + console.log(th.data.sele_g); + //-- 更新默认购买的数量 --- var mo_num=getApp().get_limit_qty(th.data.sele_g,this.data.is_act); this.setData({goodsInputNum:mo_num}) diff --git a/pages/goods/goodsInfo/goodsInfo.wxml b/pages/goods/goodsInfo/goodsInfo.wxml index 7fab3ed..3fa9e37 100644 --- a/pages/goods/goodsInfo/goodsInfo.wxml +++ b/pages/goods/goodsInfo/goodsInfo.wxml @@ -1410,7 +1410,7 @@ - + 库存不足 @@ -1426,7 +1426,7 @@ - + 库存不足