Commit 27dfae193cf228dc582b5694f4de0c315ce79012

Authored by yvan.ni
1 parent 4dbcbadd

虚拟商品的优化

packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
... ... @@ -577,7 +577,7 @@ Page({
577 577 var sales_rules = e.sales_rules;
578 578  
579 579 //虚拟商品, 代发商品不计算
580   - if (!getApp().is_virtual(that.data.fir_goods) && !that.data.fir_goods.whsle_id && sales_rules >= 2) {
  580 + if (!that.data.fir_goods.whsle_id && sales_rules >= 2) {
581 581 getApp().waitfor2(that, "wait_for_user_store", "fir_goods", function () {
582 582 var lock = 0, plist = null;
583 583 var gd = that.data.fir_goods;
... ... @@ -1674,7 +1674,7 @@ Page({
1674 1674 return false;
1675 1675 } else {
1676 1676 //---如果是线下门店销售的时候---
1677   - if(!getApp().is_virtual(th.data.sele_g) && !th.data.sele_g.whsle_id && th.data.sales_rules >= 2) {
  1677 + if(!th.data.sele_g.whsle_id && th.data.sales_rules >= 2) {
1678 1678 var pick = th.get_pick_from_list(th.data.sto_sele_id)
1679 1679 //---通过接口获取门店的线下库存信息--
1680 1680 // getApp().request.get("/api/weshop/goods/getWareStorages", {
... ... @@ -1750,7 +1750,7 @@ Page({
1750 1750 newd.prom_id = 0;
1751 1751  
1752 1752 //---如果是线下门店销售的时候---
1753   - if(!getApp().is_virtual(th.data.sele_g) && !th.data.sele_g.whsle_id && th.data.sales_rules >= 2) {
  1753 + if(!th.data.sele_g.whsle_id && th.data.sales_rules >= 2) {
1754 1754 var pick = th.get_pick_from_list(th.data.sto_sele_id)
1755 1755  
1756 1756  
... ... @@ -2246,14 +2246,21 @@ Page({
2246 2246 }
2247 2247 var e = th.data.sele_g.store_count;
2248 2248 var p_type = parseInt(th.data.prom_type); //&& p_type!=1 && p_type!=4
2249   - if (!getApp().is_virtual(th.data.sele_g) && !th.data.sele_g.whsle_id &&
  2249 + if (!th.data.sele_g.whsle_id &&
2250 2250 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)) {
2251   - if (!th.data.def_pick_store) {
2252   - wx.showModal({ title: '请选择门店', });
2253   - return false;
2254   - } else {
2255   - e = th.data.def_pick_store.CanOutQty;
  2251 +
  2252 + //-- 如果是虚拟商品,默认给最大值 --
  2253 + if(getApp().is_virtual(th.data.sele_g)){
  2254 + e =100000;
  2255 + }else{
  2256 + if (!th.data.def_pick_store) {
  2257 + wx.showModal({ title: '请选择门店', });
  2258 + return false;
  2259 + } else {
  2260 + e = th.data.def_pick_store.CanOutQty;
  2261 + }
2256 2262 }
  2263 +
2257 2264 }
2258 2265 if (!e) e = 0;
2259 2266 //库存不足,不增加
... ... @@ -2339,14 +2346,21 @@ Page({
2339 2346  
2340 2347 var e = th.data.sele_g.store_count;
2341 2348 var p_type = parseInt(th.data.prom_type); //&& p_type!=1 && p_type!=4
2342   - if (!getApp().is_virtual(th.data.sele_g) && !th.data.sele_g.whsle_id &&
  2349 + if (!th.data.sele_g.whsle_id &&
2343 2350 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)) {
2344   - if (!th.data.def_pick_store) {
2345   - wx.showModal({ title: '请选择门店', });
2346   - return false;
2347   - } else {
2348   - e = th.data.def_pick_store.CanOutQty;
  2351 +
  2352 + //-- 如果是虚拟商品,默认给最大值 --
  2353 + if(getApp().is_virtual(th.data.sele_g)){
  2354 + e=100000;
  2355 + }else{
  2356 + if (!th.data.def_pick_store) {
  2357 + wx.showModal({ title: '请选择门店', });
  2358 + return false;
  2359 + } else {
  2360 + e = th.data.def_pick_store.CanOutQty;
  2361 + }
2349 2362 }
  2363 +
2350 2364 }
2351 2365 if (!e) e = 0;
2352 2366 //库存不足,不增加
... ... @@ -4554,7 +4568,7 @@ Page({
4554 4568 }
4555 4569  
4556 4570 //---如果是线下门店销售的时候---
4557   - if (!getApp().is_virtual(th.data.sele_g) && th.data.sales_rules >= 2 && !th.data.sele_g.whsle_id) {
  4571 + if (th.data.sales_rules >= 2 && !th.data.sele_g.whsle_id) {
4558 4572 var pick = th.get_pick_from_list(th.data.sto_sele_id)
4559 4573  
4560 4574 th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) {
... ... @@ -4656,6 +4670,11 @@ Page({
4656 4670  
4657 4671 var sales_rules = this.data.sales_rules;
4658 4672  
  4673 + //如果默认是商品
  4674 + if(getApp().is_virtual(goodsinfo)){
  4675 + return func(100000);
  4676 + }
  4677 +
4659 4678 var lock_rq = {
4660 4679 store_id: os.stoid,
4661 4680 wareId: goodsinfo.goods_id,
... ...