/**
|
* 初始化详情对话框
|
*/
|
var language =$("#language").val()
|
var SysCouponRecordInfoDlg = {
|
sysCouponRecordInfoData : {},
|
validateFields: {
|
name: {
|
validators: {
|
notEmpty: {
|
message: language==1?'名称不能为空':(language==2?"The name cannot be empty!":"Nama itu tidak bisa kosong!")
|
}
|
}
|
},
|
money: {
|
validators: {
|
notEmpty: {
|
message: language==1?'金额不能为空':(language==2?"The amount cannot be empty!":"Jumlah tidak dapat kosong!")
|
},
|
regexp: {
|
regexp: /^(([1-9]{1}\d*)|(0{1}))(\.\d{1,2})?$/,
|
message: language==1?'金额格式不正确':(language==2?"The amount format is incorrect!":"Format jumlah tidak benar!")
|
}
|
}
|
}
|
}
|
};
|
|
/**
|
* 验证数据是否为空
|
*/
|
SysCouponRecordInfoDlg.validate = function () {
|
$('#sysCouponRecordInfoForm').data("bootstrapValidator").resetForm();
|
$('#sysCouponRecordInfoForm').bootstrapValidator('validate');
|
return $("#sysCouponRecordInfoForm").data('bootstrapValidator').isValid();
|
};
|
/**
|
* 清除数据
|
*/
|
SysCouponRecordInfoDlg.clearData = function() {
|
this.sysCouponRecordInfoData = {};
|
}
|
|
/**
|
* 设置对话框中的数据
|
*
|
* @param key 数据的名称
|
* @param val 数据的具体值
|
*/
|
SysCouponRecordInfoDlg.set = function(key, val) {
|
this.sysCouponRecordInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
|
return this;
|
}
|
|
/**
|
* 设置对话框中的数据
|
*
|
* @param key 数据的名称
|
* @param val 数据的具体值
|
*/
|
SysCouponRecordInfoDlg.get = function(key) {
|
return $("#" + key).val();
|
}
|
|
/**
|
* 关闭此对话框
|
*/
|
SysCouponRecordInfoDlg.close = function() {
|
parent.layer.close(window.parent.SysCouponRecord.layerIndex);
|
}
|
|
/**
|
* 收集数据
|
*/
|
SysCouponRecordInfoDlg.collectData = function() {
|
this
|
.set('id')
|
.set('money')
|
.set('fullMoney')
|
.set('insertTime')
|
.set('companyId')
|
.set('couponUseType')
|
.set('couponType')
|
.set('name')
|
.set('effective');
|
}
|
|
SysCouponRecordInfoDlg.immediately=function(){
|
var remark = $("#remark").val();
|
if (remark.length > 250){
|
if(language==1){
|
Feng.info("备注不能超过250个字");
|
}else if(language==2){
|
Feng.info("Remarks should not exceed 250 words");
|
}else {
|
Feng.info("Perhatian seharusnya tidak melebihi 250 kata");
|
}
|
return;
|
}
|
// 3通过 2拒绝
|
var state = $("input[name='state']:checked").val();
|
|
var ajax = new $ax(Feng.ctxPath + "/sysCouponRecord/audit", function(data){
|
if(language==1){
|
Feng.success("操作成功!");
|
}else if(language==2){
|
Feng.success("Successfully!");
|
}else {
|
Feng.success("Sukses!");
|
}
|
window.parent.SysCouponRecord.table.refresh();
|
SysCouponRecordInfoDlg.close();
|
},function(data){
|
if(language==1){
|
Feng.error("操作失败!" + data.responseJSON.message + "!");
|
}else if(language==2){
|
Feng.error("Fail!" + data.responseJSON.message + "!");
|
}else {
|
Feng.error("Gagal!" + data.responseJSON.message + "!");
|
}
|
});
|
ajax.set("id",$("#id").val());
|
ajax.set("remark",remark);
|
ajax.set("state",state);
|
ajax.start();
|
}
|
/**
|
* 提交添加
|
*/
|
SysCouponRecordInfoDlg.addSubmit = function() {
|
|
this.clearData();
|
this.collectData();
|
if(!this.validate()){
|
return ;
|
}
|
if ($("#name").val().length > 20){
|
if(language==1){
|
Feng.info("名称不能超过20个字");
|
}else if(language==2){
|
Feng.info("The name cannot exceed 20 characters");
|
}else {
|
Feng.info("Nama tidak dapat melebihi 20 karakter");
|
}
|
|
return;
|
}
|
if ( $("#money").val() > 99999 ){
|
if(language==1){
|
Feng.info("金额最多不能超过5位数");
|
}else if(language==2){
|
Feng.info("The amount cannot exceed 5 figures");
|
}else {
|
Feng.info("Jumlah tidak dapat melebihi 5 angka");
|
}
|
|
return;
|
}
|
if($("couponType").val()==2 && $("#fullMoney").val() > 99999){
|
if(language==1){
|
Feng.info("金额最多不能超过5位数");
|
}else if(language==2){
|
Feng.info("The amount cannot exceed four figures");
|
}else {
|
Feng.info("Jumlah tidak dapat melebihi empat angka");
|
}
|
return;
|
}
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/sysCouponRecord/add", function(data){
|
Feng.success("添加成功!");
|
window.parent.SysCouponRecord.table.refresh();
|
SysCouponRecordInfoDlg.close();
|
},function(data){
|
Feng.error("添加失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set(this.sysCouponRecordInfoData);
|
ajax.set("language",$("#yy").val());
|
ajax.start();
|
}
|
|
/**
|
* 提交修改
|
*/
|
SysCouponRecordInfoDlg.editSubmit = function() {
|
|
this.clearData();
|
this.collectData();
|
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/sysCouponRecord/update", function(data){
|
Feng.success("修改成功!");
|
window.parent.SysCouponRecord.table.refresh();
|
SysCouponRecordInfoDlg.close();
|
},function(data){
|
Feng.error("修改失败!" + data.responseJSON.message + "!");
|
});
|
ajax.set(this.sysCouponRecordInfoData);
|
ajax.set("language",$("#yy").val());
|
ajax.start();
|
}
|
|
$(function() {
|
Feng.initValidator("sysCouponRecordInfoForm", SysCouponRecordInfoDlg.validateFields);
|
});
|