| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const utils_auth = require("../../utils/auth.js");
- const utils_api = require("../../utils/api.js");
- const _sfc_main = {
- __name: "transaction",
- setup(__props) {
- const subscriptions = common_vendor.ref([]);
- const loading = common_vendor.ref(false);
- const isLoggedIn = common_vendor.ref(false);
- const checkLogin = () => {
- isLoggedIn.value = utils_auth.isLoggedIn();
- };
- const handleBack = () => {
- const pages = getCurrentPages();
- pages.length > 1 ? common_vendor.index.navigateBack() : common_vendor.index.switchTab({ url: "/pages/mine/mine" });
- };
- const loadSubscriptions = async () => {
- if (!isLoggedIn.value)
- return;
- loading.value = true;
- try {
- const res = await utils_api.getUserSubscriptions();
- if (res.code === 200) {
- subscriptions.value = res.data || [];
- }
- } catch (e) {
- console.error("加载订阅记录失败:", e);
- } finally {
- loading.value = false;
- }
- };
- common_vendor.onLoad(() => checkLogin());
- common_vendor.onMounted(() => {
- if (isLoggedIn.value)
- loadSubscriptions();
- });
- common_vendor.onShow(() => {
- checkLogin();
- if (isLoggedIn.value)
- loadSubscriptions();
- });
- return (_ctx, _cache) => {
- return common_vendor.e({
- a: common_vendor.o(handleBack),
- b: loading.value
- }, loading.value ? {} : subscriptions.value.length === 0 ? {} : {
- d: common_vendor.f(subscriptions.value, (item, index, i0) => {
- return common_vendor.e({
- a: common_vendor.t(item.poolType === 1 ? "⚡" : "📈"),
- b: common_vendor.t(item.poolName),
- c: common_vendor.t(item.isActive ? "生效中" : "已过期"),
- d: common_vendor.n(item.isActive ? "active" : "expired"),
- e: common_vendor.t(item.amount),
- f: common_vendor.t(item.startTime),
- g: common_vendor.t(item.expireTime),
- h: item.isActive
- }, item.isActive ? {
- i: common_vendor.t(item.remainDays)
- } : {}, {
- j: index
- });
- })
- }, {
- c: subscriptions.value.length === 0
- });
- };
- }
- };
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-a901d1cb"], ["__file", "D:/program/gupiao-wx/src/pages/transaction/transaction.vue"]]);
- wx.createPage(MiniProgramPage);
|