78 lines
1.6 KiB
JavaScript
78 lines
1.6 KiB
JavaScript
// packageH/credit_value/recharge/recharge.js
|
|
var yz_pay = require("../../../mycomponent/yz_pay/yz_pay");
|
|
import DHttp from "../DHttp";
|
|
Page({
|
|
behaviors: [yz_pay],
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
payMethods: [],
|
|
rechargeCount: 0,
|
|
payFeeAliPayOrderSN: "",
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
DHttp.request(
|
|
"plugin.credit-inventory.frontend.controllers.recharge.index"
|
|
).then(({ buttons }) => {
|
|
for (const methodItem of buttons) {
|
|
methodItem["_iconClassName"] = this.btnclass(
|
|
methodItem["value"]
|
|
);
|
|
}
|
|
this.setData({
|
|
payMethods: buttons,
|
|
});
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {},
|
|
inputRechargeCount({ detail: { value } }) {
|
|
this.setData({
|
|
rechargeCount: value,
|
|
});
|
|
},
|
|
payFee({
|
|
currentTarget: {
|
|
dataset: { type },
|
|
},
|
|
}) {
|
|
DHttp.request(
|
|
"plugin.credit-inventory.frontend.controllers.recharge.handle",
|
|
{
|
|
pay_way: type,
|
|
recharge_money: this.data.rechargeCount,
|
|
client_type: 2,
|
|
}
|
|
)
|
|
.then(({ config, js, order_sn, uid }) => {
|
|
if (!order_sn) {
|
|
wx.showToast({
|
|
icon: "none",
|
|
title: "参数错误",
|
|
duration: 1500,
|
|
});
|
|
}
|
|
this.rechargePay(type, config, order_sn, 'credit');
|
|
})
|
|
.catch(({ msg }) => {
|
|
wx.showToast({
|
|
title: msg,
|
|
icon: "none",
|
|
});
|
|
});
|
|
},
|
|
});
|