puzhibing
2024-03-04 7e7f901b2172281dc294dfbc67e6ad00625f09f4
cloud-server-management/src/main/webapp/static/modular/system/operatorUser/operatorUser.js
@@ -19,22 +19,315 @@
 */
TSite.initColumn = function () {
    return [
        {field: 'selectItem', checkbox: true},
        {field: 'selectItem', radio: true},
        {title: '主键ID', field: 'id', visible: false, align: 'center', valign: 'middle'},
        {title: '所在城市', field: 'provinceAndCity', visible: true, align: 'center', valign: 'middle',width:'20%',},
        {title: '管理员姓名', field: 'userName', visible: true, align: 'center', valign: 'middle',},
        {title: '运营商ID', field: 'operatorId', visible: false, align: 'center', valign: 'middle',},
        {title: '管理员手机号', field: 'phone', visible: true, align: 'center', valign: 'middle'},
        {title: '认证平台', field: 'platform', visible: true, align: 'center', valign: 'middle'},
        {title: '认证类型', field: 'type', visible: true, align: 'center', valign: 'middle'},
        {title: '分账比例', field: 'proportion', visible: true, align: 'center', valign: 'middle'},
        {title: '审核状态', field: 'state', visible: true, align: 'center', valign: 'middle',
        {title: '认证类型', field: 'type', visible: true, align: 'center', valign: 'middle',
            formatter:function (data) {
                return {1:"待审核",2:"审核中",3:"已通过",4:"已拒绝"}[data]
                if (data==1){
                    return "个人"
                }else if (data==2){
                    return "企业"
                }else{
                    return "未认证"
                }
            }
        },
        {title: '分账比例', field: 'proportion', visible: true, align: 'center', valign: 'middle'},
        {title: '审核状态', field: 'audit', visible: true, align: 'center', valign: 'middle',
            formatter:function (data) {
                return {0:"未认证",1:"待审核",2:"审核通过",3:"审核失败"}[data]
            }
        },
        {title: '操作', field: 'audit', visible: true, align: 'center', valign: 'middle',
            formatter: function (data,row) {
                var btn = "";
                if(data==0) {
                    var str = '<button class="btn btn-outline btn-primary" onclick="TSite.auth('+row.operatorId+')" >去认证</button>'
                    btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="" onfocus="TUser.tooltip()">' + str + '</p>']
                }else {
                    var str = '<button class="btn btn-outline btn-primary" onclick="TSite.auth1(' + row.operatorId + ')" >详情</button>'
                    btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="" onfocus="TUser.tooltip()">' + str + '</p>']
                }
                return btn;
            }
        },
    ];
};
TSite.auth = function () {
    if (this.check()) {
        var index = layer.open({
            type: 2,
            title: "商户认证",
            area: ['100%', '100%'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/operator/proportionAuth/' + TSite.seItem.operatorId
        });
        this.layerIndex = index;
    }
};
/**
 * 商户号认证页面回显
 */
TSite.auth1 = function () {
    if (this.check()) {
        var index = layer.open({
            type: 2,
            title: "商户认证详情",
            area: ['100%', '100%'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/operator/proportionAuth1/' + TSite.seItem.operatorId
        });
        this.layerIndex = index;
    }
};
TSite.proportion = function () {
    var selected = $('#' + this.id).bootstrapTable('getSelections');
    if(selected.length >1 ){
        Feng.info("只能选择一个运营商商户设置分账比例!");
    }else {
        if (this.check()) {
            var index = layer.open({
                type: 2,
                title: "认证",
                area: ['100%', '100%'], //宽高
                fix: false, //不固定
                maxmin: true,
                content: Feng.ctxPath + '/operator/proportion/' + TSite.seItem.operatorId
            });
            this.layerIndex = index;
        }
    }
};
TSite.commit = function(){
    var alipayProportion  = $("#alipayProportion").val();
    var wechatProportion  = $("#wechatProportion").val();
    if($("#alipayProportion").val()=='' ){
        Feng.info("请输入支付宝分账比例")
        return;
    }
    if($("#wechatProportion").val()=='' ){
        Feng.info("请输入微信分账比例")
        return;
    }
    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/operator/proportion", function(data){
            Feng.success("设置成功!");
            window.parent.TSite.table.refresh();
            TSite.close();
    },function(data){
        Feng.error("操作失败!");
    });
    ajax.set("operatorIdOne",        $("#id").val()    );
    ajax.set("alipayProportion",        $("#alipayProportion").val()    );
    ajax.set("alipayNum",        $("#alipayNum").val()    );
    ajax.set("wechatProportion",        $("#wechatProportion").val()    );
    ajax.set("wechatNum",        $("#wechatNum").val()    );
    ajax.start();
};
// 银行卡使用
TSite.oneChange2 = function (e) {
    var oneId=$(e).val();
    console.log(oneId)
    console.log("!!!!!!!!!!!!!")
    var ajax = new $ax(Feng.ctxPath + "/tCompetition/onChange3", function(data){
        if(data!=null){
            var content='<option value="">选择市</option>';
            $.each(data, function(k,v) {
                content += "<option value='"+v.code+"'>"+v.name+"</option>";
            });
            $("#cCode").empty().append(content);
        }
    });
    ajax.set("oneId",oneId);
    ajax.start();
};
// 经营地址使用
TSite.oneChange6 = function (e) {
    var oneId=$(e).val();
    console.log(oneId)
    console.log("!!!!!!!!!!!!!")
    var ajax = new $ax(Feng.ctxPath + "/tCompetition/onChange3", function(data){
        if(data!=null){
            var content='<option value="">选择市</option>';
            $.each(data, function(k,v) {
                content += "<option value='"+v.code+"'>"+v.name+"</option>";
            });
            $("#bcCode").empty().append(content);
        }
    });
    ajax.set("oneId",oneId);
    ajax.start();
};
// 经营地址使用
TSite.twoChange = function (e) {
    var oneId=$(e).val();
    console.log(oneId)
    console.log("!!!!!!!!!!!!!")
    var ajax = new $ax(Feng.ctxPath + "/operator/getDistrict", function(data){
        if(data!=null){
            var content='<option value="">选择区(县)</option>';
            $.each(data, function(k,v) {
                content += "<option value='"+v.code+"'>"+v.name+"</option>";
            });
            $("#bdCode").empty().append(content);
        }
    });
    ajax.set("cityCode",oneId);
    ajax.start();
};
TSite.addSubmit = function(){
    var bodyType = $("input[name='bodyType']:checked").val();
    var type = $("input[name='type']:checked").val();
    if (bodyType=="" || null == bodyType){
        Feng.error("请选择主体类型");
        return;
    }
    if ("" == $("#businessName").val() ){
        Feng.error("请输入商户名称");
        return;
    }
    if ("" == $("#aliasName").val() ){
        Feng.error("请输入商户别名");
        return;
    }
    if ("" == $("#businessNumber").val() ){
        Feng.error("请输入营业执照编号");
        return;
    }
    if ("" == $("#businessNumber").val() ){
        Feng.error("请上传营业执照");
        return;
    }
    if ("" == $("#name").val() ){
        Feng.error("请输入联系人姓名");
        return;
    }
    if ("" == $("#phone").val() ){
        Feng.error("请输入联系人电话");
        return;
    }
    if ("" == $("#legalPerson").val()){
        Feng.error("请输入法人姓名");
        return;
    }
    if ("" == $("#leagleNumber").val()){
        Feng.error("请输入法人身份证号");
        return;
    }
    if ("" == $("#zfbAccount").val()){
        Feng.error("请输入签约支付宝账号");
        return;
    }
    // 结算账户类型
    var accountType = $("input[name='accountType']:checked").val();
    // 结算到银行卡
    if (accountType == "bankCard"){
        if ("" == $("#bankCard").val()){
            Feng.error("请输入银行卡号");
            return;
        }
        if ("" == $("#bankName").val()){
            Feng.error("请选择开户银行");
            return;
        }
        if ("" == $("#bankName1").val()){
            Feng.error("请输入开户支行名称");
            return;
        }
        if ("" == $("#bankUserName").val()){
            Feng.error("请输入开户名称");
            return;
        }
        if ("" == $("#pCode").val()){
            Feng.error("请选择开户银行所在省");
            return;
        }
        if ("" == $("#cCode").val()){
            Feng.error("请选择开户银行所在市");
            return;
        }
    }else{
        // 结算到支付宝
        if ("" == $("#alipayAccount").val()){
            Feng.error("请输入支付宝账号");
            return;
        }
    }
    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/operator/auth", function(data){
        if (data==5001){
            Feng.error("未上传营业执照!");
            return;
        }else if(data==5002){
            Feng.error("未上传法人身份证正面照!");
            return;
        }else if(data==5003){
            Feng.error("未上传法人身份证背面照!");
            return;
        }else if(data==5007){
            Feng.error("输入的开户银行名称有误!");
            return;
        } else if (data.code==500){
            console.log(data);
            Feng.error("认证失败:"+data.msg);
            return;
        }else{
            Feng.success("认证成功!请等待支付宝审核");
            window.parent.TSite.table.refresh();
            TSite.close();
        }
    },function(data){
        Feng.error("操作失败!");
    });
    ajax.set("operatorId",        $("#id").val());
    ajax.set("bodyType",        bodyType );
    ajax.set("businessName",        $("#businessName").val());
    ajax.set("aliasName",        $("#aliasName").val());
    ajax.set("businessNumber",        $("#businessNumber").val()    );
    ajax.set("license",        $("#license").val()    );
    ajax.set("name",        $("#name").val()    );
    ajax.set("phone",        $("#phone").val()    );
    ajax.set("shopProvinceCode",        $("#bpCode").val()    );
    ajax.set("shopProvince",        $('#bpCode option:selected').text());
    ajax.set("shopCityCode",        $("#bcCode").val()    );
    ajax.set("shopCity",        $('#bcCode option:selected').text());
    ajax.set("shopDistrictCode",        $("#bdCode").val()    );
    ajax.set("shopDistrict",        $('#bdCode option:selected').text());
    ajax.set("registerAddress",        $("#registerAddress").val()    );
    ajax.set("legalPerson",        $("#legalPerson").val()    );
    ajax.set("leagleNumber",        $("#leagleNumber").val()    );
    ajax.set("legalFront",        $("#IDCardImg").val()    );
    ajax.set("legalBack",        $("#IDCardImg1").val()    );
    ajax.set("accountType",        accountType    );
    ajax.set("alipayAccount",        $("#alipayAccount").val()    );
    ajax.set("bankCard",        $("#bankCard").val()    );
    // 结算账户类型
    var useType = $("input[name='useType']:checked").val();
    ajax.set("useType",        useType    );
    // 银行卡类型
    var cardType = $("input[name='cardType']:checked").val();
    ajax.set("cardType",        cardType    );
    ajax.set("bankName",        $("#bankName").val()    );
    ajax.set("bankNameTwo",        $("#bankName1").val()    );
    ajax.set("accountName",        $("#bankUserName").val()    );
    ajax.set("provinceCode",        $("#pCode").val()    );
    ajax.set("province",        $('#pCode option:selected').text());
    ajax.set("cityCode",        $("#cCode").val()    );
    ajax.set("city",        $('#cCode option:selected').text());
    ajax.set("iqImage",        $("#iqImage").val()    );
    ajax.set("zfbAccount",        $("#zfbAccount").val()    );
    ajax.start();
};
/**
 * 检查是否选中
 */
