params['type'] ?? 0]; $where[] = ['o.delivery_type', '=', DeliveryEnum::SELF_DELIVERY]; $where[] = ['o.pay_status', '=', PayEnum::ISPAID]; // 已售后成且订单已关闭的订单 无需再显示在待核销列表 if (($this->params['type'] ?? 0) == 0) { $where[] = [ 'o.order_status', 'in', [ OrderEnum::STATUS_WAIT_DELIVERY, OrderEnum::STATUS_WAIT_RECEIVE, ], ]; } $where[] = ['sv.user_id', '=', $this->request->userId]; $where[] = ['sv.status', '=', YesNoEnum::YES]; return $where; } /** * @notes 查看自提订单列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author ljj * @date 2021/8/27 4:14 下午 */ public function lists(): array { $lists = Order::field('o.id,o.address,o.verification_status') ->alias('o') ->join('selffetch_verifier sv', 'sv.selffetch_shop_id = o.selffetch_shop_id') ->with(['order_goods' => function ($query) { $query->field('order_id,goods_snap,goods_name,goods_num') ->append(['goods_image', 'spec_value_str']) ->hidden(['goods_snap']); }]) ->append(['verification_status_desc']) ->hidden(['verification_status']) ->where(self::setSearch()) ->limit($this->limitOffset, $this->limitLength) ->group('o.id') ->select() ->toArray(); foreach ($lists as &$list) { $list['contact'] = $list['address']->contact; unset($list['address']); } return $lists; } /** * @notes 查看自提订单总数 * @return int * @author ljj * @date 2021/8/27 4:14 下午] */ public function count(): int { return Order::alias('o') ->join('selffetch_verifier sv', 'sv.selffetch_shop_id = o.selffetch_shop_id') ->where(self::setSearch()) ->group('o.id') ->count(); } }