Authored by cailing

订单详情页优惠价修改

@@ -109,7 +109,8 @@ class CartModel @@ -109,7 +109,8 @@ class CartModel
109 /* 预售购物车 */ 109 /* 预售购物车 */
110 $result['presellGoodsCount'] = $advanceCount; 110 $result['presellGoodsCount'] = $advanceCount;
111 $result['preSellCart'] = self::procCartData($cart['advance_cart_data'], $onlyGift, $onlyAdvanceBuy); 111 $result['preSellCart'] = self::procCartData($cart['advance_cart_data'], $onlyGift, $onlyAdvanceBuy);
112 - } while (false); 112 + }
  113 + while (false);
113 114
114 return $result; 115 return $result;
115 } 116 }
@@ -154,7 +155,8 @@ class CartModel @@ -154,7 +155,8 @@ class CartModel
154 $result['code'] = $select['code']; 155 $result['code'] = $select['code'];
155 $result['message'] = $select['message']; 156 $result['message'] = $select['message'];
156 } 157 }
157 - } while (0); 158 + }
  159 + while (0);
158 160
159 return $result; 161 return $result;
160 } 162 }
@@ -173,7 +175,7 @@ class CartModel @@ -173,7 +175,7 @@ class CartModel
173 $result = array('code' => 400, 'message' => '出错啦~'); 175 $result = array('code' => 400, 'message' => '出错啦~');
174 176
175 // 处理sku 177 // 处理sku
176 - $sku_list = json_encode(array(array('product_sku'=>$sku,'buy_number'=>intval($count), 'promotion_id'=>$promotionId))); 178 + $sku_list = json_encode(array(array('product_sku' => $sku, 'buy_number' => intval($count), 'promotion_id' => $promotionId)));
177 $remove = CartData::removeFromCart($uid, $sku_list, $shoppingKey); 179 $remove = CartData::removeFromCart($uid, $sku_list, $shoppingKey);
178 if ($remove && isset($remove['code'])) { 180 if ($remove && isset($remove['code'])) {
179 $result['code'] = $remove['code']; 181 $result['code'] = $remove['code'];
@@ -277,7 +279,8 @@ class CartModel @@ -277,7 +279,8 @@ class CartModel
277 $result['code'] = $modify['code']; 279 $result['code'] = $modify['code'];
278 $result['message'] = $modify['message']; 280 $result['message'] = $modify['message'];
279 } 281 }
280 - } while (0); 282 + }
  283 + while (0);
281 284
282 return $result; 285 return $result;
283 } 286 }
@@ -307,7 +310,8 @@ class CartModel @@ -307,7 +310,8 @@ class CartModel
307 $result['code'] = $modify['code']; 310 $result['code'] = $modify['code'];
308 $result['message'] = $modify['message']; 311 $result['message'] = $modify['message'];
309 } 312 }
310 - } while (0); 313 + }
  314 + while (0);
