<template>
  <v-container class="invite-user" fluid :class="`bg-${type}`">
    <div class="rule" @click="show = true">规则</div>
    <div class="box1">
      <div class="fcnc">
        <div v-for="(item, index) in level.levelAwardDetails" :key="item.goodsId">
          <div v-if="index < 4" class="cybz-content-container">
            <v-img class="cybz-content" :src="returnContent[index].img" />
            <div class="cybz-content-text">{{returnContent[index].content}}</div>
            <img v-if="item.status === 0" class="w76h24" src="~/assets/image/activity/invite-user/btn-3.png" alt="">
            <img v-else-if="item.status === 1" class="w76h24" src="~/assets/image/activity/invite-user/btn-1.png" alt="" @click="receiveLevelAward(item.goodsId)">
            <img v-else-if="item.status === 2" class="w76h24" src="~/assets/image/activity/invite-user/btn-2.png" alt="">
          </div>
        </div>
      </div>
      <v-btn v-if="received" class="share-button" rounded @click="share()">
        云机免费领取
      </v-btn>
      <v-btn v-else class="share-button" rounded @click="share()">
        赶紧分享你的好友，送云机时长
      </v-btn>
      <div class="dqdj-content">
        <div class="dqdj-item">
          <div class="dqdj-title">{{ level.currentLevelName }}</div>
          <div class="dqdj-text">当前等级</div>
        </div>
        <div class="dqdj-content-line"></div>
        <div class="dqdj-item">
          <div class="dqdj-title">{{ level.shareFriendCount }}</div>
          <div class="dqdj-text">分享好友数</div>
        </div>
        <div class="dqdj-content-line"></div>
        <div class="dqdj-item">
          <div class="dqdj-title">{{ level.boostValue }}</div>
          <div class="dqdj-text">累计助力值</div>
        </div>
      </div>
      <div class="progress">
        <div class="progress-box" :style="`width: ${width}px`"></div>
        <div class="progress-list">
          <div v-for="item in level.levelAwardDetails" :key="item.goodsId" class="fnc">
            <img v-if="item.status === 0" class="wh38" src="~/assets/image/activity/invite-user/box-gray.png" alt="">
            <img v-else-if="item.status === 1" class="wh38" src="~/assets/image/activity/invite-user/box-close.png" alt="" @click="receiveLevelAward(item.goodsId)">
            <img v-else-if="item.status === 2" class="wh38" src="~/assets/image/activity/invite-user/box-open.png" alt="">
            <span class="progress-text">{{ item.levelName }}</span>
          </div>
        </div>
      </div>
    </div>
    <div v-if="type === 2" :class="current ? 'box3 tab2' : 'box3'">
      <div class="tab">
        <div class="tab-item" @click="current = 0">{{ current === 1 ? '我的奖励' : '' }}</div>
        <div class="tab-item" @click="current = 1">{{ current === 1 ? '排行榜' : '' }}</div>
      </div>
      <div v-show="current === 0">
        <div v-if="myActivationCode.length" class="code-table">
          <div class="table-header">
            <table class="w-full">
              <colgroup>
                <col class="time-col" />
                <col class="code-col" />
                <col class="award-col" />
                <col class="status-col" />
              </colgroup>
              <thead class="text-left text-sm whitespace-nowrap break-normal">
                <tr>
                  <th class="text-center">获取的时间</th>
                  <th class="text-center">激活码编号</th>
                  <th class="text-center">奖励内容</th>
                  <th class="text-center">使用状态</th>
                </tr>
              </thead>
            </table>
          </div>
          <div class="table-body">
            <table class="w-full">
              <colgroup>
                <col class="time-col" />
                <col class="code-col" />
                <col class="award-col" />
                <col class="status-col" />
              </colgroup>
              <tbody class="text-xs">
                <tr v-for="(item, index) in myActivationCode" :key="index">
                  <td class="whitespace-nowrap break-normal text-center">
                    {{ item.createTime | formatDate('MM月DD日 HH:mm') }}
                  </td>
                  <td class="whitespace-nowrap break-normal text-center">
                    <div class="flex">
                      <span class="font-mono">{{ item.activationCode | activationCodeMask }} </span><span class="mx-1">|</span>
                      <v-btn text small color="#FF9616" class="copy-btn" @click="copyCode(item)">复制</v-btn>
                    </div>
                  </td>
                  <td class="whitespace-nowrap break-normal text-center">
                    {{ item.awardStr }}
                  </td>
                  <td class="whitespace-nowrap break-normal text-center">
                    <span :style="item.activationUse ? 'color: #FF1D02' : '#333333'">{{ ['未使用', '已使用', '已过期'][item.activationUse] }}</span>
                  </td>
                </tr>
              </tbody>
            </table>
            <div v-if="myActivationCode.length" v-intersect.quiet="codeLoadMoreIntersect" class="flex item-center justify-center">
              <v-btn :loading="codeIsLoading" text small>
                <template v-if="codeIsLoading">加载中</template>
                <template v-else-if="codeHasMore">加载更多</template>
                <template v-else>没有更多</template>
              </v-btn>
            </div>
          </div>
        </div>
        <div v-else class="fwc">
          <img src="~/assets/image/activity/invite-user/noReward@2x.png" alt="">
        </div>
      </div>
      <div v-show="current === 1">
        <div v-if="levelAwardRankings.length" class="code-table">
          <div class="mylevel">
            <div class="fcw">
              <span class="c8F8F8F">当前排名</span>
              <span>{{ currentRanking > 0 ? currentRanking : '暂未上榜' }}</span>
            </div>
            <div class="fcw">
              <span class="c8F8F8F">本轮助力值</span>
              <span>{{ boostValue }}</span>
            </div>
            <div class="fcw">
              <span class="c8F8F8F">距上一名</span>
              <span>{{ preRanking > 0 ? preRanking : '/' }}</span>
            </div>
            <div class="fcw">
              <span class="c8F8F8F">距本轮排行结束时间</span>
              <span>
                <van-count-down :time="currentEndTime * 1000" format="DD 天 HH 时 mm 分 ss 秒" />
              </span>
            </div>
          </div>
          <div class="table-header">
            <table class="w-full">
              <colgroup>
                <col class="num-col" />
                <col class="user-col" />
                <col class="friend-col" />
                <col class="award-col" />
              </colgroup>
              <thead class="text-sm whitespace-nowrap break-normal">
                <tr>
                  <th class="text-center">排名</th>
                  <th class="text-center">用户</th>
                  <th class="text-center">好友助力值</th>
                  <th class="text-center">排名奖励</th>
                </tr>
              </thead>
            </table>
          </div>
          <div class="table-body">
            <table class="w-full">
              <colgroup>
                <col class="num-col" />
                <col class="user-col" />
                <col class="friend-col" />
                <col class="award-col" />
              </colgroup>
              <tbody class="text-xs">
                <tr v-for="(item, index) in levelAwardRankings" :key="index">
                  <td class="whitespace-nowrap break-normal text-center">
                    <img v-if="item.ranking === 1" class="w24h28" src="~/assets/image/activity/invite-user/no1.png" alt="">
                    <img v-else-if="item.ranking === 2" class="w24h28" src="~/assets/image/activity/invite-user/no2.png" alt="">
                    <img v-else-if="item.ranking === 3" class="w24h28" src="~/assets/image/activity/invite-user/no3.png" alt="">
                    <span v-else>{{ item.ranking }}</span>
                  </td>
                  <td class="whitespace-nowrap break-normal text-center">
                    {{ item.userName }}
                  </td>
                  <td class="whitespace-nowrap break-normal text-center">
                    {{ item.boostValue }}
                  </td>
                  <td class="whitespace-nowrap break-normal text-center">
                    {{ item.awardStr }}
                  </td>
                </tr>
              </tbody>
            </table>
          </div>
        </div>
        <div v-else class="fwc">
          <img src="~/assets/image/activity/invite-user/nodata.png" alt="">
        </div>
      </div>
    </div>
    <img class="w373h192" src="~/assets/image/activity/invite-user/rule2.png" alt="">
    <van-popup v-model="show" style="background: transparent;padding-bottom: 60px;width: 100%;">
      <activity-invite-user-box class="box4">
        <template #title>活动规则</template>
        <div class="text-sm" v-html="activityRules"></div>
      </activity-invite-user-box>
      <van-icon name="close" class="close1" color="#939393" @click="show = false;" />
    </van-popup>
  </v-container>
