feat(OrderEnum): 根据订单状态和退款状态更新订单类型

This commit is contained in:
mkm 2024-07-27 10:16:28 +08:00
parent 50dd13542e
commit 22c89d8ddd
3 changed files with 10 additions and 7 deletions

View File

@ -64,7 +64,11 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface
->order(['id' => 'desc'])
->select()->each(function ($item) {
$item['pay_time'] = $item['pay_time'] > 0 ? date('Y-m-d H:i:s', $item['pay_time']) : '';
$item['status_name'] = OrderEnum::getOrderType($item['status']) ?? '';
if($item['status']==-1){
$item['status_name'] = OrderEnum::refundStatus($item['refund_status']) ?? '';
}else{
$item['status_name'] = OrderEnum::getOrderType($item['status']) ?? '';
}
if ($item['uid'] <= 0) {
$item['nickname'] = '游客';
} else {

View File

@ -180,10 +180,6 @@ class OrderEnum
*/
public static function getOrderType($value = true)
{
if($value==-1){
$status = self::refundStatus($value) ?? '';
return $status;
}
$data = [
self::RECEIVED_GOODS => '已完成',
self::WAIT_EVALUATION => '待评价',

View File

@ -40,8 +40,11 @@ class StoreOrder extends BaseModel
public function getStatusNameTextAttr($value, $data)
{
$status = OrderEnum::getOrderType($data['status']) ?? '';
if($data['status']==-1){
$status = OrderEnum::refundStatus($data['refund_status']) ?? '';
}else{
$status = OrderEnum::getOrderType($data['status']) ?? '';
}
return $status;
}