订单操作
This commit is contained in:
parent
017d9456c3
commit
6b5d8df018
|
|
@ -40,3 +40,83 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
/* 派单按钮 */
|
||||
.button-dispatch {
|
||||
background-color: #4CAF50; /* Material Design的绿色 */
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.button-dispatch:hover {
|
||||
background-color: #45A049; /* 深一点的绿色 */
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
/* 编辑按钮 */
|
||||
.button-edit {
|
||||
background-color: #1976D2; /* Material Design的蓝色 */
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.button-edit:hover {
|
||||
background-color: #1565C0;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
/* 复制按钮 */
|
||||
.button-copy {
|
||||
background-color: #388E3C; /* Bootstrap的绿色 */
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.button-copy:hover {
|
||||
background-color: #2C6B2F;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
/* 催单按钮 */
|
||||
.button-remind {
|
||||
background-color: #FF9800; /* Material Design的橙色 */
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.button-remind:hover {
|
||||
background-color: #FB8C00;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
/* 订单报错按钮 */
|
||||
.button-error {
|
||||
background-color: #D32F2F; /* Material Design的红色 */
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.button-error:hover {
|
||||
background-color: #C62828;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
/* 取消按钮 */
|
||||
.button-cancel {
|
||||
background-color: #757575; /* Material Design的灰色 */
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.button-cancel:hover {
|
||||
background-color: #616161;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
/* 更多按钮 */
|
||||
.button-more {
|
||||
background-color: #607D8B; /* Material Design的蓝灰色 */
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.button-more:hover {
|
||||
background-color: #546E7A;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ define([], function () {
|
|||
var zoom_id = $(that).data("zoom-id") ? $(that).data("zoom-id") : "";
|
||||
var lat = lat_id ? $("#" + lat_id).val() : '';
|
||||
var lng = lng_id ? $("#" + lng_id).val() : '';
|
||||
var city_code = $("#area_id").val();
|
||||
var city_code = $("#c-city").val();
|
||||
var zoom = zoom_id ? $("#" + zoom_id).val() : '';
|
||||
var url = "/addons/address/index/select?1=1";
|
||||
var url = "/addons/address/index/select?a=1";
|
||||
url += (lat && lng) ? 'lat=' + lat + '&lng=' + lng +
|
||||
(input_id ? "&address=" + $("#" + input_id).val() : "")
|
||||
+(zoom ? "&zoom=" + zoom : "") : ''
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
define(['jquery', 'bootstrap', 'backend', 'table', 'form','cascader'], function ($, undefined, Backend, Table, Form) {
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'cascader'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
function clearInfo() {
|
||||
$('[name^="row["]').val('');
|
||||
|
|
@ -6,6 +6,43 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','cascader'], function
|
|||
$(".selectpicker").val('').selectpicker('refresh');
|
||||
}
|
||||
|
||||
function copyToClipboard(text) {
|
||||
// 创建一个隐藏的 textarea 元素
|
||||
const textarea = document.createElement('textarea');
|
||||
textarea.value = text;
|
||||
document.body.appendChild(textarea);
|
||||
|
||||
// 选中内容并复制
|
||||
textarea.select();
|
||||
document.execCommand('copy');
|
||||
|
||||
// 移除 textarea 元素
|
||||
document.body.removeChild(textarea);
|
||||
Toastr.info('复制成功');
|
||||
}
|
||||
|
||||
// 拼装文本
|
||||
function assembleOrderMessage(data) {
|
||||
const message = `
|
||||
【订单详情】
|
||||
录单员: ${data.user.nickname}
|
||||
订单编号: ${data.order_no}
|
||||
客户姓名: ${data.customer}
|
||||
客户电话: ${data.tel}
|
||||
订单状态: ${data.status_text}
|
||||
地域: ${data.area.merge_name}
|
||||
详细地址: ${data.address}
|
||||
派单方式: ${data.dispatch_type === 1 ? '手动派单' : '自动派单'}
|
||||
收款方式: ${data.collect_text || '未收款'}
|
||||
订单来源: ${data.source_shop}
|
||||
服务名称: ${data.item_title}
|
||||
|
||||
请查收以上订单信息。`;
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
// 初始化表格参数配置
|
||||
|
|
@ -130,73 +167,62 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','cascader'], function
|
|||
table: table,
|
||||
events: Table.api.events.operate,
|
||||
formatter: Table.api.formatter.operate,
|
||||
align:"left",
|
||||
align: "left",
|
||||
buttons: [
|
||||
{
|
||||
name: 'edit',
|
||||
text:"编辑",
|
||||
text: "编辑",
|
||||
icon: 'fa fa-pencil',
|
||||
title: __('Edit'),
|
||||
extend: 'data-toggle="tooltip" data-container="body"',
|
||||
classname: 'btn btn-xs btn-success btn-editone'
|
||||
classname: 'btn btn-xs button-edit btn-editone',
|
||||
|
||||
},
|
||||
{
|
||||
name: 'push',
|
||||
icon: 'fa fa-copy',
|
||||
title: '复制',
|
||||
text:"复制",
|
||||
text: "复制",
|
||||
url: 'order/copy',
|
||||
extend: 'data-toggle="tooltip" data-container="body"',
|
||||
classname: 'btn btn-xs btn-info btn-dialog',
|
||||
callback: function ($data){
|
||||
classname: 'btn btn-xs button-copy btn-dialog',
|
||||
callback: function ($data) {
|
||||
console.log($data);
|
||||
}
|
||||
},
|
||||
dropdown: "更多"
|
||||
},
|
||||
{
|
||||
name:"dispatch",
|
||||
text:"派单",
|
||||
title:"派单",
|
||||
name: "dispatch",
|
||||
text: "派单",
|
||||
title: "派单",
|
||||
extend: 'data-toggle="tooltip" data-container="body"',
|
||||
classname: 'btn btn-xs btn-info btn-dialog',
|
||||
classname: 'btn btn-xs button-dispatch btn-dialog',
|
||||
//classname:"btn-view btn-dialog",
|
||||
icon:'fa fa-add',
|
||||
url: function(row){
|
||||
return 'orders/dispatch/add?order_id='+row.id;
|
||||
icon: 'fa fa-add',
|
||||
url: function (row) {
|
||||
return 'orders/dispatch/add?order_id=' + row.id;
|
||||
},
|
||||
visible:function(row){
|
||||
if(row.status == 10){
|
||||
visible: function (row) {
|
||||
if (row.status == 10) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
refresh:true,
|
||||
refresh: true,
|
||||
},
|
||||
{
|
||||
name: 'send',
|
||||
text: '中转订单',
|
||||
title: '中转订单',
|
||||
classname: 'btn btn-xs btn-info btn-dialog',
|
||||
icon: 'fa fa-send',
|
||||
url: 'order/send',
|
||||
visible:function(row){
|
||||
if(row.status == 10){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
},
|
||||
{
|
||||
name:"reminder",
|
||||
text:"催单",
|
||||
title:"派单",
|
||||
name: "reminder",
|
||||
text: "催单",
|
||||
title: "派单",
|
||||
extend: 'data-toggle="tooltip" data-container="body"',
|
||||
classname: 'btn btn-xs btn-info btn-magic btn-ajax',
|
||||
classname: 'btn btn-xs button-remind btn-magic btn-ajax',
|
||||
icon: 'fa fa-bolt',
|
||||
url: 'order/reminder',
|
||||
dropdown: "更多",
|
||||
success: function (data, ret) {
|
||||
if (ret.code === 1){
|
||||
if (ret.code === 1) {
|
||||
Layer.alert('催单成功');
|
||||
}else {
|
||||
} else {
|
||||
Layer.alert(ret.msg);
|
||||
}
|
||||
return false;
|
||||
|
|
@ -208,31 +234,34 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','cascader'], function
|
|||
Layer.alert(ret.msg);
|
||||
return false;
|
||||
},
|
||||
visible:function(row){
|
||||
if(row.status > 0){
|
||||
visible: function (row) {
|
||||
if (row.status > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
},
|
||||
{
|
||||
name:"error",
|
||||
text:"订单报错",
|
||||
title:"订单报错",
|
||||
name: "copy_text",
|
||||
text: "复制信息",
|
||||
title: "复制信息",
|
||||
extend: 'data-toggle="tooltip" data-container="body"',
|
||||
classname: 'btn btn-xs btn-warning btn-dialog',
|
||||
icon: 'fa fa-bolt',
|
||||
url: 'order/addAbnormal',
|
||||
refresh:true,
|
||||
classname: 'btn btn-xs button-error btn-click',
|
||||
icon: 'fa fa-text',
|
||||
click: function (data, item) {
|
||||
const text = assembleOrderMessage(item);
|
||||
copyToClipboard(text);
|
||||
}
|
||||
}, {
|
||||
name: 'delete',
|
||||
text: '取消',
|
||||
title: '取消',
|
||||
classname: 'btn btn-xs btn-danger btn-dialog',
|
||||
classname: 'btn btn-xs button-cancel btn-dialog',
|
||||
icon: 'fa fa-trash',
|
||||
url: 'order/delete',
|
||||
visible:function(row){
|
||||
if(row.status >= 0){
|
||||
dropdown: "更多",
|
||||
visible: function (row) {
|
||||
if (row.status >= 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -248,79 +277,79 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','cascader'], function
|
|||
Table.api.bindevent(table);
|
||||
let cloneQueryParams = null;
|
||||
//绑定tab事件
|
||||
$('a[data-toggle="tab"]').on('show.bs.tab',function(event){
|
||||
let type =$(this).attr("data-value");
|
||||
$('a[data-toggle="tab"]').on('show.bs.tab', function (event) {
|
||||
let type = $(this).attr("data-value");
|
||||
let options = table.bootstrapTable('getOptions');
|
||||
$('.nav-tabs li').attr('class','');
|
||||
$(this).parent().attr("class",'active');
|
||||
options.pageNumber =1;
|
||||
$('.nav-tabs li').attr('class', '');
|
||||
$(this).parent().attr("class", 'active');
|
||||
options.pageNumber = 1;
|
||||
if (cloneQueryParams == null) {
|
||||
cloneQueryParams = options.queryParams;
|
||||
}
|
||||
|
||||
options.queryParams =function(params){
|
||||
options.queryParams = function (params) {
|
||||
params.type = type;
|
||||
return cloneQueryParams(params);
|
||||
};
|
||||
table.bootstrapTable('refresh',{});
|
||||
table.bootstrapTable('refresh', {});
|
||||
return false;
|
||||
});
|
||||
|
||||
},
|
||||
add: function () {
|
||||
$("#mybuttom").on("click", function() {
|
||||
$("#mybuttom").on("click", function () {
|
||||
Form.api.submit($("form[role=form]"));
|
||||
Toastr.success('录入成功');
|
||||
return false;
|
||||
});
|
||||
Form.api.bindevent($("form[role=form]"),function (success,ret) {
|
||||
Form.api.bindevent($("form[role=form]"), function (success, ret) {
|
||||
clearInfo();
|
||||
Toastr.success('操作成功');
|
||||
return false;
|
||||
},);
|
||||
$("#c-city").on("cp:updated", function() {
|
||||
$("#c-city").on("cp:updated", function () {
|
||||
var citypicker = $(this).data("citypicker");
|
||||
var code = citypicker.getCode("district") || citypicker.getCode("city") || citypicker.getCode("province");
|
||||
|
||||
$("#area_id").val(code);
|
||||
$("#area_name").val(citypicker.getVal());
|
||||
});
|
||||
$("[data-toggle='addresspicker']").data("callback", function(res){
|
||||
$("[data-toggle='addresspicker']").data("callback", function (res) {
|
||||
Form.api.target($('#c-address'));
|
||||
});
|
||||
|
||||
var _data = items;
|
||||
|
||||
$('#item_id').zdCascader({
|
||||
data:_data,
|
||||
onChange: function ($this,data,allPathData) {
|
||||
data: _data,
|
||||
onChange: function ($this, data, allPathData) {
|
||||
// console.log(data,allPathData);
|
||||
$('#item_id_value').val(data.value);
|
||||
}
|
||||
});
|
||||
$('#item_id').val($('#item_id').data('value')).focus();
|
||||
$("#smart").on("click", function() {
|
||||
$("#smart").on("click", function () {
|
||||
$.ajax({
|
||||
url: "order/smart", // 你的 API 地址
|
||||
type: "GET",
|
||||
dataType: "json",
|
||||
data: {
|
||||
str:$('#smart_text').val()
|
||||
str: $('#smart_text').val()
|
||||
},
|
||||
success: function (data) {
|
||||
if (data.code === 1){
|
||||
if (data.code === 1) {
|
||||
data = data.data;
|
||||
if (data.mobile !== ''){
|
||||
if (data.mobile !== '') {
|
||||
$('#c-tel').val(data.mobile);
|
||||
}
|
||||
if (data.name !== ''){
|
||||
if (data.name !== '') {
|
||||
$('#c-customer').val(data.name);
|
||||
}
|
||||
if (data.item.id !== 0){
|
||||
if (data.item.id !== 0) {
|
||||
$('#item_id_value').val(data.item.id);
|
||||
$('#item_id').val(data.item.item);
|
||||
}
|
||||
if (data.idn){
|
||||
if (data.idn) {
|
||||
$('#c-source-id').val(data.idn);
|
||||
}
|
||||
let citypicker = $('#c-city');
|
||||
|
|
@ -329,7 +358,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','cascader'], function
|
|||
// city: data.city,
|
||||
// district: data.region
|
||||
// });
|
||||
citypicker.val(data.province + '/' + data.city + '/'+ data.region);
|
||||
citypicker.val(data.province + '/' + data.city + '/' + data.region);
|
||||
citypicker = citypicker.data("citypicker");
|
||||
citypicker.refresh();
|
||||
var code = citypicker.getCode("district") || citypicker.getCode("city") || citypicker.getCode("province");
|
||||
|
|
@ -352,7 +381,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','cascader'], function
|
|||
},
|
||||
addabnormal: function () {
|
||||
console.log('abnormal');
|
||||
Form.api.bindevent($("#add-form"),null,null,function (data) {
|
||||
Form.api.bindevent($("#add-form"), null, null, function (data) {
|
||||
Form.api.submit($("#add-form"));
|
||||
// console.log(data);
|
||||
// return false;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@
|
|||
86: {
|
||||
'A-G': [
|
||||
{code: '340000', address: '安徽省'},
|
||||
{code: '110000', address: '北京'},
|
||||
{code: '110000', address: '北京市'},
|
||||
{code: '500000', address: '重庆'},
|
||||
{code: '350000', address: '福建省'},
|
||||
{code: '620000', address: '甘肃省'},
|
||||
|
|
@ -99,7 +99,7 @@
|
|||
},
|
||||
|
||||
"110000": {
|
||||
"110100": "北京市"
|
||||
"110100": "市辖区"
|
||||
},
|
||||
"110100": {
|
||||
"110101": "东城区",
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@
|
|||
86: {
|
||||
'A-G': [
|
||||
{code: '340000', address: '安徽省'},
|
||||
{code: '110000', address: '北京'},
|
||||
{code: '110000', address: '北京市'},
|
||||
{code: '500000', address: '重庆'},
|
||||
{code: '350000', address: '福建省'},
|
||||
{code: '620000', address: '甘肃省'},
|
||||
|
|
@ -99,7 +99,7 @@
|
|||
},
|
||||
|
||||
"110000": {
|
||||
"110100": "北京市"
|
||||
"110100": "市辖区"
|
||||
},
|
||||
"110100": {
|
||||
"110101": "东城区",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user