| | |
| | | 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({ |
| | | id: "", |
| | | userName: "", |
| | | headImg: "", |
| | | waterCardNumber: "", |
| | | balance: "", |
| | | count: "", |
| | | userPhone: "" |
| | | }); |
| | | const isVip = common_vendor.ref(false); |
| | | async function getVipInfo() { |
| | | async function getInfo() { |
| | | let res = await api_index.getUserInfo(); |
| | | if (res.data.userInfo.waterCardNumber) { |
| | | let res1 = await api_index.getVipInfoApi(); |
| | | vipInfo.value = res1.data; |
| | | isVip.value = false; |
| | | } else { |
| | | isVip.value = false; |
| | | if (res.code == 200) { |
| | | 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; |
| | | cardInfo.value.id = res.data.userInfo.id; |
| | | 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.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/icon32.png", url: "/pages/paymentRecord/index" }, |
| | | { text: "充值记录", icon: "../../static/images/index/icon33.png", url: "" }, |
| | | { text: "账户共享", icon: "../../static/images/index/icon34.png", url: "" }, |
| | | { text: "优惠卷", icon: "../../static/images/index/icon35.png", url: "" }, |
| | |
| | | } |
| | | common_vendor.onMounted(async () => { |
| | | getTopHeight(); |
| | | await getVipInfo(); |
| | | }); |
| | | common_vendor.onShow(async () => { |
| | | await getInfo(); |
| | | }); |
| | | 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) => navTo("/pages/addCard/index")) |
| | | }, { |
| | | e: common_assets._imports_2, |
| | | f: common_assets._imports_3, |
| | | g: topHeight.value + "rpx", |
| | | d: common_assets._imports_2, |
| | | e: common_vendor.o(($event) => navTo("/pages/addCard/index")), |
| | | f: common_vendor.o(($event) => navTo("/pages/userInfo/index")), |
| | | g: common_assets._imports_3, |
| | | h: common_assets._imports_4, |
| | | i: common_vendor.o(($event) => navTo("/pages/sendWater/index")), |
| | | j: common_vendor.o(($event) => navTo("/pages/recharge/index")), |
| | | k: common_assets._imports_5, |
| | | l: common_vendor.f(functionList.value, (item, index, i0) => { |
| | | i: common_vendor.t(cardInfo.value.waterCardNumber), |
| | | j: common_vendor.t(cardInfo.value.userPhone), |
| | | k: common_vendor.t(cardInfo.value.balance), |
| | | l: common_vendor.o(($event) => navTo("/pages/recharge/index")), |
| | | m: topHeight.value + "rpx", |
| | | n: common_assets._imports_5, |
| | | o: common_vendor.o(($event) => navTo("/pages/sendWater/index")), |
| | | p: common_assets._imports_1$1, |
| | | q: common_vendor.o(($event) => navTo("/pages/facilityList/index")), |
| | | r: common_assets._imports_7, |
| | | s: common_vendor.o(($event) => toScan()), |
| | | t: common_vendor.f(functionList.value, (item, index, i0) => { |
| | | return { |
| | | a: item.icon, |
| | | b: common_vendor.t(item.text), |
| | |
| | | d: index |
| | | }; |
| | | }), |
| | | m: common_assets._imports_6, |
| | | n: common_assets._imports_7, |
| | | o: common_assets._imports_8, |
| | | p: common_assets._imports_9, |
| | | q: common_assets._imports_8 |
| | | }); |
| | | v: common_assets._imports_8, |
| | | w: common_assets._imports_9, |
| | | x: common_assets._imports_10, |
| | | y: common_vendor.o(($event) => navTo("/pages/station/index")), |
| | | z: common_assets._imports_11, |
| | | A: common_assets._imports_10 |
| | | }; |
| | | }; |
| | | } |
| | | }; |