<template>
  <div class="orderVerification" :style="styleData.orderVerification" v-if="btnShow && actStatus == 3">
    <div @click="goToOrderCheck" :class="sizeType?'bigImg':'smallImg'"></div>
  </div>
</template>
 
<script>
  import { orderVerificationService } from "@/util/hdzxtcomCreate.js";
  import apis1 from '@/util/apis1.js';
  let { getTaskConfigApi } = apis1;
  export default {
    props: [
    "datas",
    "keyData",
    "styleData",
    "isTemplate",
    "templateData",
    "modifyContent",
    "isWebClick",
  ],
    data() {
      return {
        sizeType: true,
        activityType:0,
        btnShow:false,
        actStatus:sessionStorage.getItem("actStatus")
      };
    },
    created() {
      this.activityType = sessionStorage.getItem("activityType");
      if(!this.isTemplate){
        if(this.activityType == '10107'|| this.activityType == '10095'|| this.activityType == '10094'|| this.activityType == '10093'|| this.activityType == '10091'|| this.activityType == '10089'|| this.activityType == '10086'|| this.activityType == '10084'|| this.activityType == '10092'|| this.activityType == '10082'|| this.activityType == '10059'|| this.activityType == '10020'|| this.activityType == '10042' || this.activityType == '10035' || this.activityType == '10021' || this.activityType == '10046' || this.activityType == '10031' || this.activityType == '10054' || this.activityType == '10041' || this.activityType == '10062' || this.activityType == '10063'){
          getTaskConfigApi(res=>{
            if(res.data.category && res.data.isCheck == 1){
              sessionStorage.setItem('taskVo',JSON.stringify(res.data))
              this.btnShow = true
              if(this.activityType == '10107'){
                sessionStorage.setItem('orderStatus',JSON.stringify(res.data.orderStatus))
              }
            }else{
              this.btnShow = false
            }
          })
        }else{
          if(this.activityType == '10077'){
            this.btnShow = true
          }else{
            this.btnShow = true
          }
        }
      }
      setTimeout(() => {
        // this.sizeType = false
      }, 3000);
    },
    mounted() {
      this.sessionStorageObserver = setInterval(() => {
        const currentActStatus = sessionStorage.getItem("actStatus");
        if (currentActStatus !== this.actStatus) {
          this.actStatus = currentActStatus;
        }
      }, 100); // 每100ms检查一次
    },
    methods: {
      goToOrderCheck() {
        if (this.isWebClick) {
          return;
        }
        if (this.isTemplate) {
          return;
        }
        this.sizeType = true
        orderVerificationService.create(callBack => {
          orderVerificationService.close();
        });
        setTimeout(() => {
          // this.sizeType = falsesizeType
        }, 3000);
      },

    },
    beforeDestroy() {
      if (this.sessionStorageObserver) {
        clearInterval(this.sessionStorageObserver);
      }
    }
  };
</script>
 
<style scoped lang="scss">
  .orderVerification {
    right: 0;
    position: absolute;
    .bigImg {
      width: 1.5rem;
      height: 0.5rem; /* 根据需要设置图片容器的高度 */
      background-image: url(//img10.360buyimg.com/imgzone/jfs/t1/263362/23/18700/13622/67aaad1dF28171263/e563824098235185.png);
      background-size: 100%;
    }
    .smallImg {
      width: 1.5rem;
      height: 0.5rem; /* 根据需要设置图片容器的高度 */
      background-image: url(//img10.360buyimg.com/imgzone/jfs/t1/227658/9/33443/5928/67aaad1dF890a71e8/9ee78e4e9655b3e1.png);
      background-size: 100%;
    }
  }
</style>