Browse Source

bug修改

yuwenjun 3 years ago
parent
commit
210912966d

+ 26 - 26
src/api/auth.js

@@ -2,45 +2,45 @@ import request from '@/utils/request'
 
 
 // 授权列表
 // 授权列表
 export function fecthAuthList(params) {
 export function fecthAuthList(params) {
-    return request({
-        url: '/auth/list',
-        method: 'get',
-        params
-    })
+  return request({
+    url: '/auth/list',
+    method: 'get',
+    params
+  })
 }
 }
 
 
 // 添加品牌授权
 // 添加品牌授权
 export function saveBrandAuth(data) {
 export function saveBrandAuth(data) {
-    return request({
-        url: '/auth/save',
-        method: 'post',
-        data
-    })
+  return request({
+    url: '/auth/save',
+    method: 'post',
+    data
+  })
 }
 }
 
 
 // 修改授权状态
 // 修改授权状态
 export function changeAuthStatus(data) {
 export function changeAuthStatus(data) {
-    return request({
-        url: '/auth/update/status',
-        method: 'post',
-        data
-    })
+  return request({
+    url: '/auth/update/status',
+    method: 'post',
+    data
+  })
 }
 }
 
 
 // 删除授权
 // 删除授权
 export function removeAuth(data) {
 export function removeAuth(data) {
-    return request({
-        url: '/auth/delete',
-        method: 'post',
-        data
-    })
+  return request({
+    url: '/auth/delete',
+    method: 'post',
+    data
+  })
 }
 }
 
 
 // 审核状态
 // 审核状态
 export function auditAuth(data) {
 export function auditAuth(data) {
-    return request({
-        url: '/auth/audit',
-        method: 'post',
-        data
-    })
-}
+  return request({
+    url: '/auth/audit',
+    method: 'post',
+    data
+  })
+}

+ 32 - 33
src/api/product.js

@@ -2,55 +2,54 @@ import request from '@/utils/request'
 
 
 // 获取商品列表
 // 获取商品列表
 export function getProdList(params) {
 export function getProdList(params) {
-    return request({
-        url: '/auth/product/list',
-        method: 'get',
-        params
-    })
+  return request({
+    url: '/auth/product/list',
+    method: 'get',
+    params
+  })
 }
 }
 
 
 // 添加商品
 // 添加商品
 export function saveProduct(data) {
 export function saveProduct(data) {
-    return request({
-        url: '/auth/product/save',
-        method: 'post',
-        data
-    })
+  return request({
+    url: '/auth/product/save',
+    method: 'post',
+    data
+  })
 }
 }
 
 
 // 根据id获取商品信息
 // 根据id获取商品信息
 export function getProductById(params) {
 export function getProductById(params) {
-    return request({
-        url: '/auth/product/form/data',
-        method: 'get',
-        params
-    })
+  return request({
+    url: '/auth/product/form/data',
+    method: 'get',
+    params
+  })
 }
 }
 
 
 // 修改商品状态
 // 修改商品状态
 export function setProductStatus(data) {
 export function setProductStatus(data) {
-    return request({
-        url: '/auth/product/update/status',
-        method: 'post',
-        data
-    })
+  return request({
+    url: '/auth/product/update/status',
+    method: 'post',
+    data
+  })
 }
 }
 
 
 // 删除商品
 // 删除商品
 export function removeProduct(data) {
 export function removeProduct(data) {
-    return request({
-        url: '/auth/product/delete',
-        method: 'post',
-        data
-    })
+  return request({
+    url: '/auth/product/delete',
+    method: 'post',
+    data
+  })
 }
 }
 
 
-
-//审核商品 /auth/product/audit
+// 审核商品 /auth/product/audit
 export function auditProduct(data) {
 export function auditProduct(data) {
-    return request({
-        url: '/auth/product/audit',
-        method: 'post',
-        data
-    })
-}
+  return request({
+    url: '/auth/product/audit',
+    method: 'post',
+    data
+  })
+}

+ 1 - 0
src/views/login/index.vue

