<template>
  <view class="noauth-cont" v-if="jurisdictionList.HasPermission === 2 || jurisdictionList.HasPermission === 3 || jurisdictionList.HasPermission === 4 || jurisdictionList.HasPermission === 5">
    <block v-if="!isShowAlert">
      <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 class="strong-text">买方研选</text> 权限
          <text style="margin-bottom: 30rpx"> 您可申请开通试用 </text>
        </view>
        <view class="tip" v-else>{{ jurisdictionList.PopupMsg }}</view>
        <view class="btn-cont" v-if="jurisdictionList.Type !== '专项调研'" @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 class="product-introduction-box" v-if="jurisdictionList.IsResearch">
<!--    <view class="research-btn" @click="goRouterResearch('介绍')">
          <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/report_Yx.png"></image>
          点击查看买方研选产品介绍
        </view>
        <view class="research-btn" @click="goRouterResearch('报价')">
          <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/quotation_icon.png"></image>
          点击查看买方研选服务报价单
        </view> -->
        <view class="product-introduction">
          <view class="introduction-header">
            <view class="introduction-header-left"></view>
            <view class="introduction-header-right">
              <view class="introduction-title-CN">
                产品介绍
              </view>
              <view class="introduction-title-US">
                Product Introduction
              </view>
            </view>
          </view>
          <view class="introduction-body">
            <view class="introduction-body-box">
              <view class="body-box-title">
                独家亮点
              </view>
              <view class="introduction-body-row"><span class="highHight-text">低至1000元</span>起访谈优质专家</view>
              <view class="introduction-body-row">重点公司小范围交流<span class="highHight-text">破圈</span>参加</view>
              <view class="introduction-body-row"><span class="highHight-text">海量</span>调研过程及纪要共享</view>
            </view>
            <view class="introduction-body-box">
              <view class="body-box-title">
                优质资源
              </view>
              <view class="introduction-body-row"><span class="highHight-text">500+</span>篇/年调研纪要更新，</view>
              <view class="introduction-body-row"><span class="highHight-text">300+</span>场/年海内外重点公司小范围交流，</view>
              <view class="introduction-body-row"><span class="highHight-text">100+</span>场/年热点线下调研，</view>
              <view class="introduction-body-row"><span class="highHight-text">30000+</span>名优质行业专家长期合作，</view>
              <view class="introduction-body-row"><span class="highHight-text">1000+</span>名优秀买方汇集，</view>
            </view>
            <view class="introduction-body-box">
              <view class="body-box-title" style="margin-bottom: 18rpx;">
                服务报价
              </view>
              <view class="body-row-content">
                <view class="body-row-title">
                  3万/年
                </view>
                <view class="introduction-body-row">含无限量调研纪要查阅</view>
                <view class="introduction-body-row"><span class="highHight-text">以及3次</span>公开专家访谈；</view>
              </view>
              <view class="body-row-content">
                <view class="body-row-title">
                  5万/年
                </view>
                <view class="introduction-body-row">含无限量调研纪要查阅</view>
                <view class="introduction-body-row">
                  <span class="highHight-text">以及15次</span>公开专家访谈<span class="highHight-text">或30次</span>重点公司、专家小范围交流；
                </view>
              </view>
              <view class="body-row-content" style="margin-bottom: 0;">
                <view class="body-row-title">
                  10万/年
                </view>
                <view class="introduction-body-row">含无限量调研纪要查阅</view>
                <view class="introduction-body-row">
                  <span class="highHight-text">以及40次</span>公开专家访谈
                  <span class="highHight-text">或80次</span>重点公司、专家小范围交流
                  <span class="highHight-text">或20次</span>私享专家一对一。
                </view>
              </view>
            </view>
          </view>
        </view>
      </view>
    </block>
    <block v-else>
      <text class="moneh-text"> 上传名片并填写简单信息，24小时内我们会为您开通一个月的免费月卡 </text>
      <img src="https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/month_card.png" class="month_card" alt="" />
      <view class="btn-cont btn-dl" @click="applyAuth"> 立即上传 </view>
      <view class="btn-cont month-back" @click="backIndex"> 返回</view>
    </block>
  </view>
