Forráskód Böngészése

修改供应商添加

喻文俊 3 éve
szülő
commit
19cfe61bd6
1 módosított fájl, 192 hozzáadás és 376 törlés
  1. 192 376
      src/views/admin/supplier/edit.vue

+ 192 - 376
src/views/admin/supplier/edit.vue

@@ -1,9 +1,9 @@
 <template>
   <div v-loading="isLoading" class="addSupplier">
-    <el-form ref="formData1Ref" :model="formData1" :rules="formDataRules" label-width="120px" class="addForm">
+    <el-form ref="submitFormRef" :model="submitForm" :rules="formDataRules" label-width="120px" class="addForm">
       <el-form-item label="供应商类型:" prop="shopType">
         <el-select
-          v-model="formData1.shopType"
+          v-model="submitForm.shopType"
           placeholder="请选择供应商类型"
           style="width: 100%"
           @change="handleTypeChange"
@@ -14,13 +14,13 @@
       </el-form-item>
 
       <!-- 供应商名称 -->
-      <el-form-item v-if="formData1.shopType === 2" label="供应商名称:" prop="shopName">
-        <el-input v-model="formData1.shopName" placeholder="请输入供应商名称" maxlength="50" show-word-limit />
+      <el-form-item v-if="submitForm.shopType === 2" label="供应商名称:" prop="shopName">
+        <el-input v-model="submitForm.shopName" placeholder="请输入供应商名称" maxlength="50" show-word-limit />
       </el-form-item>
 
-      <el-form-item v-if="formData1.shopType === 1" clearable label="供应商名称:" prop="brandId">
+      <el-form-item v-if="submitForm.shopType === 1" clearable label="供应商名称:" prop="brandId">
         <el-select
-          v-model="formData1.brandId"
+          v-model="submitForm.brandId"
           placeholder="请选择品牌"
           style="width: 100%"
           filterable
@@ -32,39 +32,38 @@
       <!-- 供应商名称END -->
 
       <el-form-item label="手机号:" prop="mobile">
-        <el-input v-model="formData1.mobile" placeholder="请输入手机号" maxlength="11" show-word-limit @input="handleInput" />
+        <el-input v-model="submitForm.mobile" placeholder="请输入手机号" maxlength="11" show-word-limit @input="handleMobileInput" />
       </el-form-item>
 
       <el-form-item label="联系人:" prop="linkMan">
-        <el-input v-model="formData1.linkMan" placeholder="请输入联系人" />
+        <el-input v-model="submitForm.linkMan" placeholder="请输入联系人" />
       </el-form-item>
 
       <!-- 代理商logo -->
       <transition name="fade">
-        <el-form-item v-if="formData1.shopType === 2" label="代理商logo:" prop="logo">
-          <el-input v-show="false" v-model="formData1.logo" />
-          <upload-image-t
+        <el-form-item v-if="submitForm.shopType === 2" label="代理商logo:" prop="logo">
+          <el-input v-show="false" v-model="submitForm.logo" />
+          <upload-image
+            :limit="1"
             tip="建议尺寸:200px * 200px"
             :image-list="logoList"
-            :before-upload="beforeLogoImageUpload"
             @success="uploadLogoImageSuccess"
             @remove="handleLogoImageRemove"
           />
         </el-form-item>
       </transition>
       <transition name="fade">
-        <el-form-item v-if="formData1.shopType === 2" label="代理品牌:" prop="shopInfo" class="brand-list">
+        <el-form-item v-if="submitForm.shopType === 2" label="代理品牌:" prop="shopInfo" class="brand-list">
           <template v-if="supplierBrands !== []">
             <el-tag v-for="(brand , index) in supplierBrands" :key="index" closable type="success" @close="handleRemove(index)" @click="handleShowInfo(index)">{{ brand.brandName }}</el-tag>
           </template>
           <el-tag type="primary" @click="handleShowDialog">添加品牌<span class="el-icon-plus" /></el-tag>
