From 463240df80fcf3469c3805a78991ab6f9306e994 Mon Sep 17 00:00:00 2001 From: gcd Date: Sun, 8 Jun 2025 18:16:11 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20=E5=90=8E=E5=8F=B0=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=BD=95=E5=85=A5=E9=A1=B5=E9=9D=A2=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Order.php | 7 +- application/admin/validate/Order.php | 42 +- application/admin/view/order/add.html | 715 +++++++++++++++---------- public/assets/img/automation.png | Bin 0 -> 1740 bytes 4 files changed, 485 insertions(+), 279 deletions(-) create mode 100644 public/assets/img/automation.png diff --git a/application/admin/controller/Order.php b/application/admin/controller/Order.php index e81ec9e..aee0d2f 100644 --- a/application/admin/controller/Order.php +++ b/application/admin/controller/Order.php @@ -204,11 +204,16 @@ class Order extends Backend public function add() { - if (false === $this->request->isPost()) { return $this->view->fetch(); } $params = $this->request->post('row/a'); + + $validate = $this->validate($params, \app\admin\validate\Order::class . '.add'); + if ($validate !== true) { + $this->error($validate); + } + $params = array_filter($params, function ($val) { return $val != ''; }); diff --git a/application/admin/validate/Order.php b/application/admin/validate/Order.php index e0565c2..50ef95c 100644 --- a/application/admin/validate/Order.php +++ b/application/admin/validate/Order.php @@ -10,18 +10,56 @@ class Order extends Validate * 验证规则 */ protected $rule = [ + 'source' => 'require', + 'item_id' => 'require', + 'customer' => 'require|max:32', + 'tel' => 'require|number|max:32', + 'area_id' => 'require', + 'address' => 'require|max:255', + 'lng' => 'require', + 'lat' => 'require', + 'online_amount|收款金额' => 'require|number|between:0.01,10000000', + 'plan_time|上门时间' => 'requireIf:set_time,1|date' ]; /** * 提示消息 */ protected $message = [ + 'source.require' => '请选择订单渠道', + 'item_id.require' => '请选择服务项目', + + 'customer.require' => '请输入客户昵称', + 'customer.max' => '客户昵称不能超过 32 个字符', + + 'tel.require' => '请输入客户电话', + 'area_id.require' => '请选择地区', + + 'address.require' => '请选择详细地址', + 'address.max' => '详细地址不能超过 255 个字符', + + 'lng.require' => '请选择详细地址', + 'lat.require' => '请选择详细地址', + + 'online_amount.require' => '请输入收款金额', + 'online_amount.number' => '收款金额不正确', ]; /** * 验证场景 */ protected $scene = [ - 'add' => [], + 'add' => [ + 'source', + 'item_id', + 'customer', + 'tel', + 'area_id', + 'address', + 'lng', + 'lat', + 'online_amount', + 'plan_time', + ], 'edit' => [], ]; - + } diff --git a/application/admin/view/order/add.html b/application/admin/view/order/add.html index 2644c32..b4feccc 100644 --- a/application/admin/view/order/add.html +++ b/application/admin/view/order/add.html @@ -1,283 +1,446 @@ - -
-
-
- -
-
-
-
-
-
- -
- -
-
-
- -
- -
-
- - -
- -
- - -
-
-
- -
-
- -
地图查找
-
- - - -
-
- -
- -
- - - -
-
- -
- -
- -
-
- -
- -
- -
-
- -
- -
-
- -
- - -
- -
-
    -
    -
    -
    - -
    - -
    - -
    - -
    -
    - - - -
    - -
    - -
    -
    - -
    - -
    - -
    -
    - - -
    - -
    - -
    -
    - -
    - -
    - -
    -
    - - - -
    - -
    - -
    -
    -
    - -
    - -
    -
    - -
    - -
    - - -
    -
    - - -
    - -
    -
    快速输入:
    -
    -
    - -
    -
    -
    - -
    -
    - -
    -
    -
    +
    +
    +
    +
    + +
    +
    +
    *订单渠道:
    +
    + +
    +
    +
    *服务项目:
    +
    + + +
    +
    +
    +
    +
    +
    *客户昵称:
    +
    + +
    +
    +
    +
    *客户电话:
    +
    + +
    +
    +
    +
    +
    *地区:
    +
    + + +
    +
    +
    +
    +
    *详细地址:
    +
    +
    地图查找
    +
    +
    +
    + + + + +
    +
    +
    +
    +
    收款方式:
    +
    + +
    +
    +
    +
    *收款金额:
    +
    + +
    +
    +
    +
    +
    +
    优惠:
    +
    + +
    +
    +
    + +
    +
    +
    上门时间:
    +
    + {:build_radios('row[set_time]', ['1'=>'有', '0'=>'无'], 1)} +
    +
    +
    +
    *设置时间:
    +
    + +
    +
    +
    +
    +
    +
    订单备注:
    +
    +
    + +
    +
    +
    +
    +
    录单员:
    +
    + +
    +
    +
    +
    +
    图片上传:
    +
    +
    + +
    + + +
    + +
    +
      +
      +
      +
      +
      +
      +
      快速录入:
      +
      +
      +
      +
      + +
      +
      +
      +
      + + 智能识别 +
      +
      +
      +
      + + + + + +
      +
      +
      - - \ No newline at end of file + var items = {:json_encode($items); }; + window.addEventListener('DOMContentLoaded', function () { + setTimeout(function () { + const container = document.querySelector('.body-hidden'); + if (container) { + container.classList.remove('body-hidden'); + container.classList.add('body-shown'); + } + }, 500); + }); + + + + + + + + + + + + + + + + diff --git a/public/assets/img/automation.png b/public/assets/img/automation.png new file mode 100644 index 0000000000000000000000000000000000000000..943f60052b3419ec300d66e66c1875e241bc5bdb GIT binary patch literal 1740 zcmV;-1~d7IP)Px#1am@3R0s$N2z&@+hyVZvc1c7*RCt`_n>}b;M-az}iVWj_o(*Hr5G`492dcb@4Z;dHdw_^tGIk46E`wX~6OZK2m z6}Zph;?IC>($@VUi|Wt=c2`PS18p&&hh;z$`{eE72{0DV?$VM$JP!l4-mm|W*S%uZ{6W|;1+dk!v%@}wpXn5@AUuTiQO&mEoUb_EB zkurjP?0Gy$(;LL!z}Gp%2&@Bd$loLlM_8LO4fco}5f79j={z`eW3EN!92#SGj4`tn z&;2MgXGj7@*qsmIjJZhn2#aIr-IrKBuce}o)$vrE5TgU)lDdf|g$h^Jj4`JQ7Y~dv z8<8CxnsTW*bgcwC#+aJ{8rF<;zO*rC+B+Hpc9fSl0u#!%p-fu3z$RW8UmdnHY0=iP zBl~H`pcKQgDmpsk3GvE_-c>iwZy95J#Ks9deK0A<4m+S=`M>k;NMm2|$);sk!zVeTT+B$$}Cb z^8@bT2O4#%`Z?(|)hY`csj==er|mUiaCzAtnKRY+#>!38$$%~^EiSFOmc7wXC4TQ=eTsMJe#I8n$A3!N=;g*4GArz7 zw-l~P?w2GqBw|U?Lt~|8sO(f~j9hwdiuaCXpH*Lwkp98<*l0}KvAX{Ffv~4J2EG-~ zsseiCyjNt0RWqPco{h0*bV-3_f~^dV@l`Th>RtjG1Efn^QqYjZ$qLWMj4|Fg8tNeH zhWNe2<(9Pj?<#teRa6W#tvDLW=cRCJtZjHJp63=vv+|lDM`)(JoGOpkrRfqZTON-Y z<_)9!5T_dL%U+PE8Y0!F{F20k#Z=V@xI>w`)$x9SPo zSQbGCEOk{jR+uP3uHH7=wlU_fbIv<62|p%v3?5;RuuW{pStUgB2rJ&QpLhOdpwD8$ z=FE*fCGH7UuHS8J9Wr`qEPGeDPB8SC>tU0qJ1pMus~j;Uc+a9vk6BF9_n7N_<(?I1 zrP{hI-N$-(O~?hra3BAw{8d``ilnW(!YBBiUoA=_R}A?KPw)eyXld)b=;EWPC-@Fdg{|7uj>&geu^)(j^{tWC&;hjCc8hzjg<{v(Qm5wQ}N5_@s ii(tUN3ZMMf00005a( literal 0 HcmV?d00001 From cb6c595c8f056c99047f2949d6ddcbc18514ca50 Mon Sep 17 00:00:00 2001 From: gcd Date: Sun, 8 Jun 2025 21:12:46 +0800 Subject: [PATCH 2/4] =?UTF-8?q?feat:=20=E5=90=8E=E5=8F=B0=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=BD=95=E5=85=A5=E9=A1=B5=E9=9D=A2=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/view/order/edit.html | 607 ++++++++++++++----------- public/assets/js/addons.js | 1 - 2 files changed, 353 insertions(+), 255 deletions(-) diff --git a/application/admin/view/order/edit.html b/application/admin/view/order/edit.html index 1df3deb..9b77e67 100644 --- a/application/admin/view/order/edit.html +++ b/application/admin/view/order/edit.html @@ -1,262 +1,361 @@ - -
      -
      -
      - -
      -
      -
      -
      -
      -
      - -
      - -
      -
      -
      - -
      - -
      -
      - -
      - -
      - - -
      -
      -
      - -
      -
      - -
      地图查找
      -
      - - - -
      -
      - -
      - -
      - - -
      -
      - -
      - -
      - -
      -
      - -
      - -
      - -
      -
      - -
      - -
      -
      - -
      - - -
      - -
      -
        -
        -
        - -
        - - -
        -
        - -
        - -
        -
        - - - -
        - -
        - -
        -
        - - -
        - -
        - -
        -
        - - -
        - -
        - -
        -
        - -
        - -
        - -
        -
        - -
        - -
        - -
        -
        - - -
        - -
        - -
        -
        - -
        - -
        - -
        -
        - - - -
        - - - -
        -
        +
        +
        +
        +
        + +
        +
        +
        *订单渠道:
        +
        +
        +
        +
        +
        *服务项目:
        +
        + + +
        +
        +
        +
        +
        *客户昵称:
        +
        + +
        +
        +
        +
        *客户电话:
        +
        + +
        +
        +
        +
        +
        *地区:
        +
        + + +
        +
        +
        +
        +
        *详细地址:
        +
        +
        地图查找
        +
        +
        +
        + + + + +
        +
        +
        +
        +
        收款方式:
        +
        + +
        +
        +
        +
        *收款金额:
        +
        + +
        +
        +
        +
        +
        +
        优惠:
        +
        + +
        +
        +
        + +
        +
        +
        上门时间:
        +
        + {:build_radios('row[set_time]', ['1'=>'有', '0'=>'无'], $row.plan_time === '' ? 0 : 1)} +
        +
        +
        +
        *设置时间:
        +
        + +
        +
        +
        +
        +
        +
        订单备注:
        +
        +
        + +
        +
        +
        +
        +
        录单员:
        +
        + +
        +
        +
        + +
        +
        图片上传:
        +
        +
        + +
        + + +
        + +
        +
          +
          +
          +
          +
          - + - - - \ No newline at end of file + + + + + + + + + + + + + + diff --git a/public/assets/js/addons.js b/public/assets/js/addons.js index 6299f6b..0f3bdcb 100755 --- a/public/assets/js/addons.js +++ b/public/assets/js/addons.js @@ -1,7 +1,6 @@ define([], function () { require([], function () { //绑定data-toggle=addresspicker属性点击事件 - $(document).on('click', "[data-toggle='addresspicker']", function () { var that = this; var callback = $(that).data('callback'); From 4c326272769da3d31a4a7e8879dc09e2509eaf9c Mon Sep 17 00:00:00 2001 From: gcd Date: Sun, 8 Jun 2025 22:44:05 +0800 Subject: [PATCH 3/4] =?UTF-8?q?feat:=20=E5=90=8E=E5=8F=B0=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E8=AE=A2=E5=8D=95=E9=A1=B5=E9=9D=A2=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Order.php | 16 +++++++++++++++- application/admin/validate/Order.php | 13 ++++++++++++- application/admin/view/order/add.html | 2 +- application/admin/view/order/edit.html | 25 ++++++++++++++++--------- public/assets/js/backend/order.js | 25 +++++++++++++++++++++++++ 5 files changed, 69 insertions(+), 12 deletions(-) diff --git a/application/admin/controller/Order.php b/application/admin/controller/Order.php index aee0d2f..a641abf 100644 --- a/application/admin/controller/Order.php +++ b/application/admin/controller/Order.php @@ -209,6 +209,7 @@ class Order extends Backend } $params = $this->request->post('row/a'); + // 数据验证 $validate = $this->validate($params, \app\admin\validate\Order::class . '.add'); if ($validate !== true) { $this->error($validate); @@ -254,7 +255,6 @@ class Order extends Backend $params['update_time'] = date('Y-m-d H:i:s'); $result = $this->model->allowField(true)->save($params); - if ($params['dispatch_type'] == 2) { AutoDispatchLogic::autoDispatch($this->model, $this->auth); } @@ -293,6 +293,20 @@ class Order extends Backend if (request()->isPost()) { // 获取表单提交的数据 $params = input('post.row/a'); + + // 数据验证 + $validate = $this->validate($params, \app\admin\validate\Order::class . '.edit'); + if ($validate !== true) { + $this->error($validate); + } + + if (!$params['set_time']) { + $params['plan_time'] = null; + } + + //移除无用字段:是否设置上门时间 + unset($params['set_time']); + $params['update_time'] = date('Y-m-d H:i:s'); $sources = $this->sources; $sources = array_column($sources, 'title', 'id'); diff --git a/application/admin/validate/Order.php b/application/admin/validate/Order.php index 50ef95c..353541e 100644 --- a/application/admin/validate/Order.php +++ b/application/admin/validate/Order.php @@ -59,7 +59,18 @@ class Order extends Validate 'online_amount', 'plan_time', ], - 'edit' => [], + 'edit' => [ + 'source', + 'item_id', + 'customer', + 'tel', + 'area_id', + 'address', + 'lng', + 'lat', + 'online_amount', + 'plan_time', + ], ]; } diff --git a/application/admin/view/order/add.html b/application/admin/view/order/add.html index b4feccc..1ffa24b 100644 --- a/application/admin/view/order/add.html +++ b/application/admin/view/order/add.html @@ -105,7 +105,7 @@ {:build_radios('row[set_time]', ['1'=>'有', '0'=>'无'], 1)}
          -
          +
          *设置时间:
          diff --git a/application/admin/view/order/edit.html b/application/admin/view/order/edit.html index 9b77e67..5e3a09b 100644 --- a/application/admin/view/order/edit.html +++ b/application/admin/view/order/edit.html @@ -2,7 +2,6 @@
          -
          *订单渠道:
          @@ -61,9 +60,9 @@ name="row[address]" type="text">{$row.address} + name="row[lng]" id="lng" value="{$row.lng}"> + name="row[lat]" id="lat" value="{$row.lat}">
          @@ -102,10 +101,10 @@
          上门时间:
          - {:build_radios('row[set_time]', ['1'=>'有', '0'=>'无'], $row.plan_time === '' ? 0 : 1)} + {:build_radios('row[set_time]', ['1'=>'有', '0'=>'无'], $row.plan_time === '' || $row.plan_time === null ? 0 : 1)}
          -
          +
          *设置时间:
          @@ -138,10 +137,10 @@
          图片上传:
          - +
          - - + +
          @@ -150,6 +149,12 @@
          +
          @@ -190,8 +195,10 @@ } .full-height { width: 100vw; - height: 768px; + height: 808px; background: #f1f4f6; + padding-top: 20px !important; + padding-bottom: 20px !important; } .ctr { width: 630px; diff --git a/public/assets/js/backend/order.js b/public/assets/js/backend/order.js index 0122db0..6db3c88 100644 --- a/public/assets/js/backend/order.js +++ b/public/assets/js/backend/order.js @@ -479,10 +479,35 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function }); }); Controller.api.map(); + + $('input[name="row[set_time]"]').on('change', function () { + var val = $(this).val(); + if (val == 1) { + $('#set-time').show(); + } else { + $('#set-time').hide(); + } + }); }, edit: function () { + // 未选择上门时间时,隐藏时间选择框 + var planTime = $('input[name="row[plan_time]"]').val() + if (planTime === '' || planTime === 'null') { + $('#set-time').hide(); + } else { + $('#set-time').show(); + } + Controller.api.bindevent(); Controller.api.map(); + $('input[name="row[set_time]"]').on('change', function () { + var val = $(this).val(); + if (val == 1) { + $('#set-time').show(); + } else { + $('#set-time').hide(); + } + }); }, copy: function () { Controller.api.bindevent(); From 2785532d4fc83cc5ef146c674aff9f575470a8bc Mon Sep 17 00:00:00 2001 From: gcd Date: Sun, 8 Jun 2025 23:02:15 +0800 Subject: [PATCH 4/4] =?UTF-8?q?feat:=20=E5=90=8E=E5=8F=B0=E5=A4=8D?= =?UTF-8?q?=E5=88=B6=E8=AE=A2=E5=8D=95=E9=A1=B5=E9=9D=A2=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Order.php | 4 + application/admin/view/order/copy.html | 619 ++++++++++++++----------- public/assets/js/backend/order.js | 38 +- 3 files changed, 385 insertions(+), 276 deletions(-) diff --git a/application/admin/controller/Order.php b/application/admin/controller/Order.php index a641abf..be5da90 100644 --- a/application/admin/controller/Order.php +++ b/application/admin/controller/Order.php @@ -215,6 +215,10 @@ class Order extends Backend $this->error($validate); } + if (!$params['set_time']) { + $params['plan_time'] = null; + } + $params = array_filter($params, function ($val) { return $val != ''; }); diff --git a/application/admin/view/order/copy.html b/application/admin/view/order/copy.html index b6268f4..4ea015b 100644 --- a/application/admin/view/order/copy.html +++ b/application/admin/view/order/copy.html @@ -1,266 +1,369 @@ - -
          -
          -
          - -
          -
          -
          -
          -
          -
          - -
          - -
          -
          -
          - -
          - -
          -
          - -
          - -
          - - -
          -
          -
          - -
          -
          - -
          地图查找
          -
          - - - -
          -
          - -
          - -
          - - -
          -
          - -
          - -
          - -
          -
          - -
          - -
          - -
          -
          - -
          - -
          -
          - -
          - - -
          - -
          -
            -
            -
            - -
            - - -
            -
            - -
            - -
            -
            - - - -
            - -
            - -
            -
            - - -
            - -
            - -
            -
            - - -
            - -
            - -
            -
            - -
            - -
            - -
            -
            - - - - - -
            - -
            - -
            -
            - - -
            - -
            - -
            -
            - -
            - -
            - -
            -
            - - - -
            - - - -
            -
            +
            +
            +
            +
            + +
            +
            +
            *订单渠道:
            +
            +
            +
            +
            +
            *服务项目:
            +
            + + +
            +
            +
            +
            +
            *客户昵称:
            +
            + +
            +
            +
            +
            *客户电话:
            +
            + +
            +
            +
            +
            +
            *地区:
            +
            + + +
            +
            +
            +
            +
            *详细地址:
            +
            +
            地图查找
            +
            +
            +
            + + + + +
            +
            +
            +
            +
            收款方式:
            +
            + +
            +
            +
            +
            *收款金额:
            +
            + +
            +
            +
            +
            +
            +
            优惠:
            +
            + +
            +
            +
            + +
            +
            +
            上门时间:
            +
            + {:build_radios('row[set_time]', ['1'=>'有', '0'=>'无'], $row.plan_time === '' || $row.plan_time === null ? 0 : 1)} +
            +
            +
            +
            *设置时间:
            +
            + +
            +
            +
            +
            +
            +
            订单备注:
            +
            +
            + +
            +
            +
            +
            +
            录单员:
            +
            + +
            +
            +
            + +
            +
            图片上传:
            +
            +
            + +
            + + +
            + +
            +
              +
              +
              +
              + +
              - + - - - \ No newline at end of file + + + + + + + + + + + + + + diff --git a/public/assets/js/backend/order.js b/public/assets/js/backend/order.js index 6db3c88..50a3c39 100644 --- a/public/assets/js/backend/order.js +++ b/public/assets/js/backend/order.js @@ -424,6 +424,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function } return false; }); + $("#mysubmit").on("click", function () { const res = $("form[role=form]").isValid(); if (res){ @@ -433,7 +434,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function } return false; }); - Form.api.bindevent($("form[role=form]")); + $("#smart").on("click", function () { $.ajax({ url: "order/smart", // 你的 API 地址 @@ -478,16 +479,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function } }); }); + Controller.api.bindevent(); Controller.api.map(); - - $('input[name="row[set_time]"]').on('change', function () { - var val = $(this).val(); - if (val == 1) { - $('#set-time').show(); - } else { - $('#set-time').hide(); - } - }); }, edit: function () { // 未选择上门时间时,隐藏时间选择框 @@ -500,16 +493,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function Controller.api.bindevent(); Controller.api.map(); - $('input[name="row[set_time]"]').on('change', function () { - var val = $(this).val(); - if (val == 1) { - $('#set-time').show(); - } else { - $('#set-time').hide(); - } - }); }, copy: function () { + // 未选择上门时间时,隐藏时间选择框 + var planTime = $('input[name="row[plan_time]"]').val() + if (planTime === '' || planTime === 'null') { + $('#set-time').hide(); + } else { + $('#set-time').show(); + } + Controller.api.bindevent(); Controller.api.map(); }, @@ -556,6 +549,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function api: { bindevent: function () { Form.api.bindevent($("form[role=form]")); + + $('input[name="row[set_time]"]').on('change', function () { + var val = $(this).val(); + if (val == 1) { + $('#set-time').show(); + } else { + $('#set-time').hide(); + } + }); }, map:function () { $("#c-city").on("cp:updated", function () {