<template>
  <view>
    <!-- 生成公众号二维码 -->
    <we-qrcode @generate="(e) => qrcodeResult(e)"></we-qrcode>
    <officialAccount
      followIndex="eat"
      :wechatAcQrcode="wechatAcQrcode"
      v-if="showOfficialAccount"
      @close="modelClose($event, 'officialAccount')"
    />
    <couponModal
      v-if="showCoupon"
      getMode="eat"
      @close="modelClose($event, 'coupon')"
    />
    <birthdayGift
      v-if="showBirthdayGift"
      @close="modelClose($event, 'birthdayGift')"
    />
  </view>
</template>
<script setup>
import weQrcode from "@/components/wechat-ac-qrcode.vue";

import { ref, watch, computed, reactive, toRaw } from "vue";
import couponModal from "@/components/coupon-modal.vue";
import birthdayGift from "@/components/birthday-modal.vue";
import officialAccount from "@/components/official-account.vue";
//弹窗列表
const list = ref([]);

const showBirthdayGift = ref(true);
const showCoupon = ref(false);
const showOfficialAccount = ref(false);

function modelClose(e, type) {
  if (type == "birthdayGift") {
    showCoupon.value = true;
    return;
  }
  if (type == "coupon") {
    showOfficialAccount.value = true;
    return;
  }
  if (type == "officialAccount") {
    return;
  }
}
const wechatAcQrcode = ref("");
const userinfo = uni.cache.get("userInfo") || {};
const codeVal = ref(userinfo.wechatAcQrcode || "");
function qrcodeResult(e) {
  wechatAcQrcode.value = e;
}
</script>