311 315
312 return $result; 316 return $result;
313 } 317 }
@@ -350,7 +354,8 @@ class CartModel @@ -350,7 +354,8 @@ class CartModel
350 if ($isLimitGoods) { 354 if ($isLimitGoods) {
351 $result['error'] = true; 355 $result['error'] = true;
352 $result['message'] = $pay['message']; 356 $result['message'] = $pay['message'];
353 - } else { 357 + }
  358 + else {
354 $result['cartUrl'] = Helpers::url('/cart/index/index'); 359 $result['cartUrl'] = Helpers::url('/cart/index/index');
355 } 360 }
356 361
@@ -376,7 +381,7 @@ class CartModel @@ -376,7 +381,7 @@ class CartModel
376 } 381 }
377 382
378 // 收货人有关信息 383 // 收货人有关信息
379 - $isSunfengSupport = false;// 是否支持顺丰快递 384 + $isSunfengSupport = false; // 是否支持顺丰快递
380 if (isset($payReturn['delivery_address']) && !empty($payReturn['delivery_address'])) { 385 if (isset($payReturn['delivery_address']) && !empty($payReturn['delivery_address'])) {
381 $result['addressId'] = isset($address['address_id']) ? $address['address_id'] : $payReturn['delivery_address']['address_id']; 386 $result['addressId'] = isset($address['address_id']) ? $address['address_id'] : $payReturn['delivery_address']['address_id'];
382 $result['name'] = isset($address['consignee']) ? $address['consignee'] : $payReturn['delivery_address']['consignee']; 387 $result['name'] = isset($address['consignee']) ? $address['consignee'] : $payReturn['delivery_address']['consignee'];
@@ -442,7 +447,8 @@ class CartModel @@ -442,7 +447,8 @@ class CartModel
442 if (isset($orderInfo['deliveryTimeId'])) { 447 if (isset($orderInfo['deliveryTimeId'])) {
443 $flag = array_search($orderInfo['deliveryTimeId'], $idArr); 448 $flag = array_search($orderInfo['deliveryTimeId'], $idArr);
444 $flag !== false && $result['dispatchTime'][$flag]['isSelected'] = true; 449 $flag !== false && $result['dispatchTime'][$flag]['isSelected'] = true;
445 - } else { 450 + }
  451 + else {
446 $result['dispatchTime'][$defaultKey]['isSelected'] = true; 452 $result['dispatchTime'][$defaultKey]['isSelected'] = true;
447 } 453 }
448 } 454 }
@@ -466,7 +472,8 @@ class CartModel @@ -466,7 +472,8 @@ class CartModel
466 if ($single['goods_type'] == 'gift' && !isset($single['isAdvanceBuy'])) { 472 if ($single['goods_type'] == 'gift' && !isset($single['isAdvanceBuy'])) {
467 $oneGoods['gift'] = true; 473 $oneGoods['gift'] = true;
468 $oneGoods['price'] = Helpers::transPrice($single['sale_price']); 474 $oneGoods['price'] = Helpers::transPrice($single['sale_price']);
469 - } elseif ($single['goods_type'] == 'price_gift') { 475 + }
  476 + elseif ($single['goods_type'] == 'price_gift') {
470 $oneGoods['advanceBuy'] = true; 477 $oneGoods['advanceBuy'] = true;
471 $oneGoods['price'] = Helpers::transPrice($single['sale_price']); 478 $oneGoods['price'] = Helpers::transPrice($single['sale_price']);
472 } 479 }
@@ -524,11 +531,11 @@ class CartModel @@ -524,11 +531,11 @@ class CartModel
524 if ($payReturn['shopping_cart_data']['is_multi_package'] == 'Y') { 531 if ($payReturn['shopping_cart_data']['is_multi_package'] == 'Y') {
525 $result['isJit'] = true; 532 $result['isJit'] = true;
526 $jitInfo = array(); 533 $jitInfo = array();
527 - if(!empty($orderInfo)){  
528 - $jitInfo = array('deliveryId' => $orderInfo['deliveryId'], 'paymentType'=> $orderInfo['paymentType'], 'couponCode' => $orderInfo['couponCode'], 'yohoCoin' => $orderInfo['yohoCoin']); 534 + if (!empty($orderInfo)) {
  535 + $jitInfo = array('deliveryId' => $orderInfo['deliveryId'], 'paymentType' => $orderInfo['paymentType'], 'couponCode' => $orderInfo['couponCode'], 'yohoCoin' => $orderInfo['yohoCoin']);
529 } 536 }
530 //传递相关参数 537 //传递相关参数
531 - $param =array_merge(array('cartType' => $cartType, 'skuList' => $skuList), $jitInfo); 538 + $param = array_merge(array('cartType' => $cartType, 'skuList' => $skuList), $jitInfo);
532 $result['jitDetailUrl'] = Helpers::url('/cart/index/jitDetail', $param); 539 $result['jitDetailUrl'] = Helpers::url('/cart/index/jitDetail', $param);
533 } 540 }
534 $result['cartPayData'] = isset($orderCompute['promotion_formula_list']) ? $orderCompute['promotion_formula_list'] : $payReturn['shopping_cart_data']['promotion_formula_list']; 541 $result['cartPayData'] = isset($orderCompute['promotion_formula_list']) ? $orderCompute['promotion_formula_list'] : $payReturn['shopping_cart_data']['promotion_formula_list'];
@@ -571,8 +578,8 @@ class CartModel @@ -571,8 +578,8 @@ class CartModel
571 $coupons['couponName'] = $orderInfo['couponName']; 578 $coupons['couponName'] = $orderInfo['couponName'];
572 } 579 }
573 $result['coupon'] = $coupons; 580 $result['coupon'] = $coupons;
574 -  
575 - } while (false); 581 + }
  582 + while (false);
576 583
577 return $result; 584 return $result;
578 } 585 }
@@ -643,7 +650,8 @@ class CartModel @@ -643,7 +650,8 @@ class CartModel
643 if ($coupon && isset($coupon['code'])) { 650 if ($coupon && isset($coupon['code'])) {
644 $result = $coupon; 651 $result = $coupon;
645 } 652 }
646 - } while (0); 653 + }
  654 + while (0);
