Authored by 马力

Merge branch 'dev_优惠券优化'

... ... @@ -55,4 +55,6 @@ module.exports = function (app) {
//作废
app.post("/coupon/invalid", "CouponList_invalid");
// 查询优惠券操作记录
app.post("/coupon/getOperationRecords", "CouponList_getOperationRecords");
};
\ No newline at end of file
... ...
... ... @@ -74,6 +74,13 @@ module.exports = {
couponId: {type: Number},
invalidReason: {type: String}
}
},
getOperationRecords: {
title: "查询优惠券操作记录",
url: "/coupon/queryOperationRecord",
params: {
couponsId: {type: Number}
}
}
}
};
\ No newline at end of file
... ...
... ... @@ -91,7 +91,7 @@
</div>
<div class="form-group">
<label class="col-sm-2 control-label">申请部门<i class="red">*</i></label>
<label class="col-sm-2 control-label">费用承担部门<i class="red">*</i></label>
<div class="col-sm-8" id="departments">
... ...
... ... @@ -207,6 +207,32 @@
</div>
</script>
<script type="text/template" id="operation-record-template">
<div class="historyList">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>操作类型</th>
<th>操作人</th>
<th>执行时间</th>
</tr>
</thead>
<tbody>
[[if list.length > 0]]
[[each list as item index]]
<tr>
<td>[[item.operationType]]</td>
<td>[[item.operator]]</td>
<td>[[item.createTime]]</td>
</tr>
[[/each]]
[[else]]
<tr><td colspan="7">没有操作记录!</td></tr>
[[/if]]
</tbody>
</table>
</div>
</script>
<%include '../../../common/views/__ui/footer'%>
... ...
... ... @@ -60,29 +60,29 @@ var t = new common.tab({
el: "#basicTab",
click: function () {
columnname = $(this).find('a').attr('columnname');
g.options.columns[5].hidden = true;
g.options.columns[6].hidden = true;
g.options.columns[7].hidden = true;
switch (columnname) {
case "1":
{
g.options.columns[8].hidden = true;
g.options.columns[7].hidden = true;
}
break;
case "2":
{
g.options.columns[6].hidden = false;
g.options.columns[8].hidden = true;
g.options.columns[5].hidden = false;
g.options.columns[7].hidden = true;
}
break;
case "3":
{
g.options.columns[7].hidden = false;
g.options.columns[8].hidden = true;
g.options.columns[6].hidden = false;
g.options.columns[7].hidden = true;
}
break;
case "all":
{
g.options.columns[8].hidden = false;
g.options.columns[7].hidden = false;
}
break;
}
... ... @@ -143,7 +143,6 @@ 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>"
... ... @@ -236,6 +235,9 @@ var Bll = {
for (var i = 0; i < array.length; i++) {
btns.push(buttons[array[i]])
}
// 增加查看操作记录按钮
btns.push('<a class="btn btn-primary btn-xs operation-records" data-coupon-id="' + id + '">操作记录</a>');
return btns;
}
};
... ... @@ -358,4 +360,42 @@ $(document).on('click', '.coupon-info', function () {
Bll.toastInfo(item1, '优惠券详情');
});
// 查看操作记录
$(document).on('click', '.operation-records', function() {
var couponId = $(this).data('coupon-id');
var option = {
title:'操作记录详情',
content:"<div class='historyDetail'>加载操作记录...</div>",
width:'70%',
button:[{value:"关闭", css:"btn-primary"}]
};
new common.dialog(option);
getOperationRecords(couponId);
});
function getOperationRecords(couponId) {
common.util.__ajax({
url: '/coupon/getOperationRecords',
data: {
couponsId: couponId
}
}, function(resp) {
if(resp.code == 200) {
var data = resp.data;
covertOperationRecord(data)
$('.historyDetail').html(common.util.__template2($('#operation-record-template').html(), {list: data}));
}
}, true);
}
// 转化操作类型,操作时间
function covertOperationRecord(data) {
var TYPE = {0: "新增", 1: "修改", 2: "作废"}
if(data && data.length > 0) {
$.each(data, function(index, item) {
item.operationType = TYPE[item.operationType];
item.createTime = Bll.getTime(item.createTime);
})
}
}
... ...