...
|
...
|
@@ -72,7 +72,6 @@ var g = new common.grid({ |
|
|
}
|
|
|
}, {
|
|
|
display: '操作',
|
|
|
//}
|
|
|
name: "status",
|
|
|
render: function (items) {
|
|
|
var HtmArr = [];
|
...
|
...
|
@@ -88,45 +87,90 @@ g.init('/brandCoupon/queryList'); |
|
|
$("#filter-btn").click(function () {
|
|
|
g.reload(1);
|
|
|
});
|
|
|
/**
|
|
|
* 监听输入框变化
|
|
|
*/
|
|
|
$(document).on("change", ".observe", function () {
|
|
|
var $this = $(this);
|
|
|
var name = $this.data("field");
|
|
|
Bll.module = common.util.__buildobj(name, '.', Bll.module, function (obj, name1) {
|
|
|
obj[name1] = $this.val();
|
|
|
});
|
|
|
Bll.module.brandName = $('#brandId').find("option[value='" + Bll.module.brandId + "']").text();
|
|
|
});
|
|
|
|
|
|
//添加
|
|
|
$(document).on('click', '#add-btn', function () {
|
|
|
articleCategoryOP("新增", '/brandCoupon/add', {});
|
|
|
/*验证*/
|
|
|
var edit = new common.edit2(".modal-body");
|
|
|
var Bll = {
|
|
|
module: null,
|
|
|
//弹框
|
|
|
toast: function (module, hint, url) {
|
|
|
Bll.module = module;
|
|
|
var d = new common.dialog({
|
|
|
title: hint + "品牌优惠券",
|
|
|
content: common.util.__template2($("#template").html(), Bll.module),
|
|
|
width: '40%',
|
|
|
button: [
|
|
|
{
|
|
|
value: "保存",
|
|
|
callback: function () {
|
|
|
if (edit.validate()) {
|
|
|
common.util.__ajax({
|
|
|
url: url,
|
|
|
data: Bll.module
|
|
|
}, function (res) {
|
|
|
if (res.code == '200') {
|
|
|
g.reload();
|
|
|
d.close();
|
|
|
}
|
|
|
else {
|
|
|
common.util.__tip(res.message, "warning");
|
|
|
}
|
|
|
}, true);
|
|
|
}
|
|
|
return false;
|
|
|
},
|
|
|
css: "btn-primary"
|
|
|
},
|
|
|
{
|
|
|
"value": "取消",
|
|
|
"css": "btn-info"
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
Bll.__editRender();
|
|
|
},
|
|
|
__editRender: function () {
|
|
|
edit.init();
|
|
|
new common.dropDown({
|
|
|
el: "#brandId",
|
|
|
ajax: 'brand'
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 添加--点击事件
|
|
|
*/
|
|
|
$(document).on('click', '#add-btn', function () {
|
|
|
var item = {
|
|
|
"couponsId": "",
|
|
|
"brandId": "",
|
|
|
"brandName": "",
|
|
|
"status": 1
|
|
|
};
|
|
|
Bll.toast(item, "添加", '/brandCoupon/add');
|
|
|
});
|
|
|
|
|
|
//编辑
|
|
|
/**
|
|
|
* 编辑--点击事件
|
|
|
*/
|
|
|
$(document).on('click', '.info-modify', function () {
|
|
|
var item = g.rows[$(this).data("index")];
|
|
|
articleCategoryOP("修改", '/brandCoupon/update', item);
|
|
|
});
|
|
|
|
|
|
function articleCategoryOP(prefix, url, item) {
|
|
|
var a = new common.edit(".confirm");
|
|
|
common.dialog.confirm(prefix + '标签', common.util.__template2($("#template").html(), item), function () {
|
|
|
return a.submit(url, function (option) {
|
|
|
var _brandName = $('#brandId').find("option[value='" + option.data.brandId + "']").text();
|
|
|
option.data.brandName = _brandName;
|
|
|
option.success = function (res) {
|
|
|
res = res.data;
|
|
|
if (res.code == "200") {
|
|
|
a.$tip("提交成功", function () {
|
|
|
g.reload();
|
|
|
}, 'growl-success');
|
|
|
} else {
|
|
|
a.$tip(res.message);
|
|
|
}
|
|
|
return false;
|
|
|
};
|
|
|
option.error = function (res) {
|
|
|
a.$tip(res.message);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
});
|
|
|
a.init();
|
|
|
new common.dropDown({
|
|
|
el: "#brandId",
|
|
|
ajax: 'brand'
|
|
|
});
|
|
|
} |
|
|
\ No newline at end of file |
|
|
common.util.__ajax({
|
|
|
url: "/brandCoupon/queryByParam",
|
|
|
data: {id: item.id}
|
|
|
}, function (res) {
|
|
|
Bll.toast(res.data, "修改", '/brandCoupon/update');
|
|
|
}, true);
|
|
|
}); |
|
|
\ No newline at end of file |
...
|
...
|
|