647 655
648 return $result; 656 return $result;
649 } 657 }
@@ -671,7 +679,8 @@ class CartModel @@ -671,7 +679,8 @@ class CartModel
671 $result['notAvailableCoupons'] = self::procCouponsData($coupons['data']['unusable_coupons']); 679 $result['notAvailableCoupons'] = self::procCouponsData($coupons['data']['unusable_coupons']);
672 // 可用优惠券 680 // 可用优惠券
673 $result['coupons'] = self::procCouponsData($coupons['data']['usable_coupons']); 681 $result['coupons'] = self::procCouponsData($coupons['data']['usable_coupons']);
674 - } while (false); 682 + }
  683 + while (false);
675 684
676 return $result; 685 return $result;
677 } 686 }
@@ -727,13 +736,16 @@ class CartModel @@ -727,13 +736,16 @@ class CartModel
727 if (empty($addressId)) { 736 if (empty($addressId)) {
728 $result['code'] = 401; 737 $result['code'] = 401;
729 $result['message'] = '配送地址不能为空'; 738 $result['message'] = '配送地址不能为空';
730 - } elseif (empty($deliveryTime)) { 739 + }
  740 + elseif (empty($deliveryTime)) {
731 $result['code'] = 402; 741 $result['code'] = 402;
732 $result['message'] = '请选择配送时间'; 742 $result['message'] = '请选择配送时间';
733 - } elseif (empty($deliveryWay)) { 743 + }
  744 + elseif (empty($deliveryWay)) {
734 $result['code'] = 403; 745 $result['code'] = 403;
735 $result['message'] = '请选择配送方式'; 746 $result['message'] = '请选择配送方式';
736 - } else { 747 + }
  748 + else {
737 $orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $qhyUnio, $userAgent); 749 $orderSubRes = CartData::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList, $qhyUnio, $userAgent);
738 if ($orderSubRes && isset($orderSubRes['code'])) { 750 if ($orderSubRes && isset($orderSubRes['code'])) {
739 $result = $orderSubRes; 751 $result = $orderSubRes;
@@ -758,8 +770,8 @@ class CartModel @@ -758,8 +770,8 @@ class CartModel
758 if (isset($productData['special_price'])) { // 加价购或者赠品的销售价字段 770 if (isset($productData['special_price'])) { // 加价购或者赠品的销售价字段
759 $data['price'] = $productData['format_market_price']; 771 $data['price'] = $productData['format_market_price'];
760 $data['salePrice'] = $productData['format_sales_price']; 772 $data['salePrice'] = $productData['format_sales_price'];
761 -  
762 - } else { // 购物车商品的销售价字段 773 + }
  774 + else { // 购物车商品的销售价字段
763 $data['price'] = $productData['market_price'] > $productData['sales_price'] ? $productData['format_market_price'] : false; 775 $data['price'] = $productData['market_price'] > $productData['sales_price'] ? $productData['format_market_price'] : false;
764 $data['salePrice'] = '¥' . Helpers::transPrice($productData['sales_price']); 776 $data['salePrice'] = '¥' . Helpers::transPrice($productData['sales_price']);
765 } 777 }
@@ -810,9 +822,7 @@ class CartModel @@ -810,9 +822,7 @@ class CartModel
810 $sizeList[$val['product_skc']][] = $oneSize; 822 $sizeList[$val['product_skc']][] = $oneSize;
811 823
812 // 所有尺码列表,赋值用于前端展示默认尺码的时候 判断出没有库存则显示灰色 824 // 所有尺码列表,赋值用于前端展示默认尺码的时候 判断出没有库存则显示灰色
813 - $allSizeList[$sizeName] = empty($allSizeList[$sizeName]['storage'])  
814 - ? array('storage' => $one['storage_number'], 'id' => $one['size_id'])  
815 - : $allSizeList[$sizeName]; 825 + $allSizeList[$sizeName] = empty($allSizeList[$sizeName]['storage']) ? array('storage' => $one['storage_number'], 'id' => $one['size_id']) : $allSizeList[$sizeName];
816 826
817 $colorNum += intval($one['storage_number']); 827 $colorNum += intval($one['storage_number']);
818 828
@@ -960,7 +970,8 @@ class CartModel @@ -960,7 +970,8 @@ class CartModel
960 $result['count'] = $data['shopping_cart_data']['selected_goods_count']; 970 $result['count'] = $data['shopping_cart_data']['selected_goods_count'];
961 $result['isAllSelected'] = ($data['shopping_cart_data']['goods_count'] === $data['shopping_cart_data']['selected_goods_count']) && ($data['shopping_cart_data']['selected_goods_count'] > 0); 971 $result['isAllSelected'] = ($data['shopping_cart_data']['goods_count'] === $data['shopping_cart_data']['selected_goods_count']) && ($data['shopping_cart_data']['selected_goods_count'] > 0);
962 $result['sumPrice'] = Helpers::transPrice($data['shopping_cart_data']['last_order_amount']); 972 $result['sumPrice'] = Helpers::transPrice($data['shopping_cart_data']['last_order_amount']);
963 - } while (0); 973 + }
  974 + while (0);
