微信小程序支付

it2024-11-07  8

小程序微信支付

一、图解二、代码

一、图解

二、代码

requestPayment: function(obj) { const vm = this; console.log(vm.detailData.orderMoney); uni.requestPayment({ 'provider': 'wxpay', 'timeStamp': obj.timestamp, 'nonceStr': obj.nonce_str, 'package': `prepay_id=${obj.prepay_id}`, 'signType': 'MD5', 'paySign': obj.sign, 'success':function(res){ uni.navigateTo({ url: '/pages/order/paySuccess?params=' + vm.detailData.orderMoney }) }, 'fail':function(res){ console.log(111,res); }, 'complete':function(res){ console.log(111,res); } }); }, getDataSource1(id) {  const vm = this; wx.request({ url: `${store.state.httpRequst.url}/wxpay/unified`, method: 'GET', header: { 'token': store.state.token }, data: {id}, success: function(data) { if (data.data.result_code === "FAIL") { uni.showModal({ title: '生成订单失败', content: data.data.err_code_des }); } else { vm.requestPayment(data.data); } } }); },
最新回复(0)