Commit 4dbcbadd4ed32dfc5caf8d70923cae4df0d52d45
1 parent
816a2532
虚拟商品的购买优化
Showing
1 changed file
with
42 additions
and
24 deletions
pages/goods/goodsInfo/goodsInfo.js
@@ -558,7 +558,7 @@ Page({ | @@ -558,7 +558,7 @@ Page({ | ||
558 | th = this; | 558 | th = this; |
559 | getApp().getConfig2(function (e) { | 559 | getApp().getConfig2(function (e) { |
560 | var sales_rules = e.sales_rules; | 560 | var sales_rules = e.sales_rules; |
561 | - if (!getApp().is_virtual(th.data.sele_g) && sales_rules >= 2 && [1, 2, 4, 6, 8, 9].indexOf(th.data.prom_type) == -1 && !th.data.sele_g.whsle_id) { | 561 | + if (sales_rules >= 2 && [1, 2, 4, 6, 8, 9].indexOf(th.data.prom_type) == -1 && !th.data.sele_g.whsle_id) { |
562 | getApp().waitfor2(that, "wait_for_user_store", "fir_goods", function () { | 562 | getApp().waitfor2(that, "wait_for_user_store", "fir_goods", function () { |
563 | var lock = 0, | 563 | var lock = 0, |
564 | plist = null; | 564 | plist = null; |
@@ -1678,7 +1678,7 @@ Page({ | @@ -1678,7 +1678,7 @@ Page({ | ||
1678 | newd.is_pd_normal = 1; | 1678 | newd.is_pd_normal = 1; |
1679 | 1679 | ||
1680 | //---如果是线下门店销售的时候--- | 1680 | //---如果是线下门店销售的时候--- |
1681 | - if (!getApp().is_virtual(th.data.sele_g) && th.data.sales_rules >= 2) { | 1681 | + if (th.data.sales_rules >= 2) { |
1682 | var pick = th.get_pick_from_list(th.data.sto_sele_id) | 1682 | var pick = th.get_pick_from_list(th.data.sto_sele_id) |
1683 | //---通过接口获取门店的线下库存信息-- | 1683 | //---通过接口获取门店的线下库存信息-- |
1684 | th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) { | 1684 | th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) { |
@@ -1776,7 +1776,7 @@ Page({ | @@ -1776,7 +1776,7 @@ Page({ | ||
1776 | return false; | 1776 | return false; |
1777 | } else { | 1777 | } else { |
1778 | //---如果是线下门店销售的时候--- | 1778 | //---如果是线下门店销售的时候--- |
1779 | - if (!getApp().is_virtual(th.data.sele_g) && !th.data.sele_g.whsle_id && th.data.sales_rules >= 2) { | 1779 | + if (!th.data.sele_g.whsle_id && th.data.sales_rules >= 2) { |
1780 | var pick = th.get_pick_from_list(th.data.sto_sele_id) | 1780 | var pick = th.get_pick_from_list(th.data.sto_sele_id) |
1781 | 1781 | ||
1782 | th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) { | 1782 | th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) { |
@@ -1835,7 +1835,7 @@ Page({ | @@ -1835,7 +1835,7 @@ Page({ | ||
1835 | } | 1835 | } |
1836 | 1836 | ||
1837 | //---如果是线下门店销售的时候--- | 1837 | //---如果是线下门店销售的时候--- |
1838 | - if ( !getApp().is_virtual(th.data.sele_g) && th.data.sales_rules >= 2 && !th.data.sele_g.whsle_id) { | 1838 | + if (th.data.sales_rules >= 2 && !th.data.sele_g.whsle_id) { |
1839 | var pick = th.get_pick_from_list(th.data.sto_sele_id) | 1839 | var pick = th.get_pick_from_list(th.data.sto_sele_id) |
1840 | //---通过接口获取门店的线下库存信息-- | 1840 | //---通过接口获取门店的线下库存信息-- |
1841 | // getApp().request.get("/api/weshop/goods/getWareStorages", { | 1841 | // getApp().request.get("/api/weshop/goods/getWareStorages", { |
@@ -2512,18 +2512,26 @@ Page({ | @@ -2512,18 +2512,26 @@ Page({ | ||
2512 | } | 2512 | } |
2513 | var e = th.data.sele_g.store_count; | 2513 | var e = th.data.sele_g.store_count; |
2514 | var p_type =parseInt(th.data.prom_type+'') ; //&& p_type!=1 && p_type!=4 | 2514 | var p_type =parseInt(th.data.prom_type+'') ; //&& p_type!=1 && p_type!=4 |
2515 | - if (!getApp().is_virtual(th.data.sele_g) && !th.data.sele_g.whsle_id && th.data.sales_rules >= 2 && | 2515 | + if (!th.data.sele_g.whsle_id && th.data.sales_rules >= 2 && |
2516 | ([1,2,4,6,8,9].indexOf(p_type)==-1 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { | 2516 | ([1,2,4,6,8,9].indexOf(p_type)==-1 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { |
2517 | - if (!th.data.def_pick_store) { | ||
2518 | - wx.showToast({ | ||
2519 | - title: '请选择门店', | ||
2520 | - icon: 'none', | ||
2521 | - }); | ||
2522 | - // wx.showModal({title: '请选择门店',}); | ||
2523 | - return false; | ||
2524 | - } else { | ||
2525 | - e = th.data.def_pick_store.CanOutQty; | 2517 | + |
2518 | + //-- 如果是虚拟商品,默认给最大值 -- | ||
2519 | + if(getApp().is_virtual(th.data.sele_g)){ | ||
2520 | + e = 100000; | ||
2521 | + }else{ | ||
2522 | + if (!th.data.def_pick_store) { | ||
2523 | + wx.showToast({ | ||
2524 | + title: '请选择门店', | ||
2525 | + icon: 'none', | ||
2526 | + }); | ||
2527 | + // wx.showModal({title: '请选择门店',}); | ||
2528 | + return false; | ||
2529 | + } else { | ||
2530 | + e = th.data.def_pick_store.CanOutQty; | ||
2531 | + } | ||
2526 | } | 2532 | } |
2533 | + | ||
2534 | + | ||
2527 | } | 2535 | } |
2528 | if (!e) e = 0; | 2536 | if (!e) e = 0; |
2529 | //库存不足,不增加 | 2537 | //库存不足,不增加 |
@@ -2650,16 +2658,22 @@ Page({ | @@ -2650,16 +2658,22 @@ Page({ | ||
2650 | 2658 | ||
2651 | var e = th.data.sele_g.store_count; | 2659 | var e = th.data.sele_g.store_count; |
2652 | var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4 | 2660 | var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4 |
2653 | - if (!getApp().is_virtual(th.data.sele_g) && !th.data.sele_g.whsle_id && th.data.sales_rules >= 2 && | 2661 | + if (!th.data.sele_g.whsle_id && th.data.sales_rules >= 2 && |
2654 | ([1,2,4,6,8,9].indexOf(p_type)==-1 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { | 2662 | ([1,2,4,6,8,9].indexOf(p_type)==-1 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { |
2655 | - if (!th.data.def_pick_store) { | ||
2656 | - wx.showModal({ | ||
2657 | - title: '请选择门店', | ||
2658 | - }); | ||
2659 | - return false; | ||
2660 | - } else { | ||
2661 | - e = th.data.def_pick_store.CanOutQty; | ||
2662 | - } | 2663 | + |
2664 | + if(getApp().is_virtual(th.data.sele_g)){ | ||
2665 | + e=100000; | ||
2666 | + }else{ | ||
2667 | + if (!th.data.def_pick_store) { | ||
2668 | + wx.showModal({ | ||
2669 | + title: '请选择门店', | ||
2670 | + }); | ||
2671 | + return false; | ||
2672 | + } else { | ||
2673 | + e = th.data.def_pick_store.CanOutQty; | ||
2674 | + } | ||
2675 | + } | ||
2676 | + | ||
2663 | } | 2677 | } |
2664 | if (!e) e = 0; | 2678 | if (!e) e = 0; |
2665 | //库存不足,不增加 | 2679 | //库存不足,不增加 |
@@ -3381,7 +3395,7 @@ Page({ | @@ -3381,7 +3395,7 @@ Page({ | ||
3381 | if (!item.whsle_id && [1,2,4,6].indexOf(item.prom_type)==-1) that.check_is_youhui(gid, that.data.is_normal); | 3395 | if (!item.whsle_id && [1,2,4,6].indexOf(item.prom_type)==-1) that.check_is_youhui(gid, that.data.is_normal); |
3382 | 3396 | ||
3383 | //默认门店要拿下门店库存 | 3397 | //默认门店要拿下门店库存 |
3384 | - if (!getApp().is_virtual(th.data.sele_g) && 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) { | 3398 | + 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) { |
3385 | var lock = 0, | 3399 | var lock = 0, |
3386 | plist = null; | 3400 | plist = null; |
3387 | 3401 | ||
@@ -7002,6 +7016,10 @@ Page({ | @@ -7002,6 +7016,10 @@ Page({ | ||
7002 | async check_CanOutQty(goodsinfo, item, func) { | 7016 | async check_CanOutQty(goodsinfo, item, func) { |
7003 | 7017 | ||
7004 | var sales_rules = this.data.sales_rules; | 7018 | var sales_rules = this.data.sales_rules; |
7019 | + //如果默认是商品 | ||
7020 | + if(getApp().is_virtual(goodsinfo)){ | ||
7021 | + return func(100000); | ||
7022 | + } | ||
7005 | 7023 | ||
7006 | var lock_rq = { | 7024 | var lock_rq = { |
7007 | store_id: os.stoid, | 7025 | store_id: os.stoid, |