...
|
...
|
@@ -28,7 +28,7 @@ class OrderModel |
|
|
* 订单相关数据处理
|
|
|
*/
|
|
|
|
|
|
static function getOrder($type = 1, $page = 1, $limit, $gender, $yh_channel, $uid) {
|
|
|
static function getOrder($type, $page, $limit, $uid) {
|
|
|
$result = array();
|
|
|
if (USE_CACHE) {
|
|
|
$key = CacheConfig::KEY_ACTION_HOME_ORDER_ORDER;
|
...
|
...
|
@@ -39,65 +39,28 @@ class OrderModel |
|
|
}
|
|
|
}
|
|
|
//调用接口获得数据
|
|
|
$data = OrderData::getOrderData($type, $page, $limit, $gender, $yh_channel, $uid);
|
|
|
$data = OrderData::getOrderData($type, $page, $limit, $uid);
|
|
|
print_r($data);
|
|
|
//检查数据返回是否正常,正常则处理数据
|
|
|
if ($data['code'] == 200 && isset($data['data'])) {
|
|
|
foreach ($data['data']['order_list'] as $key => $vo) {
|
|
|
//订单号,支付状态,订单商品数量,订单总价格(订单总价加上运费)
|
|
|
$result[$key]['orderNum'] = $vo['order_code'];
|
|
|
$result[$key]['orderStatus'] = $vo['status_str'];
|
|
|
$result[$key]['count'] = count($vo['order_goods']);
|
|
|
$result[$key]['sumCost'] = $vo['amount'] + $vo['shipping_cost'];
|
|
|
//类内调用格式化订单商品数据方法
|
|
|
$result[$key]['goods'] = self::formatOrderGoods($vo['order_goods']);
|
|
|
//根据订单status判断订单处于什么状态。
|
|
|
do {
|
|
|
//订单取消状态 = Y 时,跳出判断订单状态循环,并设置订单状态为已取消。
|
|
|
if ($vo['is_cancel'] === 'Y') {
|
|
|
$result[$key]['canceled'] = true;
|
|
|
break;
|
|
|
}
|
|
|
/* 先判断订单付款方式,根据不同的付款方式计算订单状态。(注:货到付款没有待付款状态)
|
|
|
* 付款方式:1 => 在线支付,2 => 货到付款,3 => 现金支付,4 => 抵消支付;
|
|
|
*/
|
|
|
//支付方式为非货到付款时,计算订单状态。
|
|
|
if ($vo['payment_type'] != 2) {
|
|
|
if (!empty($data[0])) {
|
|
|
$result = array();
|
|
|
foreach($data as $key => $vo){
|
|
|
$result[$key]['detailUrl'] = $vo[''];
|
|
|
$result[$key]['orderNum'] = $vo['orderCode'];
|
|
|
$result[$key]['orderStatus'] = $vo['status'];
|
|
|
$result[$key]['count'] = count($vo['ordersGoodsList']);
|
|
|
$result[$key]['sumCost'] = $vo['amount'];
|
|
|
$result[$key]['sumCost'] = $vo['amount'];
|
|
|
switch ($vo['status']) {
|
|
|
case 0:
|
|
|
$result[$key]['unpaid'] = true;
|
|
|
break;
|
|
|
//未发货&未收货 状态,统一合并到待收货状态。
|
|
|
case 1:
|
|
|
case 2:
|
|
|
case 3:
|
|
|
case 4:
|
|
|
case 5:
|
|
|
$result[$key]['unreceived'] = true;
|
|
|
//待收货状态,给查看物流url
|
|
|
$result[$key]['logisticsUrl'] = "暂无logisticsUrl数据";
|
|
|
break;
|
|
|
case 6:
|
|
|
$result[$key]['completed'] = true;
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
} elseif ($vo['payment_type'] == 2) {
|
|
|
//订单为货到付款订单时,计算订单状态。(货到付款没有待付款状态)
|
|
|
switch ($vo['status']) {
|
|
|
case 0 || 1 || 2 || 3 || 4 || 5:
|
|
|
$result[$key]['unreceived'] = true;
|
|
|
//待收货状态,给查看物流url
|
|
|
$resault[$key]['logisticsUrl'] = "备注:暂无logisticsUrl数据";
|
|
|
break;
|
|
|
case 6:
|
|
|
$result[$key]['completed'] = true;
|
|
|
$result[$key]['sumCost'] = $vo['amount'];
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
} while (false);
|
|
|
$result[$key]['sumCost'] = $vo['amount'];
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
|