123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223 |
- <template>
- <view class="user-page">
- <view class="top-box">
- <view class="flex">
- <view class="avatar">
- <open-data type="userAvatarUrl"></open-data>
- </view>
- <view>
- <view class="user-name">{{userInfo.real_name||'--'}}</view>
- <view class="tel" v-if="userInfo.mobile">{{userInfo.mobile}}</view>
- <view class="tel" v-else>{{userInfo.email}}</view>
- </view>
- </view>
- <view class="flex company">
- <image src="../../static/company.png" mode="widthFix"/>
- <text>{{userInfo.company_name||'--'}}</text>
- </view>
- </view>
- <view class="content">
- <view class="flex item-card" >
- <image src="../../static/user-icon-1.png" mode="widthFix" />
- <text class="label">品种权限</text>
- <block v-if="userInfo.status=='冻结'||(userInfo.status=='试用'&&userInfo.is_suspend==1)">
- <text style="color:#666666;margin-left:10px">暂无权限</text>
- <van-button
- custom-class="apply-btn"
- plain round color="#DDAA6A"
- size="small"
- @click.stop="handleContact"
- >联系销售</van-button>
- </block>
- <block v-else-if="userInfo.permission_list.length==0">
- <text style="color:#666666;margin-left:10px">暂无权限</text>
- <van-button
- custom-class="apply-btn"
- plain round color="#DDAA6A"
- size="small"
- @click.stop="handleGoApplyPermission"
- >立即申请</van-button>
- </block>
-
- <view v-else class="right-text look" @click="handleToUserPermission">
- <text>查看</text>
- <van-icon name="arrow"></van-icon>
- </view>
- </view>
- <view class="flex item-card">
- <image src="../../static/calendar.png" mode="widthFix" />
- <text class="label">服务截止日期</text>
- <text class="right-text" v-if="!(userInfo.status=='冻结'||(userInfo.status=='试用'&&userInfo.is_suspend==1))">{{lastTime}}</text>
- </view>
- </view>
- <!-- 弹窗 -->
- <van-popup :show="pupData.show" @close="pupData.show=false" :close-on-click-overlay="false">
- <view class="global-pup">
- <view class="content">
- <rich-text :nodes="pupData.content"></rich-text>
- </view>
- <view class="flex bot">
- <view @click="pupData.show=false">知道了</view>
- </view>
- </view>
- </van-popup>
-
- </view>
- </template>
- <script>
- const moment=require('@/utils/moment-with-locales.min')
- import {apiLastApplyRecord,apiApplyPermission} from '@/api/user'
- export default {
- computed: {
- lastTime(){
- let timeArr=[]
- this.userInfo.permission_list&&this.userInfo.permission_list.forEach(item=>{
- item.permission_list.forEach(item2=>{
- timeArr.push(new Date(item2.end_date))
- })
- })
- let maxTime=Math.max(...timeArr)
-
- if(timeArr.length===0){
- return ''
- }else{
- return moment(maxTime).format('YYYY.MM.DD')
- }
-
- }
- },
- data () {
- return {
- pupData:{
- show:false,
- content:'',//弹窗html字符串
- }
- }
- },
- onShow() {
- this.$store.dispatch('getUserInfo')
- },
- methods: {
- async handleGoApplyPermission(){
- const res=await apiLastApplyRecord({source:1})
- if(res.code===200){
- if(!res.data){
- uni.navigateTo({
- url:"/pages-applyPermission/applyPermission?source=1"
- })
- }else{
- this.pupData.show=true
- this.pupData.content=`<p>您已提交过申请,请耐心等待</p>`
- // uni.navigateTo({
- // url:"/pages-applyPermission/applyResult"
- // })
- }
- }
- },
- handleToUserPermission(){
- if(this.userInfo.permission_list.length==0) return
- uni.navigateTo({ url: '/pages-user/permissionList' })
- },
- handleContact(){
- apiApplyPermission({
- company_name:this.userInfo.company_name,
- real_name:this.userInfo.real_name,
- }).then(res=>{
- if(res.code===200){
- console.log('主动申请成功');
- }
- })
- uni.makePhoneCall({
- phoneNumber: this.userInfo.seal_mobile
- });
- }
- }
- }
- </script>
- <style lang="scss">
- .user-page{
- min-height: calc(100vh - calc(50px + constant(safe-area-inset-bottom)));
- min-height: calc(100vh - calc(50px + env(safe-area-inset-bottom)));
- background-color: #EDEDED;
- }
- .top-box{
- height: 392rpx;
- background-color: #fff;
- padding: 98rpx 50rpx 0 50rpx;
- .avatar{
- width: 154rpx;
- height: 154rpx;
- border-radius: 16rpx;
- overflow: hidden;
- margin-right: 40rpx;
- }
- .user-name{
- font-size: 24px;
- font-weight: bold;
- color: #060606;
- }
- .tel{
- margin-top: 26rpx;
- color: #999;
- }
- .company{
- margin-top: 50rpx;
- image{
- width: 32rpx;
- height: 32rpx;
- margin-right: 8rpx;
- }
- color:#DBA665;
- }
- }
- .content{
- background-color: #fff;
- margin-top: 12rpx;
- padding: 0 34rpx;
- .item-card{
- position: relative;
- padding: 30rpx 0;
- border-bottom: 1px solid $global-border-color;
- image{
- width: 36rpx;
- height: 36rpx;
- }
- .label{
- font-weight: bold;
- margin-left: 20rpx;
- }
- .apply-btn{
- position: absolute;
- top: 50%;
- right: 0;
- transform: translateY(-50%);
- height: 50rpx;
- width: 156rpx;
- }
- .right-text{
- position: absolute;
- top: 50%;
- right: 0;
- transform: translateY(-50%);
- color: #666666;
- }
- .look{
- width: 100rpx;
- height: 100rpx;
- text-align: right;
- line-height: 100rpx;
- }
- }
- .item-card:last-child{
- border: none;
- }
- }
- </style>
|