| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const utils_auth = require("../../utils/auth.js");
- require("../../utils/api.js");
- const _sfc_main = {
- __name: "transaction",
- setup(__props) {
- const subscriptions = common_vendor.ref([]);
- 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 formatDateTime = (timestamp) => {
- const date = new Date(timestamp);
- const year = date.getFullYear();
- const month = String(date.getMonth() + 1).padStart(2, "0");
- const day = String(date.getDate()).padStart(2, "0");
- const hours = String(date.getHours()).padStart(2, "0");
- const minutes = String(date.getMinutes()).padStart(2, "0");
- return `${year}-${month}-${day} ${hours}:${minutes}`;
- };
- const loadSubscriptions = () => {
- try {
- const now = Date.now();
- const allSubscriptions = [];
- const poolPurchase = common_vendor.index.getStorageSync("pool_purchase");
- if (poolPurchase) {
- allSubscriptions.push({
- poolType: "pool",
- poolName: "超短精选池",
- planName: poolPurchase.plan === "daily" ? "日订阅" : "周套餐",
- amount: poolPurchase.plan === "daily" ? "18" : "98",
- purchaseTime: poolPurchase.purchaseTime,
- expireTime: poolPurchase.expireTime,
- isActive: now < poolPurchase.expireTime
- });
- }
- const strongPurchase = common_vendor.index.getStorageSync("strong_pool_purchase");
- if (strongPurchase) {
- allSubscriptions.push({
- poolType: "strong",
- poolName: "强势趋势池",
- planName: "年订阅",
- amount: "98",
- purchaseTime: strongPurchase.purchaseTime,
- expireTime: strongPurchase.expireTime,
- isActive: now < strongPurchase.expireTime
- });
- }
- subscriptions.value = allSubscriptions.sort((a, b) => b.purchaseTime - a.purchaseTime);
- } catch (e) {
- console.error("加载订阅记录失败:", e);
- subscriptions.value = [];
- }
- };
- common_vendor.onLoad(() => checkLogin());
- common_vendor.onMounted(() => loadSubscriptions());
- common_vendor.onShow(() => {
- checkLogin();
- loadSubscriptions();
- });
- return (_ctx, _cache) => {
- return common_vendor.e({
- a: common_vendor.o(handleBack),
- b: common_vendor.t(subscriptions.value.length),
- c: subscriptions.value.length === 0
- }, subscriptions.value.length === 0 ? {} : {
- d: common_vendor.f(subscriptions.value, (item, index, i0) => {
- return common_vendor.e({
- a: common_vendor.t(item.poolType === "pool" ? "⚡" : "📈"),
- 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.planName),
- f: common_vendor.t(item.amount),
- g: common_vendor.t(formatDateTime(item.purchaseTime)),
- h: common_vendor.t(formatDateTime(item.expireTime)),
- i: item.isActive
- }, item.isActive ? {} : {}, {
- j: index
- });
- })
- });
- };
- }
- };
- 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);
|