Browse Source

审核功完成

yuwenjun 3 years ago
parent
commit
6e1fecfbaa

+ 3 - 1
.env.development

@@ -1,8 +1,10 @@
 # just a flag
 ENV = 'development'
 
-# 正式地址 API接口
+# 测试地址 API接口
 VUE_APP_BASE_API = 'https://zplma-b.caimei365.com'
+# VUE_APP_BASE_API = 'http://192.168.2.68:8012'
+
 
 # 文件上传 API接口地址
 VUE_APP_UPLOAD_API='https://zplma-b.caimei365.com'

+ 1 - 0
.eslintignore

@@ -2,3 +2,4 @@ build/*.js
 src/assets
 public
 dist
+

+ 198 - 196
.eslintrc.js

@@ -1,198 +1,200 @@
 module.exports = {
-  root: true,
-  parserOptions: {
-    parser: 'babel-eslint',
-    sourceType: 'module'
-  },
-  env: {
-    browser: true,
-    node: true,
-    es6: true,
-  },
-  extends: ['plugin:vue/recommended', 'eslint:recommended'],
+    root: true,
+    parserOptions: {
+        parser: 'babel-eslint',
+        sourceType: 'module'
+    },
+    env: {
+        browser: true,
+        node: true,
+        es6: true,
+    },
+    extends: ['plugin:vue/recommended', 'eslint:recommended'],
 
-  // add your custom rules here
-  //it is base on https://github.com/vuejs/eslint-config-vue
-  rules: {
-    "vue/max-attributes-per-line": [2, {
-      "singleline": 10,
-      "multiline": {
-        "max": 1,
-        "allowFirstLine": false
-      }
-    }],
-    "vue/singleline-html-element-content-newline": "off",
-    "vue/multiline-html-element-content-newline":"off",
-    "vue/name-property-casing": ["error", "PascalCase"],
-    "vue/no-v-html": "off",
-    'accessor-pairs': 2,
-    'arrow-spacing': [2, {
-      'before': true,
-      'after': true
-    }],
-    'block-spacing': [2, 'always'],
-    'brace-style': [2, '1tbs', {
-      'allowSingleLine': true
-    }],
-    'camelcase': [0, {
-      'properties': 'always'
-    }],
-    'comma-dangle': [2, 'never'],
-    'comma-spacing': [2, {
-      'before': false,
-      'after': true
-    }],
-    'comma-style': [2, 'last'],
-    'constructor-super': 2,
-    'curly': [2, 'multi-line'],
-    'dot-location': [2, 'property'],
-    'eol-last': 2,
-    'eqeqeq': ["error", "always", {"null": "ignore"}],
-    'generator-star-spacing': [2, {
-      'before': true,
-      'after': true
-    }],
-    'handle-callback-err': [2, '^(err|error)$'],
-    'indent': [2, 2, {
-      'SwitchCase': 1
-    }],
-    'jsx-quotes': [2, 'prefer-single'],
-    'key-spacing': [2, {
-      'beforeColon': false,
-      'afterColon': true
-    }],
-    'keyword-spacing': [2, {
-      'before': true,
-      'after': true
-    }],
-    'new-cap': [2, {
-      'newIsCap': true,
-      'capIsNew': false
-    }],
-    'new-parens': 2,
-    'no-array-constructor': 2,
-    'no-caller': 2,
-    'no-console': 'off',
-    'no-class-assign': 2,
-    'no-cond-assign': 2,
-    'no-const-assign': 2,
-    'no-control-regex': 0,
-    'no-delete-var': 2,
-    'no-dupe-args': 2,
-    'no-dupe-class-members': 2,
-    'no-dupe-keys': 2,
-    'no-duplicate-case': 2,
-    'no-empty-character-class': 2,
-    'no-empty-pattern': 2,
-    'no-eval': 2,
-    'no-ex-assign': 2,
-    'no-extend-native': 2,
-    'no-extra-bind': 2,
-    'no-extra-boolean-cast': 2,
-    'no-extra-parens': [2, 'functions'],
-    'no-fallthrough': 2,
-    'no-floating-decimal': 2,
-    'no-func-assign': 2,
-    'no-implied-eval': 2,
-    'no-inner-declarations': [2, 'functions'],
-    'no-invalid-regexp': 2,
-    'no-irregular-whitespace': 2,
-    'no-iterator': 2,
-    'no-label-var': 2,
-    'no-labels': [2, {
-      'allowLoop': false,
-      'allowSwitch': false
-    }],
-    'no-lone-blocks': 2,
-    'no-mixed-spaces-and-tabs': 2,
-    'no-multi-spaces': 2,
-    'no-multi-str': 2,
-    'no-multiple-empty-lines': [2, {
-      'max': 1
-    }],
-    'no-native-reassign': 2,
-    'no-negated-in-lhs': 2,
-    'no-new-object': 2,
-    'no-new-require': 2,
-    'no-new-symbol': 2,
-    'no-new-wrappers': 2,
-    'no-obj-calls': 2,
-    'no-octal': 2,
-    'no-octal-escape': 2,
-    'no-path-concat': 2,
-    'no-proto': 2,
-    'no-redeclare': 2,
-    'no-regex-spaces': 2,
-    'no-return-assign': [2, 'except-parens'],
-    'no-self-assign': 2,
-    'no-self-compare': 2,
-    'no-sequences': 2,
-    'no-shadow-restricted-names': 2,
-    'no-spaced-func': 2,
-    'no-sparse-arrays': 2,
-    'no-this-before-super': 2,
-    'no-throw-literal': 2,
-    'no-trailing-spaces': 2,
-    'no-undef': 2,
-    'no-undef-init': 2,
-    'no-unexpected-multiline': 2,
-    'no-unmodified-loop-condition': 2,
-    'no-unneeded-ternary': [2, {
-      'defaultAssignment': false
-    }],
-    'no-unreachable': 2,
-    'no-unsafe-finally': 2,
-    'no-unused-vars': [2, {
-      'vars': 'all',
-      'args': 'none'
-    }],
-    'no-useless-call': 2,
-    'no-useless-computed-key': 2,
-    'no-useless-constructor': 2,
-    'no-useless-escape': 0,
-    'no-whitespace-before-property': 2,
-    'no-with': 2,
-    'one-var': [2, {
-      'initialized': 'never'
-    }],
-    'operator-linebreak': [2, 'after', {
-      'overrides': {
-        '?': 'before',
-        ':': 'before'
-      }
-    }],
-    'padded-blocks': [2, 'never'],
-    'quotes': [2, 'single', {
-      'avoidEscape': true,
-      'allowTemplateLiterals': true
-    }],
-    'semi': [2, 'never'],
-    'semi-spacing': [2, {
-      'before': false,
-      'after': true
-    }],
-    'space-before-blocks': [2, 'always'],
-    'space-before-function-paren': [2, 'never'],
-    'space-in-parens': [2, 'never'],
-    'space-infix-ops': 2,
-    'space-unary-ops': [2, {
-      'words': true,
-      'nonwords': false
-    }],
-    'spaced-comment': [2, 'always', {
-      'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ',']
-    }],
-    'template-curly-spacing': [2, 'never'],
-    'use-isnan': 2,
-    'valid-typeof': 2,
-    'wrap-iife': [2, 'any'],
-    'yield-star-spacing': [2, 'both'],
-    'yoda': [2, 'never'],
-    'prefer-const': 2,
-    'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
-    'object-curly-spacing': [2, 'always', {
-      objectsInObjects: false
-    }],
-    'array-bracket-spacing': [2, 'never']
-  }
-}
+    // add your custom rules here
+    //it is base on https://github.com/vuejs/eslint-config-vue
+    rules: {
+        // "eslint no-whitespace-before-property": true,
+        "vue/max-attributes-per-line": [2, {
+            "singleline": 10,
+            "multiline": {
+                "max": 1,
+                "allowFirstLine": false
+            }
+        }],
+        "vue/singleline-html-element-content-newline": "off",
+        "vue/multiline-html-element-content-newline": "off",
+        "vue/name-property-casing": ["error", "PascalCase"],
+        "vue/no-v-html": "off",
+        'accessor-pairs': 2,
+        'arrow-spacing': [2, {
+            'before': true,
+            'after': true
+        }],
+        'block-spacing': [2, 'always'],
+        'brace-style': [2, '1tbs', {
+            'allowSingleLine': true
+        }],
+        'camelcase': [0, {
+            'properties': 'always'
+        }],
+        'comma-dangle': [2, 'never'],
+        'comma-spacing': [2, {
+            'before': false,
+            'after': true
+        }],
+        'comma-style': [2, 'last'],
+        'constructor-super': 2,
+        'curly': [2, 'multi-line'],
+        'dot-location': [2, 'property'],
+        'eol-last': 2,
+        'eqeqeq': ["error", "always", { "null": "ignore" }],
+        'generator-star-spacing': [2, {
+            'before': true,
+            'after': true
+        }],
+        'handle-callback-err': [2, '^(err|error)$'],
+        'indent': [2, 2, {
+            'SwitchCase': 1
+        }],
+        // "indent": [4, 4],
+        'jsx-quotes': [2, 'prefer-single'],
+        'key-spacing': [2, {
+            'beforeColon': false,
+            'afterColon': true
+        }],
+        'keyword-spacing': [2, {
+            'before': true,
+            'after': true
+        }],
+        'new-cap': [2, {
+            'newIsCap': true,
+            'capIsNew': false
+        }],
+        'new-parens': 2,
+        'no-array-constructor': 2,
+        'no-caller': 2,
+        'no-console': 'off',
+        'no-class-assign': 2,
+        'no-cond-assign': 2,
+        'no-const-assign': 2,
+        'no-control-regex': 0,
+        'no-delete-var': 2,
+        'no-dupe-args': 2,
+        'no-dupe-class-members': 2,
+        'no-dupe-keys': 2,
+        'no-duplicate-case': 2,
+        'no-empty-character-class': 2,
+        'no-empty-pattern': 2,
+        'no-eval': 2,
+        'no-ex-assign': 2,
+        'no-extend-native': 2,
+        'no-extra-bind': 2,
+        'no-extra-boolean-cast': 2,
+        'no-extra-parens': [2, 'functions'],
+        'no-fallthrough': 2,
+        'no-floating-decimal': 2,
+        'no-func-assign': 2,
+        'no-implied-eval': 2,
+        'no-inner-declarations': [2, 'functions'],
+        'no-invalid-regexp': 2,
+        'no-irregular-whitespace': 2,
+        'no-iterator': 2,
+        'no-label-var': 2,
+        'no-labels': [2, {
+            'allowLoop': false,
+            'allowSwitch': false
+        }],
+        'no-lone-blocks': 2,
+        'no-mixed-spaces-and-tabs': 2,
+        'no-multi-spaces': 2,
+        'no-multi-str': 2,
+        'no-multiple-empty-lines': [2, {
+            'max': 1
+        }],
+        'no-native-reassign': 2,
+        'no-negated-in-lhs': 2,
+        'no-new-object': 2,
+        'no-new-require': 2,
+        'no-new-symbol': 2,
+        'no-new-wrappers': 2,
+        'no-obj-calls': 2,
+        'no-octal': 2,
+        'no-octal-escape': 2,
+        'no-path-concat': 2,
+        'no-proto': 2,
+        'no-redeclare': 2,
+        'no-regex-spaces': 2,
+        'no-return-assign': [2, 'except-parens'],
+        'no-self-assign': 2,
+        'no-self-compare': 2,
+        'no-sequences': 2,
+        'no-shadow-restricted-names': 2,
+        'no-spaced-func': 2,
+        'no-sparse-arrays': 2,
+        'no-this-before-super': 2,
+        'no-throw-literal': 2,
+        'no-trailing-spaces': 2,
+        'no-undef': 2,
+        'no-undef-init': 2,
+        'no-unexpected-multiline': 2,
+        'no-unmodified-loop-condition': 2,
+        'no-unneeded-ternary': [2, {
+            'defaultAssignment': false
+        }],
+        'no-unreachable': 2,
+        'no-unsafe-finally': 2,
+        'no-unused-vars': [2, {
+            'vars': 'all',
+            'args': 'none'
+        }],
+        'no-useless-call': 2,
+        'no-useless-computed-key': 2,
+        'no-useless-constructor': 2,
+        'no-useless-escape': 0,
+        'no-whitespace-before-property': 2,
+        'no-with': 2,
+        'one-var': [2, {
+            'initialized': 'never'
+        }],
+        'operator-linebreak': [2, 'after', {
+            'overrides': {
+                '?': 'before',
+                ':': 'before'
+            }
+        }],
+        'padded-blocks': [2, 'never'],
+        'quotes': [2, 'single', {
+            'avoidEscape': true,
+            'allowTemplateLiterals': true
+        }],
+        'semi': [2, 'never'],
+        'semi-spacing': [2, {
+            'before': false,
+            'after': true
+        }],
+        'space-before-blocks': [2, 'always'],
+        'space-before-function-paren': [2, 'never'],
+        'space-in-parens': [2, 'never'],
+        'space-infix-ops': 2,
+        'space-unary-ops': [2, {
+            'words': true,
+            'nonwords': false
+        }],
+        'spaced-comment': [2, 'always', {
+            'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ',']
+        }],
+        'template-curly-spacing': [2, 'never'],
+        'use-isnan': 2,
+        'valid-typeof': 2,
+        'wrap-iife': [2, 'any'],
+        'yield-star-spacing': [2, 'both'],
+        'yoda': [2, 'never'],
+        'prefer-const': 2,
+        'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
+        'object-curly-spacing': [2, 'always', {
+            objectsInObjects: false
+        }],
+        'array-bracket-spacing': [2, 'never']
+    }
+}

+ 2 - 1
.prettierrc

@@ -1,4 +1,5 @@
 {
   "semi": false,
-  "singleQuote": true
+  "singleQuote": true,
+  "printWidth": 120
 }

+ 1 - 1
jsconfig.json

@@ -6,4 +6,4 @@
     }
   },
   "exclude": ["node_modules", "dist"]
-}
+}

+ 29 - 20
src/api/auth.js

@@ -2,36 +2,45 @@ import request from '@/utils/request'
 
 // 授权列表
 export function fecthAuthList(params) {
-  return request({
-    url: '/auth/list',
-    method: 'get',
-    params
-  })
+    return request({
+        url: '/auth/list',
+        method: 'get',
+        params
+    })
 }
 
 // 添加品牌授权
 export function saveBrandAuth(data) {
-  return request({
-    url: '/auth/save',
-    method: 'post',
-    data
-  })
+    return request({
+        url: '/auth/save',
+        method: 'post',
+        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) {
-  return request({
-    url: '/auth/delete',
-    method: 'post',
-    data
-  })
+    return request({
+        url: '/auth/delete',
+        method: 'post',
+        data
+    })
 }
+
+// 审核状态
+export function auditAuth(data) {
+    return request({
+        url: '/auth/audit',
+        method: 'post',
+        data
+    })
+}

+ 35 - 25
src/api/product.js

@@ -2,45 +2,55 @@ import request from '@/utils/request'
 
 // 获取商品列表
 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) {
-  return request({
-    url: '/auth/product/save',
-    method: 'post',
-    data
-  })
+    return request({
+        url: '/auth/product/save',
+        method: 'post',
+        data
+    })
 }
 
 // 根据id获取商品信息
 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) {
-  return request({
-    url: '/auth/product/update/status',
-    method: 'post',
-    data
-  })
+    return request({
+        url: '/auth/product/update/status',
+        method: 'post',
+        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
+export function auditProduct(data) {
+    return request({
+        url: '/auth/product/audit',
+        method: 'post',
+        data
+    })
+}

+ 15 - 13
src/components/qrcode/index.vue

@@ -1,16 +1,14 @@
 <template>
   <div class="code-container">
-    <transition name="fade">
-      <div v-if="isVisible" class="qrcode">
-        <div class="title">{{ productInfo.productName }}</div>
-        <div class="sncode"><span>仪器SN码:</span>{{ hanldeSNcode(productInfo.snCode) }}</div>
-        <div class="content">
-          <img :src="imgUrl" alt="">
-        </div>
-        <div class="btn down-btn" @click="handleDown">下载二维码</div>
-        <div class="btn close-btn" @click="handleClose">关闭</div>
+    <div class="qrcode">
+      <div class="title">{{ productInfo.productName }}</div>
+      <div class="sncode"><span>仪器SN码:</span>{{ hanldeSNcode(productInfo.snCode) }}</div>
+      <div class="content">
+        <img :src="imgUrl" alt="">
       </div>
-    </transition>
+      <div class="btn down-btn" @click="handleDown">下载二维码</div>
+      <div class="btn close-btn" @click="handleClose">关闭</div>
+    </div>
     <canvas id="canvas" style="display:none" />
     <div v-if="isVisible" class="mask" @click="handleClose" />
     <a id="downloadLink" href="#" style="display:none" />
@@ -32,7 +30,7 @@ export default {
     },
     isVisible: {
       type: Boolean,
-      default: false
+      default: true
     }
   },
   data() {
@@ -154,17 +152,21 @@ export default {
 </script>
 
 <style lang="scss" scoped>
+.code-container{
+  position: relative;
+  z-index: 999999;
+}
 .mask{
   position: fixed;
   top: 0;
   left: 0;
-  z-index: 9998;
+  z-index: 999998;
   width: 100vw;
   height: 100vh;
   background: rgba(0,0,0,.5);
 }
 .qrcode{
-  z-index: 9999;
+  z-index: 999999;
   position: fixed;
   left: 50%;
   top: 20%;

+ 4 - 5
src/layout/components/Navbar.vue

@@ -7,7 +7,7 @@
     <div class="right-menu">
       <template v-if="device!=='mobile'">
         <!-- <search id="header-search" class="right-menu-item" /> -->
-        <notice-todo />
+        <!-- <notice-todo /> -->
         <!-- <error-log class="errLog-container right-menu-item hover-effect" /> -->
 
         <screenfull id="screenfull" class="right-menu-item hover-effect" />
@@ -40,15 +40,15 @@ import Hamburger from '@/components/Hamburger'
 // import ErrorLog from '@/components/ErrorLog'
 import Screenfull from '@/components/Screenfull'
 // import Search from '@/components/HeaderSearch'
-import NoticeTodo from './NoticeTodo'
+// import NoticeTodo from './NoticeTodo'
 
 export default {
   components: {
     Breadcrumb,
     Hamburger,
     // ErrorLog,
-    Screenfull,
-    NoticeTodo
+    Screenfull
+    // NoticeTodo
     // Search
   },
   computed: {
@@ -68,7 +68,6 @@ export default {
     },
     async logout() {
       await this.$store.dispatch('user/logout')
-      await this.$store.commit('permission/SET_INITROUTER', false)
       this.$message.success('已退出当前账号')
       window.location.replace('/#/login')
     }

+ 21 - 0
src/mixin/scrollTo.js

@@ -0,0 +1,21 @@
+import { getStorage } from '@/utils/storage'
+import { scrollTo } from '@/utils/scroll-to'
+
+export default {
+  data() {
+    return {
+      mPath: ''
+    }
+  },
+  created() {
+    this.mPath = this.$route.path
+    this.initPageInfo()
+  },
+  methods: {
+    initPageInfo() {
+      const { listQuery, scrollY } = JSON.parse(getStorage(this.mPath))
+      this.listQuery = listQuery
+      scrollTo(scrollY, 500)
+    }
+  }
+}

+ 20 - 14
src/permission.js

@@ -1,43 +1,48 @@
 import router from './router'
 import store from './store'
 import { Message } from 'element-ui'
-import { getToken } from '@/utils/auth' // get token from cookie
+import { getToken } from '@/utils/auth'
 import getPageTitle from '@/utils/get-page-title'
 
 const whiteList = ['/login', '/auth-redirect'] // no redirect whitelist
 const toSupplier = ['/supplier/list', '/supplier']
-const onlyPath = ['/auth/list', '/product/list', '/product/add', '/product/edit']
+
+// const onlyPath = ['/auth/list', '/product/list', '/product/add', '/product/edit']
 
 router.beforeEach(async(to, from, next) => {
   // 设置页面名称
-  document.title = getPageTitle(to.meta.title)
+  // eslint-disable-next-line indent
+    document.title = getPageTitle(to.meta.title)
 
   const hasToken = getToken()
   if (hasToken) {
-    if (toSupplier.includes(to.path) && onlyPath.includes(from.path)) {
-      // 满足要求则关闭所有标签,防止数据冲突
-      if (store.getters.proxyInfo !== null) {
-        store.dispatch('tagsView/delAllProxyView')
-      }
+    /**
+         * 满足要求则关闭所有标签,防止代理数据冲突
+         * 条件:1、sotre中存有代理数据 即 proxyInfo !== null
+         *      2、即将跳转的页面为 /supplier/list 或者 /supplier
+         */
+    if (toSupplier.includes(to.path) && store.getters.proxyInfo !== null) {
+      store.dispatch('tagsView/delAllProxyView')
       store.commit('user/SET_PROXY_INFO', null)
       console.log('关闭其他的标签')
     }
     if (to.path === '/login') {
-      // if is logged in, redirect to the home page
-      next()
+      // 在登录状态下访问login页面,直接跳转到首页
+      next('/supplier')
     } else {
       // 加载国家列表
       store.dispatch('app/setCountry')
-      const hasInitRouter = store.getters.initRouter
+      const hasInitRouter = store.getters.initRouter // 是否需要初始化路由
       if (hasInitRouter) {
         next()
       } else {
         try {
-          // get user info
-          // note: roles must be a object array! such as: ['admin'] or ,['developer','editor']
+          // 设置路由的初始化状态
           store.commit('permission/SET_INITROUTER', true)
-          // generate accessible routes map based on roles
+
+          // 通过
           const accessRoutes = await store.dispatch('permission/generateRoutes', store.getters.roles)
+
           // dynamically add accessible routes
           router.addRoutes(accessRoutes)
 
@@ -60,6 +65,7 @@ router.beforeEach(async(to, from, next) => {
     } else {
       // other pages that do not have permission to access are redirected to the login page.
       next(`/login`)
+
       // Message({ message: '登录失效,请重新登录!' })
       // router.replace('/login')
       return

+ 4 - 6
src/router/index.js

@@ -24,6 +24,7 @@ import Layout from '@/layout'
     affix: true                  if set true, the tag will affix in the tags-view
     breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
     activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
+    proxy: false
   }
  */
 
@@ -105,7 +106,6 @@ export const asyncRoutes = [
     redirect: '/supplier/list',
     meta: { title: '供应商管理', icon: 'el-icon-s-custom', roles: ['admin'], noCache: true },
     children: [
-      // admin
       {
         path: 'list',
         component: () => import('@/views/supplier/user/index'),
@@ -134,8 +134,6 @@ export const asyncRoutes = [
     component: Layout,
     alwaysShow: true,
     redirect: '/auth/list',
-    // hidden: 'true',
-    // hidden: store.getters.userIdentity === 1 ? 'true' : 'false',
     name: 'Auth',
     meta: { title: '授权管理', icon: 'el-icon-s-promotion', roles: ['admin', 'normal'], noCache: true, proxy: true },
     children: [
@@ -180,6 +178,7 @@ export const asyncRoutes = [
       }
     ]
   },
+  // 审核页面
   {
     path: '/review',
     component: Layout,
@@ -192,7 +191,7 @@ export const asyncRoutes = [
         path: 'list',
         component: () => import('@/views/supplier/review/index'),
         name: 'ReviewList',
-        meta: { title: '审核列表', icon: 'el-icon-menu', roles: ['admin'], noCache: true, affix: true }
+        meta: { title: '审核列表', icon: 'el-icon-menu', roles: ['admin'], noCache: true }
       },
       {
         path: 'auth-list',
@@ -217,7 +216,7 @@ export const asyncRoutes = [
       }
     ]
   },
-  // 404 page must be placed at the end !!!
+  // 404页面
   { path: '*', redirect: '/404', hidden: true }
 ]
 
@@ -230,7 +229,6 @@ const createRouter = () =>
 
 const router = createRouter()
 
-// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
 export function resetRouter() {
   const newRouter = createRouter()
   router.matcher = newRouter.matcher // reset router

+ 24 - 19
src/store/modules/user.js

@@ -6,11 +6,14 @@ const userInfo = getUser() && JSON.parse(getUser())
 function formatRoles(userIdentity) {
   let roles = []
   switch (userIdentity) {
-    case 1: roles = ['admin']
+    case 1:
+      roles = ['admin']
       break
-    case 2:roles = ['normal']
+    case 2:
+      roles = ['normal']
       break
-    default :roles = []
+    default:
+      roles = []
       break
   }
   return roles
@@ -58,21 +61,23 @@ const actions = {
   login({ commit }, userInfo) {
     const { username, password } = userInfo
     return new Promise((resolve, reject) => {
-      login({ mobileOrName: username.trim(), password: password }).then(response => {
-        const { shopStatus, token, authUserId, userIdentity, name, shopType, brandId } = response.data
-        const roles = formatRoles(userIdentity)
-        commit('SET_TOKEN', token) // 保存token
-        commit('SET_USERINFO', { shopStatus, authUserId, userIdentity, shopType, brandId }) // 保存用户信息
-        commit('SET_ROLES', roles) // 根据用户类型生成角色列表
-        commit('SET_NAME', name) // 保存用户名称
-        // commit('app/SET_IS_REFRESH', false)
-        setToken(token) // cokies保存token
-        setUser(response.data) // cokies保存当前用户信息
-        console.log(response)
-        resolve()
-      }).catch(error => {
-        reject(error)
-      })
+      login({ mobileOrName: username.trim(), password: password })
+        .then(response => {
+          const { shopStatus, token, authUserId, userIdentity, name, shopType, brandId } = response.data
+          const roles = formatRoles(userIdentity)
+          commit('SET_TOKEN', token) // 保存token
+          commit('SET_USERINFO', { shopStatus, authUserId, userIdentity, shopType, brandId }) // 保存用户信息
+          commit('SET_ROLES', roles) // 根据用户类型生成角色列表
+          commit('SET_NAME', name) // 保存用户名称
+          // commit('app/SET_IS_REFRESH', false)
+          setToken(token) // cokies保存token
+          setUser(response.data) // cokies保存当前用户信息
+          console.log(response)
+          resolve()
+        })
+        .catch(error => {
+          reject(error)
+        })
     })
   },
 
@@ -82,6 +87,7 @@ const actions = {
     commit('SET_ROLES', []) // 重置角色权限表
     commit('SET_PROXY_INFO', null)
     commit('SET_NAME', '')
+
     removeToken() // 从cokies中移除token
     resetRouter() // 重置路由
     removeUser() // 从cokies中移除用户信息
@@ -97,7 +103,6 @@ const actions = {
       resolve()
     })
   }
-
 }
 
 export default {

+ 4 - 1
src/styles/index.css

@@ -677,7 +677,6 @@ aside a:hover {
 
 .table-cell .cell .el-badge {
   vertical-align: 0;
-  margin-left: 5px;
 }
 
 .el-drawer header span {
@@ -687,3 +686,7 @@ aside a:hover {
 .el-drawer button {
   outline: none !important;
 }
+
+.reason {
+  cursor: pointer;
+}

File diff suppressed because it is too large
+ 0 - 0
src/styles/index.min.css


+ 123 - 129
src/styles/index.scss

@@ -4,241 +4,235 @@
 @import './element-ui.scss';
 @import './sidebar.scss';
 @import './btn.scss';
-
 body {
-  height: 100%;
-  -moz-osx-font-smoothing: grayscale;
-  -webkit-font-smoothing: antialiased;
-  text-rendering: optimizeLegibility;
-  font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
+    height: 100%;
+    -moz-osx-font-smoothing: grayscale;
+    -webkit-font-smoothing: antialiased;
+    text-rendering: optimizeLegibility;
+    font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
 }
 
 label {
-  font-weight: 700;
+    font-weight: 700;
 }
 
 html {
-  height: 100%;
-  box-sizing: border-box;
+    height: 100%;
+    box-sizing: border-box;
 }
 
 #app {
-  height: 100%;
+    height: 100%;
 }
 
 *,
 *:before,
 *:after {
-  box-sizing: inherit;
+    box-sizing: inherit;
 }
 
 .no-padding {
-  padding: 0px !important;
+    padding: 0px !important;
 }
 
 .padding-content {
-  padding: 4px 0;
+    padding: 4px 0;
 }
 
 a:focus,
 a:active {
-  outline: none;
+    outline: none;
 }
 
 a,
 a:focus,
 a:hover {
-  cursor: pointer;
-  color: inherit;
-  text-decoration: none;
+    cursor: pointer;
+    color: inherit;
+    text-decoration: none;
 }
 
 div:focus {
-  outline: none;
+    outline: none;
 }
 
 .fr {
-  float: right;
+    float: right;
 }
 
 .fl {
-  float: left;
+    float: left;
 }
 
 .pr-5 {
-  padding-right: 5px;
+    padding-right: 5px;
 }
 
 .pl-5 {
-  padding-left: 5px;
+    padding-left: 5px;
 }
 
 .block {
-  display: block;
+    display: block;
 }
 
 .pointer {
-  cursor: pointer;
+    cursor: pointer;
 }
 
 .inlineBlock {
-  display: block;
+    display: block;
 }
 
 .clearfix {
-  &:after {
-    visibility: hidden;
-    display: block;
-    font-size: 0;
-    content: " ";
-    clear: both;
-    height: 0;
-  }
+    &:after {
+        visibility: hidden;
+        display: block;
+        font-size: 0;
+        content: " ";
+        clear: both;
+        height: 0;
+    }
 }
 
 aside {
-  background: #eef1f6;
-  padding: 8px 24px;
-  margin-bottom: 20px;
-  border-radius: 2px;
-  display: block;
-  line-height: 32px;
-  font-size: 16px;
-  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
-  color: #2c3e50;
-  -webkit-font-smoothing: antialiased;
-  -moz-osx-font-smoothing: grayscale;
-
-  a {
-    color: #337ab7;
-    cursor: pointer;
-
-    &:hover {
-      color: rgb(32, 160, 255);
+    background: #eef1f6;
+    padding: 8px 24px;
+    margin-bottom: 20px;
+    border-radius: 2px;
+    display: block;
+    line-height: 32px;
+    font-size: 16px;
+    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
+    color: #2c3e50;
+    -webkit-font-smoothing: antialiased;
+    -moz-osx-font-smoothing: grayscale;
+    a {
+        color: #337ab7;
+        cursor: pointer;
+        &:hover {
+            color: rgb(32, 160, 255);
+        }
     }
-  }
 }
 
 //main-container全局样式
 .app-container {
-  padding: 20px;
+    padding: 20px;
 }
 
 .components-container {
-  margin: 30px 50px;
-  position: relative;
+    margin: 30px 50px;
+    position: relative;
 }
 
 .pagination-container {
-  margin-top: 30px;
+    margin-top: 30px;
 }
 
 .text-center {
-  text-align: center
+    text-align: center
 }
 
 .sub-navbar {
-  height: 50px;
-  line-height: 50px;
-  position: relative;
-  width: 100%;
-  text-align: right;
-  padding-right: 20px;
-  transition: 600ms ease position;
-  background: linear-gradient(90deg, rgba(32, 182, 249, 1) 0%, rgba(32, 182, 249, 1) 0%, rgba(33, 120, 241, 1) 100%, rgba(33, 120, 241, 1) 100%);
-
-  .subtitle {
-    font-size: 20px;
-    color: #fff;
-  }
-
-  &.draft {
-    background: #d0d0d0;
-  }
-
-  &.deleted {
-    background: #d0d0d0;
-  }
+    height: 50px;
+    line-height: 50px;
+    position: relative;
+    width: 100%;
+    text-align: right;
+    padding-right: 20px;
+    transition: 600ms ease position;
+    background: linear-gradient(90deg, rgba(32, 182, 249, 1) 0%, rgba(32, 182, 249, 1) 0%, rgba(33, 120, 241, 1) 100%, rgba(33, 120, 241, 1) 100%);
+    .subtitle {
+        font-size: 20px;
+        color: #fff;
+    }
+    &.draft {
+        background: #d0d0d0;
+    }
+    &.deleted {
+        background: #d0d0d0;
+    }
 }
 
 .link-type,
 .link-type:focus {
-  color: #337ab7;
-  cursor: pointer;
-
-  &:hover {
-    color: rgb(32, 160, 255);
-  }
+    color: #337ab7;
+    cursor: pointer;
+    &:hover {
+        color: rgb(32, 160, 255);
+    }
 }
 
 .filter-container {
-  padding-bottom: 10px;
-
-  .filter-item {
-    display: inline-block;
-    vertical-align: middle;
-    margin-bottom: 10px;
-  }
+    padding-bottom: 10px;
+    .filter-item {
+        display: inline-block;
+        vertical-align: middle;
+        margin-bottom: 10px;
+    }
 }
 
 //refine vue-multiselect plugin
 .multiselect {
-  line-height: 16px;
+    line-height: 16px;
 }
 
 .multiselect--active {
-  z-index: 1000 !important;
+    z-index: 1000 !important;
 }
 
-.status{
-  &.success{
-    color: #67C23A;
-  }
-  &.danger{
-    color: #F56C6C;
-  }
-  &.warning{
-    color: #E6A23C;
-  }
+.status {
+    &.success {
+        color: #67C23A;
+    }
+    &.danger {
+        color: #F56C6C;
+    }
+    &.warning {
+        color: #E6A23C;
+    }
 }
 
-
 .hidden {
-  .el-upload {
-    display: none !important;
-  }
+    .el-upload {
+        display: none !important;
+    }
 }
 
-.tableHeader{
-  th{
-    background-color: #f7f7f7 !important;
-  }
+.tableHeader {
+    th {
+        background-color: #f7f7f7 !important;
+    }
 }
 
 // .el-badge__content.is-fixed{
 //   top: 14px !important;
 // }
-
-.el-drawer__header{
-  margin-bottom: 0 !important;
+.el-drawer__header {
+    margin-bottom: 0 !important;
 }
 
-.table-cell{
-  .cell{
-    overflow: visible !important;
-    .el-badge{
-      vertical-align: 0;
-      margin-left: 5px;
+.table-cell {
+    .cell {
+        overflow: visible !important;
+        .el-badge {
+            vertical-align: 0;
+        }
     }
-  }
 }
-.el-drawer{
-  header{
-    span{
-      outline: none;
+
+.el-drawer {
+    header {
+        span {
+            outline: none;
+        }
     }
-  }
-  button{
-    outline: none !important;
-  }
+    button {
+        outline: none !important;
+    }
+}
+
+.reason {
+    cursor: pointer;
 }

+ 1 - 1
src/utils/storage.js

@@ -5,7 +5,7 @@ export function setStorage(key, value) {
 }
 
 export function getStorage(key) {
-  window.localStorage.getItem(key)
+  return window.localStorage.getItem(key)
 }
 
 export function removeStorage(key) {

+ 22 - 0
src/utils/tools.js

@@ -17,3 +17,25 @@ export function throttle(func, wait) {
     }
   }
 }
+
+// 防抖
+export function debounce(func, wait, immediate) {
+  let timeout, result
+  return function() {
+    const context = this
+    const args = arguments
+    if (timeout) clearTimeout(timeout)
+    if (immediate) {
+      const callNow = !timeout
+      timeout = setTimeout(function() {
+        timeout = null
+      }, wait)
+      if (callNow) result = func.apply(context, args)
+    } else {
+      timeout = setTimeout(function() {
+        func.apply(context, args)
+      }, wait)
+    }
+    return result
+  }
+}

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

@@ -22,7 +22,7 @@
         />
       </el-form-item>
 
-      <el-tooltip v-model="capsTooltip" content="Caps lock is On" placement="right" manual>
+      <el-tooltip v-model="capsTooltip" content="大写已开启" placement="right" manual>
         <el-form-item prop="password">
           <span class="svg-container">
             <svg-icon icon-class="password" />

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

@@ -80,7 +80,6 @@ export default {
     },
     async logout() {
       await this.$store.dispatch('user/logout')
-      await this.$store.commit('permission/SET_INITROUTER', false)
       window.location.replace('/#/login')
     }
   }

+ 96 - 16
src/views/supplier/auth/index.vue

@@ -3,8 +3,36 @@
     <div class="filter-container">
       <span>授权机构:</span>
       <el-input v-model="listQuery.authParty" placeholder="授权机构" style="width: 280px;" class="filter-item" @keyup.enter.native="handleFilter" />
-      <el-button type="primary" @click="getList">查询</el-button>
-      <el-button v-if="userIdentity === 2 || proxyInfo!==null" type="primary" @click="handleShowEditDialog('添加品牌授权')">添加品牌授权</el-button>
+      <span>审核状态:</span>
+      <el-select
+        v-model="listQuery.auditStatus"
+        placeholder="审核状态"
+        clearable
+        style="width: 200px"
+        class="filter-item"
+        @change="getList"
+      >
+        <el-option label="全部" value="" />
+        <el-option label="待审核" :value="2" />
+        <el-option label="审核通过" :value="1" />
+        <el-option label="审核未通过" :value="0" />
+      </el-select>
+      <span>上线状态:</span>
+      <el-select
+        v-model="listQuery.status"
+        placeholder="上线状态"
+        clearable
+        style="width: 200px"
+        class="filter-item"
+        @change="getList"
+      >
+        <el-option label="全部" value="" />
+        <el-option label="已上线" :value="1" />
+        <el-option label="待上线" :value="2" />
+        <el-option label="未上线" :value="0" />
+      </el-select>
+      <el-button icon="el-icon-search" type="primary" @click="getList">查询</el-button>
+      <el-button v-if="userIdentity === 2 || proxyInfo!==null" icon="el-icon-edit" type="primary" @click="handleShowEditDialog('添加品牌授权')">添加品牌授权</el-button>
     </div>
     <!-- 表格区域 -->
     <el-table
@@ -21,15 +49,46 @@
 
       <el-table-column label="授权机构" align="center" prop="authParty" />
 
+      <el-table-column label="审核状态" width="220px" align="center">
+        <template slot-scope="{ row }">
+          <el-tag v-if="row.auditStatus === 2" size="small" type="warning">待审核</el-tag>
+          <el-tag v-if="row.auditStatus === 1" size="small" type="success">审核通过</el-tag>
+          <!-- 未通过原因展示 -->
+          <template v-if="row.auditStatus === 0">
+            <!-- <span class="status danger">审核未通过&nbsp;</span> -->
+            <el-popover
+              placement="top-start"
+              title="审核说明"
+              width="400"
+              trigger="hover"
+              :content="row.invalidReason"
+            >
+              <el-tag slot="reference" size="small" type="danger" class="reason">
+                <span>审核未通过</span>
+                <span class="el-icon-question status danger " />
+              </el-tag>
+            </el-popover>
+            <!-- 未通过原因展示END -->
+          </template>
+        </template>
+      </el-table-column>
+
       <el-table-column v-if="userIdentity===2 || proxyInfo!==null" label="上线状态" width="140px" align="center">
         <template slot-scope="{row}">
-          <template v-if="row.status === 0">
-            <span style="margin-right:10px;" class="status danger">已下线</span>
-            <el-button type="primary" size="mini" @click="handleChangeStatus(row)">上线</el-button>
+          <!-- 只有审核通过了才能操作上下线 auditStatus :审核状态 -->
+          <template v-if="row.auditStatus === 1">
+            <template v-if="row.status === 0">
+              <span style="margin-right:10px;" class="status danger">已下线</span>
+              <el-button type="primary" size="mini" @click="handleChangeStatus(row)">上线</el-button>
+            </template>
+            <template v-else>
+              <span style="margin-right:10px;" class="status success ">已上线</span>
+              <el-button type="info" size="mini" plain @click="handleChangeStatus(row)">下线</el-button>
+            </template>
           </template>
           <template v-else>
-            <span style="margin-right:10px;" class="status success ">已上线</span>
-            <el-button type="info" size="mini" plain @click="handleChangeStatus(row)">下线</el-button>
+            <!-- <el-tag type="warning">待上线</el-tag> -->
+            <span style="margin-right:10px;" class="status warning">待上线</span>
           </template>
         </template>
       </el-table-column>
@@ -106,6 +165,7 @@ export default {
   },
   data() {
     return {
+      noticeTitle: '添加',
       dialogFlag: true, // 对话框状态
       tableKey: 0,
       list: null,
@@ -116,7 +176,8 @@ export default {
         authParty: '', // 授权机构
         authUserId: '', // 供应商用户id
         pageNum: 1, // 页码
-        pageSize: 10 // 分页
+        pageSize: 10, // 分页
+        status: ''
       },
       // 添加品牌授权
       showAddAuthDialog: false, // 显示添加供应商对话框
@@ -133,7 +194,10 @@ export default {
           { required: true, message: '请输入授权机构名称', trigger: 'blur' }
         ]
       },
-      disabled: false
+      disabled: false,
+      // 审核未通过
+      auditFailedList: [],
+      auditNoticeFlag: true
     }
   },
   computed: {
@@ -160,6 +224,8 @@ export default {
         // this.formatList(list)
         this.list = list
         this.total = total
+        // 获取审核未通过的列表
+        this.checkAuditFailedList(list)
       }).catch(err => {
         console.log(err)
         return this.$message.error('授权列表信息获取失败')
@@ -167,6 +233,21 @@ export default {
         this.listLoading = false
       })
     },
+    // 获取审核未通过条数
+    // Audit failed 审核未通过
+    checkAuditFailedList(data) {
+      this.auditFailedList = data.filter(item => item.auditStatus === 0)
+      console.log(this.auditFailedList)
+      if (this.auditFailedList.length > 0 && this.auditNoticeFlag) {
+        this.$notify.info({
+          title: '消息通知',
+          dangerouslyUseHTMLString: true,
+          message: `您共有<b style="color:red">${this.auditFailedList.length}</b>个授权机构未能通过审核,请查看原因并及时修改!`,
+          duration: 3000
+        })
+        this.auditNoticeFlag = false
+      }
+    },
     // 检查机构名是否存在 true:存在  false:不存在
     handleCheckAuthName(name) {
       const flag = this.list.some(item => item.authParty === name)
@@ -197,8 +278,8 @@ export default {
             this.getList()
             const h = this.$createElement
             this.$notify.success({
-              title: '添加授权机构',
-              message: h('i', { style: 'color: #333' }, `已添加授权机构:"${this.addAuthFormData.authParty}"`),
+              title: `${this.noticeTitle}授权机构`,
+              message: h('i', { style: 'color: #333' }, `已${this.noticeTitle}授权机构:"${this.addAuthFormData.authParty}"`),
               duration: 3000
             })
             this.$refs.addAuthForm.resetFields()
@@ -283,23 +364,22 @@ export default {
     },
     // 对话框关闭事件
     dialogClosed() {
+      console.log('dialog is closed')
+      this.addAuthFormData.authParty = ''
       this.addAuthFormData.authId = ''
       this.addAuthFormData.status = 1
+      this.noticeTitle = '添加'
       this.$refs.addAuthForm.resetFields()
     },
     handleShowEditDialog(title, data) {
       this.dialogTitle = title
       if (data) {
-        // authId: '', // 授权id
-        // authUserId: '', // 供应商用户id
-        // authParty: '', // 授权机构
-        // createBy: '', // 创建人id
-        // status: 1
         this.addAuthFormData.authId = data.authId
         this.addAuthFormData.authUserId = data.authUserId
         this.addAuthFormData.authParty = data.authParty
         this.addAuthFormData.createBy = data.createBy
         this.status = data.status
+        this.noticeTitle = '修改'
         this.dialogFlag = false
       } else {
         this.dialogFlag = true

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

@@ -165,9 +165,7 @@ export default {
       this.formData.createBy = this.proxyInfo?.authUserId || this.authUserId
       this.formData.authUserId = this.proxyInfo?.authUserId || this.authUserId
       saveProduct(this.formData).then(res => {
-        if (res.code !== 0) {
-          return
-        }
+        if (res.code !== 0) return
         const h = this.$createElement
         this.$notify.success({
           title: '新增商品',
@@ -176,6 +174,7 @@ export default {
         })
         this.$refs.addFormRef.resetFields()
         this.clearFormData()
+        this.$store.dispatch('tagsView/delView', this.$route)
         this.$router.push(`/product/list?id=${this.formData.authId}`)
       }).finally(() => {
         this.isLoading = false

+ 2 - 0
src/views/supplier/product/edit.vue

@@ -184,12 +184,14 @@ export default {
       this.formData.createBy = this.proxyInfo?.authUserId || this.authUserId
       this.formData.authUserId = this.proxyInfo?.authUserId || this.authUserId
       saveProduct(this.formData).then(res => {
+        if (res.code !== 0) return
         const h = this.$createElement
         this.$notify.success({
           title: '修改商品',
           message: h('i', { style: 'color: #333' }, `已修改商品:"${this.formData.productName}"`),
           duration: 2000
         })
+        this.$store.dispatch('tagsView/delView', this.$route)
         this.$router.back()
       }).finally(() => {
         this.isLoading = false

+ 101 - 14
src/views/supplier/product/index.vue

@@ -1,12 +1,40 @@
 <template>
   <div class="app-container">
     <div class="filter-container">
-      <span>授权机构:</span>
-      <el-input v-model="listQuery.title" placeholder="授权机构" style="width: 200px;" class="filter-item" @keyup.enter.native="handleFilter" />
+      <span>商品名称:</span>
+      <el-input v-model="listQuery.productName" placeholder="商品名称" style="width: 200px;" class="filter-item" @keyup.enter.native="handleFilter" />
       <span>商品SN码:</span>
       <el-input v-model="listQuery.snCode" placeholder="商品SN码" style="width: 200px;" class="filter-item" @keyup.enter.native="handleFilter" />
-      <el-button type="primary" @click="handleFilter">查询</el-button>
-      <el-button v-if="userIdentity === 2 || proxyInfo !== null" type="primary" @click="$_navigationTo(`add?id=${listQuery.authId}`)">添加商品</el-button>
+      <span>审核状态:</span>
+      <el-select
+        v-model="listQuery.auditStatus"
+        placeholder="审核状态"
+        clearable
+        style="width: 200px"
+        class="filter-item"
+        @change="getList"
+      >
+        <el-option label="全部" value="" />
+        <el-option label="待审核" :value="2" />
+        <el-option label="审核通过" :value="1" />
+        <el-option label="审核未通过" :value="0" />
+      </el-select>
+      <span>上线状态:</span>
+      <el-select
+        v-model="listQuery.status"
+        placeholder="上线状态"
+        clearable
+        style="width: 200px"
+        class="filter-item"
+        @change="getList"
+      >
+        <el-option label="全部" value="" />
+        <el-option label="已上线" :value="1" />
+        <el-option label="待上线" :value="2" />
+        <el-option label="未上线" :value="0" />
+      </el-select>
+      <el-button type="primary" icon="el-icon-search" @click="handleFilter">查询</el-button>
+      <el-button v-if="userIdentity === 2 || proxyInfo !== null" icon="el-icon-edit" type="primary" @click="$_navigationTo(`add?id=${listQuery.authId}`)">添加商品</el-button>
     </div>
     <!-- 表格区域 -->
     <el-table
@@ -22,15 +50,47 @@
       <el-table-column label="序号" type="index" align="center" width="80" />
       <el-table-column label="商品名称" align="center" prop="productName" />
       <el-table-column label="商品SN码" align="center" prop="snCode" />
+
+      <el-table-column label="审核状态" width="220px" align="center">
+        <template slot-scope="{ row }">
+          <el-tag v-if="row.auditStatus === 2" size="small" type="warning">待审核</el-tag>
+          <el-tag v-if="row.auditStatus === 1" size="small" type="success">审核通过</el-tag>
+          <!-- 未通过原因展示 -->
+          <template v-if="row.auditStatus === 0">
+            <!-- <span class="status danger">审核未通过&nbsp;</span> -->
+            <el-popover
+              placement="top-start"
+              title="审核说明"
+              width="400"
+              trigger="hover"
+              :content="row.invalidReason"
+            >
+              <el-tag slot="reference" size="small" type="danger" class="reason">
+                <span>审核未通过</span>
+                <span class="el-icon-question status danger " />
+              </el-tag>
+            </el-popover>
+            <!-- 未通过原因展示END -->
+          </template>
+        </template>
+      </el-table-column>
+
       <el-table-column v-if="userIdentity===2 || proxyInfo !== null" label="上线状态" width="140px" align="center">
         <template slot-scope="{row}">
-          <template v-if="row.status === 0">
-            <span style="margin-right:10px;" class="status danger">已下线</span>
-            <el-button type="primary" size="mini" @click="handleChangeStatus(row)">上线</el-button>
+          <!-- 只有审核通过了才能操作上下线 auditStatus :审核状态 -->
+          <template v-if="row.auditStatus === 1">
+            <template v-if="row.status === 0">
+              <span style="margin-right:10px;" class="status danger">已下线</span>
+              <el-button type="primary" size="mini" @click="handleChangeStatus(row)">上线</el-button>
+            </template>
+            <template v-else>
+              <span style="margin-right:10px;" class="status success ">已上线</span>
+              <el-button type="info" size="mini" plain @click="handleChangeStatus(row)">下线</el-button>
+            </template>
           </template>
           <template v-else>
-            <span style="margin-right:10px;" class="status success ">已上线</span>
-            <el-button type="info" size="mini" plain @click="handleChangeStatus(row)">下线</el-button>
+            <!-- <el-tag type="warning">待上线</el-tag> -->
+            <span style="margin-right:10px;" class="status warning">待上线</span>
           </template>
         </template>
       </el-table-column>
@@ -50,7 +110,10 @@
               删除
             </el-button>
           </template>
-          <el-button type="primary" size="mini" @click="handleShowQRcode(row)">
+          <el-button v-if="row.auditStatus === 1" type="primary" size="mini" @click="handleShowQRcode(row)">
+            二维码
+          </el-button>
+          <el-button v-else type="info" size="mini" disabled>
             二维码
           </el-button>
         </template>
@@ -61,7 +124,9 @@
     <pagination v-show="total>0" :total="total" :page.sync="listQuery.pageNum" :limit.sync="listQuery.pageSize" @pagination="getList" />
 
     <!-- 二维码 -->
-    <qrcode v-if="showQRcode" :is-visible="showQRcode" :product-info="productInfo" @close="showQRcode = false" />
+    <transition name="fade">
+      <qrcode v-if="showQRcode" :product-info="productInfo" @close="showQRcode = false" />
+    </transition>
   </div>
 </template>
 
@@ -90,6 +155,8 @@ export default {
       total: 0,
       listLoading: true,
       listQuery: {
+        status: '',
+        auditStatus: '',
         authId: '',
         productName: '',
         snCode: '',
@@ -97,7 +164,10 @@ export default {
         pageSize: 10
       },
       showQRcode: false,
-      productInfo: {}
+      productInfo: {},
+      // 审核未通过
+      auditFailedList: [],
+      auditNoticeFlag: true
     }
   },
   computed: {
@@ -120,8 +190,10 @@ export default {
     // 获取列表信息
     getList() {
       getProdList(this.listQuery).then(res => {
-        this.total = res.data.total
-        this.list = res.data.list
+        const { total, list } = res.data
+        this.total = total
+        this.list = list
+        this.checkAuditFailedList(list)
       }).finally(() => {
         this.listLoading = false
       })
@@ -176,6 +248,21 @@ export default {
     handleShowQRcode(item) {
       this.productInfo = item
       this.showQRcode = true
+    },
+    // 获取审核未通过条数
+    // Audit failed 审核未通过
+    checkAuditFailedList(data) {
+      this.auditFailedList = data.filter(item => item.auditStatus === 0)
+      console.log(this.auditFailedList)
+      if (this.auditFailedList.length > 0 && this.auditNoticeFlag) {
+        this.$notify.info({
+          title: '消息通知',
+          dangerouslyUseHTMLString: true,
+          message: `您共有<b style="color:red">${this.auditFailedList.length}</b>件商品未能通过审核,请查看原因并及时修改!`,
+          duration: 3000
+        })
+        this.auditNoticeFlag = false
+      }
     }
   }
 }

+ 136 - 68
src/views/supplier/review/authList.vue

@@ -8,15 +8,16 @@
         placeholder="授权机构名称"
         style="width: 200px"
         class="filter-item"
-        @keyup.enter.native="handleFilter"
+        @keyup.enter.native="getList"
       />
       <span>审核状态:</span>
       <el-select
-        v-model="listQuery.reviewStatus"
+        v-model="listQuery.auditStatus"
         placeholder="审核状态"
         clearable
         style="width: 200px"
         class="filter-item"
+        @change="getList"
       >
         <el-option label="全部" value="" />
         <el-option label="待审核" :value="2" />
@@ -25,23 +26,24 @@
       </el-select>
       <span>商品信息审核状态:</span>
       <el-select
-        v-model="listQuery.shopReviewStatus"
+        v-model="listQuery.lowerAuditStatus"
         placeholder="供应商类型"
         clearable
         style="width: 200px"
         class="filter-item"
+        @change="getList"
       >
         <el-option label="全部" value="" />
         <el-option label="已完成审核" :value="1" />
         <el-option label="未完成审核" :value="0" />
       </el-select>
-      <el-button type="primary">查询</el-button>
+      <el-button type="primary" icon="el-icon-search" @click="getList">查询</el-button>
     </div>
     <!-- 搜索区域END -->
     <!-- 表格区域 -->
     <el-table
       v-loading="listLoading"
-      :data="reviewData"
+      :data="list"
       style="width: 100%"
       border
       fit
@@ -51,120 +53,186 @@
       <el-table-column label="序号" type="index" width="80" align="center" />
       <el-table-column prop="authParty" label="授权机构" align="center" />
       <el-table-column label="审核状态" width="220px" align="center">
-        <template slot-scope="{row}">
-          <span v-if="row.reviewStatus === 2" class="status warning">待审核</span>
-          <span v-if="row.reviewStatus === 1" class="status success">审核通过</span>
-          <span v-if="row.reviewStatus === 0" class="status danger">审核未通过</span>
+        <template slot-scope="{ row }">
+          <el-tag v-if="row.auditStatus === 2" size="small" type="warning">待审核</el-tag>
+          <el-tag v-if="row.auditStatus === 1" size="small" type="success">审核通过</el-tag>
+          <!-- 未通过原因展示 -->
+          <template v-if="row.auditStatus === 0">
+            <!-- <span class="status danger">审核未通过&nbsp;</span> -->
+            <el-popover
+              placement="top-start"
+              title="审核说明"
+              width="400"
+              trigger="hover"
+              :content="row.invalidReason"
+            >
+              <el-tag slot="reference" size="small" type="danger" class="reason">
+                <span>审核未通过</span>
+                <span class="el-icon-question status danger " />
+              </el-tag>
+            </el-popover>
+            <!-- 未通过原因展示END -->
+          </template>
         </template>
       </el-table-column>
       <el-table-column label="商品信息审核状态" width="220px" align="center">
+        <template slot-scope="{ row }">
+          <el-tag v-if="row.lowerAuditStatus === 0" size="small" type="danger">未完成审核</el-tag>
+          <el-tag v-if="row.lowerAuditStatus === 1" size="small" type="success">已完成审核</el-tag>
+        </template>
+      </el-table-column>
+
+      <el-table-column label="审核时间" width="250px" align="center">
         <template slot-scope="{row}">
-          <span v-if="row.shopReviewStatus === 0" class="status danger">未完成审核</span>
-          <span v-if="row.shopReviewStatus === 1" class="status success">已完成审核</span>
+          <span v-if="row.auditStatus!==2">{{ row.auditTime | formatTime }}</span>
+          <span v-else>—</span>
         </template>
       </el-table-column>
-      <el-table-column prop="reviewTime" label="审核时间" align="center" />
-      <el-table-column prop="reviewBy" label="审核人" align="center" />
-      <el-table-column label="操作" width="240px" align="center">
+
+      <el-table-column label="审核人" align="center" width="200px">
         <template slot-scope="{row}">
-          <el-button v-if="row.reviewStatus !== 1" type="primary" size="mini" @click="handleShowDialog(row)">审核</el-button>
-          <el-badge :value="12" :max="99">
-            <el-button type="primary" size="mini" @click="$_navigationTo('shop-list')">商品信息审核</el-button>
+          <span v-if="row.auditStatus!==2">{{ row.auditBy }}</span>
+          <span v-else>—</span>
+        </template>
+      </el-table-column>
+
+      <el-table-column label="操作" width="240px" align="center">
+        <template slot-scope="{ row }">
+          <el-button
+            v-if="row.auditStatus === 2"
+            type="warning"
+            size="mini"
+            style="margin-right:5px"
+            icon="el-icon-s-check"
+            @click="handleShowDialog(row)"
+          >审核</el-button>
+          <el-badge :hidden="row.lowerAuditStatus === 1" :value="row.waitAuditNum" :max="99">
+            <el-button icon="el-icon-s-shop" type="primary" size="mini" @click="$_navigationTo(`shop-list?authId=${row.authId}`)">商品信息审核</el-button>
           </el-badge>
         </template>
       </el-table-column>
     </el-table>
     <!-- 表格区域END -->
-
+    <!-- 页码 -->
+    <pagination v-show="total>0" :total="total" :page.sync="listQuery.pageNum" :limit.sync="listQuery.pageSize" @pagination="getList" />
     <!-- 审核弹窗 -->
     <el-dialog title="授权机构审核" :visible.sync="dialogVisible" width="450px" @close="dialogClosed">
       <div class="auth-info">
         <div class="auth-name">
           <i>授权机构:</i>
-          <span>{{ dialogData.authParty }}</span>
+          <b>{{ dialogData.authParty }}</b>
         </div>
-        <el-form ref="form" :model="dialogData" label-width="85px" :rules="dialogFormRules">
+        <el-form ref="formRef" :model="dialogData" label-width="85px" :rules="dialogFormRules">
           <el-form-item label="审核状态:">
-            <el-radio-group v-model="dialogData.reviewStatus">
+            <el-radio-group v-model="dialogData.auditStatus">
               <el-radio :label="1">通过</el-radio>
               <el-radio :label="0">不通过</el-radio>
             </el-radio-group>
           </el-form-item>
-          <el-form-item v-if="dialogData.reviewStatus === 0" label="原因:" prop="reason">
-            <el-input v-model="dialogData.reason" type="textarea" placeholder="请说明原因" />
+          <el-form-item v-if="dialogData.auditStatus === 0" label="原因:" prop="invalidReason">
+            <el-input v-model="dialogData.invalidReason" type="textarea" placeholder="请说明原因" />
           </el-form-item>
         </el-form>
       </div>
       <div slot="footer">
         <el-button @click="dialogVisible = false">取 消</el-button>
-        <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
+        <el-button type="primary" @click="auditStatusHandle">确 定</el-button>
       </div>
     </el-dialog>
-
   </div>
 </template>
 
 <script>
-
+import Pagination from '@/components/Pagination'
+import { fecthAuthList, auditAuth } from '@/api/auth'
+import { formatDate } from '@/utils'
+import { mapGetters } from 'vuex'
 export default {
+  components: { Pagination },
+  filters: {
+    formatTime(time) {
+      if (!time) {
+        return ''
+      }
+      return formatDate(time, 'yyyy-MM-DD HH:mm:ss')
+    }
+  },
   data() {
     return {
       // 是否显示dialog
       dialogVisible: false,
       listLoading: false,
-      // 查询query
+      // 查询参数
       listQuery: {
-        authParty: '',
-        reviewStatus: '',
-        shopReviewStatus: ''
+        listType: 2,
+        authParty: '', // 授权机构
+        authUserId: '', // 供应商用户id
+        pageNum: 1, // 页码
+        pageSize: 10, // 分页
+        auditStatus: '', // 审核状态
+        lowerAuditStatus: '' // 下属内容审核状态
       },
+      total: 0,
       dialogData: {
-        authParty: '果果哒',
-        reviewStatus: 1,
-        reason: ''
+        auditBy: '', // 审核人
+        authId: '', // 授权机构id
+        authParty: '', // 授权机构名称
+        auditStatus: 1, // 审核状态
+        invalidReason: '' // 审核信息
       },
       dialogFormRules: {
-        reason: { required: true, message: '不通过原因不能为空', tigger: 'blur' }
+        invalidReason: {
+          required: true,
+          message: '不通过原因不能为空',
+          tigger: 'blur'
+        }
       },
       // 机构信息审核列表
-      reviewData: [
-        {
-          authParty: '果果哒',
-          reviewStatus: 1,
-          reviewTime: '2020/12/12 12:12:12',
-          reviewBy: 'admin',
-          shopReviewStatus: 0
-        },
-        {
-          authParty: '阿里巴巴',
-          reviewStatus: 1,
-          reviewTime: '2020/12/12 12:12:12',
-          reviewBy: 'admin',
-          shopReviewStatus: 1
-        },
-        {
-          authParty: '腾讯科技',
-          reviewStatus: 2,
-          reviewTime: '2020/12/12 12:12:12',
-          reviewBy: 'admin',
-          shopReviewStatus: 0
-        },
-        {
-          authParty: '字节跳动',
-          reviewStatus: 0,
-          reviewTime: '2020/12/12 12:12:12',
-          reviewBy: 'admin',
-          shopReviewStatus: 1
-        }
-      ]
+      list: []
     }
   },
+  computed: {
+    ...mapGetters(['authUserId'])
+  },
+  created() {
+    this.listQuery.authUserId = this.$route.query.authUserId
+    this.getList()
+  },
   methods: {
-    // 过滤列表
-    handleFilter() {},
+    // 获取授权列表
+    getList() {
+      this.listLoading = true
+      fecthAuthList(this.listQuery).then(response => {
+        if (response.code !== 0) return
+        const { list, total } = response.data
+        this.list = list
+        this.total = total
+      }).finally(() => {
+        this.listLoading = false
+      })
+    },
+    // 审核
+    auditStatusHandle() {
+      this.$refs.formRef.validate(valid => {
+        if (valid) {
+          // 指定审核人
+          this.dialogData.auditBy = this.authUserId
+          // 提交审核信息
+          auditAuth(this.dialogData).then(res => {
+            if (res.code !== 0) return
+            this.$message.success(res.data)
+          }).finally(() => {
+            this.dialogVisible = false
+            this.getList()
+          })
+        }
+      })
+    },
     // 审核对话框
     handleShowDialog(item) {
+      console.log(item)
       this.dialogData.authParty = item.authParty
+      this.dialogData.authId = item.authId
       this.dialogVisible = true
     },
     // 审核对话框关闭
@@ -196,8 +264,8 @@ export default {
   }
 }
 
-.auth-info{
-  .auth-name{
+.auth-info {
+  .auth-name {
     font-size: 16px;
     padding-bottom: 25px;
     border-bottom: 1px solid #ddd;

+ 65 - 35
src/views/supplier/review/index.vue

@@ -8,7 +8,7 @@
         placeholder="供应商名称"
         style="width: 200px"
         class="filter-item"
-        @keyup.enter.native="handleFilter"
+        @keyup.enter.native="getList"
       />
       <span>供应商类型:</span>
       <el-select
@@ -17,6 +17,7 @@
         clearable
         style="width: 200px"
         class="filter-item"
+        @change="getList"
       >
         <el-option label="所有类型" value="" />
         <el-option label="代理商" :value="2" />
@@ -28,20 +29,20 @@
         placeholder="手机号"
         style="width: 200px"
         class="filter-item"
-        @keyup.enter.native="handleFilter"
+        @keyup.enter.native="getList"
       />
       <span>审核状态:</span>
       <el-select
-        v-model="listQuery.reviewStatus"
+        v-model="listQuery.lowerAuditStatus"
         placeholder="供应商类型"
         clearable
         style="width: 200px"
         class="filter-item"
+        @change="getList"
       >
-        <el-option label="所有类型" value="" />
-        <el-option label="已审核" :value="1" />
-        <el-option label="未审核" :value="2" />
-        <el-option label="未通过" :value="0" />
+        <el-option label="全部" value="" />
+        <el-option label="已完成审核" :value="1" />
+        <el-option label="未完成审核" :value="0" />
       </el-select>
       <span>联系人:</span>
       <el-input
@@ -49,15 +50,15 @@
         placeholder="联系人"
         style="width: 200px"
         class="filter-item"
-        @keyup.enter.native="handleFilter"
+        @keyup.enter.native="getList"
       />
-      <el-button type="primary" @click="getList(listQuery)">查询</el-button>
+      <el-button type="primary" icon="el-icon-search" @click="getList">查询</el-button>
     </div>
     <!-- 搜索区域END -->
     <!-- 表格区域 -->
     <el-table
       v-loading="listLoading"
-      :data="reviewData"
+      :data="list"
       style="width: 100%"
       border
       fit
@@ -65,9 +66,9 @@
       cell-class-name="table-cell"
     >
       <el-table-column label="序号" type="index" width="80" align="center" />
-      <el-table-column prop="shopName" label="供应商名称" align="center" />
+      <el-table-column prop="name" label="供应商名称" align="center" />
       <el-table-column label="供应商类型" width="150px" align="center">
-        <template slot-scope="{row}">
+        <template slot-scope="{ row }">
           <span v-if="row.shopType === 1">品牌方</span>
           <span v-if="row.shopType === 2">代理商</span>
         </template>
@@ -75,49 +76,78 @@
       <el-table-column prop="mobile" label="手机号" width="200px" align="center" />
       <el-table-column prop="linkMan" label="联系人" width="200px" align="center" />
       <el-table-column label="审核状态" width="220px" align="center">
-        <template slot-scope="{row}">
-          <span v-if="row.reviewStatus === 0" class="status danger">未完成审核</span>
-          <span v-if="row.reviewStatus === 1" class="status success">已完成审核</span>
+        <template slot-scope="{ row }">
+          <el-tag v-if="row.lowerAuditStatus === 0" size="small" type="danger">未完成审核</el-tag>
+          <el-tag v-if="row.lowerAuditStatus === 1" size="small" type="success">已完成审核</el-tag>
         </template>
       </el-table-column>
       <el-table-column label="操作" width="240px" align="center">
-        <template>
-          <el-badge :value="12">
-            <el-button type="primary" size="mini" @click="$_navigationTo('auth-list')">品牌授权信息审核</el-button>
+        <template slot-scope="{ row }">
+          <el-badge :hidden="row.lowerAuditStatus === 1" :value="row.waitAuditNum" :max="99">
+            <el-button
+              type="primary"
+              icon="el-icon-s-check"
+              size="mini"
+              @click="$_navigationTo(`auth-list?authUserId=${row.authUserId}`)"
+            >品牌授权信息审核</el-button>
           </el-badge>
         </template>
       </el-table-column>
     </el-table>
     <!-- 表格区域END -->
+    <!-- 页码 -->
+    <pagination
+      v-show="total > 0"
+      :total="total"
+      :page.sync="listQuery.pageNum"
+      :limit.sync="listQuery.pageSize"
+      @pagination="getList(listQuery)"
+    />
   </div>
 </template>
 
 <script>
+import { fetchSupplierList } from '@/api/supplier'
+import Pagination from '@/components/Pagination'
 export default {
+  components: { Pagination },
   data() {
     return {
-      listLoading: false,
       listQuery: {
-        shopName: '',
-        shopType: '',
-        mobile: '',
-        reviewStatus: '',
-        linkMan: ''
+        listType: 2,
+        brandId: '', // 品牌id
+        linkMan: '', // 联系人
+        mobile: '', // 手机号
+        pageNum: 0, // 页码
+        pageSize: 20, // 分页大小
+        shopName: '', // 供应商名称
+        shopType: '', // 供应商类型
+        lowerAuditStatus: ''
       },
-      reviewData: [
-        {
-          shopName: '果果哒',
-          shopType: 1,
-          mobile: '15872950940',
-          linkMan: '预谋',
-          reviewStatus: 1
-        }
-      ]
+      listLoading: false,
+      list: [],
+      total: 0
     }
   },
+  created() {
+    this.getList()
+  },
   methods: {
     // 过滤列表
-    handleFilter() {}
+    handleFilter() {},
+    // 获取供应商列表
+    getList() {
+      this.listLoading = true
+      fetchSupplierList(this.listQuery)
+        .then(res => {
+          if (res.code !== 0) return
+          this.list = res.data.list
+          this.total = res.data.total
+        })
+        .finally(() => {
+          this.listLoading = false
+        })
+    }
   }
 }
 </script>
@@ -141,7 +171,7 @@ export default {
     margin-left: 10px;
   }
 }
-.el-table .cell{
+.el-table .cell {
   overflow: visible;
 }
 </style>

+ 77 - 46
src/views/supplier/review/shopDetail.vue

@@ -1,83 +1,114 @@
 <template>
-  <div class="shop-detail">
-    <el-form ref="formRef" :model="formData" :rules="formRules" label-width="120px">
+  <div v-loading="isLoading" class="shop-detail">
+    <el-form v-if="product!==null" ref="formRef" :model="formData" :rules="formRules" label-width="120px">
       <el-form-item label="商品名称:">
-        <span>某某某商品高级货色</span>
+        <span>{{ product.productName }}</span>
       </el-form-item>
       <el-form-item label="商品SN码:">
-        <span>954sad54gasg</span>
+        <span>{{ product.snCode }}</span>
       </el-form-item>
       <el-form-item label="商品图片:">
         <el-image
           style="width: 140px; height: 140px"
-          :src="shopImageUrl"
-          :preview-src-list="srcList"
+          :src="product.productImage"
+          :preview-src-list="imgList"
         />
       </el-form-item>
       <el-form-item label="授权牌:">
         <el-image
           style="width: 140px; height: 140px"
-          :src="authorizeUrl"
-          :preview-src-list="srcList"
+          :src="product.certificateImage"
+          :preview-src-list="imgList"
         />
       </el-form-item>
-      <el-form-item label="相关参数:">
-        <table>
-          <tr>
-            <td>品牌:</td>
-            <td>阿里巴巴</td>
-          </tr>
-          <tr>
-            <td>品牌:</td>
-            <td>阿里巴巴</td>
-          </tr>
-          <tr>
-            <td>品牌:</td>
-            <td>阿里巴巴</td>
-          </tr>
-          <tr>
-            <td>品牌:</td>
-            <td>阿里巴巴</td>
-          </tr>
-        </table>
-      </el-form-item>
+      <template v-if="product.paramList.length>0">
+        <el-form-item label="相关参数:">
+          <table>
+            <tr v-for="(params,index) in product.paramList" :key="index">
+              <td>{{ params.paramName }}:</td>
+              <td>{{ params.paramContent }}</td>
+            </tr>
+          </table>
+        </el-form-item>
+      </template>
 
       <el-form-item label="审核状态:">
-        <el-radio-group v-model="formData.status">
+        <el-radio-group v-model="formData.auditStatus">
           <el-radio :label="1">通过</el-radio>
           <el-radio :label="0">不通过</el-radio>
         </el-radio-group>
       </el-form-item>
-      <el-form-item v-if="formData.status!==1" prop="reason" label="原因:">
-        <el-input v-model="formData.reason" type="textarea" placeholder="请说明原因" />
+      <el-form-item v-if="formData.auditStatus!==1" prop="invalidReason" label="原因:">
+        <el-input v-model="formData.invalidReason" type="textarea" placeholder="请说明原因" />
       </el-form-item>
       <el-form-item>
-        <el-button type="info">返回</el-button>
-        <el-button type="primary">提交</el-button>
+        <el-button type="info" @click="$_back">返回</el-button>
+        <el-button type="primary" @click="submit">提交</el-button>
       </el-form-item>
     </el-form>
   </div>
 </template>
 
 <script>
+import { getProductById, auditProduct } from '@/api/product'
+import { mapGetters } from 'vuex'
 export default {
   data() {
     return {
-      titleCol: 4,
-      contentCol: 18,
-      shopImageUrl: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
-      authorizeUrl: 'https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg',
-      srcList: [
-        'https://fuss10.elemecdn.com/8/27/f01c15bb73e1ef3793e64e6b7bbccjpeg.jpeg',
-        'https://fuss10.elemecdn.com/1/8e/aeffeb4de74e2fde4bd74fc7b4486jpeg.jpeg'
-      ],
+      authId: '', // 当前产品所属授权机构id
+      isLoading: false,
       formData: {
-        status: 1,
-        reason: ''
+        auditBy: '', // 审核人id
+        productId: '', // 商品id
+        auditStatus: 1, // 商品审核状态
+        invalidReason: '' // 审核信息
       },
       formRules: {
-        reason: { required: true, message: '不通过原因不能为空', tigger: 'blur' }
-      }
+        invalidReason: { required: true, message: '不通过原因不能为空', tigger: 'blur' }
+      },
+      imgList: [], // 图片列表
+      product: null // 商品信息
+    }
+  },
+  computed: {
+    ...mapGetters(['authUserId'])
+  },
+  created() {
+    this.formData.productId = this.$route.query.id
+    this.authId = this.$route.query.authId
+    this.getDetail()
+  },
+  methods: {
+    // 获取商品详情
+    getDetail() {
+      this.isLoading = true
+      getProductById({ productId: this.formData.productId })
+        .then(res => {
+          if (res.code !== 0) return
+          this.product = res.data
+          this.imgList = [this.product.productImage, this.product.certificateImage]
+        }).finally(() => {
+          this.isLoading = false
+        })
+    },
+    // 提交审核信息
+    submit() {
+      this.$refs.formRef.validate(valid => {
+        if (valid) {
+          this.isLoading = true
+          // 指定审核人
+          this.formData.auditBy = this.authUserId
+          // 提交审核信息
+          auditProduct(this.formData).then(res => {
+            if (res.code !== 0) return
+            this.$message.success(res.data)
+            this.$store.dispatch('tagsView/delView', this.$route)
+            this.$router.replace(`/review/shop-list?authId=${this.authId}`)
+          }).finally(() => {
+            this.isLoading = false
+          })
+        }
+      })
     }
   }
 }
@@ -97,7 +128,7 @@ export default {
     }
   }
   .el-form {
-    width: 600px;
+    width: 800px;
     margin: 25px auto 0;
     .el-button{
       width: 120px;

+ 82 - 42
src/views/supplier/review/shopList.vue

@@ -4,19 +4,19 @@
     <div class="filter-container">
       <span>商品名称:</span>
       <el-input
-        v-model="listQuery.shopName"
+        v-model="listQuery.productName"
         placeholder="请输入商品名称"
         style="width: 200px"
         class="filter-item"
-        @keyup.enter.native="handleFilter"
+        @keyup.enter.native="getList"
       />
       <span>商品SN码:</span>
       <el-input
-        v-model="listQuery.mobile"
+        v-model="listQuery.snCode"
         placeholder="请输入商品SN码"
         style="width: 200px"
         class="filter-item"
-        @keyup.enter.native="handleFilter"
+        @keyup.enter.native="getList"
       />
       <span>审核状态:</span>
       <el-select
@@ -25,19 +25,20 @@
         clearable
         style="width: 200px"
         class="filter-item"
+        @change="getList"
       >
         <el-option label="所有类型" value="" />
         <el-option label="待审核" :value="1" />
         <el-option label="审核通过" :value="2" />
         <el-option label="审核未通过" :value="0" />
       </el-select>
-      <el-button type="primary">查询</el-button>
+      <el-button type="primary" icon="el-icon-search" @click="getList">查询</el-button>
     </div>
     <!-- 搜索区域END -->
     <!-- 表格区域 -->
     <el-table
       v-loading="listLoading"
-      :data="reviewData"
+      :data="list"
       style="width: 100%"
       border
       fit
@@ -46,66 +47,104 @@
     >
       <el-table-column label="序号" type="index" width="80" align="center" />
       <el-table-column prop="productName" label="商品名称" align="center" />
-      <el-table-column prop="sncode" label="商品SN码" align="center" />
+      <el-table-column prop="snCode" label="商品SN码" align="center" />
       <el-table-column label="审核状态" width="220px" align="center">
+        <template slot-scope="{ row }">
+          <el-tag v-if="row.auditStatus === 2" size="small" type="warning">待审核</el-tag>
+          <el-tag v-if="row.auditStatus === 1" size="small" type="success">审核通过</el-tag>
+          <!-- 未通过原因展示 -->
+          <template v-if="row.auditStatus === 0">
+            <!-- <span class="status danger">审核未通过&nbsp;</span> -->
+            <el-popover
+              placement="top-start"
+              title="审核说明"
+              width="400"
+              trigger="hover"
+              :content="row.invalidReason"
+            >
+              <el-tag slot="reference" size="small" type="danger" class="reason">
+                <span>审核未通过</span>
+                <span class="el-icon-question status danger " />
+              </el-tag>
+            </el-popover>
+            <!-- 未通过原因展示END -->
+          </template>
+        </template>
+      </el-table-column>
+      <el-table-column label="审核时间" width="250px" align="center">
+        <template slot-scope="{row}">
+          <span v-if="row.auditStatus!==2">{{ row.auditTime | formatTime }}</span>
+          <span v-else>—</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="审核人" align="center">
         <template slot-scope="{row}">
-          <span v-if="row.reviewStatus === 2" class="status warning">待审核</span>
-          <span v-if="row.reviewStatus === 1" class="status success">审核通过</span>
-          <span v-if="row.reviewStatus === 0" class="status danger">审核未通过</span>
+          <span v-if="row.auditStatus!==2">{{ row.auditBy }}</span>
+          <span v-else>—</span>
         </template>
       </el-table-column>
-      <el-table-column prop="reviewTime" label="审核时间" align="center" />
-      <el-table-column prop="reviewBy" label="审核人" align="center" />
       <el-table-column label="操作" width="240px" align="center">
-        <template>
-          <el-button type="primary" size="mini" @click="$_navigationTo('shop-detail')">审核</el-button>
+        <template slot-scope="{row}">
+          <el-button v-if="row.auditStatus === 2" type="primary" icon="el-icon-s-check" size="mini" @click="$_navigationTo(`shop-detail?id=${row.productId}&authId=${listQuery.authId}`)">审核</el-button>
+          <span v-else class="status success el-icon-check">&nbsp;已审核</span>
         </template>
       </el-table-column>
     </el-table>
     <!-- 表格区域END -->
+    <!-- 页码 -->
+    <pagination v-show="total>0" :total="total" :page.sync="listQuery.pageNum" :limit.sync="listQuery.pageSize" @pagination="getList" />
   </div>
 </template>
 
 <script>
+import Pagination from '@/components/Pagination'
+import { getProdList } from '@/api/product'
+import { formatDate } from '@/utils'
 export default {
+  components: { Pagination },
+  filters: {
+    formatTime(time) {
+      if (!time) {
+        return ''
+      }
+      return formatDate(time, 'yyyy-MM-DD HH:mm:ss')
+    }
+  },
+
   data() {
     return {
       listLoading: false,
       listQuery: {
-        shopName: '',
-        shopType: '',
-        mobile: '',
+        listType: 2,
+        authId: '',
+        productName: '',
         reviewStatus: '',
-        linkMan: ''
+        snCode: '',
+        pageNum: 1,
+        pageSize: 10
       },
-      reviewData: [
-        {
-          productName: '果果哒',
-          reviewStatus: 1,
-          reviewTime: '2021/12/12 12:12:12',
-          sncode: 'jlfasdjlgds',
-          reviewBy: 'admin'
-        },
-        {
-          productName: '拼多多三折',
-          reviewStatus: 2,
-          reviewTime: '2021/12/12 12:12:12',
-          sncode: 'jlfasdjlgds',
-          reviewBy: 'admin'
-        },
-        {
-          productName: '淘宝五折',
-          reviewStatus: 0,
-          reviewTime: '2021/12/12 12:12:12',
-          sncode: 'jlfasdjlgds',
-          reviewBy: 'admin'
-        }
-      ]
+      total: 0,
+      list: []
     }
   },
+  created() {
+    this.listQuery.authId = this.$route.query.authId
+    this.getList()
+  },
   methods: {
     // 过滤列表
-    handleFilter() {}
+    handleFilter() {},
+    // 获取列表信息
+    getList() {
+      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
+      })
+    }
   }
 }
 </script>
@@ -132,4 +171,5 @@ export default {
 .el-table .cell{
   overflow: visible;
 }
+
 </style>

+ 1 - 0
src/views/supplier/user/add.vue

@@ -312,6 +312,7 @@ export default {
             message: h('i', { style: 'color: #333' }, `已添加供应商:"${this.formData1.shopName}"`),
             duration: 3000
           })
+          this.$store.dispatch('tagsView/delView', this.$route)
           this.$router.push('/supplier')
         }).finally(() => {
           this.isLoading = false

+ 1 - 0
src/views/supplier/user/edit.vue

@@ -363,6 +363,7 @@ export default {
             message: h('i', { style: 'color: #333' }, `已修改供应商:"${this.formData1.shopName}"`),
             duration: 3000
           })
+          this.$store.dispatch('tagsView/delView', this.$route)
           this.$router.push('/supplier')
         }).finally(() => {
           this.isLoading = false

+ 5 - 31
src/views/supplier/user/index.vue

@@ -23,8 +23,8 @@
       <el-input v-model="listQuery.mobile" placeholder="手机号" style="width: 200px;" class="filter-item" @keyup.enter.native="handleFilter" />
       <span>联系人:</span>
       <el-input v-model="listQuery.linkMan" placeholder="联系人" style="width: 200px;" class="filter-item" @keyup.enter.native="handleFilter" />
-      <el-button type="primary" @click="getList(listQuery)">查询</el-button>
-      <el-button type="primary" @click="$_navigationTo('add')">添加供应商</el-button>
+      <el-button type="primary" icon="el-icon-search" @click="getList(listQuery)">查询</el-button>
+      <el-button type="primary" icon="el-icon-edit" @click="$_navigationTo('add')">添加供应商</el-button>
     </div>
     <!-- 表格区域 -->
     <el-table
@@ -88,6 +88,7 @@ import { fetchSupplierList, supplierStatusChange } from '@/api/supplier'
 import { resetPassword } from '@/api/user'
 import { fetchBrandList } from '@/api/brand'
 import { formatDate } from '@/utils'
+// import scrollTo from '@/mixin/scrollTo'
 export default {
   name: 'ComplexTable',
   components: { Pagination },
@@ -99,6 +100,7 @@ export default {
       return formatDate(time, 'yyyy-MM-DD HH:mm:ss')
     }
   },
+  // mixins: [scrollTo],
   data() {
     return {
       slider: 1,
@@ -120,38 +122,10 @@ export default {
     }
   },
   created() {
-    // console.log(1)
-    // this.prevData = JSON.parse(window.localStorage.getItem('prevData')) || null
-    // if (this.prevData !== null) {
-    //   this.listQuery.pageNum = this.prevData.prevData
-    //   this.listQuery.pageSize = this.prevData.pageSize
-    // }
     this.getList()
     this.getBrandList()
   },
-  // mounted() {
-  //   if (this.prevData !== null) {
-  //     window.scrollTo(0, this.prevData.scroll)
-  //   }
-  //   this.addEventListenerScroll()
-  // },
   methods: {
-    // addEventListenerScroll() {
-    //   let timer = null
-    //   const that = this
-    //   window.addEventListener('scroll', function() {
-    //     clearTimeout(timer)
-    //     timer = setTimeout(() => {
-    //       // console.log(this.scrollY)
-    //       const data = JSON.stringify({
-    //         scroll: this.scrollY,
-    //         pageNum: that.listQuery.pageNum,
-    //         pageSize: that.listQuery.pageSize
-    //       })
-    //       window.localStorage.setItem('prevData', data)
-    //     }, 200)
-    //   })
-    // },
     // 获取列表数据
     getList() {
       this.listLoading = true
@@ -224,7 +198,7 @@ export default {
         const h = this.$createElement
         this.$notify.success({
           title: '重置密码',
-          message: h('i', { style: 'color: #333' }, `已重置供应商"${item.name}"的面膜`),
+          message: h('i', { style: 'color: #333' }, `已重置供应商"${item.name}"的密码`),
           duration: 2000
         })
       })

Some files were not shown because too many files changed in this diff