operations.couponActivity.Index.js
3.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
webpackJsonp([104],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {
/**
* Created by Arthur on 16/5/26.
* 品牌发券管理
*/
__webpack_require__(9);
var $ = __webpack_require__(1);
common = __webpack_require__(2);
var activityTypes = ["普通活动", "APP活动"];
var status=["关闭","开启"];
$.timepicker.dateRange($('#startTimeStr'), $('#endTimeStr'));
var Bll={
getTime: function (time) {
var t = new Date(time * 1000);
return common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
},
toast:function(hint,data){
common.dialog.confirm("温馨提示", hint, function () {
common.util.__ajax({
url:"/couponActivity/update",
data:data
}, function () {
g.reload();
},true);
});
}
};
var g = new common.grid({
el: '#content-list',
parms: function() {
return {
actName: common.util.__input("actName"),
startTimeStr: common.util.__input("startTimeStr"),
endTimeStr: common.util.__input("endTimeStr"),
};
},
columns: [
{
display: 'ID',
name: "id"
},
{
display: '名称',
name: "actName"
}, {
display: '类型',
name: "activityType",
render: function (item) {
return activityTypes[item.activityType - 1]
}
}, {
display: "活动地址",
name: "actUrl"
}, {
display: "分享",
render: function (item) {
var arr = [];
arr.push("<p>标题:" + item.shareTitle + "</p>");
arr.push("<p>描述:" + item.shareDescribe+ "</p>");
arr.push("<p>地址:" + item.shareUrl + "</p>");
return arr.join('');
}
}, {
display: "活动时间",
render: function (item) {
return Bll.getTime(item.startTime)+"至"+Bll.getTime(item.endTime);
}
},{
display: "状态",
render: function (item) {
return status[item.status];
}
}, {
display: '操作',
render: function (item) {
var HtmArr = [];
HtmArr.push('<a data-index="' + item.__index + '" href="/couponActivity/index/update/'+item.id+'" class="btn btn-primary btn-xs info-modify">编辑</a>');
if(item.status==0){
HtmArr.push('<a data-index="' + item.__index + '" id="open" href="JavaScript:;" class="btn btn-success btn-xs ">开启</a>');
}else{
HtmArr.push('<a data-index="' + item.__index + '" id="close" href="JavaScript:;" class="btn btn-danger btn-xs ">关闭</a>');
}
return HtmArr.join('');
}
}]
});
g.init('/couponActivity/queryList');
//==================== 按钮点击事件 =====================//
$("#filter-btn").click(function () {
g.reload(1);
});
$(document).on('click','#open',function(){
var item = g.rows[$(this).data("index")];
item.status=1;
Bll.toast("确定开启活动吗?",item);
});
$(document).on('click','#close',function(){
var item = g.rows[$(this).data("index")];
item.status=0;
Bll.toast("确定关闭活动吗?",item);
});
/***/ }
]);