</template>

<script>
import { User, FreeButton } from "@/config/api.js";
export default {
  props: {
    jurisdictionList: {
      type: Object,
      required: true,
      default: {},
    },
    idAct: {
      type: Number,
      required: true,
    },
  },
  data() {
    return {
      isShowAlert: false,
    };
  },
  methods: {
    /* 无权限申请开通权限 */
    applyAuth() {
      /* 区分是否是潜在用户 */
      this.jurisdictionList.HasPermission === 3
        ? uni.navigateTo({
            url: "/pageMy/applyTrial/applyTrial?tryType=Activity&detailId=" + this.idAct,
          })
        : this.jurisdictionList.HasPermission === 5
        ? this.sellerApplyAuth()
        : uni.showModal({
            title: "",
            content: "您已经提交过申请了，请耐心等待",
            showCancel: false,
            confirmColor: "#3385FF",
            success: function (res) {},
          });
    },
    //销售的立即申请
    sellerApplyAuth() {
      User.applyTry({
        TryType: "Activity",
        DetailId: this.idAct,
      }).then((res) => {
        if (res.Ret === 200) {
          uni.showModal({
            title: "",
            content: "提交申请成功，请耐心等待",
            showCancel: false,
            confirmColor: "#3385FF",
            success: function (res) {
              this.backIndex();
            },
          });
        }
      });
    },
    // 返回首頁
    backIndex() {
      uni.navigateBack({
        fail() {
          uni.switchTab({
            url: "/pages/index/index",
          });
        },
      });
    },
    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 {
  padding-top: 170rpx;
  text-align: center;
  font-size: 28rpx;

  .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: 368rpx;
    height: 80rpx;
    background: linear-gradient(268deg, #2ddbff 0%, #1599ff 49%, #005eff 100%);
    color: #fff;
    font-size: 34rpx;
    margin: 0 auto;
    text-align: center;
    line-height: 80rpx;

    &.back-btn {
      background: #fff !important;
      color: #2c83ff;
      border: 1px solid #2c83ff;
      margin-top: 30rpx;
    }

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

    .btn-txt {
      width: 100%;
      position: absolute;
      z-index: 1;
    }
  }
  .product-introduction-box{
    background-color: #F7F7F7;
    padding-top: 10rpx;
    margin-top: 60rpx;
    .product-introduction{
      padding: 60rpx 60rpx 0;
      background-color: white;
      .introduction-header{
        margin-bottom: 40rpx;
        display: flex;
        .introduction-header-left{
          background-color: #CAAF8B;
          height: 90rpx;
          width: 14rpx;
          margin-right: 20rpx;
        }
        .introduction-header-right{
          text-align: left;
          .introduction-title-CN{
            font-weight: 500;
            font-size: 34rpx;
            color: #333333;
            line-height: 42rpx;
            margin-bottom: 8rpx;
          }
          .introduction-title-US{
            font-weight: 400;
            font-size: 28rpx;
            color: #C0C4CC;
            line-height: 42rpx;
          }
        }
      }
      .introduction-body{
        .introduction-body-box{
          text-align: left;
          margin-bottom: 40rpx;
          .body-row-content{
            margin-bottom: 40rpx;
            font-size: 34rpx;
            line-height: 48rpx;
            font-weight: 600;
            color: #CAAF8B;
            .body-row-title{
              margin-left: 40rpx;
            }
          }
          .body-box-title{
            font-weight: 600;
            font-size: 34rpx;
            line-height: 48rpx;
            padding-left: 40rpx;
            position: relative;
            margin-bottom: 22rpx;
            &::before{
              content: "";
              height: 20rpx;
              width: 20rpx;
              background-color: #CAAF8B;
              border-radius: 20rpx;
              position: absolute;
              left: 0;
              top: 16rpx;
            }
          }
          .introduction-body-row{
            margin-left: 40rpx;
            font-weight: 400;
            font-size: 26rpx;
            color: #333333;
            line-height: 36rpx;
          }
          .highHight-text{
            color: #CAAF8B;
          }
        }

      }
    }
  }
  .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>
