<template>
  <view>
    <!-- 生成公众号二维码 -->
    <we-qrcode @generate="(e) => qrcodeResult(e)"></we-qrcode>

    <officialAccount
      followIndex="order"
      :wechatAcQrcode="wechatAcQrcode"
      v-if="showOfficialAccount"
      @close="modelClose($event, 'officialAccount')"
    />
    <Drainage  v-model="showDrainage" @close="modelClose($event, 'drainage')" />
  </view>
</template>
  <script setup>
import weQrcode from "@/components/wechat-ac-qrcode.vue";

import { ref, watch, computed, reactive, toRaw } from "vue";
import officialAccount from "@/components/official-account.vue";
import Drainage from "@/components/drainage.vue";

const showDrainage = defineModel({
  type: Boolean,
  default: false,
});
const showOfficialAccount = ref(false);

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