@@ -88,6 +88,7 @@ export default {
   created() {
   created() {
     // window.addEventListener('storage', this.afterQRScan)
     // window.addEventListener('storage', this.afterQRScan)
     const isRefresh = this.$store.getters.isRefresh
     const isRefresh = this.$store.getters.isRefresh
+    console.log(isRefresh)
     if (!isRefresh) {
     if (!isRefresh) {
       window.location.reload()
       window.location.reload()
     }
     }

+ 8 - 8
src/views/supplier/auth/index.vue

@@ -73,17 +73,17 @@
         </template>
         </template>
       </el-table-column>
       </el-table-column>
 
 
-      <el-table-column v-if="userIdentity===2 || proxyInfo!==null" label="上线状态" width="140px" align="center">
+      <el-table-column label="上线状态" width="140px" align="center">
         <template slot-scope="{row}">
         <template slot-scope="{row}">
           <!-- 只有审核通过了才能操作上下线 auditStatus :审核状态 -->
           <!-- 只有审核通过了才能操作上下线 auditStatus :审核状态 -->
           <template v-if="row.auditStatus === 1">
           <template v-if="row.auditStatus === 1">
             <template v-if="row.status === 0">
             <template v-if="row.status === 0">
               <span style="margin-right:10px;" class="status danger">已下线</span>
               <span style="margin-right:10px;" class="status danger">已下线</span>
-              <el-button type="primary" size="mini" @click="handleChangeStatus(row)">上线</el-button>
+              <el-button v-if="userIdentity===2 || proxyInfo!==null" type="primary" size="mini" @click="handleChangeStatus(row)">上线</el-button>
             </template>
             </template>
             <template v-else>
             <template v-else>
               <span style="margin-right:10px;" class="status success ">已上线</span>
               <span style="margin-right:10px;" class="status success ">已上线</span>
-              <el-button type="info" size="mini" plain @click="handleChangeStatus(row)">下线</el-button>
+              <el-button v-if="userIdentity===2 || proxyInfo!==null" type="info" size="mini" plain @click="handleChangeStatus(row)">下线</el-button>
             </template>
             </template>
           </template>
           </template>
           <template v-else>
           <template v-else>
@@ -132,12 +132,12 @@
         <el-form-item label="授权机构:" prop="authParty">
         <el-form-item label="授权机构:" prop="authParty">
           <el-input v-model="addAuthFormData.authParty" placeholder="请输入授权机构名称" />
           <el-input v-model="addAuthFormData.authParty" placeholder="请输入授权机构名称" />
         </el-form-item>
         </el-form-item>
-        <el-form-item label="上线状态:">
+        <!-- <el-form-item label="上线状态:">
           <el-select v-model="addAuthFormData.status">
           <el-select v-model="addAuthFormData.status">
             <el-option label="上线" :value="1" />
             <el-option label="上线" :value="1" />
             <el-option label="下线" :value="0" />
             <el-option label="下线" :value="0" />
           </el-select>
           </el-select>
-        </el-form-item>
+        </el-form-item> -->
       </el-form>
       </el-form>
       <span slot="footer" class="dialog-footer">
       <span slot="footer" class="dialog-footer">
         <el-button @click="showAddAuthDialog = false">取 消</el-button>
         <el-button @click="showAddAuthDialog = false">取 消</el-button>
@@ -187,7 +187,7 @@ export default {
         authUserId: '', // 供应商用户id
         authUserId: '', // 供应商用户id
         authParty: '', // 授权机构
         authParty: '', // 授权机构
         createBy: '', // 创建人id
         createBy: '', // 创建人id
-        status: 1 // 授权状态 0下架,1上架
+        status: 2 // 授权状态 0下线,1上线  2待审核
       },
       },
       addAuthFormRules: {
       addAuthFormRules: {
         authParty: [
         authParty: [
@@ -238,11 +238,11 @@ export default {
     checkAuditFailedList(data) {
     checkAuditFailedList(data) {
       this.auditFailedList = data.filter(item => item.auditStatus === 0)
       this.auditFailedList = data.filter(item => item.auditStatus === 0)
       console.log(this.auditFailedList)
       console.log(this.auditFailedList)
-      if (this.auditFailedList.length > 0 && this.auditNoticeFlag) {
+      if (this.auditFailedList.length > 0 && this.auditNoticeFlag && (this.userIdentity !== 1 || this.proxyInfo !== null)) {
         this.$notify.info({
         this.$notify.info({
           title: '消息通知',
           title: '消息通知',
           dangerouslyUseHTMLString: true,
           dangerouslyUseHTMLString: true,
-          message: `共有<b style="color:red">${this.auditFailedList.length}</b>个授权机构未能通过审核,请查看原因并及时修改!`,
+          message: `共有<b style="color:red">${this.auditFailedList.length}</b>个授权机构未能通过审核,请查看原因并及时修改!`,
           duration: 3000
           duration: 3000
         })
         })
         this.auditNoticeFlag = false
         this.auditNoticeFlag = false

+ 3 - 3
src/views/supplier/product/add.vue

@@ -61,7 +61,7 @@
           @click="handleAddParam"
           @click="handleAddParam"
         >添加参数</el-button>
         >添加参数</el-button>
       </el-form-item>
       </el-form-item>
-      <el-form-item label="上线状态:">
+      <!-- <el-form-item label="上线状态:">
         <el-select
         <el-select
           v-model="formData.status"
           v-model="formData.status"
           placeholder="上线状态"
           placeholder="上线状态"
@@ -70,7 +70,7 @@
           <el-option label="上线" :value="1" />
           <el-option label="上线" :value="1" />
           <el-option label="下线" :value="0" />
           <el-option label="下线" :value="0" />
         </el-select>
         </el-select>
-      </el-form-item>
+      </el-form-item> -->
     </el-form>
     </el-form>
     <div class="submit-btn">
     <div class="submit-btn">
       <el-button type="primary" @click="submit">保存</el-button>
       <el-button type="primary" @click="submit">保存</el-button>
@@ -115,7 +115,7 @@ export default {
         productImage: '', //	商品图片
         productImage: '', //	商品图片
         productName: '', //	商品名称
         productName: '', //	商品名称
         snCode: '', //	商品SN码
         snCode: '', //	商品SN码
-        status: 1, //	上架状态:0下架,1上架
+        status: 2, //	上架状态:0下线,1上线 2待审核
         brandId: ''
         brandId: ''
       },
       },
       rules: {
       rules: {

+ 5 - 5
src/views/supplier/product/index.vue

@@ -75,17 +75,17 @@
         </template>
         </template>
       </el-table-column>
       </el-table-column>
 
 
-      <el-table-column v-if="userIdentity===2 || proxyInfo !== null" label="上线状态" width="140px" align="center">
+      <el-table-column label="上线状态" width="140px" align="center">
         <template slot-scope="{row}">
         <template slot-scope="{row}">
           <!-- 只有审核通过了才能操作上下线 auditStatus :审核状态 -->
           <!-- 只有审核通过了才能操作上下线 auditStatus :审核状态 -->
           <template v-if="row.auditStatus === 1">
           <template v-if="row.auditStatus === 1">
             <template v-if="row.status === 0">
             <template v-if="row.status === 0">
               <span style="margin-right:10px;" class="status danger">已下线</span>
               <span style="margin-right:10px;" class="status danger">已下线</span>
-              <el-button type="primary" size="mini" @click="handleChangeStatus(row)">上线</el-button>
+              <el-button v-if="userIdentity===2 || proxyInfo !== null" type="primary" size="mini" @click="handleChangeStatus(row)">上线</el-button>
             </template>
             </template>
             <template v-else>
             <template v-else>
               <span style="margin-right:10px;" class="status success ">已上线</span>
               <span style="margin-right:10px;" class="status success ">已上线</span>
-              <el-button type="info" size="mini" plain @click="handleChangeStatus(row)">下线</el-button>
+              <el-button v-if="userIdentity===2 || proxyInfo !== null" type="info" size="mini" plain @click="handleChangeStatus(row)">下线</el-button>
             </template>
             </template>
           </template>
           </template>
           <template v-else>
           <template v-else>
@@ -254,11 +254,11 @@ export default {
     checkAuditFailedList(data) {
     checkAuditFailedList(data) {
       this.auditFailedList = data.filter(item => item.auditStatus === 0)
       this.auditFailedList = data.filter(item => item.auditStatus === 0)
       console.log(this.auditFailedList)
       console.log(this.auditFailedList)
-      if (this.auditFailedList.length > 0 && this.auditNoticeFlag) {
+      if (this.auditFailedList.length > 0 && this.auditNoticeFlag && (this.userIdentity !== 1 || this.proxyInfo !== null)) {
         this.$notify.info({
         this.$notify.info({
           title: '消息通知',
           title: '消息通知',
           dangerouslyUseHTMLString: true,
           dangerouslyUseHTMLString: true,
-          message: `共有<b style="color:red">${this.auditFailedList.length}</b>件商品未能通过审核,请查看原因并及时修改!`,
+          message: `共有<b style="color:red">${this.auditFailedList.length}</b>件商品未能通过审核,请查看原因并及时修改!`,
           duration: 3000
           duration: 3000
         })
         })
         this.auditNoticeFlag = false
         this.auditNoticeFlag = false

+ 9 - 3
src/views/supplier/user/add.vue

@@ -90,7 +90,7 @@
     </div>
     </div>
 
 
     <!-- 供应商添加品牌的对话框 -->
     <!-- 供应商添加品牌的对话框 -->
-    <el-dialog title="添加代理品牌" :visible.sync="showDialog" width="width" @closed="dialogClosed">
+    <el-dialog :title="dialogTitleText" :visible.sync="showDialog" width="width" @closed="dialogClosed">
       <el-form ref="formData2Ref" :model="formData2" label-width="120px" :rules="formDataRules">
       <el-form ref="formData2Ref" :model="formData2" label-width="120px" :rules="formDataRules">
 
 
         <el-form-item label="选择品牌:" prop="brandId">
         <el-form-item label="选择品牌:" prop="brandId">
@@ -223,6 +223,7 @@ export default {
       selectedShopType: 1,
       selectedShopType: 1,
       currentIndex: '',
       currentIndex: '',
       prevBrandId: '',
       prevBrandId: '',
+      dialogTitle: '添加',
       // 表单1
       // 表单1
       formData1: {
       formData1: {
         shopType: 1, // 供应商类型
         shopType: 1, // 供应商类型
@@ -282,6 +283,9 @@ export default {
       return this.brandList.filter(item => {
       return this.brandList.filter(item => {
         return !this.excludeBrandList.includes(item.id)
         return !this.excludeBrandList.includes(item.id)
       })
       })
+    },
+    dialogTitleText() {
+      return `${this.dialogTitle}代理品牌`
     }
     }
   },
   },
   watch: {
   watch: {
@@ -403,6 +407,7 @@ export default {
     },
     },
     // 添加品牌对话框
     // 添加品牌对话框
     handleShowDialog() {
     handleShowDialog() {
+      this.dialogTitle = '新增'
       this.showDialog = true
       this.showDialog = true
       this.resetFormData2()
       this.resetFormData2()
     },
     },
@@ -436,8 +441,8 @@ export default {
         this.showDialog = false
         this.showDialog = false
         const h = this.$createElement
         const h = this.$createElement
         this.$notify.success({
         this.$notify.success({
-          title: '新增品牌',
-          message: h('i', { style: 'color: #333' }, `新增品牌:"${shopInfo.brandName}"`),
+          title: `${this.dialogTitle}品牌`,
+          message: h('i', { style: 'color: #333' }, `${this.dialogTitle}品牌:"${shopInfo.brandName}"`),
           duration: 2000
           duration: 2000
         })
         })
       })
       })
@@ -455,6 +460,7 @@ export default {
     },
     },
     // 修改品牌
     // 修改品牌
     handleShowInfo(index) {
     handleShowInfo(index) {
+      this.dialogTitle = '修改'
       this.currentIndex = index
       this.currentIndex = index
       this.formData2 = this.supplierBrands[index]
       this.formData2 = this.supplierBrands[index]
       this.prevBrandId = this.supplierBrands[index].brandId // 保存当前的品牌id
       this.prevBrandId = this.supplierBrands[index].brandId // 保存当前的品牌id

+ 31 - 4
src/views/supplier/user/edit.vue

@@ -94,7 +94,7 @@
     </div>
     </div>
 
 
     <!-- 供应商添加品牌的对话框 -->
     <!-- 供应商添加品牌的对话框 -->
-    <el-dialog title="添加代理品牌" :visible.sync="showDialog" width="width" @closed="dialogClosed">
+    <el-dialog :title="dialogTitleText" :visible.sync="showDialog" width="width" @closed="dialogClosed">
       <el-form ref="formData2Ref" :model="formData2" label-width="120px" :rules="formDataRules">
       <el-form ref="formData2Ref" :model="formData2" label-width="120px" :rules="formDataRules">
 
 
         <el-form-item label="选择品牌:" prop="brandId">
         <el-form-item label="选择品牌:" prop="brandId">
@@ -103,6 +103,7 @@
             placeholder="请选择品牌"
             placeholder="请选择品牌"
             style="width: 100%"
             style="width: 100%"
             filterable
             filterable
+            :disabled="isBinded"
             @change="handleBrandChange"
             @change="handleBrandChange"
           >
           >
             <el-option v-for="item in brandListCopy" :key="item.id" :label="item.name" :value="item.id" />
             <el-option v-for="item in brandListCopy" :key="item.id" :label="item.name" :value="item.id" />
@@ -220,6 +221,7 @@ export default {
     }
     }
     return {
     return {
       id: '',
       id: '',
+      dialogTitle: '新增',
       isCheckout: true,
       isCheckout: true,
       isLoading: false,
       isLoading: false,
       dialogLoading: false,
       dialogLoading: false,
@@ -228,6 +230,8 @@ export default {
       selectedShopType: 1,
       selectedShopType: 1,
       currentIndex: '',
       currentIndex: '',
       prevBrandId: '',
       prevBrandId: '',
+      existProductBrandIds: '',
+      isBinded: false,
       // 表单1
       // 表单1
       formData1: {
       formData1: {
         shopType: 1, // 供应商类型
         shopType: 1, // 供应商类型
@@ -287,6 +291,9 @@ export default {
       return this.brandList.filter(item => {
       return this.brandList.filter(item => {
         return !this.excludeBrandList.includes(item.id)
         return !this.excludeBrandList.includes(item.id)
       })
       })
+    },
+    dialogTitleText() {
+      return `${this.dialogTitle}代理品牌`
     }
     }
   },
   },
   watch: {
   watch: {
@@ -318,6 +325,8 @@ export default {
         this.selectedShopType = res.data.shopType
         this.selectedShopType = res.data.shopType
         this.getBrandList(this.selectedShopType)
         this.getBrandList(this.selectedShopType)
         this.setFormData(res.data)
         this.setFormData(res.data)
+        this.existProductBrandIds = res.data.existProductBrandIds.split(',')
+        console.log(this.existProductBrandIds)
       }).finally(() => {
       }).finally(() => {
         this.isLoading = false
         this.isLoading = false
       })
       })
@@ -455,6 +464,7 @@ export default {
     },
     },
     // 添加品牌对话框
     // 添加品牌对话框
     handleShowDialog() {
     handleShowDialog() {
+      this.dialogTitle = '新增'
       this.showDialog = true
       this.showDialog = true
       this.resetFormData2()
       this.resetFormData2()
     },
     },
@@ -489,14 +499,24 @@ export default {
         this.showDialog = false
         this.showDialog = false
         const h = this.$createElement
         const h = this.$createElement
         this.$notify.success({
         this.$notify.success({
-          title: '新增品牌',
-          message: h('i', { style: 'color: #333' }, `新增品牌:"${shopInfo.brandName}"`),
+          title: `${this.dialogTitle}品牌`,
+          message: h('i', { style: 'color: #333' }, `${this.dialogTitle}品牌:"${shopInfo.brandName}"`),
           duration: 2000
           duration: 2000
         })
         })
       })
       })
     },
     },
     // 移除品牌
     // 移除品牌
     handleRemove(index) {
     handleRemove(index) {
+      // 如果该品牌已绑定商品,则不能删除
+      if (this.existProductBrandIds.includes(this.supplierBrands[index].brandId.toString())) {
+        this.$message({
+          message: `该品牌已绑定供应商商品,无法进行删除`,
+          type: 'warning',
+          duration: 1000
+        })
+        return
+      }
+
       const pop = this.supplierBrands.splice(index, 1)[0]
       const pop = this.supplierBrands.splice(index, 1)[0]
       this.removeExcludeBrand(pop.brandId)
       this.removeExcludeBrand(pop.brandId)
       const h = this.$createElement
       const h = this.$createElement
@@ -508,8 +528,13 @@ export default {
     },
     },
     // 修改品牌
     // 修改品牌
     handleShowInfo(index) {
     handleShowInfo(index) {
+      // 如果该品牌已绑定商品,则不能修改品牌
+      if (this.existProductBrandIds.includes(this.supplierBrands[index].brandId.toString())) {
+        this.isBinded = true
+      }
+      this.dialogTitle = '修改'
       this.currentIndex = index
       this.currentIndex = index
-      this.formData2 = this.supplierBrands[index]
+      this.formData2 = this.clone(this.supplierBrands[index])
       this.prevBrandId = this.supplierBrands[index].brandId // 保存当前的品牌id
       this.prevBrandId = this.supplierBrands[index].brandId // 保存当前的品牌id
       this.fileList2 = [{ name: '', url: this.formData2.brandAuthLogo }]
       this.fileList2 = [{ name: '', url: this.formData2.brandAuthLogo }]
       this.fileList3 = [{ name: '', url: this.formData2.statementImage }]
       this.fileList3 = [{ name: '', url: this.formData2.statementImage }]
@@ -523,6 +548,8 @@ export default {
         this.addExcludeBrand(this.prevBrandId)
         this.addExcludeBrand(this.prevBrandId)
         this.prevBrandId = ''
         this.prevBrandId = ''
       }
       }
+      this.isBinded = false
+      this.dialogTitle = '新增'
       this.resetFormData2()
       this.resetFormData2()
     },
     },
     // 声明类型切换
     // 声明类型切换