"use strict"; const common_vendor = require("../../common/vendor.js"); const common_assets = require("../../common/assets.js"); const api_index = require("../../api/index.js"); const _sfc_main = { __name: "index", setup(__props) { const topHeight = common_vendor.ref(0); function getTopHeight() { if (common_vendor.index.getMenuButtonBoundingClientRect) { topHeight.value = common_vendor.index.getMenuButtonBoundingClientRect().top * 2; } } const cardInfo = common_vendor.ref({ userName: "", headImg: "", waterCardNumber: "", balance: "", count: "", userPhone: "" }); const isVip = common_vendor.ref(false); async function getInfo() { let res = await api_index.getUserInfo(); console.log("res", res.data); cardInfo.value.userName = res.data.userInfo.userName; cardInfo.value.headImg = res.data.userInfo.headImg; cardInfo.value.userPhone = res.data.userInfo.userPhone; if (res.data.userInfo.waterCardNumber) { let res1 = await api_index.getVipInfoApi(); cardInfo.value.waterCardNumber = res1.data.cardNumber; if (res1.data.cardType == 1) { cardInfo.value.balance = res1.data.balance; } else if (res1.data.cardType == 2) { cardInfo.value.count = res1.data.count; } isVip.value = true; } else { isVip.value = false; } common_vendor.index.setStorageSync("userInfo", JSON.stringify(cardInfo.value)); } function toScan() { common_vendor.index.scanCode({ scanType: ["qrCode"], success: function(res) { console.log("条码类型:" + res.scanType); console.log("条码内容:" + res.result); common_vendor.index.navigateTo({ url: "/pages/scanWater/index" }); } }); } const functionList = common_vendor.ref([ { text: "余额记录", icon: "../../static/images/index/icon31.png", url: "/pages/balanceRecord/index" }, { text: "消费记录", icon: "../../static/images/index/icon32.png", url: "" }, { text: "充值记录", icon: "../../static/images/index/icon33.png", url: "" }, { text: "账户共享", icon: "../../static/images/index/icon34.png", url: "" }, { text: "优惠卷", icon: "../../static/images/index/icon35.png", url: "" }, { text: "电子发票", icon: "../../static/images/index/icon36.png", url: "" }, { text: "联系客服", icon: "../../static/images/index/icon37.png", url: "" }, { text: "推广分佣", icon: "../../static/images/index/icon38.png", url: "" } ]); function navTo(itemUrl) { if (itemUrl) { common_vendor.index.navigateTo({ url: itemUrl }); } } common_vendor.onMounted(async () => { getTopHeight(); }); common_vendor.onShow(async () => { await getInfo(); }); return (_ctx, _cache) => { return { a: common_assets._imports_0$1, b: common_vendor.t(cardInfo.value.userName), c: common_assets._imports_1, d: common_vendor.o(($event) => navTo("/pages/userInfo/index")), e: common_assets._imports_2, f: common_vendor.t(cardInfo.value.waterCardNumber), g: common_vendor.t(cardInfo.value.userPhone), h: common_assets._imports_3, i: common_vendor.o(($event) => navTo("/pages/addCard/index")), j: common_vendor.t(cardInfo.value.balance), k: common_vendor.o(($event) => navTo("/pages/recharge/index")), l: topHeight.value + "rpx", m: common_assets._imports_4, n: common_vendor.o(($event) => navTo("/pages/sendWater/index")), o: common_assets._imports_1$1, p: common_vendor.o(($event) => navTo("/pages/facilityList/index")), q: common_assets._imports_6, r: common_vendor.o(($event) => toScan()), s: common_vendor.f(functionList.value, (item, index, i0) => { return { a: item.icon, b: common_vendor.t(item.text), c: common_vendor.o(($event) => navTo(item.url), index), d: index }; }), t: common_assets._imports_7, v: common_assets._imports_8, w: common_assets._imports_9, x: common_assets._imports_10, y: common_assets._imports_9 }; }; } }; const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-1cf27b2a"]]); wx.createPage(MiniProgramPage);