<template>
  <div
    :style="styleData.infoContainer3"
    ref="fansTask"
    @click="styleClick('click', 'fansTask')"
    @mousemove="styleClick('mousemove', 'fansTask')"
    @mouseout="styleClick('mouseout')"
  >
    <div>
      <img :src="styleData.containerTask.imageUrl" alt="" :style="styleData.containerTask"/>
    </div>
    <div :style="styleData.questionO" @click="openStrategyDialog">
      <div :style="styleData.questionoo">能量分领取攻略</div>
    </div>
    <div :style="styleData.taskDiv">
      <div :style="styleData.dayTaskContainer" v-if="activity1 == true ||activity2 == true ||activity3 == true ||activity4 == true">
        <div v-if="activity1 == true ||activity2 == true ||activity3 == true ||activity4 == true" :style="styleData.dayTasks">
          <img :style="styleData.imgDayImg"
               src="//img10.360buyimg.com/imgzone/jfs/t1/86352/31/709/1850/5db16efdE6292ad56/ea2810bee7b2c0e2.png">
          <div :style="styleData.dayTaskText">
            任务<span :style="styleData.dayTaskSpan">每日更新</span>哦，明天也来看看吧～
          </div>
        </div>
        <div v-for="(item, index) in fansPlayList.taskList" :key="index">
          <!--浏览店铺-->
          <div :style="styleData.dayTask" v-if="item.taskType == 2">
            <img
              src="https://img10.360buyimg.com/imgzone/jfs/t1/92381/40/626/7290/5db174afE545730d9/9e6bcf473ba09345.png"
              alt=""
              :style="styleData.taskIcon"
            />
            <div :style="styleData.borderDay">
              <div :style="styleData.taskText">店铺打卡1次</div>
              <div :style="styleData.scoreEng">
                能量分+{{ item.sendNum }}，每日上限{{ item.maxNum }}次
              </div>
            </div>
            <div :style="styleData.progressDiv">
              <div :style="styleData.progressVan">
                <van-progress
                  pivot-text=""
                  color="#ee0a24"
                  :percentage="(item.completeCount/item.maxNum)*100"
                />
              </div>
            </div>

            <div
              :style="styleData.goTaskBtn"
              :class="{
              'hasComplete-task-btn': item.completeCount >= item.maxNum,
            }"
              @click="doDayTask1"
            >
              {{ item.completeCount >= item.maxNum ? "已完成" : "去完成" }}({{
                item.completeCount
              }}/{{ item.maxNum }})
            </div>
          </div>

          <!--浏览商品-->
          <div :style="styleData.dayTask" v-else-if="item.taskType == 3">
            <img
              src="https://img10.360buyimg.com/imgzone/jfs/t1/58005/3/14090/8177/5db17629Ebd8e5557/493c5e57845e2fe5.png"
              alt=""
              :style="styleData.taskIcon"
            />
            <div :style="styleData.borderDay">
              <div :style="styleData.taskText">浏览商品详情</div>
              <div :style="styleData.scoreEng">
                能量分+{{ item.sendNum }}，每日上限{{ item.maxNum }}次
              </div>
            </div>
            <div :style="styleData.progressDiv">
              <div :style="styleData.progressVan">
                <van-progress
                  pivot-text=""
                  color="#ee0a24"
                  :percentage="(item.completeCount/item.maxNum)*100"
                />
              </div>
            </div>
            <div
              :style="styleData.goTaskBtn"
              :class="{
              'hasComplete-task-btn': item.completeCount >= item.maxNum,
            }"
              @click="doDayTask2()"
            >
              {{ item.completeCount >= item.maxNum ? "已完成" : "去完成" }}({{
                item.completeCount
              }}/{{ item.maxNum }})
            </div>
          </div>

          <!--加购商品-->
          <div :style="styleData.dayTask" v-else-if="item.taskType == 7">
            <img
              src="https://img10.360buyimg.com/imgzone/jfs/t1/105326/18/674/7478/5db176b6E81f35354/5ed3596ee291e2e8.png"
              alt=""
              :style="styleData.taskIcon"
            />
            <div :style="styleData.borderDay">
              <div :style="styleData.taskText">加购商品</div>
              <div :style="styleData.scoreEng">
                能量分+{{ item.sendNum }}，每日上限{{ item.maxNum }}次
              </div>
            </div>
            <div :style="styleData.progressDiv">
              <div :style="styleData.progressVan">
                <van-progress
                  pivot-text=""
                  color="#ee0a24"
                  :percentage="(item.completeCount/item.maxNum)*100"
                />
              </div>
            </div>
            <div
              :style="styleData.goTaskBtn"
              :class="{
              'hasComplete-task-btn': item.completeCount >= item.maxNum,
            }"
              @click="doDayTask3()"
            >
              {{ item.completeCount >= item.maxNum ? "已完成" : "去完成" }}({{
                item.completeCount
              }}/{{ item.maxNum }})
            </div>
          </div>

          <!--分享活动-->
          <div :style="styleData.dayTask" v-if="item.taskType == 12">
            <img
              src="https://img10.360buyimg.com/imgzone/jfs/t1/82313/33/13620/8143/5db174afE335545ef/7e830e66e70ecb4b.png"
              alt=""
              :style="styleData.taskIcon"
            />
            <div :style="styleData.borderDay">
              <div :style="styleData.taskText">分享活动</div>
              <div :style="styleData.scoreEng">
                能量分+{{ item.sendNum }}，每日上限{{ item.maxNum }}次
              </div>
            </div>
            <div :style="styleData.progressDiv">
              <div :style="styleData.progressVan">
                <van-progress
                  pivot-text=""
                  color="#ee0a24"
                  :percentage="(item.completeCount/item.maxNum)*100"
                />
              </div>
            </div>
            <div
              :style="styleData.goTaskBtn"
              :class="{
              'hasComplete-task-btn': item.completeCount >= item.maxNum,
            }"
              @click="doDayTask4"
            >
              {{ item.completeCount >= item.maxNum ? "已完成" : "去完成" }}({{
                item.completeCount
              }}/{{ item.maxNum }})
            </div>
          </div>
        </div>
      </div>

      <div
        v-if="activity5 == true || activity6 == true || activity7 == true"
        :style="styleData.activityTaskContainer">
        <div v-if="activity5 == true || activity6 == true || activity7 == true" :style="styleData.activityTaskContainerDiv">
          <img :style="styleData.activityTaskImg"
               src="https://img10.360buyimg.com/imgzone/jfs/t1/85413/18/657/2551/5db174bfEaec4d799/c1e8c78d734771d4.png">
          <div :style="styleData.dayTaskText">
            活动开始啦，奖励<span :style="styleData.dayTaskSpan">更丰富！</span></div>
        </div>
        <div v-for="(item, index) in fansPlayList.taskList" :key="index">
          <!--活动提醒-->
          <div :style="styleData.activityTask" v-if="item.taskType == 17">
            <img
              src="https://img10.360buyimg.com/imgzone/jfs/t1/104966/24/637/8280/5db174b0E5e3fae5a/b8dd41119fcc19bf.png"
              alt=""
              :style="styleData.taskIcon"
            />
            <div :style="styleData.borderActivity">
              <div :style="styleData.taskText">设置活动提醒1次</div>
              <div :style="styleData.scoreEng">
                能量分+{{ item.sendNum }}，活动内上限{{ item.maxNum }}次
              </div>
            </div>
            <div :style="styleData.progressDiv">
              <div :style="styleData.progressVan">
                <van-progress
                  pivot-text=""
                  color="#ee0a24"
                  :percentage="(item.completeCount/item.maxNum)*100"
                />
              </div>
            </div>
            <div
              :style="styleData.goTaskBtn"
              :class="{
              'hasComplete-task-btn': item.completeCount >= item.maxNum,
            }"
              @click="doActivityTask6"
            >
              {{ item.completeCount >= item.maxNum ? "已完成" : "提醒我" }}({{
                item.completeCount
              }}/{{ item.maxNum }})
            </div>
          </div>

          <!--领取优惠券-->
          <div :style="styleData.activityTask" v-else-if="item.taskType == 18">
            <img
              src="//img10.360buyimg.com/imgzone/jfs/t1/53326/19/14145/7367/5db174b0Ec4274557/e72cf8037ed63f4d.png"
              alt=""
              :style="styleData.taskIcon"
            />
            <div :style="styleData.borderActivity">
              <div :style="styleData.taskText">优惠券领取</div>
              <div :style="styleData.scoreEng">
                能量分+{{ item.sendNum }}，活动内上限{{ item.maxNum }}次
              </div>
            </div>
            <div :style="styleData.progressDiv">
              <div :style="styleData.progressVan">
                <van-progress
                  pivot-text=""
                  color="#ee0a24"
                  :percentage="(item.completeCount/item.maxNum)*100"
                />
              </div>
            </div>
            <div
              :style="styleData.goTaskBtn"
              :class="{
              'hasComplete-task-btn': item.completeCount >= item.maxNum,
            }"
              @click="doActivityTask7"
            >
              {{ item.completeCount >= item.maxNum ? "已完成" : "领取优惠券" }}({{
                item.completeCount
              }}/{{ item.maxNum }})
            </div>
          </div>

          <!--逛会场/直播-->
          <div :style="styleData.activityTask" v-else-if="item.taskType == 4">
            <img
              src="https://img10.360buyimg.com/imgzone/jfs/t1/88744/38/7569/8047/5dfca7baEf025d273/0074f926d7980fce.png"
              alt=""
              :style="styleData.taskIcon"
              v-if="item.meetOrLiveType == 0"
            />
            <img
              src="https://img10.360buyimg.com/imgzone/jfs/t1/105691/17/7657/8357/5dfca7b9Ee3222121/e8add78fb22fb471.png"
              alt=""
              :style="styleData.taskIcon"
              v-else-if="item.meetOrLiveType == 1"
            />
            <div :style="styleData.borderActivity">
              <div :style="styleData.taskText">
                <template v-if="item.meetOrLiveType == 0">逛会场</template>
                <template v-if="item.meetOrLiveType == 1">看直播</template>
              </div>
              <div :style="styleData.scoreEng">
                能量分+{{ item.sendNum }}，活动内上限{{ item.maxNum }}次
              </div>
            </div>
            <div :style="styleData.progressDiv">
              <div :style="styleData.progressVan">
                <van-progress
                  pivot-text=""
                  color="#ee0a24"
                  :percentage="(item.completeCount/item.maxNum)*100"
                />
              </div>
            </div>
            <div
              :style="styleData.goTaskBtn"
              :class="{
              'hasComplete-task-btn': item.completeCount >= item.maxNum,
            }"
              @click="doActivityTask5"
            >
              {{ item.completeCount >= item.maxNum ? "已完成" : "去完成" }}({{
                item.completeCount
              }}/{{ item.maxNum }})
            </div>
          </div>
        </div>
      </div>
    </div>

  </div>
