Authored by biao

resolve conflict

... ... @@ -10,7 +10,7 @@ use Plugin\Helpers;
/**
* Description of Order
*
*
*/
class OrderModel
{
... ... @@ -21,7 +21,7 @@ class OrderModel
/**
* 订单相关数据处理
*
*
* payment_type:
'1' => array(//在线支付
0 => '待付款',
... ... @@ -98,7 +98,7 @@ class OrderModel
/**
* 查看物流
*
*
* @param int $orderCode 订单编号
* @param int $uid 用户ID
* @return array
... ... @@ -185,7 +185,7 @@ class OrderModel
/**
* 获取订单详情信息
*
*
* @param string $orderCode 订单号
* @param int $uid 用户ID
* @param string $sessionKey 用户的会话
... ... @@ -197,6 +197,7 @@ class OrderModel
if (is_numeric($orderCode) && is_numeric($uid) && is_string($sessionKey)) {
$orderDetail = OrderData::viewOrderData($orderCode, $uid, $sessionKey);
print_r($orderDetail);
if (isset($orderDetail['data']['order_code'])) {
$count = 0;
... ... @@ -252,7 +253,7 @@ class OrderModel
/**
* 获取订单状态
*
*
* @param array $order 订单
* @param bool $showLogistics 控制是否显示物流信息
* @return array
... ... @@ -361,4 +362,85 @@ class OrderModel
}
}
/**
* 获取拆单信息数据
* @param type $uid 用户id
* @param type $cartType 购物车类型
* @param type $skuList 商品信息
* @return boolean
*/
public static function getPackageInfo($orderCode, $uid, $sessionKey)
{
$result = array();
$carpay = OrderData::viewOrderData($orderCode, $uid, $sessionKey);
// print_r($carpay);
do {
// if (!$carpay || $carpay['code'] != 200 || empty($carpay['data']['package_list'])) {
// break;
// }
// $package = $carpay['data'];
// // 拆单数据
// if (isset($package['package_list']) && !empty($package['package_list'])) {
// $result['jitDetailPage'] = true;
// $packageList = $package['data']['package_list'];
// foreach ($packageList as $pk => $pv) {
// $result['packages'][$pk]['packageType'] = $pk + 1;
// $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);
// $tag = isset($glv['goods_type']) ? $glv['goods_type'] : '';
// switch ($tag) {
// case 'price_gift' :
// //加价购
// $result['packages'][$pk]['goods'][$glk]['isAdd'] = true;
// break;
// case 'gift' :
// //赠品
// $result['packages'][$pk]['goods'][$glk]['isGift'] = true;
// break;
// default:
// break;
// }
// }
// $result['packages'][$pk]['expressCost'] = $pv['shopping_cost'];//运费
// $result['packages'][$pk]['discount'] = $pv['shopping_cut_cost'];//已优惠
// }
// }
if (!$carpay || $carpay['code'] != 200 || empty($carpay['data']['shopping_cart_data'])) {
break;
}
$package = $carpay['data'];
// 拆单数据
if (isset($package['shopping_cart_data']) && !empty($package['shopping_cart_data'])) {
$result['jitDetailPage'] = true;
$packageList = $package['shopping_cart_data']['package_list'];
foreach ($packageList as $pk => $pv) {
$result['packages'][$pk]['packageType'] = $pk + 1;
$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);
$tag = isset($glv['goods_type']) ? $glv['goods_type'] : '';
switch ($tag) {
case 'price_gift' :
//加价购
$result['packages'][$pk]['goods'][$glk]['isAdd'] = true;
break;
case 'gift' :
//赠品
$result['packages'][$pk]['goods'][$glk]['isGift'] = true;
break;
default:
break;
}
}
$result['packages'][$pk]['expressCost'] = $pv['shopping_cost']; //运费
$result['packages'][$pk]['discount'] = $pv['shopping_cut_cost']; //已优惠
}
}
}
while (false);
return $result;
}
}
... ...
... ... @@ -415,10 +415,10 @@ class CartModel
$oneDeliv['isSelected'] = true;
$isDeliveryId = false;
}
$result['dispatchMode'][$key] = $oneDeliv;
}
if ($isDeliveryId) {
$result['dispatchMode'][$defaultKey]['isSelected'] = true;
}
... ... @@ -490,7 +490,7 @@ class CartModel
if ($pay['is_support'] !== 'Y') {
continue;
}
$onePay = array();
$onePay['id'] = $pay['payment_id'];
$onePay['paymentType'] = $pay['payment_type'];
... ... @@ -504,7 +504,7 @@ class CartModel
$result['paymentWay'][] = $onePay;
}
//默认第一个
if ($isPaymentType) {
$result['paymentWay'][0]['recommend'] = true;
... ... @@ -521,6 +521,14 @@ class CartModel
// 订单数据
if (isset($payReturn['shopping_cart_data']) && !empty($payReturn['shopping_cart_data'])) {
//判断是否为JIT商品
if ($payReturn['shopping_cart_data']['is_multi_package'] == 'Y') {
$result['isJit'] = true;
$result['jitDetailUrl'] = Helpers::url('/cart/index/jitDetail', array('cartType' => $cartType, 'skuList' => $skuList));
}
//测试
// $result['isJit'] = true;
// $result['jitDetailUrl'] = Helpers::url('/cart/index/jitDetail', array('cartType' => $cartType, 'skuList' => $skuList));
$result['cartPayData'] = isset($orderCompute['promotion_formula_list']) ? $orderCompute['promotion_formula_list'] : $payReturn['shopping_cart_data']['promotion_formula_list'];
$price = isset($orderCompute['last_order_amount']) ? $orderCompute['last_order_amount'] : $payReturn['shopping_cart_data']['last_order_amount'];
$result['price'] = Helpers::transPrice($price, true);
... ...
... ... @@ -521,4 +521,34 @@ class IndexController extends AbstractAction
$this->echoJson($result);
}
/**
* jit拆单/配送信息
*
*
*/
public function jitDetailAction()
{
$data = array();
$uid = $this->getUid(true);
$cartType = $this->get('cartType', ''); //购物车类型
$skuList = $this->get('skuList', ''); //cookie中记录的一些订单有关数据
$orderCode = $this->get('orderCode', ''); //订单号
$sessionKey = $this->get('sessionKey', ''); //用户会话
if ($cartType) {
//购物车
$data = CartModel::getPackageInfo($uid, $cartType, $skuList);
}else{
//订单列表
$data = OrderModel::getPackageInfo($orderCode, $uid, $sessionKey);
}
// 返回地址
$returnUrl = Helpers::url('/home/orders');
$this->setTitle('配送信息');
$this->setNavHeader('配送信息', $returnUrl, false); // 不显示右上角home按钮
$this->_view->display('jit-detail', $data);
}
}
... ...