From 6479fb873fc2dcd9d8418b10f355c825b64b82eb Mon Sep 17 00:00:00 2001 From: Liuyi <candymxq888@outlook.com> Date: 星期一, 30 九月 2024 17:01:26 +0800 Subject: [PATCH] 修改主页会员卡信息,修改会员卡绑定 --- unpackage/dist/dev/mp-weixin/pages/index/index.js | 68 +++++++++++++++++++++------------ 1 files changed, 43 insertions(+), 25 deletions(-) diff --git a/unpackage/dist/dev/mp-weixin/pages/index/index.js b/unpackage/dist/dev/mp-weixin/pages/index/index.js index b87cb87..ab50f11 100644 --- a/unpackage/dist/dev/mp-weixin/pages/index/index.js +++ b/unpackage/dist/dev/mp-weixin/pages/index/index.js @@ -8,35 +8,50 @@ const topHeight = common_vendor.ref(0); function getTopHeight() { if (common_vendor.index.getMenuButtonBoundingClientRect) { - topHeight.value = (common_vendor.index.getMenuButtonBoundingClientRect().top + common_vendor.index.getMenuButtonBoundingClientRect().height) * 2; + topHeight.value = common_vendor.index.getMenuButtonBoundingClientRect().top * 2; } } - const vipInfo = common_vendor.ref(); + const cardInfo = common_vendor.ref({ + userName: "", + headImg: "", + waterCardNumber: "", + balance: "", + count: "", + userPhone: "" + }); const isVip = common_vendor.ref(false); async function getVipInfo() { let res = await api_index.getUserInfo(); + 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(); - vipInfo.value = res1.data; + cardInfo.value.waterCardNumber = res1.data.userInfo.waterCardNumber; + 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; } } - function navToAddCard() { + function toScan() { common_vendor.index.navigateTo({ - url: "/pages/addCard/index" + url: "/pages/scanWater/index" }); } const functionList = common_vendor.ref([ - { text: "余额记录", icon: "../../static/images/index/icon31.png", url: "" }, + { 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: "/pages/login/index" } + { text: "推广分佣", icon: "../../static/images/index/icon38.png", url: "" } ]); function navTo(itemUrl) { if (itemUrl) { @@ -49,21 +64,24 @@ getTopHeight(); await getVipInfo(); }); + common_vendor.onShow(async () => { + await getVipInfo(); + }); return (_ctx, _cache) => { - return common_vendor.e({ - a: isVip.value - }, isVip.value ? { - b: common_assets._imports_0$1 - } : { + return { + a: common_assets._imports_0$1, + b: common_vendor.t(cardInfo.value.userName), c: common_assets._imports_1, - d: common_vendor.o(($event) => navToAddCard()) - }, { - e: common_assets._imports_2, - f: common_assets._imports_3, + d: common_assets._imports_2, + e: common_vendor.t(cardInfo.value.waterCardNumber), + f: common_vendor.o(($event) => navTo("/pages/userInfo/index")), g: topHeight.value + "rpx", - h: common_assets._imports_4, - i: common_assets._imports_5, - j: common_vendor.f(functionList.value, (item, index, i0) => { + h: common_assets._imports_3, + i: common_vendor.o(($event) => navTo("/pages/sendWater/index")), + j: common_vendor.o(($event) => navTo("/pages/recharge/index")), + k: common_assets._imports_4, + l: common_vendor.o(($event) => toScan()), + m: common_vendor.f(functionList.value, (item, index, i0) => { return { a: item.icon, b: common_vendor.t(item.text), @@ -71,12 +89,12 @@ d: index }; }), - k: common_assets._imports_6, - l: common_assets._imports_7, - m: common_assets._imports_8, - n: common_assets._imports_9, - o: common_assets._imports_8 - }); + n: common_assets._imports_5, + o: common_assets._imports_6, + p: common_assets._imports_7, + q: common_assets._imports_8, + r: common_assets._imports_7 + }; }; } }; -- Gitblit v1.9.3