...
|
...
|
@@ -194,12 +194,16 @@ class Cart extends Model |
|
|
if ($goods['ismake'] == '0' && $cart['goods_num'] > $cart['goods_sku']['stock_num']) {
|
|
|
$this->setError('很抱歉,商品 [' . $goods['goods_name'] . '] 库存不足');
|
|
|
}
|
|
|
// 商品总数
|
|
|
$total_num += $cart['goods_num'];
|
|
|
// 商品总价
|
|
|
$total_price += $cart['goods_total_price'] = bcmul($cart['goods_price'], $cart['goods_num'], 2);
|
|
|
// 商品总重量
|
|
|
$total_goods_weight += bcmul($cart['goods_sku']['goods_weight'], $cart['goods_num'], 2);
|
|
|
$cart['goods_total_price'] = bcmul($cart['goods_price'], $cart['goods_num'], 2);
|
|
|
// 只计算选中商品
|
|
|
if($cart['isselected'] == '1'){
|
|
|
// 商品总数
|
|
|
$total_num += $cart['goods_num'];
|
|
|
// 商品总价
|
|
|
$total_price += $cart['goods_total_price'];
|
|
|
// 商品总重量
|
|
|
$total_goods_weight += bcmul($cart['goods_sku']['goods_weight'], $cart['goods_num'], 2);
|
|
|
}
|
|
|
// 显示商品信息
|
|
|
$cart->goods->visible(['goods_name','goods_image','category_ids','spec_type']);
|
|
|
// 显示用户尺寸信息
|
...
|
...
|
@@ -218,7 +222,8 @@ class Cart extends Model |
|
|
'goods_num',
|
|
|
'make_type',
|
|
|
'goods',
|
|
|
'user_size'
|
|
|
'user_size',
|
|
|
'isselected'
|
|
|
])->append([
|
|
|
'goods_total_price',
|
|
|
'goods_sku'
|
...
|
...
|
@@ -236,7 +241,7 @@ class Cart extends Model |
|
|
krsort($express);
|
|
|
$express_price = 0;
|
|
|
foreach($express as $k => $v){
|
|
|
if($total_goods_weight >= $k){
|
|
|
if($total_goods_weight > $k){
|
|
|
$express_price = $v;
|
|
|
break;
|
|
|
}
|
...
|
...
|
@@ -305,7 +310,9 @@ class Cart extends Model |
|
|
public function orderCouponList($user,$cart_list){
|
|
|
$new_cart_list = [];
|
|
|
foreach ($cart_list as $key => $value) {
|
|
|
$new_cart_list[$value['goods_id']][] = $value;
|
|
|
if($value['isselected'] == '1'){
|
|
|
$new_cart_list[$value['goods_id']][] = $value;
|
|
|
}
|
|
|
}
|
|
|
$coupon_id_arr = [];
|
|
|
$tree = Tree::instance()->init(collection(Category::order('weigh desc,id desc')->select())->toArray(), 'pid');
|
...
|
...
|
|