1
|
var $ = require('jquery'),
|
1
|
var $ = require('jquery'),
|
2
|
common = require('../../../../common/common');
|
2
|
common = require('../../../../common/common');
|
3
|
console.log("rejectPromotions in");
|
3
|
console.log("rejectPromotions in");
|
4
|
-// var rejectPromotions={
|
|
|
5
|
-// batchIds:[],
|
|
|
6
|
-// buildCheckboxHtml:function(_class,_data_index,_checked){
|
|
|
7
|
-// var _checkBox="<input type='checkbox'";
|
|
|
8
|
-// var _end="/>";
|
|
|
9
|
-// if(_class){
|
|
|
10
|
-// _checkBox+=" class='"+_class+"'";
|
|
|
11
|
-// }
|
|
|
12
|
-// if(_data_index){
|
|
|
13
|
-// _checkBox+=" data-index='"+_data_index+"'";
|
|
|
14
|
-// }
|
|
|
15
|
-// if(_checked){
|
|
|
16
|
-// _checkBox+=" checked='"+_checked+"'";
|
|
|
17
|
-// }
|
|
|
18
|
-// _checkBox+=_end;
|
|
|
19
|
-// return _checkBox;
|
|
|
20
|
-// },
|
|
|
21
|
-// getParam:function(){
|
|
|
22
|
-// var g=this;
|
|
|
23
|
-// /*
|
|
|
24
|
-// var _buildCheckboxHtml = function (_class,_data_index,_checked) {
|
|
|
25
|
-// return this.buildCheckboxHtml(_class,_data_index,_checked);
|
|
|
26
|
-// };*/
|
|
|
27
|
-// var param={
|
|
|
28
|
-// el: '#basicTable_promotion',
|
|
|
29
|
-// size: 10,
|
|
|
30
|
-// parms: function() {
|
|
|
31
|
-// return {
|
|
|
32
|
-// startTime: common.util.__input('startTime'),
|
|
|
33
|
-// endTime:common.util.__input("endTime")
|
|
|
34
|
-// };
|
|
|
35
|
-// },
|
|
|
36
|
-// columns: [
|
|
|
37
|
-// {
|
|
|
38
|
-// display: '',
|
|
|
39
|
-// type: 'checkbox',
|
|
|
40
|
-// _class:"all",
|
|
|
41
|
-// render: function (item) {
|
|
|
42
|
-// var htmlContent = "";
|
|
|
43
|
-// var _class="promotion_checkbox";
|
|
|
44
|
-// if(g.batchIds.length === 0 ){
|
|
|
45
|
-// //htmlContent = "<input type='checkbox' class='wqt_checkbox' data-index='"+item.__index+"'>";
|
|
|
46
|
-// htmlContent = g.buildCheckboxHtml(_class,item.__index);
|
|
|
47
|
-// }else{
|
|
|
48
|
-// $.each(g.batchIds,function(n,value) {
|
|
|
49
|
-// if(item.id == value){
|
|
|
50
|
-// //htmlContent = "<input type='checkbox' checked='checked' class='wqt_checkbox' data-index='"+item.__index+"'>";
|
|
|
51
|
-// htmlContent = g.buildCheckboxHtml(_class,item.__index,"checked");
|
|
|
52
|
-// return false
|
|
|
53
|
-// }else{
|
|
|
54
|
-// htmlContent = "<input type='checkbox' class='wqt_checkbox' data-index='"+item.__index+"'>";
|
|
|
55
|
-// htmlContent = g.buildCheckboxHtml(_class,item.__index);
|
|
|
56
|
-// }
|
|
|
57
|
-// })
|
|
|
58
|
-// }
|
|
|
59
|
-// return htmlContent;
|
|
|
60
|
-// }
|
|
|
61
|
-// },{
|
|
|
62
|
-// display: "ID",
|
|
|
63
|
-// name: "id"
|
|
|
64
|
-// }, {
|
|
|
65
|
-// display: "促销名称",
|
|
|
66
|
-// name: "title"
|
|
|
67
|
-// }, {
|
|
|
68
|
-// display: '优先级',
|
|
|
69
|
-// name: "priority"
|
|
|
70
|
-// }, {
|
|
|
71
|
-// display: '开始时间',
|
|
|
72
|
-// name: "startTime",
|
|
|
73
|
-// render: function(item) {
|
|
|
74
|
-// var date = new Date(item.startTime * 1000);
|
|
|
75
|
-// return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
|
|
|
76
|
-// }
|
|
|
77
|
-// }, {
|
|
|
78
|
-// display: '结束时间',
|
|
|
79
|
-// name: "endTime",
|
|
|
80
|
-// render: function(item) {
|
|
|
81
|
-// var date = new Date(item.endTime * 1000);
|
|
|
82
|
-// return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
|
|
|
83
|
-// }
|
|
|
84
|
-// }, {
|
|
|
85
|
-// display: '是否启用',
|
|
|
86
|
-// name: "status",
|
|
|
87
|
-// render: function(item) {
|
|
|
88
|
-// if(item.status==1){
|
|
|
89
|
-// var name ="已启用" ;
|
|
|
90
|
-// }else {
|
|
|
91
|
-// var name ="未启用" ;
|
|
|
92
|
-// }
|
|
|
93
|
-// return name;
|
|
|
94
|
-// }
|
|
|
95
|
-// }, {
|
|
|
96
|
-// display: '优惠券限制使用',
|
|
|
97
|
-// name: "status",
|
|
|
98
|
-// render: function(item) {
|
|
|
99
|
-// if(item.status==1){
|
|
|
100
|
-// var name ="是" ;
|
|
|
101
|
-// }else {
|
|
|
102
|
-// var name ="否" ;
|
|
|
103
|
-// }
|
|
|
104
|
-// return name;
|
|
|
105
|
-// }
|
|
|
106
|
-// }]
|
|
|
107
|
-// };
|
|
|
108
|
-// return param;
|
|
|
109
|
-// },
|
|
|
110
|
-// bindGrid: function(param){
|
|
|
111
|
-// return new common.grid(param);
|
|
|
112
|
-// },
|
|
|
113
|
-// grid: undefined,
|
|
|
114
|
-// init: function(){
|
|
|
115
|
-// var g=this,
|
|
|
116
|
-// _param=this.getParam();
|
|
|
117
|
-// this.grid=g.bindGrid(_param);
|
|
|
118
|
-// this.grid.init("/promotionInfo/list");
|
|
|
119
|
-// this.bindEvent();
|
|
|
120
|
-// },
|
|
|
121
|
-// reload:function(){
|
|
|
122
|
-// var g=this,
|
|
|
123
|
-// _grid=this.grid;
|
|
|
124
|
-// _grid.reload(1);
|
|
|
125
|
-// },
|
|
|
126
|
-// bindEvent: function() {
|
|
|
127
|
-// var g = this.grid,
|
|
|
128
|
-// p = this.options,
|
|
|
129
|
-// _batchIds=this.batchIds;
|
4
|
+var rejectPromotions={
|
|
|
5
|
+ batchIds:[],
|
|
|
6
|
+ buildCheckboxHtml:function(_class,_data_index,_checked){
|
|
|
7
|
+ var _checkBox="<input type='checkbox'";
|
|
|
8
|
+ var _end="/>";
|
|
|
9
|
+ if(_class){
|
|
|
10
|
+ _checkBox+=" class='"+_class+"'";
|
|
|
11
|
+ }
|
|
|
12
|
+ if(_data_index){
|
|
|
13
|
+ _checkBox+=" data-index='"+_data_index+"'";
|
|
|
14
|
+ }
|
|
|
15
|
+ if(_checked){
|
|
|
16
|
+ _checkBox+=" checked='"+_checked+"'";
|
|
|
17
|
+ }
|
|
|
18
|
+ _checkBox+=_end;
|
|
|
19
|
+ return _checkBox;
|
|
|
20
|
+ },
|
|
|
21
|
+ getParam:function(){
|
|
|
22
|
+ var g=this;
|
|
|
23
|
+ /*
|
|
|
24
|
+ var _buildCheckboxHtml = function (_class,_data_index,_checked) {
|
|
|
25
|
+ return this.buildCheckboxHtml(_class,_data_index,_checked);
|
|
|
26
|
+ };*/
|
|
|
27
|
+ var param={
|
|
|
28
|
+ el: '#basicTable_promotion',
|
|
|
29
|
+ size: 10,
|
|
|
30
|
+ parms: function() {
|
|
|
31
|
+ return {
|
|
|
32
|
+ startTime: common.util.__input('startTime'),
|
|
|
33
|
+ endTime:common.util.__input("endTime")
|
|
|
34
|
+ };
|
|
|
35
|
+ },
|
|
|
36
|
+ columns: [
|
|
|
37
|
+ {
|
|
|
38
|
+ display: '',
|
|
|
39
|
+ type: 'checkbox',
|
|
|
40
|
+ _class:"all",
|
|
|
41
|
+ render: function (item) {
|
|
|
42
|
+ var htmlContent = "";
|
|
|
43
|
+ var _class="promotion_checkbox";
|
|
|
44
|
+ if(g.batchIds.length === 0 ){
|
|
|
45
|
+ //htmlContent = "<input type='checkbox' class='wqt_checkbox' data-index='"+item.__index+"'>";
|
|
|
46
|
+ htmlContent = g.buildCheckboxHtml(_class,item.__index);
|
|
|
47
|
+ }else{
|
|
|
48
|
+ $.each(g.batchIds,function(n,value) {
|
|
|
49
|
+ if(item.id == value){
|
|
|
50
|
+ //htmlContent = "<input type='checkbox' checked='checked' class='wqt_checkbox' data-index='"+item.__index+"'>";
|
|
|
51
|
+ htmlContent = g.buildCheckboxHtml(_class,item.__index,"checked");
|
|
|
52
|
+ return false
|
|
|
53
|
+ }else{
|
|
|
54
|
+ htmlContent = "<input type='checkbox' class='wqt_checkbox' data-index='"+item.__index+"'>";
|
|
|
55
|
+ htmlContent = g.buildCheckboxHtml(_class,item.__index);
|
|
|
56
|
+ }
|
|
|
57
|
+ })
|
|
|
58
|
+ }
|
|
|
59
|
+ return htmlContent;
|
|
|
60
|
+ }
|
|
|
61
|
+ },{
|
|
|
62
|
+ display: "ID",
|
|
|
63
|
+ name: "id"
|
|
|
64
|
+ }, {
|
|
|
65
|
+ display: "促销名称",
|
|
|
66
|
+ name: "title"
|
|
|
67
|
+ }, {
|
|
|
68
|
+ display: '优先级',
|
|
|
69
|
+ name: "priority"
|
|
|
70
|
+ }, {
|
|
|
71
|
+ display: '开始时间',
|
|
|
72
|
+ name: "startTime",
|
|
|
73
|
+ render: function(item) {
|
|
|
74
|
+ var date = new Date(item.startTime * 1000);
|
|
|
75
|
+ return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
|
|
|
76
|
+ }
|
|
|
77
|
+ }, {
|
|
|
78
|
+ display: '结束时间',
|
|
|
79
|
+ name: "endTime",
|
|
|
80
|
+ render: function(item) {
|
|
|
81
|
+ var date = new Date(item.endTime * 1000);
|
|
|
82
|
+ return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
|
|
|
83
|
+ }
|
|
|
84
|
+ }, {
|
|
|
85
|
+ display: '是否启用',
|
|
|
86
|
+ name: "status",
|
|
|
87
|
+ render: function(item) {
|
|
|
88
|
+ if(item.status==1){
|
|
|
89
|
+ var name ="已启用" ;
|
|
|
90
|
+ }else {
|
|
|
91
|
+ var name ="未启用" ;
|
|
|
92
|
+ }
|
|
|
93
|
+ return name;
|
|
|
94
|
+ }
|
|
|
95
|
+ }, {
|
|
|
96
|
+ display: '优惠券限制使用',
|
|
|
97
|
+ name: "status",
|
|
|
98
|
+ render: function(item) {
|
|
|
99
|
+ if(item.status==1){
|
|
|
100
|
+ var name ="是" ;
|
|
|
101
|
+ }else {
|
|
|
102
|
+ var name ="否" ;
|
|
|
103
|
+ }
|
|
|
104
|
+ return name;
|
|
|
105
|
+ }
|
|
|
106
|
+ }]
|
|
|
107
|
+ };
|
|
|
108
|
+ return param;
|
|
|
109
|
+ },
|
|
|
110
|
+ bindGrid: function(param){
|
|
|
111
|
+ return new common.grid(param);
|
|
|
112
|
+ },
|
|
|
113
|
+ grid: undefined,
|
|
|
114
|
+ init: function(){
|
|
|
115
|
+ var g=this,
|
|
|
116
|
+ _param=this.getParam();
|
|
|
117
|
+ this.grid=g.bindGrid(_param);
|
|
|
118
|
+ this.grid.init("/promotionInfo/list");
|
|
|
119
|
+ this.bindEvent();
|
|
|
120
|
+ },
|
|
|
121
|
+ reload:function(){
|
|
|
122
|
+ var g=this,
|
|
|
123
|
+ _grid=this.grid;
|
|
|
124
|
+ _grid.reload(1);
|
|
|
125
|
+ },
|
|
|
126
|
+ bindEvent: function() {
|
|
|
127
|
+ var g = this.grid,
|
|
|
128
|
+ p = this.options,
|
|
|
129
|
+ _batchIds=this.batchIds;
|
130
|
|
130
|
|
131
|
-// $(g.grid).on("change", ".all", function() {
|
|
|
132
|
-// var selected = $(".all").prop("checked");
|
|
|
133
|
-// $(".promotion_checkbox").prop("checked", selected);
|
|
|
134
|
-// g.selected.length = 0;
|
|
|
135
|
-// $(".promotion_checkbox").each(function() {
|
|
|
136
|
-// var checked = $(this).prop("checked");
|
|
|
137
|
-// var index = $(this).data("index");
|
|
|
138
|
-// if (checked) {
|
|
|
139
|
-// /**************业务控制 特殊情况**************/
|
|
|
140
|
-// if(_batchIds){
|
|
|
141
|
-// if($.inArray(g.rows[index]['id'], _batchIds) == -1 ){
|
|
|
142
|
-// _batchIds.push(g.rows[index]['id']);
|
|
|
143
|
-// }
|
|
|
144
|
-// }
|
|
|
145
|
-// /*********************************************/
|
|
|
146
|
-// g.selected.push(g.rows[index]);
|
|
|
147
|
-// }else{
|
|
|
148
|
-// /**************业务控制 特殊情况**************/
|
131
|
+ $(g.grid).on("change", ".all", function() {
|
|
|
132
|
+ var selected = $(".all").prop("checked");
|
|
|
133
|
+ $(".promotion_checkbox").prop("checked", selected);
|
|
|
134
|
+ g.selected.length = 0;
|
|
|
135
|
+ $(".promotion_checkbox").each(function() {
|
|
|
136
|
+ var checked = $(this).prop("checked");
|
|
|
137
|
+ var index = $(this).data("index");
|
|
|
138
|
+ if (checked) {
|
|
|
139
|
+ /**************业务控制 特殊情况**************/
|
|
|
140
|
+ if(_batchIds){
|
|
|
141
|
+ if($.inArray(g.rows[index]['id'], _batchIds) == -1 ){
|
|
|
142
|
+ _batchIds.push(g.rows[index]['id']);
|
|
|
143
|
+ }
|
|
|
144
|
+ }
|
|
|
145
|
+ /*********************************************/
|
|
|
146
|
+ g.selected.push(g.rows[index]);
|
|
|
147
|
+ }else{
|
|
|
148
|
+ /**************业务控制 特殊情况**************/
|
149
|
|
149
|
|
150
|
-// var _index = $.inArray(g.rows[index]['id'], _batchIds);
|
|
|
151
|
-// if(_batchIds && _index != -1 ){
|
|
|
152
|
-// _batchIds.splice(_index,1);
|
|
|
153
|
-// }
|
|
|
154
|
-// /********************************************/
|
|
|
155
|
-// }
|
|
|
156
|
-// });
|
|
|
157
|
-// }); //g.selected
|
|
|
158
|
-// //$(".promotion_checkbox").prop("checked",true);
|
|
|
159
|
-// $(g.grid).on("change", ".promotion_checkbox", function() {
|
|
|
160
|
-// $(".all").prop("checked", false);
|
|
|
161
|
-// g.selected.length = 0;
|
|
|
162
|
-// var selected = true;
|
150
|
+ var _index = $.inArray(g.rows[index]['id'], _batchIds);
|
|
|
151
|
+ if(_batchIds && _index != -1 ){
|
|
|
152
|
+ _batchIds.splice(_index,1);
|
|
|
153
|
+ }
|
|
|
154
|
+ /********************************************/
|
|
|
155
|
+ }
|
|
|
156
|
+ });
|
|
|
157
|
+ }); //g.selected
|
|
|
158
|
+ //$(".promotion_checkbox").prop("checked",true);
|
|
|
159
|
+ $(g.grid).on("change", ".promotion_checkbox", function() {
|
|
|
160
|
+ $(".all").prop("checked", false);
|
|
|
161
|
+ g.selected.length = 0;
|
|
|
162
|
+ var selected = true;
|
163
|
|
163
|
|
164
|
-// /************业务控制 特殊情况****************/
|
|
|
165
|
-// if(_batchIds){
|
|
|
166
|
-// if($(this).prop("checked")){
|
|
|
167
|
-// if($.inArray(g.rows[$(this).attr("data-index")]['id'], _batchIds) == -1 ){
|
|
|
168
|
-// _batchIds.push(g.rows[$(this).attr("data-index")]['id']);
|
|
|
169
|
-// }
|
|
|
170
|
-// }else{
|
|
|
171
|
-// var _index = $.inArray(g.rows[$(this).attr("data-index")]['id'], _batchIds);
|
|
|
172
|
-// if(_index != -1 ){
|
|
|
173
|
-// _batchIds.splice(_index,1);
|
|
|
174
|
-// }
|
|
|
175
|
-// }
|
|
|
176
|
-// }
|
|
|
177
|
-// /********************************************/
|
164
|
+ /************业务控制 特殊情况****************/
|
|
|
165
|
+ if(_batchIds){
|
|
|
166
|
+ if($(this).prop("checked")){
|
|
|
167
|
+ if($.inArray(g.rows[$(this).attr("data-index")]['id'], _batchIds) == -1 ){
|
|
|
168
|
+ _batchIds.push(g.rows[$(this).attr("data-index")]['id']);
|
|
|
169
|
+ }
|
|
|
170
|
+ }else{
|
|
|
171
|
+ var _index = $.inArray(g.rows[$(this).attr("data-index")]['id'], _batchIds);
|
|
|
172
|
+ if(_index != -1 ){
|
|
|
173
|
+ _batchIds.splice(_index,1);
|
|
|
174
|
+ }
|
|
|
175
|
+ }
|
|
|
176
|
+ }
|
|
|
177
|
+ /********************************************/
|
178
|
|
178
|
|
179
|
-// $(".promotion_checkbox").each(function() {
|
|
|
180
|
-// var checked = $(this).prop("checked");
|
|
|
181
|
-// var index = $(this).data("index");
|
|
|
182
|
-// if (checked) {
|
|
|
183
|
-// g.selected.push(g.rows[index]);
|
|
|
184
|
-// } else {
|
|
|
185
|
-// selected = false;
|
|
|
186
|
-// }
|
|
|
187
|
-// });
|
|
|
188
|
-// $(".all").prop("checked", selected);
|
|
|
189
|
-// });
|
179
|
+ $(".promotion_checkbox").each(function() {
|
|
|
180
|
+ var checked = $(this).prop("checked");
|
|
|
181
|
+ var index = $(this).data("index");
|
|
|
182
|
+ if (checked) {
|
|
|
183
|
+ g.selected.push(g.rows[index]);
|
|
|
184
|
+ } else {
|
|
|
185
|
+ selected = false;
|
|
|
186
|
+ }
|
|
|
187
|
+ });
|
|
|
188
|
+ $(".all").prop("checked", selected);
|
|
|
189
|
+ });
|
190
|
|
190
|
|
191
|
-// $(g.grid).on("change",".t_size",function(){
|
|
|
192
|
-// p.size=$(this).val();
|
|
|
193
|
-// g.reload(1);
|
|
|
194
|
-// })
|
|
|
195
|
-// }
|
|
|
196
|
-// }
|
|
|
197
|
-
|
|
|
198
|
-var rejectPromotions = {};
|
191
|
+ $(g.grid).on("change",".t_size",function(){
|
|
|
192
|
+ p.size=$(this).val();
|
|
|
193
|
+ g.reload(1);
|
|
|
194
|
+ })
|
|
|
195
|
+ }
|
|
|
196
|
+ }
|
199
|
|
197
|
|
200
|
module.exports = rejectPromotions; |
198
|
module.exports = rejectPromotions; |