puzhibing
2023-07-26 709a4a10be56952ead6340e4822fce41a66e47cd
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
/**
 * 初始化详情对话框
 */
var TAgentInfoDlg = {
    tAgentInfoData : {},
    validateFields: {
        principal: {
            validators: {
                notEmpty: {
                    message: '负责人姓名不能为空'
                },
                regexp: {
                    regexp:  /^[\u4E00-\u9FA5A-Za-z\s]+$/,
                    message: '不能输入特殊字符和数字'
                }
            }
        },
        principalPhone: {
            validators: {
                notEmpty: {
                    message: '联系电话不能为空'
                },
                regexp: {
                    regexp: /^1[3-9]\d{9}$/,
                    message: '请输入合法手机号'
                }
            }
        },
        area: {
            validators: {
                notEmpty: {
                    message: '请选择代理区域'
                }
            }
        },
        account: {
            validators: {
                notEmpty: {
                    message: '登录账号不能为空'
                }
            }
        },
        password: {
            validators: {
                notEmpty: {
                    message:  '登录密码不能为空'
                },
                identical: {
                    field: 'rePassword',
                    message: '两次密码不一致'
                },
            }
        },
        rePassword: {
            validators: {
                notEmpty: {
                    message: '密码不能为空'
                },
                identical: {
                    field: 'password',
                    message: '两次密码不一致'
                },
            }
        },
        merchantName: {
            validators: {
                notEmpty: {
                    message: '公司名称不能为空'
                }
            }
        },
        businessScope: {
            validators: {
                notEmpty: {
                    message: '经营范围不能为空'
                }
            }
        },
        socialCreditCode: {
            validators: {
                notEmpty: {
                    message: '统一社会信用码不能为空'
                }
            }
        },
        socialCreditCodeExpires: {
            validators: {
                notEmpty: {
                    message: '统一社会信用证有效期不能为空'
                }
            }
        },
        provCodeEnterprise: {
            validators: {
                notEmpty: {
                    message: '地区不能为空'
                }
            }
        },
        cityCodeEnterprise: {
            validators: {
                notEmpty: {
                    message: '地区不能为空'
                }
            }
        },
        areaCodeEnterprise: {
            validators: {
                notEmpty: {
                    message: '地区不能为空'
                }
            }
        },
        address: {
            validators: {
                notEmpty: {
                    message: '企业详细地址不能为空'
                }
            }
        },
        legalPerson: {
            validators: {
                notEmpty: {
                    message: '法人姓名不能为空'
                }
            }
        },
        merchantIDCode: {
            validators: {
                notEmpty: {
                    message: '法人身份证号不能为空'
                }
            }
        },
        certIdExpires: {
            validators: {
                notEmpty: {
                    message: '法人身份证有效期不能为空'
                }
            }
        },
        legalPhone: {
            validators: {
                notEmpty: {
                    message: '法人手机号不能为空'
                }
            }
        },
        fileNo: {
            validators: {
                notEmpty: {
                    message: '营业执照扫描件不能为空'
                }
            }
        },
        cardName: {
            validators: {
                notEmpty: {
                    message: '结算账户名不能为空'
                }
            }
        },
        cardNo: {
            validators: {
                notEmpty: {
                    message: '结算账户号不能为空'
                }
            }
        },
        phone: {
            validators: {
                notEmpty: {
                    message: '银行预留手机号不能为空'
                }
            }
        },
        bankCode: {
            validators: {
                notEmpty: {
                    message: '银行名称不能为空'
                }
            }
        },
        provCodeBank: {
            validators: {
                notEmpty: {
                    message: '开户行地区不能为空'
                }
            }
        },
        cityCodeBank: {
            validators: {
                notEmpty: {
                    message: '开户行地区不能为空'
                }
            }
        },
        areaCodeBank: {
            validators: {
                notEmpty: {
                    message: '开户行地区不能为空'
                }
            }
        }
    }
};
 
/**
 * 验证数据是否为空
 */
TAgentInfoDlg.validate = function () {
    $('#tAgentInfoForm').data("bootstrapValidator").resetForm();
    $('#tAgentInfoForm').bootstrapValidator('validate');
    return $("#tAgentInfoForm").data('bootstrapValidator').isValid();
};
 
/**
 * 清除数据
 */
TAgentInfoDlg.clearData = function() {
    this.tAgentInfoData = {};
}
 
/**
 * 设置对话框中的数据
 *
 * @param key 数据的名称
 * @param val 数据的具体值
 */
TAgentInfoDlg.set = function(key, val) {
    this.tAgentInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
    return this;
}
 
/**
 * 设置对话框中的数据
 *
 * @param key 数据的名称
 * @param val 数据的具体值
 */
TAgentInfoDlg.get = function(key) {
    return $("#" + key).val();
}
 
/**
 * 关闭此对话框
 */
TAgentInfoDlg.close = function() {
    parent.layer.close(window.parent.TAgent.layerIndex);
}
 
/**
 * 收集数据
 */
TAgentInfoDlg.collectData = function() {
    this
        .set('id')
        .set('principal')
        .set('principalPhone')
        .set('email')
        .set('provinceCode')
        .set('provinceName')
        .set('cityCode')
        .set('cityName')
        .set('status')
        .set('area')
        .set('areaId')
        .set('account')
        .set('password')
        .set('createTime')
        .set('userType')
        .set('merchantName')
        .set('businessScope')
        .set('socialCreditCode')
        .set('socialCreditCodeExpires')
        .set('provCodeEnterprise')
        .set('cityCodeEnterprise')
        .set('areaCodeEnterprise')
        .set('address')
        .set('cardName')
        .set('cardNo')
        .set('bankAcctType')
        .set('phone')
        .set('legalPerson')
        .set('merchantIDCode')
        .set('certIdExpires')
        .set('legalPhone')
        .set('bankCode')
        .set('provCodeBank')
        .set('cityCodeBank')
        .set('areaCodeBank');
}
 
/**
 * 提交添加
 */
TAgentInfoDlg.addSubmit = function() {
 
    this.clearData();
    this.collectData();
 
    if(!this.validate()){
        return ;
    }
    if(this.tAgentInfoData.userType == 0){
        delete this.tAgentInfoData.socialCreditCodeExpires;
        delete this.tAgentInfoData.certIdExpires;
    }
 
    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/tAgent/add", function(data){
        if(data.code == 500){
            Feng.error("添加失败!" + data.message + "!");
            return false;
        }
        Feng.success("添加成功!");
        window.parent.TAgent.table.refresh();
        TAgentInfoDlg.close();
    },function(data){
        Feng.error("添加失败!" + data.message + "!");
    });
    ajax.set(this.tAgentInfoData);
    ajax.start();
}
 
/**
 * 提交修改
 */
TAgentInfoDlg.editSubmit = function() {
 
    this.clearData();
    this.collectData();
 
    if(!this.validate()){
        return ;
    }
 
    //提交信息
    var ajax = new $ax(Feng.ctxPath + "/tAgent/update", function(data){
        Feng.success("修改成功!");
        window.parent.TAgent.table.refresh();
        TAgentInfoDlg.close();
    },function(data){
        Feng.error("修改失败!" + data.responseJSON.message + "!");
    });
    ajax.set(this.tAgentInfoData);
    ajax.start();
}
 
$(function() {
    Feng.initValidator("tAgentInfoForm", TAgentInfoDlg.validateFields);
});