Преглед изворни кода

供应商端审核功能接口调试

yuwenjun1997 пре 2 година
родитељ
комит
60b7bd9dc0

+ 0 - 4
src/utils/config.js

@@ -1,4 +0,0 @@
-export const routePrefixMap = {
-  10: '/10/ldm',
-  12: '/12/ross'
-}

+ 2 - 2
src/views/components/ClubDetail/index.vue

@@ -29,11 +29,11 @@
     </div>
     <div class="row">
       <div class="col">运营联系人:</div>
-      <div class="col">{{ clubInfo.mobile }}</div>
+      <div class="col">{{ clubInfo.linkMan }}</div>
     </div>
     <div class="row">
       <div class="col">运营联系人手机号:</div>
-      <div class="col">{{ clubInfo.mobile }}</div>
+      <div class="col">{{ clubInfo.linkMobile }}</div>
     </div>
     <div class="row">
       <div class="col">logo:</div>

+ 26 - 24
src/views/normal/audit/club/components/club-list.vue

@@ -60,7 +60,7 @@
       <el-table-column label="操作" width="240px" align="center">
         <template slot-scope="{ row }">
           <permission-button
-            v-if="shopAuditStatus === 0"
+            v-if="row.shopAuditStatus === 0"
             type="primary"
             size="mini"
             style="margin-right: 5px"
@@ -85,7 +85,12 @@
     </el-table>
     <!-- 表格区域END -->
     <!-- 页码 -->
-    <pagination :total="total" :page.sync="listQuery.pageNum" :limit.sync="listQuery.pageSize" @pagination="getList" />
+    <pagination
+      :total="total"
+      :page.sync="listQuery.pageNum"
+      :limit.sync="listQuery.pageSize"
+      @pagination="fecthAuthList"
+    />
   </div>
 </template>
 
@@ -122,40 +127,37 @@ export default {
   },
   created() {
     this.listQuery.authUserId = this.authUserId
+    this.listQuery.shopAuditStatus = this.shopAuditStatus
     this.getList()
   },
   methods: {
     // 获取授权列表
     getList() {
-      this.listQuery.shopAuditStatus = this.shopAuditStatus
-      this.listLoading = true
-      fecthAuthList(this.listQuery)
-        .then((response) => {
-          const { list, total } = response.data
-          this.list = list
-          this.total = total
-        })
-        .finally(() => {
-          this.listLoading = false
-        })
+      this.listQuery.pageNum = 1
+      this.list = []
+      this.fecthAuthList()
     },
+
+    async fecthAuthList() {
+      try {
+        this.listLoading = true
+        const res = await fecthAuthList(this.listQuery)
+        this.list = res.data.list
+        this.total = res.data.total
+      } catch (error) {
+        console.log(error)
+      } finally {
+        this.listLoading = false
+      }
+    },
+
     onClick(row, type) {
       this.$router.push(`/supplier-audit/club/club-detail?authId=${row.authId}&type=${type}`)
     },
+
     indexMethod(index) {
       return index + this.listQuery.pageSize * (this.listQuery.pageNum - 1) + 1
     }
   }
 }
 </script>
-
-<style lang="scss" scoped>
-.auth-info {
-  .auth-name {
-    font-size: 16px;
-    padding-bottom: 25px;
-    border-bottom: 1px solid #ddd;
-    margin-bottom: 25px;
-  }
-}
-</style>

+ 25 - 20
src/views/normal/audit/club/components/device-list.vue

@@ -66,7 +66,12 @@
     </el-table>
     <!-- 表格区域END -->
     <!-- 页码 -->
-    <pagination :total="total" :page.sync="listQuery.pageNum" :limit.sync="listQuery.pageSize" @pagination="getList" />
+    <pagination
+      :total="total"
+      :page.sync="listQuery.pageNum"
+      :limit.sync="listQuery.pageSize"
+      @pagination="fetchProductList"
+    />
   </div>
 </template>
 
@@ -97,39 +102,39 @@ export default {
   },
   created() {
     this.listQuery.authId = this.$route.query.authId
+    this.listQuery.shopAuditStatus = this.shopAuditStatus
     this.getList()
   },
   methods: {
-    // 过滤列表
-    handleFilter() {},
     // 获取列表信息
     getList() {
-      this.listQuery.shopAuditStatus = this.shopAuditStatus
-      this.listLoading = true
-      getProdList(this.listQuery)
-        .then((res) => {
-          if (res.code !== 0) return
-          this.total = res.data.total
-          this.list = res.data.list
-        })
-        .finally(() => {
-          this.listLoading = false
-        })
+      this.listQuery.pageNum = 1
+      this.list = []
+      this.fetchProductList()
     },
+
+    async fetchProductList() {
+      try {
+        this.listLoading = true
+        const res = await getProdList(this.listQuery)
+        this.total = res.data.total
+        this.list = res.data.list
+      } catch (error) {
+        console.log(error)
+      } finally {
+        this.listLoading = false
+      }
+    },
+
     onClick(row, type) {
       this.$router.push(
         `/supplier-audit/club/device-detail?relationId=${row.relationId}&productId=${row.productId}&authId=${this.listQuery.authId}&type=${type}`
       )
     },
+
     indexMethod(index) {
       return index + this.listQuery.pageSize * (this.listQuery.pageNum - 1) + 1
     }
   }
 }
 </script>
-
-<style lang="scss" scoped>
-.el-table .cell {
-  overflow: visible;
-}
-</style>

