model = new OrderModel; } /** * 订单导出 * @param string $dataType * @throws \think\exception\DbException */ public function export($dataType) { return $this->model->exportList($dataType, $this->request->param()); } /** * 批量发货 * @return array|mixed * @throws \app\common\exception\BaseException * @throws \think\exception\PDOException */ public function batchDelivery() { if (!$this->request->isAjax()) { return $this->fetch('batchDelivery', [ 'express_list' => ExpressModel::getAll() ]); } if ($this->model->batchDelivery($this->postData('order'))) { return $this->renderSuccess('发货成功'); } return $this->renderError($this->model->getError() ?: '发货失败'); } /** * 批量发货模板 */ public function deliveryTpl() { return $this->model->deliveryTpl(); } /** * 审核:用户取消订单 * @param $order_id * @return array|bool * @throws \think\exception\DbException */ public function confirmCancel($order_id) { $model = OrderModel::detail($order_id); if ($model->confirmCancel($this->postData('order'))) { return $this->renderSuccess('操作成功'); } return $this->renderError($model->getError() ?: '操作失败'); } /** * 门店自提核销 * @param $order_id * @return array|bool * @throws \think\exception\DbException */ public function extract($order_id) { $model = OrderModel::detail($order_id); $data = $this->postData('order'); if ($model->extract($data['extract_clerk_id'])) { return $this->renderSuccess('核销成功'); } return $this->renderError($model->getError() ?: '核销失败'); } }