...
|
...
|
@@ -109,7 +109,8 @@ class CartModel |
|
|
/* 预售购物车 */
|
|
|
$result['presellGoodsCount'] = $advanceCount;
|
|
|
$result['preSellCart'] = self::procCartData($cart['advance_cart_data'], $onlyGift, $onlyAdvanceBuy);
|
|
|
} while (false);
|
|
|
}
|
|
|
while (false);
|
|
|
|
|
|
return $result;
|
|
|
}
|
...
|
...
|
@@ -154,7 +155,8 @@ class CartModel |
|
|
$result['code'] = $select['code'];
|
|
|
$result['message'] = $select['message'];
|
|
|
}
|
|
|
} while (0);
|
|
|
}
|
|
|
while (0);
|
|
|
|
|
|
return $result;
|
|
|
}
|
...
|
...
|
@@ -173,7 +175,7 @@ class CartModel |
|
|
$result = array('code' => 400, 'message' => '出错啦~');
|
|
|
|
|
|
// 处理sku
|
|
|
$sku_list = json_encode(array(array('product_sku'=>$sku,'buy_number'=>intval($count), 'promotion_id'=>$promotionId)));
|
|
|
$sku_list = json_encode(array(array('product_sku' => $sku, 'buy_number' => intval($count), 'promotion_id' => $promotionId)));
|
|
|
$remove = CartData::removeFromCart($uid, $sku_list, $shoppingKey);
|
|
|
if ($remove && isset($remove['code'])) {
|
|
|
$result['code'] = $remove['code'];
|
...
|
...
|
@@ -277,7 +279,8 @@ class CartModel |
|
|
$result['code'] = $modify['code'];
|
|
|
$result['message'] = $modify['message'];
|
|
|
}
|
|
|
} while (0);
|
|
|
}
|
|
|
while (0);
|
|
|
|
|
|
return $result;
|
|
|
}
|
...
|
...
|
@@ -307,7 +310,8 @@ class CartModel |
|
|
$result['code'] = $modify['code'];
|
|
|
$result['message'] = $modify['message'];
|
|
|
}
|
|
|
} while (0);
|
|
|
}
|
|
|
while (0);
|
|
|
|
|
|
return $result;
|
|
|
}
|
...
|
...
|
@@ -350,7 +354,8 @@ class CartModel |
|
|
if ($isLimitGoods) {
|
|
|
$result['error'] = true;
|
|
|
$result['message'] = $pay['message'];
|
|
|
} else {
|
|
|
}
|
|
|
else {
|
|
|
$result['cartUrl'] = Helpers::url('/cart/index/index');
|
|
|
}
|
|
|
|
...
|
...
|
@@ -376,7 +381,7 @@ class CartModel |
|
|
}
|
|
|
|
|
|
// 收货人有关信息
|
|
|
$isSunfengSupport = false;// 是否支持顺丰快递
|
|
|
$isSunfengSupport = false; // 是否支持顺丰快递
|
|
|
if (isset($payReturn['delivery_address']) && !empty($payReturn['delivery_address'])) {
|
|
|
$result['addressId'] = isset($address['address_id']) ? $address['address_id'] : $payReturn['delivery_address']['address_id'];
|
|
|
$result['name'] = isset($address['consignee']) ? $address['consignee'] : $payReturn['delivery_address']['consignee'];
|
...
|
...
|
@@ -414,10 +419,10 @@ class CartModel |
|
|
$oneDeliv['isSelected'] = true;
|
|
|
$isDeliveryId = false;
|
|
|
}
|
|
|
|
|
|
|
|
|
$result['dispatchMode'][$key] = $oneDeliv;
|
|
|
}
|
|
|
|
|
|
|
|
|
if ($isDeliveryId) {
|
|
|
$result['dispatchMode'][$defaultKey]['isSelected'] = true;
|
|
|
}
|
...
|
...
|
@@ -442,7 +447,8 @@ class CartModel |
|
|
if (isset($orderInfo['deliveryTimeId'])) {
|
|
|
$flag = array_search($orderInfo['deliveryTimeId'], $idArr);
|
|
|
$flag !== false && $result['dispatchTime'][$flag]['isSelected'] = true;
|
|
|
} else {
|
|
|
}
|
|
|
else {
|
|
|
$result['dispatchTime'][$defaultKey]['isSelected'] = true;
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -466,7 +472,8 @@ class CartModel |
|
|
if ($single['goods_type'] == 'gift' && !isset($single['isAdvanceBuy'])) {
|
|
|
$oneGoods['gift'] = true;
|
|
|
$oneGoods['price'] = Helpers::transPrice($single['sale_price']);
|
|
|
} elseif ($single['goods_type'] == 'price_gift') {
|
|
|
}
|
|
|
elseif ($single['goods_type'] == 'price_gift') {
|
|
|
$oneGoods['advanceBuy'] = true;
|
|
|
$oneGoods['price'] = Helpers::transPrice($single['sale_price']);
|
|
|
}
|
...
|
...
|
@@ -489,7 +496,7 @@ class CartModel |
|
|
if ($pay['is_support'] !== 'Y') {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
|
|
|
$onePay = array();
|
|
|
$onePay['id'] = $pay['payment_id'];
|
|
|
$onePay['paymentType'] = $pay['payment_type'];
|
...
|
...
|
@@ -503,7 +510,7 @@ class CartModel |
|
|
|
|
|
$result['paymentWay'][] = $onePay;
|
|
|
}
|
|
|
|
|
|
|
|
|
//默认第一个
|
|
|
if ($isPaymentType) {
|
|
|
$result['paymentWay'][0]['recommend'] = true;
|
...
|
...
|
@@ -524,11 +531,11 @@ class CartModel |
|
|
if ($payReturn['shopping_cart_data']['is_multi_package'] == 'Y') {
|
|
|
$result['isJit'] = true;
|
|
|
$jitInfo = array();
|
|
|
if(!empty($orderInfo)){
|
|
|
$jitInfo = array('deliveryId' => $orderInfo['deliveryId'], 'paymentType'=> $orderInfo['paymentType'], 'couponCode' => $orderInfo['couponCode'], 'yohoCoin' => $orderInfo['yohoCoin']);
|
|
|
if (!empty($orderInfo)) {
|
|
|
$jitInfo = array('deliveryId' => $orderInfo['deliveryId'], 'paymentType' => $orderInfo['paymentType'], 'couponCode' => $orderInfo['couponCode'], 'yohoCoin' => $orderInfo['yohoCoin']);
|
|
|
}
|
|
|
//传递相关参数
|
|
|
$param =array_merge(array('cartType' => $cartType, 'skuList' => $skuList), $jitInfo);
|
|
|
$param = array_merge(array('cartType' => $cartType, 'skuList' => $skuList), $jitInfo);
|
|
|
$result['jitDetailUrl'] = Helpers::url('/cart/index/jitDetail', $param);
|
|
|
}
|
|
|
$result['cartPayData'] = isset($orderCompute['promotion_formula_list']) ? $orderCompute['promotion_formula_list'] : $payReturn['shopping_cart_data']['promotion_formula_list'];
|
...
|
...
|
@@ -571,8 +578,8 @@ class CartModel |
|
|
$coupons['couponName'] = $orderInfo['couponName'];
|
|
|
}
|
|
|
$result['coupon'] = $coupons;
|
|
|
|
|
|
} while (false);
|
|
|
}
|
|
|
while (false);
|
|
|
|
|
|
return $result;
|
|
|
}
|
...
|
...
|
@@ -643,7 +650,8 @@ class CartModel |
|
|
if ($coupon && isset($coupon['code'])) {
|
|
|
$result = $coupon;
|
|
|
}
|
|
|
} while (0);
|
|
|
}
|
|
|
while (0);
|
|
|
|
|
|
return $result;
|
|
|
}
|
...
|
...
|
@@ -671,7 +679,8 @@ class CartModel |
|
|
$result['notAvailableCoupons'] = self::procCouponsData($coupons['data']['unusable_coupons']);
|
|
|
// 可用优惠券
|
|
|
$result['coupons'] = self::procCouponsData($coupons['data']['usable_coupons']);
|
|
|
} while (false);
|
|
|
}
|
|
|
while (false);
|
|
|
|
|
|
return $result;
|
|
|
}
|
...
|
...
|
@@ -727,13 +736,16 @@ class CartModel |
|
|
if (empty($addressId)) {
|
|
|
$result['code'] = 401;
|
|
|
$result['message'] = '配送地址不能为空';
|
|
|
} elseif (empty($deliveryTime)) {
|
|
|
}
|
|
|
elseif (empty($deliveryTime)) {
|
|
|
$result['code'] = 402;
|
|
|
$result['message'] = '请选择配送时间';
|
|
|
} elseif (empty($deliveryWay)) {
|
|
|
}
|
|
|
elseif (empty($deliveryWay)) {
|
|
|
$result['code'] = 403;
|
|
|
$result['message'] = '请选择配送方式';
|
|
|
} else {
|
|
|
}
|
|
|
else {
|
|
|
$orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $qhyUnio, $userAgent);
|
|
|
if ($orderSubRes && isset($orderSubRes['code'])) {
|
|
|
$result = $orderSubRes;
|
...
|
...
|
@@ -758,8 +770,8 @@ class CartModel |
|
|
if (isset($productData['special_price'])) { // 加价购或者赠品的销售价字段
|
|
|
$data['price'] = $productData['format_market_price'];
|
|
|
$data['salePrice'] = $productData['format_sales_price'];
|
|
|
|
|
|
} else { // 购物车商品的销售价字段
|
|
|
}
|
|
|
else { // 购物车商品的销售价字段
|
|
|
$data['price'] = $productData['market_price'] > $productData['sales_price'] ? $productData['format_market_price'] : false;
|
|
|
$data['salePrice'] = '¥' . Helpers::transPrice($productData['sales_price']);
|
|
|
}
|
...
|
...
|
@@ -810,9 +822,7 @@ class CartModel |
|
|
$sizeList[$val['product_skc']][] = $oneSize;
|
|
|
|
|
|
// 所有尺码列表,赋值用于前端展示默认尺码的时候 判断出没有库存则显示灰色
|
|
|
$allSizeList[$sizeName] = empty($allSizeList[$sizeName]['storage'])
|
|
|
? array('storage' => $one['storage_number'], 'id' => $one['size_id'])
|
|
|
: $allSizeList[$sizeName];
|
|
|
$allSizeList[$sizeName] = empty($allSizeList[$sizeName]['storage']) ? array('storage' => $one['storage_number'], 'id' => $one['size_id']) : $allSizeList[$sizeName];
|
|
|
|
|
|
$colorNum += intval($one['storage_number']);
|
|
|
|
...
|
...
|
@@ -960,7 +970,8 @@ class CartModel |
|
|
$result['count'] = $data['shopping_cart_data']['selected_goods_count'];
|
|
|
$result['isAllSelected'] = ($data['shopping_cart_data']['goods_count'] === $data['shopping_cart_data']['selected_goods_count']) && ($data['shopping_cart_data']['selected_goods_count'] > 0);
|
|
|
$result['sumPrice'] = Helpers::transPrice($data['shopping_cart_data']['last_order_amount']);
|
|
|
} while (0);
|
|
|
}
|
|
|
while (0);
|
|
|
|
|
|
return $result;
|
|
|
}
|
...
|
...
|
@@ -978,14 +989,13 @@ class CartModel |
|
|
$result['price'] = $orderInfo['data']['payment_amount'];
|
|
|
}
|
|
|
}
|
|
|
$param = array('order_code'=>$orderCode);
|
|
|
$result['guang'] = Helpers::url('','','guang');
|
|
|
$result['orderDetail'] = Helpers::url('/home/orderDetail',$param);
|
|
|
$param = array('order_code' => $orderCode);
|
|
|
$result['guang'] = Helpers::url('', '', 'guang');
|
|
|
$result['orderDetail'] = Helpers::url('/home/orderDetail', $param);
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* jit拆单数据(结算页和订单详情页)
|
|
|
* @param type $uid 用户uid
|
...
|
...
|
@@ -1004,20 +1014,21 @@ class CartModel |
|
|
$result = array('jitDetailPage' => true, 'packages' => array());
|
|
|
if ($cartType) {
|
|
|
//购物车中结算页拆单
|
|
|
if(isset($deliveryId) && !empty($deliveryId)){
|
|
|
if (isset($deliveryId) && !empty($deliveryId)) {
|
|
|
//购物车选择改变字段,重新运算订单数据
|
|
|
$newcar = CartData::orderCompute($uid, $cartType, $deliveryId, $paymentType, $paymentType, $couponCode, $yohoCoin, $skuList);
|
|
|
if(isset($newcar['data']['package_list'])){
|
|
|
$packageList = $newcar['data']['package_list'];
|
|
|
$result['returnUrl'] = Helpers::url('/cart/index/orderEnsure', array('cartType' => $cartType));
|
|
|
$newcar = CartData::orderCompute($uid, $cartType, $deliveryId, $paymentType, $paymentType, $couponCode, $yohoCoin, $skuList);
|
|
|
if (isset($newcar['data']['package_list'])) {
|
|
|
$packageList = $newcar['data']['package_list'];
|
|
|
$result['returnUrl'] = Helpers::url('/cart/index/orderEnsure', array('cartType' => $cartType));
|
|
|
}
|
|
|
}else{
|
|
|
}
|
|
|
else {
|
|
|
$carpay = CartData::cartPay($uid, $cartType, 0, $skuList);
|
|
|
if (isset($carpay['data']['shopping_cart_data']['package_list'])) {
|
|
|
$packageList = $carpay['data']['shopping_cart_data']['package_list'];
|
|
|
//返回地址跳转
|
|
|
$result['returnUrl'] = Helpers::url('/cart/index/orderEnsure', array('cartType' => $cartType));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else {
|
...
|
...
|
@@ -1026,7 +1037,7 @@ class CartModel |
|
|
if (isset($carpay['data']['package_list'])) {
|
|
|
$packageList = $carpay['data']['package_list'];
|
|
|
//返回地址跳转
|
|
|
$result['returnUrl'] = Helpers::url('/home/orderdetail',array('order_code' => $orderCode));
|
|
|
$result['returnUrl'] = Helpers::url('/home/orderdetail', array('order_code' => $orderCode));
|
|
|
}
|
|
|
}
|
|
|
do {
|
...
|
...
|
@@ -1036,7 +1047,7 @@ class CartModel |
|
|
// 拆单数据
|
|
|
foreach ($packageList as $pk => $pv) {
|
|
|
$result['packages'][$pk]['packageType'] = $pk + 1;
|
|
|
$result['packages'][$pk]['dispatchType'] = ($pv['supplier_id'] == 0) ? '总仓库' : '异地调拨'; //仓库
|
|
|
$result['packages'][$pk]['dispatchType'] = ($pv['supplier_id'] == 0) ? '总仓发货' : '异地调拨'; //仓库
|
|
|
$goodList = $pv['goods_list'];
|
|
|
foreach ($goodList as $glk => $glv) {
|
|
|
$result['packages'][$pk]['goods'][$glk]['thumb'] = Images::getImageUrl($glv['goods_images'], 235, 314);
|
...
|
...
|
@@ -1055,7 +1066,9 @@ class CartModel |
|
|
}
|
|
|
}
|
|
|
$result['packages'][$pk]['expressCost'] = $pv['shopping_cost']; //运费
|
|
|
$result['packages'][$pk]['discount'] = $pv['shopping_cut_cost']; //已优惠
|
|
|
if ($pv['shopping_cut_cost'] != 0) {
|
|
|
$result['packages'][$pk]['discount'] = $pv['shopping_cut_cost']; //已优惠
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
while (false);
|
...
|
...
|
|