</template>
<script>
import apis1 from "../../../util/apis1.js";
import {goToShopPage, goToActive, acReminder} from "../../../util/tools.js";
import {allShare} from "../../../js/share.js";
import {Progress, Circle} from "vant";
import store from "../../../store/store";

let {getFansTaskList, fansTaskList} = apis1;
import {
  AddSkuPopComService,
  FansRulePopComService,
  FansActivityRemindPopComService,
  CollectCouponsPopComService,
} from "../../../util/comCreate.js";
import Vue from "vue";

Vue.use(Progress);
export default {
  props: [
    "isTemplate",
    "datas",
    "keyData",
    "styleData",
    "templateData",
    "isWebClick",
    "modifyContent",
  ],
  data() {
    return {
      fansPlayList: [],
      shareFlag: false,
      taskId: "",
      skuId: "",
      score: 0,
      activity1: false,
      activity2: false,
      activity3: false,
      activity4: false,
      activity5: false,
      activity6: false,
      activity7: false,
      checkFlag: false,
      btnFlag: false,
      acRemindAddress: "",
      styleDataOld: {},
    };
  },

  created() {
    //深拷贝重置需要
    this.styleDataOld = JSON.parse(JSON.stringify(this.styleData));
    this.initData();
  },
  methods: {
    styleClick(type, refName) {
      if (this.isWebClick) {
        //传值给B端
        let byValue = {
          modifyContent: this.modifyContent,
          refName: refName,
          styleData: this.styleData,
          c_this: this,
          isCustomSwitching: this.isCustomSwitching,
          styleDataOld: this.styleDataOld,
        };
        this.$emit("opertaionCom", type, byValue);
      }
    },
    initData() {
      var datasAll = this.templateData;

      if (this.isTemplate == true) {
        this.$toast("活动预览，仅供查看");
        if (datasAll) {
          this.fansPlayList = datasAll.basicTask;
          for (var i = 0; i < this.fansPlayList.taskList.length; i++) {
            if (this.fansPlayList.taskList[i].taskType == 2) {
              this.activity1 = true;
              this.fansPlayList.taskList[i].completeCount = 0;
              this.fansPlayList.taskList[i].maxNum =
                datasAll.basicTask.taskList[
                  i
                  ].rule.browseShop.dayLimit.limitNum;
              this.fansPlayList.taskList[i].sendNum =
                datasAll.basicTask.taskList[i].rule.browseShop.sendNum;
            } else if (this.fansPlayList.taskList[i].taskType == 3) {
              this.activity2 = true;
              this.fansPlayList.taskList[i].completeCount = 0;
              this.fansPlayList.taskList[i].maxNum =
                datasAll.basicTask.taskList[i].rule.browseSku.dayLimit.limitNum;
              this.fansPlayList.taskList[i].sendNum =
                datasAll.basicTask.taskList[i].rule.browseSku.sendNum;
            } else if (this.fansPlayList.taskList[i].taskType == 4) {
              this.activity7 = true;
              this.fansPlayList.taskList[i].completeCount = 0;
              this.fansPlayList.taskList[i].maxNum =
                datasAll.basicTask.taskList[
                  i
                  ].rule.browseMeetOrLiveRule.activeLimit.limitNum;
              this.fansPlayList.taskList[i].sendNum =
                datasAll.basicTask.taskList[
                  i
                  ].rule.browseMeetOrLiveRule.sendNum;
              this.fansPlayList.taskList[i].meetOrLiveType =
                datasAll.basicTask.taskList[
                  i
                  ].rule.browseMeetOrLiveRule.meetOrLiveType;
            } else if (this.fansPlayList.taskList[i].taskType == 7) {
              this.activity3 = true;
              this.fansPlayList.taskList[i].completeCount = 0;
              this.fansPlayList.taskList[i].maxNum =
                datasAll.basicTask.taskList[
                  i
                  ].rule.addSkuRule.dayLimit.limitNum;
              this.fansPlayList.taskList[i].sendNum =
                datasAll.basicTask.taskList[i].rule.addSkuRule.sendNum;
            } else if (this.fansPlayList.taskList[i].taskType == 12) {
              this.activity4 = true;
              this.fansPlayList.taskList[i].completeCount = 0;
              this.fansPlayList.taskList[i].maxNum =
                datasAll.basicTask.taskList[
                  i
                  ].rule.shareActiveRule.dayLimit.limitNum;
              this.fansPlayList.taskList[i].sendNum =
                datasAll.basicTask.taskList[i].rule.shareActiveRule.sendNum;
            } else if (this.fansPlayList.taskList[i].taskType == 17) {
              this.activity5 = true;
              this.fansPlayList.taskList[i].completeCount = 0;
              this.fansPlayList.taskList[i].maxNum =
                datasAll.basicTask.taskList[
                  i
                  ].rule.activityReminderRule.activeLimit.limitNum;
              this.fansPlayList.taskList[i].sendNum =
                datasAll.basicTask.taskList[
                  i
                  ].rule.activityReminderRule.sendNum;
            } else if (this.fansPlayList.taskList[i].taskType == 18) {
              this.activity6 = true;
              this.fansPlayList.taskList[i].completeCount = 0;
              this.fansPlayList.taskList[i].maxNum =
                datasAll.basicTask.taskList[
                  i
                  ].rule.getCouponsRule.activeLimit.limitNum;
              this.fansPlayList.taskList[i].sendNum =
                datasAll.basicTask.taskList[i].rule.getCouponsRule.sendNum;
            }
          }
        } else {
          //没有模板的数据
          this.fansPlayList = {
            taskList: [
              {
                activeOrDay: 1,
                completeCount: 0,
                maxNum: 1,
                sendNum: 1,
                shopId: 1000002791,
                status: 0,
                taskId: "1425695738683203586",
                taskPosition: 1,
                taskType: 2,
                validType: 0,
              },
            ],
          };
          for (var i = 0; i < this.fansPlayList.taskList.length; i++) {
            if (this.fansPlayList.taskList[i].taskType == 2) {
              this.activity1 = true;
            } else if (this.fansPlayList.taskList[i].taskType == 3) {
              this.activity2 = true;
            } else if (this.fansPlayList.taskList[i].taskType == 4) {
              this.activity7 = true;
            } else if (this.fansPlayList.taskList[i].taskType == 7) {
              this.activity3 = true;
            } else if (this.fansPlayList.taskList[i].taskType == 12) {
              this.activity4 = true;
            } else if (this.fansPlayList.taskList[i].taskType == 17) {
              this.activity5 = true;
            } else if (this.fansPlayList.taskList[i].taskType == 18) {
              this.activity6 = true;
            }
          }
        }
      } else {
        this.shareFlag = this.datas.shareFlag;
        this.shareUserId = store.state.shareUserId;
        getFansTaskList((data) => {
          this.fansPlayList = data.data.taskActivityInfoVO;
          for (var i = 0; i < this.fansPlayList.taskList.length; i++) {
            if (this.fansPlayList.taskList[i].taskType == 2) {
              this.activity1 = true;
            } else if (this.fansPlayList.taskList[i].taskType == 3) {
              // 浏览
              this.activity2 = true;
            } else if (this.fansPlayList.taskList[i].taskType == 4) {
              this.activity7 = true;
            } else if (this.fansPlayList.taskList[i].taskType == 7) {
              // 加购
              this.activity3 = true;
            } else if (this.fansPlayList.taskList[i].taskType == 12) {
              this.activity4 = true;
            } else if (this.fansPlayList.taskList[i].taskType == 17) {
              this.activity5 = true;
            } else if (this.fansPlayList.taskList[i].taskType == 18) {
              this.activity6 = true;
            }
            // 判断如果完成数量超过限制数量
            if (
              this.fansPlayList.taskList[i].completeCount >
              this.fansPlayList.taskList[i].maxNum
            ) {
              this.fansPlayList.taskList[i].completeCount =
                this.fansPlayList.taskList[i].maxNum;
            }
          }
        });
      }
    },
    openStrategyDialog() {
      if(!this.isWebClick) {
        FansRulePopComService.create((prizeRecordDetilClick) => {
          FansRulePopComService.close();
        });
      }
    },
    checkActivityStatus() {
      if (this.isTemplate) {
        this.$toast("活动预览，仅供查看");
        this.checkFlag = false;
        return;
      }
      let actStatus = sessionStorage.getItem("actStatus");

      if (actStatus == 2) {
        // Toast
        this.$toast("活动已结束");
        this.checkFlag = false;
        return;
      }
      if (actStatus == 1) {
        this.$toast("活动尚未开始");
        this.checkFlag = false;
        return;
      }
      // 方双击
      if (this.btnFlag == true) {
        this.checkFlag = false;
        return;
      }
      this.btnFlag = true;
      this.checkFlag = true;
    },

    checkTaskType(type) {
      //type 1、浏览店铺 2、浏览商品 3、加购商品 4、分享活动 5、逛会场/直播 6、活动提醒 7、领取优惠券
      for (var i = 0; i < this.fansPlayList.taskList.length; i++) {
        //浏览店铺
        if (this.fansPlayList.taskList[i].taskType == 2 && type == 1) {
          var that = this;
          if (
            this.fansPlayList.taskList[i].completeCount <
            this.fansPlayList.taskList[i].maxNum
          ) {
            // 定义值,先走for 在走回调i = 1;
            var index = i;
            fansTaskList(this.fansPlayList.taskList[i].taskId, "", (data) => {
              that.fansPlayList.taskList[index].completeCount =
                that.fansPlayList.taskList[index].completeCount + 1;
              that.score = that.fansPlayList.taskList[index].sendNum;
              that.publicData.$emit("fansFollowShop", that.score);
            });
            this.btnFlag = false;
            this.goShop(this.fansPlayList.taskList[i].shopId);
          } else {
            this.btnFlag = false;
            this.$toast("今天已完成该任务，请明天再来！");
          }

          //浏览商品
        } else if (this.fansPlayList.taskList[i].taskType == 3 && type == 2) {
          var index = i;
          if (
            this.fansPlayList.taskList[i].completeCount <
            this.fansPlayList.taskList[i].maxNum
          ) {
            var maxCount = this.fansPlayList.taskList[i].maxNum;
            AddSkuPopComService.create(
              this.fansPlayList.taskList[i],
              2,
              (count) => {
                AddSkuPopComService.close();
                this.btnFlag = false;
                if (count >= maxCount) {
                  this.fansPlayList.taskList[index].completeCount = maxCount;
                } else {
                  this.fansPlayList.taskList[index].completeCount = count;
                }
              }
            );
          } else {
            this.btnFlag = false;
            this.$toast("今天已完成该任务，请明天再来！");
          }
          //加购商品
        } else if (this.fansPlayList.taskList[i].taskType == 7 && type == 3) {
          var index = i;
          if (
            this.fansPlayList.taskList[i].completeCount <
            this.fansPlayList.taskList[i].maxNum
          ) {
            var maxCount = this.fansPlayList.taskList[i].maxNum;
            AddSkuPopComService.create(
              this.fansPlayList.taskList[i],
              1,
              (count) => {
                AddSkuPopComService.close();
                this.btnFlag = false;
                if (count >= maxCount) {
                  this.fansPlayList.taskList[index].completeCount = maxCount;
                } else {
                  this.fansPlayList.taskList[index].completeCount = count;
                }
              }
            );
          } else {
            this.btnFlag = false;
            this.$toast("今天已完成该任务，请明天再来！");
          }
          //分享活动
        } else if (this.fansPlayList.taskList[i].taskType == 12 && type == 4) {
          var index = i;
          if (
            this.fansPlayList.taskList[i].completeCount <
            this.fansPlayList.taskList[i].maxNum
          ) {
            fansTaskList(this.fansPlayList.taskList[i].taskId, "", (data) => {
              if (data.data == true) {
                this.fansPlayList.taskList[index].completeCount =
                  this.fansPlayList.taskList[index].completeCount + 1;
                this.score = this.fansPlayList.taskList[index].sendNum;
                this.publicData.$emit("fansFollowShop", this.score);
                this.btnFlag = false;
              }
              allShare(this.isTemplate, this, (callBackData) => {
                console.log(callBackData, "callBackData");
              });
            });
          } else {
            this.btnFlag = false;
            this.$toast("今天已完成该任务，请明天再来！");
          }
          //逛会场/直播
        } else if (this.fansPlayList.taskList[i].taskType == 4 && type == 5) {
          var index = i;
          var maxCount = this.fansPlayList.taskList[i].maxNum;
          this.score = this.fansPlayList.taskList[i].sendNum;
          if (
            this.fansPlayList.taskList[i].completeCount <
            this.fansPlayList.taskList[i].maxNum
          ) {
            fansTaskList(this.fansPlayList.taskList[i].taskId, "", (data) => {
              if (data.data == true) {
                this.fansPlayList.taskList[index].completeCount =
                  this.fansPlayList.taskList[index].completeCount + 1;
                this.publicData.$emit("fansFollowShop", this.score);
              }
            });
            this.goToActiveTask(this.fansPlayList.taskList[index].meetUrl);
            this.btnFlag = false;
          } else {
            this.btnFlag = false;
            this.$toast("您已完成该任务");
          }
          //活动提醒
        } else if (this.fansPlayList.taskList[i].taskType == 17 && type == 6) {
          var index = i;
          var maxCount = this.fansPlayList.taskList[i].maxNum;
          this.score = this.fansPlayList.taskList[i].sendNum;
          if (
            this.fansPlayList.taskList[i].completeCount <
            this.fansPlayList.taskList[i].maxNum
          ) {
            fansTaskList(this.fansPlayList.taskList[i].taskId, "", (data) => {
              if (data.data == true) {
                this.fansPlayList.taskList[index].completeCount =
                  this.fansPlayList.taskList[index].completeCount + 1;
                this.acRemindAddress =
                  this.fansPlayList.taskList[index].acRemindAddress;
                let params = {
                  acRemindTime: this.fansPlayList.taskList[index].acRemindTime,
                };
                acReminder(params, (callBackData) => {
                  console.log(callBackData, "提醒回调");
                });
                this.publicData.$emit("fansFollowShop", this.score);
                FansActivityRemindPopComService.create(
                  this.acRemindAddress,
                  (prizeRecordDetilClick) => {
                    FansActivityRemindPopComService.close();
                  }
                );
              }
            });
            this.btnFlag = false;
          } else {
            this.$toast("您已完成该任务");
            this.btnFlag = false;
          }
          //领取优惠券
        } else if (this.fansPlayList.taskList[i].taskType == 18 && type == 7) {
          var index = i;
          if (
            this.fansPlayList.taskList[i].completeCount <
            this.fansPlayList.taskList[i].maxNum
          ) {
            var maxCount = this.fansPlayList.taskList[i].maxNum;
            CollectCouponsPopComService.create(
              this.fansPlayList.taskList[i],
              (data) => {
                CollectCouponsPopComService.close();
                if (data > maxCount) {
                  this.fansPlayList.taskList[index].completeCount = maxCount;
                } else {
                  this.fansPlayList.taskList[index].completeCount = data;
                }
              }
            );
            this.btnFlag = false;
          } else {
            this.btnFlag = false;
            this.$toast("您已完成该任务");
          }
        }
      }
    },
    //浏览店铺
    doDayTask1() {
      this.checkActivityStatus();
      if (this.checkFlag == true) {
        this.checkTaskType(1);
      }
    },
    //浏览商品
    doDayTask2() {
      this.checkActivityStatus();
      if (this.checkFlag == true) {
        this.checkTaskType(2);
      }
    },
    //加购商品
    doDayTask3() {
      this.checkActivityStatus();
      if (this.checkFlag == true) {
        this.checkTaskType(3);
      }
    },
    //分享活动
    doDayTask4() {
      this.checkActivityStatus();
      if (this.checkFlag == true) {
        this.checkTaskType(4);
      }
    },
    //逛会场/直播
    doActivityTask5() {
      this.checkActivityStatus();
      if (this.checkFlag == true) {
        this.checkTaskType(5);
      }
    },
    //活动提醒
    doActivityTask6() {
      this.checkActivityStatus();
      if (this.checkFlag == true) {
        this.checkTaskType(6);
      }
    },
    //领取优惠券
    doActivityTask7() {
      this.checkActivityStatus();
      if (this.checkFlag == true) {
        this.checkTaskType(7);
      }
    },
    //跳转店铺
    goShop(shopId) {
      goToShopPage(shopId);
    },
    //跳转会场
    goToActiveTask(url) {
      goToActive(url);
    },
  },
};
</script>
<style lang="scss" scoped>
.hasComplete-task-btn {
  color: #ee0a24;
  background: white;
  border: 1px solid #ee0a24;
  border-radius: 28px;
}

.day-task:nth-child(n + 2),
.activity-task:nth-child(n + 2) {
  margin-top: 0.2rem;
}
</style>
