From bb80209ffb81d7f38ee33da879b111f76268c0a1 Mon Sep 17 00:00:00 2001
From: xman <1946321327@qq.com>
Date: Fri, 18 Apr 2025 16:37:28 +0800
Subject: [PATCH] cmd
---
.../controller/orders/Dispatchrecord.php | 10 +-
.../lang/zh-cn/orders/dispatchrecord.php | 4 +-
.../admin/view/orders/dispatch2/index.html | 2 +-
.../admin/view/orders/dispatchlog/index.html | 5 +-
.../admin/view/orders/dispatchrecord/add.html | 36 ++++--
public/assets/js/backend/orders/dispatch2.js | 110 +++++++++++-------
.../assets/js/backend/orders/dispatchlog.js | 81 ++++++-------
7 files changed, 151 insertions(+), 97 deletions(-)
diff --git a/application/admin/controller/orders/Dispatchrecord.php b/application/admin/controller/orders/Dispatchrecord.php
index 51c8642..7648956 100644
--- a/application/admin/controller/orders/Dispatchrecord.php
+++ b/application/admin/controller/orders/Dispatchrecord.php
@@ -119,7 +119,15 @@ class Dispatchrecord extends Backend
$params['admin_id'] = $this->auth->id;
$result = $this->model->allowField(true)->save($params);
- OrderDispatch::where('id',$params['dispatch_id'])->where('follow',0)->update(['follow'=>1]);
+ $dispatch = OrderDispatch::get($params['dispatch_id']);
+
+ if(empty($dispatch)){
+ $this->error('任务不存在');
+ }
+ $dispatch->follow = 1;
+ $dispatch->record_count += 1;
+ $dispatch->save();
+
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();
diff --git a/application/admin/lang/zh-cn/orders/dispatchrecord.php b/application/admin/lang/zh-cn/orders/dispatchrecord.php
index ac79d27..5b6ddbd 100644
--- a/application/admin/lang/zh-cn/orders/dispatchrecord.php
+++ b/application/admin/lang/zh-cn/orders/dispatchrecord.php
@@ -3,7 +3,7 @@
return [
'Dispatch_id' => '任务ID',
'Worker_id' => '师傅ID',
- 'Remark' => '备注',
+ 'Remark' => '跟进内容',
'Need_notice' => '是否提醒',
'Need_notice 0' => '不需要',
'Need_notice 1' => '需要',
@@ -12,7 +12,7 @@ return [
'Set status to 0'=> '设为未通知',
'Status 1' => '已通知',
'Set status to 1'=> '设为已通知',
- 'Notice_time' => '提醒时间',
+ 'Notice_time' => '下次跟进',
'Create_time' => '创建时间',
'Update_time' => '更新时间',
'Admin_id' => '管理员ID'
diff --git a/application/admin/view/orders/dispatch2/index.html b/application/admin/view/orders/dispatch2/index.html
index 1a19729..da3e517 100644
--- a/application/admin/view/orders/dispatch2/index.html
+++ b/application/admin/view/orders/dispatch2/index.html
@@ -22,7 +22,7 @@
{:__('Delete')}
-->
- {:__('创建报错')}
+ {:__('上报错误')}
{:__('取消任务')}
diff --git a/application/admin/view/orders/dispatchlog/index.html b/application/admin/view/orders/dispatchlog/index.html
index a179e4e..620a14d 100644
--- a/application/admin/view/orders/dispatchlog/index.html
+++ b/application/admin/view/orders/dispatchlog/index.html
@@ -3,8 +3,8 @@
+
+
+
+
+
+
+
+
+
-
diff --git a/public/assets/js/backend/orders/dispatch2.js b/public/assets/js/backend/orders/dispatch2.js
index b3d5c89..5dc7a51 100644
--- a/public/assets/js/backend/orders/dispatch2.js
+++ b/public/assets/js/backend/orders/dispatch2.js
@@ -38,7 +38,28 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
return '';
}},
+ {
+ field: 'follow',
+ title: '跟进状态',
+ searchList: {
+ '0':'待跟进',
+ "1": '已跟进',
+ "2": '已结束',
+ },
+ formatter: Table.api.formatter.label,
+ custom: {
+ '0': 'warning', // 待跟进:灰蓝色(默认 Bootstrap info)
+ '1': 'success', // 已跟进:绿色
+ '2': 'default', // 已结束:红色
+ },
+ defaultValue: '0'
+ },
+
+ {field: 'record_count', title: '跟进次数',operate: false},
+
{field: 'id', title: __('Id'), operate: '='},
+
+
//{field: 'order_id', title: __('Order_id')},
{field: 'order.order_no', title: __('Order.order_no'), operate: '='},
@@ -49,6 +70,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
formatter: Table.api.formatter.status,
custom:{25:"red"}
},
+ //{field: 'follow', title: __('跟进状态'), searchList: {"0":__('待跟进'),"1":__('已跟进'),"2":__('已结束')}, formatter: Table.api.formatter.normal},
// {field: 'worker_id', title: __('Worker_id')},
{field: 'worker_name', title: __('Worker_name'), operate: 'LIKE'},
@@ -66,9 +88,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
}
}},
-
- {field: 'follow', title: __('跟进状态'), searchList: {"0":__('待跟进'),"1":__('已跟进'),"2":__('已结束')}, formatter: Table.api.formatter.normal},
-
{field: 'order.source_shop', title: __('Order.source_shop'), operate: '='},
// {field: 'order.source', title: __('Order.source')},
{field: 'order.customer', title: __('Order.customer'), operate: false},
@@ -179,56 +198,61 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','layer'], function ($,
}
// 弹出确认框并要求输入文本
- Layer.prompt({
- title: "请输入操作理由",
- formType: 2, // 多行文本输入框
- }, function (inputValue, index) {
- if (!inputValue) {
- Layer.alert("输入内容不能为空!");
- return;
- }
- // 关闭弹出框
- Layer.close(index);
+ Layer.open({
+ type: 1,
+ title: '请输入操作理由',
+ area: ['450px', '280px'], // 宽高可调
+ btn: ['提交', '取消'],
+ content: '
' +
+ '
' +
+ '提示:取消后该订单会重新进入待派单状态' +
+ '
' +
+ '
' +
+ '
',
+ yes: function(index, layero) {
+ var inputValue = $("#input-reason").val().trim();
- // 显示 loading 层
- var loadingIndex = Layer.load(1, {
- shade: [0.2, '#ccc'], // 背景遮罩,可选
- });
-
-
- //这里可以加入 Ajax 请求处理逻辑
- $.ajax({
- url: 'orders/dispatch2/del',
- type: 'POST',
- data: {
- ids: selectedIds,
- reason: inputValue,
- },
- success: function (response,data) {
- Layer.close(loadingIndex); // 关闭 loading
- if(response.code == 1){
- // 成功提示
- Toastr.success(data.message || "操作成功!");
- // 刷新表格
- table.bootstrapTable('refresh');
- }else{
- Toastr.error(response.msg || "操作失败!");
- }
- return;
- },
- error: function () {
- Layer.close(loadingIndex); // 关闭 loading
- Toastr.error("操作失败,请重试!");
+ if (!inputValue) {
+ Layer.msg('输入内容不能为空!');
return;
}
- });
+ Layer.close(index);
+
+ var loadingIndex = Layer.load(1, {
+ shade: [0.2, '#ccc']
+ });
+
+ $.ajax({
+ url: 'orders/dispatch2/del',
+ type: 'POST',
+ data: {
+ ids: selectedIds, // 确保 selectedIds 已定义
+ reason: inputValue
+ },
+ success: function(response) {
+ Layer.close(loadingIndex);
+ if (response.code == 1) {
+ Toastr.success(response.message || "操作成功!");
+ table.bootstrapTable('refresh');
+ } else {
+ Toastr.error(response.msg || "操作失败!");
+ }
+ },
+ error: function() {
+ Layer.close(loadingIndex);
+ Toastr.error("操作失败,请重试!");
+ }
+ });
+ }
});
});
+
+
// 获取选中项
$(document).on("click", ".btn-add-normal", function () {
// 获取选中项的 ID
diff --git a/public/assets/js/backend/orders/dispatchlog.js b/public/assets/js/backend/orders/dispatchlog.js
index 1bfb87e..bd77d03 100644
--- a/public/assets/js/backend/orders/dispatchlog.js
+++ b/public/assets/js/backend/orders/dispatchlog.js
@@ -62,6 +62,48 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// 表格1
var table1 = $("#table1");
table1.bootstrapTable({
+ url: 'orders/dispatchrecord/index' + location.search,
+ /* extend: {
+ index_url: '',
+ add_url: '',
+ edit_url: '',
+ del_url: '',
+ multi_url: '',
+ table: '',
+ },*/
+ toolbar: '#toolbar2',
+ sortName: 'id',
+ search: false,
+ commonSearch:false,
+ visible: false,
+ showToggle: false,
+ showColumns: false,
+ showExport: false,
+ columns: [
+ [
+ {field: 'id', title: __('Id')},
+ //{field: 'dispatch_id', title: __('Dispatch_id')},
+ //{field: 'worker_id', title: __('Worker_id')},
+ {field: 'remark', title: __('跟进内容'), operate: 'LIKE', table: table2, class: 'autocontent', formatter: Table.api.formatter.content},
+ {field: 'images', title: __('跟进依据'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
+ /* {field: 'need_notice', title: __('需要提醒'), searchList: {"0":__('否'),"1":__('是')}, formatter: Table.api.formatter.normal},
+ {field: 'notice_time', title: __('提醒时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},*/
+ {field: 'status', title: __('状态'), searchList: {"0":__('进行中'),"1":__('已完成')}, formatter: Table.api.formatter.status},
+ {field: 'create_time', title: __('创建时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
+ //{field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
+ ]
+ ]
+
+
+ });
+
+ // 为表格1绑定事件
+ Table.api.bindevent(table1);
+ },
+ second: function () {
+ // 表格2
+ var table2 = $("#table2");
+ table2.bootstrapTable({
url: 'orders/dispatchlog/index' + location.search,
toolbar: '#toolbar1',
sortName: 'id',
@@ -85,45 +127,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
]
]
});
-
- // 为表格1绑定事件
- Table.api.bindevent(table1);
- },
- second: function () {
- // 表格2
- var table2 = $("#table2");
- table2.bootstrapTable({
- url: 'orders/dispatchrecord/index' + location.search,
- /* extend: {
- index_url: '',
- add_url: '',
- edit_url: '',
- del_url: '',
- multi_url: '',
- table: '',
- },*/
- toolbar: '#toolbar2',
- sortName: 'id',
- search: false,
- commonSearch:false,
- visible: false,
- showToggle: false,
- showColumns: false,
- showExport: false,
- columns: [
- [
- {field: 'id', title: __('Id')},
- //{field: 'dispatch_id', title: __('Dispatch_id')},
- //{field: 'worker_id', title: __('Worker_id')},
- {field: 'remark', title: __('跟进内容'), operate: 'LIKE', table: table2, class: 'autocontent', formatter: Table.api.formatter.content},
- {field: 'need_notice', title: __('需要提醒'), searchList: {"0":__('否'),"1":__('是')}, formatter: Table.api.formatter.normal},
- {field: 'notice_time', title: __('提醒时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
- {field: 'status', title: __('状态'), searchList: {"0":__('进行中'),"1":__('已完成')}, formatter: Table.api.formatter.status},
- {field: 'create_time', title: __('创建时间'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
- //{field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
- ]
- ]
- });
// 为表格2绑定事件
Table.api.bindevent(table2);
}