-          <!-- <el-input v-model="formData1.shopInfo" class="hiddenInput" /> -->
         </el-form-item>
       </transition>
 
-      <template v-if="formData1.shopType === 1">
+      <template v-if="submitForm.shopType === 1">
         <el-form-item label="产地:" prop="countryId">
-          <el-select v-model="formData1.countryId" placeholder="产地" style="width: 100%" filterable>
+          <el-select v-model="submitForm.countryId" placeholder="产地" style="width: 100%" filterable>
             <el-option
               v-for="item in countryList"
               :key="item.countryId"
@@ -76,47 +75,44 @@
 
         <el-form-item label="品牌logo:" class="no-input" prop="brandAuthLogo">
           <upload-image
-            ref="uploadImageRef1"
-            :file-list="fileList1"
-            @success="imageUploadSuccess1"
-            @error="imageUploadFaild1"
-            @remove="imageRemove1"
+            tip="建议尺寸:200px * 200px"
+            :image-list="brandAuthLogoList"
+            @success="uploadBrandAuthSuccess"
+            @remove="handleRemoveBrandAuthLogo"
           />
-          <el-input v-model="formData1.brandAuthLogo" type="hidden" class="hiddenInput" />
+          <el-input v-show="false" v-model="submitForm.brandAuthLogo" />
         </el-form-item>
 
         <el-form-item label="官网认证链接:">
-          <el-input v-model="formData1.securityLink" placeholder="请输入官网认证链接" />
+          <el-input v-model="submitForm.securityLink" placeholder="请输入官网认证链接" />
         </el-form-item>
       </template>
 
       <!-- 公众号信息 -->
       <el-form-item label="微信公众号:">
-        <el-select v-model="formData1.wxAccountType" placeholder="请选择微信公众号类型" style="width: 100%">
+        <el-select v-model="submitForm.wxAccountType" placeholder="请选择微信公众号类型" style="width: 100%">
           <el-option label="服务号" :value="2" />
           <el-option label="订阅号" :value="1" />
         </el-select>
       </el-form-item>
       <el-form-item label="appID:">
-        <el-input v-model="formData1.appId" placeholder="微信公众号appID,没有就不填" />
+        <el-input v-model="submitForm.appId" placeholder="微信公众号appID,没有就不填" />
       </el-form-item>
       <el-form-item label="appSecret:">
-        <el-input v-model="formData1.appSecret" placeholder="微信公众号appsecret,没有就不填" />
+        <el-input v-model="submitForm.appSecret" placeholder="微信公众号appsecret,没有就不填" />
       </el-form-item>
       <el-form-item label="公众号二维码:" prop="qrCodeImage">
         <upload-image
-          ref="uploadImageRef1"
-          :file-list="ewmUrl"
-          tip-title="128px*128px"
-          @success="wxImageUploadSuccess"
-          @error="wxImageUploadFaild"
-          @remove="wxImageUploadRemove"
+          tip="建议尺寸:200px * 200px"
+          :image-list="qrCodeImageList"
+          @success="uploadQrCodeImageSuccess"
+          @remove="handleRemoveQrCodeImage"
         />
-        <el-input v-model="formData1.qrCodeImage" type="hidden" class="hiddenInput" />
+        <el-input v-show="false" v-model="submitForm.qrCodeImage" />
       </el-form-item>
       <!-- 公众号信息END -->
       <el-form-item label="供应商状态:">
-        <el-select v-model="formData1.shopStatus" placeholder="请选择供应商状态" style="width: 100%">
+        <el-select v-model="submitForm.shopStatus" placeholder="请选择供应商状态" style="width: 100%">
           <el-option label="启用" :value="1" />
           <el-option label="禁用" :value="0" />
         </el-select>
@@ -128,23 +124,23 @@
     </div>
 
     <!-- 供应商添加品牌的对话框 -->
