6
0
Fork 0

修改售后订单返回状态显示

release
vine_liutk 2021-12-20 15:55:06 +08:00
parent 31a887554d
commit 742ecc376f
3 changed files with 24 additions and 2 deletions

View File

@ -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,

View File

@ -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,
];
}

View File

@ -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');