Explorar o código

v1.7.4上正式

yuwenjun1997 %!s(int64=2) %!d(string=hai) anos
pai
achega
61faeff09b

+ 4 - 4
.env.development

@@ -2,13 +2,13 @@
 EVN = 'development'
 
 # 网站地址
-# LOCALHOSE = 'https://zp-b.caimei365.com'
-LOCALHOSE = 'http://192.168.2.92:8888'
+LOCALHOSE = 'https://zp-b.caimei365.com'
+# LOCALHOSE = 'http://192.168.2.92:8888'
 # LOCALHOSE = 'http://192.168.1.102:8888'
 
 # 接口api地址
-# BASE_URL = 'https://zplma-b.caimei365.com'
-BASE_URL = 'http://192.168.2.200:8012'
+BASE_URL = 'https://zplma-b.caimei365.com'
+# BASE_URL = 'http://192.168.2.200:8012'
 # BASE_URL = 'http://192.168.2.67:8012'
 
 # 静态资源文件地址

+ 6 - 2
apis/module/common.js

@@ -34,8 +34,12 @@ export default ($axios) => {
     $axios.post('/wx/data/feedback/submit', data)
 
   // 验证token是否到期
-  commonApis.checkToken = (data = {}) =>
-    $axios.post('/wx/user/login/token/check', data)
+  commonApis.checkToken = (params = {}) =>
+    $axios.get('/wx/user/login/token/check', params)
+
+  // 校验token并返回用户信息
+  commonApis.checkTokenResult = (params) =>
+    $axios.get('/wx/data/token/check', params)
 
   // 获取城市列表(树状)
   commonApis.fetchCityList = (params = {}) =>

+ 20 - 7
layouts/app-ross.vue

@@ -47,8 +47,8 @@
                   <span class="icon el-icon-arrow-down"></span>
                   <div class="drop-down">
                     <ul class="nav">
-                      <li @click="onUserCenter">个人中心</li>
-                      <li @click="logout">退出登录</li>
+                      <li @click.stop="onUserCenter">个人中心</li>
+                      <li @click.stop="logout">退出登录</li>
                     </ul>
                   </div>
                 </div>
@@ -228,14 +228,16 @@ export default {
 
     // 回到首页
     backHome() {
-      if (this.$route.path === this.routePrefix) return
-      this.$router.replace(this.routePrefix)
+      // if (this.$route.path === this.routePrefix) return
+      // this.$router.replace(this.routePrefix)
+      window.location.href = window.location.origin + this.routePrefix
     },
 
     // 个人中心
     onUserCenter() {
-      const path = `${this.routePrefix}/center`
-      this.$router.push(path)
+      // const path = `${this.routePrefix}/center`
+      window.location.href =
+        window.location.origin + `${this.routePrefix}/center`
     },
 
     // 响应页面宽度变化
@@ -257,7 +259,7 @@ export default {
 <style scoped lang="scss">
 @keyframes slide-down {
   0% {
-    top: 12px;
+    top: 48px;
     z-index: 9;
     opacity: 0;
   }
@@ -516,6 +518,17 @@ export default {
           margin: 0 1.6vw;
         }
 
+        .login-btn {
+          width: 13.4vw;
+          height: 6.4vw;
+          color: #fff;
+          background: rgba(255, 255, 255, 0.39);
+          font-size: 3.4vw;
+          text-align: center;
+          line-height: 6.4vw;
+          margin-right: 2.4vw;
+        }
+
         .user-center {
           position: relative;
 

+ 206 - 3
pages/_template/ross/center/club-detail.vue

@@ -29,9 +29,15 @@
           <div class="col content">{{ clubInfo.area }}</div>
         </div>
         <div class="row">
-          <div class="col label">所在位置:</div>
+          <div class="col label">详细地址:</div>
           <div class="col content">{{ clubInfo.address }}</div>
         </div>
+        <div class="row">
+          <div class="col label">所在位置:</div>
+          <div class="col content">
+            <div class="postion-btn" @click="initMap">查看定位</div>
+          </div>
+        </div>
         <div class="row block">
           <div class="col label">logo:</div>
           <div class="col content">
@@ -69,6 +75,21 @@
         </div>
       </template>
     </div>
+
+    <div class="position-select" v-if="mapVisiable">
+      <div class="position-select-container">
+        <SimpleAMap ref="aMap" :lnglat="lnglat" />
+        <div class="position-select-footer">
+          <div class="lnglat">当前经纬度:{{ clubInfo.lngAndLat }}</div>
+          <div
+            class="position-confirm postion-control"
+            @click="mapVisiable = false"
+          >
+            确定
+          </div>
+        </div>
+      </div>
+    </div>
   </div>
 </template>
 
@@ -78,13 +99,14 @@ export default {
   layout: 'app-ross',
   data() {
     return {
+      mapVisiable: false,
       clubInfo: {},
     }
   },
   computed: {
     ...mapGetters(['userInfo', 'routePrefix']),
     isAuth() {
-      return this.userInfo && this.userInfo.authId
+      return this.clubInfo.auditStatus === 1
     },
     firstClubTypeName() {
       if (!this.clubInfo.firstClubType) return '其他'
@@ -98,16 +120,20 @@ export default {
         this.clubInfo.secondClubType - 1
       ]
     },
+    lnglat() {
+      return this.clubInfo.lngAndLat ? this.clubInfo.lngAndLat.split(',') : null
+    },
   },
   created() {
     this.fetchClubDetail()
   },
   methods: {
+    // 获取机构详情
     async fetchClubDetail() {
       try {
         const authId = this.userInfo.authId
         if (!authId) return
-        const res = await this.$http.api.getAuthClubDetail({ authId })
+        const res = await this.$http.api.fetchClubAuthInfoData({ authId })
         this.clubInfo = res.data
       } catch (error) {
         console.log(error)
@@ -117,6 +143,13 @@ export default {
     toAuth() {
       this.$router.push(`${this.routePrefix}/form/club-register`)
     },
+    // 地图定位
+    initMap() {
+      this.mapVisiable = true
+      this.$nextTick(() => {
+        this.$refs.aMap.init()
+      })
+    },
   },
 }
 </script>
@@ -128,6 +161,67 @@ export default {
     justify-content: center;
   }
 
+  .position-select {
+    width: 100vw;
+    height: 100vh;
+    background: rgba(0, 0, 0, 0.39);
+    position: fixed;
+    top: 0;
+    left: 0;
+    z-index: 999;
+
+    display: flex;
+    justify-content: center;
+    align-items: center;
+
+    .position-select-container {
+      background: #fff;
+      width: 60%;
+      box-sizing: border-box;
+      padding: 24px;
+
+      .position-select-footer {
+        position: relative;
+        display: flex;
+        justify-content: flex-end;
+        align-items: center;
+        padding-top: 24px;
+
+        .lnglat {
+          position: absolute;
+          font-size: 14px;
+          color: #666;
+
+          left: 0;
+          top: 50%;
+          transform: translateY(-50%);
+        }
+      }
+
+      .postion-control {
+        width: 120px;
+        height: 40px;
+        font-size: 14px;
+        border-radius: 4px;
+        display: flex;
+        justify-content: center;
+        align-items: center;
+        cursor: pointer;
+        margin-left: 16px;
+
+        &.position-confirm {
+          background: #f56c6c;
+          color: #fff;
+        }
+
+        &.position-cancel {
+          background: #b1b1b1;
+          color: #fff;
+        }
+      }
+    }
+  }
+
   .page-content {
     max-width: 760px;
     padding-bottom: 167px;
@@ -185,6 +279,30 @@ export default {
             margin-right: 0;
           }
         }
+
+        .postion-btn {
+          height: 28px;
+          line-height: 28px;
+          font-size: 14px;
+          color: #fff;
+          background: #1890ff;
+          display: flex;
+          justify-content: center;
+          align-items: center;
+          cursor: pointer;
+          border-radius: 4px;
+          padding: 0 8px;
+
+          &::before {
+            content: '';
+            display: inline-block;
+            width: 16px;
+            height: 16px;
+            background: url(~assets/theme-images/common/icon-position.png)
+              no-repeat center;
+            background-size: 16px 16px;
+          }
+        }
       }
     }
   }
@@ -196,6 +314,67 @@ export default {
     justify-content: center;
   }
 
+  .position-select {
+    width: 100vw;
+    height: 100vh;
+    background: rgba(0, 0, 0, 0.39);
+    position: fixed;
+    top: 0;
+    left: 0;
+    z-index: 999;
+
+    display: flex;
+    justify-content: center;
+    align-items: center;
+
+    .position-select-container {
+      background: #fff;
+      width: 80%;
+      box-sizing: border-box;
+      padding: 3.2vw;
+
+      .position-select-footer {
+        padding-top: 10vw;
+        position: relative;
+        display: flex;
+        justify-content: flex-end;
+        align-items: center;
+
+        .lnglat {
+          position: absolute;
+          font-size: 3.2vw;
+          color: #666;
+
+          left: 0;
+          top: 5vw;
+          transform: translateY(-50%);
+        }
+      }
+
+      .postion-control {
+        width: 16vw;
+        height: 7vw;
+        font-size: 3.4vw;
+        border-radius: 0.4vw;
+        display: flex;
+        justify-content: center;
+        align-items: center;
+        cursor: pointer;
+        margin-left: 3.6vw;
+
+        &.position-confirm {
+          background: #f56c6c;
+          color: #fff;
+        }
+
+        &.position-cancel {
+          background: #b1b1b1;
+          color: #fff;
+        }
+      }
+    }
+  }
+
   .page-content {
     padding: 0 4vw;
     .title {
@@ -258,6 +437,30 @@ export default {
             margin-right: 0;
           }
         }
+
+        .postion-btn {
+          height: 6.8vw;
+          line-height: 6.8vw;
+          font-size: 3.2vw;
+          color: #fff;
+          background: #1890ff;
+          display: flex;
+          justify-content: center;
+          align-items: center;
+          cursor: pointer;
+          border-radius: 0.4vw;
+          padding: 0 1.2vw;
+
+          &::before {
+            content: '';
+            display: inline-block;
+            width: 3.58vw;
+            height: 3.58vw;
+            background: url(~assets/theme-images/common/icon-position.png)
+              no-repeat center;
+            background-size: 3.58vw;
+          }
+        }
       }
     }
   }

+ 38 - 3
pages/_template/ross/center/device/index.vue

@@ -22,6 +22,7 @@
           </div>
         </div>
       </div>
+      <div class="to-auth-btn" v-if="isAuth && !isPc" @click="toAuth">去认证</div>
     </div>
   </div>
 </template>
@@ -33,6 +34,7 @@ export default {
   data() {
     return {
       list: [],
+      clubInfo: {},
     }
   },
   filters: {
@@ -42,13 +44,14 @@ export default {
     },
   },
   computed: {
-    ...mapGetters(['routePrefix', 'userInfo', 'authUserId']),
+    ...mapGetters(['routePrefix', 'userInfo', 'authUserId', 'isPc']),
     isAuth() {
-      return this.userInfo && this.userInfo.authId
+      return this.clubInfo.auditStatus === 1 && this.list.length > 0
     },
   },
   created() {
     this.fetchProductList()
+    this.fetchAuthDetail()
   },
   methods: {
     // 产看详情
@@ -56,6 +59,18 @@ export default {
       const path = `${this.routePrefix}/center/device/detail?productId=${row.productId}&relationId=${row.relationId}`
       this.$router.push(path)
     },
+    // 获取机构信息
+    async fetchAuthDetail() {
+      try {
+        if (this.userInfo && !this.userInfo.authId) return
+        const res = await this.$http.api.fetchClubAuthInfoData({
+          authId: this.userInfo.authId,
+        })
+        this.clubInfo = res.data
+      } catch (error) {
+        console.log(error)
+      }
+    },
     // 获取已认证设备列表
     async fetchProductList() {
       try {
@@ -65,7 +80,9 @@ export default {
           authId,
           authUserId: this.authUserId,
         })
-        this.list = res.data
+        if (res.data) {
+          this.list = res.data
+        }
       } catch (error) {
         console.log(error)
       }
@@ -123,6 +140,7 @@ export default {
       display: flex;
       justify-content: space-between;
       align-items: center;
+      flex-wrap: wrap;
 
       .device {
         width: 490px;
@@ -133,6 +151,7 @@ export default {
         align-items: center;
         box-sizing: border-box;
         padding: 16px;
+        margin-bottom: 20px;
         cursor: pointer;
 
         .cover {
@@ -171,6 +190,21 @@ export default {
       padding: 8vw 0;
     }
 
+    .to-auth-btn {
+      width: 85.2vw;
+      height: 12vw;
+      background: #f3920d;
+      border-radius: 0.2vw;
+      text-align: center;
+      line-height: 12vw;
+      color: #ffffff;
+      font-size: 3.6vw;
+      position: fixed;
+      bottom: 24vw;
+      left: 50%;
+      transform: translateX(-50%);
+    }
+
     .tip {
       font-size: 3vw;
       color: #b2b2b2;
@@ -193,6 +227,7 @@ export default {
 
     .device-list {
       padding: 0 3.2vw;
+      padding-bottom: 26vw;
       .device {
         height: 26vw;
         background: #f3f5f6;

+ 99 - 8
pages/_template/ross/center/index.vue

@@ -2,7 +2,7 @@
   <div class="page">
     <div class="page-top flex flex-col justify-center items-center">
       <div class="club-logo">
-        <img :src="userInfo.logo" alt="" v-if="userInfo.logo" />
+        <img :src="clubInfo.logo" alt="" v-if="isAuth" />
         <img
           src="~/assets/theme-images/common/pc-icon-club-logo-default.png"
           v-else-if="isPc"
@@ -13,22 +13,24 @@
         />
       </div>
       <div class="club-mobile">{{ userInfo.mobile }}</div>
-      <div class="club-name" v-if="userInfo.authId">
-        机构:{{ userInfo.authParty }}
-      </div>
+      <div class="club-name" v-if="isAuth">机构:{{ clubInfo.authParty }}</div>
     </div>
     <div class="page-content">
       <div class="section-title">我的认证</div>
       <div class="section-content">
         <div class="item club" @click="onToClubDetail">
-          <div class="auth-icon auth">已认证</div>
+          <div class="auth-icon" :class="isAuth ? 'auth' : 'un-auth'">
+            {{ isAuth ? '已认证' : '未认证' }}
+          </div>
           <div class="tip">机构认证</div>
           <div class="btn">
             点击查看<span class="icon el-icon-arrow-right"></span>
           </div>
         </div>
         <div class="item device" @click="onToDeviceList">
-          <div class="auth-icon un-auth">未认证</div>
+          <div class="auth-icon" :class="isAuthDevice ? 'auth' : 'un-auth'">
+            {{ isAuthDevice ? '已认证' : '未认证' }}
+          </div>
           <div class="tip">设备认证</div>
           <div class="btn">
             点击查看<span class="icon el-icon-arrow-right"></span>
@@ -44,12 +46,13 @@
       </template>
       <template v-else>
         <div class="menu-list">
-          <div class="item">
+          <div class="item" @click="toAccountSubNav">
             <span>账户设置</span>
             <span class="el-icon-arrow-right"></span>
           </div>
         </div>
       </template>
+      <div v-if="!isPc" class="logout" @click="logout">退出登录</div>
     </div>
   </div>
 </template>
@@ -58,10 +61,70 @@
 import { mapGetters } from 'vuex'
 export default {
   layout: 'app-ross',
+  data() {
+    return {
+      clubInfo: {},
+      list: [],
+    }
+  },
   computed: {
-    ...mapGetters(['routePrefix', 'isPc', 'userInfo']),
+    ...mapGetters(['routePrefix', 'isPc', 'userInfo', 'authUserId']),
+    isAuth() {
+      return this.clubInfo.auditStatus === 1
+    },
+    isAuthDevice() {
+      return this.isAuth && this.list.length > 0
+    },
+  },
+  created() {
+    this.initUserInfo()
   },
   methods: {
+    // 初始化用户信息
+    async initUserInfo() {
+      try {
+        const res = await this.$http.api.checkTokenResult()
+        this.$store.dispatch('user/login', res.data)
+        this.$setStorage(this.routePrefix, 'userInfo', res.data)
+        this.fetchAuthDetail()
+        this.fetchProductList()
+      } catch (error) {
+        console.log(error)
+      }
+    },
+    // 获取机构信息
+    async fetchAuthDetail() {
+      try {
+        const authId = this.userInfo.authId
+        if (!authId) return
+        const res = await this.$http.api.fetchClubAuthInfoData({
+          authId,
+        })
+        this.clubInfo = res.data
+      } catch (error) {
+        console.log(error)
+      }
+    },
+    // 获取已认证设备列表
+    async fetchProductList() {
+      try {
+        const authId = this.userInfo.authId
+        if (!authId) return
+        const res = await this.$http.api.fetchClubAuthProductList({
+          authId,
+          authUserId: this.authUserId,
+        })
+        if (res.data) {
+          this.list = res.data
+        }
+      } catch (error) {
+        console.log(error)
+      }
+    },
+    // 去账户设置菜单列表
+    toAccountSubNav() {
+      this.$router.push(`${this.routePrefix}/center/subnav/account`)
+    },
     // 机构详情
     onToClubDetail() {
       this.$router.push(`${this.routePrefix}/center/club-detail`)
@@ -74,6 +137,17 @@ export default {
     onResetPassword() {
       this.$router.push(`${this.routePrefix}/center/settings/password`)
     },
+    // 退出登录
+    logout() {
+      this.$store.dispatch('user/logout')
+      this.$removeStorage(this.routePrefix, 'userInfo')
+      this.backHome()
+    },
+    // 回到首页
+    backHome() {
+      if (this.$route.path === this.routePrefix) return
+      this.$router.replace(this.routePrefix)
+    },
   },
 }
 </script>
@@ -268,12 +342,29 @@ export default {
   }
 
   .page-content {
+    padding-bottom: 26vw;
     .section-title {
       font-size: 4.2vw;
       color: #666666;
       padding: 6.4vw 0 3.2vw;
       padding-left: 4vw;
     }
+
+    .logout {
+      width: 85.2vw;
+      height: 12vw;
+      background: #f3920d;
+      border-radius: 0.2vw;
+      text-align: center;
+      line-height: 12vw;
+      color: #ffffff;
+      font-size: 3.6vw;
+      position: fixed;
+      bottom: 24vw;
+      left: 50%;
+      transform: translateX(-50%);
+    }
+
     .section-content {
       display: flex;
       justify-content: space-between;

+ 18 - 3
pages/_template/ross/center/settings/password.vue

@@ -102,7 +102,7 @@ export default {
   },
   methods: {
     // 返回
-    onBack(){
+    onBack() {
       this.$router.back()
     },
     // 提交
@@ -123,12 +123,27 @@ export default {
           password: this.formData.password,
           authUserId: this.authUserId,
         })
-        this.$toast('密码修改成功')
-        this.$emit('click', 'login')
+        this.$toast('密码修改成功,请重新登录')
+        setTimeout(() => {
+          this.logout()
+        }, 2000)
       } catch (error) {
         console.log(error)
       }
     },
+
+    // 退出登录
+    logout() {
+      this.$store.dispatch('user/logout')
+      this.$removeStorage(this.routePrefix, 'userInfo')
+      this.backHome()
+    },
+
+    // 回到首页
+    backHome() {
+      window.location.href = window.location.origin + this.routePrefix
+    },
+
     // 发送短信验证码
     async onSend() {
       if (this.sendStatus > 0) return

+ 46 - 0
pages/_template/ross/center/subnav/account.vue

@@ -0,0 +1,46 @@
+<template>
+  <div class="sub-nav">
+    <div class="item" @click="onResetPassword">
+      <span>修改密码</span>
+      <span class="el-icon-arrow-right"></span>
+    </div>
+  </div>
+</template>
+
+<script>
+import { mapGetters } from 'vuex'
+export default {
+  layout: 'app-ross',
+  data() {
+    return {}
+  },
+  computed: {
+    ...mapGetters(['routePrefix']),
+  },
+  methods: {
+    // 修改密码
+    onResetPassword() {
+      this.$router.push(`${this.routePrefix}/center/settings/password`)
+    },
+  },
+}
+</script>
+
+<style lang="scss" scoped>
+.sub-nav {
+  padding: 0 4vw;
+  padding-top: 2.4vw;
+  .item {
+    width: 100%;
+    padding: 3vw 0;
+    display: flex;
+    justify-content: space-between;
+    font-size: 3.4vw;
+    border-bottom: 0.1vw solid #c2c2c2;
+
+    .el-icon-arrow-right {
+      font-size: 4vw;
+    }
+  }
+}
+</style>

+ 15 - 1
pages/_template/ross/form/club-register.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="page">
     <div class="page-top flex flex-col justify-center items-center">
-      <!-- <!-- <img class="logo" :src="supplierInfo.logo" /> --> -->
+      <!-- <img class="logo" :src="supplierInfo.logo" /> -->
       <div
         class="name mt-2"
         v-text="supplierInfo.shopName + '正品授权申请'"
@@ -99,6 +99,7 @@ export default {
     return {
       isRequest: true,
       active: false,
+      isSubmit: false,
       registerType: [3],
       step: 1,
       stepList: [
@@ -179,6 +180,10 @@ export default {
     this.isRequest = true
     this.initPageForm()
   },
+  beforeDestroy() {
+    this.$toast.clear()
+    this.isSubmit = false
+  },
   methods: {
     onConfirm() {
       this.$router.push(this.routePrefix)
@@ -211,6 +216,12 @@ export default {
     },
 
     async onSubmit() {
+      this.$toast.loading({
+        message: '正在提交注册信息,请勿操作...',
+        duration: 0,
+      })
+      if (this.isSubmit) return
+      this.isSubmit = true
       const params = {
         registerType: this.registerType.join(','),
         authUserId: this.authUserId,
@@ -230,6 +241,9 @@ export default {
       } catch (error) {
         console.log(error)
         this.$toast(error.msg)
+      } finally {
+        this.$toast.clear()
+        this.isSubmit = false
       }
     },
 

+ 2 - 0
pages/_template/ross/form/components/form-club-info.vue

@@ -306,6 +306,8 @@ export default {
         provinceId: '',
         cityId: '',
         townId: '',
+        linkMan: '',
+        linkMobile: ''
       },
       rules: {
         name: [

+ 1 - 1
pages/_template/ross/record/club/edit.vue

@@ -50,6 +50,7 @@ export default {
         this.formData.authUserId = this.authUserId
         this.formData.source = 2
         this.formData.authId = this.clubInfo.authId
+        console.log(this.formData)
         await this.$http.api.authClubSave(this.formData)
         this.$toast('保存成功')
         this.$router.push(`${this.routePrefix}/record/club/detail`)
@@ -76,7 +77,6 @@ export default {
     },
 
     onClubInfoFormStep(data) {
-      console.log(data)
       this.formData = data
     },
   },