Liuyi
2024-12-20 d470e67ac1997882502b75cbfdaf359626cfaaa8
unpackage/dist/dev/mp-weixin/pages/index/index.js
@@ -13,6 +13,7 @@
      }
    }
    const cardInfo = common_vendor.ref({
      //用户档案信息
      id: "",
      userName: "微信用户",
      headImg: "",
@@ -33,8 +34,8 @@
    const isShareCard = common_vendor.ref(false);
    async function getVipInfo() {
      await api_index.getVipInfoApi().then((res) => {
        console.log("会员卡信息响应", res);
        if (res.code == 200 && res.data.id) {
          console.log("获取会员卡返回响应-首页", res);
          cardInfo.value.waterCardNumber = res.data.cardNumber;
          cardInfo.value.cardType = res.data.cardType;
          cardInfo.value.state = res.data.state == 2 ? true : false;
@@ -47,12 +48,13 @@
            cardInfo.value.count = res.data.count;
          }
          isVip.value = true;
          console.log("cardInfo", cardInfo.value, "isShareCard.value", isShareCard.value);
          console.log("会员卡及用户信息", cardInfo.value);
        }
      });
    }
    async function getInfo() {
      await api_index.getUserInfo().then(async (res) => {
        console.log("用户信息响应", res);
        if (res.code == 200) {
          cardInfo.value.userName = res.data.userInfo.userName ? res.data.userInfo.userName : cardInfo.value.userName;
          cardInfo.value.headImg = res.data.userInfo.headImg;
@@ -60,7 +62,6 @@
          cardInfo.value.userPhone = res.data.userInfo.userPhone;
          cardInfo.value.id = res.data.userInfo.id;
          await getVipInfo();
          console.log("用户信息响应", res);
          console.log("用户信息", cardInfo.value);
          common_vendor.index.setStorageSync("userInfo", JSON.stringify(cardInfo.value));
        }
@@ -70,23 +71,24 @@
      common_vendor.index.scanCode({
        scanType: ["qrCode"],
        success: async function(res) {
          console.log("条码内容:" + res.result);
          let code = res.result.split("=")[1];
          console.log("条码内容:" + res.result, "code", code);
          common_vendor.index.navigateTo({
            url: `/pages/scanWater/index?facilityCode=${res.result}`
            url: `/pages/scanWater/index?facilityCode=${code}`
          });
        }
      });
    }
    const functionList = common_vendor.ref([
      //isUrl:1:页面跳转,2:弹窗功能,3:弹窗功能,4:未开发
      { text: "余额记录", icon: "../../static/images/index/icon31.png", bgColor: "#16b387", url: "/pages/functionList/balanceRecord/index", isUrl: 1 },
      { text: "消费记录", icon: "../../static/images/index/icon32.png", bgColor: "#329ae8", url: "/pages/functionList/paymentRecord/index", isUrl: 1 },
      { text: "充值记录", icon: "../../static/images/index/icon33.png", bgColor: "#f0a50e", url: "/pages/functionList/rechargeRecord/index", isUrl: 1 },
      { text: "水卡共享", icon: "../../static/images/index/icon34.png", bgColor: "#55ca8c", url: "/pages/functionList/share/cardShare/index", isUrl: 1 },
      { text: "故障上报", icon: "../../static/images/index/icon35.png", bgColor: "#a88ff1", url: "/pages/infoBreakdown/index", isUrl: 1 },
      { text: "优惠卷", icon: "../../static/images/index/icon36.png", bgColor: "#18bfc4", url: "", isUrl: 4 },
      { text: "会员卡挂失", icon: "../../static/images/index/icon37.png", bgColor: "#4875f0", url: "", isUrl: 2 },
      { text: "会员卡解绑", icon: "../../static/images/index/icon38.png", bgColor: "#f45088", url: "", isUrl: 3 }
      { text: "余额记录", icon: "../../static/images/index/icon31.png", url: "/pages/functionList/balanceRecord/index", isUrl: 1 },
      { text: "消费记录", icon: "../../static/images/index/icon32.png", url: "/pages/functionList/paymentRecord/index", isUrl: 1 },
      { text: "充值记录", icon: "../../static/images/index/icon33.png", url: "/pages/functionList/rechargeRecord/index", isUrl: 1 },
      { text: "水卡共享", icon: "../../static/images/index/icon34.png", url: "/pages/functionList/share/cardShare/index", isUrl: 1 },
      { text: "故障上报", icon: "../../static/images/index/icon35.png", url: "/pages/infoBreakdown/index", isUrl: 1 },
      { text: "优惠卷", icon: "../../static/images/index/icon36.png", url: "", isUrl: 4 },
      { text: "卡挂失", icon: "../../static/images/index/icon37.png", url: "", isUrl: 2 },
      { text: "卡解绑", icon: "../../static/images/index/icon38.png", url: "", isUrl: 3 }
    ]);
    function navTo(itemUrl) {
      if (itemUrl) {
@@ -258,23 +260,24 @@
      }
    }
    common_vendor.onMounted(async () => {
      console.log("空用户信息", cardInfo.value);
      common_vendor.index.setStorageSync("userInfo", JSON.stringify(cardInfo.value));
      getTopHeight();
      await getInfo();
      await getUserLocation();
      console.log("进入首页了");
      console.log("onMounted", "用户存储本地数据", JSON.parse(common_vendor.index.getStorageSync("userInfo")));
    });
    common_vendor.onShow(async () => {
      getTopHeight();
      await getInfo();
      console.log("onShow", "用户存储本地数据", JSON.parse(common_vendor.index.getStorageSync("userInfo")));
    });
    common_vendor.index.showShareMenu({
      withShareTicket: true,
      menus: ["shareAppMessage", "shareTimeline"],
      success: function() {
        console.log("分享菜单显示成功");
      },
      fail: function(err) {
        console.error("分享菜单显示失败", err);
      }
    });
    return (_ctx, _cache) => {
@@ -290,68 +293,49 @@
        f: common_vendor.o(($event) => navTo("/pages/userInfo/index")),
        g: common_assets._imports_1$2,
        h: common_assets._imports_0$3,
        i: isShareCard.value
      }, isShareCard.value ? {
        j: common_vendor.t(cardInfo.value.waterCardNumber)
      } : {}, {
        k: !isShareCard.value
        i: isVip.value
      }, isVip.value ? common_vendor.e({
        j: isShareCard.value
      }, isShareCard.value ? common_vendor.e({
        k: isLoss.value
      }, isLoss.value ? {} : {}) : {}, {
        l: !isShareCard.value
      }, !isShareCard.value ? common_vendor.e({
        l: isVip.value
      }, isVip.value ? {
        m: common_assets._imports_3$1
      } : {}, {
        n: isVip.value
      }, isVip.value ? {} : {}, {
        o: !isVip.value
      }, !isVip.value ? {} : {}, {
        p: isLoss.value && isVip.value
      }, isLoss.value && isVip.value ? {} : {}, {
        q: isVip.value
      }, isVip.value ? {
        r: common_vendor.t(cardInfo.value.waterCardNumber)
      } : {}, {
        s: isVip.value
      }, isVip.value ? {} : {}, {
        t: isVip.value
      }, isVip.value ? {
        v: common_vendor.t(cardInfo.value.balance)
      } : {}, {
        w: !isVip.value
      }, !isVip.value ? {
        x: common_assets._imports_4$1,
        y: common_vendor.o(($event) => navTo("/pages/addCard/index"))
      } : {}, {
        z: isVip.value
      }, isVip.value ? {
        A: common_vendor.o(($event) => navTo("/pages/recharge/index"))
        m: isLoss.value
      }, isLoss.value ? {} : {}) : {}, {
        n: common_vendor.t(cardInfo.value.waterCardNumber),
        o: common_vendor.t(cardInfo.value.balance),
        p: !isShareCard.value
      }, !isShareCard.value ? {
        q: common_vendor.o(($event) => navTo("/pages/recharge/index"))
      } : {}) : {}, {
        B: topHeight.value + "rpx",
        C: common_assets._imports_5,
        D: common_vendor.o(upGrade),
        E: common_assets._imports_1$1,
        F: common_vendor.o(($event) => navTo("/pages/facilityList/index")),
        G: common_assets._imports_7,
        H: common_vendor.o(($event) => toScan()),
        I: common_vendor.f(functionList.value, (item, index, i0) => {
        r: !isVip.value
      }, !isVip.value ? {
        s: common_vendor.o(($event) => navTo("/pages/addCard/index"))
      } : {}, {
        t: topHeight.value + "rpx",
        v: common_assets._imports_3$1,
        w: common_vendor.o(upGrade),
        x: common_assets._imports_1$1,
        y: common_vendor.o(($event) => navTo("/pages/facilityList/index")),
        z: common_assets._imports_5,
        A: common_vendor.o(($event) => toScan()),
        B: common_vendor.f(functionList.value, (item, index, i0) => {
          return {
            a: item.icon,
            b: item.bgColor,
            c: common_vendor.t(item.text),
            d: common_vendor.o(($event) => setEvent(item.isUrl, item.url), index),
            e: index
            b: common_vendor.t(item.text),
            c: common_vendor.o(($event) => setEvent(item.isUrl, item.url), index),
            d: index
          };
        }),
        J: common_assets._imports_8,
        K: common_assets._imports_9,
        L: common_assets._imports_10,
        M: common_assets._imports_11,
        N: common_vendor.o(($event) => navTo("/pagesPoints/pointsMall/index")),
        O: common_assets._imports_12,
        P: common_assets._imports_13,
        Q: common_vendor.o(($event) => navTo("/pages/station/index")),
        R: common_assets._imports_14,
        S: common_assets._imports_13,
        T: common_vendor.o(upGrade)
        C: common_assets._imports_6,
        D: common_vendor.o(($event) => navTo("/pagesPoints/pointsMall/index")),
        E: common_assets._imports_7,
        F: common_assets._imports_8,
        G: common_vendor.o(($event) => navTo("/pages/station/index")),
        H: common_assets._imports_9,
        I: common_assets._imports_8,
        J: common_vendor.o(upGrade)
      });
    };
  }