/**
|
* 通知管理初始化
|
*/
|
var TimeOutAppeal = {
|
id: "TimeOutAppealTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
TimeOutAppeal.initColumn = function () {
|
return [
|
{field: 'selectItem', radio: true},
|
{title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'},
|
{title: '申请时间', field: 'createTime', align: 'center', valign: 'middle'},
|
{title: '订单ID', field: 'orderNum', align: 'center', valign: 'middle'},
|
{title: '订单类型', field: 'types', align: 'center', valign: 'middle'},
|
{title: '扣款金额', field: 'timeOutMoney', align: 'center', valign: 'middle'},
|
{title: '超时时间', field: 'timeOut', align: 'center', valign: 'middle'},
|
{title: '司机电话', field: 'driverPhone', align: 'center', valign: 'middle'},
|
{title: '司机姓名', field: 'driverName', align: 'center', valign: 'middle'},
|
{title: '申诉内容', field: 'content', align: 'center', valign: 'middle'},
|
{title: '申诉图片', field: 'imgList', align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
if (value == null || value === '') {
|
return '<a class = "view" href="javascript:void(0)"><img style="width: 50px;height:50px;" src="' + Feng.ctxPath + '/static/img/NoPIC.png" /></a>';
|
} else {
|
var arr = value.split(";");
|
var html = '';
|
for (let i = 0; i < arr.length; i++) {
|
html += '<a><img onclick="TimeOutAppeal.openBig(this)" style="width: 50px;height:50px;" src="'+ arr[i] + '" /></a> ';
|
}
|
return html;
|
}
|
},
|
events: 'operateEvents'
|
},
|
{title: '退回金额', field: 'returnMoney', align: 'center', valign: 'middle'},
|
{title: '状态', field: 'state', align: 'center', valign: 'middle',
|
formatter: function (value,row) {
|
switch (value) {
|
case 1:
|
return "未处理";
|
case 2:
|
return "同意";
|
case 3:
|
return "拒绝";
|
}
|
}
|
}
|
];
|
};
|
|
|
/// 放大图片
|
TimeOutAppeal.openBig = function(t){
|
layer.open({
|
type: 1,
|
title: false,
|
closeBtn: 0,
|
area: 'auto',
|
skin: 'layui-layer-nobg', //没有背景色
|
shadeClose: true,
|
content: '<img src="' + $(t)[0].src + '" height="100%" width="100%" />'
|
});
|
};
|
|
|
/**
|
* 检查是否选中
|
*/
|
TimeOutAppeal.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if (selected.length == 0) {
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
} else {
|
TimeOutAppeal.seItem = selected[0];
|
return true;
|
}
|
};
|
|
|
/**
|
* 同意
|
*/
|
TimeOutAppeal.agree = function(){
|
if (this.check()){
|
if (TimeOutAppeal.seItem.state != 1){
|
Feng.error("该条申诉已经处理过,不能重复处理");
|
return false;
|
}
|
|
|
var ajax = new $ax(Feng.ctxPath + '/timeOutAppeal/searchTimeOutMoney', function (data) {
|
if('' == data){
|
Feng.error("订单数据异常");
|
return
|
}
|
|
var index = layer.open({
|
type: 1,
|
title: '处理申诉',
|
area: ['800px', '400px'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: '<div class="row" style="width: 100%;margin-top: 100px">' +
|
'<div class="form-group">' +
|
'<label class="control-label col-sm-3"></label><label class="control-label col-sm-3">超时扣款金额</label>' +
|
'<div class="col-sm-3" style="margin-left: -80px"><input id="timeOutMoney" class="form-control" value="' + data + '" disabled>' +
|
'</div></div><br/><br/>' +
|
'<div class="form-group">' +
|
'<label class="control-label col-sm-3"></label><label class="control-label col-sm-3">退回金额</label>' +
|
'<div class="col-sm-3" style="margin-left: -80px"><input class="form-control" id="returnMoney">' +
|
'</div></div><br/><br/><br/><br/><br/>' +
|
'<div class="row"><label class="control-label col-sm-5"></label>' +
|
'<div class="col-sm-3"><button type="button" class="btn btn-primary" onclick="TimeOutAppeal.agreeSubmit(' + TimeOutAppeal.seItem.id + ')">' +
|
' <i class="fa fa-check"></i> 确定\n' +
|
'</button></div>' +
|
'</div>'
|
});
|
this.layerIndex = index;
|
|
|
},function (data) {
|
Feng.error(data.msg);
|
});
|
ajax.set("appealId",TimeOutAppeal.seItem.id);
|
ajax.start();
|
|
|
}
|
};
|
|
|
/**
|
* 同意提交
|
*/
|
TimeOutAppeal.agreeSubmit = function(id){
|
if ($("#returnMoney").val() === ""){
|
Feng.error("退还金额不能为空");
|
return false;
|
}
|
|
if ($("#returnMoney").val() > $("#timeOutMoney").val()){
|
Feng.error("退还金额不能大于超时扣款金额");
|
return false;
|
}
|
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/timeOutAppeal/agreeSubmit", function(data){
|
Feng.success("操作成功!");
|
TimeOutAppeal.table.refresh();
|
layer.close(window.TimeOutAppeal.layerIndex);
|
},function(data){
|
Feng.error("操作失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("id",id);
|
ajax.set("returnMoney",$('#returnMoney').val());
|
ajax.start();
|
};
|
|
|
|
/// 退回金额数值范围校验
|
// TimeOutAppeal.compare = function(t){
|
// if ($(t).val() > $("#timeOutMoney").val()){
|
// Feng.error("退还金额不能大于超时扣款金额");
|
// return false;
|
// }
|
// };
|
|
|
/**
|
* 解决
|
*/
|
TimeOutAppeal.disagree = function(){
|
if (this.check()){
|
if (TimeOutAppeal.seItem.state != 1){
|
Feng.error("该条申诉已经处理过,不能重复处理");
|
return false;
|
}
|
|
var index = layer.open({
|
type: 1,
|
title: '处理申诉',
|
area: ['800px', '400px'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: '<div class="row" style="width: 100%;margin-top: 80px">' +
|
'<div class="form-group">' +
|
'<label class="control-label col-sm-2"></label><label class="control-label col-sm-3">拒绝理由</label>' +
|
'<div class="col-sm-3" style="margin-left: -80px"><textarea id="remark" style="width: 300px;height: 150px"></textarea></div>' +
|
'</div></div><br/><br/><br/>' +
|
'<div class="row" style="width: 100%"><label class="control-label col-sm-5"></label>' +
|
'<div class="col-sm-3"><button type="button" class="btn btn-primary" onclick="TimeOutAppeal.disagreeSubmit(' + TimeOutAppeal.seItem.id + ')">' +
|
' <i class="fa fa-check"></i> 确定\n' +
|
'</button></div>' +
|
'</div>'
|
});
|
this.layerIndex = index;
|
}
|
};
|
|
|
|
/**
|
* 拒绝提交
|
*/
|
TimeOutAppeal.disagreeSubmit = function(id){
|
if ($("#remark").val() === ""){
|
Feng.error("拒绝理由不能为空");
|
return false;
|
}
|
|
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/timeOutAppeal/disagreeSubmit", function(data){
|
Feng.success("操作成功!");
|
TimeOutAppeal.table.refresh();
|
layer.close(window.TimeOutAppeal.layerIndex);
|
},function(data){
|
Feng.error("操作失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("id",id);
|
ajax.set("remark",$('#remark').val());
|
ajax.start();
|
};
|
|
|
/**
|
* 删除
|
*/
|
TimeOutAppeal.delete = function() {
|
if (this.check()){
|
|
if (TimeOutAppeal.seItem.state == 1){
|
Feng.error("只有已经被处理过的申诉才能删除");
|
return false;
|
}
|
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/timeOutAppeal/delete", function(data){
|
Feng.success("删除成功!");
|
TimeOutAppeal.table.refresh();
|
layer.close(window.TimeOutAppeal.layerIndex);
|
},function(data){
|
Feng.error("删除失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("id",TimeOutAppeal.seItem.id);
|
ajax.start();
|
}
|
};
|
|
|
|
/**
|
* 查询通知列表
|
*/
|
TimeOutAppeal.search = function () {
|
var queryData = {};
|
queryData['driverName'] = $("#driverName").val();
|
queryData['driverPhone'] = $("#driverPhone").val();
|
queryData['orderNum'] = $("#orderNum").val();
|
var arr = $("#createTime").val().split(" - ");
|
queryData['startTime'] = arr[0];
|
queryData['endTime'] = arr[1];
|
TimeOutAppeal.table.refresh({query: queryData});
|
};
|
|
$(function () {
|
var defaultColunms = TimeOutAppeal.initColumn();
|
var table = new BSTable(TimeOutAppeal.id, "/timeOutAppeal/list", defaultColunms);
|
table.setPaginationType("server");
|
TimeOutAppeal.table = table.init();
|
});
|