diff --git a/api/pay/pay.js b/api/pay/pay.js new file mode 100644 index 0000000..5479a74 --- /dev/null +++ b/api/pay/pay.js @@ -0,0 +1,12 @@ +import request from '../../utils/request' + +export function refreshPayResult(no) { + return request({ + url: '/app/pay/refreshPayResult', + method: 'PUT', + header: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + data: { no: no }, + }) +} diff --git a/pages/index/index.vue b/pages/index/index.vue index 91f26a0..57e3645 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -65,6 +65,7 @@ import { getPeriodPackagesByDevId, } from '../../api/lease/lease.js' import { getIsRealName } from '../../api' +import { refreshPayResult } from '../../api/pay/pay' export default { components: { @@ -107,6 +108,9 @@ export default { packageLoading: false, selectedPackage: null, renewData: {}, + + //订单id + no: '', } }, @@ -410,8 +414,10 @@ export default { uni.hideLoading() if (response.code === 200) { const data = response.data + this.no = data.pay.no + console.log('data.pay.no:', this.no) const wxpPayParams = data.payParams - console.log(data) + console.log('续费response:', data) const payParams = { package: wxpPayParams.packageVal, // 后端返回的字段名 @@ -424,12 +430,14 @@ export default { wx.requestPayment({ ...payParams, - success: function (res) { + success: async function (res) { uni.showToast({ title: '支付成功', icon: 'success', duration: 3000, }) + await refreshPayResult(this.no) + setTimeout(() => { uni.navigateTo({ url: `/pages/myOrder/orderDetail?id=${data.pay.bstId}`,