Commit 0dc48a94c1de835c1837ddec970b6dcc6321962e
1 parent
ad3af2fb
组合购的bug优化
Showing
3 changed files
with
10 additions
and
6 deletions
packageE/pages/cart/cart2/zh_calculate.js
@@ -156,9 +156,9 @@ module.exports = { | @@ -156,9 +156,9 @@ module.exports = { | ||
156 | 156 | ||
157 | //看一下是几倍 | 157 | //看一下是几倍 |
158 | let be = parseInt(no_in_arr.length / act.zhbuyqty); | 158 | let be = parseInt(no_in_arr.length / act.zhbuyqty); |
159 | - //如果有总数控制的时候 | 159 | + //如果有总数控制的时候,看还能买几组 |
160 | if(act.zh_num){ | 160 | if(act.zh_num){ |
161 | - var be1=act.zh_num-act.zh_buy_num-1; | 161 | + var be1= parseInt((act.zh_num-act.zh_buy_num)/ act.zhbuyqty)-1; |
162 | if(be1<be) be=be1; | 162 | if(be1<be) be=be1; |
163 | } | 163 | } |
164 | 164 | ||
@@ -207,8 +207,8 @@ module.exports = { | @@ -207,8 +207,8 @@ module.exports = { | ||
207 | 207 | ||
208 | } | 208 | } |
209 | if (!zhqty_len) { | 209 | if (!zhqty_len) { |
210 | - aprice += be1 * act.zhprice; | ||
211 | - let pop_num = be1 * act.zhbuyqty - delete_num; | 210 | + aprice += be * act.zhprice; |
211 | + let pop_num = be * act.zhbuyqty - delete_num; | ||
212 | for (var m = 0; m < pop_num; m++) { | 212 | for (var m = 0; m < pop_num; m++) { |
213 | no_in_arr.pop(); | 213 | no_in_arr.pop(); |
214 | } | 214 | } |
pages/cart/cart/zh_calculate.js
@@ -240,9 +240,9 @@ module.exports = { | @@ -240,9 +240,9 @@ module.exports = { | ||
240 | var zhqty_len = 0; //几个超量倍增 | 240 | var zhqty_len = 0; //几个超量倍增 |
241 | var be = parseInt(no_in_arr.length / act.zhbuyqty); //看一下是几倍 | 241 | var be = parseInt(no_in_arr.length / act.zhbuyqty); //看一下是几倍 |
242 | 242 | ||
243 | - //如果有总数控制的时候 | 243 | + //如果有总数控制的时候,看还能买几组 |
244 | if(act.zh_num){ | 244 | if(act.zh_num){ |
245 | - var be1=act.zh_num-act.zh_buy_num-1; | 245 | + var be1= parseInt((act.zh_num-act.zh_buy_num)/ act.zhbuyqty)-1; |
246 | if(be1<be) be=be1; | 246 | if(be1<be) be=be1; |
247 | } | 247 | } |
248 | 248 |
utils/more_cx.js
@@ -46,6 +46,7 @@ module.exports = { | @@ -46,6 +46,7 @@ module.exports = { | ||
46 | 46 | ||
47 | let no_in_arr = []; //剩余的未加入组合购 | 47 | let no_in_arr = []; //剩余的未加入组合购 |
48 | let out_arr = []; //超出活动限购的商品放入 | 48 | let out_arr = []; //超出活动限购的商品放入 |
49 | + let zhqty_bz = []; //超量 | ||
49 | 50 | ||
50 | //-- 判断组合购的总数量是不是到了 -- | 51 | //-- 判断组合购的总数量是不是到了 -- |
51 | if(act.zh_num>0){ | 52 | if(act.zh_num>0){ |
@@ -135,6 +136,9 @@ module.exports = { | @@ -135,6 +136,9 @@ module.exports = { | ||
135 | all_num += item.num; | 136 | all_num += item.num; |
136 | //当有起购数的控制的时候 | 137 | //当有起购数的控制的时候 |
137 | if (item.zhqty) { | 138 | if (item.zhqty) { |
139 | + | ||
140 | + zhqty_bz.push(item); | ||
141 | + | ||
138 | all_zhqty += item.zhqty; | 142 | all_zhqty += item.zhqty; |
139 | if (item.num < item.zhqty) { | 143 | if (item.num < item.zhqty) { |
140 | need_to_buy += item.zhqty - item.num; | 144 | need_to_buy += item.zhqty - item.num; |