-    <el-dialog :title="dialogTitleText" :visible.sync="showDialog" width="width" @closed="dialogClosed">
-      <el-form ref="formData2Ref" :model="formData2" label-width="120px" :rules="formDataRules">
+    <el-dialog title="添加供应商品牌" :visible.sync="dialogAddBrand" width="width" @closed="handleDialogAddBrandClosed">
+      <el-form ref="subFormRef" :model="subForm" label-width="120px" :rules="formDataRules">
 
         <el-form-item label="选择品牌:" prop="brandId">
           <el-select
-            v-model="formData2.brandId"
+            v-model="subForm.brandId"
             placeholder="请选择品牌"
             style="width: 100%"
             filterable
             @change="handleBrandChange"
           >
-            <el-option v-for="item in brandListCopy" :key="item.id" :label="item.name" :value="item.id" />
+            <el-option v-for="item in brandList" :key="item.id" :label="item.name" :value="item.id" />
           </el-select>
         </el-form-item>
 
         <el-form-item label="产地:" prop="countryId">
-          <el-select v-model="formData2.countryId" placeholder="产地" style="width: 100%" filterable>
+          <el-select v-model="subForm.countryId" placeholder="产地" style="width: 100%" filterable>
             <el-option
               v-for="item in countryList"
               :key="item.countryId"
@@ -156,17 +152,16 @@
 
         <el-form-item label="品牌logo:" class="no-input" prop="brandAuthLogo">
           <upload-image
-            ref="uploadImageRef2"
-            :file-list="fileList2"
-            @success="imageUploadSuccess2"
-            @error="imageUploadFaild2"
-            @remove="imageRemove2"
+            tip="建议尺寸:200px * 200px"
+            :image-list="brandAuthLogoList"
+            @success="uploadBrandAuthSuccess"
+            @remove="handleRemoveBrandAuthLogo"
           />
-          <el-input v-model="formData2.brandAuthLogo" type="hidden" class="hiddenInput" />
+          <el-input v-show="false" v-model="subForm.brandAuthLogo" />
         </el-form-item>
 
         <el-form-item label="代理声明:">
-          <el-radio-group v-model="formData2.statementType" @change="handleStatementChange">
+          <el-radio-group v-model="subForm.statementType" @change="handleStatementChange">
             <el-radio :label="1">弹窗</el-radio>
             <el-radio :label="2">链接</el-radio>
             <el-radio :label="3">图片</el-radio>
@@ -174,60 +169,58 @@
           </el-radio-group>
         </el-form-item>
 
-        <el-form-item v-if="formData2.statementType === 1" ref="statement1" label="弹窗:" prop="statementContent">
+        <el-form-item v-if="subForm.statementType === 1" ref="statement1" label="弹窗:" prop="statementContent">
           <el-input
-            v-if="formData2.statementType === 1"
-            v-model="formData2.statementContent"
+            v-if="subForm.statementType === 1"
+            v-model="subForm.statementContent"
             type="textarea"
           />
         </el-form-item>
 
-        <el-form-item v-else-if="formData2.statementType === 2" ref="statement2" label="链接:" prop="statementLink">
-          <el-input v-if="formData2.statementType === 2" v-model="formData2.statementLink" />
+        <el-form-item v-else-if="subForm.statementType === 2" ref="statement2" label="链接:" prop="statementLink">
+          <el-input v-if="subForm.statementType === 2" v-model="subForm.statementLink" />
         </el-form-item>
 
         <el-form-item
-          v-else-if="formData2.statementType === 3"
+          v-else-if="subForm.statementType === 3"
           ref="statement3"
           label="图片:"
           class="no-input"
           prop="statementImage"
         >
           <upload-image
-            v-if="formData2.statementType === 3"
-            ref="uploadImageRef3"
-            :file-list="fileList3"
-            tip-title="宽:760px"
-            @success="imageUploadSuccess3"
-            @error="imageUploadFaild3"
-            @remove="imageRemove3"
+            v-if="subForm.statementType === 3"
+            tip="建议尺寸:200px * 200px"
+            :image-list="statementImageList"
+            @success="uploadStatementImageSuccess"
+            @remove="handleRemoveStatementImage"
           />
