operations.activitytemplate.Index.js
2.47 KB
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
webpackJsonp([90],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {
/**
* Created by ty on 2016/7/4.
* 活动模板管理
*/
var $ = __webpack_require__(1),
common = __webpack_require__(2);
var statusArr = ["已关闭", "已开启"];
var g = new common.grid({
el: '#content-list',
usepagesize:true,
parms: function () {
return {
title: common.util.__input('title'),
};
},
columns: [
{
display: "ID",
name: "id"
},
{
display: '模板标题',
name: "title",
style:"width:20%;word-break:break-all;"
},
{
display: '图片地址',
render: function (item) {
if(item.image) {
return "<img src='"+ item.image +"' height='100px'/>";
}
}
},
{
display: 'SKN数量',
name: "productCount"
},
{
display: "状态",
render: function (item) {
return "<p>" + statusArr[item.status] + "</p>";
}
},
{
display: '操作',
render: function (item) {
var HtmArr = [];
HtmArr.push('<a href="/operations/activitytemplate/product/'+ item.id +'" class="btn btn-info btn-xs addProduct">添加商品</a>');
HtmArr.push('<a href="/operations/activitytemplate/edit/'+ item.id +'" class="btn btn-primary btn-xs">编辑</a>');
if(item.status == 1) {
HtmArr.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn btn-danger btn-xs auditStatus">关闭模板</a>');
} else {
HtmArr.push('<a data-index="' + item.__index + '" href="JavaScript:;" class="btn btn-success btn-xs auditStatus">开启模板</a>');
}
return HtmArr.join('');
}
}]
});
g.init("/activityTemplate/selectTemplateList");
$(document).on("click", ".auditStatus", function () {
var item = g.rows[$(this).data("index")];
var url = item.status == 1 ? "/activityTemplate/closeTemplate" : "/activityTemplate/publishTemplate";
common.util.__ajax({
url: url,
data: {id: item.id}
}, function () {
g.reload();
});
});
$("#filter-btn").click(function () {
g.reload();
});
/***/ }
]);