mycard.js 5.45 KB
"use strict";
const common_vendor = require("../../../common/vendor.js");
const common_api = require("../../../common/api.js");
require("../../../common/request.js");
require("../../../config.js");
require("../../../common/login.js");
if (!Array) {
  const _easycom_uni_segmented_control2 = common_vendor.resolveComponent("uni-segmented-control");
  _easycom_uni_segmented_control2();
}
const _easycom_uni_segmented_control = () => "../../../uni_modules/uni-segmented-control/components/uni-segmented-control/uni-segmented-control.js";
if (!Math) {
  _easycom_uni_segmented_control();
}
const _sfc_main = {
  __name: "mycard",
  setup(__props) {
    const vTypeImg = common_vendor.ref("/static/v1.png");
    const items = common_vendor.ref(["消费记录", "充值记录"]);
    const current = common_vendor.ref(0);
    const card = common_vendor.ref({});
    const list1 = common_vendor.ref([]);
    const list2 = common_vendor.ref([]);
    common_vendor.index.getStorageSync("currUser");
    common_vendor.onLoad(() => {
      common_api.getOwnMemberInfo().then((res) => {
        card.value = res.data;
        getxfList();
      });
    });
    common_vendor.onPullDownRefresh(() => {
      common_api.getOwnMemberInfo().then((res) => {
        card.value = res.data;
        getxfList();
      });
    });
    function onClickItem(e) {
      console.log(e);
      if (e.currentIndex === 0) {
        getxfList();
      } else if (e.currentIndex === 1) {
        getxzList();
      }
      if (current.value !== e.currentIndex) {
        current.value = e.currentIndex;
      }
    }
    function getxfList() {
      if (card.value.isVip) {
        common_api.xfList({
          memberId: card.value.info.id
        }).then((res) => {
          list1.value = res.rows;
        });
      }
    }
    function getxzList() {
      if (card.value.isVip) {
        common_api.czList({
          memberId: card.value.info.id
        }).then((res) => {
          list2.value = res.rows;
        });
      }
    }
    function goRenew() {
      let path = "/pages/usercenter/mycard/renew";
      common_vendor.index.navigateTo({
        url: path
      });
    }
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: card.value.isVip
      }, card.value.isVip ? {
        b: vTypeImg.value,
        c: common_vendor.t(card.value.info.cardTypeStr),
        d: common_vendor.t(card.value.info.cardCode),
        e: common_vendor.t(card.value.info.balance),
        f: common_vendor.t((100 - card.value.info.discountPercent) / 10),
        g: common_vendor.t(card.value.info.expirationTime),
        h: common_vendor.o(goRenew)
      } : {}, {
        i: common_vendor.o(onClickItem),
        j: common_vendor.p({
          current: current.value,
          values: items.value,
          ["style-type"]: "text",
          ["active-color"]: "#16C682"
        }),
        k: current.value === 0
      }, current.value === 0 ? common_vendor.e({
        l: common_vendor.f(list1.value, (item, index, i0) => {
          var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
          return common_vendor.e({
            a: common_vendor.t(item.dataId),
            b: common_vendor.t(item.consumeTypeStr),
            c: (_a = item.siteOrder) == null ? void 0 : _a.payTime
          }, ((_b = item.siteOrder) == null ? void 0 : _b.payTime) ? {
            d: common_vendor.t(item.siteOrder.payTime)
          } : ((_c = item.cptSignOrder) == null ? void 0 : _c.payTime) ? {
            f: common_vendor.t((_d = item.cptSignOrder) == null ? void 0 : _d.payTime)
          } : {
            g: common_vendor.t(item.orderTime)
          }, {
            e: (_e = item.cptSignOrder) == null ? void 0 : _e.payTime,
            h: (_f = item.siteOrder) == null ? void 0 : _f.verificationCode
          }, ((_g = item.siteOrder) == null ? void 0 : _g.verificationCode) ? {
            i: common_vendor.t(item.siteOrder.verificationCode)
          } : {}, {
            j: item.siteOrder
          }, item.siteOrder ? {
            k: common_vendor.t(item.siteOrder.siteName)
          } : {}, {
            l: common_vendor.t(item.dataValue),
            m: (_h = item.siteOrder) == null ? void 0 : _h.refundAmount
          }, ((_i = item.siteOrder) == null ? void 0 : _i.refundAmount) ? {
            n: common_vendor.t(item.siteOrder.refundAmount)
          } : {}, {
            o: ((_j = item.cptSignOrder) == null ? void 0 : _j.payStatus) == "5"
          }, ((_k = item.cptSignOrder) == null ? void 0 : _k.payStatus) == "5" ? {
            p: common_vendor.t(item.cptSignOrder.organizerRefundAmount)
          } : {}, {
            q: index
          });
        }),
        m: list1.value.length == 0
      }, list1.value.length == 0 ? {} : {}) : {}, {
        n: current.value === 1
      }, current.value === 1 ? common_vendor.e({
        o: common_vendor.f(list2.value, (item, index, i0) => {
          return common_vendor.e({
            a: common_vendor.t(item.orderCode),
            b: item.payTime
          }, item.payTime ? {
            c: common_vendor.t(item.payTime)
          } : {}, {
            d: common_vendor.t(item.payTypeStr),
            e: common_vendor.t(item.orderValue),
            f: index
          });
        }),
        p: list2.value.length == 0
      }, list2.value.length == 0 ? {} : {}) : {});
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-408578a3"], ["__file", "/Users/yangyang/project/j-mini/Venue/pages/usercenter/mycard/mycard.vue"]]);
wx.createPage(MiniProgramPage);