@@ -309,26 +309,33 @@ export default {
309
309
if (this .ratesForm .spec == 1 ) {
310
310
rates .forEach (r => {
311
311
let properties = []
312
- r .spec .forEach ((v , i ) => {
313
- let specValue = this .dynamicSpec [i].specValue .find (o => o .name == v);
314
- let propertie = {};
315
- propertie .propertyId = this .dynamicSpec [i].specId ;
316
- propertie .valueId = specValue .id ;
317
- properties .push (propertie);
318
- })
312
+ if (r .spec instanceof Array ){
313
+ r .spec .forEach ((v , i ) => {
314
+ let specValue = this .dynamicSpec [i].specValue .find (o => o .name == v);
315
+ let propertie = {};
316
+ propertie .propertyId = this .dynamicSpec [i].specId ;
317
+ propertie .valueId = specValue .id ;
318
+ properties .push (propertie);
319
+ })
320
+ }else {
321
+ let specValue = this .dynamicSpec [0 ].specValue .find (o => o .name == r .spec );
322
+ let propertie = {};
323
+ propertie .propertyId = this .dynamicSpec [0 ].specId ;
324
+ propertie .valueId = specValue .id ;
325
+ properties .push (propertie);
326
+ }
319
327
r .properties = properties;
320
328
})
321
329
}
322
330
this .baseForm .skus = rates;
323
331
this .baseForm .specType = this .ratesForm .spec ;
324
332
this .baseForm .categoryId = this .baseForm .categoryIds [this .baseForm .categoryIds .length - 1 ];
325
- console .log (this .baseForm )
326
333
createSpu (this .baseForm ).then ((response ) => {
334
+ console .log (response)
327
335
this .$modal .msgSuccess (" 新增成功" );
328
- this .open = false ;
329
- this .getList ();
330
336
this .$emit (" closeDialog" );
331
337
});
338
+
332
339
},
333
340
/** 查询规格 */
334
341
getPropertyPageList () {
0 commit comments