|
@@ -11,11 +11,22 @@ const _sfc_main = {
|
|
|
const selectedPlan = common_vendor.ref("daily");
|
|
const selectedPlan = common_vendor.ref("daily");
|
|
|
const selectedDate = common_vendor.ref("2025年11月20日");
|
|
const selectedDate = common_vendor.ref("2025年11月20日");
|
|
|
const isLoggedIn = common_vendor.ref(false);
|
|
const isLoggedIn = common_vendor.ref(false);
|
|
|
|
|
+ const paymentMethod = common_vendor.ref("wechat");
|
|
|
|
|
+ const userPoints = common_vendor.ref(0);
|
|
|
const checkLogin = () => {
|
|
const checkLogin = () => {
|
|
|
isLoggedIn.value = utils_auth.isLoggedIn();
|
|
isLoggedIn.value = utils_auth.isLoggedIn();
|
|
|
console.log("[超短池] 登录状态:", isLoggedIn.value);
|
|
console.log("[超短池] 登录状态:", isLoggedIn.value);
|
|
|
return isLoggedIn.value;
|
|
return isLoggedIn.value;
|
|
|
};
|
|
};
|
|
|
|
|
+ const getUserPoints = () => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const points = common_vendor.index.getStorageSync("user_points") || 0;
|
|
|
|
|
+ userPoints.value = points;
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ console.error("获取积分失败:", e);
|
|
|
|
|
+ userPoints.value = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
const checkPurchaseStatus = () => {
|
|
const checkPurchaseStatus = () => {
|
|
|
try {
|
|
try {
|
|
|
const purchaseInfo = common_vendor.index.getStorageSync("pool_purchase");
|
|
const purchaseInfo = common_vendor.index.getStorageSync("pool_purchase");
|
|
@@ -56,6 +67,7 @@ const _sfc_main = {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
console.log("已登录,显示购买弹窗");
|
|
console.log("已登录,显示购买弹窗");
|
|
|
|
|
+ getUserPoints();
|
|
|
showModal.value = true;
|
|
showModal.value = true;
|
|
|
};
|
|
};
|
|
|
const closePurchaseModal = () => {
|
|
const closePurchaseModal = () => {
|
|
@@ -69,6 +81,19 @@ const _sfc_main = {
|
|
|
});
|
|
});
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
+ if (paymentMethod.value === "points") {
|
|
|
|
|
+ const requiredPoints = selectedPlan.value === "daily" ? 180 : 980;
|
|
|
|
|
+ if (userPoints.value < requiredPoints) {
|
|
|
|
|
+ common_vendor.index.showToast({
|
|
|
|
|
+ title: "积分不足,请充值或选择微信支付",
|
|
|
|
|
+ icon: "none"
|
|
|
|
|
+ });
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ const newPoints = userPoints.value - requiredPoints;
|
|
|
|
|
+ common_vendor.index.setStorageSync("user_points", newPoints);
|
|
|
|
|
+ userPoints.value = newPoints;
|
|
|
|
|
+ }
|
|
|
const now = Date.now();
|
|
const now = Date.now();
|
|
|
let expireTime = now;
|
|
let expireTime = now;
|
|
|
if (selectedPlan.value === "daily") {
|
|
if (selectedPlan.value === "daily") {
|
|
@@ -81,13 +106,14 @@ const _sfc_main = {
|
|
|
const purchaseInfo = {
|
|
const purchaseInfo = {
|
|
|
plan: selectedPlan.value,
|
|
plan: selectedPlan.value,
|
|
|
purchaseTime: now,
|
|
purchaseTime: now,
|
|
|
- expireTime
|
|
|
|
|
|
|
+ expireTime,
|
|
|
|
|
+ paymentMethod: paymentMethod.value
|
|
|
};
|
|
};
|
|
|
common_vendor.index.setStorageSync("pool_purchase", purchaseInfo);
|
|
common_vendor.index.setStorageSync("pool_purchase", purchaseInfo);
|
|
|
isPurchased.value = true;
|
|
isPurchased.value = true;
|
|
|
closePurchaseModal();
|
|
closePurchaseModal();
|
|
|
common_vendor.index.showToast({
|
|
common_vendor.index.showToast({
|
|
|
- title: "解锁成功",
|
|
|
|
|
|
|
+ title: paymentMethod.value === "points" ? "积分支付成功" : "解锁成功",
|
|
|
icon: "success"
|
|
icon: "success"
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
@@ -100,10 +126,12 @@ const _sfc_main = {
|
|
|
common_vendor.onLoad(() => {
|
|
common_vendor.onLoad(() => {
|
|
|
checkLogin();
|
|
checkLogin();
|
|
|
checkPurchaseStatus();
|
|
checkPurchaseStatus();
|
|
|
|
|
+ getUserPoints();
|
|
|
});
|
|
});
|
|
|
common_vendor.onShow(() => {
|
|
common_vendor.onShow(() => {
|
|
|
checkLogin();
|
|
checkLogin();
|
|
|
checkPurchaseStatus();
|
|
checkPurchaseStatus();
|
|
|
|
|
+ getUserPoints();
|
|
|
});
|
|
});
|
|
|
return (_ctx, _cache) => {
|
|
return (_ctx, _cache) => {
|
|
|
return common_vendor.e({
|
|
return common_vendor.e({
|
|
@@ -122,17 +150,29 @@ const _sfc_main = {
|
|
|
i: common_vendor.o((...args) => _ctx.closePhoneAuth && _ctx.closePhoneAuth(...args))
|
|
i: common_vendor.o((...args) => _ctx.closePhoneAuth && _ctx.closePhoneAuth(...args))
|
|
|
} : {}, {
|
|
} : {}, {
|
|
|
j: showModal.value
|
|
j: showModal.value
|
|
|
- }, showModal.value ? {
|
|
|
|
|
|
|
+ }, showModal.value ? common_vendor.e({
|
|
|
k: common_vendor.o(closePurchaseModal),
|
|
k: common_vendor.o(closePurchaseModal),
|
|
|
l: selectedPlan.value === "daily" ? 1 : "",
|
|
l: selectedPlan.value === "daily" ? 1 : "",
|
|
|
m: common_vendor.o(($event) => selectedPlan.value = "daily"),
|
|
m: common_vendor.o(($event) => selectedPlan.value = "daily"),
|
|
|
n: selectedPlan.value === "weekly" ? 1 : "",
|
|
n: selectedPlan.value === "weekly" ? 1 : "",
|
|
|
o: common_vendor.o(($event) => selectedPlan.value = "weekly"),
|
|
o: common_vendor.o(($event) => selectedPlan.value = "weekly"),
|
|
|
- p: common_vendor.o(handlePurchase),
|
|
|
|
|
- q: common_vendor.o(() => {
|
|
|
|
|
|
|
+ p: paymentMethod.value === "wechat"
|
|
|
|
|
+ }, paymentMethod.value === "wechat" ? {} : {}, {
|
|
|
|
|
+ q: paymentMethod.value === "wechat" ? 1 : "",
|
|
|
|
|
+ r: common_vendor.o(($event) => paymentMethod.value = "wechat"),
|
|
|
|
|
+ s: common_vendor.t(userPoints.value),
|
|
|
|
|
+ t: common_vendor.t(selectedPlan.value === "daily" ? 180 : 980),
|
|
|
|
|
+ v: paymentMethod.value === "points"
|
|
|
|
|
+ }, paymentMethod.value === "points" ? {} : {}, {
|
|
|
|
|
+ w: paymentMethod.value === "points" ? 1 : "",
|
|
|
|
|
+ x: common_vendor.o(($event) => paymentMethod.value = "points"),
|
|
|
|
|
+ y: common_vendor.t(paymentMethod.value === "points" ? "确认积分支付" : "确认支付并解锁"),
|
|
|
|
|
+ z: paymentMethod.value === "points" ? 1 : "",
|
|
|
|
|
+ A: common_vendor.o(handlePurchase),
|
|
|
|
|
+ B: common_vendor.o(() => {
|
|
|
}),
|
|
}),
|
|
|
- r: common_vendor.o(closePurchaseModal)
|
|
|
|
|
- } : {});
|
|
|
|
|
|
|
+ C: common_vendor.o(closePurchaseModal)
|
|
|
|
|
+ }) : {});
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|