فهرست منبع

认证通v1.7.2页面调整完毕,接口未同步

yuwenjun1997 2 سال پیش
والد
کامیت
6593fc5af7

+ 2 - 2
.env.development

@@ -27,5 +27,5 @@ VUE_APP_LOCAL = 'http://zplm-b.caimei365.com'
 VUE_APP_WWW_HOST = 'https://zp-b.caimei365.com'
 
 # 支付
-VUE_APP_PAY_LOCAL = 'http://192.168.2.68:18014'
-# VUE_APP_PAY_LOCAL = 'http://zplm-b.caimei365.com
+# VUE_APP_PAY_LOCAL = 'http://192.168.2.68:18014'
+VUE_APP_PAY_LOCAL = 'http://zplm-b.caimei365.com

+ 4 - 0
src/styles/index.scss

@@ -410,3 +410,7 @@ aside {
 .preview-image {
   display: inline-block;
 }
+
+.max-width {
+  width: 100%;
+}

+ 40 - 32
src/views/admin/member/settings/service-edit.vue

@@ -89,19 +89,21 @@ export default {
     // 获取菜单配置列表
     fetchVipMenusConfigure() {
       this.isLoading = true
-      fetchVipMenusConfigure().then(res => {
-        console.log(res)
-        this.baseMenuList = res.data.baseMenuList.map(item => {
-          item.checked = false
-          return item
+      fetchVipMenusConfigure()
+        .then((res) => {
+          console.log(res)
+          this.baseMenuList = res.data.baseMenuList.map((item) => {
+            item.checked = false
+            return item
+          })
+          this.upMenuList = res.data.upMenuList.map((item) => {
+            item.checked = false
+            return item
+          })
         })
-        this.upMenuList = res.data.upMenuList.map(item => {
-          item.checked = false
-          return item
+        .finally(() => {
+          this.isLoading = false
         })
-      }).finally(() => {
-        this.isLoading = false
-      })
     },
     // 修改菜单配置列表
     updateVipMenusConfigure() {
@@ -109,31 +111,37 @@ export default {
       updateVipMenusConfigure({
         upMenuList: this.upMenuList,
         baseMenuList: this.baseMenuList
-      }).then(res => {
-        this.$message.success('保存配置成功')
-        this.$store.dispatch('tagsView/delView', this.$route)
-        this.$router.back()
-      }).finally(() => {
-        this.isLoading = false
       })
+        .then((res) => {
+          this.$message.success('保存配置成功')
+          this.$store.dispatch('tagsView/delView', this.$route)
+          this.$router.back()
+        })
+        .finally(() => {
+          this.isLoading = false
+        })
     },
     // 添加到左边
     handleJoinLeft() {
-      const beforeJoinList = this.upMenuList.filter(item => item.checked)
-      this.upMenuList = this.upMenuList.filter(item => !item.checked)
-      this.baseMenuList.push(...beforeJoinList.map(item => {
-        item.checked = false
-        return item
-      }))
+      const beforeJoinList = this.upMenuList.filter((item) => item.checked)
+      this.upMenuList = this.upMenuList.filter((item) => !item.checked)
+      this.baseMenuList.push(
+        ...beforeJoinList.map((item) => {
+          item.checked = false
+          return item
+        })
+      )
     },
     // 添加到右边
     handleJoinRight() {
-      const beforeJoinList = this.baseMenuList.filter(item => item.checked)
-      this.baseMenuList = this.baseMenuList.filter(item => !item.checked)
-      this.upMenuList.push(...beforeJoinList.map(item => {
-        item.checked = false
-        return item
-      }))
+      const beforeJoinList = this.baseMenuList.filter((item) => item.checked)
+      this.baseMenuList = this.baseMenuList.filter((item) => !item.checked)
+      this.upMenuList.push(
+        ...beforeJoinList.map((item) => {
+          item.checked = false
+          return item
+        })
+      )
     },
     handleCellClick(row) {
       console.log(row)
@@ -151,7 +159,7 @@ export default {
   overflow-x: auto;
   margin: 0 auto;
 
-  .list{
+  .list {
     width: 1350px;
     margin: 30px auto 0;
     display: flex;
@@ -159,7 +167,7 @@ export default {
     align-items: center;
   }
 
-  .section{
+  .section {
     width: 600px;
   }
 
@@ -173,7 +181,7 @@ export default {
     .filter-control {
       margin: 0;
 
-      .el-select{
+      .el-select {
         width: 100px;
       }
     }

+ 177 - 750
src/views/admin/supplier/edit.vue

@@ -1,285 +1,123 @@
 <template>
-  <div v-loading="isLoading" class="page-form-container">
-    <el-form ref="submitFormRef" :model="submitForm" :rules="formDataRules" label-width="120px" class="addForm">
+  <div class="page-form-container">
+    <el-form ref="submitForm" :model="formData" :rules="rules" label-width="140px">
+      <el-form-item label="供应商名称:" prop="shopName">
+        <el-input v-model="formData.shopName" placeholder="请输入供应商名称" maxlength="50" show-word-limit />
+      </el-form-item>
       <el-form-item label="供应商类型:" prop="shopType">
-        <el-select
-          v-model="submitForm.shopType"
-          placeholder="请选择供应商类型"
-          style="width: 100%"
-          :disabled="editType === 'edit'"
-          @change="handleTypeChange"
-        >
+        <el-select v-model="formData.shopType" placeholder="请选择供应商类型">
           <el-option label="品牌方" :value="1" />
           <el-option label="代理商" :value="2" />
         </el-select>
       </el-form-item>
-
-      <!-- 供应商名称 -->
-      <el-form-item v-if="submitForm.shopType === 2" label="供应商名称:" prop="shopName">
-        <el-input
-          v-model="submitForm.shopName"
-          placeholder="请输入供应商名称"
-          maxlength="50"
-          show-word-limit
-          :disabled="editType === 'edit'"
-        />
+      <el-form-item label="关联采美供应商:">
+        <el-select v-model="formData.shopType" placeholder="请选择需要关联的供应商" clearable>
+          <el-option label="品牌方" :value="1" />
+          <el-option label="代理商" :value="2" />
+        </el-select>
       </el-form-item>
-
-      <template v-if="submitForm.shopType === 1">
-        <el-form-item clearable label="供应商名称:" prop="brandId">
-          <el-select
-            v-if="editType === 'add'"
-            v-model="submitForm.brandId"
-            placeholder="请选择品牌"
-            style="width: 100%"
-            filterable
-            @change="handleBrandChange"
-          >
-            <el-option v-for="item in brandList" :key="item.id" :label="item.name" :value="item.id" />
-          </el-select>
+      <el-form-item label="手机号:" prop="mobile">
+        <div class="flex">
           <el-input
-            v-else
-            v-model="submitForm.shopName"
-            placeholder="请输入供应商名称"
-            maxlength="50"
+            v-model="formData.mobile"
+            placeholder="请输入手机号"
+            maxlength="11"
             show-word-limit
-            :disabled="editType === 'edit'"
+            @input="onMobileInput"
           />
-        </el-form-item>
-
-        <!-- 制造商 -->
-        <el-form-item label="制造商:">
-          <el-input v-model="submitForm.manufacturer" placeholder="请输入制造商名称" maxlength="50" show-word-limit />
-        </el-form-item>
-      </template>
-      <!-- 供应商名称END -->
-
-      <el-form-item label="手机号:" prop="mobile">
-        <el-input
-          v-model="submitForm.mobile"
-          placeholder="请输入手机号"
-          maxlength="11"
-          show-word-limit
-          @input="handleMobileInput"
-        />
+          <div class="form-label-tip">(提示:该手机号为登录账号)</div>
+        </div>
       </el-form-item>
-
       <el-form-item label="联系人:" prop="linkMan">
-        <el-input v-model="submitForm.linkMan" placeholder="请输入联系人" />
+        <el-input v-model="formData.linkMan" placeholder="请输入联系人" maxlength="50" show-word-limit />
       </el-form-item>
-
-      <!-- 代理商logo -->
-      <transition name="fade">
-        <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"
-            @success="uploadLogoImageSuccess"
-            @remove="handleLogoImageRemove"
-          />
-        </el-form-item>
-      </transition>
-      <transition name="fade">
-        <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="handleRemoveBrand(brand)"
-              @click="handleEditBrand(brand)"
-            >{{ brand.brandName }}</el-tag>
-          </template>
-          <el-tag type="primary" @click="handleAddBrand">添加品牌<span class="el-icon-plus" /></el-tag>
-          <el-input v-show="false" v-model="submitForm.shopInfo" />
-        </el-form-item>
-      </transition>
-
-      <template v-if="submitForm.shopType === 1">
-        <el-form-item label="产地:" prop="countryId">
-          <el-select v-model="submitForm.countryId" placeholder="产地" style="width: 100%" filterable>
-            <el-option
-              v-for="item in countryList"
-              :key="item.countryId"
-              :label="item.countryName"
-              :value="item.countryId"
-            />
-          </el-select>
-        </el-form-item>
-
-        <el-form-item label="品牌logo:" class="no-input" prop="brandAuthLogo">
-          <upload-image
-            tip="建议尺寸:200px * 200px"
-            :image-list="brandAuthLogoList"
-            @success="uploadBrandAuthSuccess"
-            @remove="handleRemoveBrandAuthLogo"
-          />
-          <el-input v-show="false" v-model="submitForm.brandAuthLogo" />
-        </el-form-item>
-
-        <el-form-item label="官网认证链接:">
-          <el-input v-model="submitForm.securityLink" placeholder="请输入官网认证链接" />
-        </el-form-item>
-      </template>
-
-      <!-- 公众号信息 -->
-      <el-form-item label="微信公众号:">
-        <el-select v-model="submitForm.wxAccountType" placeholder="请选择微信公众号类型" style="width: 100%">
-          <el-option label="请选择" :value="0" />
-          <el-option label="服务号" :value="2" />
+      <el-form-item label="供应商logo:" prop="logo">
+        <upload-image
+          tip="建议尺寸:200px * 200px"
+          :image-list="logoImageList"
+          @success="onUploadLogoSuccess"
+          @remove="onRemoveLogoImage"
+        />
+        <el-input v-show="false" v-model="formData.logo" />
+      </el-form-item>
+      <el-form-item label="旗下品牌:" prop="brandList">
+        <template v-for="(item, index) in formData.brandList">
+          <el-tag
+            :key="index"
+            effect="dark"
+            closable
+            type="success"
+            @close="onRemoveBrand(index)"
+            @click="onEditBrand('edit', item, index)"
+          >
+            <span>{{ item.brandName }}</span>
+          </el-tag>
+        </template>
+        <el-tag type="primary" effect="dark" @click="onEditBrand('add')">添加品牌<span class="el-icon-plus" /></el-tag>
+        <el-checkbox-group v-show="false" v-model="formData.brandList" />
+      </el-form-item>
+      <el-form-item label="微信公众号:" prop="wxAccountType">
+        <el-select v-model="formData.wxAccountType" placeholder="请选择微信公众号类型" clearable>
           <el-option label="订阅号" :value="1" />
+          <el-option label="服务号" :value="2" />
         </el-select>
       </el-form-item>
-
-      <transition-group name="fade">
-        <template v-if="submitForm.wxAccountType !== 0">
-          <el-form-item key="appID" label="appID:">
-            <el-input v-model="submitForm.appId" placeholder="微信公众号appID" />
-          </el-form-item>
-          <el-form-item v-if="submitForm.wxAccountType === 2" key="appSecret" label="appSecret:">
-            <el-input v-model="submitForm.appSecret" placeholder="微信公众号appsecret" />
-          </el-form-item>
-          <el-form-item key="qrCodeImage" label="公众号二维码:" prop="qrCodeImage">
-            <upload-image
-              tip="建议尺寸:200px * 200px"
-              :image-list="qrCodeImageList"
-              @success="uploadQrCodeImageSuccess"
-              @remove="handleRemoveQrCodeImage"
-            />
-            <el-input v-show="false" v-model="submitForm.qrCodeImage" />
-          </el-form-item>
-        </template>
-      </transition-group>
-
-      <!-- 公众号信息END -->
-      <el-form-item label="供应商状态:">
-        <el-select v-model="submitForm.shopStatus" placeholder="请选择供应商状态" style="width: 100%">
+      <template v-if="formData.wxAccountType === 2">
+        <el-form-item label="appID:" prop="appId">
+          <el-input v-model="formData.appId" placeholder="请输入服务号appId" />
+        </el-form-item>
+        <el-form-item label="appSecret:" prop="appSecret">
+          <el-input v-model="formData.appSecret" placeholder="请输入服务号appSecret" />
+        </el-form-item>
+      </template>
+      <el-form-item label="供应商状态:" prop="shopStatus">
+        <el-select v-model="formData.shopStatus" placeholder="请选择供应商状态">
           <el-option label="启用" :value="1" />
           <el-option label="禁用" :value="0" />
         </el-select>
       </el-form-item>
     </el-form>
+
     <div class="control-box">
-      <el-button type="primary" @click="submit">保存</el-button>
-      <el-button type="warning" @click="navigateBack()">返回</el-button>
+      <el-button type="warning" @click="navigateBack">返回</el-button>
+      <el-button type="primary" @click="onSubmit">提交</el-button>
     </div>
 
-    <!-- 供应商添加品牌的对话框 -->
-    <el-dialog :title="editBrandText" :visible.sync="dialogAddBrand" width="width" @close="handleDialogAddBrandClosed">
-      <el-form ref="subFormRef" :model="subForm" label-width="120px" :rules="formDataRules">
-        <el-form-item label="选择品牌:" prop="brandId">
-          <el-select
-            v-model="subForm.brandId"
-            placeholder="请选择品牌"
-            style="width: 100%"
-            filterable
-            @change="handleBrandChange"
-          >
-            <el-option v-for="item in otherBrandList" :key="item.id" :label="item.name" :value="item.id" />
-          </el-select>
-        </el-form-item>
-
-        <el-form-item label="产地:" prop="countryId">
-          <el-select v-model="subForm.countryId" placeholder="产地" style="width: 100%" filterable>
-            <el-option
-              v-for="item in countryList"
-              :key="item.countryId"
-              :label="item.countryName"
-              :value="item.countryId"
-            />
-          </el-select>
-        </el-form-item>
-
-        <el-form-item label="制造商:">
-          <el-input v-model="subForm.manufacturer" placeholder="请输入制造商名称" maxlength="50" show-word-limit />
-        </el-form-item>
-
-        <el-form-item label="品牌logo:" class="no-input" prop="brandAuthLogo">
-          <upload-image
-            tip="建议尺寸:200px * 200px"
-            :image-list="brandAuthLogoList"
-            @success="uploadBrandAuthSuccess"
-            @remove="handleRemoveBrandAuthLogo"
-          />
-          <el-input v-show="false" v-model="subForm.brandAuthLogo" />
-        </el-form-item>
-
-        <el-form-item label="代理声明:" prop="statementType">
-          <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>
-            <el-radio :label="4">文件</el-radio>
-          </el-radio-group>
-        </el-form-item>
-
-        <el-form-item v-if="subForm.statementType === 1" ref="statement" label="弹窗:" prop="statementContent">
-          <el-input v-model="subForm.statementContent" type="textarea" />
-        </el-form-item>
-
-        <el-form-item v-else-if="subForm.statementType === 2" ref="statement" label="链接:" prop="statementLink">
-          <el-input v-model="subForm.statementLink" />
-        </el-form-item>
-
-        <el-form-item
-          v-else-if="subForm.statementType === 3"
-          ref="statement"
-          label="图片:"
-          class="no-input"
-          prop="statementImage"
-        >
-          <upload-image
-            tip="建议尺寸:200px * 200px"
-            :image-list="statementImageList"
-            @success="uploadStatementImageSuccess"
-            @remove="handleRemoveStatementImage"
-          />
-          <el-input v-show="false" v-model="subForm.statementImage" />
-        </el-form-item>
-
-        <el-form-item v-else ref="statement" label="文件:" prop="statementFileId">
-          <upload-file
-            ref="fileUpload"
-            :auto-upload="false"
-            :data="uploadParams"
-            :file-list="statementFileList"
-            :before-upload="beforeUploadStatementFile"
-            @success="uploadStatementFileSuccess"
-            @remove="removeStatementFile"
-            @change="changeStatementFile"
-          />
-          <el-input v-show="false" v-model="subForm.statementFileId" />
-        </el-form-item>
-
-        <el-form-item label="官网认证链接:" prop="securityLink">
-          <el-input v-model="subForm.securityLink" placeholder="请输入官网认证链接" />
-        </el-form-item>
-      </el-form>
-
-      <div slot="footer">
-        <el-button @click="addBrandSubmitCancel">取 消</el-button>
-        <el-button type="primary" :loading="submitLoading" @click="handleSaveBrand">确 定</el-button>
-      </div>
+    <!-- 品牌编辑dialog -->
+    <el-dialog
+      title="编辑品牌信息"
+      width="36%"
+      :visible.sync="brandEditVisible"
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+      :show-close="false"
+    >
+      <brand-edit-form v-if="brandEditVisible" ref="brandEditForm" :model="brandModel" @change="onBrandFormChange" />
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="onEditBrandCancel">取 消</el-button>
+        <el-button type="primary" @click="onBrandSubmit">确 定</el-button>
+      </span>
     </el-dialog>
   </div>
 </template>
-
 <script>
-import UploadFile from '@/components/UploadFile'
 import UploadImage from '@/components/UploadImage'
-import { mapGetters } from 'vuex'
-import { isMobile } from '@/utils/validate'
-import { fetchBrandList } from '@/api/brand'
+import { BrandEditForm } from '@/views/components'
 import { deepClone } from '@/utils'
-import { addSupplier, getSupplierById } from '@/api/supplier'
-import { Promise } from 'jszip/lib/external'
-let uuid = 0
+import { isMobile } from '@/utils/validate'
+
+const generateBrandInfo = () => ({
+  brandName: '',
+  brandAuthLogo: '',
+  country: '',
+  manufacturer: ''
+})
 
 export default {
-  components: { UploadImage, UploadFile },
+  components: {
+    UploadImage,
+    BrandEditForm
+  },
   data() {
     const validMobile = (rule, value, callback) => {
       if (!isMobile(value)) {
@@ -287,540 +125,129 @@ export default {
       }
       return callback()
     }
-
-    const validShopInfo = (rule, value, callback) => {
-      console.log(value)
-      if (value <= 0) {
-        return callback(new Error('代理品牌不能为空'))
-      }
-      return callback()
-    }
-
     return {
-      id: '', // 供应商id
-      editType: '',
-      isLoading: false,
-      submitLoading: false,
-      dialogAddBrand: false,
-      brandTagClickType: '', // 品牌表单点击类型
-      selectedShopType: 1, // 当前选中的供应商类型
-      currentBrand: {}, // 当前选中的品牌
-      selectedBrandIds: [], // 代理商已添加的品牌id
-      editBrandInfo: {},
-      // 表单1
-      submitForm: {
-        shopType: 1, // 供应商类型
+      type: 'add',
+      brandEditVisible: false,
+      brandEditType: 'add',
+      brandEditIndex: 0,
+      formData: {
         shopName: '', // 供应商名称
-        brandId: '', // 品牌id
+        shopType: '', // 供应商类型
         mobile: '', // 手机号
         linkMan: '', // 联系人
-        countryId: 1, // 产地id
-        brandAuthLogo: '', // 品牌logo
-        securityLink: '', // 官网认证链接
-        shopStatus: 1, // 供应商状态,
-        shopInfo: '',
-        wxAccountType: 0,
+        logo: '', // 代理商logo
+        brandList: [],
+        wxAccountType: '',
         appId: '',
         appSecret: '',
-        qrCodeImage: '', // 微信公众号二维码
-        logo: '', // 代理商logo
-        manufacturer: '' // 制造商
-      },
-      // 表单2
-      subForm: {
-        brandId: '', // 品牌id
-        countryId: 1, // 产地id
-        brandAuthLogo: '', // 品牌logo
-        securityLink: '', // 官网认证链接
-        statementType: 1, // 代理声明类型
-        statementContent: '', // 声明内容
-        statementFileId: null, // 声明文件id
-        statementImage: '', // 声明图片
-        statementLink: '', // 声明链接
-        manufacturer: '' // 制造商
+        shopStatus: 1 // 供应商状态,
       },
-      supplierBrands: [],
-      brandList: [],
-      // 表单数据校验
-      formDataRules: {
-        shopType: { required: true, message: '供应商类型不能为空', tigger: 'change', type: 'number' },
-        shopName: { required: true, message: '供应名称不能为空', tigger: 'change' },
+      rules: {
+        shopName: [{ required: true, message: '请输入供应商名称', trigger: ['blur'] }],
+        shopType: [{ required: true, message: '请选择供应商类型', trigger: ['change'] }],
         mobile: [
-          { required: true, message: '手机号不能为空', tigger: 'change' },
-          { validator: validMobile, tigger: 'change' }
+          { required: true, message: '请输入手机号', trigger: ['blur'] },
+          { validator: validMobile, tigger: ['blur'] }
         ],
-        linkMan: { required: true, message: '联系人不能为空', tigger: 'blur' },
-        countryId: { required: true, message: '产地不能为空', tigger: 'change', type: 'number' },
-        brandAuthLogo: { required: true, message: '品牌logo不能为空', tigger: 'change' },
-        shopInfo: [
-          { required: true, message: '代理品牌不能为空', tigger: 'change', type: 'number' },
-          { validator: validShopInfo, tigger: 'change' }
-        ],
-        brandId: { required: true, message: '品牌不能为空', tigger: 'change', type: 'number' },
-        statementContent: { required: true, message: '声明内容不能为空', tigger: 'change' }, // 声明内容
-        statementFileId: { required: true, message: '声明文件不能为空', tigger: 'change', type: 'number' }, // 声明文件id
-        statementImage: { required: true, message: '声明图片不能为空', tigger: 'change' }, // 声明图片
-        statementLink: { required: true, message: '声明链接不能为空', tigger: 'change' }, // 声明链接,
-        logo: { required: true, message: '代理商logo不能为空', tigger: 'change' }
+        linkMan: [{ required: true, message: '请输入联系人', trigger: ['blur'] }],
+        logo: [{ required: true, message: '请上传供应商logo', trigger: ['change'] }],
+        brandList: [{ required: true, type: 'array', message: '请至少添加一个品牌', trigger: ['change'] }],
+        shopStatus: [{ required: true, message: '请选择供应商状态', trigger: ['change'] }],
+        appId: [{ required: true, message: '请输入服务号appId', trigger: ['blur'] }],
+        appSecret: [{ required: true, message: '请输入服务号appSecret', trigger: ['blur'] }]
       },
-
-      // 上传图片列表
-      logoList: [],
-      brandAuthLogoList: [],
-      qrCodeImageList: [],
-      // brandAuthLogoList:[],
-      statementImageList: [],
-      // 上传的文件列表
-      statementFileList: [], // 文件
-      statementFileName: '' // 声明文件名称 临时
-    }
-  },
-  computed: {
-    ...mapGetters(['countryList', 'authUserId']),
-    // 去除重复的品牌后的列表
-    otherBrandList() {
-      if (this.brandTagClickType === 'add') {
-        return this.brandList.filter((item) => this.selectedBrandIds.indexOf(item.id) === -1)
-      }
-
-      if (this.brandTagClickType === 'edit') {
-        const exclude = this.selectedBrandIds.filter((id) => id !== this.editBrandInfo.brandId)
-        return this.brandList.filter((item) => exclude.indexOf(item.id) === -1)
-      }
-
-      return this.brandList
-    },
-    // 文件上传参数
-    uploadParams() {
-      return {
-        brandId: this.currentBrand.id,
-        authUserId: this.id
-      }
-    },
-    // 文案提示
-    editTypeText() {
-      return this.editType === 'edit' ? '修改' : '添加'
-    },
-    editBrandText() {
-      return this.brandTagClickType === 'edit' ? '修改品牌' : '添加品牌'
-    }
-  },
-  watch: {
-    // 根据供应商类型变化获取品牌列表
-    selectedShopType(nVal) {
-      this.getBrandList(nVal)
+      brandModel: generateBrandInfo(),
+      logoImageList: []
     }
   },
   created() {
-    this.editType = this.$route.query.type || 'add'
-    this.id = parseInt(this.$route.query.id) || ''
-    this.getBrandList(this.selectedShopType)
-    this.fetchSupplierInfo()
+    this.type = this.$route.query.type || 'add'
+    if (this.type === 'edit') {
+      this.initFormData()
+    }
   },
   methods: {
-    /** 数据回显 */
-    // 获取供应商信息
-    fetchSupplierInfo() {
-      if (!this.id) return
-      getSupplierById({ authUserId: this.id }).then((res) => {
-        this.initSupplierInfo(res.data)
-      })
-    },
-
-    // 初始化供应商信息
-    initSupplierInfo(info) {
-      for (const key in this.submitForm) {
-        if (Object.hasOwnProperty.call(info, key)) {
-          this.submitForm[key] = info[key]
-        }
-      }
-
-      this.selectedShopType = info.shopType
-      if (this.selectedShopType === 1) {
-        // 品牌方
-        const shopInfo = info.shopInfo[0]
-        this.submitForm.brandId = shopInfo.brandId
-        this.submitForm.countryId = shopInfo.countryId
-        this.submitForm.brandAuthLogo = shopInfo.brandAuthLogo
-        this.submitForm.securityLink = shopInfo.securityLink
-        this.submitForm.manufacturer = shopInfo.manufacturer
-        this.submitForm.brandName = shopInfo.brandName
-
-        if (shopInfo.brandAuthLogo) {
-          this.brandAuthLogoList = [{ name: shopInfo.brandName, url: shopInfo.brandAuthLogo }]
-        }
-      } else {
-        // 代理商
-        this.supplierBrands = info.shopInfo.map((item) => {
-          item.uuid = ++uuid
-          this.selectedBrandIds.push(item.brandId)
-          return item
-        })
-
-        // 代理商logo
-        if (this.submitForm.logo) {
-          this.logoList = [{ name: this.submitForm.brandName, url: this.submitForm.logo }]
-        }
-
-        this.submitForm.shopInfo = this.supplierBrands.length
-      }
-
-      // 微信公众号二维码
-      if (this.submitForm.qrCodeImage) {
-        this.qrCodeImageList = [{ name: '', url: this.submitForm.qrCodeImage }]
-      }
-    },
-    /** 数据回显END */
-
-    // 提交保存
-    async submit() {
+    // 初始化表单信息
+    initFormData() {},
+    // 保存
+    onSave() {
+      console.log(this.formData)
+    },
+    // 提交供应商信息
+    async onSubmit() {
       try {
-        await this.$refs.submitFormRef.validate()
-      } catch (err) {
-        return
-      }
-
-      this.isLoading = true
-      let params = {}
-      if (this.selectedShopType === 1) {
-        params = this.getBrandParams()
-      } else {
-        params = this.getShopParams()
-      }
-
-      // 设置创建人
-      params.createBy = this.authUserId
-      params.authUserId = this.id
-
-      console.log(params)
-      addSupplier(params)
-        .then((res) => {
-          this.$message.success(`${this.editTypeText}供应商成功`)
-          this.$store.dispatch('tagsView/delView', this.$route)
-          this.$router.replace('/supplier/list')
-        })
-        .finally(() => {
-          this.isLoading = false
-        })
-    },
-
-    /** 封装请求参数 */
-    // 代理商参数
-    getShopParams() {
-      const params = {
-        shopType: 2, // 供应商类型
-        shopName: '', // 供应商名称
-        logo: '', // 代理商logo
-        mobile: '', // 手机号
-        linkMan: '', // 联系人
-        securityLink: '', // 官网认证链接
-        shopStatus: 1, // 供应商状态,
-        wxAccountType: 2,
-        appId: '',
-        appSecret: '',
-        qrCodeImage: '', // 微信公众号二维码
-        manufacturer: '' // 制造商
-      }
-      for (const key in params) {
-        if (Object.hasOwnProperty.call(this.submitForm, key)) {
-          params[key] = this.submitForm[key]
-        }
-      }
-
-      params.shopInfo = deepClone(this.supplierBrands).map((item) => {
-        delete item.statementFileName
-        delete item.uuid
-        return item
-      })
-
-      return params
-    },
-
-    // 品牌方参数
-    getBrandParams() {
-      const params = {
-        shopType: 1, // 供应商类型
-        mobile: '', // 手机号
-        linkMan: '', // 联系人
-        wxAccountType: 2,
-        appId: '',
-        appSecret: '',
-        qrCodeImage: '', // 微信公众号二维码
-        shopStatus: 1 // 供应商状态,
-      }
-      for (const key in params) {
-        if (Object.hasOwnProperty.call(this.submitForm, key)) {
-          params[key] = this.submitForm[key]
-        }
+        await this.$refs.submitForm.validate()
+        this.onSave()
+      } catch (error) {
+        console.log(error)
       }
-
-      params.shopName = this.currentBrand.name
-      params.shopInfo = [
-        {
-          brandId: this.submitForm.brandId,
-          countryId: this.submitForm.countryId,
-          brandAuthLogo: this.submitForm.brandAuthLogo,
-          securityLink: this.submitForm.securityLink,
-          manufacturer: this.submitForm.manufacturer, // 制造商
-          statementType: 1,
-          statementContent: '',
-          statementFileId: null,
-          statementImage: '',
-          statementLink: ''
-        }
-      ]
-      return params
-    },
-    // 大理上添加
-    /** 封装请求参数 end */
-
-    // 品牌改变事件
-    handleBrandChange(id) {
-      console.log(id)
-      this.currentBrand = this.brandList.find((item) => item.id === id)
-      this.brandAuthLogoList = [{ name: this.currentBrand.name, url: this.currentBrand.authLogo }]
-      this.submitForm.brandAuthLogo = this.currentBrand.authLogo
-      this.subForm.brandAuthLogo = this.currentBrand.authLogo
     },
-
-    /** 品牌标签操作 */
-    // 添加品牌对话框
-    handleAddBrand() {
-      this.brandTagClickType = 'add'
-      // 文件上传参数
-      this.dialogAddBrand = true
-    },
-    // 修改品牌
-    handleEditBrand(row) {
-      this.brandTagClickType = 'edit'
-      // 等待dialog表单渲染完成后再设置值
-      this.$nextTick(() => {
-        this.editBrandInfo = row
-        // 设置选中品牌信息
-        this.currentBrand.id = row.brandId
-        this.currentBrand.name = row.brandName
-        this.currentBrand.authLogo = row.brandAuthLogo
-        this.statementFileName = row.statementFileName
-
-        if (row.brandAuthLogo) {
-          this.brandAuthLogoList = [{ name: row.brandName, url: row.brandAuthLogo }]
-        }
-
-        if (row.statementImage) {
-          this.statementImageList = [{ name: row.brandName, url: row.statementImage }]
-        }
-
-        if (row.statementFileId) {
-          this.statementFileList = [{ name: row.statementFileName }]
-        }
-
-        for (const key in this.subForm) {
-          if (Object.hasOwnProperty.call(this.editBrandInfo, key)) {
-            this.subForm[key] = this.editBrandInfo[key]
-          }
-        }
-
-        console.log(this.subForm)
-      })
-
-      this.dialogAddBrand = true
+    // 品牌信息变化
+    onBrandFormChange(data) {
+      this.brandModel = data
     },
-    // 移除品牌
-    handleRemoveBrand(row) {
-      // 从已选品牌id列表中移除
-      this.selectedBrandIds.splice(this.selectedBrandIds.indexOf(row.brandId), 1)
-      // 从已添加品牌列表中移除
-      const findIndex = this.supplierBrands.findIndex((item) => item.uuid === row.uuid)
-      this.supplierBrands.splice(findIndex, 1)
-      this.submitForm.shopInfo = this.supplierBrands.length
-    },
-    // 保存品牌
-    async handleSaveBrand() {
-      if (this.subForm.statementType === 4) {
-        console.log('有文件上传')
-        if (!this.subForm.statementFileId || this.subForm.statementFileId === -1) {
-          this.submitLoading = true
-          this.$refs.fileUpload.$refs.fileUpload.submit()
-          return
-        }
-      }
+    // 品牌信息确认
+    async onBrandSubmit() {
       try {
-        await this.$refs.subFormRef.validate()
-        this.handleSaveBrandAction()
+        await this.$refs.brandEditForm.validate()
+        if (this.brandEditType === 'add') {
+          this.formData.brandList.push(deepClone(this.brandModel))
+        } else {
+          this.formData.brandList.splice(this.brandEditIndex, 1, deepClone(this.brandModel))
+        }
+        this.brandEditVisible = false
       } catch (error) {
         console.log(error)
       }
     },
-
-    // 取消保存品牌
-    addBrandSubmitCancel() {
-      // 取消上传文件
-      if (this.$refs.fileUpload) {
-        this.$refs.fileUpload.$refs.fileUpload.abort()
-        this.$message.info('文件上传已取消')
-      }
-      this.dialogAddBrand = false
-    },
-
-    // 保存品牌操作
-    handleSaveBrandAction() {
-      // 深度克隆数据
-      const brandInfo = deepClone(this.subForm)
-      // 保存已添加品牌id
-      this.selectedBrandIds.push(this.currentBrand.id)
-      // 设置品牌名称(显示使用)
-      brandInfo.brandName = this.currentBrand.name
-      brandInfo.brandAuthLogo = this.currentBrand.authLogo
-      brandInfo.statementFileName = this.statementFileName
-      if (this.brandTagClickType === 'add') {
-        // 设置唯一id
-        brandInfo.uuid = ++uuid
-        // 保存数据到代理商品牌列表
-        this.supplierBrands.push(brandInfo)
-      }
-      if (this.brandTagClickType === 'edit') {
-        // 使用新数据替换旧数据
-        const findIndex = this.supplierBrands.findIndex((item) => item.uuid === this.editBrandInfo.uuid)
-        this.supplierBrands.splice(findIndex, 1, brandInfo)
-      }
-      this.dialogAddBrand = false
-    },
-
-    // 添加品牌对话框关闭
-    handleDialogAddBrandClosed() {
-      this.subForm.securityLink = ''
-      this.subForm.manufacturer = ''
-      this.subForm.statementType = 1
-      this.statementFileName = ''
-      this.statementImageList = []
-      this.statementFileList = []
-      this.brandAuthLogoList = []
-      this.currentBrand = {}
-      this.submitForm.shopInfo = this.supplierBrands.length
-      // 按钮loading结束
-      this.submitLoading = false
-      // 初始化表单
-      this.$refs.subFormRef.resetFields()
-      console.log(this.subForm)
-    },
-
-    // 声明类型切换
-    handleStatementChange() {
-      this.$refs.statement.clearValidate()
-    },
-    // 供应商类型改变事件
-    handleTypeChange(type) {
-      this.selectedShopType = type
-      this.brandAuthLogoList = []
-      this.statementImageList = []
-      this.currentBrand = {}
-    },
-    // 获取品牌列表
-    getBrandList(type) {
-      fetchBrandList({ type }).then((res) => {
-        if (res.code !== 0) {
-          return
-        }
-        this.brandList = res.data
-      })
-    },
-    /** 品牌标签操作END */
-
-    // 输入框输入时
-    handleMobileInput() {
-      this.submitForm.mobile = this.submitForm.mobile.replace(/[^\w\.\/]/gi, '')
-    },
-
-    /** 图片上传 */
-    // 代理商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
-      this.subForm.brandAuthLogo = response.data
-    },
-    handleRemoveBrandAuthLogo({ file, fileList }) {
-      this.brandAuthLogoList = fileList
-      this.submitForm.brandAuthLogo = ''
-      this.subForm.brandAuthLogo = ''
-    },
-
-    // 公众号二维码
-    uploadQrCodeImageSuccess({ response, file, fileList }) {
-      this.qrCodeImageList = fileList
-      this.submitForm.qrCodeImage = response.data
-    },
-    handleRemoveQrCodeImage({ file, fileList }) {
-      this.qrCodeImageList = fileList
-      this.submitForm.qrCodeImage = ''
-    },
-
-    // 声明图片
-    uploadStatementImageSuccess({ response, file, fileList }) {
-      this.statementImageList = fileList
-      this.subForm.statementImage = response.data
+    // 编辑品牌事件
+    onEditBrand(type, row, index) {
+      this.brandEditType = type
+      this.brandEditIndex = index
+      this.brandModel = type === 'add' ? generateBrandInfo() : row
+      this.brandEditVisible = true
     },
-    handleRemoveStatementImage({ file, fileList }) {
-      this.statementImageList = fileList
-      this.subForm.statementImage = ''
+    // 品牌编辑取消
+    onEditBrandCancel() {
+      this.$refs.brandEditForm.clearValidate()
+      this.brandEditVisible = false
     },
-
-    /** 文件上传 */
-    uploadStatementFileSuccess({ response, file, fileList }) {
-      this.statementFileList = fileList
-      this.subForm.statementFileId = response.data.fileId
-      this.statementFileName = response.data.fileName
-      // 验证表单数据并保存
-      this.$refs.subFormRef.validate((valide) => {
-        if (!valide) return
-        this.handleSaveBrandAction()
-      })
+    // 删除品牌
+    onRemoveBrand(index) {
+      this.formData.brandList.splice(index, 1)
     },
-    removeStatementFile({ file, fileList }) {
-      this.statementFileList = []
-      this.subForm.statementFileId = null
+    // 供应商logo上传成功
+    onUploadLogoSuccess({ response, file, fileList }) {
+      this.logoImageList = fileList
+      this.formData.logo = response.data
     },
-    changeStatementFile({ file, fileList }) {
-      this.statementFileList = fileList
-      this.subForm.statementFileId = -1
+    // 移除供应商logo
+    onRemoveLogoImage() {
+      this.logoImageList = []
+      this.formData.logo = ''
     },
-    beforeUploadStatementFile(file) {
-      const maxSize = 30
-      if (file.size <= maxSize * 1024 * 1024) return true
-      return this.$confirm(`您上传的文件大于${maxSize}MB,是否继续上传?文件上传过程中请您耐心等待!`, '文件上传提示', {
-        confirmButtonText: '继续',
-        cancelButtonText: '取消',
-        type: 'warning'
-      })
-        .then(() => {
-          return Promise.resolve()
-        })
-        .catch(() => {
-          this.$message.info('已取消上传')
-          this.submitLoading = false
-          return Promise.reject()
-        })
+    // 输入手机号时
+    onMobileInput() {
+      this.formData.mobile = this.formData.mobile.replace(/[^\w\.\/]/gi, '')
     }
   }
 }
 </script>
-
 <style lang="scss" scoped>
-.addForm {
-  .brand-list {
-    .el-tag {
-      margin-right: 5px;
-      cursor: pointer;
-    }
+.el-tag {
+  cursor: pointer;
+  margin-right: 8px;
+}
+.el-select {
+  width: 100%;
+}
+
+.flex {
+  display: flex;
+  .form-label-tip {
+    white-space: nowrap;
+    margin-left: 6px;
+    font-size: 12px;
   }
 }
 </style>

+ 826 - 0
src/views/admin/supplier/edit_old.vue

@@ -0,0 +1,826 @@
+<template>
+  <div v-loading="isLoading" class="page-form-container">
+    <el-form ref="submitFormRef" :model="submitForm" :rules="formDataRules" label-width="120px" class="addForm">
+      <el-form-item label="供应商类型:" prop="shopType">
+        <el-select
+          v-model="submitForm.shopType"
+          placeholder="请选择供应商类型"
+          style="width: 100%"
+          :disabled="editType === 'edit'"
+          @change="handleTypeChange"
+        >
+          <el-option label="品牌方" :value="1" />
+          <el-option label="代理商" :value="2" />
+        </el-select>
+      </el-form-item>
+
+      <!-- 供应商名称 -->
+      <el-form-item v-if="submitForm.shopType === 2" label="供应商名称:" prop="shopName">
+        <el-input
+          v-model="submitForm.shopName"
+          placeholder="请输入供应商名称"
+          maxlength="50"
+          show-word-limit
+          :disabled="editType === 'edit'"
+        />
+      </el-form-item>
+
+      <template v-if="submitForm.shopType === 1">
+        <el-form-item clearable label="供应商名称:" prop="brandId">
+          <el-select
+            v-if="editType === 'add'"
+            v-model="submitForm.brandId"
+            placeholder="请选择品牌"
+            style="width: 100%"
+            filterable
+            @change="handleBrandChange"
+          >
+            <el-option v-for="item in brandList" :key="item.id" :label="item.name" :value="item.id" />
+          </el-select>
+          <el-input
+            v-else
+            v-model="submitForm.shopName"
+            placeholder="请输入供应商名称"
+            maxlength="50"
+            show-word-limit
+            :disabled="editType === 'edit'"
+          />
+        </el-form-item>
+
+        <!-- 制造商 -->
+        <el-form-item label="制造商:">
+          <el-input v-model="submitForm.manufacturer" placeholder="请输入制造商名称" maxlength="50" show-word-limit />
+        </el-form-item>
+      </template>
+      <!-- 供应商名称END -->
+
+      <el-form-item label="手机号:" prop="mobile">
+        <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="submitForm.linkMan" placeholder="请输入联系人" />
+      </el-form-item>
+
+      <!-- 代理商logo -->
+      <transition name="fade">
+        <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"
+            @success="uploadLogoImageSuccess"
+            @remove="handleLogoImageRemove"
+          />
+        </el-form-item>
+      </transition>
+      <transition name="fade">
+        <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="handleRemoveBrand(brand)"
+              @click="handleEditBrand(brand)"
+            >{{ brand.brandName }}</el-tag>
+          </template>
+          <el-tag type="primary" @click="handleAddBrand">添加品牌<span class="el-icon-plus" /></el-tag>
+          <el-input v-show="false" v-model="submitForm.shopInfo" />
+        </el-form-item>
+      </transition>
+
+      <template v-if="submitForm.shopType === 1">
+        <el-form-item label="产地:" prop="countryId">
+          <el-select v-model="submitForm.countryId" placeholder="产地" style="width: 100%" filterable>
+            <el-option
+              v-for="item in countryList"
+              :key="item.countryId"
+              :label="item.countryName"
+              :value="item.countryId"
+            />
+          </el-select>
+        </el-form-item>
+
+        <el-form-item label="品牌logo:" class="no-input" prop="brandAuthLogo">
+          <upload-image
+            tip="建议尺寸:200px * 200px"
+            :image-list="brandAuthLogoList"
+            @success="uploadBrandAuthSuccess"
+            @remove="handleRemoveBrandAuthLogo"
+          />
+          <el-input v-show="false" v-model="submitForm.brandAuthLogo" />
+        </el-form-item>
+
+        <el-form-item label="官网认证链接:">
+          <el-input v-model="submitForm.securityLink" placeholder="请输入官网认证链接" />
+        </el-form-item>
+      </template>
+
+      <!-- 公众号信息 -->
+      <el-form-item label="微信公众号:">
+        <el-select v-model="submitForm.wxAccountType" placeholder="请选择微信公众号类型" style="width: 100%">
+          <el-option label="请选择" :value="0" />
+          <el-option label="服务号" :value="2" />
+          <el-option label="订阅号" :value="1" />
+        </el-select>
+      </el-form-item>
+
+      <transition-group name="fade">
+        <template v-if="submitForm.wxAccountType !== 0">
+          <el-form-item key="appID" label="appID:">
+            <el-input v-model="submitForm.appId" placeholder="微信公众号appID" />
+          </el-form-item>
+          <el-form-item v-if="submitForm.wxAccountType === 2" key="appSecret" label="appSecret:">
+            <el-input v-model="submitForm.appSecret" placeholder="微信公众号appsecret" />
+          </el-form-item>
+          <el-form-item key="qrCodeImage" label="公众号二维码:" prop="qrCodeImage">
+            <upload-image
+              tip="建议尺寸:200px * 200px"
+              :image-list="qrCodeImageList"
+              @success="uploadQrCodeImageSuccess"
+              @remove="handleRemoveQrCodeImage"
+            />
+            <el-input v-show="false" v-model="submitForm.qrCodeImage" />
+          </el-form-item>
+        </template>
+      </transition-group>
+
+      <!-- 公众号信息END -->
+      <el-form-item label="供应商状态:">
+        <el-select v-model="submitForm.shopStatus" placeholder="请选择供应商状态" style="width: 100%">
+          <el-option label="启用" :value="1" />
+          <el-option label="禁用" :value="0" />
+        </el-select>
+      </el-form-item>
+    </el-form>
+    <div class="control-box">
+      <el-button type="primary" @click="submit">保存</el-button>
+      <el-button type="warning" @click="navigateBack()">返回</el-button>
+    </div>
+
+    <!-- 供应商添加品牌的对话框 -->
+    <el-dialog :title="editBrandText" :visible.sync="dialogAddBrand" width="width" @close="handleDialogAddBrandClosed">
+      <el-form ref="subFormRef" :model="subForm" label-width="120px" :rules="formDataRules">
+        <el-form-item label="选择品牌:" prop="brandId">
+          <el-select
+            v-model="subForm.brandId"
+            placeholder="请选择品牌"
+            style="width: 100%"
+            filterable
+            @change="handleBrandChange"
+          >
+            <el-option v-for="item in otherBrandList" :key="item.id" :label="item.name" :value="item.id" />
+          </el-select>
+        </el-form-item>
+
+        <el-form-item label="产地:" prop="countryId">
+          <el-select v-model="subForm.countryId" placeholder="产地" style="width: 100%" filterable>
+            <el-option
+              v-for="item in countryList"
+              :key="item.countryId"
+              :label="item.countryName"
+              :value="item.countryId"
+            />
+          </el-select>
+        </el-form-item>
+
+        <el-form-item label="制造商:">
+          <el-input v-model="subForm.manufacturer" placeholder="请输入制造商名称" maxlength="50" show-word-limit />
+        </el-form-item>
+
+        <el-form-item label="品牌logo:" class="no-input" prop="brandAuthLogo">
+          <upload-image
+            tip="建议尺寸:200px * 200px"
+            :image-list="brandAuthLogoList"
+            @success="uploadBrandAuthSuccess"
+            @remove="handleRemoveBrandAuthLogo"
+          />
+          <el-input v-show="false" v-model="subForm.brandAuthLogo" />
+        </el-form-item>
+
+        <el-form-item label="代理声明:" prop="statementType">
+          <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>
+            <el-radio :label="4">文件</el-radio>
+          </el-radio-group>
+        </el-form-item>
+
+        <el-form-item v-if="subForm.statementType === 1" ref="statement" label="弹窗:" prop="statementContent">
+          <el-input v-model="subForm.statementContent" type="textarea" />
+        </el-form-item>
+
+        <el-form-item v-else-if="subForm.statementType === 2" ref="statement" label="链接:" prop="statementLink">
+          <el-input v-model="subForm.statementLink" />
+        </el-form-item>
+
+        <el-form-item
+          v-else-if="subForm.statementType === 3"
+          ref="statement"
+          label="图片:"
+          class="no-input"
+          prop="statementImage"
+        >
+          <upload-image
+            tip="建议尺寸:200px * 200px"
+            :image-list="statementImageList"
+            @success="uploadStatementImageSuccess"
+            @remove="handleRemoveStatementImage"
+          />
+          <el-input v-show="false" v-model="subForm.statementImage" />
+        </el-form-item>
+
+        <el-form-item v-else ref="statement" label="文件:" prop="statementFileId">
+          <upload-file
+            ref="fileUpload"
+            :auto-upload="false"
+            :data="uploadParams"
+            :file-list="statementFileList"
+            :before-upload="beforeUploadStatementFile"
+            @success="uploadStatementFileSuccess"
+            @remove="removeStatementFile"
+            @change="changeStatementFile"
+          />
+          <el-input v-show="false" v-model="subForm.statementFileId" />
+        </el-form-item>
+
+        <el-form-item label="官网认证链接:" prop="securityLink">
+          <el-input v-model="subForm.securityLink" placeholder="请输入官网认证链接" />
+        </el-form-item>
+      </el-form>
+
+      <div slot="footer">
+        <el-button @click="addBrandSubmitCancel">取 消</el-button>
+        <el-button type="primary" :loading="submitLoading" @click="handleSaveBrand">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import UploadFile from '@/components/UploadFile'
+import UploadImage from '@/components/UploadImage'
+import { mapGetters } from 'vuex'
+import { isMobile } from '@/utils/validate'
+import { fetchBrandList } from '@/api/brand'
+import { deepClone } from '@/utils'
+import { addSupplier, getSupplierById } from '@/api/supplier'
+import { Promise } from 'jszip/lib/external'
+let uuid = 0
+
+export default {
+  components: { UploadImage, UploadFile },
+  data() {
+    const validMobile = (rule, value, callback) => {
+      if (!isMobile(value)) {
+        return callback(new Error('手机号格式不正确'))
+      }
+      return callback()
+    }
+
+    const validShopInfo = (rule, value, callback) => {
+      console.log(value)
+      if (value <= 0) {
+        return callback(new Error('代理品牌不能为空'))
+      }
+      return callback()
+    }
+
+    return {
+      id: '', // 供应商id
+      editType: '',
+      isLoading: false,
+      submitLoading: false,
+      dialogAddBrand: false,
+      brandTagClickType: '', // 品牌表单点击类型
+      selectedShopType: 1, // 当前选中的供应商类型
+      currentBrand: {}, // 当前选中的品牌
+      selectedBrandIds: [], // 代理商已添加的品牌id
+      editBrandInfo: {},
+      // 表单1
+      submitForm: {
+        shopType: 1, // 供应商类型
+        shopName: '', // 供应商名称
+        brandId: '', // 品牌id
+        mobile: '', // 手机号
+        linkMan: '', // 联系人
+        countryId: 1, // 产地id
+        brandAuthLogo: '', // 品牌logo
+        securityLink: '', // 官网认证链接
+        shopStatus: 1, // 供应商状态,
+        shopInfo: '',
+        wxAccountType: 0,
+        appId: '',
+        appSecret: '',
+        qrCodeImage: '', // 微信公众号二维码
+        logo: '', // 代理商logo
+        manufacturer: '' // 制造商
+      },
+      // 表单2
+      subForm: {
+        brandId: '', // 品牌id
+        countryId: 1, // 产地id
+        brandAuthLogo: '', // 品牌logo
+        securityLink: '', // 官网认证链接
+        statementType: 1, // 代理声明类型
+        statementContent: '', // 声明内容
+        statementFileId: null, // 声明文件id
+        statementImage: '', // 声明图片
+        statementLink: '', // 声明链接
+        manufacturer: '' // 制造商
+      },
+      supplierBrands: [],
+      brandList: [],
+      // 表单数据校验
+      formDataRules: {
+        shopType: { required: true, message: '供应商类型不能为空', tigger: 'change', type: 'number' },
+        shopName: { required: true, message: '供应名称不能为空', tigger: 'change' },
+        mobile: [
+          { required: true, message: '手机号不能为空', tigger: 'change' },
+          { validator: validMobile, tigger: 'change' }
+        ],
+        linkMan: { required: true, message: '联系人不能为空', tigger: 'blur' },
+        countryId: { required: true, message: '产地不能为空', tigger: 'change', type: 'number' },
+        brandAuthLogo: { required: true, message: '品牌logo不能为空', tigger: 'change' },
+        shopInfo: [
+          { required: true, message: '代理品牌不能为空', tigger: 'change', type: 'number' },
+          { validator: validShopInfo, tigger: 'change' }
+        ],
+        brandId: { required: true, message: '品牌不能为空', tigger: 'change', type: 'number' },
+        statementContent: { required: true, message: '声明内容不能为空', tigger: 'change' }, // 声明内容
+        statementFileId: { required: true, message: '声明文件不能为空', tigger: 'change', type: 'number' }, // 声明文件id
+        statementImage: { required: true, message: '声明图片不能为空', tigger: 'change' }, // 声明图片
+        statementLink: { required: true, message: '声明链接不能为空', tigger: 'change' }, // 声明链接,
+        logo: { required: true, message: '代理商logo不能为空', tigger: 'change' }
+      },
+
+      // 上传图片列表
+      logoList: [],
+      brandAuthLogoList: [],
+      qrCodeImageList: [],
+      // brandAuthLogoList:[],
+      statementImageList: [],
+      // 上传的文件列表
+      statementFileList: [], // 文件
+      statementFileName: '' // 声明文件名称 临时
+    }
+  },
+  computed: {
+    ...mapGetters(['countryList', 'authUserId']),
+    // 去除重复的品牌后的列表
+    otherBrandList() {
+      if (this.brandTagClickType === 'add') {
+        return this.brandList.filter((item) => this.selectedBrandIds.indexOf(item.id) === -1)
+      }
+
+      if (this.brandTagClickType === 'edit') {
+        const exclude = this.selectedBrandIds.filter((id) => id !== this.editBrandInfo.brandId)
+        return this.brandList.filter((item) => exclude.indexOf(item.id) === -1)
+      }
+
+      return this.brandList
+    },
+    // 文件上传参数
+    uploadParams() {
+      return {
+        brandId: this.currentBrand.id,
+        authUserId: this.id
+      }
+    },
+    // 文案提示
+    editTypeText() {
+      return this.editType === 'edit' ? '修改' : '添加'
+    },
+    editBrandText() {
+      return this.brandTagClickType === 'edit' ? '修改品牌' : '添加品牌'
+    }
+  },
+  watch: {
+    // 根据供应商类型变化获取品牌列表
+    selectedShopType(nVal) {
+      this.getBrandList(nVal)
+    }
+  },
+  created() {
+    this.editType = this.$route.query.type || 'add'
+    this.id = parseInt(this.$route.query.id) || ''
+    this.getBrandList(this.selectedShopType)
+    this.fetchSupplierInfo()
+  },
+  methods: {
+    /** 数据回显 */
+    // 获取供应商信息
+    fetchSupplierInfo() {
+      if (!this.id) return
+      getSupplierById({ authUserId: this.id }).then((res) => {
+        this.initSupplierInfo(res.data)
+      })
+    },
+
+    // 初始化供应商信息
+    initSupplierInfo(info) {
+      for (const key in this.submitForm) {
+        if (Object.hasOwnProperty.call(info, key)) {
+          this.submitForm[key] = info[key]
+        }
+      }
+
+      this.selectedShopType = info.shopType
+      if (this.selectedShopType === 1) {
+        // 品牌方
+        const shopInfo = info.shopInfo[0]
+        this.submitForm.brandId = shopInfo.brandId
+        this.submitForm.countryId = shopInfo.countryId
+        this.submitForm.brandAuthLogo = shopInfo.brandAuthLogo
+        this.submitForm.securityLink = shopInfo.securityLink
+        this.submitForm.manufacturer = shopInfo.manufacturer
+        this.submitForm.brandName = shopInfo.brandName
+
+        if (shopInfo.brandAuthLogo) {
+          this.brandAuthLogoList = [{ name: shopInfo.brandName, url: shopInfo.brandAuthLogo }]
+        }
+      } else {
+        // 代理商
+        this.supplierBrands = info.shopInfo.map((item) => {
+          item.uuid = ++uuid
+          this.selectedBrandIds.push(item.brandId)
+          return item
+        })
+
+        // 代理商logo
+        if (this.submitForm.logo) {
+          this.logoList = [{ name: this.submitForm.brandName, url: this.submitForm.logo }]
+        }
+
+        this.submitForm.shopInfo = this.supplierBrands.length
+      }
+
+      // 微信公众号二维码
+      if (this.submitForm.qrCodeImage) {
+        this.qrCodeImageList = [{ name: '', url: this.submitForm.qrCodeImage }]
+      }
+    },
+    /** 数据回显END */
+
+    // 提交保存
+    async submit() {
+      try {
+        await this.$refs.submitFormRef.validate()
+      } catch (err) {
+        return
+      }
+
+      this.isLoading = true
+      let params = {}
+      if (this.selectedShopType === 1) {
+        params = this.getBrandParams()
+      } else {
+        params = this.getShopParams()
+      }
+
+      // 设置创建人
+      params.createBy = this.authUserId
+      params.authUserId = this.id
+
+      console.log(params)
+      addSupplier(params)
+        .then((res) => {
+          this.$message.success(`${this.editTypeText}供应商成功`)
+          this.$store.dispatch('tagsView/delView', this.$route)
+          this.$router.replace('/supplier/list')
+        })
+        .finally(() => {
+          this.isLoading = false
+        })
+    },
+
+    /** 封装请求参数 */
+    // 代理商参数
+    getShopParams() {
+      const params = {
+        shopType: 2, // 供应商类型
+        shopName: '', // 供应商名称
+        logo: '', // 代理商logo
+        mobile: '', // 手机号
+        linkMan: '', // 联系人
+        securityLink: '', // 官网认证链接
+        shopStatus: 1, // 供应商状态,
+        wxAccountType: 2,
+        appId: '',
+        appSecret: '',
+        qrCodeImage: '', // 微信公众号二维码
+        manufacturer: '' // 制造商
+      }
+      for (const key in params) {
+        if (Object.hasOwnProperty.call(this.submitForm, key)) {
+          params[key] = this.submitForm[key]
+        }
+      }
+
+      params.shopInfo = deepClone(this.supplierBrands).map((item) => {
+        delete item.statementFileName
+        delete item.uuid
+        return item
+      })
+
+      return params
+    },
+
+    // 品牌方参数
+    getBrandParams() {
+      const params = {
+        shopType: 1, // 供应商类型
+        mobile: '', // 手机号
+        linkMan: '', // 联系人
+        wxAccountType: 2,
+        appId: '',
+        appSecret: '',
+        qrCodeImage: '', // 微信公众号二维码
+        shopStatus: 1 // 供应商状态,
+      }
+      for (const key in params) {
+        if (Object.hasOwnProperty.call(this.submitForm, key)) {
+          params[key] = this.submitForm[key]
+        }
+      }
+
+      params.shopName = this.currentBrand.name
+      params.shopInfo = [
+        {
+          brandId: this.submitForm.brandId,
+          countryId: this.submitForm.countryId,
+          brandAuthLogo: this.submitForm.brandAuthLogo,
+          securityLink: this.submitForm.securityLink,
+          manufacturer: this.submitForm.manufacturer, // 制造商
+          statementType: 1,
+          statementContent: '',
+          statementFileId: null,
+          statementImage: '',
+          statementLink: ''
+        }
+      ]
+      return params
+    },
+    // 大理上添加
+    /** 封装请求参数 end */
+
+    // 品牌改变事件
+    handleBrandChange(id) {
+      console.log(id)
+      this.currentBrand = this.brandList.find((item) => item.id === id)
+      this.brandAuthLogoList = [{ name: this.currentBrand.name, url: this.currentBrand.authLogo }]
+      this.submitForm.brandAuthLogo = this.currentBrand.authLogo
+      this.subForm.brandAuthLogo = this.currentBrand.authLogo
+    },
+
+    /** 品牌标签操作 */
+    // 添加品牌对话框
+    handleAddBrand() {
+      this.brandTagClickType = 'add'
+      // 文件上传参数
+      this.dialogAddBrand = true
+    },
+    // 修改品牌
+    handleEditBrand(row) {
+      this.brandTagClickType = 'edit'
+      // 等待dialog表单渲染完成后再设置值
+      this.$nextTick(() => {
+        this.editBrandInfo = row
+        // 设置选中品牌信息
+        this.currentBrand.id = row.brandId
+        this.currentBrand.name = row.brandName
+        this.currentBrand.authLogo = row.brandAuthLogo
+        this.statementFileName = row.statementFileName
+
+        if (row.brandAuthLogo) {
+          this.brandAuthLogoList = [{ name: row.brandName, url: row.brandAuthLogo }]
+        }
+
+        if (row.statementImage) {
+          this.statementImageList = [{ name: row.brandName, url: row.statementImage }]
+        }
+
+        if (row.statementFileId) {
+          this.statementFileList = [{ name: row.statementFileName }]
+        }
+
+        for (const key in this.subForm) {
+          if (Object.hasOwnProperty.call(this.editBrandInfo, key)) {
+            this.subForm[key] = this.editBrandInfo[key]
+          }
+        }
+
+        console.log(this.subForm)
+      })
+
+      this.dialogAddBrand = true
+    },
+    // 移除品牌
+    handleRemoveBrand(row) {
+      // 从已选品牌id列表中移除
+      this.selectedBrandIds.splice(this.selectedBrandIds.indexOf(row.brandId), 1)
+      // 从已添加品牌列表中移除
+      const findIndex = this.supplierBrands.findIndex((item) => item.uuid === row.uuid)
+      this.supplierBrands.splice(findIndex, 1)
+      this.submitForm.shopInfo = this.supplierBrands.length
+    },
+    // 保存品牌
+    async handleSaveBrand() {
+      if (this.subForm.statementType === 4) {
+        console.log('有文件上传')
+        if (!this.subForm.statementFileId || this.subForm.statementFileId === -1) {
+          this.submitLoading = true
+          this.$refs.fileUpload.$refs.fileUpload.submit()
+          return
+        }
+      }
+      try {
+        await this.$refs.subFormRef.validate()
+        this.handleSaveBrandAction()
+      } catch (error) {
+        console.log(error)
+      }
+    },
+
+    // 取消保存品牌
+    addBrandSubmitCancel() {
+      // 取消上传文件
+      if (this.$refs.fileUpload) {
+        this.$refs.fileUpload.$refs.fileUpload.abort()
+        this.$message.info('文件上传已取消')
+      }
+      this.dialogAddBrand = false
+    },
+
+    // 保存品牌操作
+    handleSaveBrandAction() {
+      // 深度克隆数据
+      const brandInfo = deepClone(this.subForm)
+      // 保存已添加品牌id
+      this.selectedBrandIds.push(this.currentBrand.id)
+      // 设置品牌名称(显示使用)
+      brandInfo.brandName = this.currentBrand.name
+      brandInfo.brandAuthLogo = this.currentBrand.authLogo
+      brandInfo.statementFileName = this.statementFileName
+      if (this.brandTagClickType === 'add') {
+        // 设置唯一id
+        brandInfo.uuid = ++uuid
+        // 保存数据到代理商品牌列表
+        this.supplierBrands.push(brandInfo)
+      }
+      if (this.brandTagClickType === 'edit') {
+        // 使用新数据替换旧数据
+        const findIndex = this.supplierBrands.findIndex((item) => item.uuid === this.editBrandInfo.uuid)
+        this.supplierBrands.splice(findIndex, 1, brandInfo)
+      }
+      this.dialogAddBrand = false
+    },
+
+    // 添加品牌对话框关闭
+    handleDialogAddBrandClosed() {
+      this.subForm.securityLink = ''
+      this.subForm.manufacturer = ''
+      this.subForm.statementType = 1
+      this.statementFileName = ''
+      this.statementImageList = []
+      this.statementFileList = []
+      this.brandAuthLogoList = []
+      this.currentBrand = {}
+      this.submitForm.shopInfo = this.supplierBrands.length
+      // 按钮loading结束
+      this.submitLoading = false
+      // 初始化表单
+      this.$refs.subFormRef.resetFields()
+      console.log(this.subForm)
+    },
+
+    // 声明类型切换
+    handleStatementChange() {
+      this.$refs.statement.clearValidate()
+    },
+    // 供应商类型改变事件
+    handleTypeChange(type) {
+      this.selectedShopType = type
+      this.brandAuthLogoList = []
+      this.statementImageList = []
+      this.currentBrand = {}
+    },
+    // 获取品牌列表
+    getBrandList(type) {
+      fetchBrandList({ type }).then((res) => {
+        if (res.code !== 0) {
+          return
+        }
+        this.brandList = res.data
+      })
+    },
+    /** 品牌标签操作END */
+
+    // 输入框输入时
+    handleMobileInput() {
+      this.submitForm.mobile = this.submitForm.mobile.replace(/[^\w\.\/]/gi, '')
+    },
+
+    /** 图片上传 */
+    // 代理商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
+      this.subForm.brandAuthLogo = response.data
+    },
+    handleRemoveBrandAuthLogo({ file, fileList }) {
+      this.brandAuthLogoList = fileList
+      this.submitForm.brandAuthLogo = ''
+      this.subForm.brandAuthLogo = ''
+    },
+
+    // 公众号二维码
+    uploadQrCodeImageSuccess({ response, file, fileList }) {
+      this.qrCodeImageList = fileList
+      this.submitForm.qrCodeImage = response.data
+    },
+    handleRemoveQrCodeImage({ file, fileList }) {
+      this.qrCodeImageList = fileList
+      this.submitForm.qrCodeImage = ''
+    },
+
+    // 声明图片
+    uploadStatementImageSuccess({ response, file, fileList }) {
+      this.statementImageList = fileList
+      this.subForm.statementImage = response.data
+    },
+    handleRemoveStatementImage({ file, fileList }) {
+      this.statementImageList = fileList
+      this.subForm.statementImage = ''
+    },
+
+    /** 文件上传 */
+    uploadStatementFileSuccess({ response, file, fileList }) {
+      this.statementFileList = fileList
+      this.subForm.statementFileId = response.data.fileId
+      this.statementFileName = response.data.fileName
+      // 验证表单数据并保存
+      this.$refs.subFormRef.validate((valide) => {
+        if (!valide) return
+        this.handleSaveBrandAction()
+      })
+    },
+    removeStatementFile({ file, fileList }) {
+      this.statementFileList = []
+      this.subForm.statementFileId = null
+    },
+    changeStatementFile({ file, fileList }) {
+      this.statementFileList = fileList
+      this.subForm.statementFileId = -1
+    },
+    beforeUploadStatementFile(file) {
+      const maxSize = 30
+      if (file.size <= maxSize * 1024 * 1024) return true
+      return this.$confirm(`您上传的文件大于${maxSize}MB,是否继续上传?文件上传过程中请您耐心等待!`, '文件上传提示', {
+        confirmButtonText: '继续',
+        cancelButtonText: '取消',
+        type: 'warning'
+      })
+        .then(() => {
+          return Promise.resolve()
+        })
+        .catch(() => {
+          this.$message.info('已取消上传')
+          this.submitLoading = false
+          return Promise.reject()
+        })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.addForm {
+  .brand-list {
+    .el-tag {
+      margin-right: 5px;
+      cursor: pointer;
+    }
+  }
+}
+</style>

+ 5 - 4
src/views/admin/supplier/index.vue

@@ -87,17 +87,18 @@
           <span>{{ row.createTime | formatTime }}</span>
         </template>
       </el-table-column>
+      <el-table-column label="创建人" width="120px" align="center" prop="createBy" />
       <!-- <el-table-column label="创建人" class-name="status-col" width="100px" prop="createBy" /> -->
-      <el-table-column label="操作" align="center" width="360" class-name="small-padding fixed-width">
+      <el-table-column label="操作" align="center" width="280" class-name="small-padding fixed-width">
         <template slot-scope="{ row }">
           <el-button size="mini" type="primary" @click="navigationTo(`supplier-edit?id=${row.authUserId}&type=edit`)">
             编辑
           </el-button>
+          <el-button size="mini" type="primary" @click="handleResetPwd(row)"> 重置密码 </el-button>
           <el-button size="mini" type="primary" @click="handleProxy(row)"> 代他操作 </el-button>
-          <el-button size="mini" type="primary" @click="navigationTo(`club-list?id=${row.authUserId}`)">
+          <!-- <el-button size="mini" type="primary" @click="navigationTo(`club-list?id=${row.authUserId}`)">
             查看机构认证
-          </el-button>
-          <el-button size="mini" type="primary" @click="handleResetPwd(row)"> 重置密码 </el-button>
+          </el-button> -->
         </template>
       </el-table-column>
     </el-table>

+ 103 - 0
src/views/components/BrandEditForm/index.vue

@@ -0,0 +1,103 @@
+<template>
+  <div class="brand-edit-form">
+    <el-form ref="brandEditForm" :model="formData" :rules="rules" label-width="90px">
+      <el-form-item label="品牌名:" prop="brandName">
+        <el-input v-model="formData.brandName" placeholder="请输入品牌名" maxlength="50" show-word-limit />
+      </el-form-item>
+      <el-form-item label="品牌logo:" prop="brandAuthLogo">
+        <upload-image
+          tip="建议尺寸:200px * 200px"
+          :image-list="imageList"
+          @success="uploadSuccess"
+          @remove="onRemoveImage"
+        />
+        <el-input v-show="false" v-model="formData.brandAuthLogo" />
+      </el-form-item>
+      <el-form-item label="产地:" prop="country">
+        <el-input v-model="formData.country" placeholder="请输入产地" maxlength="50" show-word-limit />
+      </el-form-item>
+      <el-form-item label="制造商:" prop="manufacturer">
+        <el-input v-model="formData.manufacturer" placeholder="请输入制造商" maxlength="50" show-word-limit />
+      </el-form-item>
+    </el-form>
+  </div>
+</template>
+<script>
+import UploadImage from '@/components/UploadImage'
+import { objectCover } from '@/utils'
+export default {
+  components: {
+    UploadImage
+  },
+  props: {
+    model: {
+      type: Object,
+      default: () => ({
+        brandName: '',
+        brandAuthLogo: '',
+        country: '',
+        manufacturer: ''
+      }),
+      validator: (value) => {
+        return ['brandName', 'brandAuthLogo', 'country', 'manufacturer'].every((key) =>
+          Object.hasOwnProperty.call(value, key)
+        )
+      }
+    }
+  },
+  data() {
+    return {
+      formData: {
+        brandName: '',
+        brandAuthLogo: '',
+        country: '',
+        manufacturer: ''
+      },
+      rules: {
+        brandName: [{ required: true, message: '请输入品牌名称', trigger: ['blur'] }],
+        brandAuthLogo: [{ required: true, message: '请上传品牌logo', trigger: ['change'] }],
+        country: [{ required: true, message: '请输入产地', trigger: ['blur'] }],
+        manufacturer: [{ required: true, message: '请输入制造商', trigger: ['blur'] }]
+      },
+      imageList: []
+    }
+  },
+  watch: {
+    formData: {
+      deep: true,
+      handler: function(nval) {
+        this.$emit('change', nval)
+      }
+    }
+  },
+  created() {
+    objectCover(this.formData, this.model)
+    if (this.formData.brandAuthLogo) {
+      this.imageList = [{ name: '品牌logo', url: this.formData.brandAuthLogo }]
+    }
+  },
+  methods: {
+    validate() {
+      return this.$refs.brandEditForm?.validate()
+    },
+    validateField() {
+      return this.$refs.brandEditForm?.validateField()
+    },
+    resetFields() {
+      return this.$refs.brandEditForm?.resetFields()
+    },
+    clearValidate() {
+      return this.$refs.brandEditForm?.clearValidate()
+    },
+    uploadSuccess({ response, file, fileList }) {
+      this.imageList = fileList
+      this.formData.brandAuthLogo = response.data
+    },
+    onRemoveImage() {
+      this.imageList = []
+      this.formData.brandAuthLogo = ''
+    }
+  }
+}
+</script>
+<style lang="scss" scoped></style>

+ 9 - 1
src/views/components/ClubDetail/index.vue

@@ -27,6 +27,14 @@
         </div>
       </div>
     </div>
+    <div class="row">
+      <div class="col">运营联系人:</div>
+      <div class="col">{{ clubInfo.mobile }}</div>
+    </div>
+    <div class="row">
+      <div class="col">运营联系人手机号:</div>
+      <div class="col">{{ clubInfo.mobile }}</div>
+    </div>
     <div class="row">
       <div class="col">logo:</div>
       <div class="col">
@@ -231,7 +239,7 @@ export default {
     font-size: 14px;
     color: #333;
     &:first-child {
-      min-width: 100px;
+      min-width: 140px;
       text-align: right;
       margin-right: 8px;
       font-weight: bold;

+ 4 - 0
src/views/components/DeviceDetail/index.vue

@@ -1,5 +1,9 @@
 <template>
   <div>
+    <div class="row">
+      <div class="col">认证方式:</div>
+      <div class="col">新设备认证 | 关联已认证设备</div>
+    </div>
     <div class="row">
       <div class="col">设备名称:</div>
       <div class="col">{{ productInfo.productName }}</div>

+ 1 - 0
src/views/components/index.js

@@ -7,3 +7,4 @@ export { default as DoctorCustomItems } from './DoctorCustomItems/index.vue'
 export { default as MemberBenefits } from './MemberBenefits/index.vue'
 export { default as RadioCard } from './RadioCard/index.vue'
 export { default as ClubListSelector } from './ClubListSelector/index.vue'
+export { default as BrandEditForm } from './BrandEditForm/index.vue'

+ 72 - 61
src/views/normal/club/device/edit.vue

@@ -7,54 +7,63 @@
       </el-form-item>
       -->
 
-      <el-form-item label="设备名称:" prop="productTypeId">
-        <el-select
-          v-model="formData.productTypeId"
-          filterable
-          placeholder="选择设备"
-          style="width: 100%"
-          @change="onProductTypeIdChange"
-        >
-          <el-option
-            v-for="item in deviceList"
-            :key="item.productTypeId"
-            :label="item.name"
-            :value="item.productTypeId"
-          />
-        </el-select>
+      <el-form-item label="认证方式:">
+        <el-radio-group v-model="formData.authType">
+          <el-radio :label="1">新设备认证</el-radio>
+          <el-radio :label="2">关联已认证设备</el-radio>
+        </el-radio-group>
       </el-form-item>
 
+      <template v-if="formData.authType === 1">
+        <el-form-item label="设备名称:" prop="productTypeId">
+          <el-select
+            v-model="formData.productTypeId"
+            filterable
+            placeholder="选择设备"
+            style="width: 100%"
+            @change="onProductTypeIdChange"
+          >
+            <el-option
+              v-for="item in deviceList"
+              :key="item.productTypeId"
+              :label="item.name"
+              :value="item.productTypeId"
+            />
+          </el-select>
+        </el-form-item>
+      </template>
+
       <el-form-item label="设备SN码:" prop="snCode">
         <el-input v-model="formData.snCode" placeholder="请输入设备SN码" />
       </el-form-item>
 
-      <!-- **************** 新方法配置授权牌 START ******************* -->
-      <!-- <el-form-item label="授权牌:">
-        <el-radio-group v-model="formData.addQrCodeFlag" size="mini">
-          <el-radio :label="0" border>模板库生成</el-radio>
-          <el-radio :label="1" border>自定义上传</el-radio>
-        </el-radio-group>
-        <div style="margin-top: 12px">
-
-          <template v-if="formData.addQrCodeFlag === 1">
-            <upload-image
-              tip="建议尺寸:150px * 112px"
-              :image-list="certificateImageList"
-              :before-upload="beforeCertificateImageUpload"
-              @success="uploadCertificateImageSuccess"
-              @remove="handleCertificateImageRemove"
-            />
-            <el-input v-model="formData.certificateImage" class="hiddenInput" />
-          </template>
-          <el-image v-else style="width:148px;height:148px" />
-        </div>
-      </el-form-item> -->
+      <template v-if="formData.authType === 1">
+        <!-- **************** 新方法配置授权牌 START ******************* -->
+        <el-form-item label="授权牌:">
+          <el-radio-group v-model="formData.addQrCodeFlag" size="mini">
+            <el-radio :label="0" border>模板库生成</el-radio>
+            <el-radio :label="1" border>自定义上传</el-radio>
+          </el-radio-group>
+          <div style="margin-top: 12px">
+            <template v-if="formData.addQrCodeFlag === 1">
+              <upload-image
+                tip="建议尺寸:150px * 112px"
+                :image-list="certificateImageList"
+                :before-upload="beforeCertificateImageUpload"
+                @success="uploadCertificateImageSuccess"
+                @remove="handleCertificateImageRemove"
+              />
+              <el-input v-model="formData.certificateImage" class="hiddenInput" />
+            </template>
+            <el-image v-else style="width: 148px; height: 148px" />
+          </div>
+        </el-form-item>
 
-      <!-- **************** 新方法配置授权牌 End ******************* -->
+        <!-- **************** 新方法配置授权牌 End ******************* -->
 
-      <!-- **************** 旧方法配置授权牌 START ******************* -->
-      <!-- 上传授权牌 -->
-      <el-form-item label="授权牌:" prop="certificateImage">
+        <!-- **************** 旧方法配置授权牌 START ******************* -->
+        <!-- 上传授权牌 -->
+        <!-- <el-form-item label="授权牌:" prop="certificateImage">
         <upload-image
           tip="建议尺寸:542px * 546px"
           :image-list="certificateImageList"
@@ -63,35 +72,36 @@
           @remove="handleCertificateImageRemove"
         />
         <el-input v-model="formData.certificateImage" class="hiddenInput" />
-      </el-form-item>
-      <!-- 是否生成二维码授权牌 -->
-      <!-- <el-form-item label="生成二维码授权牌:">
+      </el-form-item> -->
+        <!-- 是否生成二维码授权牌 -->
+        <!-- <el-form-item label="生成二维码授权牌:">
         <el-radio-group v-model="formData.addQrCodeFlag" size="mini">
           <el-radio :label="0" border>否</el-radio>
           <el-radio :label="1" border :disabled="certificateImageList.length <= 0">是</el-radio>
         </el-radio-group>
       </el-form-item> -->
-      <!-- 二维码授权牌模板 -->
-      <!-- <el-form-item v-if="formData.addQrCodeFlag === 1" label="选择模板:">
+        <!-- 二维码授权牌模板 -->
+        <!-- <el-form-item v-if="formData.addQrCodeFlag === 1" label="选择模板:">
         <auth-card-template v-model="formData.addTemplateType" :image-list="certificateImageList" />
       </el-form-item> -->
-      <!-- **************** 旧方法配置授权牌 END ******************* -->
+        <!-- **************** 旧方法配置授权牌 END ******************* -->
 
-      <el-form-item label="购买渠道:">
-        <el-input v-model="formData.purchaseWay" placeholder="请输入购买渠道" />
-      </el-form-item>
+        <el-form-item label="购买渠道:">
+          <el-input v-model="formData.purchaseWay" placeholder="请输入购买渠道" />
+        </el-form-item>
 
-      <el-form-item label="发票:">
-        <upload-image
-          tip="建议图片分辨率:242px*242px"
-          :limit="1"
-          :image-list="invoiceImageList"
-          :before-upload="beforeInvoiceImageUpload"
-          @success="uploadInvoiceImageSuccess"
-          @remove="handleInvoiceImageRemove"
-        />
-        <el-input v-show="false" v-model="formData.invoiceImage" />
-      </el-form-item>
+        <el-form-item label="发票:">
+          <upload-image
+            tip="建议图片分辨率:242px*242px"
+            :limit="1"
+            :image-list="invoiceImageList"
+            :before-upload="beforeInvoiceImageUpload"
+            @success="uploadInvoiceImageSuccess"
+            @remove="handleInvoiceImageRemove"
+          />
+          <el-input v-show="false" v-model="formData.invoiceImage" />
+        </el-form-item>
+      </template>
     </el-form>
     <div class="submit-btn">
       <el-button type="primary" @click="submit">保存</el-button>
@@ -123,6 +133,7 @@ export default {
       brandList: [],
       deviceList: [], // 设备列表
       formData: {
+        authType: 1,
         authUserId: '',
         authId: '', //	授权id
         certificateImage: '', //	授权牌照
@@ -133,7 +144,7 @@ export default {
         snCode: '', //	设备SN码
         status: 2, //	上架状态:0下线,1上线 2待审核
         brandId: '',
-        addQrCodeFlag: 0,
+        addQrCodeFlag: '',
         addTemplateType: 1,
         productTypeId: '',
         purchaseWay: '', // 购买渠道

+ 9 - 1
src/views/normal/club/edit.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="club-edit page-form-container">
-    <el-form ref="submitForm" label-width="100px" :model="formData" :rules="rules">
+    <el-form ref="submitForm" label-width="140px" :model="formData" :rules="rules">
       <el-form-item label="机构名称:" prop="name">
         <el-input v-model="formData.name" placeholder="请输入机构名称" clearable />
       </el-form-item>
@@ -32,6 +32,14 @@
         <el-input v-model="formData.mobile" placeholder="请输入联系方式" clearable />
       </el-form-item>
 
+      <el-form-item label="运营联系人:">
+        <el-input v-model="formData.mobile" placeholder="请输入运营联系人" clearable />
+      </el-form-item>
+
+      <el-form-item label="运营联系人手机号:">
+        <el-input v-model="formData.mobile" placeholder="请输入运营联系人手机号" clearable />
+      </el-form-item>
+
       <el-form-item label="认证编号:" prop="authCode">
         <el-input v-model="formData.authCode" placeholder="请输认证编号" clearable />
       </el-form-item>

+ 12 - 0
src/views/normal/club/index.vue

@@ -23,6 +23,10 @@
           <el-option label="未上线" :value="0" />
         </el-select>
       </div>
+      <div class="filter-control">
+        <span>明星机构</span>
+        <el-checkbox />
+      </div>
       <div class="filter-control">
         <permission-button type="primary" @click="getList">查询</permission-button>
         <permission-button type="primary" @click="navigationTo('club-add?type=edit')">添加</permission-button>
@@ -32,6 +36,8 @@
       <div class="filter-control">
         <permission-button type="primary" @click="downLoadExportExcel">获取导入模板</permission-button>
         <permission-button type="primary" @click="onHandleExport(1)">一键下载授权牌</permission-button>
+      </div>
+      <div class="filter-control">
         <permission-button type="primary" @click="onHandleExport(3)">一键下载机构二维码</permission-button>
       </div>
       <div class="filter-control">
@@ -80,6 +86,12 @@
 
       <el-table-column label="扫码次数" align="center" prop="" width="80" />
 
+      <el-table-column label="明星机构" align="center" prop="" width="80">
+        <template>
+          <el-checkbox />
+        </template>
+      </el-table-column>
+
       <el-table-column label="创建时间" class-name="status-col" width="160px">
         <template slot-scope="{ row }">
           <span>{{ row.createTime | formatTime }}</span>

+ 204 - 5
src/views/normal/personal/index.vue

@@ -20,6 +20,24 @@
       </el-col>
     </el-row>
     <el-divider />
+    <el-row>
+      <el-col :span="5">联系人:</el-col>
+      <el-col :span="8">{{ supplierInfo.mobile }}</el-col>
+      <el-col :span="8">
+        <el-link icon="el-icon-edit" type="primary" @click="onEditContactName">修改联系人</el-link>
+      </el-col>
+    </el-row>
+    <el-divider />
+    <el-row>
+      <el-col :span="5">公司logo:</el-col>
+      <el-col :span="8">
+        <preview-image />
+        <div style="margin-top: 12px">
+          <el-link icon="el-icon-upload" type="primary" @click="onEditLogo">修改</el-link>
+        </div>
+      </el-col>
+    </el-row>
+    <el-divider />
     <el-row>
       <el-col :span="5">登录账号:</el-col>
       <el-col :span="8">{{ supplierInfo.loginAccount ? supplierInfo.loginAccount : '暂未绑定' }}</el-col>
@@ -30,8 +48,32 @@
     <el-divider />
     <template v-if="supplierInfo.shopType === 2">
       <el-row>
-        <el-col :span="5">代理品牌:</el-col>
-        <el-col :span="8">{{ brandList }}</el-col>
+        <el-col :span="5">旗下品牌:</el-col>
+        <el-col :span="19">
+          <div class="tag-list">
+            <template v-for="(item, index) in brandList">
+              <el-tag
+                :key="index"
+                closable
+                effect="dark"
+                size="small"
+                type="success"
+                @close="onRemoveBrand(index)"
+                @click="onEditBrand('edit', item, index)"
+              >
+                <span>{{ item.brandName }}</span>
+              </el-tag>
+            </template>
+            <el-tag
+              effect="dark"
+              type="primary"
+              size="small"
+              @click="onEditBrand('add')"
+            >添加品牌<span
+              class="el-icon-plus"
+            /></el-tag>
+          </div>
+        </el-col>
       </el-row>
       <el-divider />
     </template>
@@ -50,20 +92,85 @@
         </router-link>
       </el-col>
     </el-row>
+
+    <!-- 品牌编辑dialog -->
+    <el-dialog
+      :title="eidtText"
+      width="36%"
+      :visible.sync="editVisible"
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+      :show-close="false"
+    >
+      <template v-if="editType < 2">
+        <brand-edit-form v-if="editVisible" ref="brandEditForm" :model="brandModel" @change="onBrandFormChange" />
+      </template>
+      <template v-else>
+        <el-form v-if="editVisible" ref="submitForm" label-width="80px" :model="formData" :rules="rules">
+          <el-form-item v-if="editType === 2" label="logo:" prop="logo">
+            <el-input v-show="false" v-model="formData.logo" />
+            <upload-image
+              tip="建议尺寸:200px * 200px"
+              :image-list="logoImageList"
+              @success="onUploadLogoSuccess"
+              @remove="onRemoveLogoImage"
+            />
+          </el-form-item>
+          <el-form-item v-if="editType === 3" label="联系人:" prop="linkMan">
+            <el-input v-model="formData.linkMan" placeholder="请输入联系人" />
+          </el-form-item>
+        </el-form>
+      </template>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="onCancel">取 消</el-button>
+        <el-button type="primary" @click="onSubmit">确 定</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
 <script>
 import { getSupplierById } from '@/api/supplier'
+import UploadImage from '@/components/UploadImage'
+import { BrandEditForm } from '@/views/components'
+import { deepClone } from '@/utils'
+
+const generateBrandInfo = () => ({
+  brandName: '',
+  brandAuthLogo: '',
+  country: '',
+  manufacturer: ''
+})
+
 export default {
+  components: {
+    UploadImage,
+    BrandEditForm
+  },
   data() {
     return {
-      supplierInfo: {}
+      editType: 0,
+      editVisible: false,
+      brandEditType: 'add',
+      brandEditIndex: 0,
+      supplierInfo: {},
+      brandList: [],
+      brandModel: generateBrandInfo(),
+      formData: {
+        logo: '',
+        linkMan: ''
+      },
+      rules: {
+        logo: [{ required: true, message: '请上传logo', trigger: 'change' }],
+        linkMan: [{ required: true, message: '请输入联系人', trigger: 'blur' }]
+      },
+      logoImageList: []
     }
   },
   computed: {
-    brandList() {
-      return this.supplierInfo.shopInfo.map((item) => item.brandName).join('/')
+    eidtText() {
+      const eidtText = ['添加品牌', '修改品牌', '修改logo', '修改联系人']
+      return eidtText[this.editType]
     }
   },
   created() {
@@ -76,6 +183,86 @@ export default {
         console.log(res)
         this.supplierInfo = res.data
       })
+    },
+    // 品牌信息变化
+    onBrandFormChange(data) {
+      this.brandModel = data
+    },
+    // 编辑品牌事件
+    onEditBrand(type, row, index) {
+      this.editType = type === 'add' ? 0 : 1
+      this.brandEditType = type
+      this.brandEditIndex = index
+      this.brandModel = type === 'add' ? generateBrandInfo() : row
+      this.editVisible = true
+    },
+    // 删除品牌
+    onRemoveBrand(index) {
+      this.brandList.splice(index, 1)
+    },
+    // 品牌信息确认提交
+    async onBrandSubmit() {
+      try {
+        await this.$refs.brandEditForm.validate()
+        if (this.brandEditType === 'add') {
+          this.brandList.push(deepClone(this.brandModel))
+        } else {
+          this.brandList.splice(this.brandEditIndex, 1, deepClone(this.brandModel))
+        }
+        this.editVisible = false
+      } catch (error) {
+        console.log(error)
+      }
+    },
+    // 编辑取消
+    onCancel() {
+      this.editVisible = false
+    },
+    // 编辑提交
+    onSubmit() {
+      const action = {
+        0: this.onBrandSubmit,
+        1: this.onBrandSubmit,
+        2: this.onLogoSubmit,
+        3: this.onContactSubmit
+      }
+      action[this.editType]()
+    },
+    // logo编辑
+    onEditLogo() {
+      this.editType = 2
+      this.editVisible = true
+    },
+    // logo编辑提交
+    async onLogoSubmit() {
+      try {
+        await this.$refs.submitForm.validate()
+      } catch (error) {
+        console.log(error)
+      }
+    },
+    // 编辑联系人
+    onEditContactName() {
+      this.editType = 3
+      this.editVisible = true
+    },
+    // 联系人编辑提交
+    async onContactSubmit() {
+      try {
+        await this.$refs.submitForm.validate()
+      } catch (error) {
+        console.log(error)
+      }
+    },
+    // 供应商logo上传成功
+    onUploadLogoSuccess({ response, file, fileList }) {
+      this.logoImageList = fileList
+      this.formData.logo = response.data
+    },
+    // 移除供应商logo
+    onRemoveLogoImage() {
+      this.logoImageList = []
+      this.formData.logo = ''
     }
   }
 }
@@ -105,4 +292,16 @@ export default {
   font-size: 24px;
   font-weight: bold;
 }
+.tag-list {
+  margin-top: -10px;
+  .el-tag {
+    cursor: pointer;
+    margin-right: 8px;
+    margin-top: 8px;
+  }
+}
+
+.el-divider {
+  margin: 16px 0;
+}
 </style>