liujie
2023-08-16 5cb1979f05446792cc33a8cb6b7aaae906da5a70
management/guns-admin/src/main/webapp/static/modular/system/tAgent/tAgent.js
@@ -22,7 +22,7 @@
            {title: '客服电话', field: 'serviceCalls', visible: true, align: 'center', valign: 'middle'},
            {title: '订单数量', field: 'orderSum', visible: true, align: 'center', valign: 'middle'},
            {title: '有效订单', field: 'validOrder', visible: true, align: 'center', valign: 'middle'},
            {title: '已发放优惠券', field: 'issuedCoupon', visible: true, align: 'center', valign: 'middle'},
            // {title: '已发放优惠券', field: 'issuedCoupon', visible: true, align: 'center', valign: 'middle'},
            {title: '已使用优惠券', field: 'usedCoupon', visible: true, align: 'center', valign: 'middle'},
        {title: '累计优惠券金额', field: 'couponPriceSum', visible: true, align: 'center', valign: 'middle'},
        {title: '司机充值', field: 'driverRecharge', visible: true, align: 'center', valign: 'middle'},
@@ -39,13 +39,7 @@
                }},
        {title: '操作', visible: true, align: 'center', valign: 'middle',width:150,
            formatter: function (value, row) {
                if (row.status === 1){
                    return '<a href="#" onclick="TAgent.updateStatus('+row.id+','+row.status+')" style="color:red">停用</a>' +'&nbsp;' +
                        '<a href="#" onclick="TAgent.searchTAgentDetail('+row.id+')" style="color:green">详情</a>'
                }else if (row.status === 2){
                    return '<a href="#" onclick="TAgent.updateStatus('+row.id+','+row.status+')" style="color:green">解冻</a>' +'&nbsp;' +
                        '<a href="#" onclick="TAgent.searchTAgentDetail('+row.id+')" style="color:green">详情</a>'
                }
                return '<a href="#" onclick="TAgent.searchTAgentDetail('+row.id+')" style="color:green">详情</a>'
            }
        }
    ];
@@ -80,6 +74,47 @@
    this.layerIndex = index;
};
TAgent.openUpdateTAgent = function(){
    if (this.check()) {
        var index = layer.open({
            type: 2,
            title: '编辑',
            area: ['100%', '100%'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/tAgent/tAgent_update/' + TAgent.seItem.id
        });
        this.layerIndex = index;
    }
}
TAgent.stop = function(){
    if(this.check()){
        var ajax = new $ax(Feng.ctxPath + "/tAgent/update-status", function (data) {
            Feng.success("修改成功!");
            TAgent.table.refresh();
        }, function (data) {
            Feng.error("修改失败!" + data.responseJSON.message + "!");
        });
        ajax.set("id", TAgent.seItem.id);
        ajax.set("status", 1);
        ajax.start();
    }
}
TAgent.start = function(){
    if(this.check()){
        var ajax = new $ax(Feng.ctxPath + "/tAgent/update-status", function (data) {
            Feng.success("修改成功!");
            TAgent.table.refresh();
        }, function (data) {
            Feng.error("修改失败!" + data.responseJSON.message + "!");
        });
        ajax.set("id", TAgent.seItem.id);
        ajax.set("status", 2);
        ajax.start();
    }
}
/**
 * 提交启用冻结
 */
@@ -110,22 +145,6 @@
    this.layerIndex = index;
};
/**
 * 打开查看详情
 */
TAgent.openTAgentDetail = function () {
    if (this.check()) {
        var index = layer.open({
            type: 2,
            title: '详情',
            area: ['800px', '420px'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/tAgent/tAgent_update/' + TAgent.seItem.id
        });
        this.layerIndex = index;
    }
};
/**
 * 打开区域选择页面
@@ -174,31 +193,48 @@
            ajax.start();
        }
    });
}
    /*var province = document.getElementById('province');
    var index= province.selectedIndex ;
    var id = province.options[index].id;
/**
 * 查询区
 */
TAgent.areaDistrict = function () {
    //监听第二个下拉菜单的变动操作
    $("#city").change(function(){
        if(this.value==""){//第二级菜单为空,则将第三级菜单也置为空
            $("#district").empty();
            $("#district").append('<option value="">请选择</option>');
        }
        if(this.value!=""){//第二级菜单不为空,则将第三级菜单动态生成
            $("#district").empty();
            $("#district").append('<option value="">请选择</option>');
            var city = document.getElementById('city');
            var cityIndex= city.selectedIndex ;
            var id = city.options[cityIndex].id;
            if(id == ""){
                id = city.options[cityIndex].value;
            }
    var ajax = new $ax(Feng.ctxPath + "/tAgent/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);
                for(var i=0,n=data.length;i<n;i++){//对区数据进行遍历,动态生成
                    $("#district").append('<option value="'+data[i].id+'">'+data[i].name+'</option>');
        }
    }, function (data) {
        Feng.error("查询失败!" + data.responseJSON.message + "!");
    });
    ajax.start();*/
            ajax.start();
}
    })
}
/**
 * 选择省市
 */
TAgent.submitArea = function () {
    var province = document.getElementById('province');
    var provinceIndex= province.selectedIndex ;
    var provinceName = province.options[provinceIndex].value;
    var provinceId = province.options[provinceIndex].id;
    var provinceId = province.options[provinceIndex].value;
    var provinceName = province.options[provinceIndex].innerText;
    if(provinceName == null || provinceName == ''){
        Feng.error("请选择省份!")
@@ -215,6 +251,9 @@
        return;
    }
    console.log(provinceName+'/'+cityName)
    console.log(provinceId+'/'+cityId)
    parent.$("#area").val(provinceName+'/'+cityName)
    parent.$("#areaId").val(provinceId+'/'+cityId)
    TAgentInfoDlg.close();