liujie
2023-09-25 d41358fce9a436d81b9341d06fc1d8f3ddff92ff
cloud-server-management/src/main/webapp/static/modular/system/appUser/tAppUser.js
@@ -32,9 +32,9 @@
                return {1:"是",0:"否"}[data]
            }
        },
        {title: '状态', field: 'status', visible: true, align: 'center', valign: 'middle',
        {title: '状态', field: 'state', visible: true, align: 'center', valign: 'middle',
            formatter:function (data) {
                return {1:"正常",2:"冻结",3:"已删除"}[data]
                return {1:"正常",2:"冻结",3:"已注销"}[data]
            }}
    ];
};
@@ -89,13 +89,35 @@
                area: ['100%', '100%'], //宽高
                fix: false, //不固定
                maxmin: true,
                content: Feng.ctxPath + '/bodySideAppointment/update/' + TQuestion.seItem.id
                content: Feng.ctxPath + '/appUser/update/' + TQuestion.seItem.id+"/"+1
            });
            this.layerIndex = index;
        }
    }
};
/**
 * 查看详情
 */
TQuestion.openInfo = function () {
    var selected = $('#' + this.id).bootstrapTable('getSelections');
    if(selected.length >1 ){
        Feng.info("只能选择一个问题进行编辑!");
    }else {
        if (this.check()){
            var selected = $('#' + this.id).bootstrapTable('getSelections');
            var index = layer.open({
                type: 2,
                title: '编辑分类',
                area: ['100%', '100%'], //宽高
                fix: false, //不固定
                maxmin: true,
                content: Feng.ctxPath + '/appUser/update/' + TQuestion.seItem.id+"/"+2
            });
            this.layerIndex = index;
        }
    }
};
/**
 * 上架
 */