+ 1 - 6
src/views/normal/audit/club/device/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-    <el-tabs v-model="activeName" @tab-click="handleClick">
+    <el-tabs v-model="activeName">
       <el-tab-pane label="未审核" name="first">
         <device-list v-if="activeName === 'first'" :shop-audit-status="0" />
       </el-tab-pane>
@@ -21,11 +21,6 @@ export default {
     return {
       activeName: 'first'
     }
-  },
-  methods: {
-    handleClick() {}
   }
 }
 </script>
-
-<style></style>

+ 26 - 29
src/views/normal/audit/club/device/review.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="page-form-container">
-    <device-detail :product-id="productId" :relation-id="relationId" />
+    <device-detail :product-id="auditForm.productId" :relation-id="auditForm.relationId" />
     <template v-if="type === 'audit'">
       <el-form ref="auditForm" label-width="112px" :model="auditForm" :rules="rules">
         <el-form-item label="审核:">
@@ -23,7 +23,6 @@
 
 <script>
 import { auditProduct } from '@/api/product'
-import { mapGetters } from 'vuex'
 import { DeviceDetail } from '@/views/components'
 export default {
   components: {
@@ -32,11 +31,9 @@ export default {
   data() {
     return {
       type: 'review',
-      productId: '',
-      relationId: '',
       auditForm: {
+        relationId: '',
         productId: '',
-        auditBy: '', // 审核人id
         authId: '', // 机构id
         auditStatus: 1, // 审核状态
         invalidReason: '', // 审核信息
@@ -47,35 +44,35 @@ export default {
       }
     }
   },
-  computed: {
-    ...mapGetters(['authUserId'])
-  },
   created() {
-    this.authId = this.$route.query.authId
-    this.productId = this.$route.query.productId
-    this.relationId = this.$route.query.relationId
+    this.auditForm.authId = this.$route.query.authId
+    this.auditForm.productId = this.$route.query.productId
+    this.auditForm.relationId = this.$route.query.relationId
     this.type = this.$route.query.type
   },
   methods: {
     // 提交审核信息
-    submit() {
-      this.auditForm.productId = this.productId
-      this.$refs.auditForm.validate((valid) => {
-        if (valid) {
-          this.isLoading = true
-          // 指定审核人
-          this.auditForm.auditBy = this.authUserId
-          auditProduct(this.auditForm)
-            .then((res) => {
-              this.$message.success(res.data)
-              this.$store.dispatch('tagsView/delView', this.$route)
-              this.$router.back()
-            })
-            .finally(() => {
-              this.isLoading = false
-            })
-        }
-      })
+    async submit() {
+      try {
+        await this.$refs.auditForm.validate()
+        this.onAudit()
+      } catch (error) {
+        console.log(error)
+      }
+    },
+    // 审核
+    async onAudit() {
+      try {
+        this.isLoading = true
+        const res = await auditProduct(this.auditForm)
+        this.$message.success(res.data)
+        this.$store.dispatch('tagsView/delView', this.$route)
+        this.$router.back()
+      } catch (error) {
+        console.log(error)
+      } finally {
+        this.isLoading = false
+      }
     }
   }
 }

+ 1 - 6
src/views/normal/audit/club/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-    <el-tabs v-model="activeName" @tab-click="handleClick">
+    <el-tabs v-model="activeName">
       <el-tab-pane label="未审核" name="first">
         <club-list v-if="activeName === 'first'" :shop-audit-status="0" />
       </el-tab-pane>
@@ -21,11 +21,6 @@ export default {
     return {
       activeName: 'first'
     }
-  },
-  methods: {
-    handleClick() {}
   }
 }
 </script>
-
-<style></style>

+ 22 - 20
src/views/normal/audit/club/review.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="page-form-container">
-    <club-detail :auth-id="authId" />
+    <club-detail :auth-id="auditForm.authId" />
     <template v-if="type === 'audit'">
       <el-form ref="auditForm" label-width="112px" :model="auditForm" :rules="rules">
         <el-form-item label="审核:">
@@ -24,7 +24,6 @@
 <script>
 import { auditAuth } from '@/api/auth'
 import { ClubDetail } from '@/views/components'
-import { mapGetters } from 'vuex'
 export default {
   components: {
     ClubDetail
@@ -32,7 +31,6 @@ export default {
   data() {
     return {
       type: 'audit',
-      authId: '',
       auditForm: {
         auditBy: '', // 审核人id
         authId: '', // 机构id
@@ -44,11 +42,8 @@ export default {
       }
     }
   },
-  computed: {
-    ...mapGetters(['authUserId'])
-  },
   created() {
-    this.authId = this.$route.query.authId
+    this.auditForm.authId = this.$route.query.authId
     this.type = this.$route.query.type
   },
   methods: {
@@ -61,20 +56,27 @@ export default {
         })
       }
     },
+
     // 提交审核信息
-    submit() {
-      this.auditForm.authId = this.authId
-      this.auditForm.auditBy = this.authUserId
-      this.$refs.auditForm.validate((valid) => {
-        if (valid) {
-          // 提交审核信息
-          auditAuth(this.auditForm).then((res) => {
-            this.$message.success(res.data)
-            this.$store.dispatch('tagsView/delView', this.$route)
-            this.$router.back()
-          })
-        }
-      })
+    async submit() {
+      try {
+        await this.$refs.auditForm.validate()
+        this.onAudit()
+      } catch (error) {
+        console.log(error)
+      }
+    },
+
+    // 审核
+    async onAudit() {
+      try {
+        const res = await auditAuth(this.auditForm)
+        this.$message.success(res.data)
+        this.$store.dispatch('tagsView/delView', this.$route)
+        this.$router.back()
+      } catch (error) {
+        console.log(error)
+      }
     }
   }
 }