2024-09-19 07:20:14 +08:00
|
|
|
"use strict";
|
|
|
|
var __async = (__this, __arguments, generator) => {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
var fulfilled = (value) => {
|
|
|
|
try {
|
|
|
|
step(generator.next(value));
|
|
|
|
} catch (e) {
|
|
|
|
reject(e);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var rejected = (value) => {
|
|
|
|
try {
|
|
|
|
step(generator.throw(value));
|
|
|
|
} catch (e) {
|
|
|
|
reject(e);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
|
|
step((generator = generator.apply(__this, __arguments)).next());
|
|
|
|
});
|
|
|
|
};
|
|
|
|
const common_vendor = require("../../../common/vendor.js");
|
2024-10-01 09:15:35 +08:00
|
|
|
const modules_mall_sheep_index = require("../sheep/index.js");
|
|
|
|
const modules_mall_sheep_hooks_useGoods = require("../sheep/hooks/useGoods.js");
|
|
|
|
const modules_mall_sheep_api_pay_wallet = require("../sheep/api/pay/wallet.js");
|
|
|
|
const modules_mall_sheep_util_const = require("../sheep/util/const.js");
|
2024-09-19 07:20:14 +08:00
|
|
|
if (!Array) {
|
|
|
|
const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput");
|
|
|
|
const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
|
|
|
|
const _component_layout_default_uni = common_vendor.resolveComponent("layout-default-uni");
|
|
|
|
(_easycom_uni_easyinput2 + _easycom_s_layout2 + _component_layout_default_uni)();
|
|
|
|
}
|
|
|
|
const _easycom_uni_easyinput = () => "../../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js";
|
2024-10-01 09:15:35 +08:00
|
|
|
const _easycom_s_layout = () => "../sheep/components/s-layout/s-layout.js";
|
2024-09-19 07:20:14 +08:00
|
|
|
if (!Math) {
|
|
|
|
(_easycom_uni_easyinput + _easycom_s_layout)();
|
|
|
|
}
|
|
|
|
const _sfc_main = {
|
|
|
|
__name: "recharge",
|
|
|
|
setup(__props) {
|
|
|
|
common_vendor.useCssVars((_ctx) => ({
|
|
|
|
"302fd18e": common_vendor.unref(headerBg)
|
|
|
|
}));
|
2024-10-01 09:15:35 +08:00
|
|
|
const userWallet = common_vendor.computed(() => modules_mall_sheep_index.sheep.$store("user").userWallet);
|
|
|
|
const statusBarHeight = modules_mall_sheep_index.sheep.$platform.device.statusBarHeight * 2;
|
|
|
|
const headerBg = modules_mall_sheep_index.sheep.$url.css("/static/img/shop/user/withdraw_bg.png");
|
2024-09-19 07:20:14 +08:00
|
|
|
const state = common_vendor.reactive({
|
|
|
|
recharge_money: "",
|
|
|
|
// 输入的充值金额
|
|
|
|
packageList: []
|
|
|
|
});
|
|
|
|
function onCard(e) {
|
2024-10-01 09:15:35 +08:00
|
|
|
state.recharge_money = modules_mall_sheep_hooks_useGoods.fen2yuan(e);
|
2024-09-19 07:20:14 +08:00
|
|
|
}
|
|
|
|
function getRechargeTabs() {
|
|
|
|
return __async(this, null, function* () {
|
2024-10-01 09:15:35 +08:00
|
|
|
const { code, data } = yield modules_mall_sheep_api_pay_wallet.PayWalletApi.getWalletRechargePackageList();
|
2024-09-19 07:20:14 +08:00
|
|
|
if (code !== 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
state.packageList = data;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
function onConfirm() {
|
|
|
|
return __async(this, null, function* () {
|
|
|
|
var _a;
|
2024-10-01 09:15:35 +08:00
|
|
|
const { code, data } = yield modules_mall_sheep_api_pay_wallet.PayWalletApi.createWalletRecharge({
|
|
|
|
packageId: (_a = state.packageList.find((item) => modules_mall_sheep_hooks_useGoods.fen2yuan(item.payPrice) === state.recharge_money)) == null ? void 0 : _a.id,
|
2024-09-19 07:20:14 +08:00
|
|
|
payPrice: state.recharge_money * 100
|
|
|
|
});
|
|
|
|
if (code !== 0) {
|
|
|
|
return;
|
|
|
|
}
|
2024-10-01 09:15:35 +08:00
|
|
|
modules_mall_sheep_index.sheep.$platform.useProvider("wechat").subscribeMessage(modules_mall_sheep_util_const.WxaSubscribeTemplate.PAY_WALLET_RECHARGER_SUCCESS);
|
|
|
|
modules_mall_sheep_index.sheep.$router.go("/modules/mall/pay/index", {
|
2024-09-19 07:20:14 +08:00
|
|
|
id: data.payOrderId,
|
|
|
|
orderType: "recharge"
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
common_vendor.onLoad(() => {
|
|
|
|
getRechargeTabs();
|
|
|
|
});
|
|
|
|
return (_ctx, _cache) => {
|
|
|
|
return {
|
2024-10-01 09:15:35 +08:00
|
|
|
a: common_vendor.t(common_vendor.unref(modules_mall_sheep_hooks_useGoods.fen2yuan)(userWallet.value.balance)),
|
|
|
|
b: common_vendor.o(($event) => common_vendor.unref(modules_mall_sheep_index.sheep).$router.go("/modules/mall/pay/recharge-log")),
|
2024-09-19 07:20:14 +08:00
|
|
|
c: common_vendor.s({
|
|
|
|
marginTop: "-" + Number(statusBarHeight + 88) + "rpx",
|
|
|
|
paddingTop: Number(statusBarHeight + 108) + "rpx"
|
|
|
|
}),
|
|
|
|
d: common_vendor.o(($event) => state.recharge_money = $event),
|
|
|
|
e: common_vendor.p({
|
|
|
|
type: "digit",
|
|
|
|
placeholder: "请输入充值金额",
|
|
|
|
inputBorder: false,
|
|
|
|
modelValue: state.recharge_money
|
|
|
|
}),
|
|
|
|
f: common_vendor.f(state.packageList, (item, k0, i0) => {
|
|
|
|
return common_vendor.e({
|
2024-10-01 09:15:35 +08:00
|
|
|
a: common_vendor.t(common_vendor.unref(modules_mall_sheep_hooks_useGoods.fen2yuan)(item.payPrice)),
|
2024-09-19 07:20:14 +08:00
|
|
|
b: item.bonusPrice
|
|
|
|
}, item.bonusPrice ? {
|
2024-10-01 09:15:35 +08:00
|
|
|
c: common_vendor.t(common_vendor.unref(modules_mall_sheep_hooks_useGoods.fen2yuan)(item.bonusPrice))
|
2024-09-19 07:20:14 +08:00
|
|
|
} : {}, {
|
|
|
|
d: item.money,
|
|
|
|
e: common_vendor.n({
|
2024-10-01 09:15:35 +08:00
|
|
|
"btn-active": state.recharge_money === common_vendor.unref(modules_mall_sheep_hooks_useGoods.fen2yuan)(item.payPrice)
|
2024-09-19 07:20:14 +08:00
|
|
|
}),
|
|
|
|
f: common_vendor.o(($event) => onCard(item.payPrice), item.money)
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
g: common_vendor.o(onConfirm),
|
|
|
|
h: common_vendor.p({
|
|
|
|
title: "充值",
|
|
|
|
navbar: "inner"
|
|
|
|
}),
|
|
|
|
i: common_vendor.s(_ctx.__cssVars())
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-b11fb6c1"]]);
|
|
|
|
wx.createPage(MiniProgramPage);
|