var t = getApp(), a = t.request, o = t.globalData.setting, os = o, i = require("../../../../utils/util.js"), ut = i, s = require("../../../../utils/common.js"); var regeneratorRuntime = require('../../../../utils/runtime.js'); Page({ data: { iurl: o.imghost, showModal: false, //弹框控制器 perpaid: [], //数据 }, /* 生命周期函数--监听页面初次渲染完成*/ onReady: function() { this.yuck(); }, /*预存款的劵*/ async yuck() { var user_id = getApp().globalData.user_id; var store_id = os.stoid; console.log(user_id, "有进来吗银行卡", store_id ); var e = this, perpaid = ""; await getApp().request.promiseGet("/api/weshop/users/listYucun", { data: { user_id: user_id, store_id: store_id } }).then(res => { // console.log(res.data.data[0].BeginDate) var perpaids = res.data.data; // var perpaid = res.data.data; console.log( "是什么", perpaids); e.setData({ perpaid: perpaids }); }) }, //立即充值获取参数到弹框 submit: function(e) { var money = e.target.dataset.name; var s = e.target.dataset.money; var advancek = e.target.dataset.advance; console.log("sss", e.target.dataset.name); this.setData({ showModal: true }) console.log("立即充值", s, "ss", o); this.setData({ BeginSum: money, NewSum: s, adv: advancek }) }, //弹窗的方法 preventTouchMove: function() { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { wx.setNavigationBarTitle({ title: "流动资金转预存", }) }, //确定充值 determine: function(e) { this.setData({ showModal: false }) console.log("aaa"); var moneyone = e.target.dataset.moneyone; var money = e.target.dataset.money; var advancek = e.target.dataset.adv; console.log(moneyone, "aaa", money); this.recharge(money, advancek); }, //确定接口 async recharge(money, advancek) { console.log(money, "有进来吗银行卡", advancek); var user_id = getApp().globalData.user_id; var store_id = os.stoid; var recharge_type = 0; var buynum = 1; console.log(money, "有进来吗预存劵", advancek, user_id, store_id ); var e = this, perpaid = ""; await getApp().request.promiseGet("/api/weshop/users/getPay", { data: { account: money, yucun_id: advancek, user_id: user_id, store_id: store_id, recharge_type: recharge_type, buynum: buynum , } }).then(res => { console.log(res); var msg = res.data.data; var parentSn = msg.order_sn; var store_id = os.stoid; getApp().request.post("/api/weshop/order/pay/createRechargeOrder", { data: { parentSn: parentSn, store_id: store_id }, success: function (su) { console.log("su是什么",su); var n=su.data.data; console.log("su是什么", su); e.weixinPay(n, function () { e.jumpPaymentPage(); }, function () { getApp().showWarning("支付失败"); }) } }) }) }, //------支付成功页面-------- jumpPaymentPage: function () { wx.redirectTo({ url:"msg/msg", }); }, //------调起支付框-------- weixinPay: function (n, success, fail) { wx.requestPayment({ timeStamp: String(n.timeStamp), nonceStr: n.nonceStr, package: n.packageValue, signType: n.signType, paySign: n.paySign, success: function (n) { console.log(n), getApp().showSuccess("支付成功!"); "function" == typeof success && success(); wx.redirectTo({ url: "../deposit/deposit" }); }, fail: function (n) { console.log(n), "requestPayment:fail" == n.errMsg ? getApp().showWarning("支付失败") : "requestPayment:fail cancel" == n.errMsg ? getApp().showWarning("您已取消支付") : getApp().showWarning("支付失败:" + n.errMsg.substr("requestPayment:fail ".length)), "function" == typeof fail && fail(); } }); }, //关闭弹框 shut: function () { this.setData({ showModal: false }) console.log("bb"); } })