Ver código fonte

完成研报图表详情权限

jwyu 3 anos atrás
pai
commit
8845b8fa6c

+ 14 - 0
src/api/hzyb/user.js

@@ -7,4 +7,18 @@ import {get,post} from './http'
  */
 export const apiUserInfo=(params)=>{
 	return get('/user/info',params)
+}
+
+/**
+ * 用户权限申请
+ * @param business_card_url 名片地址
+ * @param company_name 公司名
+ * @param permission 选择的权限
+ * @param real_name 姓名
+ * @param source 来源:我的1、活动2、图库3、研报4
+ * @param source_agent 来源平台:1:小程序、2:pc
+ * @param from_page 来源页面: '活动列表'、'活动详情'等
+ */
+ export const apiApplyPermission=params=>{
+	return post('/user/apply',{...params,source_agent:1})
 }

+ 8 - 1
src/views/hzyb/chart/Detail.vue

@@ -1,5 +1,6 @@
 <script setup>
 import chartBox from './component/chartBox.vue'
+import noAuth from './component/noAuth.vue'
 import { Popup, Toast,Picker } from 'vant';
 import {ref,onMounted, reactive, watch} from 'vue'
 import {useRoute, useRouter,onBeforeRouteUpdate} from 'vue-router'
@@ -148,6 +149,8 @@ let chartData=ref({
 })// 图表配置数据
 let resData=ref(null)//接口详情数据
 let loading=ref(false)
+let noauth=ref(false)
+let noAuthData=ref(null)
 // 如果type:init 则是初始化获取数据 
 const getChartInfo=async (type)=>{
     // resData.value=null
@@ -202,6 +205,9 @@ const getChartInfo=async (type)=>{
         wx.miniProgram.postMessage({ data: postData });
         
 
+    }else if(res.code==403){
+        noauth.value=true
+        noAuthData.value=res.data
     }
 }
 getChartInfo('init')
@@ -913,7 +919,7 @@ const pageTouchmove=(e)=>{
 </script>
 
 <template>
-    <div class="chart-detail" v-if="!loading">
+    <div class="chart-detail" v-if="!loading&&!noauth">
         <div class="chart-title">{{resData.ChartInfo.ChartName}}</div>
         <div class="top-box">
             <div class="flex calendar-box" style="float:left" @click="handleShowDate">
@@ -1026,6 +1032,7 @@ const pageTouchmove=(e)=>{
             </div>
         </Popup>
     </div>
+    <noAuth v-if="noauth" :data="noAuthData"></noAuth>
     
     
 

+ 84 - 0
src/views/hzyb/chart/component/noAuth.vue

@@ -0,0 +1,84 @@
+<script setup>
+import { computed } from "vue";
+import {apiApplyPermission} from '@/api/hzyb/user'
+
+const props = defineProps({
+  data: Object,
+});
+
+const authType = computed(() => {
+    if(!props.data) return
+    if (props.data.type === "contact") {
+        return 1;
+    }
+    if (props.data.type === "expired") {
+        return 2;
+    }
+    if (props.data.type === "apply" && !props.data.customer_info.has_apply) {
+        return 3;
+    }
+    if (props.data.type === "apply" && props.data.customer_info.has_apply) {
+        return 4;
+    }
+});
+
+// 点击申请
+const handleApply=()=>{
+    if(props.data.customer_info.status=='流失'){
+        apiApplyPermission({
+            company_name:this.info.customer_info.company_name,
+            real_name:this.info.customer_info.name,
+            source:3,
+            from_page:'图库列表'
+        }).then(res=>{
+            // uni.navigateTo({url:'/pages-applyPermission/applyResult'})
+        })
+        return
+    }
+    wx.miniProgram.navigateTo({ url: '/pages-applyPermission/applyPermission?source=3&from_page=图库详情' })
+}
+</script>
+
+<template>
+  <div class="chart-noauth-wrap">
+    <img class="img" src="https://hzstatic.hzinsights.com/static/icon/hzyb/activity_no_auth.png" alt="" v-if="authType!=4" />
+    <img class="img-wait" src="https://hzstatic.hzinsights.com/static/icon/hzyb/chart_wait.png" alt="" v-else />
+    <block v-if="authType == 1">
+      <div style="margin-bottom: 15px">您暂无权限查看图库</div>
+      <div>若想查看请联系对口销售</div>
+      <!-- <div>{{info.name}}:{{info.mobile}}</div> -->
+      <a :href="'tel:'+props.data.mobile" tag="div" class="global-btn-yellow-change btn" style="margin-top: 30px">联系销售</a>
+    </block>
+
+    <block v-if="authType == 2">
+      <div style="margin-bottom: 15px">您的权限已到期,暂时无法查看图库</div>
+      <div>若想继续查看请联系对口销售</div>
+      <!-- <div>{{info.name}}:{{info.mobile}}</div> -->
+      <a :href="'tel:'+props.data.mobile" tag="div" class="global-btn-yellow-change btn" style="margin-top: 30px">联系销售</a>
+    </block>
+
+    <block v-if="authType == 3">
+      <div style="margin-bottom: 15px">您暂无权限查看图库</div>
+      <div>若想查看可以申请开通</div>
+      <div class="global-btn-yellow-change btn" style="margin-top: 30px" @click="handleApply">立即申请</div>
+    </block>
+
+    <block v-if="authType == 4">
+      <div style="margin-bottom: 15px">您已提交申请</div>
+      <div>请等待销售人员与您联系</div>
+    </block>
+  </div>
+</template>
+
+<style lang="scss" scoped>
+.chart-noauth-wrap {
+  padding-top: 50px;
+  text-align: center;
+  .img {
+    width: 100%;
+  }
+  .img-wait {
+    width: 186px;
+  }
+}
+</style>