瀏覽代碼

认证通v1.7.2版本接口调试

yuwenjun1997 2 年之前
父節點
當前提交
1882c15594

+ 10 - 0
src/api/auth.js

@@ -180,3 +180,13 @@ export function resetClubUserPassword(data) {
     data
   })
 }
+
+// 重置密码
+export function setStarClub(data) {
+  return request({
+    url: '/auth/star',
+    method: 'post',
+    data
+  })
+}
+

+ 1 - 1
src/api/brand.js

@@ -3,7 +3,7 @@ import request from '@/utils/request'
 // 品牌列表
 export function fetchBrandList(params) {
   return request({
-    url: '/shop/brand/list',
+    url: '/shop/info/list',
     method: 'get',
     params
   })

+ 16 - 0
src/api/product.js

@@ -116,3 +116,19 @@ export function auditProductCate(data) {
     data
   })
 }
+// 设备sn码列表
+export function fetchProductSnList(params) {
+  return request({
+    url: '/auth/product/sn/list',
+    method: 'get',
+    params
+  })
+}
+// 通过sn码获取设备信息
+export function fetchDetialBySnCode(params) {
+  return request({
+    url: '/auth/product/info',
+    method: 'get',
+    params
+  })
+}

+ 1 - 1
src/store/getters.js

@@ -24,7 +24,7 @@ const getters = {
   proxyState: state => state.proxy.proxyState,
   isChangeProxy: state => state.proxy.isChangeProxy,
   shopType: state => state.user.shopType,
-  brandId: state => state.user.brandId,
+  infoId: state => state.user.infoId,
   socketState: state => state.webSocket.socketState,
   messageList: state => state.webSocket.messageList
 }

+ 1 - 1
src/store/modules/proxy.js

