Authored by biao

resolve conflict

@@ -197,6 +197,7 @@ class OrderModel @@ -197,6 +197,7 @@ class OrderModel
197 197
198 if (is_numeric($orderCode) && is_numeric($uid) && is_string($sessionKey)) { 198 if (is_numeric($orderCode) && is_numeric($uid) && is_string($sessionKey)) {
199 $orderDetail = OrderData::viewOrderData($orderCode, $uid, $sessionKey); 199 $orderDetail = OrderData::viewOrderData($orderCode, $uid, $sessionKey);
  200 + print_r($orderDetail);
200 if (isset($orderDetail['data']['order_code'])) { 201 if (isset($orderDetail['data']['order_code'])) {
201 $count = 0; 202 $count = 0;
202 203
@@ -361,4 +362,85 @@ class OrderModel @@ -361,4 +362,85 @@ class OrderModel
361 } 362 }
362 } 363 }
363 364
  365 + /**
  366 + * 获取拆单信息数据
  367 + * @param type $uid 用户id
  368 + * @param type $cartType 购物车类型
  369 + * @param type $skuList 商品信息
  370 + * @return boolean
  371 + */
  372 + public static function getPackageInfo($orderCode, $uid, $sessionKey)
  373 + {
  374 + $result = array();
  375 + $carpay = OrderData::viewOrderData($orderCode, $uid, $sessionKey);
  376 +// print_r($carpay);
  377 + do {
  378 +// if (!$carpay || $carpay['code'] != 200 || empty($carpay['data']['package_list'])) {
  379 +// break;
  380 +// }
  381 +// $package = $carpay['data'];
  382 +// // 拆单数据
  383 +// if (isset($package['package_list']) && !empty($package['package_list'])) {
  384 +// $result['jitDetailPage'] = true;
  385 +// $packageList = $package['data']['package_list'];
  386 +// foreach ($packageList as $pk => $pv) {
  387 +// $result['packages'][$pk]['packageType'] = $pk + 1;
  388 +// $result['packages'][$pk]['dispatchType'] = ($pv['supplier_id'] == 0) ? '总仓库' : '异地调拨'; //仓库
  389 +// $goodList = $pv['goods_list'];
  390 +// foreach ($goodList as $glk => $glv) {
  391 +// $result['packages'][$pk]['goods'][$glk]['thumb'] = Images::getImageUrl($glv['goods_images'], 235, 314);
  392 +// $tag = isset($glv['goods_type']) ? $glv['goods_type'] : '';
  393 +// switch ($tag) {
  394 +// case 'price_gift' :
  395 +// //加价购
  396 +// $result['packages'][$pk]['goods'][$glk]['isAdd'] = true;
  397 +// break;
  398 +// case 'gift' :
  399 +// //赠品
  400 +// $result['packages'][$pk]['goods'][$glk]['isGift'] = true;
  401 +// break;
  402 +// default:
  403 +// break;
  404 +// }
  405 +// }
  406 +// $result['packages'][$pk]['expressCost'] = $pv['shopping_cost'];//运费
  407 +// $result['packages'][$pk]['discount'] = $pv['shopping_cut_cost'];//已优惠
  408 +// }
  409 +// }
  410 + if (!$carpay || $carpay['code'] != 200 || empty($carpay['data']['shopping_cart_data'])) {
  411 + break;
  412 + }
  413 + $package = $carpay['data'];
  414 + // 拆单数据
  415 + if (isset($package['shopping_cart_data']) && !empty($package['shopping_cart_data'])) {
  416 + $result['jitDetailPage'] = true;
  417 + $packageList = $package['shopping_cart_data']['package_list'];
  418 + foreach ($packageList as $pk => $pv) {
  419 + $result['packages'][$pk]['packageType'] = $pk + 1;
  420 + $result['packages'][$pk]['dispatchType'] = ($pv['supplier_id'] == 0) ? '总仓库' : '异地调拨'; //仓库
  421 + $goodList = $pv['goods_list'];
  422 + foreach ($goodList as $glk => $glv) {
  423 + $result['packages'][$pk]['goods'][$glk]['thumb'] = Images::getImageUrl($glv['goods_images'], 235, 314);
  424 + $tag = isset($glv['goods_type']) ? $glv['goods_type'] : '';
  425 + switch ($tag) {
  426 + case 'price_gift' :
  427 + //加价购
  428 + $result['packages'][$pk]['goods'][$glk]['isAdd'] = true;
  429 + break;
  430 + case 'gift' :
  431 + //赠品
  432 + $result['packages'][$pk]['goods'][$glk]['isGift'] = true;
  433 + break;
  434 + default:
  435 + break;
  436 + }
  437 + }
  438 + $result['packages'][$pk]['expressCost'] = $pv['shopping_cost']; //运费
  439 + $result['packages'][$pk]['discount'] = $pv['shopping_cut_cost']; //已优惠
  440 + }
  441 + }
  442 + }
  443 + while (false);
  444 + return $result;
  445 + }
