$this->id, 'orderid' => $this->orderid, 'typeText' => $this->when($this->item_type, function () { switch ($this->item_type) { case 'GOODS': $type = '商品订单'; break; case 'ACTIVITY_GIFT': $type = '活动赠品'; break; case 'VIP_GIFT': $type = '会员赠品'; break; case 'FULL_GIFT': $type = '满仓赠品'; break; } return $type; }), 'stateText' => $this->state_text, 'goodsList' => OrderGoodsListResource::collection($this->details), 'total' => number_format($this->total, 2), 'amount' => number_format($this->amount, 2), 'score' => number_format($this->score, 2), 'actual_price' => number_format($this->total - $this->score, 2), 'freight' => number_format($this->freight, 2), 'handleOption' => [ 'pay' => $this->canPay(), 'singin' => $this->canSingin(), 'cancel' => $this->canCancel(), 'track' => isset($this->express->company) && isset($this->express->number),//物流跟踪 ], 'express' =>[ 'name'=>$this->express->name, 'mobile'=>$this->express->mobile, 'address'=>$this->express->address, ], 'created_at' => (string) $this->created_at, ]; } }