</template>

<script>
import { Toast } from 'vant';
// import NativeShare from 'nativeshare';
// import { fileKeyToUrl } from '@/plugins/file-center.js';

export default {
  auth: false,
  name: 'Fission',
  filters: {
    activationCodeMask(value) {
      return value.replace(/(.{2})(.*)(.{2}$)/, '$1**$3');
    },
    timeStamp(StatusMinute) {
      const day = parseInt(StatusMinute / 60 / 60 / 24);
      const hour = parseInt((StatusMinute / 60 / 60) % 24);
      const min = parseInt(StatusMinute / 60 % 60);
      StatusMinute = '';
      if (day > 0) {
        StatusMinute = day + '天';
      }
      if (hour > 0) {
        StatusMinute += hour + '小时';
      }
      if (min > 0) {
        StatusMinute += parseFloat(min) + '分钟';
      }
      return StatusMinute;
    }
  },
  data() {
    return {
      show: false,
      current: 0,
      data: {
        todayIncomeStarCoin: 0,
        totalIncomeStarCoin: 0,
        todayBuyOrderCount: 0,
        totalBuyOrderCount: 0,
        todayBuyOrderSuccessCount: 0,
        totalBuyOrderSuccessCount: 0,
        withdrawStarCoinNum: 0,
        inviteUserName: null,
        activityId: null,
        status: 0,
        type: 2
      },
      level: {
        currentLevelName: '',
        activityId: '',
        levelAwardDetails: [],
        shareFriendCount: 0,
        boostValue: 0
      },
      activityRules: '',
      myActivationCode: [],
      levelAwardRankings: [],
      myCodeFrom: {
        activityId: null,
        pageNum: 1,
        pageSize: 8,
      },
      codeTotal: -1,
      codeIsLoading: false,
      client: 1,
      token: '',
      width: 0,
      boostValue: 0,
      currentEndTime: 0,
      currentRanking: 0,
      preRanking: 0,
      userType: 1,
      received: 0,
      // shareInfo: {
      //   title: '双子星云手机',
      //   content: `免费领取一台全能云手机！`,
      //   shareUrl: '',
      //   shareImage: ''
      // },
      showShare: false,
      returnContent: [{
        img: require('@/assets/image/activity/invite-user/card-1.png'),
        content: '奖励一&邀请1人注册',
      },
      {
        img: require('@/assets/image/activity/invite-user/card-2.png'),
        content: '奖励二&邀请2人注册',
      },
      {
        img: require('@/assets/image/activity/invite-user/card-3.png'),
        content: '奖励三&邀请3人注册',
      },
      {
        img: require('@/assets/image/activity/invite-user/card-4.png'),
        content: '奖励四&邀请5人注册',
      }]
    };
  },
  async fetch() {
    // 页面初始化后触发
    try {
      this.token = this.$route.query.token;
      await this.getActiveInfo();
      this.$native.setShareInfo(this.shareInfo);
      // await this.shareCanReceiveCloudPhone();
      await Promise.all([
        this.getActivityRules(),
        this.type === 2 && this.getMyActivationCode(this.myCodeFrom),
        this.myCodeFrom.activityId && this.getRanking({ activityId: this.myCodeFrom.activityId })
      ]);
    } catch (error) {
      Toast({
        message: error.message,
        duration: 4000
      });
    }
    if (this.$userAgent.isSzx && this.$userAgent.isAndroid) {
      this.client = 1;
    } else if (this.$userAgent.isSzx && this.$userAgent.isIos) {
      this.client = 2;
    } else if (this.$userAgent.isMiniProgram) {
      this.client = 5;
    } else {
      this.client = 7;
    }
  },
  head: {
    title: '邀请好友'
  },
  computed: {
    codeHasMore() {
      return (
        this.codeTotal < 0 ||
        this.myCodeFrom.pageNum * this.myCodeFrom.pageSize < this.codeTotal
      );
    },
    dataList() {
      switch (this.type) {
        case 1: {
          return [
            { label: '邀请用户总数', value: this.data.totalPromoter },
            { label: '购买总订单数', value: this.data.totalBuyOrderCount }
          ];
        }
        case 2: {
          return [
            { label: '邀请用户总数', value: this.data.totalPromoter },
            { label: '购买总订单数', value: this.data.totalBuyOrderCount }
          ];
        }
        case 3: {
          return [
            { label: '邀请用户总数', value: this.data.totalPromoter },
            { label: '购买总订单数', value: this.data.totalBuyOrderCount }
          ];
        }
        default: {
          return [];
        }
      }
    },
    type() {
      return 2;
    },
    shareUrl() {
      return (
        location.origin +
        this.$router.resolve({
          path: '/activity/invite-user/register-fission/',
          query: {
            invitationUserName: this.data.inviteUserName,
            activityId: this.data.activityId,
            type: this.type,
          },
        }).href
      );
    },
    shareInfo() {
      if (this.$userAgent.isMiniProgram) {
        return {
          title: '双子星APP',
          path: '/pages/home/home',
          imgUrl: location.origin + require('~/assets/image/logo.png'),
        };
      }
      return {
        title: '双子星云手机',
        desc: `畅玩“原神”“幻塔”，24小时在线，不限下载流量的手机`,
        link: this.shareUrl,
        imgUrl: location.origin + require('~/assets/image/logo.png'),
      };
    }
  },
  mounted() {
    this.makePoint('activity_Share_PV')
    this.makePoint('activity_Share_UV')
    this.addUserVisit(12);
  },
  methods: {
    // async shareCanReceiveCloudPhone() {
    //   try {
    //     const res = await this.$axios.$get('/resources/register/send/cloud/phone/shareCanReceiveCloudPhone', {}, { headers: { Authorization: this.token } });
    //     this.received = res.data.received
    //     this.shareInfo.title = res.data.title
    //     this.shareInfo.content = res.data.content
    //     this.shareInfo.shareUrl = res.data.url
    //     this.shareInfo.shareImage = fileKeyToUrl(res.data.imgUrl)
    //     this.$native.setShareInfo(this.shareInfo);
    //   } catch (err) {
    //     Toast({
    //       message: err.message,
    //       position: 'top'
    //     });
    //   }
    // },
    // async shareReceiveCloudPhone() {
    //   try {
    //     const res = await this.$axios.$post('/resources/register/send/cloud/phone/shareReceiveCloudPhone', {}, { headers: { Authorization: this.token } });
    //     Dialog.alert({
    //       message: res.msg,
    //     }).then(() => {
    //       this.showShare = false
    //     });
    //     this.addUserVisit(7);
    //   } catch (err) {
    //     Toast({
    //       message: err.message,
    //       position: 'top'
    //     });
    //   }
    // },
    async receiveLevelAward(goodsId) {
      try {
        const res = await this.$axios.$post('/activity/v1/level/award/receiveLevelAward', { activityId: this.myCodeFrom.activityId, goodsId }, { headers: { Authorization: this.token } });
        Toast({
          message: res.msg,
          position: 'top'
        });
        if (this.myCodeFrom.activityId) {
          await this.myLevelAward();
        }
        this.myCodeFrom.pageNum = 1;
        this.myActivationCode = [];
        this.getMyActivationCode(this.myCodeFrom);
        if (this.myCodeFrom.activityId) {
          this.getRanking({ activityId: this.myCodeFrom.activityId });
        }
      } catch (err) {
        Toast({
          message: err.message,
          position: 'top'
        });
      }
    },
    async myLevelAward() {
      const res = await this.$axios.$get(`/activity/v1/level/award/myLevelAward?activityId=${this.myCodeFrom.activityId}`, { headers: { Authorization: this.token } });
      this.level = res.data;
      if (this.level.levelAwardDetails) {
        this.width = 0;
        const levelLength = 280 / (this.level.levelAwardDetails.length - 1)
        this.level.levelAwardDetails.forEach((item, index) => {
          if (item.status > 0) {
            if (index > 0) {
              this.width += levelLength
            }
            if (index === 0 || index === this.level.levelAwardDetails.length - 1) {
              this.width += 14
            }
          }
        })
      }
    },
    async getActiveInfo() {
      const res = await this.$axios.$get('/activity/v1/inviteUser/orderRelation/starCoinOverview', { headers: { Authorization: this.token } });
      this.data = res.data;
      this.myCodeFrom.activityId = res.data.activityId;
      if (this.myCodeFrom.activityId) {
        await this.myLevelAward();
      }
    },
    async getMyActivationCode(params) {
      try {
        this.codeIsLoading = true;
        const res = await this.$axios.$get('/activity/v1/inviteUser/orderRelation/myActivationCode', { params, headers: { Authorization: this.token } });
        this.codeTotal = res.data.total;

        this.myActivationCode.push(
          ...(res.data.list ?? [])
        );
        this.myCodeFrom = params;
      } finally {
        this.codeIsLoading = false;
      }
    },
    async getRanking(params) {
      try {
        this.codeIsLoading = true;
        const res = await this.$axios.$get('/activity/v1/level/award/ranking', { params, headers: { Authorization: this.token } });
        this.boostValue = res.data.boostValue
        this.currentEndTime = res.data.currentEndTime
        this.currentRanking = res.data.currentRanking
        this.preRanking = res.data.preRanking
        this.levelAwardRankings = res.data.levelAwardRankings;
        this.userType = res.data.userType;
      } finally {
        this.codeIsLoading = false;
      }
    },
    async share() {
      if (this.data.status !== 1) {
        if (this.data.status === 0) {
          Toast({
            message: '当前活动已过期',
            position: 'top'
          });
          return
        }
        if (this.data.status === 2) {
          Toast({
            message: '当前活动未开启',
            position: 'top'
          });
          return
        }
        if (this.data.status === 3) {
          Toast({
            message: '当前活动已结束',
            position: 'top'
          });
          return
        }
        Toast({
          message: '未知活动状态',
          position: 'top'
        });
        return
      }

      this.$tongji.trackEvent('活动', '分享', '', 0);
      if (this.received) {
        this.addUserVisit(13);
      }
      if (this.$userAgent.isSzx || this.$userAgent.isSzxBrowser) {
        // app环境
        this.$native.share(this.shareInfo);
        this.makePoint('activity_Share_分享好友按钮');
      } else {
        // 浏览器环境
        await this.$native.clipboard.writeText(`${this.shareUrl} 双子星云手机`);
        // throw new Error('1231');
        this.$toast.success('链接复制成功');
        this.makePoint('activity_Share_复制链接');
      }
    },
    makePoint(positionButton) {
      this.$axios.$post('/public/v5/buriedPointRecord/reportRecords', [
        {
          client: this.client,
          eventCode: '28_分享活动',
          userName: 'this.$auth.user.username',
          positionButton,
          operationTime: this.getCurrentTime(),
          phoneNumber: 'this.$auth.user.phone',
          deviceId: ''
        },
      ]);
    },
    getCurrentTime() {
      const date = new Date(); // 当前时间
      const year = date.getFullYear() // 年
      const month = this.repair(date.getMonth() + 1); // 月
      const day = this.repair(date.getDate()); // 日
      const hour = this.repair(date.getHours()); // 时
      const minute = this.repair(date.getMinutes()); // 分
      const second = this.repair(date.getSeconds()); // 秒
      // 当前时间 
      const curTime = year + "-" + month + "-" + day +
        " " + hour + ":" + minute + ":" + second;
      return curTime;
    },
    repair(i) {
      if (i >= 0 && i <= 9) {
        return "0" + i;
      } else {
        return i;
      }
    },
    async getActivityRules() {
      const agreementCoding = {
        1: 'iuserrules01',
        2: 'iuserrules02',
        3: 'iuserrules03',
      }[this.type];
      if (agreementCoding) {
        const res = await this.$axios.$get(
          '/public/v4/agreement/content/getContentByType',
          {
            params: {
              agreementCoding,
              type: 1,
            },
          },
        );

        this.activityRules = res.data.content
          .replace(/[\d\D]*<body>([\d\D]+)<\/body>[\d\D]*/i, '$1')
          .replace(/<div class="phone-container">([\d\D]+)<\/div>/g, '$1');
      }
    },
    async copyCode(item) {
      await this.$native.clipboard.writeText(item.activationCode);
      Toast({
        message: '复制激活码，请在【我的-兑换中心】兑换'
      });
      this.makePoint('activity_Share_激活码复制')
    },
    codeLoadMoreIntersect(event) {
      if (event[0].isIntersecting && this.codeHasMore && !this.codeIsLoading) {
        this.getMyActivationCode({
          ...this.myCodeFrom,
          pageNum: this.myCodeFrom.pageNum + 1,
        });
      }
    },
    addUserVisit(accessType) {
      this.$axios.$post('/user/v5/operateApi/addUserVisit', {
        accessType,
        loginType: 1
      });
    }
  }
};
</script>