@@ -80,7 +373,7 @@
        area: ['100%', '100%'], //宽高
        fix: false, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/operatorUser/proportion/' + 5
        content: Feng.ctxPath + '/operatorUser/proportion/' + TSite.seItem.operatorId
    });
    this.layerIndex = index;
@@ -94,8 +387,6 @@
TSite.search = function () {
    var queryData = {};
    queryData['province']  = $("#pCode").val();
    queryData['city'] =$("#cCode").val();
    queryData['userName'] =$("#name").val();
    queryData['phone'] =$("#phone").val();
    queryData['platform'] =$("#platform").val();
@@ -105,8 +396,6 @@
};
TSite.resetSearch = function () {
    $("#pCode").val("");
    $("#cCode").val("");
    $("#name").val("");
    $("#phone").val("");
    $("#platform").val("");
@@ -115,27 +404,41 @@
    TSite.search();
};
TSite.tradeYse = function () {
    var tradeT = document.getElementById('tradeT');
    var IDCardT = document.getElementById('IDCardT');
    var tradeT = document.getElementById('tradeE');
    var endTime = document.getElementById('endTime');
    var IDCardT = document.getElementById('IDCardE');
    var bIDCardT = document.getElementById('bIDCardT');
    var tradeTime = document.getElementById('tradeTime');
    var IDCardTime = document.getElementById('IDCardTime');
    var IDCardTime = document.getElementById('IDCardEnd');
    var bTime = document.getElementById('bEnd');
    console.log("进入")
// 判断是否被选中
    if (tradeT.checked) {
        tradeTime.disabled = true;
        endTime.disabled = true;
        endTime.value="";
    } else {
        tradeTime.disabled = false;
        endTime.disabled = false;
    }
    if (IDCardT.checked) {
        IDCardTime.value="";
        IDCardTime.disabled = true;
    } else {
        IDCardTime.disabled = false;
    }
    if (bIDCardT.checked) {
        bTime.value="";
        bTime.disabled = true;
    } else {
        bTime.disabled = false;
    }
};
$(function () {
    $("#benefit").hide()
    var defaultColunms = TSite.initColumn();
    var table = new BSTable(TSite.id, "/operatorUser/listAll", defaultColunms);
    table.setPaginationType("server");
    table.setPaginationType("client");
    TSite.table = table.init();
    var c1 = new $WebUpload("license");
    var c2 = new $WebUpload("IDCardImg");
@@ -143,6 +446,9 @@
    var c4 = new $WebUpload("bImg1");
    var c5 = new $WebUpload("bImg2");
    var c6 = new $WebUpload("Img");
    var inDoorImages = new $WebUpload("inDoorImages");
    var outDoorImages = new $WebUpload("outDoorImages");
    var iqImage = new $WebUpload("iqImage");
    c1.setUploadBarId("progressBar");
    c1.init();
    c2.setUploadBarId("progressBar");
@@ -155,5 +461,10 @@
    c5.init();
    c6.setUploadBarId("progressBar");
    c6.init();
    inDoorImages.setUploadBarId("progressBar");
    inDoorImages.init();
    outDoorImages.setUploadBarId("progressBar");
    outDoorImages.init();
    iqImage.setUploadBarId("progressBar");
    iqImage.init();
});