/**
|
* 初始化美牙商家服务详情对话框
|
*/
|
var StoreServiceInfoDlg = {
|
storeServiceInfoData : {}
|
};
|
|
/**
|
* 清除数据
|
*/
|
StoreServiceInfoDlg.clearData = function() {
|
this.storeServiceInfoData = {};
|
};
|
|
/**
|
* 设置对话框中的数据
|
* @param key 数据的名称
|
* @param val 数据的具体值
|
*/
|
StoreServiceInfoDlg.set = function(key, val) {
|
this.storeServiceInfoData[key] = (typeof val == "undefined") ? $("#" + key).val() : val;
|
return this;
|
};
|
|
/**
|
* 设置对话框中的数据
|
* @param key 数据的名称
|
* @param val 数据的具体值
|
*/
|
StoreServiceInfoDlg.get = function(key) {
|
return $("#" + key).val();
|
};
|
|
/**
|
* 关闭此对话框
|
*/
|
StoreServiceInfoDlg.close = function() {
|
parent.layer.close(window.parent.StoreService.layerIndex);
|
};
|
|
/**
|
* 收集数据
|
*/
|
StoreServiceInfoDlg.collectData = function() {
|
this
|
.set('id')
|
.set('name')
|
.set('status')
|
.set('createTime');
|
};
|
|
/**
|
* 提交添加
|
*/
|
StoreServiceInfoDlg.addSubmit = function() {
|
this.clearData();
|
this.collectData();
|
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/storeService/add", function(data){
|
if(data.code == 200){
|
Feng.success("添加成功!");
|
window.parent.StoreService.table.refresh();
|
StoreServiceInfoDlg.close();
|
} else {
|
Feng.error("添加失败!" + data.message);
|
}
|
},function(){
|
Feng.error("添加失败!");
|
});
|
ajax.set(this.storeServiceInfoData);
|
ajax.start();
|
};
|
|
/**
|
* 提交修改
|
*/
|
StoreServiceInfoDlg.editSubmit = function() {
|
this.clearData();
|
this.collectData();
|
|
//提交信息
|
var ajax = new $ax(Feng.ctxPath + "/storeService/update", function(data){
|
if(data.code == 200){
|
Feng.success("修改成功!");
|
window.parent.StoreService.table.refresh();
|
StoreServiceInfoDlg.close();
|
} else {
|
Feng.error("修改失败!" + data.message);
|
}
|
},function(data){
|
Feng.error("修改失败!");
|
});
|
ajax.set(this.storeServiceInfoData);
|
ajax.start();
|
};
|
|
$(function() {
|
|
});
|