Commit 249f0fa73dbefe7eb7d36c588cadcb40b0fa66b0

Authored by yvan.ni
1 parent 85628213

1、 单赠品 赠品限购的bug优化

packageE/pages/cart/cart2/cart2.js
... ... @@ -2329,9 +2329,9 @@ Page({
2329 2329 var other_gift=0;
2330 2330 other_gift=th.get_other_gift(c_arr,get_data.gift_id,pickid);
2331 2331  
2332   - //------end-------
  2332 + //------end------- ,因为增加了限购数量不限的情况
2333 2333 if (get_data.gift_id && parseInt(get_data.zp_mode) != 1
2334   - && get_data.zp_num * item_map.bs <= get_data.limit_num-other_gift
  2334 + && (get_data.zp_num * item_map.bs <= get_data.limit_num-other_gift || !get_data.limit_num)
2335 2335 && get_data.zp_num * item_map.bs <= get_data.gift_storecount
2336 2336 && get_data.zp_num>get_data.must_num //增加一个超量
2337 2337 ) {
... ...
pages/cart/cart/cart.js
... ... @@ -4254,7 +4254,7 @@ Page({
4254 4254  
4255 4255 } else {
4256 4256 //---如果有打折的信息,赠送的信息,赠送的时候要判断是不是限购数量---
4257   - if (discount && discount['goods_id'] && discount.limit_num >= discount.bs * discount.zp_num &&
  4257 + if (discount && discount['goods_id'] && (!discount.limit_num || discount.limit_num >= discount.bs * discount.zp_num) &&
4258 4258 discount.gift_storecount >= discount.bs * discount.zp_num) {
4259 4259 //如果这礼品超了情况下
4260 4260 if (no_gift_arr.indexOf(discount.gift_id) != -1) continue;
... ... @@ -4302,7 +4302,7 @@ Page({
4302 4302 }
4303 4303  
4304 4304 //-- 赠品的数量超出库存数量和会员的限制,这里是保证所有的赠品部会超出 --
4305   - if (discount.gift_storecount < all_num + newd.goods_num || discount.limit_num < all_limit_num + newd.goods_num) {
  4305 + if (discount.gift_storecount < all_num + newd.goods_num || (discount.limit_num && discount.limit_num < all_limit_num + newd.goods_num)) {
4306 4306 no_gift_arr.push(discount.gift_id);
4307 4307 //--进入下一个循环 --
4308 4308 continue;
... ... @@ -4582,8 +4582,8 @@ Page({
4582 4582 }
4583 4583  
4584 4584 } else {
4585   - //---如果有打折的信息,赠送的信息,赠送的时候要判断是不是限购数量---
4586   - if (discount && discount['goods_id'] && discount.limit_num >= discount.bs * discount.zp_num &&
  4585 + //---如果有打折的信息,赠送的信息,赠送的时候要判断是不是限购数量,因为增加了限购数量不限的情况---
  4586 + if (discount && discount['goods_id'] && (!discount.limit_num || discount.limit_num >= discount.bs * discount.zp_num) &&
4587 4587 discount.gift_storecount >= discount.bs * discount.zp_num) {
4588 4588 //如果这礼品超了情况下
4589 4589 if (no_gift_arr.indexOf(discount.gift_id) != -1) continue;
... ... @@ -4631,7 +4631,7 @@ Page({
4631 4631 }
4632 4632  
4633 4633 //-- 赠品的数量超出库存数量和会员的限制,这里是保证所有的赠品部会超出 --
4634   - if (discount.gift_storecount < all_num + newd.goods_num || discount.limit_num < all_limit_num + newd.goods_num) {
  4634 + if (discount.gift_storecount < all_num + newd.goods_num || (discount.limit_num && discount.limit_num < all_limit_num + newd.goods_num)) {
4635 4635 no_gift_arr.push(discount.gift_id);
4636 4636 //--进入下一个循环 --
4637 4637 continue;
... ...