From 4dbcbadd4ed32dfc5caf8d70923cae4df0d52d45 Mon Sep 17 00:00:00 2001 From: yvan.ni Date: Thu, 8 Jun 2023 11:24:19 +0800 Subject: [PATCH] 虚拟商品的购买优化 --- pages/goods/goodsInfo/goodsInfo.js | 66 ++++++++++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 24 deletions(-) diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index a8a19f1..8c5d735 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -558,7 +558,7 @@ Page({ th = this; getApp().getConfig2(function (e) { var sales_rules = e.sales_rules; - 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) { + if (sales_rules >= 2 && [1, 2, 4, 6, 8, 9].indexOf(th.data.prom_type) == -1 && !th.data.sele_g.whsle_id) { getApp().waitfor2(that, "wait_for_user_store", "fir_goods", function () { var lock = 0, plist = null; @@ -1678,7 +1678,7 @@ Page({ newd.is_pd_normal = 1; //---如果是线下门店销售的时候--- - if (!getApp().is_virtual(th.data.sele_g) && th.data.sales_rules >= 2) { + if (th.data.sales_rules >= 2) { var pick = th.get_pick_from_list(th.data.sto_sele_id) //---通过接口获取门店的线下库存信息-- th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) { @@ -1776,7 +1776,7 @@ Page({ return false; } else { //---如果是线下门店销售的时候--- - if (!getApp().is_virtual(th.data.sele_g) && !th.data.sele_g.whsle_id && th.data.sales_rules >= 2) { + if (!th.data.sele_g.whsle_id && th.data.sales_rules >= 2) { var pick = th.get_pick_from_list(th.data.sto_sele_id) th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) { @@ -1835,7 +1835,7 @@ Page({ } //---如果是线下门店销售的时候--- - if ( !getApp().is_virtual(th.data.sele_g) && th.data.sales_rules >= 2 && !th.data.sele_g.whsle_id) { + if (th.data.sales_rules >= 2 && !th.data.sele_g.whsle_id) { var pick = th.get_pick_from_list(th.data.sto_sele_id) //---通过接口获取门店的线下库存信息-- // getApp().request.get("/api/weshop/goods/getWareStorages", { @@ -2512,18 +2512,26 @@ Page({ } var e = th.data.sele_g.store_count; var p_type =parseInt(th.data.prom_type+'') ; //&& p_type!=1 && p_type!=4 - if (!getApp().is_virtual(th.data.sele_g) && !th.data.sele_g.whsle_id && th.data.sales_rules >= 2 && + if (!th.data.sele_g.whsle_id && th.data.sales_rules >= 2 && ([1,2,4,6,8,9].indexOf(p_type)==-1 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { - if (!th.data.def_pick_store) { - wx.showToast({ - title: '请选择门店', - icon: 'none', - }); - // wx.showModal({title: '请选择门店',}); - return false; - } else { - e = th.data.def_pick_store.CanOutQty; + + //-- 如果是虚拟商品,默认给最大值 -- + if(getApp().is_virtual(th.data.sele_g)){ + e = 100000; + }else{ + if (!th.data.def_pick_store) { + wx.showToast({ + title: '请选择门店', + icon: 'none', + }); + // wx.showModal({title: '请选择门店',}); + return false; + } else { + e = th.data.def_pick_store.CanOutQty; + } } + + } if (!e) e = 0; //库存不足,不增加 @@ -2650,16 +2658,22 @@ Page({ var e = th.data.sele_g.store_count; var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4 - if (!getApp().is_virtual(th.data.sele_g) && !th.data.sele_g.whsle_id && th.data.sales_rules >= 2 && + if (!th.data.sele_g.whsle_id && th.data.sales_rules >= 2 && ([1,2,4,6,8,9].indexOf(p_type)==-1 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { - if (!th.data.def_pick_store) { - wx.showModal({ - title: '请选择门店', - }); - return false; - } else { - e = th.data.def_pick_store.CanOutQty; - } + + if(getApp().is_virtual(th.data.sele_g)){ + e=100000; + }else{ + if (!th.data.def_pick_store) { + wx.showModal({ + title: '请选择门店', + }); + return false; + } else { + e = th.data.def_pick_store.CanOutQty; + } + } + } if (!e) e = 0; //库存不足,不增加 @@ -3381,7 +3395,7 @@ Page({ if (!item.whsle_id && [1,2,4,6].indexOf(item.prom_type)==-1) that.check_is_youhui(gid, that.data.is_normal); //默认门店要拿下门店库存 - 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) { + 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) { var lock = 0, plist = null; @@ -7002,6 +7016,10 @@ Page({ async check_CanOutQty(goodsinfo, item, func) { var sales_rules = this.data.sales_rules; + //如果默认是商品 + if(getApp().is_virtual(goodsinfo)){ + return func(100000); + } var lock_rq = { store_id: os.stoid, -- libgit2 0.21.4