130 lines
5.1 KiB
JavaScript
130 lines
5.1 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const api_api = require("../../api/api.js");
|
|
if (!Array) {
|
|
const _easycom_up_input2 = common_vendor.resolveComponent("up-input");
|
|
const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon");
|
|
const _easycom_up_radio2 = common_vendor.resolveComponent("up-radio");
|
|
const _easycom_up_radio_group2 = common_vendor.resolveComponent("up-radio-group");
|
|
const _easycom_up_modal2 = common_vendor.resolveComponent("up-modal");
|
|
(_easycom_up_input2 + _easycom_up_icon2 + _easycom_up_radio2 + _easycom_up_radio_group2 + _easycom_up_modal2)();
|
|
}
|
|
const _easycom_up_input = () => "../../uni_modules/uview-plus/components/u-input/u-input.js";
|
|
const _easycom_up_icon = () => "../../uni_modules/uview-plus/components/u-icon/u-icon.js";
|
|
const _easycom_up_radio = () => "../../uni_modules/uview-plus/components/u-radio/u-radio.js";
|
|
const _easycom_up_radio_group = () => "../../uni_modules/uview-plus/components/u-radio-group/u-radio-group.js";
|
|
const _easycom_up_modal = () => "../../uni_modules/uview-plus/components/u-modal/u-modal.js";
|
|
if (!Math) {
|
|
(_easycom_up_input + _easycom_up_icon + _easycom_up_radio + _easycom_up_radio_group + _easycom_up_modal)();
|
|
}
|
|
const _sfc_main = {
|
|
__name: "topUp",
|
|
setup(__props) {
|
|
let getInfo = common_vendor.ref({});
|
|
let dataForm = common_vendor.reactive({
|
|
plamType: 1
|
|
});
|
|
let appConfig = common_vendor.ref({});
|
|
let paynoticeshow = common_vendor.ref(false);
|
|
common_vendor.onLoad(async () => {
|
|
let _res = await api_api.userInfo();
|
|
getInfo.value = _res;
|
|
const { configValue } = await api_api.getAppConfig({ configKey: "DEPOSIT" });
|
|
appConfig.value = JSON.parse(configValue);
|
|
});
|
|
let naVback = () => {
|
|
common_vendor.index.navigateBack();
|
|
};
|
|
let payOrder = async () => {
|
|
if (appConfig.value.minMoney > dataForm.money)
|
|
return common_vendor.index.showModal({
|
|
title: "提示",
|
|
content: `最低充值${appConfig.value.minMoney}元`,
|
|
showCancel: false
|
|
});
|
|
let _res = await api_api.userRechargeByLkl({ rechargeMoney: dataForm.money });
|
|
const { prepay_id } = _res.data.acc_resp_fields;
|
|
common_vendor.index.requestPayment({
|
|
provider: "alipay",
|
|
orderInfo: prepay_id,
|
|
success: function(res) {
|
|
console.log(res, "支付");
|
|
if (res.resultCode == 9e3) {
|
|
common_vendor.index.showModal({
|
|
title: "提示",
|
|
content: "充值成功",
|
|
showCancel: false,
|
|
success: function(res2) {
|
|
if (res2.confirm) {
|
|
common_vendor.index.navigateBack();
|
|
} else if (res2.cancel) {
|
|
console.log("用户点击取消");
|
|
}
|
|
}
|
|
});
|
|
} else {
|
|
common_vendor.index.showToast({
|
|
title: "支付失败",
|
|
icon: "none",
|
|
duration: 3500
|
|
});
|
|
}
|
|
},
|
|
fail: (err) => {
|
|
this.payState = false;
|
|
common_vendor.index.showToast({
|
|
title: "支付失败",
|
|
icon: "none",
|
|
duration: 3500
|
|
});
|
|
}
|
|
});
|
|
};
|
|
return (_ctx, _cache) => {
|
|
return {
|
|
a: common_vendor.t(common_vendor.unref(getInfo).points2 || "0.00"),
|
|
b: common_vendor.t(common_vendor.unref(appConfig).minMoney),
|
|
c: common_vendor.o(($event) => common_vendor.unref(dataForm).money = $event),
|
|
d: common_vendor.p({
|
|
customStyle: {
|
|
backgroundColor: "#ffffff"
|
|
},
|
|
type: "number",
|
|
placeholder: "请输入充值金额",
|
|
border: "surround",
|
|
modelValue: common_vendor.unref(dataForm).money
|
|
}),
|
|
e: common_vendor.p({
|
|
name: "/static/icon/zfb.png",
|
|
imgMode: "widthFix",
|
|
size: "50rpx"
|
|
}),
|
|
f: common_vendor.p({
|
|
name: 1
|
|
}),
|
|
g: common_vendor.o(($event) => common_vendor.unref(dataForm).plamType = $event),
|
|
h: common_vendor.p({
|
|
iconPlacement: "right",
|
|
borderBottom: true,
|
|
placement: "column",
|
|
modelValue: common_vendor.unref(dataForm).plamType
|
|
}),
|
|
i: common_vendor.o((...args) => common_vendor.unref(payOrder) && common_vendor.unref(payOrder)(...args)),
|
|
j: common_vendor.o(common_vendor.unref(naVback)),
|
|
k: common_vendor.o(($event) => common_vendor.isRef(paynoticeshow) ? paynoticeshow.value = false : paynoticeshow = false),
|
|
l: common_vendor.o(($event) => common_vendor.isRef(paynoticeshow) ? paynoticeshow.value = false : paynoticeshow = false),
|
|
m: common_vendor.p({
|
|
show: common_vendor.unref(paynoticeshow),
|
|
content: "未检测到支付结果",
|
|
showCancelButton: true,
|
|
confirmText: "查看余额",
|
|
cancelText: "取消",
|
|
closeOnClickOverlay: true
|
|
})
|
|
};
|
|
};
|
|
}
|
|
};
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-29ef0b49"]]);
|
|
my.createPage(MiniProgramPage);
|