/**
|
* 专车改派管理管理初始化
|
*/
|
var TReassign = {
|
id: "TReassignTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
TReassign.initColumn = function () {
|
return [
|
{field: 'selectItem', radio: true},
|
{title: '主键ID', field: 'id', visible: false, align: 'center', valign: 'middle'},
|
{title: '申请改<br/>派时间', field: 'insertTime', visible: true, align: 'center', valign: 'middle',width:'8%',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.insertTime != '' && row.insertTime != null) {
|
var time = row.insertTime.replace(" ",'<br>');
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.insertTime + '" onfocus="TUser.tooltip()">' + time + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '申请司机id', field: 'originalDriverId', visible: false, align: 'center', valign: 'middle'},
|
{title: '申请司机', field: 'originalDriver', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.originalDriver != '' && row.originalDriver != null) {
|
var driverName1 = row.originalDriver.replace("-","<br>");
|
var driverName2 = row.originalDriver.replace("-"," ");
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + driverName2 + '" onfocus="TUser.tooltip()">' + driverName1 + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '申请原因', field: 'reason', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.reason != '' && row.reason != null) {
|
var str = row.reason;
|
if (str.length > 20){
|
str = str.substring(0,20)+'...<br><button class="btn btn-outline btn-primary" onclick="TReassign.buttonClick(' + row.id + ',1)">查看更多</button>';
|
}
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.reason + '" onfocus="TUser.tooltip()">' + str + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '订单id', field: 'orderId', visible: false, align: 'center', valign: 'middle'},
|
{title: '订单编号', field: 'orderNum', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.orderNum != '' && row.orderNum != null) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.orderNum + '" onfocus="TUser.tooltip()">' + row.orderNum + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '下单用户', field: 'addOrderUser', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.addOrderUser != '' && row.addOrderUser != null) {
|
var name1 = row.addOrderUser.replace("-","<br>");
|
var name2 = row.addOrderUser.replace("-"," ");
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + name2 + '" onfocus="TUser.tooltip()">' + name1 + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '出发时间', field: 'travelTime', visible: true, align: 'center', valign: 'middle',width:'10%',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.travelTime != '' && row.travelTime != null) {
|
var time = row.travelTime.replace(" ",'<br>');
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.travelTime + '" onfocus="TUser.tooltip()">' + time + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '出发地', field: 'startAddress', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.startAddress != '' && row.startAddress != null) {
|
var str = row.startAddress;
|
var str1 = "";
|
var arr = "";
|
for(var i=0,len=str.length/15;i<len;i++) {
|
str1 = str.substr(0,15);
|
str = str.replace(str1,'');
|
arr += str1 + "<br>";
|
}
|
arr = arr.substring(0,arr.length-4);
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.startAddress + '" onfocus="TUser.tooltip()">' + arr + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '目的地', field: 'endAddress', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.endAddress != '' && row.endAddress != null) {
|
var str = row.endAddress;
|
var str1 = "";
|
var arr = "";
|
for(var i=0,len=str.length/15;i<len;i++) {
|
str1 = str.substr(0,15);
|
str = str.replace(str1,'');
|
arr += str1 + "<br>";
|
}
|
arr = arr.substring(0,arr.length-4);
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.endAddress + '" onfocus="TUser.tooltip()">' + arr + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '原始车辆id', field: 'originalCarId', visible: false, align: 'center', valign: 'middle'},
|
{title: '原服务<br/>车辆', field: 'originalCar', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.originalCar != '' && row.originalCar != null) {
|
var car1 = row.originalCar.replace("-","<br>");
|
var car2 = row.originalCar.replace("-"," ");
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + car2 + '" onfocus="TUser.tooltip()">' + car1 + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '改派<br/>处罚金', field: 'money', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.money != '' && row.money != null) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.money + '" onfocus="TUser.tooltip()">' + row.money + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '改派后的司机id', field: 'nowDriverId', visible: false, align: 'center', valign: 'middle'},
|
{title: '改派服<br/>务司机', field: 'nowDriver', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.nowDriver != '' && row.nowDriver != null) {
|
var driverName1 = row.nowDriver.replace("-","<br>");
|
var driverName2 = row.nowDriver.replace("-"," ");
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + driverName2 + '" onfocus="TUser.tooltip()">' + driverName1 + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '改派后的车辆id', field: 'nowCarId', visible: false, align: 'center', valign: 'middle'},
|
{title: '改派服<br/>务车辆', field: 'nowCar', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.nowCar != '' && row.nowCar != null) {
|
var car1 = row.nowCar.replace("-","<br>");
|
var car2 = row.nowCar.replace("-"," ");
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + car2 + '" onfocus="TUser.tooltip()">' + car1 + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '订单当<br/>前状态', field: 'orderState', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.orderState != '' && row.orderState != null) {
|
if (row.orderState == 1){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="待接单" onfocus="TUser.tooltip()">待接单</p>']
|
} else if (row.orderState == 2){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="待出发" onfocus="TUser.tooltip()">待出发</p>']
|
} else if (row.orderState == 3){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="待到达预约地点" onfocus="TUser.tooltip()">待到达预约地点</p>']
|
} else if (row.orderState == 4){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="待取货" onfocus="TUser.tooltip()">待乘客上车</p>']
|
} else if (row.orderState == 5){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="服务中" onfocus="TUser.tooltip()">服务中</p>']
|
} else if (row.orderState == 6){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="已送达" onfocus="TUser.tooltip()">完成服务</p>']
|
} else if (row.orderState == 7){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="待支付" onfocus="TUser.tooltip()">待支付</p>']
|
} else if (row.orderState == 8){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="需补差价" onfocus="TUser.tooltip()">待评价</p>']
|
} else if (row.orderState == 9){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="已取货" onfocus="TUser.tooltip()">已完成</p>']
|
} else if (row.orderState == 10){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="已取消" onfocus="TUser.tooltip()">已取消</p>']
|
} else if (row.orderState == 11){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="改派中" onfocus="TUser.tooltip()">改派中</p>']
|
} else if (row.orderState == 12){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="已支付差价" onfocus="TUser.tooltip()">取消待支付</p>']
|
}
|
}
|
return btn;
|
}
|
},
|
{title: '改派<br/>状态', field: 'state', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.state != '' && row.state != null) {
|
if (row.state == 1){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="提交申请" onfocus="TUser.tooltip()">提交申请</p>']
|
} else if (row.state == 2){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="已支付" onfocus="TUser.tooltip()">已支付</p>']
|
} else if (row.state == 3){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="已改派" onfocus="TUser.tooltip()">已改派</p>']
|
} else if (row.state == 4){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="已取消" onfocus="TUser.tooltip()">已取消</p>']
|
} else if (row.state == 5){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="已拒绝" onfocus="TUser.tooltip()">已拒绝</p>']
|
}
|
}
|
return btn;
|
}
|
}
|
];
|
};
|
|
/**
|
* 检查是否选中
|
*/
|
TReassign.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length == 0){
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}else{
|
TReassign.seItem = selected[0];
|
return true;
|
}
|
};
|
|
/**
|
* 打开查看专车改派管理详情
|
*/
|
TReassign.reassignment = function () {
|
if (this.check()) {
|
if (TReassign.seItem.orderState != 11) {
|
swal("改派失败", "【改派中】状态下才能执行此操作", "warning");
|
return;
|
}
|
var index = layer.open({
|
type: 2,
|
title: '立即改派',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tReassign/tReassign_reassignmentSmall/' + TReassign.seItem.id
|
});
|
this.layerIndex = index;
|
}
|
};
|
|
/**
|
* 操作 1=拒绝 2=取消
|
*/
|
TReassign.opt = function (type) {
|
if (this.check()) {
|
var confirm = "";
|
if (1 == type){
|
confirm = "拒绝改派";
|
}else if (2 == type){
|
confirm = "取消订单";
|
}
|
if (TReassign.seItem.orderState != 11) {
|
swal("操作失败", "【改派中】状态下才能执行此操作", "warning");
|
return;
|
}
|
swal({
|
title: "您是否确定" + confirm + "?",
|
text: "请谨慎操作,操作后数据无法恢复!",
|
type: "warning",
|
showCancelButton: true,
|
confirmButtonColor: "#DD6B55",
|
confirmButtonText: confirm,
|
closeOnConfirm: false
|
}, function () {
|
var ajax = new $ax(Feng.ctxPath + "/tReassign/optSmall", function (data) {
|
swal(confirm+"成功", "您已经成功" + confirm + "。", "success");
|
TReassign.table.refresh();
|
}, function (data) {
|
swal(confirm+"失败", data.responseJSON.message + "!", "warning");
|
});
|
ajax.set("tReassignId", TReassign.seItem.id);
|
ajax.set("optType", type);
|
ajax.start();
|
});
|
}
|
};
|
|
|
var key = CryptoJS.enc.Utf8.parse("xqT86jictTPpHMem");
|
var iv = CryptoJS.enc.Utf8.parse("xqT86jicxqT86jic");
|
|
//aes加密
|
function encryptAES(context) {
|
if(null == context || '' == context){
|
return context;
|
}
|
var encrypted = '';
|
if (typeof(context) == 'string') {
|
|
}else if(typeof(context) == 'object'){
|
context = JSON.stringify(context);
|
}
|
var srcs = CryptoJS.enc.Utf8.parse(context);
|
encrypted = CryptoJS.AES.encrypt(srcs, key, {
|
iv: iv,
|
mode: CryptoJS.mode.CBC,
|
padding: CryptoJS.pad.Pkcs7
|
});
|
return encrypted.toString();
|
}
|
// aes解密
|
function decryptAES(context) {
|
if(null == context || '' == context){
|
return context;
|
}
|
var decrypt = CryptoJS.AES.decrypt(context, key, {
|
iv: iv,
|
mode: CryptoJS.mode.CBC,
|
padding: CryptoJS.pad.Pkcs7
|
});
|
var decryptedStr = decrypt.toString(CryptoJS.enc.Utf8);
|
return decryptedStr.toString();
|
}
|
|
|
/**
|
* 查询专车改派管理列表
|
*/
|
TReassign.search = function () {
|
var queryData = {};
|
queryData['insertTime'] = $("#insertTime").val();
|
queryData['originalDriverName'] = $("#originalDriverName").val();
|
queryData['originalDriverPhone'] = encryptAES($("#originalDriverPhone").val());
|
queryData['orderNum'] = $("#orderNum").val();
|
queryData['nowDriverName'] = $("#nowDriverName").val();
|
queryData['nowDriverPhone'] = encryptAES($("#nowDriverPhone").val());
|
queryData['orderState'] = $("#orderState").val();
|
queryData['state'] = $("#state").val();
|
TReassign.table.refresh({query: queryData});
|
};
|
|
TReassign.resetSearch = function () {
|
$("#insertTime").val("");
|
$("#originalDriverName").val("");
|
$("#originalDriverPhone").val("");
|
$("#orderNum").val("");
|
$("#nowDriverName").val("");
|
$("#nowDriverPhone").val("");
|
$("#orderState").val("");
|
$("#state").val("");
|
TReassign.search();
|
};
|
|
$(function () {
|
var defaultColunms = TReassign.initColumn();
|
var table = new BSTable(TReassign.id, "/tReassign/listSmallPieceLogistics", defaultColunms);
|
table.setPaginationType("server");
|
TReassign.table = table.init();
|
});
|