userId)->value('id'); $where[] = ['staff_id','=',$staff_id]; if (isset($this->params['order_status']) && $this->params['order_status'] != '') { switch ($this->params['order_status']) { case 1: $where[] = ['order_status','=',OrderEnum::ORDER_STATUS_APPOINT]; break; case 2: $where[] = ['order_status','=',OrderEnum::ORDER_STATUS_SERVICE]; break; case 3: $where[] = ['order_status','=',OrderEnum::ORDER_STATUS_FINISH]; break; case 4: $where[] = ['order_status','=',OrderEnum::ORDER_STATUS_CLOSE]; break; } } return $where; } /** * @notes 订单服务列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author ljj * @date 2022/3/1 3:01 下午 */ public function lists(): array { $lists = Order::field('id,sn,order_status,pay_status,order_amount,appoint_time_start,appoint_time_end') ->order('id','desc') ->append(['appoint_time','appoint_week','order_status_desc','confirm_service_btn','verification_btn']) ->with(['order_goods' => function($query){ $query->field('order_id,goods_snap,goods_name')->append(['goods_image'])->hidden(['goods_snap']); }]) ->where($this->where()) ->select() ->toArray(); return $lists; } /** * @notes 订单服务数量 * @return int * @author ljj * @date 2022/3/1 3:12 下午 */ public function count(): int { return Order::where($this->where())->count(); } }