<style lang="scss" scoped>
.w76h24 {
  width: 76px;
  height: 24px;
  margin: 5px 0;
}
.w373h237 {
  width: 373px;
  height: 237px;
  display: block;
}
.fcnc {
  display: flex;
  flex-wrap: wrap;
  margin-top: 51px;
  justify-content: center;
}
.w373h192 {
  width: 373px;
  height: 192px;
  display: block;
  margin: 17px auto 0;
}

.fcw {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 12px;
  color: #333333;
}

.c8F8F8F {
  color: #8F8F8F;
  margin-bottom: 8px;
}

.mylevel {
  width: 358px;
  height: 68px;
  background: #FFFFFF;
  box-shadow: 0px 2px 16px 0px rgba(243, 93, 67, 0.22);
  border-radius: 6px;
  margin-left: -12px;
  margin-top: 20px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.rule {
  width: 24px;
  height: 56px;
  line-height: 28px;
  background: rgba(0, 0, 0, 0.19);
  border-radius: 6px 0px 0px 6px;
  font-size: 15px;
  font-weight: 400;
  color: #FFFFFF;
  position: absolute;
  right: 0;
  top: 28px;
  text-align: center;
}

.close1 {
  font-size: 30px;
  text-align: center;
  display: block;
}

.fwc {
  text-align: center;

  img {
    width: 75px;
    height: 83px;
    margin-top: 120px;
  }
}

.invite-user {
  color: #333;
  background-size: 100% auto;
  overflow: hidden;
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom, 30px);
  background-color: #F67350;

  &.bg-1 {
    background-image: url('~/assets/image/activity/invite-user/bg@2x.png');
  }

  &.bg-2 {
    background-image: url('~/assets/image/activity/invite-user/bg-6@2x.png');
  }

  &.bg-3 {
    background-image: url('~/assets/image/activity/invite-user/bg-3@2x.png');
  }
}

