|
@@ -205,15 +205,37 @@ |
|
@@ -205,15 +205,37 @@ |
205
|
|
205
|
|
206
|
this.productList(params);
|
206
|
this.productList(params);
|
207
|
},
|
207
|
},
|
208
|
- setOnSale(skns) {
|
208
|
+ setOnSale(rows) {
|
209
|
const params = {
|
209
|
const params = {
|
210
|
targetStatus: 1
|
210
|
targetStatus: 1
|
211
|
};
|
211
|
};
|
212
|
|
212
|
|
213
|
- if (_.isArray(skns)) {
|
|
|
214
|
- params.productSkns = `[${skns.join(',')}]`;
|
213
|
+ let inValid = [];
|
|
|
214
|
+ let sknArray = [];
|
|
|
215
|
+
|
|
|
216
|
+ if (_.isArray(rows)) {
|
|
|
217
|
+ _.each(rows, item => {
|
|
|
218
|
+ if (item.stock < 1) {
|
|
|
219
|
+ inValid.push(item.productSkn);
|
|
|
220
|
+ }
|
|
|
221
|
+ sknArray.push(item.productSkn);
|
|
|
222
|
+ });
|
|
|
223
|
+
|
|
|
224
|
+ if (inValid.length) {
|
|
|
225
|
+ const error = inValid.join(':库存为0不能上架;');
|
|
|
226
|
+
|
|
|
227
|
+ this.$Message.error(`${error}:库存为0不能上架;`, 5);
|
|
|
228
|
+ return;
|
|
|
229
|
+ }
|
|
|
230
|
+
|
|
|
231
|
+ params.productSkns = `[${sknArray.join(',')}]`;
|
215
|
} else {
|
232
|
} else {
|
216
|
- params.productSkns = `[${skns}]`;
|
233
|
+ if (rows.stock < 1) {
|
|
|
234
|
+ this.$Message.error('库存为0的商品不能上架');
|
|
|
235
|
+ return;
|
|
|
236
|
+ }
|
|
|
237
|
+
|
|
|
238
|
+ params.productSkns = `[${rows.productSkn}]`;
|
217
|
}
|
239
|
}
|
218
|
|
240
|
|
219
|
service.setOnSale(params)
|
241
|
service.setOnSale(params)
|
|
@@ -229,13 +251,7 @@ |
|
@@ -229,13 +251,7 @@ |
229
|
return;
|
251
|
return;
|
230
|
}
|
252
|
}
|
231
|
|
253
|
|
232
|
- let skns = [];
|
|
|
233
|
-
|
|
|
234
|
- _.each(this.batchOnSale, (item) => {
|
|
|
235
|
- skns.push(item.productSkn);
|
|
|
236
|
- });
|
|
|
237
|
-
|
|
|
238
|
- this.setOnSale(skns);
|
254
|
+ this.setOnSale(this.batchOnSale);
|
239
|
},
|
255
|
},
|
240
|
editPrice(row) {
|
256
|
editPrice(row) {
|
241
|
row.changePrice = true;
|
257
|
row.changePrice = true;
|