修改售后订单返回状态显示
parent
31a887554d
commit
742ecc376f
|
|
@ -23,7 +23,7 @@ class AfterSaleResource extends JsonResource
|
|||
'sell_price' => bcdiv($this->orderProduct->total_amount, $this->orderProduct->quantity * 100, 2),
|
||||
'num'=> $this->num,
|
||||
],
|
||||
'state' => $this->state,
|
||||
'state' => $this->after_sale_state,
|
||||
'type' => $this->type,
|
||||
'images' => $this->images,
|
||||
'description' => $this->description,
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class AfterSaleSimpleResource extends JsonResource
|
|||
'name' => $this->orderProduct->name,
|
||||
'cover' => $this->orderProduct->cover,
|
||||
],
|
||||
'state' => $this->state,
|
||||
'state' => $this->$this->after_sale_state,
|
||||
'remarks' => $this->remarks,
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,28 @@ class AfterSale extends Model
|
|||
'tracking_number',
|
||||
];
|
||||
|
||||
/**
|
||||
* 获取售后订单状态进度
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getAfterSaleStateAttribute(): int
|
||||
{
|
||||
$afterSaleState = 0;
|
||||
switch ($this->state) {
|
||||
case 5:
|
||||
$afterSaleState = 4;
|
||||
break;
|
||||
case 6:
|
||||
$afterSaleState = 5;
|
||||
break;
|
||||
default:
|
||||
$afterSaleState = $this->state;
|
||||
break;
|
||||
}
|
||||
return $afterSaleState;
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
|
|
|
|||
Loading…
Reference in New Issue