364 } 446 }
@@ -521,6 +521,14 @@ class CartModel @@ -521,6 +521,14 @@ class CartModel
521 521
522 // 订单数据 522 // 订单数据
523 if (isset($payReturn['shopping_cart_data']) && !empty($payReturn['shopping_cart_data'])) { 523 if (isset($payReturn['shopping_cart_data']) && !empty($payReturn['shopping_cart_data'])) {
  524 + //判断是否为JIT商品
  525 + if ($payReturn['shopping_cart_data']['is_multi_package'] == 'Y') {
  526 + $result['isJit'] = true;
  527 + $result['jitDetailUrl'] = Helpers::url('/cart/index/jitDetail', array('cartType' => $cartType, 'skuList' => $skuList));
  528 + }
  529 + //测试
  530 +// $result['isJit'] = true;
  531 +// $result['jitDetailUrl'] = Helpers::url('/cart/index/jitDetail', array('cartType' => $cartType, 'skuList' => $skuList));
524 $result['cartPayData'] = isset($orderCompute['promotion_formula_list']) ? $orderCompute['promotion_formula_list'] : $payReturn['shopping_cart_data']['promotion_formula_list']; 532 $result['cartPayData'] = isset($orderCompute['promotion_formula_list']) ? $orderCompute['promotion_formula_list'] : $payReturn['shopping_cart_data']['promotion_formula_list'];
525 $price = isset($orderCompute['last_order_amount']) ? $orderCompute['last_order_amount'] : $payReturn['shopping_cart_data']['last_order_amount']; 533 $price = isset($orderCompute['last_order_amount']) ? $orderCompute['last_order_amount'] : $payReturn['shopping_cart_data']['last_order_amount'];
526 $result['price'] = Helpers::transPrice($price, true); 534 $result['price'] = Helpers::transPrice($price, true);
@@ -521,4 +521,34 @@ class IndexController extends AbstractAction @@ -521,4 +521,34 @@ class IndexController extends AbstractAction
521 $this->echoJson($result); 521 $this->echoJson($result);
522 } 522 }
523 523
  524 + /**
  525 + * jit拆单/配送信息
  526 + *
  527 + *
  528 + */
  529 + public function jitDetailAction()
  530 + {
  531 + $data = array();
  532 +
  533 + $uid = $this->getUid(true);
  534 + $cartType = $this->get('cartType', ''); //购物车类型
  535 + $skuList = $this->get('skuList', ''); //cookie中记录的一些订单有关数据
  536 + $orderCode = $this->get('orderCode', ''); //订单号
  537 + $sessionKey = $this->get('sessionKey', ''); //用户会话
  538 + if ($cartType) {
  539 + //购物车
  540 + $data = CartModel::getPackageInfo($uid, $cartType, $skuList);
  541 + }else{
  542 + //订单列表
  543 + $data = OrderModel::getPackageInfo($orderCode, $uid, $sessionKey);
  544 + }
  545 + // 返回地址
  546 + $returnUrl = Helpers::url('/home/orders');
  547 +
  548 +
  549 + $this->setTitle('配送信息');
  550 + $this->setNavHeader('配送信息', $returnUrl, false); // 不显示右上角home按钮
  551 + $this->_view->display('jit-detail', $data);
  552 + }
  553 +
524 } 554 }