Commit 724e8f1ce4d2fb6a6f5135d5080c65278420a9c5
1 parent
f23c7b78
1. 解决急速模式的问题
2. 阶梯团 还差多少人活动最优时,要转化成整形计算
Showing
1 changed file
with
44 additions
and
33 deletions
pages/goods/goodsInfo/goodsInfo.js
@@ -234,6 +234,8 @@ Page({ | @@ -234,6 +234,8 @@ Page({ | ||
234 | is_collect_load:0, //是不是处理 | 234 | is_collect_load:0, //是不是处理 |
235 | is_newsales_rules:0, //是否开启最新的门店规则,此时会新读门店,当点击选择门店时会触发读取线下库存 | 235 | is_newsales_rules:0, //是否开启最新的门店规则,此时会新读门店,当点击选择门店时会触发读取线下库存 |
236 | sales_rules:1, //默认是线上销售 | 236 | sales_rules:1, //默认是线上销售 |
237 | + | ||
238 | + wait_for_user_store:null, | ||
237 | 239 | ||
238 | }, | 240 | }, |
239 | 241 | ||
@@ -624,40 +626,49 @@ Page({ | @@ -624,40 +626,49 @@ Page({ | ||
624 | 626 | ||
625 | 627 | ||
626 | //获取统一条形码,普通商品和优惠促销的商品 | 628 | //获取统一条形码,普通商品和优惠促销的商品 |
627 | - if (ee.data.data.prom_type == 0 || ee.data.data.prom_type == 2 || ee.data.data.prom_type == 3 || ee.data.data.prom_type == 4 || ee.data.data.prom_type == 5){ | ||
628 | - | 629 | + if (ee.data.data.prom_type == 0 || ee.data.data.prom_type == 2 || ee.data.data.prom_type == 3 || ee.data.data.prom_type == 4 || ee.data.data.prom_type == 5){ |
629 | //默认门店要拿下门店库存 | 630 | //默认门店要拿下门店库存 |
630 | - if(that.data.sales_rules==2 && that.data.is_newsales_rules && that.data.fir_def_store){ | ||
631 | - var lock=0,plist=null; | ||
632 | - //先读取门店的lock,采用链式写法,少用await | ||
633 | - getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{ | ||
634 | - data:{store_id:os.stoid,wareId:ee.data.data.goods_id,storageId:that.data.fir_def_store.pickup_id} | ||
635 | - }).then(res=>{ | ||
636 | - if(res.data.code==0 && res.data.data.total>0){ | ||
637 | - for(var i in res.data.data.pageData) | ||
638 | - lock+=res.data.data.pageData[i].outQty | ||
639 | - } | ||
640 | - //---通过接口获取门店的线下库存信息-- | ||
641 | - return getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{ | ||
642 | - data:{storageNos:that.data.fir_def_store.pickup_no,wareIds:encodeURIComponent(th.data.data.erpwareid),storeId:os.stoid} | ||
643 | - }) | ||
644 | - }).then(res=>{ | ||
645 | - if(res.data.code==0 && res.data.data.total>0){ | ||
646 | - plist=res.data.data.pageData[0]; | ||
647 | - } | ||
648 | - if(plist && plist.CanOutQty-lock>0){ | ||
649 | - that.data.fir_def_store.CanOutQty=plist.CanOutQty-lock; | 631 | + if(that.data.sales_rules==2 && that.data.is_newsales_rules){ |
632 | + //--等待某个值只运行---,这里有可能因为导航的时间太久,而不能计算门店库存 | ||
633 | + getApp().waitfor2(that,"wait_for_user_store","fir_def_store",function(){ | ||
634 | + if(th.data.fir_def_store){ | ||
635 | + var lock=0,plist=null; | ||
636 | + //先读取门店的lock,采用链式写法,少用await | ||
637 | + getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{ | ||
638 | + data:{store_id:os.stoid,wareId:ee.data.data.goods_id,storageId:that.data.fir_def_store.pickup_id} | ||
639 | + }).then(res=>{ | ||
640 | + if(res.data.code==0 && res.data.data.total>0){ | ||
641 | + for(var i in res.data.data.pageData) | ||
642 | + lock+=res.data.data.pageData[i].outQty | ||
643 | + } | ||
644 | + //---通过接口获取门店的线下库存信息-- | ||
645 | + return getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{ | ||
646 | + data:{storageNos:that.data.fir_def_store.pickup_no,wareIds:encodeURIComponent(th.data.data.erpwareid),storeId:os.stoid} | ||
647 | + }) | ||
648 | + }).then(res=>{ | ||
649 | + if(res.data.code==0 && res.data.data.total>0){ | ||
650 | + plist=res.data.data.pageData[0]; | ||
651 | + } | ||
652 | + if(plist && plist.CanOutQty-lock>0){ | ||
653 | + that.data.fir_def_store.CanOutQty=plist.CanOutQty-lock; | ||
654 | + }else{ | ||
655 | + that.data.fir_def_store.CanOutQty=0; | ||
656 | + } | ||
657 | + //--给门店赋值线下库存-- | ||
658 | + th.setData({def_pick_store:that.data.fir_def_store}); | ||
659 | + //获取门店 | ||
660 | + ee.get_sto(); | ||
661 | + }) | ||
650 | }else{ | 662 | }else{ |
651 | - that.data.fir_def_store.CanOutQty=0; | ||
652 | - } | ||
653 | - //--给门店赋值线下库存-- | ||
654 | - th.setData({def_pick_store:that.data.fir_def_store}); | ||
655 | - }) | ||
656 | - | 663 | + //--获取门店-- |
664 | + ee.get_sto(); | ||
665 | + } | ||
666 | + }) | ||
667 | + }else{ | ||
668 | + //获取门店 | ||
669 | + ee.get_sto(); | ||
657 | } | 670 | } |
658 | - | ||
659 | - //获取门店 | ||
660 | - ee.get_sto(); | 671 | + |
661 | ee.get_sku(o.stoid, t.data.data.sku, gid); | 672 | ee.get_sku(o.stoid, t.data.data.sku, gid); |
662 | } | 673 | } |
663 | else { | 674 | else { |
@@ -1659,7 +1670,7 @@ Page({ | @@ -1659,7 +1670,7 @@ Page({ | ||
1659 | var th=this; | 1670 | var th=this; |
1660 | //单总量超出5个的时候 | 1671 | //单总量超出5个的时候 |
1661 | if (e.data.data.total > 5) { | 1672 | if (e.data.data.total > 5) { |
1662 | - i.get("/api/weshop/storagecategory/page", { | 1673 | + getApp().request.get("/api/weshop/storagecategory/page", { |
1663 | data: { | 1674 | data: { |
1664 | store_id: o.stoid, | 1675 | store_id: o.stoid, |
1665 | is_show: 1, | 1676 | is_show: 1, |
@@ -2240,7 +2251,7 @@ Page({ | @@ -2240,7 +2251,7 @@ Page({ | ||
2240 | t.data.data.ct_rylist = JSON.parse(t.data.data.ct_rylist); | 2251 | t.data.data.ct_rylist = JSON.parse(t.data.data.ct_rylist); |
2241 | var max_num = 0; | 2252 | var max_num = 0; |
2242 | t.data.data.ct_rylist.forEach(function(val, ind) { | 2253 | t.data.data.ct_rylist.forEach(function(val, ind) { |
2243 | - if (val.rynum > max_num) max_num = val.rynum; | 2254 | + if (parseInt(val.rynum) > max_num) max_num = parseInt(val.rynum); |
2244 | }) | 2255 | }) |
2245 | t.data.data.max_ct_num = max_num; | 2256 | t.data.data.max_ct_num = max_num; |
2246 | } | 2257 | } |