.box1 {
  margin: 240px auto 0;
  width: 373px;
  height: 648px;
  background: url('~/assets/image/activity/invite-user/box.png');
  background-size: 100% 100%;
  overflow: hidden;
  .cybz-content-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 140px;
  }
  .cybz-content {
    width: 119px;
    height: 108px;
    margin: auto;
    display: block;
  }

  .cybz-content-text {
    font-size: 12px;
    color: #FF6F3C;
  }
  .share-button {
    display: block;
    margin: auto;
    width: 302px !important;
    height: 62px !important;
    background-image: url('~/assets/image/activity/invite-user/share-button@2x.png');
    background-size: 100% 100%;
    margin-top: 24px;
    color: #dd1b0d;
    font-size: 18px;
    font-weight: bold;
  }

  .dqdj-content {
    width: 308px;
    height: 71px;
    background: #f9f1f5;
    border-radius: 6px;
    margin: 15px auto 0;
    display: flex;
    align-items: center;
    justify-content: center;

    .dqdj-content-line {
      width: 1px;
      height: 32px;
      background: #ff1d02;
      opacity: 0.1;
    }

    .dqdj-item {
      width: 96px;
      text-align: center;
    }

    .dqdj-title {
      font-size: 14px;
      font-weight: 600;
      color: #ff1d02;
      line-height: 20px;
      margin-bottom: 3px;
    }

    .dqdj-text {
      font-size: 12px;
      font-weight: 400;
      color: #333333;
      line-height: 17px;
    }
  }

  .progress {
    width: 308px;
    height: 8px;
    background: #e8e8e8;
    border-radius: 4px;
    margin: 34px auto 33px;
    position: relative;

    .progress-box {
      height: 8px;
      background: linear-gradient(270deg, #ff8a00 0%, #ff4200 100%);
      border-radius: 4px;
      position: absolute;
      top: 0;
      left: 0;
    }

    .wh38 {
      width: 38px;
      height: 38px;
    }

    .fnc {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
    }
    
    .progress-text {
      font-size: 12px;
      color: #8f8f8f;
      line-height: 17px;
      margin-top: 5px;
    }

    .progress-list {
      width: 298px;
      position: absolute;
      left: 5px;
      top: -19px;
      display: flex;
      justify-content: space-between;
    }
  }
}