-          <el-input v-model="formData2.statementImage" type="hidden" class="hiddenInput" />
+          <el-input v-show="false" v-model="subForm.statementImage" />
         </el-form-item>
 
         <el-form-item v-else ref="statementFileRef" label="文件:" prop="statementFileId">
           <upload-file
-            v-if="formData2.statementType === 4"
+            v-if="subForm.statementType === 4"
             ref="uploadFileRef"
-            :auth-user-id="formData2.authUserId"
-            :brand-id="formData2.brandId"
+            :auth-user-id="subForm.authUserId"
+            :brand-id="subForm.brandId"
             :file-list="fileList4"
             @success="fileUploadSuccess"
             @error="fileUploadFaild"
             @remove="fileRemove"
             @change="fileChange"
           />
-          <el-input v-model="formData2.statementFileId" type="hidden" class="hiddenInput" />
+          <el-input v-show="false" v-model="subForm.statementFileId" />
         </el-form-item>
 
         <el-form-item label="官网认证链接:">
-          <el-input v-model="formData2.securityLink" placeholder="请输入官网认证链接" />
+          <el-input v-model="subForm.securityLink" placeholder="请输入官网认证链接" />
         </el-form-item>
 
       </el-form>
 
       <div slot="footer">
-        <el-button @click="showDialog = false">取 消</el-button>
+        <el-button @click="dialogAddBrand = false">取 消</el-button>
         <el-button type="primary" :loading="dialogLoading" @click="handleAddBrand">确 定</el-button>
       </div>
     </el-dialog>
@@ -236,16 +229,15 @@
 </template>
 
 <script>
-import UploadImage from '@/views/components/uploadImage'
 import UploadFile from '@/views/components/uploadFile'
-import UploadImageT from '@/components/UploadImage'
+import UploadImage from '@/components/UploadImage'
 import { mapGetters } from 'vuex'
 import { isMobile } from '@/utils/validate'
 import { fetchBrandList } from '@/api/brand'
