<template>
  <view class="noauth-cont" v-if="jurisdictionList.HasPermission === 2 || jurisdictionList.HasPermission === 3 || jurisdictionList.HasPermission === 4 || jurisdictionList.HasPermission === 5">
    <block v-if="!isShowAlert">
      <view class="noauth-activity-box">
        <image src="https://hzstatic.hzinsights.com/cygx/czbk/noauth.png" class="noauth-ico"></image>
        <block v-if="jurisdictionList.HasPermission !== 2">
          <view v-if="jurisdictionList.IsResearch" class="research-noauth">
            <text v-if="jurisdictionList.IsResearchSpecial" style="margin: 0 auto 100rpx; width: 612rpx"> 签约买方研选套餐才可参与此活动，请联系对口销售 </text>
            <block v-else>
              暂无 <text class="strong-text">买方研选</text> 权限
              <text style="margin-bottom: 30rpx"> 您可申请开通试用 </text>
            </block>
          </view>
          <view class="tip" v-else>{{ jurisdictionList.PopupMsg }}</view>
          <view class="btn-cont" v-if="jurisdictionList.Type !== '专项调研' && !jurisdictionList.IsResearchSpecial" @click="applyAuth"> 立即申请 </view>
        </block>
        <view class="tip" v-if="jurisdictionList.HasPermission === 2">
          <view v-if="jurisdictionList.IsResearch" class="research-noauth">
            <text v-if="jurisdictionList.IsResearchSpecial"> 签约买方研选套餐才可参与此活动，请联系对口销售 </text>
            <block v-else>
              暂无 <text class="strong-text">买方研选</text> 权限
              <text> 点击提交申请，提醒对口销售为你开通试用 </text>
            </block>
          </view>
          <block v-else>
            <block v-if="jurisdictionList.Type == '专项调研'"> 需要升级行业套餐权限才可参与此活动，请联系对口销售</block>
            <block v-else>
              <text style="margin-bottom: 20rpx"> 您暂无权限参加此活动 </text>
              <text>若想参加可以联系对口销售 </text>
              <text @click="callPhone(jurisdictionList.SellerMobile)" v-if="jurisdictionList.Type !== '专项调研'">
                {{ jurisdictionList.SellerName }}：
                <text style="color: #d4bf86; display: inline-block">{{ jurisdictionList.SellerMobile }}</text>
              </text>
              <text>申请开通对应的试用权限</text>
            </block>
          </block>
        </view>
        <view v-if="jurisdictionList.HasPermission === 2 && jurisdictionList.Type !== '专项调研' && !jurisdictionList.IsResearchSpecial" class="btn-cont" @click="sellerApplyAuth">
          {{ jurisdictionList.IsResearch ? "提交申请" : "立即申请" }}
        </view>
        <view class="btn-cont back-btn" @click="backIndex"> 返回</view>
      </view>
    </block>
  </view>
</template>

<script>
import { User, FreeButton } from "@/config/api.js";
import manageMixin from "../manageMixin";
export default {
  mixins: [manageMixin],
  props: {
    jurisdictionList: {
      type: Object,
      required: true,
      default: {},
    },
    idAct: {
      type: Number,
      required: true,
    },
  },
  data() {
    return {
      isShowAlert: false,
    };
  },
  methods: {
    callPhone(num) {
      uni.makePhoneCall({
        phoneNumber: num,
      });
    },
    //获取权限弹窗是否展示免费月卡接口
    async userIsShowAlert() {
      const res = await FreeButton.userIsShowAlert();
      if (res.Ret === 200) {
        this.isShowAlert = res.Data.IsShow;
      }
    },
    /* 跳转研选 */
    goRouterResearch(type) {
      if (type == "介绍") {
        uni.navigateTo({
          url: "/pages-purchaser/productIntroduction/productIntroduction",
        });
      } else {
        uni.navigateTo({
          url: "/pages-purchaser/ProductQuotation/ProductQuotation",
        });
      }
    },
  },
  mounted() {
    // 免费送月卡
    // this.userIsShowAlert();
  },
};
</script>

<style scoped lang="scss">
.noauth-cont {
  .noauth-activity-box {
    padding: 100rpx 25rpx 80rpx;
    text-align: center;
    font-size: 28rpx;
    background-color: #fff;
    border-radius: 16rpx;
  }
  .noauth-ico {
    width: 365rpx;
    height: 229rpx;
    margin-bottom: 70rpx;
  }

  .tip {
    width: 532rpx;
    margin: 0 auto 100rpx;

    .contract {
      padding: 40rpx 90rpx 0;
      line-height: 44rpx;

      text {
        display: inline-block;
      }
    }
  }

  .btn-cont {
    width: 500rpx;
    height: 52rpx;
    background: $uni-color-new;
    color: #fff;
    font-size: 24rpx;
    font-weight: 600;
    border-radius: 8rpx;
    margin: 0 auto;
    text-align: center;
    line-height: 52rpx;

    &.back-btn {
      background: #e5efff !important;
      color: $uni-color-new;
      margin-top: 30rpx;
    }

    .btn_bg {
      width: 100%;
      height: 80rpx;
      position: absolute;
      left: 0;
      top: 0;
    }

    .btn-txt {
      width: 100%;
      position: absolute;
      z-index: 1;
    }
  }
  .month_card {
    width: 100%;
    height: 565rpx;
    padding-left: -20rpx;
  }
  .btn-dl {
    background: linear-gradient(253deg, #fcf3e9 0%, #eedec8 100%) !important;
    color: #333 !important;
    margin: 30rpx auto !important;
  }
  .month-back {
    background: #f6f6f6 !important;
    color: #999 !important;
  }
  .moneh-text {
    text-align: center;
    width: 632rpx;
    margin: 0 auto 20rpx;
    color: #999999;
  }

  .research-noauth {
    color: #333;
    font-size: 36rpx;
    width: calc(100% + 80rpx);
    margin-left: -40rpx;
    .strong-text {
      display: inline-block;
      padding: 0 10rpx;
      font-weight: 500;
    }
    text:last-child {
      font-size: 32rpx;
      font-size: 34rpx;
      color: #999999;
      margin-top: 10rpx;
    }
  }
  // .research-btn {
  //   display: flex;
  //   align-items: center;
  //   font-size: 32rpx;
  //   width: 546rpx;
  //   height: 78rpx;
  //   margin: 30rpx auto;
  //   background: #f8f8fa;
  //   border-radius: 4rpx;
  //   padding-left: 40rpx;
  //   image {
  //     width: 40rpx;
  //     height: 40rpx;
  //     margin-right: 10rpx;
  //   }
  // }
}
</style>