.box2 {
  .value {
    color: #ff6600;
  }

  ::v-deep .box-main {
    padding-left: 20px;
    padding-right: 20px;
  }
}

.box3 {
  width: 345px;
  height: 523px;
  margin: 25px auto 0;
  background: url('~/assets/image/activity/invite-user/box2@2x.png');
  background-size: 100% 100%;
  padding: 0 4px;
  box-sizing: border-box;

  &.tab2 {
    background: url('~/assets/image/activity/invite-user/box@2x.png') !important;
    background-size: 100% 100% !important;
    height: 627px !important;
  }

  .tab {
    display: flex;
    width: 307px;
    justify-content: space-between;
    margin: 0 auto;

    .tab-item {
      width: 146px;
      height: 44px;
      text-align: center;
      line-height: 44px;
      font-size: 16px;
      font-weight: 500;
      color: #ffffff;
    }
  }

  ::v-deep .box-main {
    padding-left: 10px;
    padding-right: 10px;
  }
}

.code-table {
  .table-body {
    max-height: 430px;
    overflow-y: auto;
  }

  .time-col {
    width: 105px;
  }

  .code-col {
    width: 94px;
  }

  .award-col {
    width: 85px;
  }

  .status-col {
    width: 60px;
  }

  .num-col {
    width: 53px;
    text-align: center;
  }

  .user-col {
    width: 92px;
    text-align: center;
  }

  .friend-col {
    width: 85px;
    text-align: center;
  }

  .award-col {
    width: 96px;
    text-align: center;
  }

  tr {
    height: 40px;
    color: #8F8F8F;
  }

  td {
    height: 40px;
    color: #333;
  }

  .copy-btn {
    min-width: 0 !important;
    height: auto !important;
    padding: 0 !important;
  }
}

.box4::v-deep .box-main {
  padding-left: 10px;
  padding-right: 10px;
}

.table-header {
  margin: 0 2px;
  background: #F9F1F5;
}

.w24h28 {
  width: 24px;
  height: 28px;
}
</style>
