Authored by hf

fixes bug to call product detail api and order status

... ... @@ -517,6 +517,52 @@ class Helpers
}
/**
* 订单状态,按订单支付类型和订单状态
* @var array
*/
public static function getOrderStatus()
{
return array(
'1' => array(//在线支付
0 => '待付款',
1 => '已付款',
2 => '已付款',
3 => '已付款',
4 => '已发货',
5 => '已发货',
6 => '交易成功'
),
'2' => array(//货到付款
0 => '备货中',
1 => '已付款',
2 => '已付款',
3 => '已付款',
4 => '已发货',
5 => '已发货',
6 => '交易成功'
),
'3' => array(//现金支付
0 => '待付款',
1 => '已付款',
2 => '已付款',
3 => '已付款',
4 => '已发货',
5 => '已发货',
6 => '交易成功'
),
'4' => array(//抵消支付
0 => '待付款',
1 => '已付款',
2 => '已付款',
3 => '已付款',
4 => '已发货',
5 => '已发货',
6 => '交易成功'
)
);
}
/**
* 获取会员的级别
*
* @param string $vipInfo
... ...
... ... @@ -68,10 +68,16 @@ class OrderModel
}
//检查数据返回是否正常,正常则处理数据
if (!empty($data['data']['order_list'])) {
// 订单的状态列表
$orderStatus = Helpers::getOrderStatus();
foreach ($data['data']['order_list'] as $key => $vo) {
if ($vo['payment_status'] == 'Y' && $vo['status'] == 0) {
$vo['status'] = 1;
}
//订单号,支付状态,订单商品数量,订单总价格
$result[$key]['orderNum'] = $vo['order_code'];
$result[$key]['orderStatus'] = ($vo['is_cancel'] === 'Y') ? '已取消' : $vo['status_str'];
$result[$key]['orderStatus'] = ($vo['is_cancel'] === 'Y') ? '已取消' : $orderStatus[ $vo['payment_type'] ][ $vo['status'] ];
$result[$key]['count'] = count($vo['order_goods']);
$result[$key]['sumCost'] = $vo['amount'];
//类内调用格式化订单商品数据方法
... ...