Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
meihua-island-book
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2023-12-29 16:14:31 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
95a567704d3c84aa280b524adf5b9df95b6fcf82
95a56770
1 parent
3d534c47
支付接口联调
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
63 deletions
src/components/payCard.vue
src/components/payCard.vue
View file @
95a5677
<!--
* @Date: 2023-12-20 14:11:11
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-12-2
8 13:40:59
* @LastEditTime: 2023-12-2
9 16:14:15
* @FilePath: /meihuaApp/src/components/payCard.vue
* @Description: 文件描述
-->
...
...
@@ -98,68 +98,44 @@ onUnmounted(() => {
})
const goToPay = async () => {
// TODO:模拟代码
emit('close'); // 关闭支付弹框
//
Taro.showToast({
title: '支付成功',
icon: 'success',
duration: 1000
});
setTimeout(() => {
let current_page = getCurrentPageUrl();
if (current_page === 'pages/my/index') { // 我的页面打开
// 刷新当前页面
Taro.reLaunch({
url: '/pages/my/index?tab_index=5'
});
}
if (current_page === 'pages/detail/index') { // 订房确认页打开
// 跳转订单成功页
Taro.navigateTo({
url: '/pages/payInfo/index',
});
}
}, 1000);
// TODO:实际操作代码等待接口放上去
// // 获取支付参数
// const pay = await payAPI({ order_id: id.value });
// if (pay.code) {
// let pay = pay.data.payargs;
// // 触发微信支付操作
// wx.requestPayment({
// timeStamp: pay.timeStamp,
// nonceStr: pay.nonceStr,
// package: pay.package,
// signType: pay.signType,
// paySign: pay.paySign,
// success: async (result) => {
// emit('close'); // 关闭支付弹框
// Taro.showToast({
// title: '支付成功',
// icon: 'success',
// duration: 1000
// });
// // 支付成功后,调用检查接口
// const pay_success = await payCheckAPI({ order_id: id.value });
// if (pay_success.code) {
// let current_page = getCurrentPageUrl();
// if (current_page === 'pages/my/index') { // 我的页面打开
// // 刷新当前页面
// Taro.reLaunch({
// url: '/pages/my/index?tab_index=5'
// });
// }
// if (current_page === 'pages/detail/index') { // 订房确认页打开
// // 跳转订单成功页
// Taro.navigateTo({
// url: '/pages/payInfo/index',
// });
// }
// }
// }
// });
// }
// 获取支付参数
const { code, data } = await payAPI({ order_id: id.value });
if (code) {
let pay = data;
// 触发微信支付操作
wx.requestPayment({
timeStamp: pay.timeStamp,
nonceStr: pay.nonceStr,
package: pay.package,
signType: pay.signType,
paySign: pay.paySign,
success: async (result) => {
emit('close'); // 关闭支付弹框
Taro.showToast({
title: '支付成功',
icon: 'success',
duration: 1000
});
// 支付成功后,调用检查接口
const pay_success = await payCheckAPI({ order_id: id.value });
if (pay_success.code) {
let current_page = getCurrentPageUrl();
if (current_page === 'pages/my/index') { // 我的页面打开
// 刷新当前页面
Taro.reLaunch({
url: '/pages/my/index?tab_index=5'
});
}
if (current_page === 'pages/detail/index') { // 订房确认页打开
// 跳转订单成功页
Taro.navigateTo({
url: '/pages/payInfo/index',
});
}
}
}
});
}
}
</script>
...
...
Please
register
or
login
to post a comment