From 886cd609295e1976373075cc9e03f13711f7d6ed Mon Sep 17 00:00:00 2001 From: gcd Date: Fri, 30 May 2025 22:44:38 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E3=80=90=E5=B0=8F=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E6=8E=A5=E5=8F=A3=E3=80=91=E5=AE=8C=E6=88=90=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E6=97=B6=EF=BC=8C=E6=96=B0=E5=A2=9E=E6=9D=90=E6=96=99?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/services/OrderDispatchService.php | 12 ++++++++++++ application/worker/validate/OrderDispatch.php | 7 ++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/application/services/OrderDispatchService.php b/application/services/OrderDispatchService.php index d7e7cc1..7a8179c 100644 --- a/application/services/OrderDispatchService.php +++ b/application/services/OrderDispatchService.php @@ -384,6 +384,18 @@ class OrderDispatchService extends BaseService $orderDispatch->images = $this->removeStrCdnUrl($params['complete_images']); $orderDispatch->finish_time = $time; + // 材料相关 + $order = $this->getOrderModel()->where('id', $orderDispatch->order_id)->find(); + // 是否使用材料 + $order->is_material_used = $params['is_material_used']; + if ($order->is_material_used == 1) { + // 材料成本 + $order->material_cost = $params['material_cost']; + // 材料凭证图片组 + $order->material_images = $this->removeStrCdnUrl($params['material_images']); + $order->save(); + } + if ($params['receive_type'] == 1) { $orderDispatch->image = $this->removeStrCdnUrl($params['payment_image']); $orderDispatch->offline_total_type = $params['offline_total_type']; diff --git a/application/worker/validate/OrderDispatch.php b/application/worker/validate/OrderDispatch.php index 4e5553e..eef48e1 100644 --- a/application/worker/validate/OrderDispatch.php +++ b/application/worker/validate/OrderDispatch.php @@ -27,6 +27,11 @@ class OrderDispatch extends Validate 'is_finish_today|今日完成' => 'require|in:0,1', 'estimated_finish_time|完成时间' => 'require|date', 'work_progress|当前施工进度' => 'max:200', + + //材料相关 + 'is_material_used|是否使用材料' => 'require|in:0,1', + 'material_cost|材料成本' => 'requireIf:is_material_used,1|number|between:0,10000000', + 'material_images|材料凭证' => 'requireIf:is_material_used,1|max:1000', ]; protected $message = [ @@ -39,7 +44,7 @@ class OrderDispatch extends Validate 'info' => ['order_dispatch_id'], 'appointmentTime' => ['order_dispatch_id', 'plan_time'], 'arrivedOnSite' => ['order_dispatch_id', 'images'], - 'completeService' => ['order_dispatch_id', 'complete_images', 'offline_total_type', 'amount', 'payment_image', 'offline_total_type'], + 'completeService' => ['order_dispatch_id', 'complete_images', 'offline_total_type', 'amount', 'payment_image', 'offline_total_type', 'is_material_used', 'material_cost', 'material_images'], 'saveWorkerRemark' => ['order_dispatch_id', 'worker_remark'], 'updateProgress' => ['order_dispatch_id', 'is_finish_today', 'estimated_finish_time', 'work_progress'], ]; From 0be26ff7450c6764499733103eb3a31829770651 Mon Sep 17 00:00:00 2001 From: gcd Date: Fri, 30 May 2025 23:25:48 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=E3=80=90=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=AE=A2=E5=8D=95=E5=88=97=E8=A1=A8=E3=80=91?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=98=AF=E5=90=A6=E4=BD=BF=E7=94=A8=E6=9D=90?= =?UTF-8?q?=E6=96=99=E3=80=81=E6=9D=90=E6=96=99=E5=87=AD=E8=AF=81=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E7=BB=84=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assets/js/backend/orders/configorder.js | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/public/assets/js/backend/orders/configorder.js b/public/assets/js/backend/orders/configorder.js index 124f56d..7868a0c 100644 --- a/public/assets/js/backend/orders/configorder.js +++ b/public/assets/js/backend/orders/configorder.js @@ -61,7 +61,26 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin {field: 'refund_amount', title: __('Refund_amount'), operate:false}, {field: 'real_amount', title: __('Real_amount'), operate:false}, {field: 'cost', title: __('Cost'), operate:false}, - {field: 'material_cost', title: __('材料成本'), operate:false}, + { + field: 'material_cost_text', title: '材料', + operate: false, + cellStyle: {css: {"text-align": "left !important"}}, + formatter: function (val, row) { + let status = { + "0": "未使用", + "1": "已使用", + } + let res = ` + 是否使用材料:${status[row.is_material_used]}
+ `; + if (row.is_material_used === 1) { + res += `材料成本:¥${row.material_cost}
` + } + return res + }}, + {field: 'material_images', title: __('材料凭证'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images}, + + {field: 'performance', title: __('Performance'), operate:false}, // {field: 'dispatch_type', title: __('Dispatch_type')}, From b6d2aa21e917c6c28b79e8d8ef4dbce1c86d70bb Mon Sep 17 00:00:00 2001 From: gcd Date: Fri, 30 May 2025 23:52:11 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=20feat:=20=E3=80=90=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=AE=A2=E5=8D=95=E5=88=97=E8=A1=A8=E3=80=91?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=98=AF=E5=90=A6=E4=BD=BF=E7=94=A8=E6=9D=90?= =?UTF-8?q?=E6=96=99=E3=80=81=E6=9D=90=E6=96=99=E5=87=AD=E8=AF=81=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E7=BB=84=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/model/Order.php | 14 ++++++++++++++ application/services/OrderDispatchService.php | 3 +++ public/assets/js/backend/orders/configorder.js | 15 +++------------ 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/application/common/model/Order.php b/application/common/model/Order.php index 24737de..8604719 100644 --- a/application/common/model/Order.php +++ b/application/common/model/Order.php @@ -61,4 +61,18 @@ class Order extends Model return $images; } + + public function getMaterialImagesAttr($val) + { + if (empty($val)) { + return []; + } + + $images = explode(',', $val); + foreach ($images as $k => $v) { + $images[$k] = cdnurl($v, true); + } + + return $images; + } } diff --git a/application/services/OrderDispatchService.php b/application/services/OrderDispatchService.php index 7a8179c..20b6911 100644 --- a/application/services/OrderDispatchService.php +++ b/application/services/OrderDispatchService.php @@ -228,6 +228,9 @@ class OrderDispatchService extends BaseService 'images', 'status', 'coupon_id', + 'is_material_used', + 'material_cost', + 'material_images', ]; $orderDispatchFields = [ 'id', diff --git a/public/assets/js/backend/orders/configorder.js b/public/assets/js/backend/orders/configorder.js index 7868a0c..715a0ba 100644 --- a/public/assets/js/backend/orders/configorder.js +++ b/public/assets/js/backend/orders/configorder.js @@ -62,25 +62,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin {field: 'real_amount', title: __('Real_amount'), operate:false}, {field: 'cost', title: __('Cost'), operate:false}, { - field: 'material_cost_text', title: '材料', + field: 'material_cost_text', title: '材料成本', operate: false, cellStyle: {css: {"text-align": "left !important"}}, formatter: function (val, row) { - let status = { - "0": "未使用", - "1": "已使用", - } - let res = ` - 是否使用材料:${status[row.is_material_used]}
- `; if (row.is_material_used === 1) { - res += `材料成本:¥${row.material_cost}
` + return `¥${row.material_cost}` } - return res + return '无' }}, {field: 'material_images', title: __('材料凭证'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images}, - - {field: 'performance', title: __('Performance'), operate:false}, // {field: 'dispatch_type', title: __('Dispatch_type')},