@@ -217,48 +239,24 @@
        });
    }
};
TQuestion.oneChange = function () {
    var province = $('#pCode option:selected').text();
    var citySelect = document.getElementById("cCode");
    var ajax = new $ax(Feng.ctxPath + "/tSite/getCity", function(data){
TQuestion.oneChange = function (e) {
    var oneId=$(e).val();
    console.log(oneId)
    console.log("!!!!!!!!!!!!!")
    var ajax = new $ax(Feng.ctxPath + "/tCompetition/onChange", function(data){
        if(data!=null){
            var content='<option value="">选择市</option>';
            $.each(data, function(k,v) {
                content += "<option value='"+v.cityCode+"'>"+v.city+"</option>";
                content += "<option value='"+v.code+"'>"+v.name+"</option>";
            });
            $("#cCode").empty().append(content);
        }
    });
    if (province === ""){
        citySelect.innerHTML = '<option value="">请先选择省</option>';
    }
    ajax.set("province",province);
    ajax.set("oneId",oneId);
    ajax.start();
};
TQuestion.oneChangeNext = function (e) {
    var oneId=$(e).val();
    var city = $('#cCode option:selected').text();
    var citySelect = document.getElementById("account");
    var storeSelect = document.getElementById("store");
    if (oneId === ""){
        citySelect.innerHTML = '<option style="width: 300px" value="">请先选择省/市</option>';
        storeSelect.innerHTML = '<option style="width: 300px" value="">请先选择省/市</option>';
    }
    var ajax1 = new $ax(Feng.ctxPath + "/tSite/storeChangeNext", function(data){
        if(data!=null && data.length !== 0){
            var content='<option value="">选择门店</option>';
            $.each(data, function(k,v) {
                content += "<option style='width: 300px' value='"+v.id+"'>"+v.name+"</option>";
            });
            $("#store").empty().append(content);
        }else {
            storeSelect.innerHTML = '<option value="">当前所选市没有门店</option>';
        }
    });
    ajax1.set("oneId",city);
    ajax1.start();
};
TQuestion.addSubmit = function(){
    var data = {
@@ -267,32 +265,23 @@
        provinceCode:"",
        city:"",
        cityCode:"",
        storeId:null,
        storeName:"",
        parentName:"",
        phone:"",
        learnerName:"",
        learnerAge:null,
        name:"",
        birthday:"",
        appointmentTime:"",
        status:null,
        state:null
        gender:null,
        salesmanUserId:null
    };
    data.id                      = $("#name").val()
    data.province                = $('#pCode option:selected').text();
    data.provinceCode            = $("#pCode").val()
    data.city                    = $('#cCode option:selected').text();
    data.cityCode                = $("#cCode").val()
    data.storeId                 = $("#store").val()
    data.storeName               = $('#store option:selected').text();
    data.parentName              = $("#parentName").val()
    data.phone                   = $("#phone").val()
    data.learnerName             = $("#learnerName").val()
    data.learnerAge              = $("#learnerAge").val()
    data.name             = $("#learnerName").val()
    data.birthday                = $("#birthday").val()
    data.appointmentTime         = $("#appointmentTime").val().replace("T"," ")
    console.log("看看")
    console.log(data.appointmentTime);
    data.gender                  = $("#gender").val()
    data.salesmanUserId                  = $("#salesmanUserName").val()
    if($("#pCode").val()==''){
        Feng.info("请选择省")
        return;
@@ -301,44 +290,41 @@
        Feng.info("请选择市")
        return;
    }
    if($("#store").val()=='' ){
        Feng.info("请选择门店")
        return;
    }
    if($("#parentName").val()=='' ){
        Feng.info("请输入家长姓名")
        return;
    }
    if($("#phone").val()=='' ){
        Feng.info("请输入家长联系方式")
        Feng.info("请输入联系方式")
        return;
    }
    if($("#learnerName").val()=='' ){
        Feng.info("请输入学员姓名")
        return;
    }
    if($("#learnerAge").val()=='' ){
        Feng.info("请输入学员年龄")
        return;
    }
    if($("#birthday").val()=='' ){
        Feng.info("请选择学员生日")
        Feng.info("请选择生日")
        return;
    }
    if($("#appointmentTime").val()=='' ){
        Feng.info("请选择预约时间")
    if($("#gender").val()=='' ){
        Feng.info("请选择性别")
        return;
    }
    if($("#salesmanUserName").val()=='' ){
        Feng.info("请选择销售人员")
        return;
    }
    $.ajax({
        url: Feng.ctxPath + "/appUser/addAppUser" ,
        type: "POST",
        data: JSON.stringify(data),
        contentType: "application/json",
        success: function (response) {
            window.parent.TQuestion.table.refresh();
            TQuestion.close();
            Feng.success("添加成功");
            if (response=="5001"){
                Feng.error("当前手机号 已被注册")
            }else{
                window.parent.TQuestion.table.refresh();
                TQuestion.close();
                Feng.success("添加成功");
            }
        },
        error: function (xhr, status, error) {
            Feng.error("添加失败!" + error);
@@ -349,41 +335,79 @@
TQuestion.updateSubmit = function(){
    var data = {
        id:null,
        province:"",
        provinceCode:"",
        city:"",
        cityCode:"",
        phone:"",
        name:"",
        position:"",
        sort:"",
        birthday:"",
        gender:null,
        salesmanUserId:null
    };
    data.name     = $("#name").val()
    data.position = $("#position").val()
    data.sort     = $("#sort").val()
    data.id       = $("#dataId").val()
    if($("#name").val()==''){
        Feng.info("请输入分类名称")
    data.id                      = $("#id").val()
    data.province                = $('#pCode option:selected').text();
    data.provinceCode            = $("#pCode").val()
    data.city                    = $('#cCode option:selected').text();
    data.cityCode                = $("#cCode").val()
    data.phone                   = $("#phone").val()
    data.name                    = $("#learnerName").val()
    data.birthday                = $("#birthday").val()
    data.gender                  = $("#gender").val()
    data.salesmanUserId                  = $("#salesmanUserName").val()
    if($("#pCode").val()==''){
        Feng.info("请选择省")
        return;
    }
    if($("#cCode").val()==''){
        Feng.info("请选择所在位置")
        Feng.info("请选择市")
        return;
    }
    if($("#account").val()=='' ){
        Feng.info("请输入排序")
    if($("#phone").val()=='' ){
        Feng.info("请输入联系方式")
        return;
    }
    if($("#learnerName").val()=='' ){
        Feng.info("请输入学员姓名")
        return;
    }
    if($("#birthday").val()=='' ){
        Feng.info("请选择生日")
        return;
    }
    if($("#gender").val()=='' ){
        Feng.info("请选择性别")
        return;
    }
    if($("#salesmanUserName").val()=='' ){
        Feng.info("请选择销售人员")
        return;
    }
    $.ajax({
        url: Feng.ctxPath + "/benefits/addBenefits" ,
        url: Feng.ctxPath + "/appUser/addAppUser" ,
        type: "POST",
        data: JSON.stringify(data),
        contentType: "application/json",
        success: function (response) {
            window.parent.TQuestion.table.refresh();
            TQuestion.close();
            Feng.success("添加成功");
            if (response=="5001"){
                Feng.error("当前手机号 已被注册")
            }else{
                window.parent.TQuestion.table.refresh();
                TQuestion.close();
                Feng.success("添加成功");
            }
        },
        error: function (xhr, status, error) {
            Feng.error("添加失败!" + error);
        }
    });
};
/**
 * 查询列表
 */