"use strict";
const common_vendor = require("./common/vendor.js");
const common_js_conver = require("./common/js/conver.js");
const _sfc_main = {
  name: "ad-popup",
  props: {
    // 是否显示弹窗
    visible: {
      type: Boolean,
      value: false
    },
    coupons: {
      type: Object,
      value: null
    },
    couponsList: {
      type: Array,
      value: null
    }
  },
  data() {
    return {
      localVisible: this.visible,
      checked: false,
      initPosition: {
        left: 50,
        top: 50
      },
      // top: 35%;
      // left: 8%;
      content: {
        left: 20,
        top: 150
      },
      animation: {},
      screenWidth: 0,
      screenHeight: 0,
      top: 590,
      left: 80
    };
  },
  mounted() {
  },
  methods: {
    moneyTxt: common_js_conver.moneyTxt,
    toggleCheck() {
      common_vendor.index.__f__("log", "at components/ad-popup.vue:98", "点击了", this.checked);
      this.checked = !this.checked;
      common_vendor.index.__f__("log", "at components/ad-popup.vue:100", "点击后", this.checked);
    },
    // 关闭弹窗
    onClose() {
      this.$emit("ad-close", this.checked);
    },
    onFurl() {
      this.startAnimation();
      this.$emit("ad-furl", this.checked);
    },
    startAnimation() {
      this.showBox = true;
      this.animation = {};
      setTimeout(() => {
        const animation = common_vendor.index.createAnimation({
          duration: 1e3,
          timingFunction: "ease-in-out"
        });
        const initX = this.initPosition.left;
        const initY = this.initPosition.top;
        const targetX = initX + 120;
        const targetY = initY + 400;
        animation.translate(targetX - initX, targetY - initY).scale(0.03).rotate(180).skew(10, 10).opacity(0).step();
        this.animation = animation.export();
        setTimeout(() => {
          this.$emit("ad-close", false);
          this.initPosition = {
            left: 50,
            top: 50
          };
          this.animation = {};
        }, 1e3);
      }, 50);
    }
  }
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  return common_vendor.e({
    a: $props.visible
  }, $props.visible ? {
    b: common_vendor.o((...args) => $options.onClose && $options.onClose(...args)),
    c: common_vendor.f($props.couponsList, (item, index, i0) => {
      return {
        a: $options.moneyTxt(14, 20, item.amount / 100),
        b: common_vendor.t(item.title),
        c: common_vendor.t(item.useGmtStart),
        d: common_vendor.t(item.useGmtEnd),
        e: index
      };
    }),
    d: $props.couponsList.length > 1 ? "600rpx" : "350rpx",
    e: common_vendor.o((...args) => $options.toggleCheck && $options.toggleCheck(...args)),
    f: common_vendor.o((...args) => $options.onFurl && $options.onFurl(...args)),
    g: $props.couponsList.length > 1 ? "70vh" : "50vh",
    h: $data.animation,
    i: $data.initPosition.left,
    j: $data.initPosition.top
  } : {});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
exports.MiniProgramPage = MiniProgramPage;
//# sourceMappingURL=../.sourcemap/mp-toutiao/ad-popup.js.map
