Showing
4 changed files
with
46 additions
and
41 deletions
@@ -30,10 +30,8 @@ var grid=function(options){ | @@ -30,10 +30,8 @@ var grid=function(options){ | ||
30 | } | 30 | } |
31 | this.options=$.extend({}, defaults, options); | 31 | this.options=$.extend({}, defaults, options); |
32 | this.grid=$(options.el); | 32 | this.grid=$(options.el); |
33 | - this.isPageClick = false; | ||
34 | - | ||
35 | - | ||
36 | } | 33 | } |
34 | + | ||
37 | grid.prototype={ | 35 | grid.prototype={ |
38 | constructor:grid, | 36 | constructor:grid, |
39 | template: function () { | 37 | template: function () { |
@@ -93,9 +91,9 @@ grid.prototype={ | @@ -93,9 +91,9 @@ grid.prototype={ | ||
93 | }, | 91 | }, |
94 | __getparams:function(){ | 92 | __getparams:function(){ |
95 | var g = this, p = this.options; | 93 | var g = this, p = this.options; |
96 | - //if (!p.page) p.page = 1; | ||
97 | - var param = {}, | ||
98 | - urlArr = location.hash.substring(1).split('&&'); | 94 | + if (!p.page) p.page = 1; |
95 | + var param = {}; | ||
96 | + //urlArr = location.hash.substring(1).split('&&'); | ||
99 | 97 | ||
100 | if (p.parms) { | 98 | if (p.parms) { |
101 | if (typeof (p.parms) == "function") { | 99 | if (typeof (p.parms) == "function") { |
@@ -103,7 +101,7 @@ grid.prototype={ | @@ -103,7 +101,7 @@ grid.prototype={ | ||
103 | } | 101 | } |
104 | } | 102 | } |
105 | 103 | ||
106 | - $.each(urlArr, function(i, value){ | 104 | + /*$.each(urlArr, function(i, value){ |
107 | var result = value.split('='), | 105 | var result = value.split('='), |
108 | key = result[0], | 106 | key = result[0], |
109 | value = result[1]; | 107 | value = result[1]; |
@@ -112,15 +110,24 @@ grid.prototype={ | @@ -112,15 +110,24 @@ grid.prototype={ | ||
112 | param[key] = value; | 110 | param[key] = value; |
113 | } | 111 | } |
114 | 112 | ||
113 | + });*/ | ||
114 | + | ||
115 | + | ||
116 | + | ||
117 | + | ||
118 | + | ||
119 | + | ||
120 | + param.page = p.page; | ||
121 | + param.size = p.size; | ||
122 | + console.log(param); | ||
123 | + var html = ''; | ||
124 | + $.each(param, function(key, value) { | ||
125 | + if (value !== '') { | ||
126 | + html += key + '=' + value + '&&'; | ||
127 | + } | ||
115 | }); | 128 | }); |
129 | + location.hash = html; | ||
116 | 130 | ||
117 | - if (p.page && g.isPageClick) { | ||
118 | - | ||
119 | - param.page = p.page; | ||
120 | - g.isPageClick = false; | ||
121 | - } | ||
122 | - //param.page=p.page; | ||
123 | - //param.size=p.size; | ||
124 | return param; | 131 | return param; |
125 | }, | 132 | }, |
126 | __pagination:function(pagination){ | 133 | __pagination:function(pagination){ |
@@ -135,7 +142,6 @@ grid.prototype={ | @@ -135,7 +142,6 @@ grid.prototype={ | ||
135 | ellipsePageSet: false, | 142 | ellipsePageSet: false, |
136 | onPageClick: function(pageNumber, event) { | 143 | onPageClick: function(pageNumber, event) { |
137 | p.page = pageNumber; | 144 | p.page = pageNumber; |
138 | - g.isPageClick = true; | ||
139 | g.renderBody(); | 145 | g.renderBody(); |
140 | return false; | 146 | return false; |
141 | } | 147 | } |
@@ -184,15 +190,7 @@ grid.prototype={ | @@ -184,15 +190,7 @@ grid.prototype={ | ||
184 | }, | 190 | }, |
185 | success: function (res) { | 191 | success: function (res) { |
186 | var data = res.data.data; | 192 | var data = res.data.data; |
187 | - var html = ''; | ||
188 | - | ||
189 | - $.each(param, function(key, value) { | ||
190 | - if (value !== '') { | ||
191 | - html += key + '=' + value + '&&'; | ||
192 | - } | ||
193 | - }); | ||
194 | 193 | ||
195 | - location.hash = html; | ||
196 | g.__pagination({total:data.totalPage,page:data.page}); | 194 | g.__pagination({total:data.totalPage,page:data.page}); |
197 | g.__bodyClomun(data.list); | 195 | g.__bodyClomun(data.list); |
198 | // setpage(res); | 196 | // setpage(res); |
@@ -272,7 +270,6 @@ grid.prototype={ | @@ -272,7 +270,6 @@ grid.prototype={ | ||
272 | }); | 270 | }); |
273 | } | 271 | } |
274 | 272 | ||
275 | - console.log(p); | ||
276 | 273 | ||
277 | //p.page=1; | 274 | //p.page=1; |
278 | g.__bodyload(); | 275 | g.__bodyload(); |
@@ -89,6 +89,8 @@ exports.init = function() { | @@ -89,6 +89,8 @@ exports.init = function() { | ||
89 | 89 | ||
90 | var btnAuthority = JSON.parse($("#btnAuthority").val()); | 90 | var btnAuthority = JSON.parse($("#btnAuthority").val()); |
91 | 91 | ||
92 | + | ||
93 | + | ||
92 | var g=new grid({ | 94 | var g=new grid({ |
93 | el: '#basicTable', | 95 | el: '#basicTable', |
94 | size: 10, | 96 | size: 10, |
@@ -96,7 +98,7 @@ exports.init = function() { | @@ -96,7 +98,7 @@ exports.init = function() { | ||
96 | 98 | ||
97 | return { | 99 | return { |
98 | batchNo: $.trim($('#filter-id').val()) ||"", | 100 | batchNo: $.trim($('#filter-id').val()) ||"", |
99 | - status: parseInt($('.list-tabs').find('.active').data('status')) ||"", | 101 | + status: parseInt($('.list-tabs').find('.active').data('status')), |
100 | name: $.trim($('#filter-name').val()) ||"", | 102 | name: $.trim($('#filter-name').val()) ||"", |
101 | reqDepartment:$.trim($('#filter-dep').val()) ||"" | 103 | reqDepartment:$.trim($('#filter-dep').val()) ||"" |
102 | }; | 104 | }; |
@@ -109,7 +111,7 @@ exports.init = function() { | @@ -109,7 +111,7 @@ exports.init = function() { | ||
109 | return '<p>名称:' + item.name + '</p><p>次数' + item.limitTimes + '</p><p>部门:' + item.reqDepartment + '</p>'; | 111 | return '<p>名称:' + item.name + '</p><p>次数' + item.limitTimes + '</p><p>部门:' + item.reqDepartment + '</p>'; |
110 | }}, | 112 | }}, |
111 | {display: '使用期限', name: "name", render: function(item) { | 113 | {display: '使用期限', name: "name", render: function(item) { |
112 | - return '<p>' + item.limitDateFrom + '</p><p>' + item.limitDateTo + '</p>' | 114 | + return '<p class="audit-time">' + item.limitDateFrom + '</p><p>' + item.limitDateTo + '</p>' |
113 | }}, | 115 | }}, |
114 | {display: '优惠码说明', name: "describe"}, | 116 | {display: '优惠码说明', name: "describe"}, |
115 | {display: '申请人', name: "staff"}, | 117 | {display: '申请人', name: "staff"}, |
@@ -121,7 +123,6 @@ exports.init = function() { | @@ -121,7 +123,6 @@ exports.init = function() { | ||
121 | return html; | 123 | return html; |
122 | }}, | 124 | }}, |
123 | {display:"操作",name:"operate",render:function(items){ | 125 | {display:"操作",name:"operate",render:function(items){ |
124 | - console.log(this); | ||
125 | var HtmArr=[]; | 126 | var HtmArr=[]; |
126 | if(btnAuthority.look){ | 127 | if(btnAuthority.look){ |
127 | HtmArr.push('<a href="/coupon/info/'+ items.id+'" class="btn btn-info btn-xs">查看详情</a>'); | 128 | HtmArr.push('<a href="/coupon/info/'+ items.id+'" class="btn btn-info btn-xs">查看详情</a>'); |
@@ -216,7 +217,7 @@ exports.init = function() { | @@ -216,7 +217,7 @@ exports.init = function() { | ||
216 | 217 | ||
217 | //发放列表点击事件 | 218 | //发放列表点击事件 |
218 | $listBtn.off('click.sendPromotion').on('click.sendPromotion', function() { | 219 | $listBtn.off('click.sendPromotion').on('click.sendPromotion', function() { |
219 | - var auditTime = $(that).parents('td').siblings('.time').find('p').eq(0).text(); | 220 | + var auditTime = $(that).parents('td').siblings().find('.audit-time').text(); |
220 | 221 | ||
221 | $.ajax({ | 222 | $.ajax({ |
222 | type: 'post', | 223 | type: 'post', |
@@ -226,7 +227,9 @@ exports.init = function() { | @@ -226,7 +227,9 @@ exports.init = function() { | ||
226 | auditTime: auditTime | 227 | auditTime: auditTime |
227 | }, | 228 | }, |
228 | success: function(res) { | 229 | success: function(res) { |
229 | - if (res.data.data.length === 0) { | 230 | + var data = res.data.data.list; |
231 | + | ||
232 | + if (data.length === 0) { | ||
230 | alert('暂无时间交叉的优惠码'); | 233 | alert('暂无时间交叉的优惠码'); |
231 | } else { | 234 | } else { |
232 | $('#send-modal').modal({ | 235 | $('#send-modal').modal({ |
@@ -236,7 +239,7 @@ exports.init = function() { | @@ -236,7 +239,7 @@ exports.init = function() { | ||
236 | var tpl = Handlebars.compile($('#send-tpl').html()); | 239 | var tpl = Handlebars.compile($('#send-tpl').html()); |
237 | 240 | ||
238 | $('#send-modal tbody').html(tpl({ | 241 | $('#send-modal tbody').html(tpl({ |
239 | - data: res.data.data | 242 | + data: data |
240 | })); | 243 | })); |
241 | } | 244 | } |
242 | 245 | ||
@@ -254,8 +257,11 @@ exports.init = function() { | @@ -254,8 +257,11 @@ exports.init = function() { | ||
254 | $('#back-modal').on('click', '.btn-primary', function() { | 257 | $('#back-modal').on('click', '.btn-primary', function() { |
255 | var reason = $('#back-reason').val(); | 258 | var reason = $('#back-reason').val(); |
256 | 259 | ||
260 | + console.log(reason); | ||
261 | + | ||
257 | if (reason === '' || $.trim(reason) === '') { | 262 | if (reason === '' || $.trim(reason) === '') { |
258 | alert('请填写驳回原因'); | 263 | alert('请填写驳回原因'); |
264 | + return; | ||
259 | } | 265 | } |
260 | $.ajax({ | 266 | $.ajax({ |
261 | type: 'post', | 267 | type: 'post', |
@@ -75,7 +75,7 @@ exports.res = [ | @@ -75,7 +75,7 @@ exports.res = [ | ||
75 | name: 'auditTime', | 75 | name: 'auditTime', |
76 | type: 'String' | 76 | type: 'String' |
77 | } | 77 | } |
78 | - ] | 78 | + ] |
79 | }, | 79 | }, |
80 | { | 80 | { |
81 | route: '/auditPromotion', | 81 | route: '/auditPromotion', |
@@ -165,7 +165,10 @@ exports.res = [ | @@ -165,7 +165,10 @@ exports.res = [ | ||
165 | src:'/coupon/edit', | 165 | src:'/coupon/edit', |
166 | data:{ | 166 | data:{ |
167 | type:"info" | 167 | type:"info" |
168 | - } | 168 | + }, |
169 | + params: [ | ||
170 | + {name:"id",type:"String"} | ||
171 | + ] | ||
169 | }, | 172 | }, |
170 | { | 173 | { |
171 | route: '/checkPromotionCode', | 174 | route: '/checkPromotionCode', |
@@ -93,7 +93,7 @@ | @@ -93,7 +93,7 @@ | ||
93 | <div class="modal-body"> | 93 | <div class="modal-body"> |
94 | <p>您确定要驳回该申请吗?</p> | 94 | <p>您确定要驳回该申请吗?</p> |
95 | <label class="col-sm-3 control-label">*请填写原因</label> | 95 | <label class="col-sm-3 control-label">*请填写原因</label> |
96 | - <input id="cancel-reason" type="text" class="form-control" name="agreement-code" style="width:280px;"> | 96 | + <input id="back-reason" type="text" class="form-control" name="agreement-code" style="width:280px;"> |
97 | </div> | 97 | </div> |
98 | <div class="modal-footer"> | 98 | <div class="modal-footer"> |
99 | <button type="button" class="btn btn-default" data-dismiss="modal">取消</button> | 99 | <button type="button" class="btn btn-default" data-dismiss="modal">取消</button> |
@@ -123,7 +123,7 @@ | @@ -123,7 +123,7 @@ | ||
123 | </div> | 123 | </div> |
124 | 124 | ||
125 | <div class="modal fade" id="send-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> | 125 | <div class="modal fade" id="send-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> |
126 | - <div class="modal-dialog" role="document"> | 126 | + <div class="modal-dialog modal-lg" role="document"> |
127 | <div class="modal-content"> | 127 | <div class="modal-content"> |
128 | <div class="modal-header"> | 128 | <div class="modal-header"> |
129 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | 129 | <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> |
@@ -131,7 +131,7 @@ | @@ -131,7 +131,7 @@ | ||
131 | </div> | 131 | </div> |
132 | <div class="modal-body"> | 132 | <div class="modal-body"> |
133 | <div class="send-list"> | 133 | <div class="send-list"> |
134 | - <table class="coupon-send-table am-table am-table-bordered am-table-radius"> | 134 | + <table style="width:100%;" class="coupon-send-table am-table am-table-bordered am-table-radius"> |
135 | <thead> | 135 | <thead> |
136 | <tr class="am-primary"> | 136 | <tr class="am-primary"> |
137 | <th>批次号</th> | 137 | <th>批次号</th> |
@@ -155,21 +155,20 @@ | @@ -155,21 +155,20 @@ | ||
155 | <script id="send-tpl" type="x-tmpl-handlebars"> | 155 | <script id="send-tpl" type="x-tmpl-handlebars"> |
156 | \{{# data}} | 156 | \{{# data}} |
157 | <tr> | 157 | <tr> |
158 | - <td class="id"><a href="/couponinfo/\{{id}}">\{{batchNo}}</a></td> | ||
159 | - <td class="info"> | 158 | + <td class="id" style="width: 20%;"><a href="/coupon/info/\{{id}}">\{{batchNo}}</a></td> |
159 | + <td class="info" style="width: 30%;"> | ||
160 | <p>名称:\{{name}}</p> | 160 | <p>名称:\{{name}}</p> |
161 | <p>次数:\{{limitTimes}}</p> | 161 | <p>次数:\{{limitTimes}}</p> |
162 | <p>部门:\{{reqDepartment}}</p> | 162 | <p>部门:\{{reqDepartment}}</p> |
163 | </td> | 163 | </td> |
164 | - <td class="time"> | 164 | + <td class="time" style="width: 20%;"> |
165 | <p>\{{limitDateFrom}}</p> | 165 | <p>\{{limitDateFrom}}</p> |
166 | - 至 | ||
167 | <p>\{{limitDateTo}}</p> | 166 | <p>\{{limitDateTo}}</p> |
168 | </td> | 167 | </td> |
169 | - <td class="describe"> | 168 | + <td class="describe" style="width: 22%;"> |
170 | <p>\{{describe}}</p> | 169 | <p>\{{describe}}</p> |
171 | </td> | 170 | </td> |
172 | - <td class="staff">\{{staff}}</td> | 171 | + <td class="staff" style="width: 8%;">\{{staff}}</td> |
173 | </tr> | 172 | </tr> |
174 | \{{/ data}} | 173 | \{{/ data}} |
175 | </script> | 174 | </script> |
-
Please register or login to post a comment