xuhy
2023-02-28 adb18caa714692ccabf111ae3ab3481bf04844d4
management/guns-admin/src/main/webapp/static/modular/system/tDriver/tDriver.js
@@ -30,27 +30,51 @@
                }},
        {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'},
            {title: '所属代理商', field: 'agentId', visible: true, align: 'center', valign: 'middle'},
            {title: '所属分公司', field: 'branchOfficeId', 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: 'approvalStatus', visible: true, align: 'center', valign: 'middle'},
            {title: '当月订单量', field: 'approvalNotes', 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: 'approvalUserId', visible: true, align: 'center', valign: 'middle'},
        {title: '状态', field: 'status', 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.approvalStatus === 1){
                    return '<a href="#" onclick="TDriver.stop('+row.id+','+row.status+')" style="color:red">驳回</a>' +'&nbsp;' +
                        '<a href="#" onclick="TDriver.searchTAppUserDetail('+row.id+','+row.status+')" style="color:green">详情</a>'
                }else */if (row.status === 1){
                    return '<a href="#" onclick="TDriver.stop('+row.id+','+row.status+')" style="color:red">停用</a>' +'&nbsp;' +
                        '<a href="#" onclick="TDriver.searchTAppUserDetail('+row.id+','+row.status+')" style="color:green">详情</a>'
                if (row.status === 1){
                    return '<a href="#" onclick="TDriver.searchTDriverDetail('+row.id+')" style="color:green">详情</a>' +'&nbsp;' +
                        '<a href="#" onclick="TDriver.stop('+row.id+','+row.status+')" style="color:red">冻结</a>' +'&nbsp;' +
                        '<a href="#" onclick="TDriver.updateInfo('+row.id+')" style="color:green">编辑</a>'
                }else if (row.status === 2){
                    return '<a href="#" onclick="TDriver.start('+row.id+','+row.status+')" style="color:green">启用</a>' +'&nbsp;' +
                        '<a href="#" onclick="TDriver.searchTAppUserDetail('+row.id+','+row.status+')" style="color:green">详情</a>'
                    return '<a href="#" onclick="TDriver.searchTDriverDetail('+row.id+')" style="color:green">详情</a>' +'&nbsp;' +
                        '<a href="#" onclick="TDriver.start('+row.id+','+row.status+')" style="color:green">解冻</a>'
                }
            }
        }
@@ -78,7 +102,7 @@
    var index = layer.open({
        type: 2,
        title: '添加',
        area: ['800px', '420px'], //宽高
        area: ['100%', '100%'], //宽高
        fix: false, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/tDriver/tDriver_add'
@@ -94,13 +118,28 @@
        var index = layer.open({
            type: 2,
            title: '详情',
            area: ['800px', '420px'], //宽高
            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;
};
/**
@@ -120,6 +159,281 @@
};
/**
 * 停用页面
 */
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.areaUpdate = 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/areaPageUpdate?area='+area+'&areaId='+areaId
    });
    this.layerIndex = index;
}
/**
 * 打开区域选择页面新增
 */
TDriver.areaAdd = function () {
    var index = layer.open({
        type: 2,
        title: '区域选择',
        area: ['1000px', '270px'], //宽高
        fix: false, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/tDriver/areaPageAdd'
    });
    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)
    console.log()
    TDriverInfoDlg.close();
}
/**
 * 重置市区
 */
TDriver.resetArea = function () {
    var city = document.getElementById('city');
    var cityIndex= city.selectedIndex ;
    console.log(city.options[cityIndex].innerText)
    city.options[cityIndex].innerText = "请选择市";
    var district = document.getElementById('district');
    var districtIndex= district.selectedIndex ;
    console.log(district.options[districtIndex].innerText)
    district.options[districtIndex].innerText = "请选择区";
}
/**
 * 打开编辑页面
 */
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 () {