diff --git a/application/admin/controller/Order.php b/application/admin/controller/Order.php index 9ee351c..b70fd7b 100644 --- a/application/admin/controller/Order.php +++ b/application/admin/controller/Order.php @@ -422,6 +422,40 @@ class Order extends Backend } + public function delete($ids = null){ + if (false === $this->request->isPost()) { + + $options = \app\admin\model\Order::DELETED_TYPE; + $order = model('order')->get($ids); + return $this->fetch('delete',['row' => $order,'options'=>$options]); + } + $params = $this->request->post('row/a'); + if (empty($params)) { + $this->error(__('Parameter %s can not be empty', '')); + } + $params = $this->preExcludeFields($params); + + + $result = false; + Db::startTrans(); + try { + $order = model('order')->get($params['order_id']); + if (!$order){ + $this->error('Not Find'); + } + $params['status'] = \app\admin\model\Order::STATUS_CANCEL; + $result = $order->allowField(true)->save($params); + Db::commit(); + } catch (ValidateException | PDOException | Exception $e) { + Db::rollback(); + $this->error($e->getMessage()); + } + if ($result === false) { + $this->error(__('No rows were inserted')); + } + $this->success(); + } + private function filterAreaCodes(array $area_codes) { // 提取所有两位区号 diff --git a/application/admin/model/Order.php b/application/admin/model/Order.php index 6ccc972..411d49a 100644 --- a/application/admin/model/Order.php +++ b/application/admin/model/Order.php @@ -152,6 +152,17 @@ class Order extends Model return $tabStatus[$tab] ?? []; } + public const DELETED_TYPE = [ + 1 => '无相关师傅', + 2 => '距离客户太远', + 3 => '价格不同意', + 4 => '重复订单', + 5 => '联系客户已晚', + 6 => '询价后没有后续', + 7 => '一直联系不上', + 8 => '客户不能久等', + ]; + public function incomeBtnStatus(){ return array_merge($this->tabStatus(self::TAB_PENDING),[self::STATUS_AUDITING]); diff --git a/application/admin/view/order/delete.html b/application/admin/view/order/delete.html new file mode 100644 index 0000000..8a53540 --- /dev/null +++ b/application/admin/view/order/delete.html @@ -0,0 +1,40 @@ +
diff --git a/application/admin/view/order/index.html b/application/admin/view/order/index.html index 635c107..e3393c4 100644 --- a/application/admin/view/order/index.html +++ b/application/admin/view/order/index.html @@ -1,5 +1,14 @@