964 975
965 return $result; 976 return $result;
966 } 977 }
@@ -978,14 +989,13 @@ class CartModel @@ -978,14 +989,13 @@ class CartModel
978 $result['price'] = $orderInfo['data']['payment_amount']; 989 $result['price'] = $orderInfo['data']['payment_amount'];
979 } 990 }
980 } 991 }
981 - $param = array('order_code'=>$orderCode);  
982 - $result['guang'] = Helpers::url('','','guang');  
983 - $result['orderDetail'] = Helpers::url('/home/orderDetail',$param); 992 + $param = array('order_code' => $orderCode);
  993 + $result['guang'] = Helpers::url('', '', 'guang');
  994 + $result['orderDetail'] = Helpers::url('/home/orderDetail', $param);
984 995
985 return $result; 996 return $result;
986 } 997 }
987 998
988 -  
989 /** 999 /**
990 * jit拆单数据(结算页和订单详情页) 1000 * jit拆单数据(结算页和订单详情页)
991 * @param type $uid 用户uid 1001 * @param type $uid 用户uid
@@ -1004,14 +1014,15 @@ class CartModel @@ -1004,14 +1014,15 @@ class CartModel
1004 $result = array('jitDetailPage' => true, 'packages' => array()); 1014 $result = array('jitDetailPage' => true, 'packages' => array());
1005 if ($cartType) { 1015 if ($cartType) {
1006 //购物车中结算页拆单 1016 //购物车中结算页拆单
1007 - if(isset($deliveryId) && !empty($deliveryId)){ 1017 + if (isset($deliveryId) && !empty($deliveryId)) {
1008 //购物车选择改变字段,重新运算订单数据 1018 //购物车选择改变字段,重新运算订单数据
1009 $newcar = CartData::orderCompute($uid, $cartType, $deliveryId, $paymentType, $paymentType, $couponCode, $yohoCoin, $skuList); 1019 $newcar = CartData::orderCompute($uid, $cartType, $deliveryId, $paymentType, $paymentType, $couponCode, $yohoCoin, $skuList);
1010 - if(isset($newcar['data']['package_list'])){ 1020 + if (isset($newcar['data']['package_list'])) {
1011 $packageList = $newcar['data']['package_list']; 1021 $packageList = $newcar['data']['package_list'];
1012 $result['returnUrl'] = Helpers::url('/cart/index/orderEnsure', array('cartType' => $cartType)); 1022 $result['returnUrl'] = Helpers::url('/cart/index/orderEnsure', array('cartType' => $cartType));
1013 } 1023 }
1014 - }else{ 1024 + }
  1025 + else {
1015 $carpay = CartData::cartPay($uid, $cartType, 0, $skuList); 1026 $carpay = CartData::cartPay($uid, $cartType, 0, $skuList);
1016 if (isset($carpay['data']['shopping_cart_data']['package_list'])) { 1027 if (isset($carpay['data']['shopping_cart_data']['package_list'])) {
1017 $packageList = $carpay['data']['shopping_cart_data']['package_list']; 1028 $packageList = $carpay['data']['shopping_cart_data']['package_list'];
@@ -1026,7 +1037,7 @@ class CartModel @@ -1026,7 +1037,7 @@ class CartModel
1026 if (isset($carpay['data']['package_list'])) { 1037 if (isset($carpay['data']['package_list'])) {
1027 $packageList = $carpay['data']['package_list']; 1038 $packageList = $carpay['data']['package_list'];
1028 //返回地址跳转 1039 //返回地址跳转
1029 - $result['returnUrl'] = Helpers::url('/home/orderdetail',array('order_code' => $orderCode)); 1040 + $result['returnUrl'] = Helpers::url('/home/orderdetail', array('order_code' => $orderCode));
1030 } 1041 }
1031 } 1042 }
1032 do { 1043 do {
@@ -1055,9 +1066,11 @@ class CartModel @@ -1055,9 +1066,11 @@ class CartModel
1055 } 1066 }
1056 } 1067 }
1057 $result['packages'][$pk]['expressCost'] = $pv['shopping_cost']; //运费 1068 $result['packages'][$pk]['expressCost'] = $pv['shopping_cost']; //运费
  1069 + if ($pv['shopping_cut_cost'] != 0) {
1058 $result['packages'][$pk]['discount'] = $pv['shopping_cut_cost']; //已优惠 1070 $result['packages'][$pk]['discount'] = $pv['shopping_cut_cost']; //已优惠
1059 } 1071 }
1060 } 1072 }
  1073 + }
1061 while (false); 1074 while (false);
1062 return $result; 1075 return $result;
1063 } 1076 }