...
|
...
|
@@ -63,13 +63,13 @@ class CartModel |
|
|
|
|
|
/* 普通购物车 */
|
|
|
if(isset($cart['ordinary_cart_data'])) {
|
|
|
$result['commonGoodsCount'] = count($cart['ordinary_cart_data']['goods_list']);
|
|
|
$result['commonGoodsCount'] = $cart['ordinary_cart_data']['shopping_cart_data']['goods_count'];
|
|
|
$result['commonCart'] = self::procCartData($cart['ordinary_cart_data']);
|
|
|
}
|
|
|
|
|
|
/* 预售购物车 */
|
|
|
if(isset($cart['advance_cart_data'])) {
|
|
|
$result['presellGoodsCount'] = count($cart['advance_cart_data']['goods_list']);
|
|
|
$result['presellGoodsCount'] = $cart['advance_cart_data']['shopping_cart_data']['goods_count'];
|
|
|
$result['preSellCart'] = self::procCartData($cart['advance_cart_data']);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -330,7 +330,7 @@ class CartModel |
|
|
// cookie保存的数据
|
|
|
if (!empty($cookieData)) {
|
|
|
$orderInfo = json_decode($cookieData, true);
|
|
|
// $orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentTypeId'], $orderInfo['couponCode'], $orderInfo['yohoCoin']);
|
|
|
$orderCompute = self::orderCompute($uid, $cartType, $orderInfo['deliveryId'], $orderInfo['paymentTypeId'], $orderInfo['couponCode'], $orderInfo['yohoCoin']);
|
|
|
}
|
|
|
|
|
|
// 根据地址id查询地址信息
|
...
|
...
|
@@ -449,13 +449,24 @@ class CartModel |
|
|
$one = array();
|
|
|
$one['id'] = $inv['invoices_type_id'];
|
|
|
$one['name'] = $inv['invoices_type_name'];
|
|
|
isset($orderInfo['invoiceType']) && $one['id'] == $orderInfo['invoiceType'] && $one['isSelected'] = true;
|
|
|
|
|
|
$result['invoice'][] = $one;
|
|
|
}
|
|
|
|
|
|
// 发票信息需要记录
|
|
|
if (isset($orderInfo['invoice'])) {
|
|
|
$result['needInvoice'] = $orderInfo['invoice'];
|
|
|
$result['invoiceText'] = $orderInfo['invoiceText'];
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
// 留言
|
|
|
isset($orderInfo['msg']) && $result['msg'] = $orderInfo['msg'];
|
|
|
|
|
|
// 优惠券数据
|
|
|
$coupons = array('notUsed' => true);
|
|
|
$coupons = array();
|
|
|
!empty($orderCompute['coupon_amount']) && $coupons['value'] = $orderInfo['couponValue'];
|
|
|
$coupons += self::getCouponList($uid, 0, 1, true);
|
|
|
$result['coupon'] = $coupons;
|
...
|
...
|
@@ -556,17 +567,29 @@ class CartModel |
|
|
* @param int $paymentId 支付方式ID
|
|
|
* @param int $paymentType 支付类型ID
|
|
|
* @param string $remark 留言
|
|
|
* @param string $couponCode 优惠券码
|
|
|
* @param mixed $yohoCoin 使用的YOHO币数量或为空
|
|
|
* @return array 接口返回的数据
|
|
|
*/
|
|
|
public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $yohoCoin)
|
|
|
public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin)
|
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
$orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $yohoCoin);
|
|
|
if ($orderSubRes && isset($orderSubRes['code']) && $orderSubRes['code'] === 200) {
|
|
|
$result = array('code' => 400, 'message' => '出错啦');
|
|
|
|
|
|
if (empty($addressId)) {
|
|
|
$result['code'] = 401;
|
|
|
$result['message'] = '配送地址不能为空';
|
|
|
} elseif (empty($deliveryTime)) {
|
|
|
$result['code'] = 402;
|
|
|
$result['message'] = '请选择配送时间';
|
|
|
} elseif (empty($deliveryWay)) {
|
|
|
$result['code'] = 403;
|
|
|
$result['message'] = '请选择配送方式';
|
|
|
} else {
|
|
|
$orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin);
|
|
|
if ($orderSubRes && isset($orderSubRes['code'])) {
|
|
|
$result = $orderSubRes;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return $result;
|
|
|
}
|
...
|
...
|
@@ -583,26 +606,19 @@ class CartModel |
|
|
$result = array();
|
|
|
|
|
|
$oneGoods = array();
|
|
|
// 购买的商品列表
|
|
|
foreach ($data['goods_list'] as $value) {
|
|
|
$oneGoods['id'] = $value['product_sku'];
|
|
|
$oneGoods['skn'] = $value['product_skn'];
|
|
|
$oneGoods['name'] = $value['product_name'];
|
|
|
$oneGoods['thumb'] = Images::getImageUrl($value['goods_images'], 120, 120);
|
|
|
$oneGoods['color'] = $value['color_name'];
|
|
|
$oneGoods['size'] = $value['size_name'];
|
|
|
$oneGoods['appearDate'] = '12月'; // 目前app接口没有返回该数据
|
|
|
$oneGoods['price'] = $value['real_price'];
|
|
|
$oneGoods['count'] = $value['buy_number'];
|
|
|
$oneGoods['lowStocks'] = true;
|
|
|
// 购买的可用商品列表
|
|
|
$validGoods = Helpers::formatCartGoods($data['goods_list']);
|
|
|
!empty($validGoods) && $result['goods'] = $validGoods;
|
|
|
|
|
|
// 失效商品列表
|
|
|
$notValidGoods = Helpers::formatCartGoods($data['sold_out_goods_list']);
|
|
|
!empty($notValidGoods) && $result['$notValidGoods'] = $notValidGoods;
|
|
|
|
|
|
$result['goods'][] = $oneGoods;
|
|
|
}
|
|
|
// 赠品
|
|
|
(count($data['gift_list']) || count($data['price_gift'])) && $result['freebieOrAdvanceBuy'] = true;
|
|
|
$result['freebie'] = $data['gift_list'];
|
|
|
// 加价购
|
|
|
$result['advanceBuy'] = $data['price_gift'];
|
|
|
$result['advanceBuy'] = Helpers::formatAdvanceGoods($data['price_gift']);
|
|
|
// 结算数据
|
|
|
$result['price'] = $data['shopping_cart_data']['order_amount'];
|
|
|
$result['activityPrice'] = $data['shopping_cart_data']['discount_amount'];
|
...
|
...
|
|