| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const utils_api = require("../../utils/api.js");
- const _sfc_main = {
- data() {
- return {
- selectedPlan: 0,
- vipPlans: [],
- loading: false
- };
- },
- computed: {
- selectedPlanInfo() {
- return this.vipPlans[this.selectedPlan] || {};
- }
- },
- onLoad() {
- this.loadVipPlans();
- },
- methods: {
- async loadVipPlans() {
- this.loading = true;
- try {
- const res = await utils_api.getVipPlans();
- if (res && res.code === 200 && res.data) {
- this.vipPlans = res.data;
- } else {
- this.vipPlans = [
- {
- type: "month",
- name: "月卡VIP",
- price: 30,
- desc: "适合短期阅读",
- benefits: ["无限阅读", "免费听书", "专属客服"]
- },
- {
- type: "quarter",
- name: "季卡VIP",
- price: 80,
- desc: "超值优惠",
- benefits: ["无限阅读", "免费听书", "专属客服", "优先更新"]
- },
- {
- type: "year",
- name: "年卡VIP",
- price: 288,
- desc: "最超值选择",
- benefits: ["无限阅读", "免费听书", "专属客服", "优先更新", "专属活动"]
- }
- ];
- }
- } catch (error) {
- common_vendor.index.__f__("error", "at pages/vip/vip.vue:97", "加载VIP套餐失败:", error);
- this.vipPlans = [
- {
- type: "month",
- name: "月卡VIP",
- price: 30,
- desc: "适合短期阅读",
- benefits: ["无限阅读", "免费听书", "专属客服"]
- },
- {
- type: "quarter",
- name: "季卡VIP",
- price: 80,
- desc: "超值优惠",
- benefits: ["无限阅读", "免费听书", "专属客服", "优先更新"]
- },
- {
- type: "year",
- name: "年卡VIP",
- price: 288,
- desc: "最超值选择",
- benefits: ["无限阅读", "免费听书", "专属客服", "优先更新", "专属活动"]
- }
- ];
- } finally {
- this.loading = false;
- }
- },
- goBack() {
- common_vendor.index.navigateBack();
- },
- selectPlan(index) {
- this.selectedPlan = index;
- },
- goToPayment() {
- if (!this.selectedPlanInfo || !this.selectedPlanInfo.type) {
- common_vendor.index.showToast({
- title: "请选择VIP套餐",
- icon: "none"
- });
- return;
- }
- const plan = this.selectedPlanInfo;
- common_vendor.index.navigateTo({
- url: `/pages/payment/payment?planId=${this.selectedPlan}&planType=${plan.type}&planName=${encodeURIComponent(plan.name)}&price=${plan.price}`
- });
- }
- }
- };
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return {
- a: common_vendor.o((...args) => $options.goBack && $options.goBack(...args)),
- b: common_vendor.f($data.vipPlans, (plan, index, i0) => {
- return {
- a: common_vendor.t(plan.name),
- b: common_vendor.t(plan.price),
- c: common_vendor.t(plan.desc),
- d: common_vendor.f(plan.benefits, (benefit, i, i1) => {
- return {
- a: common_vendor.t(benefit),
- b: i
- };
- }),
- e: index,
- f: $data.selectedPlan === index ? 1 : "",
- g: common_vendor.o(($event) => $options.selectPlan(index), index)
- };
- }),
- c: common_vendor.t($options.selectedPlanInfo.price),
- d: common_vendor.o((...args) => $options.goToPayment && $options.goToPayment(...args))
- };
- }
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-61fb1047"]]);
- wx.createPage(MiniProgramPage);
- //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/vip/vip.js.map
|