...
|
...
|
@@ -21,7 +21,7 @@ var ENUM = { |
|
|
status: {0: '待审核', 1: '审核通过', 2: '驳回', '-1': '过期', 3: '作废'},//全部
|
|
|
tips: {"0": 0, "1": 0, "2": 0, "3": 0, "4": 0, "all": 0}
|
|
|
};
|
|
|
|
|
|
var columnname="all";
|
|
|
var couponIds = {};
|
|
|
/**
|
|
|
* 初始化下拉框
|
...
|
...
|
@@ -29,9 +29,8 @@ var couponIds = {}; |
|
|
new common.dropDown({el: '#filter-dep'});
|
|
|
common.util.__ajax({
|
|
|
url: "/coupon/queryList",//获取所有优惠券ID
|
|
|
data: {}
|
|
|
data: {size:1000}
|
|
|
}, function (res) {
|
|
|
//console.log("res",res);
|
|
|
$("#couponsIds").html(common.util.__template2($("#search-coupon").html(), res));
|
|
|
new common.dropDown({el: "#choose-coupon"});
|
|
|
couponIds = res.data;
|
...
|
...
|
@@ -43,7 +42,30 @@ common.util.__ajax({ |
|
|
var t = new common.tab({
|
|
|
el: "#basicTab",
|
|
|
click: function () {
|
|
|
g.reload(1);
|
|
|
columnname = $(this).find('a').attr('columnname');
|
|
|
g.options.columns[6].hidden = true;
|
|
|
g.options.columns[7].hidden = true;
|
|
|
switch (columnname){
|
|
|
case "1":{
|
|
|
g.options.columns[8].hidden = true;
|
|
|
}
|
|
|
break;
|
|
|
case "2":{
|
|
|
g.options.columns[6].hidden = false;
|
|
|
g.options.columns[8].hidden = true;
|
|
|
}
|
|
|
break;
|
|
|
case "3":{
|
|
|
g.options.columns[7].hidden = false;
|
|
|
g.options.columns[8].hidden = true;
|
|
|
}
|
|
|
break;
|
|
|
case "all":{
|
|
|
g.options.columns[8].hidden = false;
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
g.init("/coupon/queryCouponList");
|
|
|
},
|
|
|
columns: [
|
|
|
{name: "all", display: "全部"},
|
...
|
...
|
@@ -54,63 +76,6 @@ var t = new common.tab({ |
|
|
{name: "-1", display: "已过期"}
|
|
|
]
|
|
|
}).init(ENUM.tips);
|
|
|
var activeTip= t.active;
|
|
|
/**
|
|
|
* 通用方法
|
|
|
* @type {{getTime: Function, toast: Function, toastInfo: Function}}
|
|
|
*/
|
|
|
var Bll = {
|
|
|
getTime: function (time) {
|
|
|
var t = new Date(time * 1000);
|
|
|
return common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
|
|
|
},
|
|
|
toast: function (content, url,data) {
|
|
|
common.dialog.confirm("温馨提示", content, function () {
|
|
|
common.util.__ajax({
|
|
|
url:url,
|
|
|
data:data()
|
|
|
}, function () {
|
|
|
g.reload();
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
toastPass: function (content, url,data) {
|
|
|
common.dialog.confirm("温馨提示", content, function () {
|
|
|
common.util.__ajax({
|
|
|
url:url,
|
|
|
data:data
|
|
|
}, function () {
|
|
|
g.reload();
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
toastInfo: function (item, hint) {
|
|
|
common.dialog({
|
|
|
title: hint,
|
|
|
content: common.util.__template2($("#templateInfo").html(), item),
|
|
|
width: "60%",
|
|
|
button: [{
|
|
|
value: '取消'
|
|
|
}
|
|
|
|
|
|
]
|
|
|
})
|
|
|
},
|
|
|
getButtons: function (index, id, array) {
|
|
|
var btns = [];
|
|
|
var buttons = [
|
|
|
'<a class="btn btn-warning btn-xs apply-back" data-index="' + index + '" >驳回</a>',
|
|
|
'<a class="btn btn-primary btn-xs apply-success" data-index="' + index + '" >通过</a>',
|
|
|
'<a data-index="' + index + '" class="btn btn-info btn-xs coupon-info">查看详情</a>',
|
|
|
'<a data-index="' + index + '"class="btn btn-info btn-xs apply-modify" href="/market/couponList/update/'+id +'">修改</a>',
|
|
|
'<a class="btn btn-danger btn-xs apply-cancel" data-index="' + index + '" >作废</a>'
|
|
|
];
|
|
|
for (var i = 0; i < array.length; i++) {
|
|
|
btns.push(buttons[array[i]])
|
|
|
}
|
|
|
return btns;
|
|
|
}
|
|
|
};
|
|
|
/**
|
|
|
* 列表
|
|
|
* @type {common.grid}
|
...
|
...
|
@@ -118,7 +83,6 @@ var Bll = { |
|
|
var g = new common.grid({
|
|
|
el: '#basicTable',
|
|
|
parms: function () {
|
|
|
|
|
|
return {
|
|
|
couponId: common.util.__input("choose-coupon"),
|
|
|
couponName: common.util.__input("filter-couponName"),
|
...
|
...
|
@@ -159,8 +123,14 @@ var g = new common.grid({ |
|
|
},
|
|
|
{display: "优惠券说明", name: "explains"},
|
|
|
{display: "申请人", name: "proposer"},
|
|
|
{display:"驳回理由",hidden:true,name:"rejectReason",render:function(item){
|
|
|
return "<p style='color: red'>"+item.rejectReason+"</p>"
|
|
|
}},
|
|
|
{display:"作废理由",hidden:true,name:"invalidReason",render:function(item){
|
|
|
return "<p style='color: red'>"+item.invalidReason+"</p>"
|
|
|
}},
|
|
|
{
|
|
|
display: '状态', render: function (item) {
|
|
|
display: '状态',render: function (item) {
|
|
|
var html = ENUM.status[item.status] || '全部';
|
|
|
if (item.reason) {
|
|
|
if (item.status == 2 || item.status == 4) {
|
...
|
...
|
@@ -181,6 +151,64 @@ var g = new common.grid({ |
|
|
});
|
|
|
g.init("/coupon/queryCouponList");
|
|
|
/**
|
|
|
* 通用方法
|
|
|
* @type {{getTime: Function, toast: Function, toastInfo: Function}}
|
|
|
*/
|
|
|
var Bll = {
|
|
|
getTime: function (time) {
|
|
|
var t = new Date(time * 1000);
|
|
|
return common.util.__dateFormat(t, "yyyy-MM-dd hh:mm:ss");
|
|
|
},
|
|
|
toast: function (content, url,data) {
|
|
|
common.dialog.confirm("温馨提示", content, function () {
|
|
|
common.util.__ajax({
|
|
|
url:url,
|
|
|
data:data()
|
|
|
}, function () {
|
|
|
g.reload();
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
toastPass: function (content, url,data) {
|
|
|
common.dialog.confirm("温馨提示", content, function () {
|
|
|
common.util.__ajax({
|
|
|
url:url,
|
|
|
data:data
|
|
|
}, function () {
|
|
|
g.reload();
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
toastInfo: function (item, hint) {
|
|
|
common.dialog({
|
|
|
title: hint,
|
|
|
content: common.util.__template2($("#templateInfo").html(), item),
|
|
|
width: "60%",
|
|
|
button: [{
|
|
|
value: '取消',
|
|
|
css:"btn btn-primary"
|
|
|
}
|
|
|
|
|
|
]
|
|
|
})
|
|
|
},
|
|
|
getButtons: function (index, id, array) {
|
|
|
var btns = [];
|
|
|
var buttons = [
|
|
|
'<a class="btn btn-warning btn-xs apply-back" data-index="' + index + '" >驳回</a>',
|
|
|
'<a class="btn btn-primary btn-xs apply-success" data-index="' + index + '" >通过</a>',
|
|
|
'<a data-index="' + index + '" class="btn btn-info btn-xs coupon-info">查看详情</a>',
|
|
|
'<a data-index="' + index + '"class="btn btn-info btn-xs apply-modify" href="/market/couponList/update/'+id +'">修改</a>',
|
|
|
'<a class="btn btn-danger btn-xs apply-cancel" data-index="' + index + '" >作废</a>'
|
|
|
];
|
|
|
for (var i = 0; i < array.length; i++) {
|
|
|
btns.push(buttons[array[i]])
|
|
|
}
|
|
|
return btns;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 筛选
|
|
|
*/
|
|
|
$("#filter-btn").click(function () {
|
...
|
...
|
@@ -229,7 +257,6 @@ $(document).on('click', '.apply-cancel', function () { |
|
|
*/
|
|
|
$(document).on('click', '.coupon-info', function () {
|
|
|
var item = g.rows[$(this).data("index")];
|
|
|
console.log("item.options",item.options);
|
|
|
var item1 = $.extend(true, {}, item);
|
|
|
item1.createTime = Bll.getTime(item1.createTime);
|
|
|
item1.startTime = Bll.getTime(item1.startTime);
|
...
|
...
|
|