111 lines
3.1 KiB
JavaScript
111 lines
3.1 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const _sfc_main = {
|
|
data() {
|
|
var goodsList = [1, 2, 3, 4, 5, 6];
|
|
return {
|
|
systemBarHeight: 0,
|
|
goodsList,
|
|
currentIndex: 0,
|
|
currentVIPIndex: 0,
|
|
isVIP: false,
|
|
isWX: true,
|
|
price: "",
|
|
isAgreement: true
|
|
};
|
|
},
|
|
onLoad() {
|
|
this.getStatusBarHeight();
|
|
},
|
|
methods: {
|
|
// 获取状态栏高度的方法
|
|
getStatusBarHeight: function() {
|
|
var that = this;
|
|
common_vendor.index.getSystemInfo({
|
|
success: function(res) {
|
|
that.systemBarHeight = res.statusBarHeight;
|
|
}
|
|
});
|
|
},
|
|
toBack() {
|
|
common_vendor.index.navigateBack();
|
|
},
|
|
setBg(index) {
|
|
if (this.isVIP) {
|
|
return {
|
|
backgroundImage: null
|
|
};
|
|
}
|
|
if (this.currentIndex == index) {
|
|
return {
|
|
backgroundImage: "url('/static/image/recharge_goods_frame.png')"
|
|
};
|
|
} else {
|
|
return {
|
|
backgroundImage: null
|
|
};
|
|
}
|
|
},
|
|
clickGoods(index, price) {
|
|
this.isVIP = false;
|
|
this.currentIndex = index;
|
|
this.price = price;
|
|
},
|
|
clickVIPGoods(index, price) {
|
|
this.isVIP = true;
|
|
this.currentVIPIndex = index;
|
|
this.price = price;
|
|
},
|
|
setVIPBg(index) {
|
|
if (!this.isVIP) {
|
|
return {
|
|
backgroundImage: null
|
|
};
|
|
}
|
|
if (this.currentVIPIndex == index) {
|
|
return {
|
|
backgroundImage: "url('/static/image/recharge_goods_frame.png')"
|
|
};
|
|
} else {
|
|
return {
|
|
backgroundImage: null
|
|
};
|
|
}
|
|
},
|
|
setPayment(type) {
|
|
this.isWX = type;
|
|
},
|
|
clickAgreement() {
|
|
this.isAgreement = !this.isAgreement;
|
|
}
|
|
}
|
|
};
|
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return {
|
|
a: common_vendor.o(($event) => $options.toBack()),
|
|
b: $data.systemBarHeight + "px",
|
|
c: common_vendor.f($data.goodsList, (item, index, i0) => {
|
|
return {
|
|
a: common_vendor.o(($event) => $options.clickGoods(index, item)),
|
|
b: common_vendor.s($options.setBg(index))
|
|
};
|
|
}),
|
|
d: common_vendor.f($data.goodsList, (item, index, i0) => {
|
|
return {
|
|
a: common_vendor.o(($event) => $options.clickVIPGoods(index, item)),
|
|
b: common_vendor.s($options.setVIPBg(index))
|
|
};
|
|
}),
|
|
e: $data.isWX ? "/static/image/ic_c_s.png" : "/static/image/ic_c.png",
|
|
f: common_vendor.o(($event) => $options.setPayment(true)),
|
|
g: !$data.isWX ? "/static/image/ic_c_s.png" : "/static/image/ic_c.png",
|
|
h: common_vendor.o(($event) => $options.setPayment(false)),
|
|
i: common_vendor.t($data.price),
|
|
j: $data.isAgreement ? "/static/image/ic_c_s.png" : "/static/image/ic_c.png",
|
|
k: common_vendor.o((...args) => $options.clickAgreement && $options.clickAgreement(...args)),
|
|
l: common_vendor.s("paddingTop: " + $data.systemBarHeight + "px;")
|
|
};
|
|
}
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "F:/gitCode/uniapp/magicsound/pages/recharge/RechargePage.vue"]]);
|
|
wx.createPage(MiniProgramPage);
|