|
@@ -5,37 +5,66 @@ |
|
@@ -5,37 +5,66 @@ |
5
|
|
5
|
|
6
|
|
6
|
|
7
|
var $ = require('jquery'),
|
7
|
var $ = require('jquery'),
|
8
|
- common=require('../common/common');
|
8
|
+ common = require('../common/common');
|
9
|
|
9
|
|
10
|
var baseNum = 1;
|
10
|
var baseNum = 1;
|
11
|
|
11
|
|
12
|
-var ENUM={
|
|
|
13
|
- status:{0:'待审核',1:'审核通过',2:'驳回',3:'过期',4:'作废'},//全部
|
|
|
14
|
- tips:{"salenum":0,"notsalenum":0,"hotnum":0,"nothotnum":0,"all":0}
|
12
|
+var ENUM = {
|
|
|
13
|
+ status: {
|
|
|
14
|
+ 0: '待审核',
|
|
|
15
|
+ 1: '审核通过',
|
|
|
16
|
+ 2: '驳回',
|
|
|
17
|
+ 3: '过期',
|
|
|
18
|
+ 4: '作废'
|
|
|
19
|
+ }, //全部
|
|
|
20
|
+ tips: {
|
|
|
21
|
+ "salenum": 0,
|
|
|
22
|
+ "notsalenum": 0,
|
|
|
23
|
+ "hotnum": 0,
|
|
|
24
|
+ "nothotnum": 0,
|
|
|
25
|
+ "all": 0
|
|
|
26
|
+ }
|
15
|
}
|
27
|
}
|
16
|
var t = new common.tab({
|
28
|
var t = new common.tab({
|
17
|
- el:"#basicTab",
|
|
|
18
|
- click:function(){
|
29
|
+ el: "#basicTab",
|
|
|
30
|
+ click: function() {
|
19
|
tableGird.reload();
|
31
|
tableGird.reload();
|
20
|
},
|
32
|
},
|
21
|
- columns:[
|
|
|
22
|
- {name:"salenum", key: "saleFlag", value: "1", display:"已发售({salenum})"},
|
|
|
23
|
- {name:"notsalenum", key: "saleFlag", value: "0", display:"未发售({notsalenum})"},
|
|
|
24
|
- {name:"hotnum", key: "hotFlag", value: "1", display:"热门({hotnum})"},
|
|
|
25
|
- {name:"nothotnum", key: "hotFlag", value: "0", display:"非热门({nothotnum})"},
|
|
|
26
|
- {name:"all",display:"全部({all})"}
|
|
|
27
|
- ]
|
33
|
+ columns: [{
|
|
|
34
|
+ name: "salenum",
|
|
|
35
|
+ key: "saleFlag",
|
|
|
36
|
+ value: "1",
|
|
|
37
|
+ display: "已发售({salenum})"
|
|
|
38
|
+ }, {
|
|
|
39
|
+ name: "notsalenum",
|
|
|
40
|
+ key: "saleFlag",
|
|
|
41
|
+ value: "0",
|
|
|
42
|
+ display: "未发售({notsalenum})"
|
|
|
43
|
+ }, {
|
|
|
44
|
+ name: "hotnum",
|
|
|
45
|
+ key: "hotFlag",
|
|
|
46
|
+ value: "1",
|
|
|
47
|
+ display: "热门({hotnum})"
|
|
|
48
|
+ }, {
|
|
|
49
|
+ name: "nothotnum",
|
|
|
50
|
+ key: "hotFlag",
|
|
|
51
|
+ value: "0",
|
|
|
52
|
+ display: "非热门({nothotnum})"
|
|
|
53
|
+ }, {
|
|
|
54
|
+ name: "all",
|
|
|
55
|
+ display: "全部({all})"
|
|
|
56
|
+ }]
|
28
|
}).init(ENUM.tips);
|
57
|
}).init(ENUM.tips);
|
29
|
|
58
|
|
30
|
|
59
|
|
31
|
|
60
|
|
32
|
var tableGird = new common.grid({
|
61
|
var tableGird = new common.grid({
|
33
|
|
62
|
|
34
|
- el:"#limit-table-box",
|
|
|
35
|
- parms:function(){
|
63
|
+ el: "#limit-table-box",
|
|
|
64
|
+ parms: function() {
|
36
|
var obj = {
|
65
|
var obj = {
|
37
|
- productName:common.util.__input("product-name"),
|
|
|
38
|
- productSkn:common.util.__input("skn"),
|
66
|
+ productName: common.util.__input("product-name"),
|
|
|
67
|
+ productSkn: common.util.__input("skn"),
|
39
|
hotFlag: $('input[name="hotFlag"]:checked').val(),
|
68
|
hotFlag: $('input[name="hotFlag"]:checked').val(),
|
40
|
saleFlag: $('input[name="saleFlag"]:checked').val(),
|
69
|
saleFlag: $('input[name="saleFlag"]:checked').val(),
|
41
|
showFlag: $('input[name="showFlag"]:checked').val()
|
70
|
showFlag: $('input[name="showFlag"]:checked').val()
|
|
@@ -43,129 +72,127 @@ var tableGird = new common.grid({ |
|
@@ -43,129 +72,127 @@ var tableGird = new common.grid({ |
43
|
if (t.key) {
|
72
|
if (t.key) {
|
44
|
obj[t.key] = t.value;
|
73
|
obj[t.key] = t.value;
|
45
|
}
|
74
|
}
|
46
|
-
|
75
|
+
|
47
|
return obj;
|
76
|
return obj;
|
48
|
},
|
77
|
},
|
49
|
- columns:[
|
|
|
50
|
- {
|
|
|
51
|
- display: "名称",
|
|
|
52
|
- name: "productName"
|
|
|
53
|
- }, {
|
|
|
54
|
- display: "热门排序",
|
|
|
55
|
- name: "hotSort",
|
|
|
56
|
- render: function (item) {
|
|
|
57
|
- if (item.hotFlag) {
|
|
|
58
|
- return ('<input class="order-input width50" data-id="' + item.id + '" data-type="orderBy" type="text" value="'+ item.orderBy +'"/>');
|
|
|
59
|
- } else {
|
|
|
60
|
- return '-';
|
|
|
61
|
- }
|
78
|
+ columns: [{
|
|
|
79
|
+ display: "名称",
|
|
|
80
|
+ name: "productName"
|
|
|
81
|
+ }, {
|
|
|
82
|
+ display: "热门排序",
|
|
|
83
|
+ name: "hotSort",
|
|
|
84
|
+ render: function(item) {
|
|
|
85
|
+ if (item.hotFlag) {
|
|
|
86
|
+ return ('<input class="order-input width50" data-id="' + item.id + '" data-type="orderBy" type="text" value="' + item.orderBy + '"/>');
|
|
|
87
|
+ } else {
|
|
|
88
|
+ return '-';
|
62
|
}
|
89
|
}
|
63
|
- }, {
|
|
|
64
|
- display: "未发售排序",
|
|
|
65
|
- name:"notSaleSort",
|
|
|
66
|
- render: function (item) {
|
|
|
67
|
- if (item.saleFlag == 1) {
|
|
|
68
|
- return '-';
|
|
|
69
|
- } else {
|
|
|
70
|
- return ('<input class="order-input width50" data-id="' + item.id + '" data-type="notSaleOrderBy" type="text" value="'+ item.notSaleOrderBy +'"/>');
|
|
|
71
|
- }
|
90
|
+ }
|
|
|
91
|
+ }, {
|
|
|
92
|
+ display: "未发售排序",
|
|
|
93
|
+ name: "notSaleSort",
|
|
|
94
|
+ render: function(item) {
|
|
|
95
|
+ if (item.saleFlag == 1) {
|
|
|
96
|
+ return '-';
|
|
|
97
|
+ } else {
|
|
|
98
|
+ return ('<input class="order-input width50" data-id="' + item.id + '" data-type="notSaleOrderBy" type="text" value="' + item.notSaleOrderBy + '"/>');
|
72
|
}
|
99
|
}
|
73
|
- }, {
|
|
|
74
|
- display: "封面图",
|
|
|
75
|
- render: function(item){
|
100
|
+ }
|
|
|
101
|
+ }, {
|
|
|
102
|
+ display: "封面图",
|
|
|
103
|
+ render: function(item) {
|
76
|
|
104
|
|
77
|
- return ('<img class="cover-img" src="'+item.attachUrl+'" />');
|
105
|
+ return ('<img class="cover-img" src="' + item.attachUrl + '" />');
|
|
|
106
|
+ }
|
|
|
107
|
+ }, {
|
|
|
108
|
+ display: "SKN",
|
|
|
109
|
+ name: "productSkn"
|
|
|
110
|
+ }, {
|
|
|
111
|
+ display: "发售日期",
|
|
|
112
|
+ name: "saleTime",
|
|
|
113
|
+ render: function(item) {
|
|
|
114
|
+ var date = new Date(item.saleTime * 1000),
|
|
|
115
|
+ showDate = date.getFullYear() + '-' + (date.getMonth() + 1);
|
|
|
116
|
+
|
|
|
117
|
+ if (item.dayFlag == 1) {
|
|
|
118
|
+ showDate += '-' + date.getDate();
|
78
|
}
|
119
|
}
|
79
|
- }, {
|
|
|
80
|
- display:"SKN",
|
|
|
81
|
- name:"productSkn"
|
|
|
82
|
- }, {
|
|
|
83
|
- display:"发售日期",
|
|
|
84
|
- name:"saleTime",
|
|
|
85
|
- render: function(item) {
|
|
|
86
|
- var date = new Date(item.saleTime * 1000),
|
|
|
87
|
- showDate = date.getFullYear() + '-' + (date.getMonth() + 1);
|
|
|
88
|
-
|
|
|
89
|
- if (item.dayFlag == 1) {
|
|
|
90
|
- showDate += '-' + date.getDate();
|
|
|
91
|
- }
|
|
|
92
|
- return showDate;
|
120
|
+ return showDate;
|
|
|
121
|
+ }
|
|
|
122
|
+ }, {
|
|
|
123
|
+ display: "是否发售",
|
|
|
124
|
+ name: "saleFlag",
|
|
|
125
|
+ render: function(item) {
|
|
|
126
|
+ if (item.saleFlag == 1) {
|
|
|
127
|
+ return '是';
|
|
|
128
|
+ } else {
|
|
|
129
|
+ return '否';
|
93
|
}
|
130
|
}
|
94
|
- }, {
|
|
|
95
|
- display:"是否发售",
|
|
|
96
|
- name:"saleFlag",
|
|
|
97
|
- render:function(item){
|
|
|
98
|
- if (item.saleFlag == 1) {
|
|
|
99
|
- return '是';
|
|
|
100
|
- } else {
|
|
|
101
|
- return '否';
|
|
|
102
|
- }
|
131
|
+ }
|
|
|
132
|
+ }, {
|
|
|
133
|
+ display: "是否热门",
|
|
|
134
|
+ name: "hotFlag",
|
|
|
135
|
+ render: function(items) {
|
|
|
136
|
+
|
|
|
137
|
+ if (items.hotFlag) {
|
|
|
138
|
+ return '是';
|
|
|
139
|
+ } else {
|
|
|
140
|
+ return '否';
|
103
|
}
|
141
|
}
|
104
|
- }, {
|
|
|
105
|
- display:"是否热门",
|
|
|
106
|
- name:"hotFlag",
|
|
|
107
|
- render:function(items){
|
|
|
108
|
-
|
|
|
109
|
- if (items.hotFlag) {
|
|
|
110
|
- return '是';
|
|
|
111
|
- } else {
|
|
|
112
|
- return '否';
|
|
|
113
|
- }
|
142
|
+ }
|
|
|
143
|
+ }, {
|
|
|
144
|
+ display: "是否开启",
|
|
|
145
|
+ name: "showFlag",
|
|
|
146
|
+ render: function(items) {
|
|
|
147
|
+ if (items.showFlag) {
|
|
|
148
|
+ return '是';
|
|
|
149
|
+
|
|
|
150
|
+ } else {
|
|
|
151
|
+ return '否';
|
114
|
}
|
152
|
}
|
115
|
- }, {
|
|
|
116
|
- display:"是否开启",
|
|
|
117
|
- name:"showFlag",
|
|
|
118
|
- render:function(items){
|
|
|
119
|
- if (items.showFlag) {
|
|
|
120
|
- return '是';
|
|
|
121
|
-
|
|
|
122
|
- } else {
|
|
|
123
|
- return '否';
|
|
|
124
|
- }
|
153
|
+ }
|
|
|
154
|
+ }, {
|
|
|
155
|
+ display: "操作",
|
|
|
156
|
+ render: function(items) {
|
|
|
157
|
+ var HtmArr = [];
|
|
|
158
|
+ if (items.showFlag) {
|
|
|
159
|
+ HtmArr.push('<a href="javascript:;" data-id="' + items.id + '" class="btn btn-info btn-xs close-btn">关闭</a>');
|
|
|
160
|
+ } else {
|
|
|
161
|
+ HtmArr.push('<a href="javascript:;" data-id="' + items.id + '" class="btn btn-info btn-xs open-btn">开启</a>');
|
125
|
}
|
162
|
}
|
126
|
- }, {
|
|
|
127
|
- display:"操作",
|
|
|
128
|
- render:function(items){
|
|
|
129
|
- var HtmArr=[];
|
|
|
130
|
- if (items.showFlag) {
|
|
|
131
|
- HtmArr.push('<a href="javascript:;" data-id="' + items.id + '" class="btn btn-info btn-xs close-btn">关闭</a>');
|
|
|
132
|
- } else {
|
|
|
133
|
- HtmArr.push('<a href="javascript:;" data-id="' + items.id + '" class="btn btn-info btn-xs open-btn">开启</a>');
|
|
|
134
|
- }
|
|
|
135
|
-
|
|
|
136
|
- if (items.hotFlag) {
|
|
|
137
|
- HtmArr.push('<a href="javascript:;" data-id="' + items.id + '" class="btn btn-warning btn-xs hot-cancel">取消热门</a>');
|
|
|
138
|
- } else {
|
|
|
139
|
- HtmArr.push('<a href="javascript:;" data-id="' + items.id + '" class="btn btn-warning btn-xs hot-btn">设为热门</a>');
|
|
|
140
|
- }
|
|
|
141
|
- HtmArr.push('<a href="/limit/edit/' + items.id + '" data-id="' + items.id + '" class="btn btn-info btn-xs">编辑</a>');
|
|
|
142
|
- HtmArr.push('<a href="javascript:;" data-id="' + items.id + '" class="btn btn-danger btn-xs delete-btn">删除</a>');
|
|
|
143
|
- return HtmArr.join('');
|
163
|
+
|
|
|
164
|
+ if (items.hotFlag) {
|
|
|
165
|
+ HtmArr.push('<a href="javascript:;" data-id="' + items.id + '" class="btn btn-warning btn-xs hot-cancel">取消热门</a>');
|
|
|
166
|
+ } else {
|
|
|
167
|
+ HtmArr.push('<a href="javascript:;" data-id="' + items.id + '" class="btn btn-warning btn-xs hot-btn">设为热门</a>');
|
144
|
}
|
168
|
}
|
|
|
169
|
+ HtmArr.push('<a href="/limit/edit/' + items.id + '" data-id="' + items.id + '" class="btn btn-info btn-xs">编辑</a>');
|
|
|
170
|
+ HtmArr.push('<a href="javascript:;" data-id="' + items.id + '" class="btn btn-danger btn-xs delete-btn">删除</a>');
|
|
|
171
|
+ return HtmArr.join('');
|
145
|
}
|
172
|
}
|
146
|
- ]
|
173
|
+ }]
|
147
|
});
|
174
|
});
|
148
|
|
175
|
|
149
|
tableGird.init('/limit/product/page');
|
176
|
tableGird.init('/limit/product/page');
|
150
|
|
177
|
|
151
|
-var loadtab=function(){
|
|
|
152
|
- t.active=undefined;
|
|
|
153
|
- setTimeout(function(){
|
178
|
+var loadtab = function() {
|
|
|
179
|
+ t.active = undefined;
|
|
|
180
|
+ setTimeout(function() {
|
154
|
common.util.__ajax({
|
181
|
common.util.__ajax({
|
155
|
- url:'/limit/ajax/getCodeCount',
|
|
|
156
|
- data:tableGird.options.parms()
|
182
|
+ url: '/limit/ajax/getCodeCount',
|
|
|
183
|
+ data: tableGird.options.parms()
|
157
|
|
184
|
|
158
|
- },function(res){
|
|
|
159
|
- for(var key in res.data){
|
|
|
160
|
- ENUM.tips[key]=res.data[key];
|
185
|
+ }, function(res) {
|
|
|
186
|
+ for (var key in res.data) {
|
|
|
187
|
+ ENUM.tips[key] = res.data[key];
|
161
|
}
|
188
|
}
|
162
|
t.init(ENUM.tips);
|
189
|
t.init(ENUM.tips);
|
163
|
- },true);
|
|
|
164
|
- },400);
|
190
|
+ }, true);
|
|
|
191
|
+ }, 400);
|
165
|
}
|
192
|
}
|
166
|
|
193
|
|
167
|
loadtab();
|
194
|
loadtab();
|
168
|
-$("#filter-btn").click(function(){
|
195
|
+$("#filter-btn").click(function() {
|
169
|
loadtab();
|
196
|
loadtab();
|
170
|
tableGird.reload();
|
197
|
tableGird.reload();
|
171
|
});
|
198
|
});
|
|
@@ -176,12 +203,12 @@ $('#limit-table-box').on('click', '.open-btn', function() { |
|
@@ -176,12 +203,12 @@ $('#limit-table-box').on('click', '.open-btn', function() { |
176
|
var param = {
|
203
|
var param = {
|
177
|
id: $(this).data('id'),
|
204
|
id: $(this).data('id'),
|
178
|
showFlag: '1'
|
205
|
showFlag: '1'
|
179
|
- }
|
206
|
+ }
|
180
|
common.util.__ajax({
|
207
|
common.util.__ajax({
|
181
|
- url:'/limit/audit',
|
|
|
182
|
- data:param
|
208
|
+ url: '/limit/audit',
|
|
|
209
|
+ data: param
|
183
|
|
210
|
|
184
|
- },function(res){
|
211
|
+ }, function(res) {
|
185
|
tableGird.reload();
|
212
|
tableGird.reload();
|
186
|
});
|
213
|
});
|
187
|
});
|
214
|
});
|
|
@@ -191,12 +218,12 @@ $('#limit-table-box').on('click', '.close-btn', function() { |
|
@@ -191,12 +218,12 @@ $('#limit-table-box').on('click', '.close-btn', function() { |
191
|
var param = {
|
218
|
var param = {
|
192
|
id: $(this).data('id'),
|
219
|
id: $(this).data('id'),
|
193
|
showFlag: '0'
|
220
|
showFlag: '0'
|
194
|
- }
|
221
|
+ }
|
195
|
common.util.__ajax({
|
222
|
common.util.__ajax({
|
196
|
- url:'/limit/audit',
|
|
|
197
|
- data:param
|
223
|
+ url: '/limit/audit',
|
|
|
224
|
+ data: param
|
198
|
|
225
|
|
199
|
- },function(res){
|
226
|
+ }, function(res) {
|
200
|
tableGird.reload();
|
227
|
tableGird.reload();
|
201
|
});
|
228
|
});
|
202
|
});
|
229
|
});
|
|
@@ -206,12 +233,12 @@ $('#limit-table-box').on('click', '.hot-btn', function() { |
|
@@ -206,12 +233,12 @@ $('#limit-table-box').on('click', '.hot-btn', function() { |
206
|
var param = {
|
233
|
var param = {
|
207
|
id: $(this).data('id'),
|
234
|
id: $(this).data('id'),
|
208
|
hotFlag: 1
|
235
|
hotFlag: 1
|
209
|
- }
|
236
|
+ }
|
210
|
common.util.__ajax({
|
237
|
common.util.__ajax({
|
211
|
- url:'/limit/audit',
|
|
|
212
|
- data:param
|
238
|
+ url: '/limit/audit',
|
|
|
239
|
+ data: param
|
213
|
|
240
|
|
214
|
- },function(res){
|
241
|
+ }, function(res) {
|
215
|
tableGird.reload();
|
242
|
tableGird.reload();
|
216
|
});
|
243
|
});
|
217
|
});
|
244
|
});
|
|
@@ -221,12 +248,12 @@ $('#limit-table-box').on('click', '.hot-cancel', function() { |
|
@@ -221,12 +248,12 @@ $('#limit-table-box').on('click', '.hot-cancel', function() { |
221
|
var param = {
|
248
|
var param = {
|
222
|
id: $(this).data('id'),
|
249
|
id: $(this).data('id'),
|
223
|
hotFlag: 0
|
250
|
hotFlag: 0
|
224
|
- }
|
251
|
+ }
|
225
|
common.util.__ajax({
|
252
|
common.util.__ajax({
|
226
|
- url:'/limit/audit',
|
|
|
227
|
- data:param
|
253
|
+ url: '/limit/audit',
|
|
|
254
|
+ data: param
|
228
|
|
255
|
|
229
|
- },function(res){
|
256
|
+ }, function(res) {
|
230
|
tableGird.reload();
|
257
|
tableGird.reload();
|
231
|
});
|
258
|
});
|
232
|
});
|
259
|
});
|
|
@@ -234,21 +261,21 @@ $('#limit-table-box').on('click', '.hot-cancel', function() { |
|
@@ -234,21 +261,21 @@ $('#limit-table-box').on('click', '.hot-cancel', function() { |
234
|
//删除商品
|
261
|
//删除商品
|
235
|
$('#limit-table-box').on('click', '.delete-btn', function() {
|
262
|
$('#limit-table-box').on('click', '.delete-btn', function() {
|
236
|
var param = {
|
263
|
var param = {
|
237
|
- id: $(this).data('id')
|
|
|
238
|
- }
|
|
|
239
|
- /*common.util.__ajax({
|
|
|
240
|
- url:'/limit/delete',
|
|
|
241
|
- data:param
|
264
|
+ id: $(this).data('id')
|
|
|
265
|
+ }
|
|
|
266
|
+ /*common.util.__ajax({
|
|
|
267
|
+ url:'/limit/delete',
|
|
|
268
|
+ data:param
|
242
|
|
269
|
|
243
|
- },function(res){
|
|
|
244
|
- tableGird.reload();
|
|
|
245
|
- });*/
|
270
|
+ },function(res){
|
|
|
271
|
+ tableGird.reload();
|
|
|
272
|
+ });*/
|
246
|
|
273
|
|
247
|
- common.dialog.confirm("温馨提示","你确定要删除吗?",function(){
|
274
|
+ common.dialog.confirm("温馨提示", "你确定要删除吗?", function() {
|
248
|
common.util.__ajax({
|
275
|
common.util.__ajax({
|
249
|
- url:'/limit/delete',
|
276
|
+ url: '/limit/delete',
|
250
|
data: param
|
277
|
data: param
|
251
|
- }, function(){
|
278
|
+ }, function() {
|
252
|
tableGird.reload();
|
279
|
tableGird.reload();
|
253
|
});
|
280
|
});
|
254
|
});
|
281
|
});
|
|
@@ -262,14 +289,20 @@ $('#limit-table-box').on('change', '.order-input', function() { |
|
@@ -262,14 +289,20 @@ $('#limit-table-box').on('change', '.order-input', function() { |
262
|
id: goodsId
|
289
|
id: goodsId
|
263
|
};
|
290
|
};
|
264
|
|
291
|
|
265
|
- param[type] = $(this).val();
|
292
|
+ if ($(this).val() < 0) {
|
|
|
293
|
+ common.util.__tip('排序不能为负', 'warning');
|
|
|
294
|
+ return;
|
|
|
295
|
+ } else {
|
|
|
296
|
+ param[type] = $(this).val();
|
|
|
297
|
+ }
|
|
|
298
|
+
|
266
|
|
299
|
|
267
|
common.util.__ajax({
|
300
|
common.util.__ajax({
|
268
|
- url:'/limit/audit',
|
301
|
+ url: '/limit/audit',
|
269
|
data: param
|
302
|
data: param
|
270
|
- },function(res){
|
303
|
+ }, function(res) {
|
271
|
console.log(res);
|
304
|
console.log(res);
|
272
|
});
|
305
|
});
|
273
|
-});
|
|
|
274
|
-
|
|
|
275
|
- |
306
|
+}).on('keyup', '.order-input', function() {
|
|
|
307
|
+ $(this).val() = $(this).val().replace(/\D/gi, '')
|
|
|
308
|
+}); |