Authored by biao

resolve conflict

... ... @@ -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;
... ... @@ -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;
}
}
... ...
... ... @@ -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);
}
}
... ...