Commit 660d0b171147ef017d8710ee93065fae35e4a711

Authored by WXD-SEASON\season
2 parents b6e96511 80cbc1b6

合并dev_oa_fu6

@@ -1314,7 +1314,6 @@ App({ @@ -1314,7 +1314,6 @@ App({
1314 var stoid=this.globalData.setting.stoid; 1314 var stoid=this.globalData.setting.stoid;
1315 var user_id=this.globalData.user_id; 1315 var user_id=this.globalData.user_id;
1316 1316
1317 -  
1318 this.getConfig2(async function (e){ 1317 this.getConfig2(async function (e){
1319 if(e && e.switch_list) conf=JSON.parse(e.switch_list); 1318 if(e && e.switch_list) conf=JSON.parse(e.switch_list);
1320 if(conf && conf.express_searchtype==1){ 1319 if(conf && conf.express_searchtype==1){
@@ -1335,7 +1334,43 @@ App({ @@ -1335,7 +1334,43 @@ App({
1335 return true; 1334 return true;
1336 } 1335 }
1337 return false; 1336 return false;
  1337 + },
  1338 + //---- 判断是不是虚拟商品狗阿米 -----
  1339 + is_virtual(gd){
  1340 + if(gd.is_virtual==2) return true;
  1341 + return false;
  1342 + },
  1343 +
  1344 + /**
  1345 + *
  1346 + * @param gd 商品
  1347 + * @param act 活动
  1348 + * @param get_type 0默认 1是加和减的时候
  1349 + */
  1350 + get_limit_qty(gd,act,get_type){
  1351 + var islimit=gd.erp_islimit; //是不是限购
  1352 + var limittype=gd.erp_limittype; //不低于0、倍数1
  1353 + var limitqty=gd.erp_limitqty; //起购量
  1354 +
  1355 + //-- 如果有活动的时候 --
  1356 + if(act){
  1357 + islimit=act.islimit;
  1358 + limittype=act.limittype;
  1359 + limitqty=act.limitqty;
  1360 + }
  1361 +
  1362 + //-- 不是限购的时候,返回1--
  1363 + if(!islimit) return 1;
  1364 + //-- 默认的时候 --
  1365 + if(!get_type) return limitqty;
  1366 + //不低于的时候,加减的时候
  1367 + if(!limittype) return 1;
  1368 + //倍数,加减的时候
  1369 + return limitqty;
1338 1370
1339 } 1371 }
1340 1372
  1373 +
  1374 +
  1375 +
1341 }); 1376 });
components/diy_seckill/diy_seckill.wxml
@@ -481,52 +481,12 @@ @@ -481,52 +481,12 @@
481 </view> 481 </view>
482 </block> 482 </block>
483 483
484 -<<<<<<< HEAD  
485 - <view class="o1_right">  
486 - <view class="sp_wzi ellipsis-2">{{aitem.goods_name}}</view>  
487 - <view class="o1_sj_kill">  
488 - <text>{{aitem.djs.day}}</text> 天  
489 - <text>{{aitem.djs.hou}}</text> :  
490 - <text>{{aitem.djs.min}}</text> :  
491 - <text>{{aitem.djs.sec}}</text>  
492 -  
493 - </view>  
494 - <view class="money">  
495 - <view class='sp_jg'>¥{{aitem.price}}</view>  
496 -<!-- <view class='sp_jgx'>¥{{aitem.market_price}}</view>-->  
497 - </view>  
498 - <block wx:if="{{aitem.status == 0}}">  
499 - <view class="rob">  
500 - <view class="wo" style="background-color: #adadad">正在预热</view>  
501 - </view>  
502 - </block>  
503 -  
504 - <block wx:if="{{aitem.status == 3}}">  
505 - <view class="rob">  
506 - <view class="wo" style="background-color: #adadad">已结束</view>  
507 - </view>  
508 - </block>  
509 - <block wx:else>  
510 - <block wx:if="{{aitem.status == 1}}">  
511 - <view class="rob">  
512 - <view class="wo">我要抢</view>  
513 - </view>  
514 - </block>  
515 -  
516 - <block wx:if="{{aitem.status == 2}}">  
517 - <view class="rob">  
518 - <view class="wo" style="background-color: #adadad">已抢光</view>  
519 - </view>  
520 - </block>  
521 - </block>  
522 -=======  
523 <block wx:if="{{aitem.status == 2}}"> 484 <block wx:if="{{aitem.status == 2}}">
524 <view class="rob"> 485 <view class="rob">
525 <view class="wo" style="background-color: #adadad">已抢光</view> 486 <view class="wo" style="background-color: #adadad">已抢光</view>
526 </view> 487 </view>
527 </block> 488 </block>
528 </block> 489 </block>
529 ->>>>>>> dev_component  
530 490
531 491
532 </view> 492 </view>
packageA/pages/goodsInfo/goodsInfo.js
@@ -3894,507 +3894,7 @@ Page({ @@ -3894,507 +3894,7 @@ Page({
3894 }); 3894 });
3895 }, 3895 },
3896 3896
3897 -  
3898 -  
3899 -  
3900 -  
3901 -  
3902 -  
3903 - //-- 加入购物的函数 --  
3904 - add_cart_func: function (t) {  
3905 - var i = getApp().request;  
3906 - if (oo.user_id == null) {  
3907 - return s.my_warnning("还未登录!", 0, this);  
3908 - }  
3909 -  
3910 - if (!getApp().globalData.userInfo) {  
3911 - return s.my_warnning("还未登录!", 0, this);  
3912 - }  
3913 -  
3914 - var e = this,  
3915 - th = e,  
3916 - a = 0,  
3917 - o = this.data.sele_g;  
3918 - a = o.goods_id;  
3919 -  
3920 - //----------添加到购物车时,要判断限购数量,--------  
3921 - e.get_buy_num(o, function (ee) {  
3922 - //---判断商品是否超出限购---  
3923 - if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) {  
3924 - if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) {  
3925 - // wx.showModal({  
3926 - // title: '提示',  
3927 - // content: '超出活动限购数量'  
3928 - // });  
3929 - getApp().my_warnning('超出活动限购数量', 0, self);  
3930 - return false;  
3931 - }  
3932 - }  
3933 - //---判断商品是否超出活动限购---  
3934 - if ((th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0) && !th.data.is_normal) {  
3935 - if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) {  
3936 - // wx.showModal({  
3937 - // title: '提示',  
3938 - // content: '超出活动限购数量'  
3939 - // });  
3940 - getApp().my_warnning('超出活动限购数量', 0, self);  
3941 - return false;  
3942 - }  
3943 - }  
3944 -  
3945 - if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th);  
3946 - if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined)  
3947 - th.setData({  
3948 - sto_sele_name: ""  
3949 - });  
3950 - if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th);  
3951 -  
3952 - //--------------此时操作的数据------------  
3953 - var newd = {  
3954 - goods_id: o.goods_id,  
3955 - goods_num: th.data.goodsInputNum,  
3956 - pick_id: th.data.sto_sele_id,  
3957 - user_id: oo.user_id,  
3958 - store_id: th.data.stoid,  
3959 - goods_price: o.shop_price,  
3960 - member_goods_price: o.shop_price,  
3961 - goods_name: o.goods_name,  
3962 - goods_sn: o.goods_sn,  
3963 - sku: o.sku,  
3964 - prom_id: th.data.sele_g.prom_id,  
3965 - prom_type: th.data.sele_g.prom_type,  
3966 - };  
3967 -  
3968 - //---是不是从收藏夹出来的---  
3969 - if (th.data.c_guide_id) {  
3970 - newd['guide_id'] = th.data.c_guide_id;  
3971 - newd['guide_type'] = 2;  
3972 - if ("add" == t.currentTarget.dataset.action) newd['guide_type'] = 3;  
3973 - } else {  
3974 - if (getApp().globalData.guide_id) {  
3975 - newd['guide_id'] = getApp().globalData.guide_id;  
3976 - newd['guide_type'] = 0;  
3977 - if ("add" == t.currentTarget.dataset.action) newd['guide_type'] = 1;  
3978 - }  
3979 - }  
3980 - if(getApp().globalData.groupchat_id){  
3981 - newd['groupchat_id'] = getApp().globalData.groupchat_id;  
3982 - }  
3983 - //让商品带上房间号  
3984 - //让商品带上房间号  
3985 - if (th.data.sys_switch.is_skuroom_id == 1) {  
3986 - if (th.data.data.goods_id == getApp().globalData.room_goods_id) {  
3987 - newd.room_id = getApp().globalData.room_id;  
3988 - }  
3989 - } else {  
3990 - if (newd.goods_id == getApp().globalData.room_goods_id) newd.room_id = getApp().globalData.room_id;  
3991 - }  
3992 -  
3993 - //如果是积分够,is_integral_normal就要有积分购普通购买字段  
3994 - if (o.prom_type == 4) {  
3995 - newd.is_integral_normal = 1;  
3996 - }  
3997 -  
3998 - //如果有线下取价  
3999 - if (o.offline_price) {  
4000 - newd.offline_price = o.offline_price;  
4001 - newd.pricing_type = o.pricing_type;  
4002 - }  
4003 -  
4004 - //-----如果是秒杀,团购,积分购,拼团-----  
4005 - if (th.data.prom_type == 1 || th.data.prom_type == 2) {  
4006 -  
4007 - if (th.data.openSpecModal_flash_normal) {  
4008 -  
4009 - newd.prom_type = 0;  
4010 - newd.prom_id = 0;  
4011 -  
4012 - //---如果是线下门店销售的时候---  
4013 - if (th.data.sales_rules == 2) {  
4014 - var pick = th.get_pick_from_list(th.data.sto_sele_id)  
4015 - //---通过接口获取门店的线下库存信息--  
4016 - getApp().request.get("/api/weshop/goods/getWareStorages", {  
4017 - data: {  
4018 - storageNos: pick.pickup_no,  
4019 - wareIds: encodeURIComponent(th.data.sele_g.erpwareid),  
4020 - storeId: os.stoid  
4021 - },  
4022 - success: function (res) {  
4023 - if (res.data.code == 0) {  
4024 - if (res.data.data.pageData.length > 0) {  
4025 - var CanOutQty = res.data.data.pageData[0].CanOutQty;  
4026 - if (CanOutQty < e.data.goodsInputNum) {  
4027 - return s.my_warnning("库存不足!", 0, th);  
4028 - }  
4029 - //在调一次接口,读取商品的预出库的数量,lock  
4030 - getApp().request.get("/api/weshop/order/ware/lock/page", {  
4031 - data: {  
4032 - store_id: os.stoid,  
4033 - wareId: th.data.sele_g.goods_id,  
4034 - storageId: pick.pickup_id,  
4035 - pageSize: 1000  
4036 - },  
4037 - success: function (res_data) {  
4038 - if (res_data.data.code == 0 && res_data.data.data.total > 0) {  
4039 -  
4040 - var lock = 0;  
4041 - for (var i in res_data.data.data.pageData) {  
4042 - lock += res_data.data.data.pageData[i].outQty;  
4043 - }  
4044 -  
4045 - if (CanOutQty <= lock) {  
4046 - return s.my_warnning("库存不足!", 0, th);  
4047 - }  
4048 - th.add_cart_next(e, t, a, o, newd, CanOutQty - lock);  
4049 - } else {  
4050 - th.add_cart_next(e, t, a, o, newd, CanOutQty);  
4051 - }  
4052 - }  
4053 - })  
4054 - } else {  
4055 - return s.my_warnning("库存不足!", 0, th);  
4056 - }  
4057 -  
4058 - }  
4059 - }  
4060 - })  
4061 - } else {  
4062 - if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);  
4063 - if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);  
4064 - th.add_cart_next(e, t, a, o, newd); //加入购物车下一步  
4065 - }  
4066 -  
4067 - return false;  
4068 - }  
4069 -  
4070 -  
4071 - newd.goods_price = th.data.prom_price;  
4072 - newd.member_goods_price = th.data.prom_price,  
4073 - newd.prom_type = th.data.prom_type;  
4074 - newd.prom_id = th.data.prom_id;  
4075 -  
4076 - if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);  
4077 - if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);  
4078 -  
4079 - th.add_cart_next(e, t, a, o, newd); //加入购物车下一步  
4080 -  
4081 - } else if (o.prom_type == 7) {  
4082 -  
4083 - //判断进行中的活动,是不是要判断线下库存  
4084 - th.check_zh_acting(function (ee) {  
4085 - newd.prom_id = 0;  
4086 - newd.prom_type = 0;  
4087 - if (ee && th.data.sele_g.act) {  
4088 - newd.prom_id = th.data.sele_g.act.id;  
4089 - newd.prom_type = 7;  
4090 - if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);  
4091 - if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);  
4092 - th.add_cart_next(e, t, a, o, newd); //加入购物车下一步  
4093 - return false;  
4094 - } else {  
4095 - //---如果是线下门店销售的时候---  
4096 - if (th.data.sales_rules == 2) {  
4097 - var pick = th.get_pick_from_list(th.data.sto_sele_id)  
4098 - //---通过接口获取门店的线下库存信息--  
4099 - getApp().request.get("/api/weshop/goods/getWareStorages", {  
4100 - data: {  
4101 - storageNos: pick.pickup_no,  
4102 - wareIds: encodeURIComponent(th.data.sele_g.erpwareid),  
4103 - storeId: os.stoid  
4104 - },  
4105 - success: function (res) {  
4106 - if (res.data.code == 0) {  
4107 - if (res.data.data.pageData.length > 0) {  
4108 - var CanOutQty = res.data.data.pageData[0].CanOutQty;  
4109 - if (CanOutQty < e.data.goodsInputNum) {  
4110 - return s.my_warnning("库存不足!", 0, th);  
4111 - }  
4112 - //在调一次接口,读取商品的预出库的数量,lock  
4113 - getApp().request.get("/api/weshop/order/ware/lock/page", {  
4114 - data: {  
4115 - store_id: os.stoid,  
4116 - wareId: th.data.sele_g.goods_id,  
4117 - storageId: pick.pickup_id,  
4118 - pageSize: 1000  
4119 - },  
4120 - success: function (res_data) {  
4121 - if (res_data.data.code == 0 && res_data.data.data.total > 0) {  
4122 -  
4123 - var lock = 0;  
4124 - for (var i in res_data.data.data.pageData) {  
4125 - lock += res_data.data.data.pageData[i].outQty;  
4126 - }  
4127 -  
4128 - if (CanOutQty <= lock) {  
4129 - return s.my_warnning("库存不足!", 0, th);  
4130 - }  
4131 - th.add_cart_next(e, t, a, o, newd, CanOutQty - lock);  
4132 - } else {  
4133 - th.add_cart_next(e, t, a, o, newd, CanOutQty);  
4134 - }  
4135 - }  
4136 - })  
4137 - } else {  
4138 - return s.my_warnning("库存不足!", 0, th);  
4139 - }  
4140 -  
4141 - }  
4142 - }  
4143 - })  
4144 - } else {  
4145 - if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);  
4146 - if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);  
4147 - th.add_cart_next(e, t, a, o, newd); //加入购物车下一步  
4148 - }  
4149 - }  
4150 - })  
4151 -  
4152 - }  
4153 - else if (th.data.prom_type == 0 || th.data.prom_type == 3 || th.data.prom_type == 4 || th.data.prom_type == 5 || th.data.prom_type == 10) {  
4154 - newd.prom_type = 0;  
4155 - newd.prom_id = 0;  
4156 -  
4157 - if (th.data.prom_type == 10) {  
4158 - newd.prom_type = th.data.prom_type;  
4159 - newd.prom_id = th.data.prom_id;  
4160 - }  
4161 -  
4162 - //---如果是线下门店销售的时候---  
4163 - if (th.data.sales_rules == 2) {  
4164 - var pick = th.get_pick_from_list(th.data.sto_sele_id)  
4165 - //---通过接口获取门店的线下库存信息--  
4166 - getApp().request.get("/api/weshop/goods/getWareStorages", {  
4167 - data: {  
4168 - storageNos: pick.pickup_no,  
4169 - wareIds: encodeURIComponent(th.data.sele_g.erpwareid),  
4170 - storeId: os.stoid  
4171 - },  
4172 - success: function (res) {  
4173 - if (res.data.code == 0) {  
4174 - if (res.data.data.pageData.length > 0) {  
4175 - var CanOutQty = res.data.data.pageData[0].CanOutQty;  
4176 - if (CanOutQty < e.data.goodsInputNum) {  
4177 - return s.my_warnning("库存不足!", 0, th);  
4178 - }  
4179 - //在调一次接口,读取商品的预出库的数量,lock  
4180 - getApp().request.get("/api/weshop/order/ware/lock/page", {  
4181 - data: {  
4182 - store_id: os.stoid,  
4183 - wareId: th.data.sele_g.goods_id,  
4184 - storageId: pick.pickup_id,  
4185 - pageSize: 1000  
4186 - },  
4187 - success: function (res_data) {  
4188 - if (res_data.data.code == 0 && res_data.data.data.total > 0) {  
4189 -  
4190 - var lock = 0;  
4191 - for (var i in res_data.data.data.pageData) {  
4192 - lock += res_data.data.data.pageData[i].outQty;  
4193 - }  
4194 -  
4195 - if (CanOutQty <= lock) {  
4196 - return s.my_warnning("库存不足!", 0, th);  
4197 - }  
4198 - th.add_cart_next(e, t, a, o, newd, CanOutQty - lock);  
4199 - } else {  
4200 - th.add_cart_next(e, t, a, o, newd, CanOutQty);  
4201 - }  
4202 - }  
4203 - })  
4204 - } else {  
4205 - return s.my_warnning("库存不足!", 0, th);  
4206 - }  
4207 -  
4208 - }  
4209 - }  
4210 - })  
4211 - } else {  
4212 - if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);  
4213 - if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);  
4214 - th.add_cart_next(e, t, a, o, newd); //加入购物车下一步  
4215 - }  
4216 - }  
4217 - })  
4218 - },  
4219 -  
4220 - //---加入购物车的最后一步---  
4221 - add_cart_next(e, t, a, o, newd, CanOutQty) {  
4222 - var th = this, i = getApp().request;  
4223 - //---如果商品不是积分购和拼团,要判断一个是否要进行等级价的判断------  
4224 - if ((o.prom_type != 1 || o.prom_id <= 0) && ((o.prom_type != 6 && o.prom_type != 4 && o.prom_type != 2 ) || th.data.is_normal)) {  
4225 - var conf = th.data.bconfig;  
4226 - if (conf.switch_list && getApp().globalData.userInfo['card_field'] && getApp().globalData.userInfo['card_expiredate']) {  
4227 - var s_list = JSON.parse(conf.switch_list);  
4228 - var now = ut.gettimestamp();  
4229 -  
4230 -  
4231 - var str = getApp().globalData.userInfo['card_expiredate'].replace(/-/g, '/');  
4232 - var end = new Date(str);  
4233 - end = Date.parse(end) / 1000;  
4234 -  
4235 - //--如果后台有开启等级价的功能,而且会员的等级没有过期的情况下--  
4236 - if (parseInt(s_list.rank_switch) == 2 && end > now) {  
4237 - var card_price = o[getApp().globalData.userInfo['card_field']];  
4238 - //如果会员有等级价  
4239 - if (getApp().globalData.userInfo['card_field'] != undefined && getApp().globalData.userInfo['card_field'] != null  
4240 - && getApp().globalData.userInfo['card_field'] != "" && card_price > 0) {  
4241 - newd.goods_price = card_price;  
4242 - newd.member_goods_price = card_price;  
4243 - }  
4244 - }  
4245 - }  
4246 - }  
4247 -  
4248 - //if (this.data.data.goods.is_virtual) return this.buyVirtualGoods(d);  
4249 - if ("add" == t.currentTarget.dataset.action) {  
4250 -  
4251 - if (th.data.prom_goods) {  
4252 - newd.prom_type = 3;  
4253 - newd.prom_id = th.data.prom_goods[0].prom_id;  
4254 - }  
4255 -  
4256 - //----先看会员在购物车中是否加入了该商品-----  
4257 - i.get("/api/weshop/cart/page", {  
4258 - data: {  
4259 - store_id: e.data.stoid,  
4260 - user_id: oo.user_id,  
4261 - goods_id: a,  
4262 - pick_id: e.data.sto_sele_id,  
4263 - prom_type:(newd.prom_type?newd.prom_type:0),  
4264 - state: 0  
4265 - },  
4266 - success: function (re) {  
4267 -  
4268 - //-------如果购物车中有相关的数据---------  
4269 - if (re.data.data.total > 0) {  
4270 -  
4271 - var item = re.data.data.pageData[0];  
4272 -  
4273 - //判断数量,要看下购物车中有没有该商品  
4274 - if (CanOutQty) {  
4275 - if (item.goods_num + th.data.goodsInputNum > CanOutQty) {  
4276 - return s.my_warnning("库存不足!", 0, th);  
4277 - }  
4278 - } else {  
4279 - if (item.goods_num + th.data.goodsInputNum > o.store_count) {  
4280 - return s.my_warnning("库存不足!", 0, th);  
4281 - }  
4282 - }  
4283 -  
4284 - var updata = {  
4285 - id: item.id,  
4286 - goods_num: e.data.goodsInputNum + item.goods_num,  
4287 - goods_price: newd.goods_price,  
4288 - member_goods_price: newd.goods_price,  
4289 - store_id: th.data.stoid,  
4290 - };  
4291 -  
4292 - //---是不是从收藏夹出来的---  
4293 - if (th.data.c_guide_id) {  
4294 - updata['guide_id'] = th.data.c_guide_id;  
4295 - updata['guide_type'] = 3; //加入购物车之后就变成了3  
4296 - } else {  
4297 - if (getApp().globalData.guide_id) {  
4298 - updata['guide_id'] = getApp().globalData.guide_id;  
4299 - updata['guide_type'] = 0;  
4300 - }  
4301 - }  
4302 - if(getApp().globalData.groupchat_id){  
4303 - updata['groupchat_id'] = getApp().globalData.groupchat_id;  
4304 - }  
4305 - i.put("/api/weshop/cart/update", {  
4306 - data: updata,  
4307 - success: function (t) {  
4308 - getApp().my_warnning('加入购物车成功', 1, th, 450);  
4309 - var c_num = th.data.cartGoodsNum + th.data.goodsInputNum;  
4310 - th.setData({  
4311 - cartGoodsNum: c_num  
4312 - });  
4313 - th.closeSpecModal();  
4314 - }  
4315 - });  
4316 - } else {  
4317 -  
4318 -  
4319 - i.post("/api/weshop/cart/save", {  
4320 - data: newd,  
4321 - success: function (t) {  
4322 - getApp().my_warnning('加入购物车成功', 1, th, 450);  
4323 - var c_num = th.data.cartGoodsNum + e.data.goodsInputNum;  
4324 - th.setData({  
4325 - cartGoodsNum: c_num  
4326 - });  
4327 - th.closeSpecModal();  
4328 - }  
4329 - });  
4330 - }  
4331 - }  
4332 - });  
4333 -  
4334 - }  
4335 - else {  
4336 -  
4337 - //这一步主要是要让立即购买 走 购物车的逻辑 参与活动  
4338 - if (newd.prom_type == 10 || newd.prom_type == 7) {  
4339 - //----先看会员在购物车中是否加入了该商品,立即购买的-----  
4340 - getApp().request.get("/api/weshop/cart/page", {  
4341 - data: {  
4342 - store_id: e.data.stoid,  
4343 - user_id: oo.user_id,  
4344 - state: 1  
4345 - },  
4346 - success: function (res) {  
4347 - //-------如果购物车中有相关的数据---------  
4348 - if (res.data.code == 0 && res.data.data.total > 0) {  
4349 - for (let j in res.data.data.pageData) {  
4350 - let item_j = res.data.data.pageData[j];  
4351 - var url = '/api/weshop/cart/del/' + e.data.stoid + '/' + item_j.id;  
4352 - getApp().request.delete(url, {});  
4353 - }  
4354 - }  
4355 - newd.state = 1;  
4356 - getApp().request.post("/api/weshop/cart/save", {  
4357 - data: newd,  
4358 - success: function (t) {  
4359 - th.closeSpecModal();  
4360 - getApp().goto("/packageE/pages/cart/cart2/cart2?state=1");  
4361 - }  
4362 - });  
4363 - },  
4364 - })  
4365 - return false;  
4366 - }  
4367 -  
4368 - if (th.data.prom_goods) {  
4369 - var prom_d = th.data.prom_goods;  
4370 - for (var i in prom_d) {  
4371 - //判断活动有俩种条件,0元 1件  
4372 - var condition_t = prom_d[i].prom_type;  
4373 - switch (condition_t) {  
4374 - case 0: //按钱  
4375 - if (newd.goods_price >= condition_t) {  
4376 - newd.prom_type = 3;  
4377 - newd.prom_id = prom_d[i].prom_id;  
4378 - }  
4379 - break  
4380 - case 1://按购买数量  
4381 - if (newd.goods_num >= condition_t) {  
4382 - newd.prom_type = 3;  
4383 - newd.prom_id = prom_d[i].prom_id;  
4384 - }  
4385 - break;  
4386 - }  
4387 - }  
4388 -  
4389 - }  
4390 -  
4391 - newd['pick_name'] = th.data.sto_sele_name;  
4392 - newd['pick_dis'] = th.data.sto_sele_distr;  
4393 - th.buyNow(newd);  
4394 - }  
4395 - },  
4396 -  
4397 - 3897 +
4398 click_contact:function () { 3898 click_contact:function () {
4399 getApp().globalData.no_clear=1; 3899 getApp().globalData.no_clear=1;
4400 }, 3900 },
packageA/pages/prom_list/prom_list.js
@@ -351,7 +351,7 @@ Page({ @@ -351,7 +351,7 @@ Page({
351 351
352 //获取统一条形码,普通商品和优惠促销的商品 352 //获取统一条形码,普通商品和优惠促销的商品
353 //默认门店要拿下门店库存 353 //默认门店要拿下门店库存
354 - if (that.data.sales_rules >= 2) { 354 + if (!getApp().is_virtual(t.data.data) && !t.data.data.whsle_id && that.data.sales_rules >= 2) {
355 //--等待某个值只运行---,这里有可能因为导航的时间太久,而不能计算门店库存 355 //--等待某个值只运行---,这里有可能因为导航的时间太久,而不能计算门店库存
356 getApp().waitfor2(that, "wait_for_user_store", "fir_def_store", function () { 356 getApp().waitfor2(that, "wait_for_user_store", "fir_def_store", function () {
357 357
@@ -1622,12 +1622,12 @@ Page({ @@ -1622,12 +1622,12 @@ Page({
1622 var plist=null; 1622 var plist=null;
1623 var lock=0; 1623 var lock=0;
1624 1624
1625 - //---如果是活动的时候---  
1626 - if(th.data.prom_type==1 || th.data.prom_type==6){ 1625 + //---如果是活动的时候,或者是虚拟商品的时候---
  1626 + if(th.data.prom_type==1 || th.data.prom_type==6 || getApp().is_virtual(goodsinfo)){
1627 func(); return false; 1627 func(); return false;
1628 } 1628 }
1629 1629
1630 - if(this.data.sales_rules!=2){ 1630 + if(this.data.sales_rules<2){
1631 func(); 1631 func();
1632 }else{ 1632 }else{
1633 1633
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
@@ -575,7 +575,9 @@ Page({ @@ -575,7 +575,9 @@ Page({
575 var that = this, th = this; 575 var that = this, th = this;
576 getApp().getConfig2(function (e) { 576 getApp().getConfig2(function (e) {
577 var sales_rules = e.sales_rules; 577 var sales_rules = e.sales_rules;
578 - if (sales_rules >= 2) { 578 +
  579 + //虚拟商品, 代发商品不计算
  580 + if (!getApp().is_virtual(that.data.fir_goods) && !that.data.fir_goods.whsle_id && sales_rules >= 2) {
579 getApp().waitfor2(that, "wait_for_user_store", "fir_goods", function () { 581 getApp().waitfor2(that, "wait_for_user_store", "fir_goods", function () {
580 var lock = 0, plist = null; 582 var lock = 0, plist = null;
581 var gd = that.data.fir_goods; 583 var gd = that.data.fir_goods;
@@ -1570,7 +1572,7 @@ Page({ @@ -1570,7 +1572,7 @@ Page({
1570 // title: '提示', 1572 // title: '提示',
1571 // content: '超出商品限购' 1573 // content: '超出商品限购'
1572 // }); 1574 // });
1573 - getApp().my_warnning('超出商品限购', 0, th); 1575 + getApp().my_warnning('超出商品限购', 0, th);
1574 return false; 1576 return false;
1575 } 1577 }
1576 } 1578 }
@@ -1581,7 +1583,7 @@ Page({ @@ -1581,7 +1583,7 @@ Page({
1581 // title: '提示', 1583 // title: '提示',
1582 // content: '超出商品活动限购' 1584 // content: '超出商品活动限购'
1583 // }); 1585 // });
1584 - getApp().my_warnning('超出商品活动限购', 0, th); 1586 + getApp().my_warnning('超出商品活动限购', 0, th);
1585 return false; 1587 return false;
1586 } 1588 }
1587 } 1589 }
@@ -1672,7 +1674,7 @@ Page({ @@ -1672,7 +1674,7 @@ Page({
1672 return false; 1674 return false;
1673 } else { 1675 } else {
1674 //---如果是线下门店销售的时候--- 1676 //---如果是线下门店销售的时候---
1675 - if (th.data.sales_rules >= 2) { 1677 + if(!getApp().is_virtual(th.data.sele_g) && !th.data.sele_g.whsle_id && th.data.sales_rules >= 2) {
1676 var pick = th.get_pick_from_list(th.data.sto_sele_id) 1678 var pick = th.get_pick_from_list(th.data.sto_sele_id)
1677 //---通过接口获取门店的线下库存信息-- 1679 //---通过接口获取门店的线下库存信息--
1678 // getApp().request.get("/api/weshop/goods/getWareStorages", { 1680 // getApp().request.get("/api/weshop/goods/getWareStorages", {
@@ -1748,45 +1750,9 @@ Page({ @@ -1748,45 +1750,9 @@ Page({
1748 newd.prom_id = 0; 1750 newd.prom_id = 0;
1749 1751
1750 //---如果是线下门店销售的时候--- 1752 //---如果是线下门店销售的时候---
1751 - if (th.data.sales_rules >= 2) { 1753 + if(!getApp().is_virtual(th.data.sele_g) && !th.data.sele_g.whsle_id && th.data.sales_rules >= 2) {
1752 var pick = th.get_pick_from_list(th.data.sto_sele_id) 1754 var pick = th.get_pick_from_list(th.data.sto_sele_id)
1753 - //---通过接口获取门店的线下库存信息--  
1754 - // getApp().request.get("/api/weshop/goods/getWareStorages", {  
1755 - // data: { storageNos: pick.pickup_no, wareIds: encodeURIComponent(th.data.sele_g.erpwareid), storeId: os.stoid },  
1756 - // success: function (res) {  
1757 - // if (res.data.code == 0) {  
1758 - // if (res.data.data.pageData.length > 0) {  
1759 - // var CanOutQty = res.data.data.pageData[0].CanOutQty;  
1760 - // if (CanOutQty < e.data.goodsInputNum) {  
1761 - // return s.my_warnning("库存不足!", 0, th);  
1762 - // }  
1763 - // //在调一次接口,读取商品的预出库的数量,lock  
1764 - // getApp().request.get("/api/weshop/order/ware/lock/page", {  
1765 - // data: { store_id: os.stoid, wareId: th.data.sele_g.goods_id, storageId: pick.pickup_id, pageSize: 1000 },  
1766 - // success: function (res_data) {  
1767 - // if (res_data.data.code == 0 && res_data.data.data.total > 0) {  
1768 - //  
1769 - // var lock = 0;  
1770 - // for (var i in res_data.data.data.pageData) {  
1771 - // lock += res_data.data.data.pageData[i].outQty;  
1772 - // }  
1773 - //  
1774 - // if (CanOutQty <= lock) {  
1775 - // return s.my_warnning("库存不足!", 0, th);  
1776 - // }  
1777 - // th.add_cart_next(e, t, a, o, newd, CanOutQty - lock);  
1778 - // } else {  
1779 - // th.add_cart_next(e, t, a, o, newd, CanOutQty);  
1780 - // }  
1781 - // }  
1782 - // })  
1783 - // } else {  
1784 - // return s.my_warnning("库存不足!", 0, th);  
1785 - // }  
1786 - //  
1787 - // }  
1788 - // }  
1789 - // }) 1755 +
1790 1756
1791 1757
1792 th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) { 1758 th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) {
@@ -2188,11 +2154,20 @@ Page({ @@ -2188,11 +2154,20 @@ Page({
2188 2154
2189 //----------增加购买数量----------- 2155 //----------增加购买数量-----------
2190 addCartNum: function (t) { 2156 addCartNum: function (t) {
2191 - this.checkCartNum(this.data.goodsInputNum + 1); 2157 +
  2158 + var add_num=1;
  2159 + if(this.data.is_normal == 1){
  2160 + add_num=getApp().get_limit_qty(this.data.sele_g,0,1);
  2161 + }
  2162 + this.checkCartNum(this.data.goodsInputNum + add_num);
2192 }, 2163 },
2193 //----------减少购买数量----------- 2164 //----------减少购买数量-----------
2194 subCartNum: function (t) { 2165 subCartNum: function (t) {
2195 - this.checkCartNum(this.data.goodsInputNum - 1); 2166 + var add_num=1;
  2167 + if(this.data.is_normal == 1){
  2168 + add_num=getApp().get_limit_qty(this.data.sele_g,0,1);
  2169 + }
  2170 + this.checkCartNum(this.data.goodsInputNum - add_num);
2196 }, 2171 },
2197 //----------输入框输入购买数量----------- 2172 //----------输入框输入购买数量-----------
2198 inputCartNum: function (t) { 2173 inputCartNum: function (t) {
@@ -2216,6 +2191,7 @@ Page({ @@ -2216,6 +2191,7 @@ Page({
2216 //------检查数量是不是超出限购------ 2191 //------检查数量是不是超出限购------
2217 checkCartNum: function (t) { 2192 checkCartNum: function (t) {
2218 var th = this; 2193 var th = this;
  2194 + var mo_num=getApp().get_limit_qty(th.data.sele_g);
2219 this.get_buy_num(this.data.sele_g, async function () { 2195 this.get_buy_num(this.data.sele_g, async function () {
2220 2196
2221 //--判断商品是否超出限购-- 2197 //--判断商品是否超出限购--
@@ -2269,8 +2245,9 @@ Page({ @@ -2269,8 +2245,9 @@ Page({
2269 } 2245 }
2270 } 2246 }
2271 var e = th.data.sele_g.store_count; 2247 var e = th.data.sele_g.store_count;
2272 - var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4  
2273 - if (th.data.sales_rules >= 2 && (p_type != 1 && p_type != 4 && p_type != 6 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { 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 &&
  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)) {
2274 if (!th.data.def_pick_store) { 2251 if (!th.data.def_pick_store) {
2275 wx.showModal({ title: '请选择门店', }); 2252 wx.showModal({ title: '请选择门店', });
2276 return false; 2253 return false;
@@ -2283,9 +2260,20 @@ Page({ @@ -2283,9 +2260,20 @@ Page({
2283 if (e < t) { 2260 if (e < t) {
2284 wx.showModal({ title: '库存不足', }); 2261 wx.showModal({ title: '库存不足', });
2285 if (e < 0) e = 0; 2262 if (e < 0) e = 0;
  2263 +
  2264 + if(th.data.is_normal == 1){
  2265 + if(e<mo_num) e=mo_num;
  2266 + }
  2267 +
2286 th.setData({ goodsInputNum: e }); return false; 2268 th.setData({ goodsInputNum: e }); return false;
2287 } 2269 }
2288 t > e || 0 == e ? t = e : t < 1 && (t = 1); 2270 t > e || 0 == e ? t = e : t < 1 && (t = 1);
  2271 +
  2272 + //只有普通商品才有起购数
  2273 + if(th.data.is_normal == 1){
  2274 + if(t<mo_num) t=mo_num;
  2275 + }
  2276 +
2289 th.setData({ goodsInputNum: t }); 2277 th.setData({ goodsInputNum: t });
2290 th.is_show_more_buy(); 2278 th.is_show_more_buy();
2291 2279
@@ -2350,8 +2338,9 @@ Page({ @@ -2350,8 +2338,9 @@ Page({
2350 } 2338 }
2351 2339
2352 var e = th.data.sele_g.store_count; 2340 var e = th.data.sele_g.store_count;
2353 - var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4  
2354 - if (th.data.sales_rules >= 2 && (p_type != 1 && p_type != 4 && p_type != 6 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { 2341 + 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 &&
  2343 + 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)) {
2355 if (!th.data.def_pick_store) { 2344 if (!th.data.def_pick_store) {
2356 wx.showModal({ title: '请选择门店', }); 2345 wx.showModal({ title: '请选择门店', });
2357 return false; 2346 return false;
@@ -2983,7 +2972,7 @@ Page({ @@ -2983,7 +2972,7 @@ Page({
2983 2972
2984 2973
2985 //默认门店要拿下门店库存 2974 //默认门店要拿下门店库存
2986 - if (that.data.sales_rules >= 2 && that.data.def_pick_store) { 2975 + if (!getApp().is_virtual(item) && !item.whsle_id && that.data.sales_rules >= 2 && that.data.def_pick_store) {
2987 var lock = 0, plist = null; 2976 var lock = 0, plist = null;
2988 // //先读取门店的lock,采用链式写法,少用await 2977 // //先读取门店的lock,采用链式写法,少用await
2989 // getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { 2978 // getApp().request.promiseGet("/api/weshop/order/ware/lock/page", {
@@ -3213,7 +3202,8 @@ Page({ @@ -3213,7 +3202,8 @@ Page({
3213 th.setData({ all_pick_list: e.data.data.pageData }); 3202 th.setData({ all_pick_list: e.data.data.pageData });
3214 3203
3215 //--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购-- 3204 //--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购--
3216 - if (th.data.sales_rules >= 2 && !th.data.is_newsales_rules && ((th.data.prom_type != 9 && th.data.prom_type != 1 && th.data.prom_type != 6 && th.data.prom_type != 4) || is_normal == 1)) { 3205 + if (!getApp().is_virtual(th.data.sele_g) && !th.data.sele_g.whsle_id &&
  3206 + th.data.sales_rules >= 2 && !th.data.is_newsales_rules && ([1,2,4,6,8,9].indexOf(th.data.prom_type)== -1 || is_normal == 1)) {
3217 setTimeout(function () { 3207 setTimeout(function () {
3218 th.deal_pickup_dline(e); 3208 th.deal_pickup_dline(e);
3219 }, 800) 3209 }, 800)
@@ -4298,7 +4288,10 @@ Page({ @@ -4298,7 +4288,10 @@ Page({
4298 // ind == 1 为普通购买 4288 // ind == 1 为普通购买
4299 openSpecModel_pt: function (e) { 4289 openSpecModel_pt: function (e) {
4300 4290
4301 - this.setData({ open_ind_store: 9, goodsInputNum: 1 }); 4291 +
  4292 + var mo_num=getApp().get_limit_qty(this.data.sele_g);
  4293 +
  4294 + this.setData({ open_ind_store: 9, goodsInputNum: mo_num });
4302 // 判断是否有待支付订单 4295 // 判断是否有待支付订单
4303 var aid = this.data.group_id; 4296 var aid = this.data.group_id;
4304 var switOn = true; 4297 var switOn = true;
@@ -4472,172 +4465,252 @@ Page({ @@ -4472,172 +4465,252 @@ Page({
4472 //----------添加到购物车时,要判断限购数量,-------- 4465 //----------添加到购物车时,要判断限购数量,--------
4473 e.get_buy_num(o, async function (ee) { 4466 e.get_buy_num(o, async function (ee) {
4474 4467
4475 - //---判断商品是否超出限购---  
4476 - // if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) {  
4477 - // if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) {  
4478 - // wx.showModal({  
4479 - // title: '提示',  
4480 - // content: '超出商品限购'  
4481 - // });  
4482 -  
4483 - // var num = th.data.prom_buy_limit - th.data.prom_buy_num;  
4484 - // if (num < 0) num = 0;  
4485 - // th.setData({ goodsInputNum: num })  
4486 - // return false;  
4487 - // }  
4488 - // } 4468 + //---判断商品是否超出限购---
  4469 + if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) {
  4470 + if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) {
  4471 + wx.showModal({
  4472 + title: '提示',
  4473 + content: '超出商品限购'
  4474 + });
4489 4475
4490 - //---判断商品是否超出活动限购,拼团的普通购买不计算活动的限购---  
4491 - // if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && th.data.is_normal != 1) {  
4492 - // if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) {  
4493 - // wx.showModal({  
4494 - // title: '提示',  
4495 - // content: '超出商品活动限购'  
4496 - // });  
4497 -  
4498 - // var num = th.data.prom_buy_limit - th.data.prom_buy_num;  
4499 - // if (num < 0) num = 0;  
4500 - // th.setData({ goodsInputNum: num })  
4501 - // return false;  
4502 - // }  
4503 - // } 4476 + var num = th.data.prom_buy_limit - th.data.prom_buy_num;
  4477 + if (num < 0) num = 0;
  4478 + th.setData({goodsInputNum: num})
  4479 + return false;
  4480 + }
  4481 + }
4504 4482
4505 - var redis_num = 0  
4506 - //不是普通购买的时候  
4507 - // if (th.data.is_normal != 1) {  
4508 - // //-------判断活动是否抢光---------  
4509 - // await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/6/" + th.data.sele_g.prom_id, {  
4510 - // 1: 1  
4511 - // }).then(res => {  
4512 - // redis_num = res.data.data;  
4513 - // })  
4514 4483
4515 - // if (th.data.goodsInputNum > redis_num) {  
4516 - // wx.showModal({  
4517 - // title: '提示',  
4518 - // content: '超出商品活动库存'  
4519 - // }); 4484 + var redis_num = 0
4520 4485
4521 - // th.setData({ goodsInputNum: redis_num }) 4486 + if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined)
  4487 + th.setData({
  4488 + sto_sele_name: ""
  4489 + });
4522 4490
4523 - // return false;  
4524 - // }  
4525 - // } 4491 + if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th);
  4492 +
  4493 + //--------------此时操作的数据------------
  4494 + var newd = {
  4495 + goods_id: o.goods_id,
  4496 + goods_num: th.data.goodsInputNum,
  4497 + pick_id: th.data.sto_sele_id,
  4498 + user_id: oo.user_id,
  4499 + store_id: th.data.stoid,
  4500 + goods_price: o.shop_price,
  4501 + goods_name: o.goods_name,
  4502 + goods_sn: o.goods_sn,
  4503 + sku: o.sku,
  4504 + };
4526 4505
4527 - // if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th);  
4528 - // if (th.data.goodsInputNum > o.store_count) {  
4529 - // th.setData({ goodsInputNum: o.store_count })  
4530 - // return s.my_warnning("超出商品库存", 0, th);  
4531 - // } 4506 + //---是不是从收藏夹出来的---
  4507 + if (th.data.c_guide_id) {
  4508 + newd['guide_id'] = th.data.c_guide_id;
  4509 + newd['guide_type'] = 2;
4532 4510
4533 - if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined)  
4534 - th.setData({  
4535 - sto_sele_name: ""  
4536 - });  
4537 - if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); 4511 + } else {
  4512 + if (getApp().globalData.guide_id) {
  4513 + newd['guide_id'] = getApp().globalData.guide_id;
  4514 + newd['guide_type'] = 0;
4538 4515
4539 - //--------------此时操作的数据------------  
4540 - var newd = {  
4541 - goods_id: o.goods_id,  
4542 - goods_num: th.data.goodsInputNum,  
4543 - pick_id: th.data.sto_sele_id,  
4544 - user_id: oo.user_id,  
4545 - store_id: th.data.stoid,  
4546 - goods_price: o.shop_price,  
4547 - goods_name: o.goods_name,  
4548 - goods_sn: o.goods_sn,  
4549 - sku: o.sku,  
4550 - }; 4516 + }
  4517 + }
  4518 + if (getApp().globalData.groupchat_id) {
  4519 + newd['groupchat_id'] = getApp().globalData.groupchat_id;
  4520 + }
  4521 + //让商品带上房间号
  4522 + if (th.data.sys_switch.is_skuroom_id == 1) {
  4523 + if (th.data.data.goods_id == getApp().globalData.room_goods_id) {
  4524 + newd.room_id = getApp().globalData.room_id;
  4525 + }
  4526 + } else {
  4527 + if (newd.goods_id == getApp().globalData.room_goods_id) {
  4528 + newd.room_id = getApp().globalData.room_id;
  4529 + }
  4530 + }
4551 4531
4552 - //---是不是从收藏夹出来的---  
4553 - if (th.data.c_guide_id) {  
4554 - newd['guide_id'] = th.data.c_guide_id;  
4555 - newd['guide_type'] = 2; 4532 + //---如果商品不是积分购和拼团,要判断一个是否要进行等级价的判断------
4556 4533
4557 - } else {  
4558 - if (getApp().globalData.guide_id) {  
4559 - newd['guide_id'] = getApp().globalData.guide_id;  
4560 - newd['guide_type'] = 0; 4534 + if (th.data.is_normal == 1) {
  4535 + var conf = th.data.bconfig;
  4536 + if (conf.switch_list && getApp().globalData.userInfo['card_field'] && getApp().globalData.userInfo['card_expiredate']) {
  4537 + var s_list = JSON.parse(conf.switch_list);
4561 4538
4562 - }  
4563 - }  
4564 - if(getApp().globalData.groupchat_id){  
4565 - newd['groupchat_id'] = getApp().globalData.groupchat_id;  
4566 - }  
4567 - //让商品带上房间号  
4568 - if (th.data.sys_switch.is_skuroom_id == 1) {  
4569 - if (th.data.data.goods_id == getApp().globalData.room_goods_id) {  
4570 - newd.room_id = getApp().globalData.room_id;  
4571 - }  
4572 - } else {  
4573 - if (newd.goods_id == getApp().globalData.room_goods_id) {  
4574 - newd.room_id = getApp().globalData.room_id;  
4575 - }  
4576 - } 4539 + var now = ut.gettimestamp();
  4540 +
  4541 + var str = getApp().globalData.userInfo['card_expiredate'].replace(/-/g, '/');
  4542 + var end = new Date(str);
  4543 + end = Date.parse(end) / 1000;
  4544 +
  4545 + //如果后台有开启等级价的功能
  4546 + if (parseInt(s_list.rank_switch) == 2 && end > now) {
  4547 + var card_price = o[getApp().globalData.userInfo['card_field']];
  4548 + //如果会员有等级价
  4549 + if (getApp().globalData.userInfo['card_field'] != undefined && getApp().globalData.userInfo['card_field'] != null
  4550 + && getApp().globalData.userInfo['card_field'] != "" && card_price > 0) {
  4551 + newd.goods_price = card_price;
  4552 + }
  4553 + }
  4554 + }
4577 4555
4578 - //---如果商品不是积分购和拼团,要判断一个是否要进行等级价的判断------ 4556 + //---如果是线下门店销售的时候---
  4557 + if (!getApp().is_virtual(th.data.sele_g) && th.data.sales_rules >= 2 && !th.data.sele_g.whsle_id) {
  4558 + var pick = th.get_pick_from_list(th.data.sto_sele_id)
4579 4559
4580 - if (th.data.is_normal == 1) {  
4581 - var conf = th.data.bconfig;  
4582 - if (conf.switch_list && getApp().globalData.userInfo['card_field'] && getApp().globalData.userInfo['card_expiredate']) {  
4583 - var s_list = JSON.parse(conf.switch_list); 4560 + th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) {
  4561 + if (CanOutQty) {
4584 4562
4585 - var now = ut.gettimestamp(); 4563 + if (CanOutQty < e.data.goodsInputNum) {
  4564 + wx.showToast({
  4565 + title: '库存不足!',
  4566 + icon: 'none',
  4567 + });
  4568 + return false;
  4569 + }
4586 4570
4587 - var str = getApp().globalData.userInfo['card_expiredate'].replace(/-/g, '/');  
4588 - var end = new Date(str);  
4589 - end = Date.parse(end) / 1000; 4571 + th.by_next_func(newd);
  4572 + } else {
  4573 + wx.showToast({
  4574 + title: '库存不足!',
  4575 + icon: 'none',
  4576 + });
  4577 + return false;
  4578 + }
  4579 + })
4590 4580
4591 - //如果后台有开启等级价的功能  
4592 - if (parseInt(s_list.rank_switch) == 2 && end > now) {  
4593 - var card_price = o[getApp().globalData.userInfo['card_field']];  
4594 - //如果会员有等级价  
4595 - if (getApp().globalData.userInfo['card_field'] != undefined && getApp().globalData.userInfo['card_field'] != null  
4596 - && getApp().globalData.userInfo['card_field'] != "" && card_price > 0) {  
4597 - newd.goods_price = card_price; 4581 + } else {
  4582 + if (o.store_count <= 0) {
  4583 + wx.showToast({
  4584 + title: '库存已为空!',
  4585 + icon: 'none',
  4586 + });
  4587 + return false;
  4588 + //return s.my_warnning("库存已为空!", 0, th);
  4589 + }
  4590 +
  4591 + if (o.store_count < e.data.goodsInputNum) {
  4592 + wx.showToast({
  4593 + title: '库存不足!',
  4594 + icon: 'none',
  4595 + });
  4596 + return false;
  4597 + //return s.my_warnning("库存不足!", 0, th);
  4598 + }
  4599 +
  4600 +
  4601 + th.by_next_func(newd);
4598 } 4602 }
  4603 + return false;
  4604 +
  4605 +
4599 } 4606 }
4600 - }  
4601 - }  
4602 4607
4603 4608
4604 - //-----如果是秒杀,团购,积分购,拼团,且不是普通购买-----  
4605 - if (th.data.prom_type == 9 && th.data.is_normal != 1) {  
4606 - newd.goods_price = th.data.prom_price;  
4607 - newd.prom_type = th.data.prom_type;  
4608 - newd.prom_id = th.data.prom_id;  
4609 - //newd.kt_type = th.data.prom_act.kttype; //开团类型  
4610 - newd.is_pt_tz = 0;  
4611 - //th.data.sto_sele_distr=1; //直接用自提的方式提交  
4612 - if (newd.kt_type > 1) {  
4613 - newd.is_pt_tz = 1; //开团类型 4609 + //-----如果是秒杀,团购,积分购,拼团,且不是普通购买-----
  4610 + if (th.data.prom_type == 9 && th.data.is_normal != 1) {
  4611 + newd.goods_price = th.data.prom_price;
  4612 + newd.prom_type = th.data.prom_type;
  4613 + newd.prom_id = th.data.prom_id;
  4614 + //newd.kt_type = th.data.prom_act.kttype; //开团类型
  4615 + newd.is_pt_tz = 0;
  4616 + //th.data.sto_sele_distr=1; //直接用自提的方式提交
  4617 + if (newd.kt_type > 1) {
  4618 + newd.is_pt_tz = 1; //开团类型
  4619 + }
  4620 + if (newd.kt_type == 3) {
  4621 + th.data.sto_sele_distr = 1;
  4622 + }
  4623 +
  4624 + }
  4625 +
  4626 + // else if (th.data.prom_type == 3) {
  4627 + // newd.prom_type = 0;
  4628 + // newd.prom_id = 0;
  4629 + // }
  4630 +
  4631 + th.by_next_func(newd);
4614 } 4632 }
4615 - if (newd.kt_type == 3) {  
4616 - th.data.sto_sele_distr = 1; 4633 +
  4634 +
  4635 + )
  4636 + },
  4637 + by_next_func(newd){
  4638 + var th=this;
  4639 + newd['pick_name'] = th.data.sto_sele_name;
  4640 + newd['pick_dis'] = th.data.sto_sele_distr;
  4641 + newd['is_normal'] = th.data.is_normal;
  4642 +
  4643 + if (newd['is_normal']) {
  4644 + newd['is_pd_normal'] = 1;
  4645 + //判断一下有没有全局优惠活动
  4646 + th.buyNow(newd);
  4647 + }
  4648 + else {
  4649 + // 点击立即参团
  4650 + th.buyNow_pt(newd);
  4651 + }
  4652 + },
  4653 +
  4654 + //统一一下获取线下库存的函数
  4655 + async check_CanOutQty(goodsinfo, item, func) {
  4656 +
  4657 + var sales_rules = this.data.sales_rules;
  4658 +
  4659 + var lock_rq = {
  4660 + store_id: os.stoid,
  4661 + wareId: goodsinfo.goods_id,
  4662 + pageSize: 1000
  4663 + };
  4664 +
  4665 + if (sales_rules == 2) {
  4666 + lock_rq.storageId = item.pickup_id
  4667 + } else {
  4668 + lock_rq.appoint_pick_keyid = encodeURIComponent(this.data.appoint_pick_keyid)
  4669 + }
  4670 +
  4671 + var lock = 0;
  4672 + var CanOutQty = 0;
  4673 + var plist = null;
  4674 + //先读取门店的lock
  4675 + await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", {
  4676 + data: lock_rq
  4677 + }).then(res => {
  4678 + if (res.data.code == 0 && res.data.data.total > 0) {
  4679 + for (var i in res.data.data.pageData)
  4680 + lock += res.data.data.pageData[i].outQty;
4617 } 4681 }
  4682 + })
4618 4683
  4684 + var sto_req = {
  4685 + wareIds: encodeURIComponent(goodsinfo.erpwareid),
  4686 + storeId: os.stoid
  4687 + }
  4688 + if (sales_rules == 2) {
  4689 + sto_req.storageNos = item.pickup_no
  4690 + } else {
  4691 + sto_req.storageIds = encodeURIComponent(this.data.appoint_pick_keyid)
4619 } 4692 }
4620 4693
4621 - // else if (th.data.prom_type == 3) {  
4622 - // newd.prom_type = 0;  
4623 - // newd.prom_id = 0;  
4624 - // }  
4625 4694
4626 - newd['pick_name'] = th.data.sto_sele_name;  
4627 - newd['pick_dis'] = th.data.sto_sele_distr;  
4628 - newd['is_normal'] = th.data.is_normal;  
4629 4695
4630 - if (newd['is_normal']) {  
4631 - newd['is_pd_normal'] = 1;  
4632 - //判断一下有没有全局优惠活动  
4633 - th.buyNow(newd); 4696 + //读取线下的门店库存
  4697 + await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", {
  4698 + data: sto_req
  4699 + }).then(res => {
  4700 + if (res.data.code == 0 && res.data.data.total > 0) {
  4701 + plist = res.data.data.pageData[0];
  4702 + }
  4703 + })
  4704 +
  4705 + if (plist && plist.CanOutQty - lock > 0) {
  4706 + CanOutQty = plist.CanOutQty - lock;
4634 } 4707 }
4635 - else {  
4636 - // 点击立即参团  
4637 - th.buyNow_pt(newd);  
4638 - };  
4639 - })  
4640 - }, 4708 +
  4709 + if (func) func(CanOutQty);
  4710 +
  4711 + },
  4712 +
  4713 +
4641 //----------立即购买_pt----------- 4714 //----------立即购买_pt-----------
4642 buyNow_pt: function (e) { 4715 buyNow_pt: function (e) {
4643 s.set_b_now(e); 4716 s.set_b_now(e);
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.wxml
@@ -436,7 +436,7 @@ @@ -436,7 +436,7 @@
436 <view class="no_store" wx:if="{{def_pick_store && def_pick_store.is_no_dis}}"> 436 <view class="no_store" wx:if="{{def_pick_store && def_pick_store.is_no_dis}}">
437 (配送不匹配) 437 (配送不匹配)
438 </view> 438 </view>
439 - <view class="no_store" wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules>=2 && prom_type==0}}"> 439 + <view class="no_store" wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && !filters.is_virtual_gd(sele_g.is_virtual) && sales_rules>=2 && prom_type==0}}">
440 (库存不足) 440 (库存不足)
441 </view> 441 </view>
442 </block> 442 </block>
@@ -1064,12 +1064,17 @@ @@ -1064,12 +1064,17 @@
1064 <block wx:if="{{prom_type == 0}}"> 1064 <block wx:if="{{prom_type == 0}}">
1065 <view class="flex"> 1065 <view class="flex">
1066 <view class="spec-goods-stock">已售:{{sele_g.sales_sum}}</view> 1066 <view class="spec-goods-stock">已售:{{sele_g.sales_sum}}</view>
  1067 + <!-- 线下门店销售的时候 -->
1067 <block wx:if="{{sales_rules>=2}}"> 1068 <block wx:if="{{sales_rules>=2}}">
1068 - <view class="spec-goods-stock" wx:if="{{def_pick_store && def_pick_store.CanOutQty}}">  
1069 - 可售:{{def_pick_store.CanOutQty}}  
1070 - </view>  
1071 - <view class="spec-goods-stock" wx:else>可售:0</view> 1069 +
  1070 + <block wx:if="{{!filters.is_virtual_gd(sele_g.is_virtual)}}">
  1071 + <view class="spec-goods-stock" wx:if="{{def_pick_store && def_pick_store.CanOutQty}}">
  1072 + 可售:{{def_pick_store.CanOutQty}}
  1073 + </view>
  1074 + <view class="spec-goods-stock" wx:else>可售:0</view>
  1075 + </block>
1072 </block> 1076 </block>
  1077 +
1073 <block wx:else> 1078 <block wx:else>
1074 <view class="spec-goods-stock">可售:{{sele_g.store_count}}</view> 1079 <view class="spec-goods-stock">可售:{{sele_g.store_count}}</view>
1075 </block> 1080 </block>
@@ -1105,7 +1110,7 @@ @@ -1105,7 +1110,7 @@
1105 <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> 1110 <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view>
1106 <block wx:else> 1111 <block wx:else>
1107 <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> 1112 <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view>
1108 - <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules>=2 && prom_type==0}}"> 1113 + <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && !filters.is_virtual_gd(sele_g.is_virtual) && sales_rules>=2 && prom_type==0}}">
1109 (库存不足) 1114 (库存不足)
1110 </view> 1115 </view>
1111 </block> 1116 </block>
@@ -1177,7 +1182,7 @@ @@ -1177,7 +1182,7 @@
1177 </block> 1182 </block>
1178 <block wx:else> 1183 <block wx:else>
1179 <!-- 如果是线下库存购买的时候,且是普通商品购买的时候 --> 1184 <!-- 如果是线下库存购买的时候,且是普通商品购买的时候 -->
1180 - <block wx:if="{{sales_rules>=2 && prom_type==0}}"> 1185 + <block wx:if="{{!filters.is_virtual_gd(sele_g.is_virtual) && sales_rules>=2 && prom_type==0}}">
1181 <block wx:if="{{!def_pick_store.CanOutQty}}"> 1186 <block wx:if="{{!def_pick_store.CanOutQty}}">
1182 <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999"> 1187 <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">
1183 库存不足 1188 库存不足
packageC/pages/presell/cart/cart2.js
@@ -128,8 +128,8 @@ Page({ @@ -128,8 +128,8 @@ Page({
128 128
129 dis_config:null, 129 dis_config:null,
130 bn_use_commission:0, //是不是使用佣金 130 bn_use_commission:0, //是不是使用佣金
131 -  
132 - same_ok:1 //同城配送按钮控制 131 + same_ok:1,
  132 + appoint_pick_keyid: '',
133 133
134 }, 134 },
135 onLoad: function (t) { 135 onLoad: function (t) {
@@ -248,7 +248,8 @@ Page({ @@ -248,7 +248,8 @@ Page({
248 sales_rules: ee.sales_rules, 248 sales_rules: ee.sales_rules,
249 rank_switch: json_d.rank_switch, 249 rank_switch: json_d.rank_switch,
250 is_default_logistics: is_default_logistics, 250 is_default_logistics: is_default_logistics,
251 - is_same_city: is_same_city 251 + is_same_city: is_same_city,
  252 + appoint_pick_keyid: json_d.appoint_pick_keyid
252 }); 253 });
253 254
254 var rank_switch = json_d.rank_switch; 255 var rank_switch = json_d.rank_switch;
@@ -1284,7 +1285,7 @@ Page({ @@ -1284,7 +1285,7 @@ Page({
1284 if (gg.is_pd_normal) goods.is_pd_normal = 1; 1285 if (gg.is_pd_normal) goods.is_pd_normal = 1;
1285 1286
1286 //如果不立即购买或者秒杀,如果是线下库存购买的时候 1287 //如果不立即购买或者秒杀,如果是线下库存购买的时候
1287 - if (goods.prom_type != 1 && goods.prom_type != 6 && goods.prom_type != 8 && th.data.sales_rules == 2) { 1288 + if ([1,2,4,6,8,9].indexOf(goods.prom_type)== -1 && th.data.sales_rules >= 2 && !th.data.bn_goods.whsle_id && !getApp().is_virtual(th.data.bn_goods)) {
1288 var isok = 1; 1289 var isok = 1;
1289 await th.check_store_num(goods.goods_id, th.data.bn_pick, gg.goods_num, function (res) { 1290 await th.check_store_num(goods.goods_id, th.data.bn_pick, gg.goods_num, function (res) {
1290 isok = res; 1291 isok = res;
@@ -1552,7 +1553,7 @@ Page({ @@ -1552,7 +1553,7 @@ Page({
1552 } 1553 }
1553 1554
1554 //如果不立即购买或者秒杀,如果是线下库存购买的时候 1555 //如果不立即购买或者秒杀,如果是线下库存购买的时候
1555 - if (goods.prom_type == 0 && th.data.sales_rules == 2) { 1556 + if (goods.prom_type == 0 && th.data.sales_rules >= 2 && !g_item.whsle_id && !getApp().is_virtual(g_item)) {
1556 var isok = 1; 1557 var isok = 1;
1557 await th.check_store_num(goods.goods_id, t_item.pickup_id, goods.goods_num, function (res) { 1558 await th.check_store_num(goods.goods_id, t_item.pickup_id, goods.goods_num, function (res) {
1558 isok = res; 1559 isok = res;
@@ -1729,26 +1730,38 @@ Page({ @@ -1729,26 +1730,38 @@ Page({
1729 }) 1730 })
1730 1731
1731 }, 1732 },
  1733 +
  1734 +
  1735 +
1732 //---确认线下门店的数量足不足--- 1736 //---确认线下门店的数量足不足---
1733 async check_store_num(goods_id, pick, goods_num, func) { 1737 async check_store_num(goods_id, pick, goods_num, func) {
1734 var lock = 0, pick_no, plist, erpwareid; 1738 var lock = 0, pick_no, plist, erpwareid;
  1739 +
  1740 + var lock_rq = { store_id: os.stoid, wareId: goods_id, storageId: pick, pageSize: 1000 };
  1741 + if (this.data.sales_rules == 3) {
  1742 + lock_rq.appoint_pick_keyid = this.data.appoint_pick_keyid;
  1743 + delete lock_rq.storageId
  1744 + }
1735 //先读取门店的lock 1745 //先读取门店的lock
1736 await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { 1746 await getApp().request.promiseGet("/api/weshop/order/ware/lock/page", {
1737 - data: { store_id: os.stoid, wareId: goods_id, storageId: pick, pageSize: 1000 } 1747 + data:lock_rq
1738 }).then(res => { 1748 }).then(res => {
1739 if (res.data.code == 0 && res.data.data.total > 0) { 1749 if (res.data.code == 0 && res.data.data.total > 0) {
1740 for (var i in res.data.data.pageData) 1750 for (var i in res.data.data.pageData)
1741 lock += res.data.data.pageData[i].outQty; 1751 lock += res.data.data.pageData[i].outQty;
1742 } 1752 }
1743 }) 1753 })
1744 - //先获取门店的编号  
1745 - await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + pick, {  
1746 - data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick }  
1747 - }).then(res => {  
1748 - if (res.data.code == 0) {  
1749 - pick_no = res.data.data.pickup_no;  
1750 - }  
1751 - }) 1754 +
  1755 + if (this.data.sales_rules == 2) {
  1756 + //先获取门店的编号
  1757 + await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + pick, {
  1758 + data: {storeId: os.stoid, goodsId: t.goods_id, pickupId: pick}
  1759 + }).then(res => {
  1760 + if (res.data.code == 0) {
  1761 + pick_no = res.data.data.pickup_no;
  1762 + }
  1763 + })
  1764 + }
1752 //先获取商品的线下库存 1765 //先获取商品的线下库存
1753 await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + goods_id, { 1766 await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + goods_id, {
1754 data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick } 1767 data: { storeId: os.stoid, goodsId: t.goods_id, pickupId: pick }
@@ -1757,9 +1770,16 @@ Page({ @@ -1757,9 +1770,16 @@ Page({
1757 erpwareid = res.data.data.erpwareid; 1770 erpwareid = res.data.data.erpwareid;
1758 } 1771 }
1759 }) 1772 })
  1773 +
  1774 + var sto_rq = { storageNos: pick_no, wareIds: encodeURIComponent(erpwareid), storeId: os.stoid, pageSize: 2000 };
  1775 + if (this.data.sales_rules == 3) {
  1776 + sto_rq.storageIds = this.data.appoint_pick_keyid;
  1777 + delete sto_rq.storageNos
  1778 + }
  1779 +
1760 //读取线下的门店库存 1780 //读取线下的门店库存
1761 await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { 1781 await getApp().request.promiseGet("/api/weshop/goods/getWareStorages", {
1762 - data: { storageNos: pick_no, wareIds: encodeURIComponent(erpwareid), storeId: os.stoid, pageSize: 2000 } 1782 + data: sto_rq
1763 }).then(res => { 1783 }).then(res => {
1764 if (res.data.code == 0) { 1784 if (res.data.code == 0) {
1765 plist = res.data.data.pageData[0]; 1785 plist = res.data.data.pageData[0];
packageC/pages/presell/goodsInfo/goodsInfo.js
@@ -395,6 +395,8 @@ Page({ @@ -395,6 +395,8 @@ Page({
395 is_closecoupon: json_d.is_closecoupon, 395 is_closecoupon: json_d.is_closecoupon,
396 is_newsales_rules: json_d.is_newsales_rules, 396 is_newsales_rules: json_d.is_newsales_rules,
397 is_retail_price: json_d.is_retail_price || 0, 397 is_retail_price: json_d.is_retail_price || 0,
  398 + appoint_pick_keyid: json_d.appoint_pick_keyid
  399 +
398 }); 400 });
399 // ee.init(gid); 401 // ee.init(gid);
400 //------几人评价------- 402 //------几人评价-------
@@ -1992,7 +1994,8 @@ Page({ @@ -1992,7 +1994,8 @@ Page({
1992 th.setData({ all_pick_list: e.data.data.pageData }); 1994 th.setData({ all_pick_list: e.data.data.pageData });
1993 1995
1994 //--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购 预售-- 1996 //--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购 预售--
1995 - if (th.data.sales_rules == 2 && !th.data.is_newsales_rules && ((th.data.prom_type != 1 && th.data.prom_type != 6 && th.data.prom_type != 4 && th.data.prom_type != 8) || is_normal == 1)) { 1997 + if(!getApp().is_virtual(th.data.sele_g) && !th.data.sele_g.whsle_id
  1998 + && th.data.sales_rules >= 2 && !th.data.is_newsales_rules && ([1,2,4,6,8,9].indexOf(th.data.prom_type)==-1 || is_normal == 1)) {
1996 setTimeout(function () { 1999 setTimeout(function () {
1997 th.deal_pickup_dline(e); 2000 th.deal_pickup_dline(e);
1998 }, 800) 2001 }, 800)
@@ -2199,7 +2202,8 @@ Page({ @@ -2199,7 +2202,8 @@ Page({
2199 2202
2200 //------------处理线下门店库存-------- 2203 //------------处理线下门店库存--------
2201 deal_pickup_dline(e) { 2204 deal_pickup_dline(e) {
2202 - var pkno = [], th = this; 2205 + var pkno = [],
  2206 + th = this;
2203 if (!th.data.sele_g) return false; 2207 if (!th.data.sele_g) return false;
2204 2208
2205 if (this.data.def_pick_store) { 2209 if (this.data.def_pick_store) {
@@ -2219,78 +2223,165 @@ Page({ @@ -2219,78 +2223,165 @@ Page({
2219 2223
2220 var g_distr_type = th.data.sele_g.distr_type; 2224 var g_distr_type = th.data.sele_g.distr_type;
2221 var lock = []; 2225 var lock = [];
  2226 +
  2227 + var lock_rq = {
  2228 + store_id: os.stoid,
  2229 + wareId: th.data.sele_g.goods_id,
  2230 + pageSize: 1000
  2231 + };
  2232 +
  2233 + if (th.data.sales_rules == 3) {
  2234 + lock_rq.appoint_pick_keyid = th.data.appoint_pick_keyid;
  2235 + }
  2236 +
2222 //先读取门店的lock,采用链式写法,少用await 2237 //先读取门店的lock,采用链式写法,少用await
2223 getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { 2238 getApp().request.promiseGet("/api/weshop/order/ware/lock/page", {
2224 - data: { store_id: os.stoid, wareId: th.data.sele_g.goods_id, pageSize: 1000 } 2239 + data: lock_rq
2225 }).then(res => { 2240 }).then(res => {
2226 if (res.data.code == 0 && res.data.data.total > 0) { 2241 if (res.data.code == 0 && res.data.data.total > 0) {
2227 lock = res.data.data.pageData 2242 lock = res.data.data.pageData
2228 } 2243 }
  2244 + var sto_rq = {
  2245 + wareIds: encodeURIComponent(th.data.sele_g.erpwareid),
  2246 + storeId: os.stoid,
  2247 + pageSize: 2000
  2248 + }
  2249 +
  2250 + if (th.data.sales_rules == 3) {
  2251 + sto_rq.storageIds = th.data.appoint_pick_keyid;
  2252 + } else {
  2253 + sto_rq.storageNos = pkno_str;
  2254 + }
  2255 +
  2256 +
2229 //---通过接口获取门店的线下库存信息-- 2257 //---通过接口获取门店的线下库存信息--
2230 return getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { 2258 return getApp().request.promiseGet("/api/weshop/goods/getWareStorages", {
2231 - data: { storageNos: pkno_str, wareIds: encodeURIComponent(th.data.sele_g.erpwareid), storeId: os.stoid, pageSize: 2000 } 2259 + data: sto_rq
2232 }) 2260 })
2233 }).then(res => { 2261 }).then(res => {
2234 2262
2235 wx.hideLoading(); 2263 wx.hideLoading();
2236 if (res.data.code == 0) { 2264 if (res.data.code == 0) {
  2265 +
2237 if (res.data.data.pageData && res.data.data.pageData.length > 0) { 2266 if (res.data.data.pageData && res.data.data.pageData.length > 0) {
2238 - var plist = res.data.data.pageData; 2267 +
2239 var def_pick_store = th.data.def_pick_store; 2268 var def_pick_store = th.data.def_pick_store;
2240 - //以原来的数组为外循环,保证距离的顺序  
2241 - for (var kk in o_plist) {  
2242 - for (var ii in plist) {  
2243 - //线下的门店小心  
2244 - var n_item = plist[ii];  
2245 - if (n_item.StorageNo == o_plist[kk].pickup_no) {  
2246 -  
2247 - //拿到锁库的数量  
2248 - var lock_num = th.find_lock_num(o_plist[kk].pickup_id, lock);  
2249 - //可出库数大于预出库库存的数量,可以判断为有库存  
2250 - if (n_item.CanOutQty > lock_num) {  
2251 - o_plist[kk].CanOutQty = n_item.CanOutQty - lock_num;  
2252 - new_list.push(o_plist[kk]);  
2253 - //--如果找到默认门店,同时也应该判断配送方式对不对--  
2254 - if (th.data.fir_def_store && n_item.StorageNo == th.data.fir_def_store.pickup_no && (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || th.data.def_pick_store.distr_type == g_distr_type)) {  
2255 - th.data.fir_def_store.CanOutQty = n_item.CanOutQty - lock_num;  
2256 - if (def_pick_store.pickup_id == th.data.fir_def_store.pickup_id)  
2257 - th.setData({ def_pick_store: th.data.fir_def_store })  
2258 - is_find_def_store = 1; 2269 + var plist = res.data.data.pageData;
  2270 + if (th.data.sales_rules == 3) {
  2271 + var lock_num = 0;
  2272 + var Qty = 0;
  2273 + //-- 计算锁住的库存 --
  2274 + for (var i in lock) lock_num += lock[i].outQty;
  2275 + Qty = plist[0].CanOutQty - lock_num;
  2276 +
  2277 + if (Qty > 0) {
  2278 + for (var kk in o_plist) {
  2279 + o_plist[kk].CanOutQty = Qty;
  2280 + new_list.push(o_plist[kk]);
  2281 + }
  2282 + if (th.data.fir_def_store &&
  2283 + (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || (th.data.def_pick_store && th.data.def_pick_store.distr_type == g_distr_type))) {
  2284 + th.data.fir_def_store.Qty=Qty;
  2285 + if (def_pick_store && def_pick_store.pickup_id == th.data.fir_def_store.pickup_id)
  2286 + th.setData({
  2287 + def_pick_store: th.data.fir_def_store
  2288 + })
  2289 + is_find_def_store = 1;
  2290 + }
  2291 +
  2292 + } else {
  2293 + th.setData({
  2294 + all_sto: null,
  2295 + only_pk: null,
  2296 + def_pickpu_list: null
  2297 + });
  2298 + return false;
  2299 + }
  2300 +
  2301 + } else {
  2302 +
  2303 +
  2304 + //以原来的数组为外循环,保证距离的顺序
  2305 + for (var kk in o_plist) {
  2306 + for (var ii in plist) {
  2307 + //线下的门店小心
  2308 + var n_item = plist[ii];
  2309 + if (n_item.StorageNo == o_plist[kk].pickup_no) {
  2310 +
  2311 + //拿到锁库的数量
  2312 + var lock_num = th.find_lock_num(o_plist[kk].pickup_id, lock);
  2313 + //可出库数大于预出库库存的数量,可以判断为有库存
  2314 + if (n_item.CanOutQty > lock_num) {
  2315 + o_plist[kk].CanOutQty = n_item.CanOutQty - lock_num;
  2316 + new_list.push(o_plist[kk]);
  2317 + //--如果找到默认门店,同时也应该判断配送方式对不对--
  2318 + if (th.data.fir_def_store && n_item.StorageNo == th.data.fir_def_store.pickup_no && (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || th.data.def_pick_store.distr_type == g_distr_type)) {
  2319 + th.data.fir_def_store.CanOutQty = n_item.CanOutQty - lock_num;
  2320 + if (def_pick_store && def_pick_store.pickup_id == th.data.fir_def_store.pickup_id)
  2321 + th.setData({
  2322 + def_pick_store: th.data.fir_def_store
  2323 + })
  2324 + is_find_def_store = 1;
  2325 + }
2259 } 2326 }
  2327 + break;
2260 } 2328 }
2261 - break;  
2262 } 2329 }
2263 } 2330 }
  2331 +
2264 } 2332 }
2265 2333
2266 //数据组装下 2334 //数据组装下
2267 - var em = {}; em.data = {}; em.data.data = {}; 2335 + var em = {};
  2336 + em.data = {};
  2337 + em.data.data = {};
2268 em.data.data.total = new_list.length; 2338 em.data.data.total = new_list.length;
2269 em.data.data.pageData = new_list; 2339 em.data.data.pageData = new_list;
2270 2340
  2341 +
2271 //--如果找到默认门店,同时也应该判断配送方式对不对-- 2342 //--如果找到默认门店,同时也应该判断配送方式对不对--
2272 - if (th.data.fir_def_store && !is_find_def_store && th.data.fir_def_store.pickup_id && (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || th.data.def_pick_store.distr_type == g_distr_type)) { 2343 + if (th.data.fir_def_store && !is_find_def_store && th.data.fir_def_store.pickup_id &&
  2344 + (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || th.data.def_pick_store.distr_type == g_distr_type)) {
2273 th.data.fir_def_store.CanOutQty = 0; 2345 th.data.fir_def_store.CanOutQty = 0;
2274 //--当选择的门店是客户默认的门店的时候-- 2346 //--当选择的门店是客户默认的门店的时候--
2275 if (th.data.def_pick_store && th.data.fir_def_store.pickup_id == th.data.def_pick_store.pickup_id) { 2347 if (th.data.def_pick_store && th.data.fir_def_store.pickup_id == th.data.def_pick_store.pickup_id) {
2276 - th.setData({ def_pick_store: th.data.fir_def_store }); 2348 + th.setData({
  2349 + def_pick_store: th.data.fir_def_store
  2350 + });
2277 em.data.data.pageData.unshift(th.data.def_pick_store); 2351 em.data.data.pageData.unshift(th.data.def_pick_store);
2278 } else { 2352 } else {
2279 em.data.data.pageData.splice(1, 0, th.data.fir_def_store); 2353 em.data.data.pageData.splice(1, 0, th.data.fir_def_store);
2280 } 2354 }
2281 } 2355 }
2282 2356
  2357 + for (let j = 0; j < em.data.data.pageData.length; j++) {
  2358 + var iu = em.data.data.pageData[j];
  2359 + if (iu.CanOutQty <= 0) iu.is_no_qyt = 1;
  2360 +
  2361 + }
  2362 +
2283 //---把数组组装进去--- 2363 //---把数组组装进去---
2284 th.deal_pickup(em); 2364 th.deal_pickup(em);
  2365 +
2285 } else { 2366 } else {
2286 - th.setData({ def_pick_store: null, all_sto: null, only_pk: null, def_pickpu_list: null }) 2367 + th.setData({
  2368 + all_sto: null,
  2369 + only_pk: null,
  2370 + def_pickpu_list: null
  2371 + })
2287 } 2372 }
  2373 +
2288 } else { 2374 } else {
2289 - th.setData({ def_pick_store: null, all_sto: null, only_pk: null, def_pickpu_list: null }) 2375 + th.setData({
  2376 + all_sto: null,
  2377 + only_pk: null,
  2378 + def_pickpu_list: null
  2379 + })
2290 } 2380 }
2291 }) 2381 })
2292 }, 2382 },
2293 2383
  2384 +
2294 find_lock_num(pick_id, lock) { 2385 find_lock_num(pick_id, lock) {
2295 var lock_num = 0; 2386 var lock_num = 0;
2296 if (!lock) return 0; 2387 if (!lock) return 0;
packageC/pages/presell/goodsInfo/goodsInfo.wxml
@@ -194,7 +194,7 @@ @@ -194,7 +194,7 @@
194 <view class="no_store" wx:if="{{def_pick_store && def_pick_store.is_no_dis}}"> 194 <view class="no_store" wx:if="{{def_pick_store && def_pick_store.is_no_dis}}">
195 (配送不匹配2) 195 (配送不匹配2)
196 </view> 196 </view>
197 - <view class="no_store" wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}"> 197 + <view class="no_store" wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && !filters.is_virtual_gd(sele_g.is_virtual) && sales_rules>=2 && prom_type==0}}">
198 (库存不足) 198 (库存不足)
199 </view> 199 </view>
200 </block> 200 </block>
@@ -630,7 +630,7 @@ @@ -630,7 +630,7 @@
630 <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> 630 <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view>
631 <block wx:else> 631 <block wx:else>
632 <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配1)</view> 632 <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配1)</view>
633 - <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}"> 633 + <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && !filters.is_virtual_gd(sele_g.is_virtual) && sales_rules>=2 && prom_type==0}}">
634 (库存不足) 634 (库存不足)
635 </view> 635 </view>
636 </block> 636 </block>
packageC/pages/presell/list/list.wxml
@@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
33 </navigator> 33 </navigator>
34 <view class="kill-cont"> 34 <view class="kill-cont">
35 <navigator class="goods-name ellipsis-2" 35 <navigator class="goods-name ellipsis-2"
36 - url="/packageC/pages/presell/pregoodsInfo/goodsInfo?goods_id={{item.goods_id}}&pre_id={{item.id}}">{{item.goods_name}}</navigator> 36 + url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&pre_id={{item.id}}">{{item.goods_name}}</navigator>
37 <view class="flex-vertical xc-strip-frame"> 37 <view class="flex-vertical xc-strip-frame">
38 <view class="xc-strip-blank rel"> 38 <view class="xc-strip-blank rel">
39 39
packageC/pages/presell/pregoodsInfo/goodsInfo.js
@@ -1916,7 +1916,7 @@ Page({ @@ -1916,7 +1916,7 @@ Page({
1916 th.setData({ all_pick_list: e.data.data.pageData }); 1916 th.setData({ all_pick_list: e.data.data.pageData });
1917 1917
1918 //--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购-- 1918 //--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购--
1919 - if (th.data.sales_rules == 2 && !th.data.is_newsales_rules && ((th.data.prom_type != 1 && th.data.prom_type != 6 && th.data.prom_type != 4) || is_normal == 1)) { 1919 + if (th.data.sales_rules >= 2 && !th.data.is_newsales_rules && ((th.data.prom_type != 1 && th.data.prom_type != 6 && th.data.prom_type != 4) || is_normal == 1)) {
1920 setTimeout(function () { 1920 setTimeout(function () {
1921 th.deal_pickup_dline(e); 1921 th.deal_pickup_dline(e);
1922 }, 800) 1922 }, 800)
@@ -2121,9 +2121,10 @@ Page({ @@ -2121,9 +2121,10 @@ Page({
2121 } 2121 }
2122 }, 2122 },
2123 2123
2124 - //------------处理线下门店库存-------- 2124 + //------------处理线下门店库存--------
2125 deal_pickup_dline(e) { 2125 deal_pickup_dline(e) {
2126 - var pkno = [], th = this; 2126 + var pkno = [],
  2127 + th = this;
2127 if (!th.data.sele_g) return false; 2128 if (!th.data.sele_g) return false;
2128 2129
2129 if (this.data.def_pick_store) { 2130 if (this.data.def_pick_store) {
@@ -2143,78 +2144,166 @@ Page({ @@ -2143,78 +2144,166 @@ Page({
2143 2144
2144 var g_distr_type = th.data.sele_g.distr_type; 2145 var g_distr_type = th.data.sele_g.distr_type;
2145 var lock = []; 2146 var lock = [];
  2147 +
  2148 + var lock_rq = {
  2149 + store_id: os.stoid,
  2150 + wareId: th.data.sele_g.goods_id,
  2151 + pageSize: 1000
  2152 + };
  2153 +
  2154 + if (th.data.sales_rules == 3) {
  2155 + lock_rq.appoint_pick_keyid = th.data.appoint_pick_keyid;
  2156 + }
  2157 +
2146 //先读取门店的lock,采用链式写法,少用await 2158 //先读取门店的lock,采用链式写法,少用await
2147 getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { 2159 getApp().request.promiseGet("/api/weshop/order/ware/lock/page", {
2148 - data: { store_id: os.stoid, wareId: th.data.sele_g.goods_id, pageSize: 1000 } 2160 + data: lock_rq
2149 }).then(res => { 2161 }).then(res => {
2150 if (res.data.code == 0 && res.data.data.total > 0) { 2162 if (res.data.code == 0 && res.data.data.total > 0) {
2151 lock = res.data.data.pageData 2163 lock = res.data.data.pageData
2152 } 2164 }
  2165 + var sto_rq = {
  2166 + wareIds: encodeURIComponent(th.data.sele_g.erpwareid),
  2167 + storeId: os.stoid,
  2168 + pageSize: 2000
  2169 + }
  2170 +
  2171 + if (th.data.sales_rules == 3) {
  2172 + sto_rq.storageIds = th.data.appoint_pick_keyid;
  2173 + } else {
  2174 + sto_rq.storageNos = pkno_str;
  2175 + }
  2176 +
  2177 +
2153 //---通过接口获取门店的线下库存信息-- 2178 //---通过接口获取门店的线下库存信息--
2154 return getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { 2179 return getApp().request.promiseGet("/api/weshop/goods/getWareStorages", {
2155 - data: { storageNos: pkno_str, wareIds: encodeURIComponent(th.data.sele_g.erpwareid), storeId: os.stoid, pageSize: 2000 } 2180 + data: sto_rq
2156 }) 2181 })
2157 }).then(res => { 2182 }).then(res => {
2158 2183
2159 wx.hideLoading(); 2184 wx.hideLoading();
2160 if (res.data.code == 0) { 2185 if (res.data.code == 0) {
  2186 +
2161 if (res.data.data.pageData && res.data.data.pageData.length > 0) { 2187 if (res.data.data.pageData && res.data.data.pageData.length > 0) {
2162 - var plist = res.data.data.pageData; 2188 +
2163 var def_pick_store = th.data.def_pick_store; 2189 var def_pick_store = th.data.def_pick_store;
2164 - //以原来的数组为外循环,保证距离的顺序  
2165 - for (var kk in o_plist) {  
2166 - for (var ii in plist) {  
2167 - //线下的门店小心  
2168 - var n_item = plist[ii];  
2169 - if (n_item.StorageNo == o_plist[kk].pickup_no) {  
2170 -  
2171 - //拿到锁库的数量  
2172 - var lock_num = th.find_lock_num(o_plist[kk].pickup_id, lock);  
2173 - //可出库数大于预出库库存的数量,可以判断为有库存  
2174 - if (n_item.CanOutQty > lock_num) {  
2175 - o_plist[kk].CanOutQty = n_item.CanOutQty - lock_num;  
2176 - new_list.push(o_plist[kk]);  
2177 - //--如果找到默认门店,同时也应该判断配送方式对不对--  
2178 - if (th.data.fir_def_store && n_item.StorageNo == th.data.fir_def_store.pickup_no && (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || th.data.def_pick_store.distr_type == g_distr_type)) {  
2179 - th.data.fir_def_store.CanOutQty = n_item.CanOutQty - lock_num;  
2180 - if (def_pick_store.pickup_id == th.data.fir_def_store.pickup_id)  
2181 - th.setData({ def_pick_store: th.data.fir_def_store })  
2182 - is_find_def_store = 1; 2190 + var plist = res.data.data.pageData;
  2191 + if (th.data.sales_rules == 3) {
  2192 + var lock_num = 0;
  2193 + var Qty = 0;
  2194 + //-- 计算锁住的库存 --
  2195 + for (var i in lock) lock_num += lock[i].outQty;
  2196 + Qty = plist[0].CanOutQty - lock_num;
  2197 +
  2198 + if (Qty > 0) {
  2199 + for (var kk in o_plist) {
  2200 + o_plist[kk].CanOutQty = Qty;
  2201 + new_list.push(o_plist[kk]);
  2202 + }
  2203 + if (th.data.fir_def_store &&
  2204 + (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || (th.data.def_pick_store && th.data.def_pick_store.distr_type == g_distr_type))) {
  2205 + th.data.fir_def_store.Qty=Qty;
  2206 + if (def_pick_store && def_pick_store.pickup_id == th.data.fir_def_store.pickup_id)
  2207 + th.setData({
  2208 + def_pick_store: th.data.fir_def_store
  2209 + })
  2210 + is_find_def_store = 1;
  2211 + }
  2212 +
  2213 + } else {
  2214 + th.setData({
  2215 + all_sto: null,
  2216 + only_pk: null,
  2217 + def_pickpu_list: null
  2218 + });
  2219 + return false;
  2220 + }
  2221 +
  2222 + } else {
  2223 +
  2224 +
  2225 + //以原来的数组为外循环,保证距离的顺序
  2226 + for (var kk in o_plist) {
  2227 + for (var ii in plist) {
  2228 + //线下的门店小心
  2229 + var n_item = plist[ii];
  2230 + if (n_item.StorageNo == o_plist[kk].pickup_no) {
  2231 +
  2232 + //拿到锁库的数量
  2233 + var lock_num = th.find_lock_num(o_plist[kk].pickup_id, lock);
  2234 + //可出库数大于预出库库存的数量,可以判断为有库存
  2235 + if (n_item.CanOutQty > lock_num) {
  2236 + o_plist[kk].CanOutQty = n_item.CanOutQty - lock_num;
  2237 + new_list.push(o_plist[kk]);
  2238 + //--如果找到默认门店,同时也应该判断配送方式对不对--
  2239 + if (th.data.fir_def_store && n_item.StorageNo == th.data.fir_def_store.pickup_no && (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || th.data.def_pick_store.distr_type == g_distr_type)) {
  2240 + th.data.fir_def_store.CanOutQty = n_item.CanOutQty - lock_num;
  2241 + if (def_pick_store && def_pick_store.pickup_id == th.data.fir_def_store.pickup_id)
  2242 + th.setData({
  2243 + def_pick_store: th.data.fir_def_store
  2244 + })
  2245 + is_find_def_store = 1;
  2246 + }
2183 } 2247 }
  2248 + break;
2184 } 2249 }
2185 - break;  
2186 } 2250 }
2187 } 2251 }
  2252 +
2188 } 2253 }
2189 2254
2190 //数据组装下 2255 //数据组装下
2191 - var em = {}; em.data = {}; em.data.data = {}; 2256 + var em = {};
  2257 + em.data = {};
  2258 + em.data.data = {};
2192 em.data.data.total = new_list.length; 2259 em.data.data.total = new_list.length;
2193 em.data.data.pageData = new_list; 2260 em.data.data.pageData = new_list;
2194 2261
  2262 +
2195 //--如果找到默认门店,同时也应该判断配送方式对不对-- 2263 //--如果找到默认门店,同时也应该判断配送方式对不对--
2196 - if (th.data.fir_def_store && !is_find_def_store && th.data.fir_def_store.pickup_id && (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || th.data.def_pick_store.distr_type == g_distr_type)) { 2264 + if (th.data.fir_def_store && !is_find_def_store && th.data.fir_def_store.pickup_id &&
  2265 + (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || th.data.def_pick_store.distr_type == g_distr_type)) {
2197 th.data.fir_def_store.CanOutQty = 0; 2266 th.data.fir_def_store.CanOutQty = 0;
2198 //--当选择的门店是客户默认的门店的时候-- 2267 //--当选择的门店是客户默认的门店的时候--
2199 if (th.data.def_pick_store && th.data.fir_def_store.pickup_id == th.data.def_pick_store.pickup_id) { 2268 if (th.data.def_pick_store && th.data.fir_def_store.pickup_id == th.data.def_pick_store.pickup_id) {
2200 - th.setData({ def_pick_store: th.data.fir_def_store }); 2269 + th.setData({
  2270 + def_pick_store: th.data.fir_def_store
  2271 + });
2201 em.data.data.pageData.unshift(th.data.def_pick_store); 2272 em.data.data.pageData.unshift(th.data.def_pick_store);
2202 } else { 2273 } else {
2203 em.data.data.pageData.splice(1, 0, th.data.fir_def_store); 2274 em.data.data.pageData.splice(1, 0, th.data.fir_def_store);
2204 } 2275 }
2205 } 2276 }
2206 2277
  2278 + for (let j = 0; j < em.data.data.pageData.length; j++) {
  2279 + var iu = em.data.data.pageData[j];
  2280 + if (iu.CanOutQty <= 0) iu.is_no_qyt = 1;
  2281 +
  2282 + }
  2283 +
2207 //---把数组组装进去--- 2284 //---把数组组装进去---
2208 th.deal_pickup(em); 2285 th.deal_pickup(em);
  2286 +
2209 } else { 2287 } else {
2210 - th.setData({ def_pick_store: null, all_sto: null, only_pk: null, def_pickpu_list: null }) 2288 + th.setData({
  2289 + all_sto: null,
  2290 + only_pk: null,
  2291 + def_pickpu_list: null
  2292 + })
2211 } 2293 }
  2294 +
2212 } else { 2295 } else {
2213 - th.setData({ def_pick_store: null, all_sto: null, only_pk: null, def_pickpu_list: null }) 2296 + th.setData({
  2297 + all_sto: null,
  2298 + only_pk: null,
  2299 + def_pickpu_list: null
  2300 + })
2214 } 2301 }
2215 }) 2302 })
2216 }, 2303 },
2217 2304
  2305 +
  2306 +
2218 find_lock_num(pick_id, lock) { 2307 find_lock_num(pick_id, lock) {
2219 var lock_num = 0; 2308 var lock_num = 0;
2220 if (!lock) return 0; 2309 if (!lock) return 0;
packageE/pages/cart/cart2/cart2.js
@@ -4000,8 +4000,25 @@ Page({ @@ -4000,8 +4000,25 @@ Page({
4000 } 4000 }
4001 4001
4002 4002
  4003 + var mo_num=getApp().get_limit_qty(th.data.bn_goods);
  4004 + var steep=getApp().get_limit_qty(th.data.bn_goods,0,1);
  4005 +
  4006 + if ([0,3,5,7,10].indexOf(goods.prom_type)>=-1){
  4007 + if(mo_num>goods.goods_num){
  4008 + getApp().confirmBox(goods.goods_name + "的未到达起订数量");
  4009 + th.data.is_summit_ing = 0;
  4010 + return false;
  4011 + }
  4012 + if(steep>1 && (goods.goods_num-mo_num)%steep!=0 ){
  4013 + getApp().confirmBox(goods.goods_name + "的购买的数量不是起订量的倍数");
  4014 + th.data.is_summit_ing = 0;
  4015 + return false;
  4016 + }
  4017 + }
  4018 +
4003 //如果不立即购买或者秒杀,如果是线下库存购买的时候 4019 //如果不立即购买或者秒杀,如果是线下库存购买的时候
4004 - if (goods.prom_type != 1 && goods.prom_type != 6 && goods.prom_type != 2 && th.data.sales_rules >= 2 && !th.data.bn_goods.whsle_id) { 4020 + if (goods.prom_type != 1 && goods.prom_type != 6 && goods.prom_type != 2
  4021 + && th.data.sales_rules >= 2 && !th.data.bn_goods.whsle_id && !getApp().is_virtual(th.data.bn_goods)) {
4005 var isok = 1; 4022 var isok = 1;
4006 await th.check_store_num(goods.goods_id, th.data.bn_pick, gg.goods_num, function (res) { 4023 await th.check_store_num(goods.goods_id, th.data.bn_pick, gg.goods_num, function (res) {
4007 isok = res; 4024 isok = res;
@@ -4124,7 +4141,6 @@ Page({ @@ -4124,7 +4141,6 @@ Page({
4124 4141
4125 var order_prom_list_cart = th.data.order_prom_list_cart; 4142 var order_prom_list_cart = th.data.order_prom_list_cart;
4126 4143
4127 -  
4128 //--组装推送数据-- 4144 //--组装推送数据--
4129 for (var i = 0; i < order_prom_list_cart.length; i++) { 4145 for (var i = 0; i < order_prom_list_cart.length; i++) {
4130 var t_item = order_prom_list_cart[i]; 4146 var t_item = order_prom_list_cart[i];
@@ -4347,8 +4363,26 @@ Page({ @@ -4347,8 +4363,26 @@ Page({
4347 check_map[txt] = 1; 4363 check_map[txt] = 1;
4348 } 4364 }
4349 4365
4350 - //如果不立即购买或者秒杀,如果是线下库存购买的时候  
4351 - if (goods.prom_type == 0 && th.data.sales_rules >= 2) { 4366 + goods.prom_type=parseInt(goods.prom_type+'');
  4367 + var mo_num=getApp().get_limit_qty(g_item);
  4368 + var steep=getApp().get_limit_qty(g_item,0,1);
  4369 +
  4370 + if ([0,3,5,7,10].indexOf(goods.prom_type)>=-1){
  4371 + if(mo_num>goods.goods_num){
  4372 + getApp().confirmBox(goods.goods_name + "的未到达起订数量");
  4373 + th.data.is_summit_ing = 0;
  4374 + return false;
  4375 + }
  4376 + if(steep>1 && (goods.goods_num-mo_num)%steep!=0 ){
  4377 + getApp().confirmBox(goods.goods_name + "的购买的数量不是起订量的倍数");
  4378 + th.data.is_summit_ing = 0;
  4379 + return false;
  4380 + }
  4381 +
  4382 + }
  4383 +
  4384 + //如果不立即购买或者秒杀,如果是线下库存购买的时候
  4385 + if ([0,3,5,7,10].indexOf(goods.prom_type)>=-1 && th.data.sales_rules >= 2 && !g_item.whsle_id && !getApp().is_virtual(g_item) ) {
4352 var isok = 1; 4386 var isok = 1;
4353 await th.check_store_num(goods.goods_id, t_item.pickup_id, goods.goods_num, function (res) { 4387 await th.check_store_num(goods.goods_id, t_item.pickup_id, goods.goods_num, function (res) {
4354 isok = res; 4388 isok = res;
pages/activity/pind_list/pind_list.js
@@ -163,6 +163,39 @@ Page({ @@ -163,6 +163,39 @@ Page({
163 if (plist.length <= 0) { 163 if (plist.length <= 0) {
164 getApp().showWarning("没有更多数据"); 164 getApp().showWarning("没有更多数据");
165 th.data.ismore = 0; 165 th.data.ismore = 0;
  166 +
  167 +
  168 +
  169 + //没有数据切换
  170 + if (e.data.currentPage == 1 && this.data.type == 1) {
  171 +
  172 +
  173 + e.data.currentPage=1;
  174 + i = "/api/weshop/teamlist/pageteam/0?page=" + e.data.currentPage;
  175 + await getApp().request.promiseGet(i, {
  176 + isShowLoading: 0,
  177 + data: {
  178 + store_id: os.stoid,
  179 + is_end: 0,
  180 + is_show: 1,
  181 + user_id:getApp().globalData.user_id,
  182 + }
  183 + }).then(res => {
  184 + plist = res.data.data.pageData;
  185 + });
  186 +
  187 + if(plist){
  188 + setTimeout(function () {
  189 + th.data.ismore = 1;
  190 + th.setData({
  191 + type: 0
  192 + });
  193 + th.requestSalelist();
  194 + }, 1000);
  195 + }
  196 +
  197 + }
  198 +
166 } 199 }
167 //--循环读取接口--- 200 //--循环读取接口---
168 for (var i = 0; i < plist.length; i++) { 201 for (var i = 0; i < plist.length; i++) {
pages/cart/cart/cart.js
@@ -1612,9 +1612,16 @@ Page({ @@ -1612,9 +1612,16 @@ Page({
1612 } 1612 }
1613 } 1613 }
1614 1614
  1615 + var add_num=1;
  1616 + var mo_num=getApp().get_limit_qty(a);
  1617 + var steep=getApp().get_limit_qty(a,0,1);
  1618 + if(steep>1){
  1619 + add_num=steep;
  1620 + }
  1621 +
1615 1622
1616 var e = { 1623 var e = {
1617 - goods_num: a.goods_num + 1, 1624 + goods_num: a.goods_num + add_num,
1618 id: a.id, 1625 id: a.id,
1619 goods_id: a.goods_id, 1626 goods_id: a.goods_id,
1620 store_id: oo.stoid 1627 store_id: oo.stoid
@@ -1640,16 +1647,26 @@ Page({ @@ -1640,16 +1647,26 @@ Page({
1640 } 1647 }
1641 1648
1642 1649
  1650 + var add_num=1;
  1651 + var mo_num=getApp().get_limit_qty(a);
  1652 + var steep=getApp().get_limit_qty(a,0,1);
  1653 + if(steep>1){
  1654 + add_num=steep;
  1655 + }
1643 1656
1644 - if (1 != a.goods_num) {  
1645 - var e = {  
1646 - goods_num: a.goods_num - 1,  
1647 - id: a.id,  
1648 - goods_id: a.goods_id,  
1649 - store_id: oo.stoid  
1650 - };  
1651 - this.postCardList(e, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems); 1657 + var e = {
  1658 + goods_num: a.goods_num - add_num,
  1659 + id: a.id,
  1660 + goods_id: a.goods_id,
  1661 + store_id: oo.stoid
  1662 + };
  1663 +
  1664 + if(e.goods_num<=0){
  1665 + this.data.up_dating = 0;
  1666 + return false;
1652 } 1667 }
  1668 + this.postCardList(e, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems);
  1669 +
1653 }, 1670 },
1654 1671
1655 1672
@@ -1668,7 +1685,10 @@ Page({ @@ -1668,7 +1685,10 @@ Page({
1668 var e = a; 1685 var e = a;
1669 var th = this; 1686 var th = this;
1670 1687
1671 - if (a = isNaN(t.detail.value) || t.detail.value < 1 ? 1 : parseInt(t.detail.value)) { 1688 +
  1689 + var mo_num=getApp().get_limit_qty(e);
  1690 +
  1691 + if (a = isNaN(t.detail.value) || t.detail.value < mo_num ? mo_num : parseInt(t.detail.value)) {
1672 var s = { 1692 var s = {
1673 goods_num: a, 1693 goods_num: a,
1674 goods_id: e.service_id, 1694 goods_id: e.service_id,
@@ -1754,6 +1774,33 @@ Page({ @@ -1754,6 +1774,33 @@ Page({
1754 }, 1774 },
1755 1775
1756 1776
  1777 + click_set_limit(gd_info,pitems,item){
  1778 + var th=this;
  1779 + var mo_num=getApp().get_limit_qty(gd_info);
  1780 + var steep=getApp().get_limit_qty(gd_info,0,1);
  1781 + if(gd_info.is_integral_normal || gd_info.is_pd_normal || [0,3,5,7,10].indexOf(gd_info.prom_type) > -1){
  1782 +
  1783 + var ue = {
  1784 + goods_num: gd_info.goods_num,store_id: oo.stoid,
  1785 + id: gd_info.id,goods_id: gd_info.goods_id
  1786 + };
  1787 + var up_num=0;
  1788 + if(mo_num>gd_info.goods_num){
  1789 + up_num=mo_num;
  1790 + }
  1791 + if(gd_info.goods_num>mo_num && (gd_info.goods_num-mo_num)%steep!=0 && steep>1){
  1792 + up_num=mo_num+ parseInt((gd_info.goods_num-mo_num)/steep)*steep+steep;
  1793 + }
  1794 + if(up_num){
  1795 + ue.goods_num=up_num;
  1796 + th.update_cart(ue, pitems, item);
  1797 + var txt1 = "requestData[" + pitems + "].goods[" + item + "].goods_num";
  1798 + th.setData({[txt1]:up_num })
  1799 + }
  1800 + }
  1801 + },
  1802 +
  1803 +
1757 //---------------全选,全选的时候要判断是否门店的匹配方式一致-------------- 1804 //---------------全选,全选的时候要判断是否门店的匹配方式一致--------------
1758 checkAll: async function () { 1805 checkAll: async function () {
1759 var e = this, 1806 var e = this,
@@ -1792,11 +1839,16 @@ Page({ @@ -1792,11 +1839,16 @@ Page({
1792 [txt]: 0, 1839 [txt]: 0,
1793 }); 1840 });
1794 } 1841 }
  1842 +
1795 var fir = 0; 1843 var fir = 0;
1796 for (var j = 0; j < item.length; j++) { 1844 for (var j = 0; j < item.length; j++) {
1797 if (item[j].is_gift) continue; 1845 if (item[j].is_gift) continue;
1798 -  
1799 var obj = JSON.parse(JSON.stringify(item[j])); 1846 var obj = JSON.parse(JSON.stringify(item[j]));
  1847 + //-- 判断起购数量 --
  1848 + if(!e.data.checkAllToggle){
  1849 + th.click_set_limit(obj,i,j);
  1850 + }
  1851 +
1800 //计算之前先移除组合购的计算 1852 //计算之前先移除组合购的计算
1801 if (obj.prom_type == 7) 1853 if (obj.prom_type == 7)
1802 zh_calc.remove_zhprom(dda, i, obj); 1854 zh_calc.remove_zhprom(dda, i, obj);
@@ -1884,7 +1936,7 @@ Page({ @@ -1884,7 +1936,7 @@ Page({
1884 1936
1885 // if (!e.data.checkAllToggle) { 1937 // if (!e.data.checkAllToggle) {
1886 //多门店优惠促销次数控制 1938 //多门店优惠促销次数控制
1887 - if(dda[i].pro_off){ 1939 + if(dda[i].pro_off || e.data.checkAllToggle){
1888 var txt = "requestData[" + i + "].selected"; 1940 var txt = "requestData[" + i + "].selected";
1889 e.setData({ 1941 e.setData({
1890 [txt]: 0, 1942 [txt]: 0,
@@ -2041,9 +2093,11 @@ Page({ @@ -2041,9 +2093,11 @@ Page({
2041 for (var i = 0; i < item.length; i++) { 2093 for (var i = 0; i < item.length; i++) {
2042 let pro_off1=false 2094 let pro_off1=false
2043 var txt = "requestData[" + pitems + "].goods[" + i + "].selected"; 2095 var txt = "requestData[" + pitems + "].goods[" + i + "].selected";
2044 -  
2045 var gd_info = item[i]; 2096 var gd_info = item[i];
2046 - if (th.data.sales_rules >= 2 && !gd_info.whsle_id && [1, 2, 4, 6, 8, 9].indexOf(gd_info.prom_type) == -1 && !gd_info.selected) { 2097 +
  2098 + if(!sele) th.click_set_limit(gd_info,pitems,i)
  2099 +
  2100 + if (!getApp().is_virtual(gd_info) && th.data.sales_rules >= 2 && !gd_info.whsle_id && [1, 2, 4, 6, 8, 9].indexOf(gd_info.prom_type) == -1 && !gd_info.selected) {
2047 var ob = {}; 2101 var ob = {};
2048 await th.check_down_line_next(gd_info, pitems, i, gd_info.erpwareid, function (res) { 2102 await th.check_down_line_next(gd_info, pitems, i, gd_info.erpwareid, function (res) {
2049 ob = res; 2103 ob = res;
@@ -2227,45 +2281,56 @@ Page({ @@ -2227,45 +2281,56 @@ Page({
2227 var gd_info = a; 2281 var gd_info = a;
2228 2282
2229 var erpwareid = gd_info.erpwareid; 2283 var erpwareid = gd_info.erpwareid;
2230 - if (th.data.sales_rules >= 2 && !gd_info.whsle_id && [1, 2, 4, 6, 8, 9].indexOf(gd_info.prom_type) == -1 && !a.selected) {  
2231 - var ob = {};  
2232 - await th.check_down_line_next(gd_info, pitems, item, erpwareid, function (res) {  
2233 - ob = res;  
2234 - });  
2235 2284
2236 - if (ob.code == -1) {  
2237 -  
2238 - wx.showToast({  
2239 - title: '购买数量超出商品库存',  
2240 - icon: 'none',  
2241 - }); 2285 + //-- 如果是选中的时候 --
  2286 + if(!a.selected){
2242 2287
2243 - return false;  
2244 - } else {  
2245 - if (th.data.sales_rules == 3) {  
2246 - var goods_id = gd_info.goods_id;  
2247 - var num = 0; 2288 + //-- 专门来设置商品订购数量 --
  2289 + th.click_set_limit(gd_info,pitems,item)
  2290 + if (!getApp().is_virtual(gd_info) && th.data.sales_rules >= 2
  2291 + && !gd_info.whsle_id && [1, 2, 4, 6, 8, 9].indexOf(gd_info.prom_type) == -1 ) {
2248 2292
2249 - for (let i = 0; i < th.data.requestData.length; i++) {  
2250 - if (pitems == i) continue;  
2251 - var it = th.data.requestData[i].goods.find((e) => {  
2252 - return e.goods_id == goods_id;  
2253 - })  
2254 - if (it && it.selected) num += it.goods_num  
2255 - } 2293 + var ob = {};
  2294 + await th.check_down_line_next(gd_info, pitems, item, erpwareid, function (res) {
  2295 + ob = res;
  2296 + });
  2297 + if (ob.code == -1) {
2256 2298
2257 - if (num > ob.CanOutQty) {  
2258 wx.showToast({ 2299 wx.showToast({
2259 title: '购买数量超出商品库存', 2300 title: '购买数量超出商品库存',
2260 icon: 'none', 2301 icon: 'none',
2261 }); 2302 });
2262 2303
2263 return false; 2304 return false;
  2305 + } else {
  2306 + if (th.data.sales_rules == 3) {
  2307 + var goods_id = gd_info.goods_id;
  2308 + var num = 0;
  2309 +
  2310 + for (let i = 0; i < th.data.requestData.length; i++) {
  2311 + if (pitems == i) continue;
  2312 + var it = th.data.requestData[i].goods.find((e) => {
  2313 + return e.goods_id == goods_id;
  2314 + })
  2315 + if (it && it.selected) num += it.goods_num
  2316 + }
  2317 +
  2318 + if (num > ob.CanOutQty) {
  2319 + wx.showToast({
  2320 + title: '购买数量超出商品库存',
  2321 + icon: 'none',
  2322 + });
  2323 +
  2324 + return false;
  2325 + }
  2326 + }
2264 } 2327 }
2265 - } 2328 +
2266 } 2329 }
2267 2330
2268 } 2331 }
  2332 +
  2333 +
2269 let pro_off=false 2334 let pro_off=false
2270 //判断多店优惠促销次数控制 2335 //判断多店优惠促销次数控制
2271 if (th.data.requestData.length>1) { 2336 if (th.data.requestData.length>1) {
@@ -2536,8 +2601,34 @@ Page({ @@ -2536,8 +2601,34 @@ Page({
2536 user_id = getApp().globalData.user_id; 2601 user_id = getApp().globalData.user_id;
2537 2602
2538 function normal_check(store_count, goodsinfo, wareIds) { 2603 function normal_check(store_count, goodsinfo, wareIds) {
  2604 +
  2605 +
  2606 + // getApp().my_warnning('购买数量超出商品库存', 0, th);
  2607 + var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
  2608 + //-- 要判断是不是起订量不购 --
  2609 + if([0,3,5,7,10].indexOf(goodsinfo.prom_type)>-1){
  2610 + var mo_num=getApp().get_limit_qty(goodsinfo);
  2611 + var steep=getApp().get_limit_qty(goodsinfo,0,1);
  2612 + if(mo_num>1 && t.goods_num<mo_num){
  2613 + wx.showToast({
  2614 + title: '购买数量小于商品的起订量',
  2615 + icon: 'none',
  2616 + });
  2617 + t.goods_num =0;
  2618 + }
  2619 + if(steep>1 && t.goods_num>mo_num && (t.goods_num-mo_num)%steep!=0 ){
  2620 +
  2621 + wx.showToast({
  2622 + title: '购买数量必须是起订量的倍数',
  2623 + icon: 'none',
  2624 + });
  2625 + t.goods_num =mo_num+parseInt((t.goods_num-mo_num)/steep+'')*steep+steep;
  2626 + }
  2627 + }
  2628 +
  2629 +
2539 //--- 看一下是不是线下库存 --- 2630 //--- 看一下是不是线下库存 ---
2540 - if (th.data.sales_rules >= 2 && !goodsinfo.whsle_id) { 2631 + if (!getApp().is_virtual(goodsinfo) && th.data.sales_rules >= 2 && !goodsinfo.whsle_id) {
2541 th.check_down_line(t, pitem, item, wareIds); 2632 th.check_down_line(t, pitem, item, wareIds);
2542 } else { 2633 } else {
2543 if (t.goods_num > store_count) { 2634 if (t.goods_num > store_count) {
@@ -2545,8 +2636,6 @@ Page({ @@ -2545,8 +2636,6 @@ Page({
2545 title: '购买数量超出商品库存', 2636 title: '购买数量超出商品库存',
2546 icon: 'none', 2637 icon: 'none',
2547 }); 2638 });
2548 - // getApp().my_warnning('购买数量超出商品库存', 0, th);  
2549 - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";  
2550 e.setData({ 2639 e.setData({
2551 [txt]: store_count 2640 [txt]: store_count
2552 }); 2641 });
@@ -2620,7 +2709,29 @@ Page({ @@ -2620,7 +2709,29 @@ Page({
2620 }); 2709 });
2621 e.doCheckAll(); 2710 e.doCheckAll();
2622 2711
2623 - t.goods_num = cbuy > 0 ? cbuy : limit, 2712 + t.goods_num = cbuy > 0 ? cbuy : limit;
  2713 +
  2714 + if([0,3,5,7,10].indexOf(goodsinfo.prom_type)>-1){
  2715 + var mo_num=getApp().get_limit_qty(goodsinfo);
  2716 + var steep=getApp().get_limit_qty(goodsinfo,0,1);
  2717 + if(mo_num>1 && t.goods_num<mo_num){
  2718 + wx.showToast({
  2719 + title: '购买数量小于商品的起订量',
  2720 + icon: 'none',
  2721 + });
  2722 + t.goods_num=0;
  2723 +
  2724 + }
  2725 + if(steep>1 && t.goods_num>mo_num && (t.goods_num-mo_num)%steep!=0 ){
  2726 +
  2727 + wx.showToast({
  2728 + title: '购买数量必须是起订量的倍数',
  2729 + icon: 'none',
  2730 + });
  2731 +
  2732 + t.goods_num=mo_num+parseInt((t.goods_num-mo_num)/steep+'')*steep
  2733 + }
  2734 + }
2624 // t.goods_num = cbuy > 0 ? cbuy : 0, 2735 // t.goods_num = cbuy > 0 ? cbuy : 0,
2625 e.update_cart(t, pitem, item); 2736 e.update_cart(t, pitem, item);
2626 return false; 2737 return false;
@@ -3370,10 +3481,42 @@ Page({ @@ -3370,10 +3481,42 @@ Page({
3370 } 3481 }
3371 glist += i_arr[j].goods_id + ","; 3482 glist += i_arr[j].goods_id + ",";
3372 ab = 1; 3483 ab = 1;
  3484 +
  3485 + //判断商品的起订数量
  3486 + var mo_num=getApp().get_limit_qty(i_arr[j]);
  3487 + var steep=getApp().get_limit_qty(i_arr[j],0,1);
  3488 + var py_type= parseInt(i_arr[j].prom_type+'');
  3489 +
  3490 + if([0,3,5,7,10].indexOf(py_type)>-1){
  3491 +
  3492 + if(mo_num>i_arr[j].goods_num){
  3493 + getApp().confirmBox(i_arr[j].goods_name + "的未到达起订数量");
  3494 + wx.hideLoading();
  3495 + return false;
  3496 + }
  3497 + if(steep>1 && (i_arr[j].goods_num-mo_num)%steep!=0 ){
  3498 + getApp().confirmBox(i_arr[j].goods_name + "的购买的数量不是起订量的倍数");
  3499 + var num=mo_num+ parseInt((i_arr[j].goods_num-mo_num)/steep)*steep+steep;
  3500 + var e = {
  3501 + goods_num: num,
  3502 + id: i_arr[j].id,
  3503 + goods_id: i_arr[j].goods_id,
  3504 + store_id: oo.stoid
  3505 + };
  3506 +
  3507 + th.postCardList(e, j, i);
  3508 +
  3509 + wx.hideLoading();
  3510 + return false;
  3511 + }
  3512 +
  3513 + }
  3514 +
  3515 +
3373 3516
3374 //--普通商品,如果有开启线下库存的功能,要调用线下库存进行计算,赠品不要进行调用线下库存--- 3517 //--普通商品,如果有开启线下库存的功能,要调用线下库存进行计算,赠品不要进行调用线下库存---
3375 - 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 ||  
3376 - i_arr[j].need_downlow_num) && th.data.sales_rules >= 2 && i_arr[j].is_gift != 1 && !i_arr[j].whsle_id) { 3518 + 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 ||
  3519 + i_arr[j].need_downlow_num) && !getApp().is_virtual(i_arr[j]) && th.data.sales_rules >= 2 && i_arr[j].is_gift != 1 && !i_arr[j].whsle_id) {
3377 //--获取商品的线下商品ID-- 3520 //--获取商品的线下商品ID--
3378 3521
3379 var gd = null; 3522 var gd = null;
pages/cart/cart/cart.wxml
@@ -42,6 +42,7 @@ @@ -42,6 +42,7 @@
42 <!-- 门店底下的商品 --> 42 <!-- 门店底下的商品 -->
43 <view class="store"> 43 <view class="store">
44 <view class="shmd_m"> 44 <view class="shmd_m">
  45 +
45 <!-- 门店 --> 46 <!-- 门店 -->
46 <icon wx:if="{{checkAllToggle||item.selected}}" class="order-raido flex-center" bindtap="check_th_all_item" data-pitems="{{pidx}}" 47 <icon wx:if="{{checkAllToggle||item.selected}}" class="order-raido flex-center" bindtap="check_th_all_item" data-pitems="{{pidx}}"
47 color="red" size="20" type="success"></icon> 48 color="red" size="20" type="success"></icon>
pages/goods/goodsInfo/buy_com_pop.wxml
@@ -13,10 +13,14 @@ @@ -13,10 +13,14 @@
13 <view class="flex"> 13 <view class="flex">
14 <view class="spec-goods-stock">已售:{{sele_g.sales_sum}}</view> 14 <view class="spec-goods-stock">已售:{{sele_g.sales_sum}}</view>
15 <block wx:if="{{sales_rules>=2}}"> 15 <block wx:if="{{sales_rules>=2}}">
16 - <view class="spec-goods-stock" wx:if="{{def_pick_store && def_pick_store.CanOutQty}}">  
17 - 可售:{{def_pick_store.CanOutQty}}  
18 - </view>  
19 - <view class="spec-goods-stock" wx:else>可售:0</view> 16 +
  17 + <block wx:if="{{!filters.is_virtual_gd(sele_g.is_virtual)}}">
  18 + <view class="spec-goods-stock" wx:if="{{def_pick_store && def_pick_store.CanOutQty}}">
  19 + 可售:{{def_pick_store.CanOutQty}}
  20 + </view>
  21 + <view class="spec-goods-stock" wx:else>可售:0</view>
  22 + </block>
  23 +
20 </block> 24 </block>
21 <block wx:else> 25 <block wx:else>
22 <view class="spec-goods-stock">可售:{{sele_g.store_count}}</view> 26 <view class="spec-goods-stock">可售:{{sele_g.store_count}}</view>
@@ -29,8 +33,8 @@ @@ -29,8 +33,8 @@
29 <!-- 选择门店模块 --> 33 <!-- 选择门店模块 -->
30 <view class="flex-space-between address ai_end xc-width "> 34 <view class="flex-space-between address ai_end xc-width ">
31 35
32 - <view class="flex ai_end" wx:if="{{def_pick_store && def_pick_store.pickup_name}}">  
33 - <text class="fs30 xc-black3 shop_name">{{def_pick_store.pickup_name}}</text> 36 + <view class="flex" wx:if="{{def_pick_store && def_pick_store.pickup_name}}">
  37 + <text class="fs30 xc-black3 shop_name {{def_pick_store.distance!=null?'max':''}} ">{{def_pick_store.pickup_name}}</text>
34 <view class="distance fs24 xc-ash" wx:if="{{def_pick_store.distance!=null}}"> 38 <view class="distance fs24 xc-ash" wx:if="{{def_pick_store.distance!=null}}">
35 距离:{{def_pick_store.distance > 1000 ? filters.toFix(def_pick_store.distance / 1000, 2) + "km" : filters.toFix(def_pick_store.distance, 0) + "m"}} 39 距离:{{def_pick_store.distance > 1000 ? filters.toFix(def_pick_store.distance / 1000, 2) + "km" : filters.toFix(def_pick_store.distance, 0) + "m"}}
36 40
@@ -53,7 +57,7 @@ @@ -53,7 +57,7 @@
53 <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> 57 <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view>
54 <block wx:else> 58 <block wx:else>
55 <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> 59 <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view>
56 - <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2}}"> 60 + <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules>=2 && !filters.is_virtual_gd(sele_g.is_virtual) }}">
57 (库存不足) 61 (库存不足)
58 </view> 62 </view>
59 </block> 63 </block>
@@ -136,7 +140,7 @@ @@ -136,7 +140,7 @@
136 </view> 140 </view>
137 </block> 141 </block>
138 <block wx:else> 142 <block wx:else>
139 - <block wx:if="{{sales_rules>=2 && !sele_g.whsle_id}}"> 143 + <block wx:if="{{sales_rules>=2 && !sele_g.whsle_id && !filters.is_virtual_gd(sele_g.is_virtual) }}">
140 <view wx:if="{{!def_pick_store.CanOutQty}}" class="spec-cart-btn fs32" data-action="add" 144 <view wx:if="{{!def_pick_store.CanOutQty}}" class="spec-cart-btn fs32" data-action="add"
141 style="background-color: #dcdcdc;color: #999">库存不足 145 style="background-color: #dcdcdc;color: #999">库存不足
142 </view> 146 </view>
@@ -154,7 +158,7 @@ @@ -154,7 +158,7 @@
154 158
155 159
156 160
157 - <block wx:elif="{{data.store_count<=0}}"> 161 + <block wx:elif="{{data.store_count<(mo_num?mo_num:1)}}">
158 <view class="spec-cart-btn fs32" data-action="add" 162 <view class="spec-cart-btn fs32" data-action="add"
159 style="background-color: #dcdcdc;color: #999">库存不足 163 style="background-color: #dcdcdc;color: #999">库存不足
160 </view> 164 </view>
pages/goods/goodsInfo/buy_integral.wxml
@@ -26,9 +26,9 @@ @@ -26,9 +26,9 @@
26 <!-- 选择门店模块 --> 26 <!-- 选择门店模块 -->
27 <view class="flex-space-between address ai_end xc-width "> 27 <view class="flex-space-between address ai_end xc-width ">
28 28
29 - <view class="flex ai_end" wx:if="{{def_pick_store && def_pick_store.pickup_name}}">  
30 - <text class="fs30 xc-black3 shop_name">{{def_pick_store.pickup_name}}</text>  
31 - <view class="distance fs24 xc-ash"wx:if="{{def_pick_store.distance!=null}}"> 29 + <view class="flex" wx:if="{{def_pick_store && def_pick_store.pickup_name}}">
  30 + <text class="fs30 xc-black3 shop_name bold {{def_pick_store.distance!=null?'max':''}} ">{{def_pick_store.pickup_name}}</text>
  31 + <view class="distance fs24 xc-ash" wx:if="{{def_pick_store.distance!=null}}">
32 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}} 32 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}}
33 33
34 </view> 34 </view>
@@ -47,11 +47,11 @@ @@ -47,11 +47,11 @@
47 <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> 47 <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view>
48 <block wx:else> 48 <block wx:else>
49 <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> 49 <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view>
50 - <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}">(库存不足)</view> 50 + <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && !filters.is_virtual_gd(sele_g.is_virtual) && sales_rules>=2 && prom_type==0}}">(库存不足)</view>
51 </block> 51 </block>
52 </block> 52 </block>
53 53
54 - <view class="fs24 xc-ash-9f xc-distance-top "wx:if="{{def_pick_store && def_pick_store.fulladdress}}">地址:{{def_pick_store.fulladdress}}</view> 54 + <view class="fs24 xc-ash-9f xc-distance-top " wx:if="{{def_pick_store && def_pick_store.fulladdress}}">地址:{{def_pick_store.fulladdress}}</view>
55 55
56 56
57 <!--商品的属性项目--> 57 <!--商品的属性项目-->
pages/goods/goodsInfo/buy_pt.wxml
@@ -25,8 +25,10 @@ @@ -25,8 +25,10 @@
25 <view class="flex"> 25 <view class="flex">
26 <view class="spec-goods-stock">已售:{{sele_g.sales_sum}}</view> 26 <view class="spec-goods-stock">已售:{{sele_g.sales_sum}}</view>
27 <block wx:if="{{sales_rules>=2}}"> 27 <block wx:if="{{sales_rules>=2}}">
28 - <view class="spec-goods-stock" wx:if="{{def_pick_store && def_pick_store.CanOutQty}}">可售:{{def_pick_store.CanOutQty}}</view>  
29 - <view class="spec-goods-stock" wx:else>可售:0</view> 28 + <block wx:if="{{!filters.is_virtual_gd(sele_g.is_virtual)}}">
  29 + <view class="spec-goods-stock" wx:if="{{def_pick_store && def_pick_store.CanOutQty}}">可售:{{def_pick_store.CanOutQty}}</view>
  30 + <view class="spec-goods-stock" wx:else>可售:0</view>
  31 + </block>
30 </block> 32 </block>
31 <block wx:else><view class="spec-goods-stock">可售:{{sele_g.store_count}}</view></block> 33 <block wx:else><view class="spec-goods-stock">可售:{{sele_g.store_count}}</view></block>
32 </view> 34 </view>
@@ -47,11 +49,11 @@ @@ -47,11 +49,11 @@
47 <view style="margin-top: 20rpx"> 49 <view style="margin-top: 20rpx">
48 <view class="flex-space-between address ai_end xc-width "> 50 <view class="flex-space-between address ai_end xc-width ">
49 51
50 - <view class="flex ai_end" wx:if="{{def_pick_store && def_pick_store.pickup_name}}">  
51 - <text class="fs30 xc-black3 shop_name">{{def_pick_store.pickup_name}}</text> 52 + <view class="flex" wx:if="{{def_pick_store && def_pick_store.pickup_name}}">
  53 + <text class="fs30 xc-black3 shop_name {{def_pick_store.distance!=null?'max':''}} ">{{def_pick_store.pickup_name}}</text>
52 54
53 55
54 - <view class="distance fs24 xc-ash"wx:if="{{def_pick_store.distance!=null}}"> 56 + <view class="distance fs24 xc-ash" wx:if="{{def_pick_store.distance!=null}}">
55 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}} 57 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}}
56 58
57 </view> 59 </view>
@@ -71,7 +73,7 @@ @@ -71,7 +73,7 @@
71 <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> 73 <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view>
72 <block wx:else> 74 <block wx:else>
73 <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> 75 <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view>
74 - <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && is_normal}}">(库存不足)</view> 76 + <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && !filters.is_virtual_gd(sele_g.is_virtual) && sales_rules>=2 && is_normal}}">(库存不足)</view>
75 </block> 77 </block>
76 </block> 78 </block>
77 79
@@ -176,16 +178,32 @@ @@ -176,16 +178,32 @@
176 <block wx:else> 178 <block wx:else>
177 <block wx:if="{{!def_pick_store}}"> 179 <block wx:if="{{!def_pick_store}}">
178 <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">请先选择门店</view> 180 <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">请先选择门店</view>
179 - </block>  
180 - <block wx:else>  
181 - <block wx:if="{{data.store_count<=0}}">  
182 - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view>  
183 - </block>  
184 - <block wx:else>  
185 - <view bindtap="addCart_pt" class="spec-cart-btn spec-buy" data-action="buy">立即购买</view>  
186 - </block>  
187 -  
188 - </block> 181 + </block>
  182 +
  183 + <block wx:else>
  184 + <!-- 如果是线下库存购买的时候,且是普通商品购买的时候 -->
  185 + <block wx:if="{{sales_rules>=2 && !sele_g.whsle_id && !filters.is_virtual_gd(sele_g.is_virtual) }}">
  186 + <block wx:if="{{!def_pick_store.CanOutQty}}">
  187 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">
  188 + 库存不足
  189 + </view>
  190 + </block>
  191 + <block wx:else>
  192 + <view bindtap="addCart_pt" class="spec-cart-btn spec-buy" data-action="buy">立即购买</view>
  193 + </block>
  194 + </block>
  195 + <!-- 线上销售 -->
  196 + <block wx:else>
  197 + <block wx:if="{{sele_g.store_count<=0 && is_no_new}}">
  198 + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">
  199 + 库存不足
  200 + </view>
  201 + </block>
  202 + <block wx:else>
  203 + <view bindtap="addCart_pt" class="spec-cart-btn spec-buy" data-action="buy">立即购买</view>
  204 + </block>
  205 + </block>
  206 + </block>
189 </block> 207 </block>
190 </block> 208 </block>
191 </block> 209 </block>
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 (sales_rules >= 2 && [1, 2, 4, 6, 8, 9].indexOf(th.data.prom_type) == -1 && !th.data.sele_g.whsle_id) { 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) {
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;
@@ -1102,18 +1102,18 @@ Page({ @@ -1102,18 +1102,18 @@ Page({
1102 }); 1102 });
1103 1103
1104 1104
  1105 +
  1106 +
1105 //获取统一条形码,普通商品和优惠促销的商品 1107 //获取统一条形码,普通商品和优惠促销的商品
1106 if (ee.data.data.prom_type == 0 || ee.data.data.prom_type == 3 || ee.data.data.prom_type == 5 || ee.data.data.prom_type == 7 || ee.data.data.prom_type == 9 || ee.data.data.prom_type == 10) { 1108 if (ee.data.data.prom_type == 0 || ee.data.data.prom_type == 3 || ee.data.data.prom_type == 5 || ee.data.data.prom_type == 7 || ee.data.data.prom_type == 9 || ee.data.data.prom_type == 10) {
1107 - //默认门店要拿下门店库存  
1108 - if (that.data.sales_rules == 2 && that.data.is_newsales_rules) {  
1109 - //获取门店  
1110 - ee.get_sto();  
1111 1109
1112 - } else {  
1113 - //获取门店  
1114 - ee.get_sto();  
1115 - }  
1116 1110
  1111 + //-- 更新默认购买的数量 ---
  1112 + var mo_num=getApp().get_limit_qty(t.data.data);
  1113 + ee.setData({goodsInputNum:mo_num})
  1114 + ee.setData({mo_num:mo_num})
  1115 +
  1116 + ee.get_sto();
1117 ee.get_sku(o.stoid, t.data.data, gid); 1117 ee.get_sku(o.stoid, t.data.data, gid);
1118 ee.check_has_flash(); 1118 ee.check_has_flash();
1119 1119
@@ -1197,6 +1197,7 @@ Page({ @@ -1197,6 +1197,7 @@ Page({
1197 setTimeout(()=> { 1197 setTimeout(()=> {
1198 console.log('cccc'); 1198 console.log('cccc');
1199 console.log(th.data.prom_type); 1199 console.log(th.data.prom_type);
  1200 +
1200 },500) 1201 },500)
1201 1202
1202 1203
@@ -1208,11 +1209,8 @@ Page({ @@ -1208,11 +1209,8 @@ Page({
1208 console.log('aaaaaaaaaa'); 1209 console.log('aaaaaaaaaa');
1209 console.log(this.data.prom_type); 1210 console.log(this.data.prom_type);
1210 1211
1211 - this.data.enterAddressPage && (this.data.enterAddressPage = !1);  
1212 -  
1213 -  
1214 -  
1215 1212
  1213 + this.data.enterAddressPage && (this.data.enterAddressPage = !1);
1216 1214
1217 1215
1218 }, 1216 },
@@ -1680,7 +1678,7 @@ Page({ @@ -1680,7 +1678,7 @@ Page({
1680 newd.is_pd_normal = 1; 1678 newd.is_pd_normal = 1;
1681 1679
1682 //---如果是线下门店销售的时候--- 1680 //---如果是线下门店销售的时候---
1683 - if (th.data.sales_rules >= 2) { 1681 + if (!getApp().is_virtual(th.data.sele_g) && th.data.sales_rules >= 2) {
1684 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)
1685 //---通过接口获取门店的线下库存信息-- 1683 //---通过接口获取门店的线下库存信息--
1686 th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) { 1684 th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) {
@@ -1778,7 +1776,7 @@ Page({ @@ -1778,7 +1776,7 @@ Page({
1778 return false; 1776 return false;
1779 } else { 1777 } else {
1780 //---如果是线下门店销售的时候--- 1778 //---如果是线下门店销售的时候---
1781 - if (th.data.sales_rules >= 2) { 1779 + if (!getApp().is_virtual(th.data.sele_g) && !th.data.sele_g.whsle_id && th.data.sales_rules >= 2) {
1782 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)
1783 1781
1784 th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) { 1782 th.check_CanOutQty(th.data.sele_g, pick, function (CanOutQty) {
@@ -1837,7 +1835,7 @@ Page({ @@ -1837,7 +1835,7 @@ Page({
1837 } 1835 }
1838 1836
1839 //---如果是线下门店销售的时候--- 1837 //---如果是线下门店销售的时候---
1840 - if (th.data.sales_rules >= 2 && !th.data.sele_g.whsle_id) { 1838 + if ( !getApp().is_virtual(th.data.sele_g) && th.data.sales_rules >= 2 && !th.data.sele_g.whsle_id) {
1841 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)
1842 //---通过接口获取门店的线下库存信息-- 1840 //---通过接口获取门店的线下库存信息--
1843 // getApp().request.get("/api/weshop/goods/getWareStorages", { 1841 // getApp().request.get("/api/weshop/goods/getWareStorages", {
@@ -1942,6 +1940,9 @@ Page({ @@ -1942,6 +1940,9 @@ Page({
1942 th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 1940 th.add_cart_next(e, t, a, o, newd); //加入购物车下一步
1943 } 1941 }
1944 } 1942 }
  1943 +
  1944 +
  1945 +
1945 }) 1946 })
1946 }, 1947 },
1947 1948
@@ -2402,11 +2403,24 @@ Page({ @@ -2402,11 +2403,24 @@ Page({
2402 2403
2403 //----------增加购买数量----------- 2404 //----------增加购买数量-----------
2404 addCartNum: function (t) { 2405 addCartNum: function (t) {
2405 - this.checkCartNum(this.data.goodsInputNum + 1); 2406 +
  2407 + var add_num=1;
  2408 + var p_type=parseInt(this.data.prom_type)
  2409 + if([1,2,4,6,8,9].indexOf(p_type)==-1 || this.data.openSpecModal_inte_normal == 1 || this.data.is_normal == 1){
  2410 + add_num=getApp().get_limit_qty(this.data.sele_g,0,1);
  2411 + }
  2412 +
  2413 + this.checkCartNum(this.data.goodsInputNum + add_num);
2406 }, 2414 },
2407 //----------减少购买数量----------- 2415 //----------减少购买数量-----------
2408 subCartNum: function (t) { 2416 subCartNum: function (t) {
2409 - this.checkCartNum(this.data.goodsInputNum - 1); 2417 +
  2418 + var add_num=1;
  2419 + var p_type=parseInt(this.data.prom_type)
  2420 + if([1,2,4,6,8,9].indexOf(p_type)==-1 || this.data.openSpecModal_inte_normal == 1 || this.data.is_normal == 1){
  2421 + add_num=getApp().get_limit_qty(this.data.sele_g,0,1);
  2422 + }
  2423 + this.checkCartNum(this.data.goodsInputNum - add_num);
2410 }, 2424 },
2411 //----------输入框输入购买数量----------- 2425 //----------输入框输入购买数量-----------
2412 inputCartNum: function (t) { 2426 inputCartNum: function (t) {
@@ -2430,6 +2444,8 @@ Page({ @@ -2430,6 +2444,8 @@ Page({
2430 //------检查数量是不是超出限购------ 2444 //------检查数量是不是超出限购------
2431 checkCartNum: function (t) { 2445 checkCartNum: function (t) {
2432 var th = this; 2446 var th = this;
  2447 + var mo_num=getApp().get_limit_qty(th.data.sele_g);
  2448 + var steep=getApp().get_limit_qty(th.data.sele_g,0,1);
2433 this.get_buy_num(this.data.sele_g, async function () { 2449 this.get_buy_num(this.data.sele_g, async function () {
2434 2450
2435 //--判断商品是否超出限购-- 2451 //--判断商品是否超出限购--
@@ -2495,8 +2511,9 @@ Page({ @@ -2495,8 +2511,9 @@ Page({
2495 } 2511 }
2496 } 2512 }
2497 var e = th.data.sele_g.store_count; 2513 var e = th.data.sele_g.store_count;
2498 - var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4  
2499 - if (th.data.sales_rules >= 2 && (p_type != 1 && p_type != 4 && p_type != 6 && p_type != 2 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { 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 &&
  2516 + ([1,2,4,6,8,9].indexOf(p_type)==-1 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) {
2500 if (!th.data.def_pick_store) { 2517 if (!th.data.def_pick_store) {
2501 wx.showToast({ 2518 wx.showToast({
2502 title: '请选择门店', 2519 title: '请选择门店',
@@ -2517,12 +2534,33 @@ Page({ @@ -2517,12 +2534,33 @@ Page({
2517 }); 2534 });
2518 // wx.showModal({title: '库存不足',}); 2535 // wx.showModal({title: '库存不足',});
2519 if (e < 0) e = 0; 2536 if (e < 0) e = 0;
  2537 +
  2538 + //只有普通商品才有起购数
  2539 + if([1,2,4,6,8,9].indexOf(p_type)==-1 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1){
  2540 + if(e<mo_num) e=mo_num;
  2541 + if(e>mo_num && (e-mo_num)%steep!=0){
  2542 + e=mo_num+ parseInt((e-mo_num)/steep)*steep;
  2543 + }
  2544 + }
2520 th.setData({ 2545 th.setData({
2521 goodsInputNum: e 2546 goodsInputNum: e
2522 }); 2547 });
2523 return false; 2548 return false;
2524 } 2549 }
  2550 +
  2551 +
  2552 + //var steep=getApp().get_limit_qty(th.data.sele_g,0,1);
  2553 +
  2554 +
2525 t > e || 0 == e ? t = e : t < 1 && (t = 1); 2555 t > e || 0 == e ? t = e : t < 1 && (t = 1);
  2556 +
  2557 +
  2558 + //只有普通商品才有起购数
  2559 + if([1,2,4,6,8,9].indexOf(p_type)==-1 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1){
  2560 + if(t<mo_num) t=mo_num;
  2561 + }
  2562 +
  2563 +
2526 th.setData({ 2564 th.setData({
2527 goodsInputNum: t 2565 goodsInputNum: t
2528 }); 2566 });
@@ -2612,7 +2650,8 @@ Page({ @@ -2612,7 +2650,8 @@ Page({
2612 2650
2613 var e = th.data.sele_g.store_count; 2651 var e = th.data.sele_g.store_count;
2614 var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4 2652 var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4
2615 - if (th.data.sales_rules >= 2 && (p_type != 1 && p_type != 4 && p_type != 6 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { 2653 + if (!getApp().is_virtual(th.data.sele_g) && !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)) {
2616 if (!th.data.def_pick_store) { 2655 if (!th.data.def_pick_store) {
2617 wx.showModal({ 2656 wx.showModal({
2618 title: '请选择门店', 2657 title: '请选择门店',
@@ -3342,7 +3381,7 @@ Page({ @@ -3342,7 +3381,7 @@ Page({
3342 if (!item.whsle_id && [1,2,4,6].indexOf(item.prom_type)==-1) that.check_is_youhui(gid, that.data.is_normal); 3381 if (!item.whsle_id && [1,2,4,6].indexOf(item.prom_type)==-1) that.check_is_youhui(gid, that.data.is_normal);
3343 3382
3344 //默认门店要拿下门店库存 3383 //默认门店要拿下门店库存
3345 - 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) { 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) {
3346 var lock = 0, 3385 var lock = 0,
3347 plist = null; 3386 plist = null;
3348 3387
@@ -3643,7 +3682,7 @@ Page({ @@ -3643,7 +3682,7 @@ Page({
3643 }); 3682 });
3644 3683
3645 //--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购-- 3684 //--获取线下库存,而且不是新的门店规则, 同时是普通购买的时候,或者同时不能是活动,秒杀,拼团,积分购--
3646 - if (th.data.sales_rules >= 2 && !th.data.is_newsales_rules && !th.data.sele_g.whsle_id && ([1,2,4,6,8,9].indexOf(th.data.prom_type)==-1 || is_normal == 1)) { 3685 + if (!getApp().is_virtual(th.data.sele_g) && th.data.sales_rules >= 2 && !th.data.is_newsales_rules && !th.data.sele_g.whsle_id && ([1,2,4,6,8,9].indexOf(th.data.prom_type)==-1 || is_normal == 1)) {
3647 setTimeout(function () { 3686 setTimeout(function () {
3648 th.deal_pickup_dline(e); 3687 th.deal_pickup_dline(e);
3649 }, 800) 3688 }, 800)
@@ -3939,7 +3978,7 @@ Page({ @@ -3939,7 +3978,7 @@ Page({
3939 } 3978 }
3940 if (th.data.fir_def_store && 3979 if (th.data.fir_def_store &&
3941 (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || (th.data.def_pick_store && th.data.def_pick_store.distr_type == g_distr_type))) { 3980 (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || (th.data.def_pick_store && th.data.def_pick_store.distr_type == g_distr_type))) {
3942 - th.data.fir_def_store.Qty; 3981 + th.data.fir_def_store.Qty=Qty;
3943 if (def_pick_store && def_pick_store.pickup_id == th.data.fir_def_store.pickup_id) 3982 if (def_pick_store && def_pick_store.pickup_id == th.data.fir_def_store.pickup_id)
3944 th.setData({ 3983 th.setData({
3945 def_pick_store: th.data.fir_def_store 3984 def_pick_store: th.data.fir_def_store
@@ -4946,6 +4985,7 @@ Page({ @@ -4946,6 +4985,7 @@ Page({
4946 4985
4947 var th = this; 4986 var th = this;
4948 var ind = parseInt(e.currentTarget.dataset.it); 4987 var ind = parseInt(e.currentTarget.dataset.it);
  4988 + var mo_num=getApp().get_limit_qty(this.data.sele_g);
4949 4989
4950 //如果是拼单活动的普通购买 4990 //如果是拼单活动的普通购买
4951 if (ind == 1) { 4991 if (ind == 1) {
@@ -4959,14 +4999,19 @@ Page({ @@ -4959,14 +4999,19 @@ Page({
4959 th.get_sto(1); 4999 th.get_sto(1);
4960 th.setData({ 5000 th.setData({
4961 is_normal: ind, 5001 is_normal: ind,
4962 - openSpecModal_pt: 1 5002 + openSpecModal_pt: 1,
  5003 + goodsInputNum: mo_num,
  5004 + mo_num:mo_num
  5005 +
4963 }); 5006 });
4964 } else { 5007 } else {
4965 th.get_sto(1); 5008 th.get_sto(1);
4966 th.get_sku(o.stoid, th.data.data, th.data.gid, 1, function () { 5009 th.get_sku(o.stoid, th.data.data, th.data.gid, 1, function () {
4967 th.setData({ 5010 th.setData({
4968 is_normal: ind, 5011 is_normal: ind,
4969 - openSpecModal_pt: 1 5012 + openSpecModal_pt: 1,
  5013 + goodsInputNum: mo_num,
  5014 + mo_num:mo_num
4970 }); 5015 });
4971 }); 5016 });
4972 } 5017 }
@@ -4975,6 +5020,10 @@ Page({ @@ -4975,6 +5020,10 @@ Page({
4975 5020
4976 if (th.data.is_normal) { 5021 if (th.data.is_normal) {
4977 th.data.g_buy_num = new Map(); 5022 th.data.g_buy_num = new Map();
  5023 + th.setData({
  5024 + goodsInputNum: mo_num,
  5025 + mo_num:mo_num
  5026 + });
4978 } 5027 }
4979 5028
4980 //拼单商品从这里进,先判断有没有买过商品, 5029 //拼单商品从这里进,先判断有没有买过商品,
@@ -5041,7 +5090,6 @@ Page({ @@ -5041,7 +5090,6 @@ Page({
5041 getApp().confirmBox("拼团商品至少要买" + qnum + "件!"); 5090 getApp().confirmBox("拼团商品至少要买" + qnum + "件!");
5042 return false; 5091 return false;
5043 } 5092 }
5044 -  
5045 } 5093 }
5046 5094
5047 th.addcart_pt_func(); 5095 th.addcart_pt_func();
@@ -6919,7 +6967,7 @@ Page({ @@ -6919,7 +6967,7 @@ Page({
6919 var lock = 0; 6967 var lock = 0;
6920 6968
6921 //---如果是活动的时候,同时不是普通购买--- 6969 //---如果是活动的时候,同时不是普通购买---
6922 - if (th.data.sele_g.whsle_id || [1, 2, 4, 6, 8, 9].indexOf(th.data.prom_type) > -1 && !th.data.is_normal) { 6970 + if (getApp().is_virtual(th.data.sele_g) || th.data.sele_g.whsle_id || ([1, 2, 4, 6, 8, 9].indexOf(th.data.prom_type) > -1 && !th.data.is_normal)) {
6923 func(); 6971 func();
6924 return false; 6972 return false;
6925 } 6973 }
@@ -8068,10 +8116,14 @@ Page({ @@ -8068,10 +8116,14 @@ Page({
8068 openSpecModel_Nor: function () { 8116 openSpecModel_Nor: function () {
8069 this.data.g_buy_num = new Map(); 8117 this.data.g_buy_num = new Map();
8070 var th = this; 8118 var th = this;
  8119 + var mo_num=getApp().get_limit_qty(this.data.sele_g);
  8120 +
8071 this.setData({ 8121 this.setData({
8072 open_ind_store: 5, 8122 open_ind_store: 5,
8073 - goodsInputNum: 1 8123 + goodsInputNum: mo_num,
  8124 + mo_num:mo_num
8074 }); //拼团直接给4 8125 }); //拼团直接给4
  8126 +
8075 if (th.data.sku_g_pt) { 8127 if (th.data.sku_g_pt) {
8076 this.get_sto(1) 8128 this.get_sto(1)
8077 this.setData({ 8129 this.setData({
pages/goods/goodsInfo/goodsInfo.wxml
@@ -684,7 +684,7 @@ @@ -684,7 +684,7 @@
684 <view class="no_store" wx:if="{{def_pick_store && def_pick_store.is_no_dis}}"> 684 <view class="no_store" wx:if="{{def_pick_store && def_pick_store.is_no_dis}}">
685 (配送不匹配) 685 (配送不匹配)
686 </view> 686 </view>
687 - <view class="no_store" wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0 && !sele_g.whsle_id}}"> 687 + <view class="no_store" wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && !filters.is_virtual_gd(sele_g.is_virtual) && sales_rules>=2 && prom_type==0 && !sele_g.whsle_id}}">
688 (库存不足) 688 (库存不足)
689 </view> 689 </view>
690 </block> 690 </block>
@@ -1264,12 +1264,19 @@ @@ -1264,12 +1264,19 @@
1264 <block wx:if="{{prom_type==0}}"> 1264 <block wx:if="{{prom_type==0}}">
1265 <view class="flex"> 1265 <view class="flex">
1266 <view class="spec-goods-stock">已售:{{sele_g.sales_sum}}</view> 1266 <view class="spec-goods-stock">已售:{{sele_g.sales_sum}}</view>
  1267 + <!-- 线下门店销售的时候 -->
1267 <block wx:if="{{sales_rules>=2}}"> 1268 <block wx:if="{{sales_rules>=2}}">
1268 - <view class="spec-goods-stock" wx:if="{{def_pick_store && def_pick_store.CanOutQty}}">  
1269 - 可售:{{def_pick_store.CanOutQty}}  
1270 - </view>  
1271 - <view class="spec-goods-stock" wx:else>可售:0</view> 1269 +
  1270 + <!-- 如果不是虚拟商品的时候 -->
  1271 + <block wx:if="{{!filters.is_virtual_gd(sele_g.is_virtual)}}">
  1272 + <view class="spec-goods-stock" wx:if="{{def_pick_store && def_pick_store.CanOutQty}}">
  1273 + 可售:{{def_pick_store.CanOutQty}}
  1274 + </view>
  1275 + <view class="spec-goods-stock" wx:else>可售:0</view>
  1276 + </block>
  1277 +
1272 </block> 1278 </block>
  1279 +
1273 <block wx:else> 1280 <block wx:else>
1274 <view class="spec-goods-stock">可售:{{sele_g.store_count}}</view> 1281 <view class="spec-goods-stock">可售:{{sele_g.store_count}}</view>
1275 </block> 1282 </block>
@@ -1314,7 +1321,7 @@ @@ -1314,7 +1321,7 @@
1314 <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> 1321 <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view>
1315 <block wx:else> 1322 <block wx:else>
1316 <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> 1323 <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view>
1317 - <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0 &&!sele_g.whsle_id}}"> 1324 + <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && !filters.is_virtual_gd(sele_g.is_virtual) && sales_rules>=2 && prom_type==0 &&!sele_g.whsle_id && !filters.is_virtual_gd(sele_g)}}">
1318 (库存不足) 1325 (库存不足)
1319 </view> 1326 </view>
1320 </block> 1327 </block>
@@ -1394,8 +1401,8 @@ @@ -1394,8 +1401,8 @@
1394 </block> 1401 </block>
1395 <block wx:else> 1402 <block wx:else>
1396 <!-- 如果是线下库存购买的时候,且是普通商品购买的时候 --> 1403 <!-- 如果是线下库存购买的时候,且是普通商品购买的时候 -->
1397 - <block wx:if="{{sales_rules>=2 && prom_type==0 && !sele_g.whsle_id}}">  
1398 - <block wx:if="{{!def_pick_store.CanOutQty}}"> 1404 + <block wx:if="{{sales_rules>=2 && prom_type==0 && !sele_g.whsle_id && !filters.is_virtual_gd(sele_g.is_virtual) }}">
  1405 + <block wx:if="{{!def_pick_store.CanOutQty || def_pick_store.CanOutQty<mo_num }}">
1399 <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999"> 1406 <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">
1400 库存不足 1407 库存不足
1401 </view> 1408 </view>
@@ -1411,7 +1418,7 @@ @@ -1411,7 +1418,7 @@
1411 </block> 1418 </block>
1412 <!-- 线上销售 --> 1419 <!-- 线上销售 -->
1413 <block wx:else> 1420 <block wx:else>
1414 - <block wx:if="{{sele_g.store_count<=0 && is_no_new}}"> 1421 + <block wx:if="{{(sele_g.store_count<=0 || sele_g.store_count<mo_num ) && is_no_new}}">
1415 <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999"> 1422 <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">
1416 库存不足 1423 库存不足
1417 </view> 1424 </view>
@@ -1610,7 +1617,7 @@ @@ -1610,7 +1617,7 @@
1610 <view class="flex-vertical-between butttem5"> 1617 <view class="flex-vertical-between butttem5">
1611 <view class="flex xc-ash"> 1618 <view class="flex xc-ash">
1612 <view class="fs30 xc-black3 address_name">{{item.pickup_name}} 1619 <view class="fs30 xc-black3 address_name">{{item.pickup_name}}
1613 - <text class="c-red22" wx:if="{{item.is_no_qyt}}">(库存不足)</text> 1620 + <text class="c-red22" wx:if="{{item.is_no_qyt && !filters.is_virtual_gd(sele_g.is_virtual)}}">(库存不足)</text>
1614 </view> 1621 </view>
1615 </view> 1622 </view>
1616 <view> 1623 <view>
@@ -1638,7 +1645,7 @@ @@ -1638,7 +1645,7 @@
1638 <view class="flex-vertical-between "> 1645 <view class="flex-vertical-between ">
1639 <view class="flex xc-ash"> 1646 <view class="flex xc-ash">
1640 <view class="fs30 xc-black3 address_name">{{item.pickup_name}} 1647 <view class="fs30 xc-black3 address_name">{{item.pickup_name}}
1641 - <text class="c-red22" wx:if="{{item.is_no_qyt}}">(库存不足)</text> 1648 + <text class="c-red22" wx:if="{{item.is_no_qyt && !filters.is_virtual_gd(sele_g.is_virtual) }}">(库存不足)</text>
1642 </view> 1649 </view>
1643 </view> 1650 </view>
1644 <view> 1651 <view>
@@ -1668,7 +1675,7 @@ @@ -1668,7 +1675,7 @@
1668 <view class="flex-vertical-between "> 1675 <view class="flex-vertical-between ">
1669 <view class="flex xc-ash"> 1676 <view class="flex xc-ash">
1670 <view class="fs28 xc-black3 address_name">{{item.pickup_name}} 1677 <view class="fs28 xc-black3 address_name">{{item.pickup_name}}
1671 - <text class="c-red22" wx:if="{{item.is_no_qyt}}">(库存不足)</text> 1678 + <text class="c-red22" wx:if="{{item.is_no_qyt && !filters.is_virtual_gd(sele_g.is_virtual)}}">(库存不足)</text>
1672 </view> 1679 </view>
1673 </view> 1680 </view>
1674 <view> 1681 <view>
pages/user/index/index.js
@@ -991,10 +991,23 @@ Page({ @@ -991,10 +991,23 @@ Page({
991 //过滤掉分销关闭的 991 //过滤掉分销关闭的
992 let distribut_end_time = await getApp().user_tools_endTime(2);//过滤掉分销到期的 992 let distribut_end_time = await getApp().user_tools_endTime(2);//过滤掉分销到期的
993 await getApp().promiseGet("/api/weshop/storeDistribut/get/" + os.stoid, {}).then(rs => { 993 await getApp().promiseGet("/api/weshop/storeDistribut/get/" + os.stoid, {}).then(rs => {
994 - if (rs.data.code == 0) {  
995 - var dis = rs.data.data; 994 + if (rs.data.code == 0 || !rs.data.data) {
  995 + var is_ok=1;
  996 +
  997 + if(!distribut_end_time){
  998 + is_ok=0;
  999 + }
  1000 + else if(!rs.data.data){
  1001 + is_ok=0;
  1002 + }else{
  1003 + var dis=rs.data.data;
  1004 + if(!dis || dis.switch == 0){
  1005 + is_ok=0;
  1006 + }
  1007 + }
  1008 +
996 for (var i in d_list) { 1009 for (var i in d_list) {
997 - if (d_list[i].name == '我的分销' && (!dis || dis.switch == 0) || (d_list[i].name == '我的分销' && !distribut_end_time)) { 1010 + if (d_list[i].name == '我的分销' && !is_ok) {
998 d_list.splice(i, 1); 1011 d_list.splice(i, 1);
999 } 1012 }
1000 } 1013 }
pages/user/order_list/order_list.js
@@ -1041,7 +1041,7 @@ Page({ @@ -1041,7 +1041,7 @@ Page({
1041 } 1041 }
1042 1042
1043 //--如果是线下库存的时候-- 1043 //--如果是线下库存的时候--
1044 - if (th.data.conf.sales_rules >= 2 && !gg.whsle_id) { 1044 + if (!getApp().is_virtual(gg) && th.data.conf.sales_rules >= 2 && !gg.whsle_id) {
1045 var ob = {}; 1045 var ob = {};
1046 await th.check_down_line_next(gg, good.goods_num, order.pickup_id, function (obj) { 1046 await th.check_down_line_next(gg, good.goods_num, order.pickup_id, function (obj) {
1047 ob = obj; 1047 ob = obj;
@@ -1667,7 +1667,7 @@ Page({ @@ -1667,7 +1667,7 @@ Page({
1667 1667
1668 1668
1669 //判断是不是线下库存的购买, 是不是秒杀活动 1669 //判断是不是线下库存的购买, 是不是秒杀活动
1670 - if (th.data.sales_rules >= 2 && !prom && !good.whsle_id) { 1670 + if (!getApp().is_virtual(good) && th.data.sales_rules >= 2 && !prom && !good.whsle_id) {
1671 1671
1672 //-- 看一下购物车上有多少商品 -- 1672 //-- 看一下购物车上有多少商品 --
1673 var cart_num = 0; 1673 var cart_num = 0;
utils/filter.wxs
@@ -289,4 +289,8 @@ module.exports = { @@ -289,4 +289,8 @@ module.exports = {
289 isExpired: filters.isExpired, 289 isExpired: filters.isExpired,
290 gettimestamp: filters.gettimestamp, 290 gettimestamp: filters.gettimestamp,
291 showStartAndEndDate: filters.showStartAndEndDate, 291 showStartAndEndDate: filters.showStartAndEndDate,
  292 + is_virtual_gd:function (is_virtual){
  293 + if(is_virtual==2) return true;
  294 + return false;
  295 + }
292 } 296 }
293 \ No newline at end of file 297 \ No newline at end of file