append('status_text'); return $value; } public function getStatusTextAttribute() { $status_text = [ Status::CANCEL => '已取消', Status::UNPAID => '待付款', Status::PAY_EARNEST => '已付定金', Status::PAID => '已付款', Status::PAY_RETAINAGE => '已付尾款', Status::REFUNDING => '退款中', Status::REFUNDED => '已退款', Status::SUCCESS => '已完成', ]; return $status_text[$this->status] ?? '未知'; } //退款信息 public function getRefundInfoAttribute($value) { $value = $value ? json_decode($value, true) : []; if (!empty($value['pictures']) && is_array($value['pictures'])) { foreach ($value['pictures'] as &$v) { $v = $this->host . $v; } } return $value ?? []; } public function agentProduct() { return $this->belongsTo(AgentProduct::class); } public function product() { return $this->belongsTo(Product::class); } public function coupon() { return $this->belongsTo(Coupon::class); } }