marketing.CouponSend.Index.js
3.89 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
webpackJsonp([71],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {
/**
* Created by ty on 2016/5/23.
*/
'use strict';
var $ = __webpack_require__(1),
common=__webpack_require__(2);
var couponTypes = ["A券", "B券", "公开券", "生日券", "免邮券"];
var startTimeObj;
var endTimeObj;
startTimeObj = $("#filter-startTimeStr").fdatepicker({
format: 'yyyy-mm-dd hh:ii:ss',
pickTime: true
}).data("datepicker");
endTimeObj = $("#filter-endTimeStr").fdatepicker({
format: 'yyyy-mm-dd hh:ii:ss',
pickTime: true
}).data("datepicker");
//下拉框
new common.dropDown({el: '#filter-couponType'});
new common.dropDown({el: '#choose-department'});
common.util.__ajax({
url: "/coupon/getAllDepartment",//获取所有部门
data: {size: 1000}
}, function (res) {
var data=res.data;
var newData=data.filter(function(v,i){
if(v.status==1){
return v;
}
});
res.data=newData;
console.log(res);
$("#departments").html(common.util.__template2($("#search-department").html(), res));
new common.dropDown({el: "#choose-department"});
}, true);
//grid
var g = new common.grid({
el: '#basicTable',
parms:function(){
return {
couponType: common.util.__input("filter-couponType"),
couponId: common.util.__input("filter-couponId"),
couponName:common.util.__input("filter-couponName"),
department:common.util.__input("choose-department"),
startTimeStr:common.util.__input("filter-startTimeStr"),
endTimeStr:common.util.__input("filter-endTimeStr")
};
},
columns:[
{display:"优惠券ID", name:"id"},
{display:"优惠券名称",name:"couponName"},
{display: '申请部门', render: function(item) {
var deptName = item.departmentName;
if(deptName === undefined) {
deptName = '';
}
return '<p class="audit-time">' + deptName + '</p>';
}},
{display: '优惠券类型', render: function(item) {
var couponType = couponTypes[item.couponType-1];
if(couponType === undefined) {
couponType = '';
}
return '<p class="audit-time">' + couponType + '</p>';
}},
{display: '数量', name: "couponNum"},
{display: '面额', name: "couponAmount"},
{display: '开始时间', render: function(item) {
return Bll.getTime(item.startTime);
}},
{display: '结束时间', render: function(item) {
return Bll.getTime(item.endTime);
}},
{display:"操作",name:"operate",render:function(item){
var HtmArr=[];
HtmArr.push('<a href="/market/couponSend/send/'+ item.id +'" class="btn btn-success btn-xs sendCoupon" data-index="'+ item.__index+'" href="javascript:;">发券</a>');
HtmArr.push('<a href="/market/couponSend/sendHistory/'+ item.id +'" class="btn btn-info btn-xs sendHistory" data-index="'+ item.__index+'" href="javascript:;">发放记录</a>');
HtmArr.push('<a href="/market/couponSend/useHistory/'+ item.id +'" class="btn btn-primary btn-xs useHistory" data-index="'+ item.__index+'" href="javascript:;">使用记录</a>');
if(item.couponType==3){
HtmArr.push('<a href="/market/couponSend/pCouponSn/'+ item.id +'" class="btn btn-warning btn-xs pCouponSn" data-index="'+ item.__index+'" href="javascript:;">公开券码查看</a>');
}
return HtmArr.join('');
}}
]
});
g.init("/coupon/querySendCouponList");
$(document).on("click", "#filter-btn", function() {
g.reload(1);
});
var Bll={
getTime: function (time) {
var t = new Date(time * 1000);
return common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
}
};
/***/ }
]);