$this->params['type'], 'user_id' => $this->userId ]) ->with(['order_goods' => function ($query) { $query->field('goods_id,order_id,goods_snap,goods_name,goods_price,goods_num,is_comment,original_price') ->append(['goods_image', 'spec_value_str']) ->hidden(['goods_snap']); }]) ->field(['id', 'sn', 'order_type', 'order_status', 'total_num', 'order_amount', 'delivery_type', 'is_team_success', 'pay_way', 'pay_status', 'pay_time', 'express_status','delivery_content', 'delivery_content1', 'delivery_content_type', 'create_time', 'presell_id', 'transaction_id' ]) ->append(['btn']) ->order(['id' => 'desc']) ->limit($this->limitOffset, $this->limitLength) ->select()->toArray(); foreach ($lists as &$list){ //查看提货码按钮 $list['btn']['pickup_btn'] = ($list['order_status'] == OrderEnum::STATUS_WAIT_DELIVERY && $list['delivery_type'] == DeliveryEnum::SELF_DELIVERY) ? 1 : 0; //订单状态描述 $list['order_status_desc'] = ($list['order_status'] == OrderEnum::STATUS_WAIT_DELIVERY && $list['delivery_type'] == DeliveryEnum::SELF_DELIVERY) ? '待取货' : OrderEnum::getOrderStatusDesc($list['order_status']); if ($list['order_type'] == OrderEnum::TEAM_ORDER && $list['is_team_success'] != TeamEnum::TEAM_FOUND_SUCCESS){ $list['btn']['pickup_btn'] = 0; $list['order_status_desc'] = ($list['order_status'] == OrderEnum::STATUS_WAIT_DELIVERY) ? TeamEnum::getStatusDesc($list['is_team_success']) : OrderEnum::getOrderStatusDesc($list['order_status']); } //订单类型 $list['order_type_desc'] = ($list['delivery_type'] == DeliveryEnum::SELF_DELIVERY) ? '自提订单' : OrderEnum::getOrderTypeDesc($list['order_type']); // 预售信息 if ($list['order_type'] == OrderEnum::PRESELL_ORDER) { $list['presell'] = CommonPresellLogic::orderInfo($list); } } return $lists; } /** * @notes 数量 * @return int * @author 段誉 * @date 2021/7/23 18:55 */ public function count(): int { return Order::withSearch(['order_type', 'user_id'], [ 'order_type' => $this->params['type'], 'user_id' => $this->userId ])->count(); } }