-import { addSupplier } from '@/api/supplier'
+// import { addSupplier } from '@/api/supplier'
 
 export default {
-  components: { UploadImage, UploadFile, UploadImageT },
+  components: { UploadImage, UploadFile },
   data() {
     const validMobile = (rule, value, callback) => {
       if (!isMobile(value)) {
@@ -254,17 +246,16 @@ export default {
       return callback()
     }
     return {
-      isCheckout: true,
       isLoading: false,
       dialogLoading: false,
-      showDialog: false,
+      dialogAddBrand: false,
       excludeBrandList: [], // 已经选择的品牌,需要被排除在外的
-      selectedShopType: 1,
+      selectedShopType: 1, // 当前选中的供应商类型
       currentIndex: '',
       prevBrandId: '',
       dialogTitle: '添加',
       // 表单1
-      formData1: {
+      submitForm: {
         shopType: 1, // 供应商类型
         shopName: '', // 供应商名称
         brandId: '', // 品牌id
@@ -282,7 +273,7 @@ export default {
         logo: '' // 代理商logo
       },
       // 表单2
-      formData2: {
+      subForm: {
         index: '',
         isNew: true,
         brandName: '',
@@ -314,250 +305,188 @@ export default {
         statementImage: { required: true, message: '声明图片不能为空', tigger: 'change' }, // 声明图片
         statementLink: { required: true, message: '声明链接不能为空', tigger: 'change' }, // 声明链接,
         logo: { required: true, message: '代理商logo不能为空', tigger: 'change' }
-        // ewmUrl: { required: true, message: '微信公众号二维码不能为空', tigger: 'change' }
       },
-      // 上传的文件列表
-      fileList1: [],
-      fileList2: [],
-      fileList3: [],
-      fileList4: [], // 文件
+
+      // 上传图片列表
       logoList: [],
-      ewmUrl: []
+      brandAuthLogoList: [],
+      qrCodeImageList: [],
+      // brandAuthLogoList:[],
+      statementImageList: [],
+      // 上传的文件列表
+      fileList4: [] // 文件
     }
   },
   computed: {
-    ...mapGetters(['countryList', 'authUserId']),
-    brandListCopy() {
-      return this.brandList.filter(item => {
-        return !this.excludeBrandList.includes(item.id)
-      })
-    },
-    dialogTitleText() {
-      return `${this.dialogTitle}代理品牌`
-    }
+    ...mapGetters(['countryList', 'authUserId'])
   },
   watch: {
-    supplierBrands() {
-      if (this.supplierBrands.length > 0) {
-        this.formData1.shopInfo = '1'
-      } else {
-        this.formData1.shopInfo = ''
-      }
-    }
+
   },
   created() {
-    this.getBrandList(1)
+    this.getBrandList(this.selectedShopType)
   },
   methods: {
     // 提交保存
     submit() {
-      this.$refs.formData1Ref.validate(valid => {
-        if (!valid) return
-        this.isLoading = true
-        addSupplier(this.setAddParams()).then(res => {
-          if (res.code !== 0) {
-            return
-          }
-          const h = this.$createElement
-          this.$notify.success({
-            title: '添加供应商',
-            message: h('i', { style: 'color: #333' }, `已添加供应商:"${this.formData1.shopName}"`),
-            duration: 3000
-          })
-          this.$store.dispatch('tagsView/delView', this.$route)
-          this.$router.push('/supplier')
-        }).finally(() => {
-          this.isLoading = false
-        })
-      })
+      let params = {}
+      if (this.selectedShopType === 1) {
+        params = this.getBrandParams()
+      } else {
+        params = this.getShopParams()
+      }
+      console.log(params)
     },
-    // 封装请求参数
-    setAddParams() {
-      // 品牌方的参数列表
-      const result = {
-        authUserId: '',
-        createBy: '',
-        linkMan: '',
-        mobile: '',
-        shopName: '',
-        shopStatus: '',
-        shopType: '',
-        shopInfo: [],
-        qrCodeImage: '',
+
+    /** 封装请求参数 */
+    // 代理商参数
+    getShopParams() {
+      const params = {
+        shopType: 2, // 供应商类型
+        shopName: '', // 供应商名称
+        logo: '', // 代理商logo
+        mobile: '', // 手机号
+        linkMan: '', // 联系人
+        securityLink: '', // 官网认证链接
+        shopStatus: 1, // 供应商状态,
+        wxAccountType: 2,
         appId: '',
         appSecret: '',
-        wxAccountType: ''
+        qrCodeImage: '' // 微信公众号二维码
       }
-      // 品牌方
-      if (this.selectedShopType === 1) {
-        for (const key in result) {
-          if (Object.hasOwnProperty.call(result, key)) {
-            if (key !== 'shopInfo') {
-              result[key] = this.formData1[key]
-            }
-          }
+      for (const key in params) {
+        if (Object.hasOwnProperty.call(this.submitForm, key)) {
+          params[key] = this.submitForm[key]
         }
-        result.shopInfo.push({
-          brandId: this.formData1.brandId,
-          countryId: this.formData1.countryId,
-          brandAuthLogo: this.formData1.brandAuthLogo,
-          securityLink: this.formData1.securityLink,
-          statementType: 1,
-          statementContent: '',
-          statementFileId: null,
-          statementImage: '',
-          statementLink: ''
-        })
       }
+      return params
+    },
 
-      // 代理商
-      if (this.selectedShopType === 2) {
-        for (const key in result) {
-          if (Object.hasOwnProperty.call(result, key)) {
-            if (key !== 'shopInfo') {
-              result[key] = this.formData1[key]
-            }
-          }
+    // 品牌方参数
+    getBrandParams() {
+      const params = {
+        shopType: 1, // 供应商类型
+        brandId: '', // 品牌id
+        mobile: '', // 手机号
+        linkMan: '', // 联系人
+        countryId: 1, // 产地id
+        brandAuthLogo: '', // 品牌logo
+        securityLink: '', // 官网认证链接
+        wxAccountType: 2,
+        appId: '',
+        appSecret: '',
+        qrCodeImage: '', // 微信公众号二维码
+        shopStatus: 1 // 供应商状态,
+      }
+      for (const key in params) {
+        if (Object.hasOwnProperty.call(this.submitForm, key)) {
+          params[key] = this.submitForm[key]
         }
-        result.shopInfo = this.supplierBrands
-        result.logo = this.formData1.logo
       }
-      result.createBy = this.authUserId
-      console.log(result)
-      return result
+      return params
     },
+    // 大理上添加
+    /** 封装请求参数 end */
 
-    // 获取品牌列表
-    getBrandList(type) {
-      fetchBrandList({ type }).then(res => {
-        if (res.code !== 0) {
-          return
-        }
-        this.brandList = res.data
-      })
-    },
     // 品牌改变事件
     handleBrandChange(id) {
-      const selectBrand = this.brandList.filter(item => item.id === id)[0]
-      // 选择品牌方
-      if (this.formData1.shopType === 1) {
-        this.fileList1 = []
-        this.formData1.shopName = selectBrand.name
-        this.formData1.brandAuthLogo = selectBrand.authLogo
-        this.formData1.brandId = selectBrand.id
-        if (selectBrand.authLogo) {
-          this.fileList1 = [{ name: selectBrand.name, url: selectBrand.authLogo }]
-        }
-      }
-      // 如果选择代理应商
-      if (this.formData1.shopType === 2) {
-        this.formData2.brandAuthLogo = selectBrand.authLogo
-        this.formData2.brandName = selectBrand.name
-        this.formData2.brandId = selectBrand.id
-        if (selectBrand.authLogo) {
-          this.fileList2 = [{ name: selectBrand.name, url: selectBrand.authLogo }]
-        }
-      }
+      const currentBrand = this.brandList.find(item => item.id === id)
+      this.brandAuthLogoList = [{ name: currentBrand.name, url: currentBrand.authLogo }]
+      this.submitForm.brandAuthLogo = currentBrand.authLogo
     },
     // 添加品牌对话框
     handleShowDialog() {
-      this.dialogTitle = '新增'
-      this.showDialog = true
-      this.resetFormData2()
+
     },
     // 添加品牌
     handleAddBrand() {
-      this.dialogLoading = true
-      // 如果声明类型为4,并且文件id为空或null,则需要先上传文件再保存
-      if (this.formData2.statementType === 4 && (this.formData2.statementFileId === '' || this.formData2.statementFileId === null)) {
-        this.$refs.uploadFileRef.$refs.upload.submit()
-      } else {
-        this.saveShopInfo()
-      }
+
     },
+    // 保存供应信息
     saveShopInfo() {
-      this.dialogLoading = false
-      this.$refs.formData2Ref.validate(valid => {
-        if (!valid) {
-          return
-        }
-        // 如果是新增的
-        const shopInfo = this.clone(this.formData2)
-        if (shopInfo.isNew) {
-          this.supplierBrands.push(shopInfo)
-        } else {
-        // 修改的
-          this.supplierBrands.splice(this.currentIndex, 1, shopInfo)
-        }
-        this.addExcludeBrand(shopInfo.brandId)
-        shopInfo.isNew = false
-        this.prevBrandId = ''
-        this.showDialog = false
-        const h = this.$createElement
-        this.$notify.success({
-          title: `${this.dialogTitle}品牌`,
-          message: h('i', { style: 'color: #333' }, `${this.dialogTitle}品牌:"${shopInfo.brandName}"`),
-          duration: 2000
-        })
-      })
+
     },
     // 移除品牌
     handleRemove(index) {
-      const pop = this.supplierBrands.splice(index, 1)[0]
-      this.removeExcludeBrand(pop.brandId)
-      const h = this.$createElement
-      this.$notify.success({
-        title: '移除品牌',
-        message: h('i', { style: 'color: #333' }, `已移除品牌:"${pop.brandName}"`),
-        duration: 2000
-      })
+
     },
     // 修改品牌
     handleShowInfo(index) {
-      this.dialogTitle = '修改'
-      this.currentIndex = index
-      this.formData2 = this.clone(this.supplierBrands[index])
-      this.prevBrandId = this.supplierBrands[index].brandId // 保存当前的品牌id
-      this.fileList2 = [{ name: '', url: this.formData2.brandAuthLogo }]
-      this.fileList3 = [{ name: '', url: this.formData2.statementImage }]
-      this.fileList4 = [{ name: this.formData2.statementFileName, url: '' }]
-      this.removeExcludeBrand(this.supplierBrands[index].brandId)
-      this.showDialog = true
+
     },
     // 添加品牌对话框关闭
-    dialogClosed() {
-      if (this.prevBrandId) {
-        this.addExcludeBrand(this.prevBrandId)
-        this.prevBrandId = ''
-      }
-      this.resetFormData2()
+    handleDialogAddBrandClosed() {
+
     },
     // 声明类型切换
     handleStatementChange() {},
     // 供应商类型改变事件
-    handleTypeChange(shopType) {
-      this.selectedShopType = shopType
-      this.getBrandList(shopType)
-      this.resetFormData1(shopType)
+    handleTypeChange(type) {
+      this.selectedShopType = type
     },
     // 添加排除品牌
     addExcludeBrand(id) {
-      this.excludeBrandList.push(id)
+
     },
     // 移除排除品牌
     removeExcludeBrand(id) {
-      const index = this.excludeBrandList.indexOf(id)
-      this.excludeBrandList.splice(index, 1)
+
+    },
+
+    // 获取品牌列表
+    getBrandList(type) {
+      fetchBrandList({ type }).then(res => {
+        if (res.code !== 0) {
+          return
+        }
+        this.brandList = res.data
+      })
     },
+
     // 输入框输入时
-    handleInput() {
-      this.formData1.mobile = this.formData1.mobile.replace(/[^\w\.\/]/ig, '')
+    handleMobileInput() {
+      this.submitForm.mobile = this.submitForm.mobile.replace(/[^\w\.\/]/ig, '')
+    },
+
+    /** 图片上传 */
+    // 代理商logo
+    uploadLogoImageSuccess({ response, file, fileList }) {
+      this.logoList = fileList
+      this.submitForm.logo = response.data
+    },
+    handleLogoImageRemove({ file, fileList }) {
+      this.logoList = fileList
+      this.submitForm.logo = ''
+    },
+
+    // 品牌logo
+    uploadBrandAuthSuccess({ response, file, fileList }) {
+      this.brandAuthLogoList = fileList
+      this.submitForm.brandAuthLogo = response.data
     },
+    handleRemoveBrandAuthLogo({ file, fileList }) {
+      this.brandAuthLogoList = fileList
+      this.submitForm.brandAuthLogo = ''
+    },
+
+    // 公众号二维码
+    uploadQrCodeImageSuccess({ response, file, fileList }) {
+      this.qrCodeImageList = fileList
+      this.submitForm.qrCodeImage = response.data
+    },
+    handleRemoveQrCodeImage({ file, fileList }) {
+      this.qrCodeImageList = fileList
+      this.submitForm.qrCodeImage = ''
+    },
+
+    // 声明图片
+    uploadStatementImageSuccess() {},
+    handleRemoveStatementImage() {},
 
-    // 文件上传成功
+    /** 文件上传成功 */
     fileUploadSuccess(data) {
-      this.formData2.statementFileName = data.data.fileName
-      this.formData2.statementFileId = data.data.fileId
+      this.subForm.statementFileName = data.data.fileName
+      this.subForm.statementFileId = data.data.fileId
       if (data.code === 0) {
         this.saveShopInfo()
       }
@@ -567,7 +496,7 @@ export default {
       console.log(err)
     },
     fileRemove() {
-      this.formData2.statementFileId = null
+      this.subForm.statementFileId = null
       console.log('删除文件')
     },
     fileChange() {
@@ -575,119 +504,6 @@ export default {
       this.$refs.statementFileRef.clearValidate()
     },
 
-    // 图片上传成功 品牌logo  1
-    imageUploadSuccess1(data) {
-      this.formData1.brandAuthLogo = data.data
-    },
-    imageUploadFaild1(err, file, fileList) {
-      this.$message.error('图片上传失败')
-      console.log(err)
-    },
-    imageRemove1() {
-      this.formData1.brandAuthLogo = ''
-      console.log('删除图片')
-    },
-    // 图片上传成功 品牌logo 2
-    imageUploadSuccess2(data) {
-      this.formData2.brandAuthLogo = data.data
-    },
-    imageUploadFaild2(err, file, fileList) {
-      this.$message.error('图片上传失败')
-      console.log(err)
-    },
-    imageRemove2() {
-      this.formData2.brandAuthLogo = ''
-      console.log('删除图片')
-    },
-    // 图片上传成功 声明图片  3
-    imageUploadSuccess3(data) {
-      this.formData2.statementImage = data.data
-    },
-    imageUploadFaild3(err, file, fileList) {
-      this.$message.error('图片上传失败')
-      console.log(err)
-    },
-    imageRemove3() {
-      this.formData2.statementImage = ''
-      console.log('删除图片')
-    },
-    // 微信二维码上传
-    wxImageUploadSuccess(data) {
-      this.formData1.qrCodeImage = data.data
-    },
-    wxImageUploadFaild(err) {
-      this.$message.error('图片上传失败')
-      console.log(err)
-    },
-    wxImageUploadRemove() {
-      this.formData1.qrCodeImage = ''
-    },
-
-    // 代理商logo上传
-    beforeLogoImageUpload(file) {
-      const flag = file.size / 1024 / 1024 < 1
-      if (!flag) {
-        this.$message.error('上传医师照片大小不能超过 1MB!')
-      }
-      return flag
-    },
-    uploadLogoImageSuccess({ response, file, fileList }) {
-      this.logoList = fileList
-      this.formData1.logo = response.data
-    },
-    handleLogoImageRemove({ file, fileList }) {
-      this.logoList = fileList
-      this.formData1.logo = ''
-    },
-
-    // 重置表单1
-    resetFormData1(shopType) {
-      this.formData1 = {
-        shopType: shopType, // 供应商类型
-        shopName: '', // 供应商名称
-        brandId: '', // 品牌id
-        mobile: '', // 手机号
-        linkMan: '', // 联系人
-        countryId: '', // 产地id
-        brandAuthLogo: '', // 品牌logo
-        securityLink: '', // 官网认证链接
-        shopStatus: 1, // 供应商状态,
-        shopInfo: [],
-        qrCodeImage: '',
-        logo: ''
-      }
-      this.fileList1 = []
-      this.fileList2 = []
-      this.fileList3 = []
-      this.fileList4 = []
-      this.ewmUrl = []
-      this.$refs.formData1Ref.clearValidate()
-    },
-    // 重置表单2
-    resetFormData2() {
-      this.formData2 = {
-        index: '',
-        isNew: true,
-        brandName: '',
-        brandId: '', // 品牌id
-        countryId: 1, // 产地id
-        brandAuthLogo: '', // 品牌logo
-        securityLink: '', // 官网认证链接
-        statementType: 1, // 代理声明类型
-        statementContent: '', // 声明内容
-        statementFileId: null, // 声明文件id
-        statementImage: '', // 声明图片
-        statementLink: '', // 声明链接
-        statementFileName: ''
-      }
-      this.fileList1 = []
-      this.fileList2 = []
-      this.fileList3 = []
-      this.fileList4 = []
-      setTimeout(() => {
-        this.$refs.formData2Ref.clearValidate()
-      }, 200)
-    },
     // 克隆
     clone(data) {
       const result = {}