|
@@ -194,12 +194,16 @@ class Cart extends Model |
|
@@ -194,12 +194,16 @@ class Cart extends Model |
194
|
if ($goods['ismake'] == '0' && $cart['goods_num'] > $cart['goods_sku']['stock_num']) {
|
194
|
if ($goods['ismake'] == '0' && $cart['goods_num'] > $cart['goods_sku']['stock_num']) {
|
195
|
$this->setError('很抱歉,商品 [' . $goods['goods_name'] . '] 库存不足');
|
195
|
$this->setError('很抱歉,商品 [' . $goods['goods_name'] . '] 库存不足');
|
196
|
}
|
196
|
}
|
|
|
197
|
+ $cart['goods_total_price'] = bcmul($cart['goods_price'], $cart['goods_num'], 2);
|
|
|
198
|
+ // 只计算选中商品
|
|
|
199
|
+ if($cart['isselected'] == '1'){
|
197
|
// 商品总数
|
200
|
// 商品总数
|
198
|
$total_num += $cart['goods_num'];
|
201
|
$total_num += $cart['goods_num'];
|
199
|
// 商品总价
|
202
|
// 商品总价
|
200
|
- $total_price += $cart['goods_total_price'] = bcmul($cart['goods_price'], $cart['goods_num'], 2);
|
203
|
+ $total_price += $cart['goods_total_price'];
|
201
|
// 商品总重量
|
204
|
// 商品总重量
|
202
|
$total_goods_weight += bcmul($cart['goods_sku']['goods_weight'], $cart['goods_num'], 2);
|
205
|
$total_goods_weight += bcmul($cart['goods_sku']['goods_weight'], $cart['goods_num'], 2);
|
|
|
206
|
+ }
|
203
|
// 显示商品信息
|
207
|
// 显示商品信息
|
204
|
$cart->goods->visible(['goods_name','goods_image','category_ids','spec_type']);
|
208
|
$cart->goods->visible(['goods_name','goods_image','category_ids','spec_type']);
|
205
|
// 显示用户尺寸信息
|
209
|
// 显示用户尺寸信息
|
|
@@ -218,7 +222,8 @@ class Cart extends Model |
|
@@ -218,7 +222,8 @@ class Cart extends Model |
218
|
'goods_num',
|
222
|
'goods_num',
|
219
|
'make_type',
|
223
|
'make_type',
|
220
|
'goods',
|
224
|
'goods',
|
221
|
- 'user_size'
|
225
|
+ 'user_size',
|
|
|
226
|
+ 'isselected'
|
222
|
])->append([
|
227
|
])->append([
|
223
|
'goods_total_price',
|
228
|
'goods_total_price',
|
224
|
'goods_sku'
|
229
|
'goods_sku'
|
|
@@ -236,7 +241,7 @@ class Cart extends Model |
|
@@ -236,7 +241,7 @@ class Cart extends Model |
236
|
krsort($express);
|
241
|
krsort($express);
|
237
|
$express_price = 0;
|
242
|
$express_price = 0;
|
238
|
foreach($express as $k => $v){
|
243
|
foreach($express as $k => $v){
|
239
|
- if($total_goods_weight >= $k){
|
244
|
+ if($total_goods_weight > $k){
|
240
|
$express_price = $v;
|
245
|
$express_price = $v;
|
241
|
break;
|
246
|
break;
|
242
|
}
|
247
|
}
|
|
@@ -305,8 +310,10 @@ class Cart extends Model |
|
@@ -305,8 +310,10 @@ class Cart extends Model |
305
|
public function orderCouponList($user,$cart_list){
|
310
|
public function orderCouponList($user,$cart_list){
|
306
|
$new_cart_list = [];
|
311
|
$new_cart_list = [];
|
307
|
foreach ($cart_list as $key => $value) {
|
312
|
foreach ($cart_list as $key => $value) {
|
|
|
313
|
+ if($value['isselected'] == '1'){
|
308
|
$new_cart_list[$value['goods_id']][] = $value;
|
314
|
$new_cart_list[$value['goods_id']][] = $value;
|
309
|
}
|
315
|
}
|
|
|
316
|
+ }
|
310
|
$coupon_id_arr = [];
|
317
|
$coupon_id_arr = [];
|
311
|
$tree = Tree::instance()->init(collection(Category::order('weigh desc,id desc')->select())->toArray(), 'pid');
|
318
|
$tree = Tree::instance()->init(collection(Category::order('weigh desc,id desc')->select())->toArray(), 'pid');
|
312
|
foreach($new_cart_list as $goods_id => $v){
|
319
|
foreach($new_cart_list as $goods_id => $v){
|