@@ -9,7 +9,7 @@ const mutations = {
   OPEN_PROXY: (state, proxy) => {
     state.proxyInfo = {
       authUserId: proxy.authUserId,
-      brandId: proxy.brandId,
+      infoId: proxy.infoId,
       name: proxy.name,
       shopStatus: proxy.shopStatus ? 1 : 0,
       shopType: proxy.shopType,

+ 2 - 2
src/store/modules/user.js

@@ -11,7 +11,7 @@ const state = {
   authUserId: '',
   userIdentity: '',
   shopType: '',
-  brandId: '',
+  infoId: '',
   loginAccount: '',
   mobile: '',
   vipStatus: '',
@@ -30,7 +30,7 @@ const mutations = {
     state.authUserId = userInfo.authUserId || ''
     state.userIdentity = userInfo.userIdentity || ''
     state.shopType = userInfo.shopType || ''
-    state.brandId = userInfo.brandId || ''
+    state.infoId = userInfo.infoId || ''
     state.loginAccount = userInfo.loginAccount || ''
     state.mobile = userInfo.mobile || ''
     state.vipStatus = userInfo.vipStatus || ''

+ 1 - 1
src/views/admin/audit/club/index.vue

@@ -92,7 +92,7 @@ export default {
     return {
       listQuery: {
         listType: 2,
-        brandId: '', // 品牌id
+        infoId: '', // 品牌id
         linkMan: '', // 联系人
         mobile: '', // 手机号
         pageNum: 0, // 页码

+ 1 - 1
src/views/admin/audit/device/index.vue

@@ -92,7 +92,7 @@ export default {
     return {
       listQuery: {
         listType: 6,
-        brandId: '', // 品牌id
+        infoId: '', // 品牌id
         linkMan: '', // 联系人
         mobile: '', // 手机号
         pageNum: 0, // 页码

+ 1 - 1
src/views/admin/audit/material/index.vue

@@ -102,7 +102,7 @@ export default {
       total: 0,
       listQuery: {
         listType: 3,
-        brandId: '', // 品牌id
+        infoId: '', // 品牌id
         linkMan: '', // 联系人
         mobile: '', // 手机号
         pageNum: 1, // 页码

+ 1 - 1
src/views/admin/audit/personnel/index.vue

@@ -91,7 +91,7 @@ export default {
     return {
       listQuery: {
         listType: 4,
-        brandId: '', // 品牌id
+        infoId: '', // 品牌id
         linkMan: '', // 联系人
         mobile: '', // 手机号
         pageNum: 0, // 页码

+ 1 - 1
src/views/admin/logistics-licensed/components/supplier-list.vue

@@ -109,7 +109,7 @@ export default {
       tableKey: '',
       total: 0, // 条数统计
       listQuery: {
-        brandId: '', // 品牌id
+        infoId: '', // 品牌id
         linkMan: '', // 联系人
         mobile: '', // 手机号
         pageNum: 0, // 页码

+ 1 - 1
src/views/admin/settings/auth-card/index.vue

@@ -208,7 +208,7 @@ export default {
       try {
         const res = await fetchSupplierList({
           listType: 1,
-          brandId: '', // 品牌id
+          infoId: '', // 品牌id
           linkMan: '', // 联系人
           mobile: '', // 手机号
           pageNum: 1, // 页码

+ 14 - 14
src/views/admin/supplier/edit_old.vue

@@ -26,10 +26,10 @@
       </el-form-item>
 
       <template v-if="submitForm.shopType === 1">
-        <el-form-item clearable label="供应商名称:" prop="brandId">
+        <el-form-item clearable label="供应商名称:" prop="infoId">
           <el-select
             v-if="editType === 'add'"
-            v-model="submitForm.brandId"
+            v-model="submitForm.infoId"
             placeholder="请选择品牌"
             style="width: 100%"
             filterable
@@ -170,9 +170,9 @@
     <!-- 供应商添加品牌的对话框 -->
     <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-form-item label="选择品牌:" prop="infoId">
           <el-select
-            v-model="subForm.brandId"
+            v-model="subForm.infoId"
             placeholder="请选择品牌"
             style="width: 100%"
             filterable
@@ -311,7 +311,7 @@ export default {
       submitForm: {
         shopType: 1, // 供应商类型
         shopName: '', // 供应商名称
-        brandId: '', // 品牌id
+        infoId: '', // 品牌id
         mobile: '', // 手机号
         linkMan: '', // 联系人
         countryId: 1, // 产地id
@@ -328,7 +328,7 @@ export default {
       },
       // 表单2
       subForm: {
-        brandId: '', // 品牌id
+        infoId: '', // 品牌id
         countryId: 1, // 产地id
         brandAuthLogo: '', // 品牌logo
         securityLink: '', // 官网认证链接
@@ -356,7 +356,7 @@ export default {
           { required: true, message: '代理品牌不能为空', tigger: 'change', type: 'number' },
           { validator: validShopInfo, tigger: 'change' }
         ],
-        brandId: { required: true, message: '品牌不能为空', tigger: 'change', type: 'number' },
+        infoId: { 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' }, // 声明图片
@@ -384,7 +384,7 @@ export default {
       }
 
       if (this.brandTagClickType === 'edit') {
-        const exclude = this.selectedBrandIds.filter((id) => id !== this.editBrandInfo.brandId)
+        const exclude = this.selectedBrandIds.filter((id) => id !== this.editBrandInfo.infoId)
         return this.brandList.filter((item) => exclude.indexOf(item.id) === -1)
       }
 
@@ -393,7 +393,7 @@ export default {
     // 文件上传参数
     uploadParams() {
       return {
-        brandId: this.currentBrand.id,
+        infoId: this.currentBrand.id,
         authUserId: this.id
       }
     },
@@ -439,7 +439,7 @@ export default {
       if (this.selectedShopType === 1) {
         // 品牌方
         const shopInfo = info.shopInfo[0]
-        this.submitForm.brandId = shopInfo.brandId
+        this.submitForm.infoId = shopInfo.infoId
         this.submitForm.countryId = shopInfo.countryId
         this.submitForm.brandAuthLogo = shopInfo.brandAuthLogo
         this.submitForm.securityLink = shopInfo.securityLink
@@ -453,7 +453,7 @@ export default {
         // 代理商
         this.supplierBrands = info.shopInfo.map((item) => {
           item.uuid = ++uuid
-          this.selectedBrandIds.push(item.brandId)
+          this.selectedBrandIds.push(item.infoId)
           return item
         })
 
@@ -557,7 +557,7 @@ export default {
       params.shopName = this.currentBrand.name
       params.shopInfo = [
         {
-          brandId: this.submitForm.brandId,
+          infoId: this.submitForm.infoId,
           countryId: this.submitForm.countryId,
           brandAuthLogo: this.submitForm.brandAuthLogo,
           securityLink: this.submitForm.securityLink,
@@ -597,7 +597,7 @@ export default {
       this.$nextTick(() => {
         this.editBrandInfo = row
         // 设置选中品牌信息
-        this.currentBrand.id = row.brandId
+        this.currentBrand.id = row.infoId
         this.currentBrand.name = row.brandName
         this.currentBrand.authLogo = row.brandAuthLogo
         this.statementFileName = row.statementFileName
@@ -628,7 +628,7 @@ export default {
     // 移除品牌
     handleRemoveBrand(row) {
       // 从已选品牌id列表中移除
-      this.selectedBrandIds.splice(this.selectedBrandIds.indexOf(row.brandId), 1)
+      this.selectedBrandIds.splice(this.selectedBrandIds.indexOf(row.infoId), 1)
       // 从已添加品牌列表中移除
       const findIndex = this.supplierBrands.findIndex((item) => item.uuid === row.uuid)
       this.supplierBrands.splice(findIndex, 1)

+ 1 - 1
src/views/admin/supplier/index.vue

@@ -127,7 +127,7 @@ export default {
       tableKey: '',
       total: 0, // 条数统计
       listQuery: {
-        brandId: '', // 品牌id
+        infoId: '', // 品牌id
         linkMan: '', // 联系人
         mobile: '', // 手机号
         pageNum: 0, // 页码

+ 1 - 1
src/views/normal/club/cate/configs/index.js

@@ -3,7 +3,7 @@ export const tipList = ['例如:品牌', '例如:尺寸', '例如:功率',
 export const resetFormData = () => ({
   productTypeId: '',
   authUserId: '',
-  brandId: '',
+  infoId: '',
   name: '',
   image: '',
   createBy: '',

+ 5 - 5
src/views/normal/club/cate/edit.vue

@@ -14,9 +14,9 @@
           @remove="onUploadImageRemove"
         />
       </el-form-item>
-      <el-form-item v-if="shopType === 2" label="所属品牌:" prop="brandId">
-        <el-select v-model="formData.brandId" placeholder="请选择品牌" style="width: 100%" filterable clearable>
-          <el-option v-for="item in brandList" :key="item.id" :label="item.name" :value="item.id" />
+      <el-form-item v-if="shopType === 2" label="所属品牌:" prop="infoId">
+        <el-select v-model="formData.infoId" placeholder="请选择品牌" style="width: 100%" filterable clearable>
+          <el-option v-for="item in brandList" :key="item.infoId" :label="item.brandName" :value="item.infoId" />
         </el-select>
       </el-form-item>
       <el-form-item label="相关参数:" prop="paramList">
@@ -77,7 +77,7 @@ export default {
           { required: true, message: '请填写设备参数', trigger: ['change'] },
           { validator: paramListValidate, trigger: ['change'] }
         ],
-        brandId: [{ required: true, validator: valideBrandId, trigger: 'change' }]
+        infoId: [{ required: true, validator: valideBrandId, trigger: 'change' }]
       },
       brandList: [],
       productImageList: []
@@ -119,7 +119,7 @@ export default {
       this.formData.authUserId = this.authUserId
       this.formData.createBy = this.authUserId
       if (this.shopType === 1) {
-        this.formData.brandId = this.proxyInfo?.brandId || this.brandId || ''
+        this.formData.infoId = this.proxyInfo?.infoId || this.infoId || ''
       }
       const data = {
         ...this.formData,

+ 125 - 131
src/views/normal/club/device/edit.vue

@@ -1,28 +1,16 @@
 <template>
   <div v-loading="isLoading" class="addProduct page-form-container">
     <el-form ref="addFormRef" label-width="130px" class="addForm" :model="formData" :rules="rules">
-      <!--
-      <el-form-item label="设备名称:" prop="productName">
-        <el-input v-model="formData.productName" placeholder="建议输入30个字符效果最佳" show-word-limit maxlength="50" />
-      </el-form-item>
-      -->
-
       <el-form-item label="认证方式:">
-        <el-radio-group v-model="formData.authType">
+        <el-radio-group v-model="formData.authType" @change="onAuthTypeChange">
           <el-radio :label="1">新设备认证</el-radio>
           <el-radio :label="2">关联已认证设备</el-radio>
         </el-radio-group>
       </el-form-item>
 
-      <template v-if="formData.authType === 1">
+      <template v-if="formData.authType === 1 || (formData.authType === 2 && formData.snCode)">
         <el-form-item label="设备名称:" prop="productTypeId">
-          <el-select
-            v-model="formData.productTypeId"
-            filterable
-            placeholder="选择设备"
-            style="width: 100%"
-            @change="onProductTypeIdChange"
-          >
+          <el-select v-model="formData.productTypeId" filterable placeholder="选择设备" style="width: 100%" clearable>
             <el-option
               v-for="item in deviceList"
               :key="item.productTypeId"
@@ -34,18 +22,32 @@
       </template>
 
       <el-form-item label="设备SN码:" prop="snCode">
-        <el-input v-model="formData.snCode" placeholder="请输入设备SN码" />
+        <template v-if="formData.authType === 1">
+          <el-input v-model="formData.snCode" placeholder="请输入设备SN码" />
+        </template>
+        <template v-else>
+          <el-select
+            v-model="formData.snCode"
+            filterable
+            placeholder="请选择设备SN码"
+            style="width: 100%"
+            clearable
+            @change="onSnCodeChange"
+          >
+            <el-option v-for="code in productSnList" :key="code" :label="code" :value="code" />
+          </el-select>
+        </template>
       </el-form-item>
 
-      <template v-if="formData.authType === 1">
+      <template v-if="formData.authType === 1 || (formData.authType === 2 && formData.snCode)">
         <!-- **************** 新方法配置授权牌 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 v-model="formData.certificateImageType" size="mini" @change="onCertificateImageTypeChange">
+            <el-radio :label="1" border>模板库生成</el-radio>
+            <el-radio :label="2" border>自定义上传</el-radio>
           </el-radio-group>
           <div style="margin-top: 12px">
-            <template v-if="formData.addQrCodeFlag === 1">
+            <template v-if="formData.certificateImageType === 2">
               <upload-image
                 tip="建议尺寸:150px * 112px"
                 :image-list="certificateImageList"
@@ -55,37 +57,12 @@
               />
               <el-input v-model="formData.certificateImage" class="hiddenInput" />
             </template>
-            <el-image v-else style="width: 148px; height: 148px" />
+            <template v-else>
+              <preview-image v-if="formData.certificateImage" :src="formData.certificateImage" />
+            </template>
           </div>
         </el-form-item>
 
-        <!-- **************** 新方法配置授权牌 End ******************* -->
-
-        <!-- **************** 旧方法配置授权牌 START ******************* -->
-        <!-- 上传授权牌 -->
-        <!-- <el-form-item label="授权牌:" prop="certificateImage">
-        <upload-image
-          tip="建议尺寸:542px * 546px"
-          :image-list="certificateImageList"
-          :before-upload="beforeCertificateImageUpload"
-          @success="uploadCertificateImageSuccess"
-          @remove="handleCertificateImageRemove"
-        />
-        <el-input v-model="formData.certificateImage" class="hiddenInput" />
-      </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="选择模板:">
-        <auth-card-template v-model="formData.addTemplateType" :image-list="certificateImageList" />
-      </el-form-item> -->
-        <!-- **************** 旧方法配置授权牌 END ******************* -->
-
         <el-form-item label="购买渠道:">
           <el-input v-model="formData.purchaseWay" placeholder="请输入购买渠道" />
         </el-form-item>
@@ -112,10 +89,15 @@
 
 <script>
 import UploadImage from '@/components/UploadImage'
-import { saveProduct, getProductById, fetchProductSelectList } from '@/api/product'
+import {
+  saveProduct,
+  getProductById,
+  fetchProductSelectList,
+  fetchProductSnList,
+  fetchDetialBySnCode
+} from '@/api/product'
 import { mapGetters } from 'vuex'
 import { isSnCode } from '@/utils/validate'
-// import AuthCardTemplate from '@/views/components/AuthCardTemplate/index.vue'
 import { getStorage } from '@/utils/storage'
 export default {
   components: { UploadImage },
@@ -132,20 +114,18 @@ export default {
       paramsCount: 4,
       brandList: [],
       deviceList: [], // 设备列表
+      firstAuthType: '',
       formData: {
+        authId: '', //	授权id
+        relationId: '',
         authType: 1,
         authUserId: '',
-        authId: '', //	授权id
-        certificateImage: '', //	授权牌照
         createBy: '', //	创建人id
+        certificateImage: '', //	授权牌照
         // 	设备参数列表
         productId: '', //	授权设备id
-        productImage: '', //	设备图片
         snCode: '', //	设备SN码
-        status: 2, //	上架状态:0下线,1上线 2待审核
-        brandId: '',
-        addQrCodeFlag: '',
-        addTemplateType: 1,
+        certificateImageType: 1,
         productTypeId: '',
         purchaseWay: '', // 购买渠道
         invoiceImage: '' // 发票
@@ -155,95 +135,127 @@ export default {
         snCode: [{ required: true, message: 'SN码不能为空' }, { validator: valideSNcode }],
         productTypeId: [{ required: true, message: '设备名称不能为空', trigger: 'change' }]
       },
-
-      // 商品图片列表
-      productImageList: [],
       // 授权牌照图片列表
       certificateImageList: [],
       // 发票
-      invoiceImageList: []
+      invoiceImageList: [],
+      // sn list
+      productSnList: []
     }
   },
   computed: {
-    ...mapGetters(['authUserId', 'proxyInfo', 'shopType', 'brandId'])
+    ...mapGetters(['authUserId', 'proxyInfo', 'shopType', 'infoId'])
   },
   created() {
     this.editType = this.$route.query.type || 'add'
+    this.formData.relationId = this.$route.query.relationId
     this.formData.productId = this.$route.query.id
-    this.formData.authUserId = this.proxyInfo?.authUserId || this.authUserId
+    // this.formData.authUserId = this.proxyInfo?.authUserId || this.authUserId
     // 获取当前设备所属机构的id
     this.formData.authId = getStorage('device-setting-authId')
+    this.fetchDeviceList()
+    this.fetchProductSnList()
     if (this.editType === 'edit') {
-      this.initFormData()
-    }
-    // 如果供应商类型为品牌方,则自动设置品牌id
-    if (this.shopType === 1) {
-      this.formData.brandId = this.proxyInfo?.brandId || this.brandId || ''
+      this.fetchProductDetail()
     }
-    this.fetchDeviceList()
   },
   methods: {
-    // 设备分类修改
-    onProductTypeIdChange(value) {
-      const deviceInfo = this.deviceList.find((item) => item.productTypeId === value)
-      this.formData.productImage = deviceInfo.image
+    // 授权牌类型变化
+    onCertificateImageTypeChange() {
+      this.certificateImageList = []
+      this.formData.certificateImage = ''
     },
-    // 初始化表单数据
-    initFormData() {
-      this.isLoading = true
-      getProductById({ productId: this.formData.productId }).then((res) => {
-        console.log(res)
-        for (const key in res.data) {
-          if (Object.hasOwnProperty.call(res.data, key)) {
-            if (key === 'productTypeId') {
-              this.formData[key] = parseInt(res.data[key])
-            } else {
-              this.formData[key] = res.data[key]
-            }
-          }
-        }
-        this.initImageList()
 
+    // 设备sn码变化
+    async onSnCodeChange(snCode) {
+      if (!snCode) return
+      try {
+        const res = await fetchDetialBySnCode({ snCode })
+        this.formData.invoiceImage = res.data.invoiceImage
+        this.formData.purchaseWay = res.data.purchaseWay
+        this.formData.certificateImage = res.data.certificateImage
+        this.formData.certificateImageType = res.data.certificateImageType
+        this.formData.productTypeId = res.data.productTypeId
+        // this.formData.productId = res.data.productId
         if (res.data.invoiceImage) {
-          this.invoiceImageList = [{ name: '', url: res.data.invoiceImage }]
+          this.invoiceImageList = [{ name: '发票', url: res.data.invoiceImage }]
+        }
+        if (res.data.certificateImage) {
+          this.certificateImageList = [{ name: '授权牌图片', url: res.data.invoiceImage }]
         }
+      } catch (error) {
+        console.log(error)
+      }
+    },
 
-        this.isLoading = false
-      })
+    // 设备认证类型变化
+    onAuthTypeChange(authType) {
+      if (authType === 1) return
     },
 
-    // 初始化上传图片列表
-    initImageList() {
-      setTimeout(() => {
-        const certificateImage = this.formData.certificateImage
-        if (certificateImage) {
-          this.certificateImageList.push({ name: 'certificateImage', url: certificateImage })
-        }
-      }, 200)
+    // 获取设备sn码列表
+    async fetchProductSnList() {
+      try {
+        const res = await fetchProductSnList({ authId: this.formData.authId })
+        this.productSnList = res.data
+      } catch (error) {
+        console.log(error)
+      }
     },
 
-    // 模板选择
-    authCardChange(current) {
-      console.log(current)
-      this.formData.addTemplateType = current
+    // 获取设备信息
+    async fetchProductDetail() {
+      try {
+        this.isLoading = true
+        const { productId, relationId } = this.formData
+        const res = await getProductById({ productId, relationId })
+        this.initFormData(res.data)
+      } catch (error) {
+        console.log(error)
+      }
     },
 
-    // 提交表单
-    submit() {
-      this.$refs.addFormRef.validate((valide) => {
-        if (valide) {
-          this.save()
+    // 初始化表单数据
+    initFormData(data) {
+      for (const key in data) {
+        if (Object.hasOwnProperty.call(data, key)) {
+          if (key === 'productTypeId') {
+            this.formData[key] = parseInt(data[key])
+          } else {
+            this.formData[key] = data[key]
+          }
         }
-      })
+      }
+      if (data.invoiceImage) {
+        this.invoiceImageList = [{ name: '发票', url: data.invoiceImage }]
+      }
+      if (data.certificateImage) {
+        this.certificateImageList = [{ name: '授权牌图片', url: data.invoiceImage }]
+      }
+      this.firstAuthType = data.authType
+      this.isLoading = false
+    },
+
+    // 提交表单
+    async submit() {
+      try {
+        await this.$refs.addFormRef.validate()
+        this.onSave()
+      } catch (error) {
+        console.log(error)
+      }
     },
 
     // 保存表单数据
-    save() {
+    onSave() {
       this.isLoading = true
       // createBy先判断是否为代理操作,是就从代理数据中获取,否则直接获取当前登录用户的信息
       this.formData.createBy = this.proxyInfo?.authUserId || this.authUserId
-      this.formData.authUserId = this.proxyInfo?.authUserId || this.authUserId
-      this.formData.addQrCodeFlag = 0
+
+      if (this.firstAuthType === 2 && this.formData.authType === 1) {
+        this.formData.productId = ''
+      }
+
       saveProduct(this.formData)
         .then((res) => {
           if (res.code !== 0) return
@@ -274,23 +286,6 @@ export default {
       }
     },
 
-    // 产品图片上传
-    beforeProductImageUpload(file) {
-      const flag = file.size / 1024 / 1024 < 1
-      if (!flag) {
-        this.$message.error('上传产品图片大小不能超过 1MB!')
-      }
-      return flag
-    },
-    uploadProductImageSuccess({ response, file, fileList }) {
-      this.productImageList = fileList
-      this.formData.productImage = response.data
-    },
-    handleProductImageRemove({ file, fileList }) {
-      this.productImageList = fileList
-      this.formData.productImage = ''
-    },
-
     // 授权牌照上传
     beforeCertificateImageUpload(file) {
       const flag = file.size / 1024 / 1024 < 1
@@ -306,7 +301,6 @@ export default {
     handleCertificateImageRemove({ file, fileList }) {
       this.certificateImageList = fileList
       this.formData.certificateImage = ''
-      this.formData.addQrCodeFlag = 0
     },
 
     // 发票上传

+ 8 - 5
src/views/normal/club/device/index.vue

@@ -59,11 +59,11 @@
           <template v-if="row.auditStatus === 1">
             <template v-if="row.status === 0">
               <span style="margin-right: 10px" class="status danger">已下线</span>
-              <permission-button type="primary" size="mini" @click="handleChangeStatus(row)">上线</permission-button>
+              <permission-button type="primary" size="mini" @click="handleChangeStatus(row)">上</permission-button>
             </template>
             <template v-else>
               <span style="margin-right: 10px" class="status success">已上线</span>
-              <permission-button type="info" size="mini" @click="handleChangeStatus(row)">下线</permission-button>
+              <permission-button type="info" size="mini" @click="handleChangeStatus(row)">下</permission-button>
             </template>
           </template>
           <template v-else>
@@ -72,6 +72,9 @@
           </template>
         </template>
       </el-table-column>
+
+      <el-table-column label="扫码次数" align="center" prop="scanCount" width="80" />
+
       <el-table-column label="创建时间" class-name="status-col" width="160px" align="center">
         <template slot-scope="{ row }">
           <span>{{ row.createTime | formatTime }}</span>
@@ -81,17 +84,17 @@
       <el-table-column label="操作" align="center" width="240px" class-name="small-padding fixed-width">
         <template slot-scope="{ row }">
           <permission-button
-            type="default"
+            type="primary"
             size="mini"
-            @click="navigationTo(`device-edit?type=edit&id=${row.productId}`)"
+            @click="navigationTo(`device-edit?type=edit&id=${row.productId}&relationId=${row.relationId}`)"
           >
             编辑
           </permission-button>
-          <permission-button type="danger" size="mini" @click="handleRemoveProduct(row)"> 删除 </permission-button>
           <permission-button v-if="row.auditStatus === 1" type="primary" size="mini" @click="handleShowQRcode(row)">
             二维码
           </permission-button>
           <permission-button v-else type="info" size="mini" disabled> 二维码 </permission-button>
+          <permission-button type="danger" size="mini" @click="handleRemoveProduct(row)"> 删除 </permission-button>
         </template>
       </el-table-column>
     </el-table>

+ 49 - 27
src/views/normal/club/edit.vue

@@ -1,8 +1,8 @@
 <template>
   <div class="club-edit page-form-container">
     <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 label="机构名称:" prop="authParty">
+        <el-input v-model="formData.authParty" placeholder="请输入机构名称" clearable />
       </el-form-item>
       <el-form-item label="所在地区:" prop="address">
         <el-cascader
@@ -33,11 +33,18 @@
       </el-form-item>
 
       <el-form-item label="运营联系人:">
-        <el-input v-model="formData.mobile" placeholder="请输入运营联系人" clearable />
+        <el-input v-model="formData.linkMan" placeholder="请输入运营联系人" clearable />
       </el-form-item>
 
       <el-form-item label="运营联系人手机号:">
-        <el-input v-model="formData.mobile" placeholder="请输入运营联系人手机号" clearable />
+        <el-input
+          v-model="formData.linkMobile"
+          placeholder="请输入运营联系人手机号"
+          clearable
+          maxlength="11"
+          show-word-limit
+          @input="onMobileInput"
+        />
       </el-form-item>
 
       <el-form-item label="认证编号:" prop="authCode">
@@ -50,8 +57,8 @@
       <!-- <el-form-item label="手机号:" prop="userMobile">
         <el-input v-model="formData.userMobile" placeholder="请输入手机号" clearable maxlength="11" show-word-limit />
       </el-form-item> -->
-      <el-form-item label="机构logo:" prop="logoImage">
-        <el-input v-show="false" v-model="formData.logoImage" />
+      <el-form-item label="机构logo:" prop="logo">
+        <el-input v-show="false" v-model="formData.logo" />
         <upload-image
           tip="建议尺寸:242px * 242px"
           :image-list="logoList"
@@ -250,13 +257,14 @@ export default {
 
       area: '',
       formData: {
-        name: '',
+        relationId: '',
+        authParty: '',
         address: [],
         fullAddress: '',
         point: '',
         mobile: '',
         userMobile: '',
-        logoImage: '',
+        logo: '',
         banner: '',
         customFlag: 0,
         remarks: '',
@@ -269,15 +277,18 @@ export default {
         authDate: '',
         authImageType: '',
         authImageLogo: '',
-        authImage: ''
+        authImage: '',
+        // 新增运营人字段
+        linkMan: '',
+        linkMobile: ''
       },
       rules: {
-        name: [{ required: true, message: '机构名称不能为空', trigger: ['blur', 'change'] }],
+        authParty: [{ required: true, message: '机构名称不能为空', trigger: ['blur', 'change'] }],
         address: [{ required: true, message: '地址不能为空', trigger: 'change', type: 'array' }],
         fullAddress: [{ required: true, message: '详细不能为空', trigger: ['blur', 'change'] }],
         point: [{ required: true, validator: validatePoint, trigger: ['blur', 'change'] }],
         mobile: [{ required: true, validator: validateMobile, trigger: ['blur', 'change'] }],
-        logoImage: [{ required: true, message: '请上传机构logo', trigger: 'change' }],
+        logo: [{ required: true, message: '请上传机构logo', trigger: 'change' }],
         banner: [{ required: true, message: '请至少上传一张banner图片', trigger: 'change' }],
         remarks: [{ required: true, message: '店铺备注不能为空', trigger: 'blur' }],
         medicalLicenseImage: [{ required: true, message: '请上传医疗许可证', trigger: 'change' }],
@@ -358,11 +369,6 @@ export default {
       this.formData.point = `${lnglat.lng},${lnglat.lat}`
     },
 
-    // 自定义属性修改
-    custromizeFormChange(data) {
-      this.customValue = data.name
-    },
-
     // 获取地址
     initAddress() {
       return getAddress({
@@ -381,13 +387,14 @@ export default {
       if (!this.authId) return
       getAuthFormData({ authId: this.authId }).then((res) => {
         console.log(res)
-        this.formData.name = res.data.authParty
+        this.formData.authParty = res.data.authParty
 
         this.formData.fullAddress = res.data.address
         this.formData.point = res.data.lngAndLat
         this.formData.mobile = res.data.mobile
-        this.formData.logoImage = res.data.logo
+        this.formData.logo = res.data.logo
         this.formData.banner = res.data.bannerList.length || ''
+        this.formatDate.relationId = res.data.relationId
 
         this.formData.customFlag = res.data.customFlag
         this.formData.remarks = res.data.remarks
@@ -430,6 +437,10 @@ export default {
         if (res.data.authImage) {
           this.authImageList = [{ name: '自定义授权牌', url: res.data.authImage }]
         }
+
+        // 运营人相关
+        this.formData.linkMan = res.data.linkMan
+        this.formData.linkMobile = res.data.linkMobile
       })
     },
 
@@ -437,13 +448,11 @@ export default {
     submit() {
       this.$refs.submitForm.validate((valide) => {
         if (!valide) return
-
-        console.log(this.formData)
         const {
-          name: authParty,
+          authParty,
           address: [provinceId, cityId, townId],
           mobile,
-          logoImage: logo,
+          logo,
           point: lngAndLat,
           customFlag,
           remarks,
@@ -456,7 +465,9 @@ export default {
           authDate,
           authImageType,
           authImageLogo,
-          authImage
+          authImage,
+          linkMan,
+          linkMobile
         } = this.formData
 
         const authUserId = this.proxyInfo?.authUserId || this.authUserId
@@ -484,10 +495,17 @@ export default {
           authDate: authDate ? formatDate(authDate, 'yyyy.MM.DD') : '',
           authImageType,
           authImageLogo,
-          authImage
+          authImage,
+          linkMan,
+          linkMobile
         }
 
         data.bannerList = this.bannerList.map((item) => (item.response ? item.response.data : item.url))
+
+        // const data = deepClone(this.formatDate)
+        // const [provinceId, cityId, townId] = this.formData.address
+        // const lngAndLat = this.formData.point
+
         console.log(data)
         // return
         saveBrandAuth(data)
@@ -495,7 +513,7 @@ export default {
             const h = this.$createElement
             this.$notify.success({
               title: `修改授权机构`,
-              message: h('i', { style: 'color: #333' }, `已修改授权机构:"${this.formData.name}"`),
+              message: h('i', { style: 'color: #333' }, `已修改授权机构:"${this.formData.authParty}"`),
               duration: 3000
             })
             // this.$refs.submitForm.resetFields()
@@ -534,11 +552,11 @@ export default {
     // logo上传
     uploadLogoSuccess({ response, file, fileList }) {
       this.logoList = fileList
-      this.formData.logoImage = fileList[0].response.data
+      this.formData.logo = fileList[0].response.data
     },
     handleLogoRemove({ file, fileList }) {
       this.logoList = fileList
-      this.formData.logoImage = ''
+      this.formData.logo = ''
     },
     beforeLogoUpload(file) {
       const flag = file.size / 1024 < 500
@@ -630,6 +648,10 @@ export default {
     handleAuthImageLogoRemove({ file, fileList }) {
       this.authImageLogoList = fileList
       this.formData.authImageLogo = ''
+    },
+    // 输入手机号时
+    onMobileInput() {
+      this.formData.mobile = this.formData.mobile.replace(/[^\w\.\/]/gi, '')
     }
   }
 }

+ 20 - 7
src/views/normal/club/index.vue

@@ -25,7 +25,7 @@
       </div>
       <div class="filter-control">
         <span>明星机构</span>
-        <el-checkbox />
+        <el-checkbox v-model="listQuery.starFlag" :true-label="1" :false-label="null" @change="getList" />
       </div>
       <div class="filter-control">
         <permission-button type="primary" @click="getList">查询</permission-button>
@@ -84,11 +84,11 @@
         </template>
       </el-table-column>
 
-      <el-table-column label="扫码次数" align="center" prop="" width="80" />
+      <el-table-column label="扫码次数" align="center" prop="scanCount" width="80" />
 
-      <el-table-column label="明星机构" align="center" prop="" width="80">
-        <template>
-          <el-checkbox />
+      <el-table-column label="明星机构" align="center" width="80">
+        <template slot-scope="{ row }">
+          <el-checkbox v-model="row.starFlag" :true-label="1" :false-label="0" @change="onStarChange(row, $event)" />
         </template>
       </el-table-column>
 
@@ -164,7 +164,7 @@
 import FileUpload from '@/components/FileUpload'
 import QrcodeClub from '@/components/QrcodeClub'
 import { ClubListSelector } from '@/views/components'
-import { fecthAuthList, changeAuthStatus, removeAuth, authImportExcel } from '@/api/auth'
+import { fecthAuthList, changeAuthStatus, removeAuth, authImportExcel, setStarClub } from '@/api/auth'
 import { mapGetters } from 'vuex'
 import { debounce, downloadWithUrl } from '@/utils/tools'
 import handleClipboard from '@/utils/clipboard'
@@ -187,7 +187,8 @@ export default {
         authUserId: '', // 供应商用户id
         pageNum: 1, // 页码
         pageSize: 10, // 分页
-        status: ''
+        status: '',
+        starFlag: null
       },
 
       improtDialogVisible: false,
@@ -227,6 +228,17 @@ export default {
     this.getList()
   },
   methods: {
+    // 明星机构设置
+    async onStarChange(row, value) {
+      console.log(row)
+      try {
+        await setStarClub({ authId: row.authId, starFlag: value })
+        this.$message.success('操作成功')
+      } catch (error) {
+        console.log(error)
+      }
+    },
+
     // 机构二维码
     createClubQrcode(item) {
       this.clubInfo = item
@@ -431,6 +443,7 @@ export default {
     },
     // 获取授权列表
     getList() {
+      console.log(this.listQuery)
       this.listLoading = true
       fecthAuthList(this.listQuery)
         .then((response) => {