_orderList($where); } /** * 待领取 */ public function unReceive() { $where = [['status', '=', 1]]; return $this->_orderList($where); } /** * 已完成 */ public function finish() { $where = [['status', '=', 2]]; return $this->_orderList($where); } /** * 订单列表 */ private function _orderList($where) { $param = $this->request->param(); if (!empty($param['order_no'])) { $where[] = ['order_no', 'like', "%{$param['order_no']}%"]; } $list = OrderModel::with('orderProduct') ->where($where) ->order('update_time desc') ->paginate(10, false, ['query' => $param]); $this->assign('order_no', isset($param['order_no']) ? $param['order_no'] : ''); $this->assign('list', $list->items()); $this->assign('page', $list->render()); return $this->fetch(); } /** * 详情 */ public function detail() { $id = $this->request->param('id', 0, 'intval'); $order = OrderModel::with('user')->where($id)->find(); $this->assign('order', $order); return $this->fetch(); } /** * 核销 */ public function receive() { $id = $this->request->param('id', 0, 'intval'); OrderModel::update([ 'status' => 2, 'receive_time' => time(), ], ['id' => $id]); $this->success('操作成功!'); } }