xuhy
2025-01-13 6906168ccb03e4865d3e9385a9ae4a6e87008ca1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/**
 * 初始化分公司管理详情对话框
 */
var TWithdrawalInfoDlg = {
    tWithdrawalInfoData : {},
    editor: null,
};
 
/**
 * 清除数据
 */
TWithdrawalInfoDlg.clearData = function() {
    this.tWithdrawalInfoData = {};
}
 
/**
 * 设置对话框中的数据
 *
 * @param key 数据的名称
 * @param val 数据的具体值
 */
TWithdrawalInfoDlg.set = function(key, val) {
    this.tWithdrawalInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
    return this;
}
 
/**
 * 设置对话框中的数据
 *
 * @param key 数据的名称
 * @param val 数据的具体值
 */
TWithdrawalInfoDlg.get = function(key) {
    return $("#" + key).val();
}
 
/**
 * 关闭此对话框
 */
TWithdrawalInfoDlg.close = function() {
    parent.layer.close(window.parent.TWithdrawal.layerIndex);
}
 
/**
 * 收集数据
 */
TWithdrawalInfoDlg.collectData = function() {
    this
    .set('id')
    .set('driverId')
    .set('receivePaymentName')
    .set('receivePaymentAccount')
    .set('withdrawalType')
    .set('withdrawalMoney')
    .set('withdrawalTime')
    .set('status')
    .set('openBank')
    .set('remark')
    .set('receiptVoucher');
}
 
/**
 * 提交添加
 */
TWithdrawalInfoDlg.addSubmit = function() {
 
    this.clearData();
    this.collectData();
    var serverBox =[];
    $('input[name="checkbox"]:checked').each(function(){
        serverBox.push($(this).val());
    });
    if (serverBox.length == 0){
        Feng.info("请选择经营业务!");
        return;
    }
 
    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/withdrawal/add", function(data){
        if ("error" == data){
            Feng.error("登录账户已存在,请重新输入");
            return;
        }
        Feng.success("添加成功!");
        window.parent.TWithdrawal.table.refresh();
        TWithdrawalInfoDlg.close();
    },function(data){
        Feng.error("添加失败!" + data.responseJSON.message + "!");
    });
    ajax.set(TWithdrawalInfoDlg.tWithdrawalInfoData);
    ajax.start();
}
 
/**
 * 提交修改
 */
TWithdrawalInfoDlg.editSubmit = function() {
 
    this.clearData();
    this.collectData();
    var status = $("input[name='status']:checked").val();
 
    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/withdrawal/update", function(data){
        Feng.success("修改成功!");
        window.parent.TWithdrawal.table.refresh();
        TWithdrawalInfoDlg.close();
    },function(data){
        Feng.error("修改失败!" + data.responseJSON.message + "!");
    });
    this.set("status",status)
    ajax.set(TWithdrawalInfoDlg.tWithdrawalInfoData);
    ajax.start();
}
 
$(function() {
    // 初始化图片上传
    var receiptVoucher = new $WebUpload("receiptVoucher");
    receiptVoucher.setUploadBarId("progressBar");
    receiptVoucher.init();
});
 
function regexp(value, msg){
    var reg=/^(\d+.?)?\d{0,2}$/;//由 1-9开头 的正则表达式 整数 两位小数
    //先判断是否为整数 在判断 是否在 1-总页  整数范围之内
    if(reg.test(value)){
        if(value == 0){
            Feng.error(msg+"请输入大于0的整数或保留两位小数");
            return;
        }
    }else{
        Feng.error(msg+"请输入整数或保留两位小数");
        return;
    }
}
 
TWithdrawalInfoDlg.statusClick = function (status) {
    console.log(status);
    if (2 == status){
        $("#success").show();
        $("#fail").hide();
    }
    if (3 == status){
        $("#fail").show();
        $("#success").hide();
    }
}
 
function deleteSub(e) {
    $(e).parent().parent().remove();
}