/**
|
* 初始化详情对话框
|
*/
|
var TCompanyWithdrawInfoDlg = {
|
tCompanyWithdrawInfoData : {},
|
validateFields: {
|
withdrawMoney: {
|
validators: {
|
notEmpty: {
|
message: '提现金额不能为空'
|
}, regexp: {
|
regexp: /^(([1-9]{1}\d*)|(0{1}))(\.\d{0,2})?$/,
|
message: '提现金额格式不正确'
|
}
|
}
|
}
|
}
|
};
|
TCompanyWithdrawInfoDlg.validate = function () {
|
$('#withdrawFrom').data("bootstrapValidator").resetForm();
|
$('#withdrawFrom').bootstrapValidator('validate');
|
return $("#withdrawFrom").data('bootstrapValidator').isValid();
|
};
|
/**
|
* 清除数据
|
*/
|
TCompanyWithdrawInfoDlg.clearData = function() {
|
this.tCompanyWithdrawInfoData = {};
|
}
|
|
/**
|
* 设置对话框中的数据
|
*
|
* @param key 数据的名称
|
* @param val 数据的具体值
|
*/
|
TCompanyWithdrawInfoDlg.set = function(key, val) {
|
this.tCompanyWithdrawInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
|
return this;
|
}
|
|
/**
|
* 设置对话框中的数据
|
*
|
* @param key 数据的名称
|
* @param val 数据的具体值
|
*/
|
TCompanyWithdrawInfoDlg.get = function(key) {
|
return $("#" + key).val();
|
}
|
|
/**
|
* 关闭此对话框
|
*/
|
TCompanyWithdrawInfoDlg.close = function() {
|
parent.layer.close(window.parent.TCompanyWithdraw.layerIndex);
|
}
|
|
/**
|
* 收集数据
|
*/
|
TCompanyWithdrawInfoDlg.collectData = function() {
|
this
|
.set('id')
|
.set('companyId')
|
.set('withdrawMoney')
|
.set('type')
|
.set('remark')
|
.set('status')
|
.set('createId')
|
.set('createTime');
|
}
|
|
/**
|
* 提交添加
|
*/
|
TCompanyWithdrawInfoDlg.addSubmit = function() {
|
|
this.clearData();
|
this.collectData();
|
if(!this.validate()){
|
return ;
|
}
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/tCompanyWithdraw/add", function(data){
|
if(data=='5001'){
|
Feng.info("提现金额大于可用金额")
|
return;
|
}else {
|
Feng.success("操作成功!");
|
window.parent.TCompanyWithdraw.table.refresh();
|
TCompanyWithdrawInfoDlg.close();
|
}
|
},function(data){
|
Feng.error("操作失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set("money",$("#withdrawMoney").val());
|
ajax.set("type",$("#type").val());
|
ajax.set("remark",$("#remark").val());
|
ajax.start();
|
}
|
|
/**
|
* 提交修改
|
*/
|
TCompanyWithdrawInfoDlg.editSubmit = function() {
|
|
this.clearData();
|
this.collectData();
|
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/tCompanyWithdraw/update", function(data){
|
Feng.success("修改成功!");
|
window.parent.TCompanyWithdraw.table.refresh();
|
TCompanyWithdrawInfoDlg.close();
|
},function(data){
|
Feng.error("修改失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set(this.tCompanyWithdrawInfoData);
|
ajax.start();
|
}
|
|
$(function() {
|
Feng.initValidator("withdrawFrom", TCompanyWithdrawInfoDlg.validateFields);
|
});
|