Authored by liuyue

优惠码bug 修改

... ... @@ -30,10 +30,8 @@ var grid=function(options){
}
this.options=$.extend({}, defaults, options);
this.grid=$(options.el);
this.isPageClick = false;
}
grid.prototype={
constructor:grid,
template: function () {
... ... @@ -93,9 +91,9 @@ grid.prototype={
},
__getparams:function(){
var g = this, p = this.options;
//if (!p.page) p.page = 1;
var param = {},
urlArr = location.hash.substring(1).split('&&');
if (!p.page) p.page = 1;
var param = {};
//urlArr = location.hash.substring(1).split('&&');
if (p.parms) {
if (typeof (p.parms) == "function") {
... ... @@ -103,7 +101,7 @@ grid.prototype={
}
}
$.each(urlArr, function(i, value){
/*$.each(urlArr, function(i, value){
var result = value.split('='),
key = result[0],
value = result[1];
... ... @@ -112,15 +110,24 @@ grid.prototype={
param[key] = value;
}
});*/
param.page = p.page;
param.size = p.size;
console.log(param);
var html = '';
$.each(param, function(key, value) {
if (value !== '') {
html += key + '=' + value + '&&';
}
});
location.hash = html;
if (p.page && g.isPageClick) {
param.page = p.page;
g.isPageClick = false;
}
//param.page=p.page;
//param.size=p.size;
return param;
},
__pagination:function(pagination){
... ... @@ -135,7 +142,6 @@ grid.prototype={
ellipsePageSet: false,
onPageClick: function(pageNumber, event) {
p.page = pageNumber;
g.isPageClick = true;
g.renderBody();
return false;
}
... ... @@ -184,15 +190,7 @@ grid.prototype={
},
success: function (res) {
var data = res.data.data;
var html = '';
$.each(param, function(key, value) {
if (value !== '') {
html += key + '=' + value + '&&';
}
});
location.hash = html;
g.__pagination({total:data.totalPage,page:data.page});
g.__bodyClomun(data.list);
// setpage(res);
... ... @@ -272,7 +270,6 @@ grid.prototype={
});
}
console.log(p);
//p.page=1;
g.__bodyload();
... ...
... ... @@ -89,6 +89,8 @@ exports.init = function() {
var btnAuthority = JSON.parse($("#btnAuthority").val());
var g=new grid({
el: '#basicTable',
size: 10,
... ... @@ -96,7 +98,7 @@ exports.init = function() {
return {
batchNo: $.trim($('#filter-id').val()) ||"",
status: parseInt($('.list-tabs').find('.active').data('status')) ||"",
status: parseInt($('.list-tabs').find('.active').data('status')),
name: $.trim($('#filter-name').val()) ||"",
reqDepartment:$.trim($('#filter-dep').val()) ||""
};
... ... @@ -109,7 +111,7 @@ exports.init = function() {
return '<p>名称:' + item.name + '</p><p>次数' + item.limitTimes + '</p><p>部门:' + item.reqDepartment + '</p>';
}},
{display: '使用期限', name: "name", render: function(item) {
return '<p>' + item.limitDateFrom + '</p><p>' + item.limitDateTo + '</p>'
return '<p class="audit-time">' + item.limitDateFrom + '</p><p>' + item.limitDateTo + '</p>'
}},
{display: '优惠码说明', name: "describe"},
{display: '申请人', name: "staff"},
... ... @@ -121,7 +123,6 @@ exports.init = function() {
return html;
}},
{display:"操作",name:"operate",render:function(items){
console.log(this);
var HtmArr=[];
if(btnAuthority.look){
HtmArr.push('<a href="/coupon/info/'+ items.id+'" class="btn btn-info btn-xs">查看详情</a>');
... ... @@ -216,7 +217,7 @@ exports.init = function() {
//发放列表点击事件
$listBtn.off('click.sendPromotion').on('click.sendPromotion', function() {
var auditTime = $(that).parents('td').siblings('.time').find('p').eq(0).text();
var auditTime = $(that).parents('td').siblings().find('.audit-time').text();
$.ajax({
type: 'post',
... ... @@ -226,7 +227,9 @@ exports.init = function() {
auditTime: auditTime
},
success: function(res) {
if (res.data.data.length === 0) {
var data = res.data.data.list;
if (data.length === 0) {
alert('暂无时间交叉的优惠码');
} else {
$('#send-modal').modal({
... ... @@ -236,7 +239,7 @@ exports.init = function() {
var tpl = Handlebars.compile($('#send-tpl').html());
$('#send-modal tbody').html(tpl({
data: res.data.data
data: data
}));
}
... ... @@ -254,8 +257,11 @@ exports.init = function() {
$('#back-modal').on('click', '.btn-primary', function() {
var reason = $('#back-reason').val();
console.log(reason);
if (reason === '' || $.trim(reason) === '') {
alert('请填写驳回原因');
return;
}
$.ajax({
type: 'post',
... ...
... ... @@ -75,7 +75,7 @@ exports.res = [
name: 'auditTime',
type: 'String'
}
]
]
},
{
route: '/auditPromotion',
... ... @@ -165,7 +165,10 @@ exports.res = [
src:'/coupon/edit',
data:{
type:"info"
}
},
params: [
{name:"id",type:"String"}
]
},
{
route: '/checkPromotionCode',
... ...
... ... @@ -93,7 +93,7 @@
<div class="modal-body">
<p>您确定要驳回该申请吗?</p>
<label class="col-sm-3 control-label">*请填写原因</label>
<input id="cancel-reason" type="text" class="form-control" name="agreement-code" style="width:280px;">
<input id="back-reason" type="text" class="form-control" name="agreement-code" style="width:280px;">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
... ... @@ -123,7 +123,7 @@
</div>
<div class="modal fade" id="send-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
... ... @@ -131,7 +131,7 @@
</div>
<div class="modal-body">
<div class="send-list">
<table class="coupon-send-table am-table am-table-bordered am-table-radius">
<table style="width:100%;" class="coupon-send-table am-table am-table-bordered am-table-radius">
<thead>
<tr class="am-primary">
<th>批次号</th>
... ... @@ -155,21 +155,20 @@
<script id="send-tpl" type="x-tmpl-handlebars">
\{{# data}}
<tr>
<td class="id"><a href="/couponinfo/\{{id}}">\{{batchNo}}</a></td>
<td class="info">
<td class="id" style="width: 20%;"><a href="/coupon/info/\{{id}}">\{{batchNo}}</a></td>
<td class="info" style="width: 30%;">
<p>名称:\{{name}}</p>
<p>次数:\{{limitTimes}}</p>
<p>部门:\{{reqDepartment}}</p>
</td>
<td class="time">
<td class="time" style="width: 20%;">
<p>\{{limitDateFrom}}</p>
<p>\{{limitDateTo}}</p>
</td>
<td class="describe">
<td class="describe" style="width: 22%;">
<p>\{{describe}}</p>
</td>
<td class="staff">\{{staff}}</td>
<td class="staff" style="width: 8%;">\{{staff}}</td>
</tr>
\{{/ data}}
</script>
... ...