<template>
  <view class="chart-no-auth">
        <image class="img" :src="globalImgUrls.activityNoAuth" mode="widthFix"></image>
        
        <block v-if="authType==1">
            <view style="margin-bottom:15px">您暂无权限查看图库</view>
            <view>若想查看请联系对口销售</view>
            <!-- <view>{{info.name}}:{{info.mobile}}</view> -->
            <view class="global-btn-yellow-change btn" style="margin-top:30px" @click="handleCall">联系销售</view>
        </block>

        <block v-if="authType==2">
            <view style="margin-bottom:15px">您的权限已到期，暂时无法查看图库</view>
            <view>若想继续查看请联系对口销售</view>
            <!-- <view>{{info.name}}:{{info.mobile}}</view> -->
            <view class="global-btn-yellow-change btn" style="margin-top:30px" @click="handleCall">联系销售</view>
        </block>

        <block v-if="authType==3">
            <view style="margin-bottom:15px">您暂无权限查看图库</view>
            <view>若想查看可以申请开通</view>
            <view class="global-btn-yellow-change btn" style="margin-top:30px" @click="handleApply">立即申请</view>
        </block>
        
  </view>
</template>

<script>
export default {    
    props: {
        info:null
    },
    computed: {
        authType(){
            if(!this.info) return
            let type
            let status=this.info.customer_info.status //客户状态
            // 该客户为冻结、试用暂停状态;该客户为正式、试用、永续状态，但联系人图表权限未开启或禁用
            if(
                status=='冻结'||
                (status=='试用'&&this.info.customer_info.is_suspend)||
                (['正式','试用','永续'].includes(status))
            ){
                type=1
            }

            // 该客户为正式、试用、永续状态，联系人图表权限已到期
            // if()

            return type
        }
    },
    methods: {
        handleCall(){
            uni.makePhoneCall({
                phoneNumber: this.info.mobile,
                success: (result) => {},
                fail: (error) => {}
            })
        },

        handleApply(){
            uni.navigateTo({ url: '/pages-applyPermission/applyPermission' })
        }
    }
}
</script>

<style lang="scss" scoped>
.chart-no-auth{
    padding: 34rpx;
    text-align: center;
    font-size: $global-font-size-lg;
    .img{
        width: 100%;
        margin-bottom: 50rpx;
    }
    .btn{
        width: 380rpx;
        line-height: 70rpx;
        margin-left: auto;
        margin-right: auto;
        margin-top: 40rpx;
    }
}
</style>