/**
|
* 分公司管理管理初始化
|
*/
|
var TWithdrawal = {
|
id: "TWithdrawalTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
TWithdrawal.initColumn = function () {
|
return [
|
{field: 'selectItem', radio: true},
|
{title: '主键id', field: 'id', visible: false, align: 'center', valign: 'middle'},
|
{title: '申请时间', field: 'withdrawalTime', visible: true, align: 'center', valign: 'middle',width:'10%',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.withdrawalTime != '' && row.withdrawalTime != null) {
|
var time = row.withdrawalTime.replace(" ",'<br>');
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.withdrawalTime + '" onfocus="TUser.tooltip()">' + time + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '提现人', field: 'driverName', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.driverName != '' && row.driverName != null) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.driverName + '" onfocus="TUser.tooltip()">' + row.driverName + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '提现方式', field: 'withdrawalType', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.withdrawalType != '' && row.withdrawalType != null) {
|
if (row.withdrawalType == 1){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color: black;" title="待处理" onfocus="TUser.tooltip()">支付宝</p>']
|
}else {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color: red;" title="银行卡" onfocus="TUser.tooltip()">银行卡</p>']
|
}
|
} else{
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="-" onfocus="TUser.tooltip()">-</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '收款人信息', field: 'receivePaymentName', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.receivePaymentName != '' && row.receivePaymentName != null) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.receivePaymentName + '" onfocus="TUser.tooltip()">' + row.receivePaymentName + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '账户余额', field: 'driverBalance', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.driverBalance != '' && row.driverBalance != null) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.driverBalance + '" onfocus="TUser.tooltip()">' + row.driverBalance + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '提现金额', field: 'withdrawalMoney', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.withdrawalMoney != '' && row.withdrawalMoney != null) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.withdrawalMoney + '" onfocus="TUser.tooltip()">' + row.withdrawalMoney + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '联系电话', field: 'driverPhone', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.driverPhone != '' && row.driverPhone != null) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.driverPhone + '" onfocus="TUser.tooltip()">' + row.driverPhone + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '备注', field: 'remark', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.remark != '' && row.remark != null) {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.remark + '" onfocus="TUser.tooltip()">' + row.remark + '</p>']
|
}
|
return btn;
|
}
|
},
|
{title: '状态', field: 'status', visible: true, align: 'center', valign: 'middle',width:'10%',
|
formatter: function (value, row) {
|
var btn = "";
|
if(row.status != '' && row.status != null) {
|
if (row.status == 1){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color: black;" title="待处理" onfocus="TUser.tooltip()">待处理</p>']
|
}else if (row.status == 2){
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color: forestgreen;" title="转账成功" onfocus="TUser.tooltip()">转账成功</p>']
|
}else {
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color: red;" title="转账失败" onfocus="TUser.tooltip()">转账失败</p>']
|
}
|
} else{
|
btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="-" onfocus="TUser.tooltip()">-</p>']
|
}
|
return btn;
|
}
|
},
|
{
|
title: '操作', visible: true, align: 'center', valign: 'middle', formatter: function (value, row, index) {
|
return '<button type="button" class="btn btn-primary button-margin" onclick="TWithdrawal.detail(' + row.id + ')" id=""><i class="fa fa-search"></i> 详情</button>'; }
|
}
|
];
|
};
|
|
/**
|
* 检查是否选中
|
*/
|
TWithdrawal.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length == 0){
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}else{
|
TWithdrawal.seItem = selected[0];
|
return true;
|
}
|
};
|
|
/**
|
* 点击添加分公司管理
|
*/
|
TWithdrawal.openAddTWithdrawal = function () {
|
var index = layer.open({
|
type: 2,
|
title: '添加分公司',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/withdrawal/tWithdrawal_add'
|
});
|
this.layerIndex = index;
|
};
|
|
/**
|
* 打开查看分公司管理详情
|
*/
|
TWithdrawal.openTWithdrawalDetail = function () {
|
if (this.check()) {
|
var index = layer.open({
|
type: 2,
|
title: '编辑分公司',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/withdrawal/tWithdrawal_update/' + TWithdrawal.seItem.id
|
});
|
this.layerIndex = index;
|
}
|
};
|
|
/**
|
* 查看
|
*/
|
TWithdrawal.detail = function (id) {
|
var index = layer.open({
|
type: 2,
|
title: '查看详情',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/withdrawal/tWithdrawal_update/' + id
|
});
|
this.layerIndex = index;
|
};
|
|
|
/**
|
* 删除分公司管理
|
*/
|
TWithdrawal.delete = function () {
|
if (this.check()) {
|
var nickname = TWithdrawal.seItem.name;
|
if (nickname == "" || nickname == null || nickname == undefined) {
|
nickname = "该分公司";
|
} else {
|
nickname = "【" + nickname + "】";
|
}
|
var franchiseeNum = TWithdrawal.seItem.franchiseeNum;
|
var carNumber = TWithdrawal.seItem.carNumber;
|
var driverNumber = TWithdrawal.seItem.driverNumber;
|
if (parseInt(franchiseeNum) > 0 ||parseInt(carNumber) > 0 || parseInt(driverNumber) > 0){
|
swal("操作失败", nickname + "下还有加盟商或车辆或司机!", "warning");
|
return;
|
}
|
swal({
|
title: "您是否确认删除" + nickname + "?",
|
text: "请谨慎操作,删除后数据无法恢复!",
|
type: "warning",
|
showCancelButton: true,
|
confirmButtonColor: "#DD6B55",
|
confirmButtonText: "删除",
|
closeOnConfirm: false
|
}, function () {
|
var ajax = new $ax(Feng.ctxPath + "/withdrawal/delete", function (data) {
|
swal("删除成功", "您已经删除了" + nickname + "。", "success");
|
TWithdrawal.table.refresh();
|
}, function (data) {
|
swal("删除失败", data.responseJSON.message + "!", "warning");
|
});
|
ajax.set("tWithdrawalId", TWithdrawal.seItem.id);
|
ajax.start();
|
});
|
}
|
};
|
/**
|
* 导出
|
*/
|
TWithdrawal.export = function () {
|
window.location.href=Feng.ctxPath + "/withdrawal/excel?insertTime="+$("#insertTime").val()+
|
"&driverName="+$("#driverName").val()+
|
"&status="+$("#status").val();
|
};
|
/**
|
* 查询分公司管理列表
|
*/
|
TWithdrawal.search = function () {
|
var queryData = {};
|
queryData['insertTime'] = $("#insertTime").val();
|
queryData['driverName'] = $("#driverName").val();
|
queryData['status'] = $("#status").val();
|
TWithdrawal.table.refresh({query: queryData});
|
};
|
|
TWithdrawal.resetSearch = function () {
|
$("#insertTime").val("");
|
$("#driverName").val("");
|
$("#status").val("");
|
TWithdrawal.search();
|
};
|
|
$(function () {
|
var defaultColunms = TWithdrawal.initColumn();
|
var table = new BSTable(TWithdrawal.id, "/withdrawal/list", defaultColunms);
|
table.setPaginationType("server");
|
TWithdrawal.table = table.init();
|
});
|