/**
|
* 管理初始化
|
*/
|
var TDriver = {
|
id: "TDriverTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
TDriver.initColumn = function () {
|
return [
|
{field: 'selectItem', radio: true},
|
{title: '主键', field: 'id', visible: true, align: 'center', valign: 'middle'},
|
{title: '编号', field: 'code', visible: true, align: 'center', valign: 'middle'},
|
{title: '姓名', field: 'name', visible: true, align: 'center', valign: 'middle'},
|
{title: '手机号', field: 'phone', visible: true, align: 'center', valign: 'middle'},
|
{title: '性别', field: 'sex', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
if (row.sex === 1){
|
return '<span>男</span>'
|
}else if (row.sex === 2){
|
return '<span>女</span>'
|
}else {
|
return '<span>未知</span>'
|
}
|
}},
|
{title: '驾驶证号码', field: 'driverLicenseNumber', visible: true, align: 'center', valign: 'middle'},
|
{title: '身份证号码', field: 'idcard', visible: true, align: 'center', valign: 'middle'},
|
{title: '身份证', field: 'source', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
if (null != row.idcardFront){
|
return '<span>已上传</span>'
|
}else{
|
return '<span>未上传</span>'
|
}
|
}},
|
{title: '所属代理商', field: 'agentName', visible: true, align: 'center', valign: 'middle'},
|
{title: '所属分公司', field: 'branchName', visible: true, align: 'center', valign: 'middle'},
|
{title: '钱包余额', field: 'balance', visible: true, align: 'center', valign: 'middle'},
|
{title: '累计订单量', field: 'cumulativeOrderCount', visible: true, align: 'center', valign: 'middle'},
|
{title: '当月订单量', field: 'monthOrderCount', visible: true, align: 'center', valign: 'middle'},
|
{title: '积分', field: 'integral', visible: true, align: 'center', valign: 'middle'},
|
{title: '拒单次数', field: 'refusalCount', visible: true, align: 'center', valign: 'middle'},
|
{title: '状态', field: 'status', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
if (row.status === 1){
|
return '<span>正常</span>'
|
}else if (row.status === 2){
|
return '<span>冻结</span>'
|
}else if (row.status === 3){
|
return '<span>已删除</span>'
|
}
|
}},
|
{title: '审核状态', field: 'approvalStatus', visible: true, align: 'center', valign: 'middle',
|
formatter: function (value, row) {
|
if (row.approvalStatus === 1){
|
return '<span>待审核</span>'
|
}else if (row.approvalStatus === 2){
|
return '<span>审核通过</span>'
|
}else if (row.approvalStatus === 3){
|
return '<span>审核不通过</span>'
|
}
|
}},
|
{title: '添加时间', field: 'createTime', visible: true, align: 'center', valign: 'middle'},
|
{title: '操作', visible: true, align: 'center', valign: 'middle',width:150,
|
formatter: function (value, row) {
|
if (row.status === 1){
|
return '<a href="#" onclick="TDriver.searchTDriverDetail('+row.id+')" style="color:green">详情</a>' +' ' +
|
'<a href="#" onclick="TDriver.stop('+row.id+','+row.status+')" style="color:red">冻结</a>' +' ' +
|
'<a href="#" onclick="TDriver.updateInfo('+row.id+')" style="color:green">编辑</a>'
|
}else if (row.status === 2){
|
return '<a href="#" onclick="TDriver.searchTDriverDetail('+row.id+')" style="color:green">详情</a>' +' ' +
|
'<a href="#" onclick="TDriver.start('+row.id+','+row.status+')" style="color:green">解冻</a>'
|
}
|
}
|
}
|
];
|
};
|
|
/**
|
* 检查是否选中
|
*/
|
TDriver.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length == 0){
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}else{
|
TDriver.seItem = selected[0];
|
return true;
|
}
|
};
|
|
/**
|
* 点击添加
|
*/
|
TDriver.openAddTDriver = function () {
|
var index = layer.open({
|
type: 2,
|
title: '添加',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tDriver/tDriver_add'
|
});
|
this.layerIndex = index;
|
};
|
|
/**
|
* 打开查看详情
|
*/
|
TDriver.openTDriverDetail = function () {
|
if (this.check()) {
|
var index = layer.open({
|
type: 2,
|
title: '详情',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tDriver/tDriver_update/' + TDriver.seItem.id
|
});
|
this.layerIndex = index;
|
}
|
};
|
|
/**
|
* 打开查看详情(使用中)
|
*/
|
TDriver.searchTDriverDetail = function (id) {
|
var index = layer.open({
|
type: 2,
|
title: '详情',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tDriver/driverDetail?tDriverId=' + id
|
});
|
this.layerIndex = index;
|
};
|
|
/**
|
* 删除
|
*/
|
TDriver.delete = function () {
|
if (this.check()) {
|
var ajax = new $ax(Feng.ctxPath + "/tDriver/delete", function (data) {
|
Feng.success("删除成功!");
|
TDriver.table.refresh();
|
}, function (data) {
|
Feng.error("删除失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("tDriverId",this.seItem.id);
|
ajax.start();
|
}
|
};
|
|
/**
|
* 停用页面
|
*/
|
TDriver.stop = function (id) {
|
var index = layer.open({
|
type: 2,
|
title: '停用',
|
area: ['45%', '50%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tDriver/tDriver_start_and_stop?id='+id
|
});
|
this.layerIndex = index;
|
};
|
|
/**
|
* 启动页面
|
*/
|
TDriver.start = function (id) {
|
var index = layer.open({
|
type: 2,
|
title: '启用',
|
area: ['45%', '50%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tDriver/tDriver_start_and_stop?id='+id
|
});
|
this.layerIndex = index;
|
};
|
|
/**
|
* 提交启用冻结
|
*/
|
TDriver.updateStatus = function () {
|
var ajax = new $ax(Feng.ctxPath + "/tDriver/update-status", function (data) {
|
Feng.success("修改成功!");
|
TDriverInfoDlg.close();
|
parent.TDriver.table.refresh();
|
}, function (data) {
|
Feng.error("修改失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("id",$("#id").val());
|
ajax.set("status",$("#status").val());
|
if($("#status").val() == 1){
|
ajax.set("remark",$("#stopRemark").val());
|
}
|
if($("#status").val() == 2){
|
ajax.set("remark",$("#startRemark").val());
|
}
|
ajax.start();
|
};
|
|
/**
|
* 跳转充值余额页面
|
* @param id
|
*/
|
TDriver.rechargeBalancePage = function () {
|
if (this.check()) {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
var id = selected[0].id;
|
var index = layer.open({
|
type: 2,
|
title: '充值余额',
|
area: ['45%', '20%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tDriver/rechargeBalancePage?id=' + id
|
});
|
this.layerIndex = index;
|
}
|
};
|
|
/**
|
* 提交充值
|
*/
|
TDriver.rechargeBalance = function () {
|
var ajax = new $ax(Feng.ctxPath + "/tDriver/recharge-balance", function (data) {
|
Feng.success("修改成功!");
|
TDriverInfoDlg.close();
|
parent.TDriver.table.refresh();
|
}, function (data) {
|
Feng.error("修改失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("id",$("#id").val());
|
ajax.set("money",$("#backgroundBalance").val());
|
ajax.start();
|
};
|
|
/**
|
* 司机信息导出
|
*/
|
TDriver.export=function(){
|
var createTime=$("#createTime").val()
|
var phone=$("#phone").val()
|
var status=$("#status").val()
|
window.location.href=Feng.ctxPath + "/tDriver/export?createTime="+createTime
|
+"&status="+status
|
+"&phone="+phone
|
;
|
}
|
|
/**
|
* 跳转审核页面
|
* @param id
|
*/
|
TDriver.auditPage = function () {
|
if (this.check()) {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
var id = selected[0].id;
|
var approvalStatus = selected[0].approvalStatus;
|
if(approvalStatus != 1){
|
Feng.info("该条数据已审核!");
|
return false;
|
}
|
var index = layer.open({
|
type: 2,
|
title: '审核详情',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tDriver/auditPage?id=' + id
|
});
|
this.layerIndex = index;
|
}
|
};
|
|
/**
|
* 提交审核
|
*/
|
TDriver.auditSubmit = function () {
|
var ajax = new $ax(Feng.ctxPath + "/tDriver/auditSubmit", function (data) {
|
Feng.success("修改成功!");
|
TDriverInfoDlg.close();
|
parent.TDriver.table.refresh();
|
}, function (data) {
|
Feng.error("修改失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("id",$("#id").val());
|
ajax.set("approvalStatus",$("#approvalStatus").val());
|
ajax.set("approvalNotes",$("#approvalNotes").val());
|
ajax.start();
|
};
|
|
/**
|
* 打开区域选择页面
|
*/
|
TDriver.area = function () {
|
|
var area = $("#area").val();
|
var areaId = $("#areaId").val();
|
|
var index = layer.open({
|
type: 2,
|
title: '区域选择',
|
area: ['1000px', '270px'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tDriver/areaPage?area='+area+'&areaId='+areaId
|
});
|
this.layerIndex = index;
|
}
|
|
/**
|
* 查询市
|
*/
|
TDriver.areaCity = function () {
|
var province = document.getElementById('province');
|
var index= province.selectedIndex ;
|
var id = province.options[index].id;
|
var ajax = new $ax(Feng.ctxPath + "/tDriver/areaCity?parentId="+id, function (data) {
|
var opts=document.getElementById('city').options;
|
opts.length=0;// 这一句是清空原有列表项
|
for(var i=0,n=data.length;i<n;i++){
|
var data1=data[i];
|
var opt=new Option(data1.name,data1.id,true,true);
|
opts.add(opt);
|
}
|
}, function (data) {
|
Feng.error("查询失败!" + data.responseJSON.message + "!");
|
});
|
ajax.start();
|
}
|
|
/**
|
* 查询区
|
*/
|
TDriver.areaDistrict = function () {
|
var city = document.getElementById('city');
|
var cityIndex= city.selectedIndex ;
|
var id = city.options[cityIndex].value;
|
var ajax = new $ax(Feng.ctxPath + "/tDriver/areaCity?parentId="+id, function (data) {
|
var opts=document.getElementById('district').options;
|
opts.length=0;// 这一句是清空原有列表项
|
for(var i=0,n=data.length;i<n;i++){
|
var data1=data[i];
|
var opt=new Option(data1.name,data1.id,true,true);
|
opts.add(opt);
|
}
|
}, function (data) {
|
Feng.error("查询失败!" + data.responseJSON.message + "!");
|
});
|
ajax.start();
|
}
|
|
/**
|
* 选择省市
|
*/
|
TDriver.submitArea = function () {
|
var province = document.getElementById('province');
|
var provinceIndex= province.selectedIndex ;
|
var provinceName = province.options[provinceIndex].value;
|
var provinceId = province.options[provinceIndex].id;
|
|
var city = document.getElementById('city');
|
var cityIndex= city.selectedIndex ;
|
var cityId = city.options[cityIndex].value;
|
var cityName = city.options[cityIndex].innerText;
|
|
var district = document.getElementById('district');
|
var districtIndex= district.selectedIndex ;
|
var districtId = district.options[districtIndex].value;
|
var districtName = district.options[districtIndex].innerText;
|
|
parent.$("#area").val(provinceName+'/'+cityName+'/'+districtName)
|
parent.$("#areaId").val(provinceId+'/'+cityId+'/'+districtId)
|
TDriverInfoDlg.close();
|
}
|
|
/**
|
* 打开编辑页面
|
*/
|
TDriver.updateInfo = function (id) {
|
var index = layer.open({
|
type: 2,
|
title: '编辑',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/tDriver/tDriver_update?tDriverId='+id
|
});
|
this.layerIndex = index;
|
}
|
|
/**
|
* 查询列表
|
*/
|
TDriver.search = function () {
|
var queryData = {};
|
queryData['createTime'] = $("#createTime").val();
|
queryData['phone'] = $("#phone").val();
|
queryData['status'] = $("#status").val();
|
TDriver.table.refresh({query: queryData});
|
};
|
|
/**
|
* 重置
|
*/
|
TDriver.resetSearch = function (){
|
$("#createTime").val('');
|
$("#phone").val('');
|
$("#status").val('');
|
TDriver.search();
|
}
|
|
$(function () {
|
var defaultColunms = TDriver.initColumn();
|
var table = new BSTable(TDriver.id, "/tDriver/list", defaultColunms);
|
table.setPaginationType("client");
|
TDriver.table = table.init();
|
});
|