linwenxin 8 місяців тому
батько
коміт
097862913f
1 змінених файлів з 11 додано та 8 видалено
  1. 11 8
      src/views/mallManagement/goods/goods_add/index.vue

+ 11 - 8
src/views/mallManagement/goods/goods_add/index.vue

@@ -968,6 +968,8 @@ export default {
 
     // 点击 提交表单
     clickSubmitForm() {
+      // this.submitForm()
+      // return
       // 验证第一步
       this.$refs.step1Form.validate(valid => {
         if (valid) {
@@ -1010,14 +1012,15 @@ export default {
     // 提交表单
     submitForm() {
       this.formLoading = true
-
-      let images = []
-      for (let i = 0; i < this.step1Form.images.length; i++) {
-        let obj = {}
-        obj.id = this.step1Form.images[i].id
-        images.push(obj)
-      }
-
+      console.log(this.step1Form.images)
+      let images = this.step1Form.images.filter(item => item.url).map(item => ({ id: item.id, url: item.url }))
+      console.log(images)
+      // for (let i = 0; i < this.step1Form.images.length; i++) {
+      //   let obj = {}
+      //   obj.id = this.step1Form.images[i].id
+      //   images.push(obj)
+      // }
+      // return
       let categoryId = ''
       if (typeof this.step1Form.classify == 'string') {
         categoryId = this.step1Form.classify