Showing
2 changed files
with
30 additions
and
3 deletions
| 1 | /* | 1 | /* |
| 2 | * @Date: 2023-12-22 10:29:37 | 2 | * @Date: 2023-12-22 10:29:37 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2023-12-28 09:55:37 | 4 | + * @LastEditTime: 2024-01-17 15:56:50 |
| 5 | * @FilePath: /meihuaApp/src/api/index.js | 5 | * @FilePath: /meihuaApp/src/api/index.js |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | */ | 7 | */ |
| ... | @@ -20,6 +20,7 @@ const Api = { | ... | @@ -20,6 +20,7 @@ const Api = { |
| 20 | ORDER_CANCEL: '/srv/?a=room_data&t=order_cancel', | 20 | ORDER_CANCEL: '/srv/?a=room_data&t=order_cancel', |
| 21 | PAY: '/srv/?a=pay', | 21 | PAY: '/srv/?a=pay', |
| 22 | PAY_CHECK: '/srv/?a=pay_check', | 22 | PAY_CHECK: '/srv/?a=pay_check', |
| 23 | + ORDER_SUCCESS: '/srv/?a=room_data&t=order_success', | ||
| 23 | } | 24 | } |
| 24 | 25 | ||
| 25 | /** | 26 | /** |
| ... | @@ -118,3 +119,10 @@ export const myOrderAPI = (params) => fn(fetch.get(Api.MY_ORDER, params)); | ... | @@ -118,3 +119,10 @@ export const myOrderAPI = (params) => fn(fetch.get(Api.MY_ORDER, params)); |
| 118 | * @returns | 119 | * @returns |
| 119 | */ | 120 | */ |
| 120 | export const orderCancelAPI = (params) => fn(fetch.post(Api.ORDER_CANCEL, params)); | 121 | export const orderCancelAPI = (params) => fn(fetch.post(Api.ORDER_CANCEL, params)); |
| 122 | + | ||
| 123 | +/** | ||
| 124 | + * @description: 订单成功 | ||
| 125 | + * @param id | ||
| 126 | + * @returns | ||
| 127 | + */ | ||
| 128 | +export const orderSuccessAPI = (params) => fn(fetch.post(Api.ORDER_SUCCESS, params)); | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2023-12-20 14:11:11 | 2 | * @Date: 2023-12-20 14:11:11 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2023-12-29 17:59:42 | 4 | + * @LastEditTime: 2024-01-17 16:00:33 |
| 5 | * @FilePath: /meihuaApp/src/components/payCard.vue | 5 | * @FilePath: /meihuaApp/src/components/payCard.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -22,7 +22,7 @@ | ... | @@ -22,7 +22,7 @@ |
| 22 | import Taro from '@tarojs/taro' | 22 | import Taro from '@tarojs/taro' |
| 23 | import { ref, watch, onMounted, onUnmounted } from 'vue' | 23 | import { ref, watch, onMounted, onUnmounted } from 'vue' |
| 24 | import { getCurrentPageUrl } from "@/utils/weapp"; | 24 | import { getCurrentPageUrl } from "@/utils/weapp"; |
| 25 | -import { payAPI, payCheckAPI } from '@/api/index' | 25 | +import { payAPI, payCheckAPI, orderSuccessAPI } from '@/api/index' |
| 26 | 26 | ||
| 27 | /** | 27 | /** |
| 28 | * 格式化时间 | 28 | * 格式化时间 |
| ... | @@ -90,6 +90,7 @@ onUnmounted(() => { | ... | @@ -90,6 +90,7 @@ onUnmounted(() => { |
| 90 | }) | 90 | }) |
| 91 | 91 | ||
| 92 | const goToPay = async () => { | 92 | const goToPay = async () => { |
| 93 | + if (price.value > 0) { // 金额大于0 | ||
| 93 | // 获取支付参数 | 94 | // 获取支付参数 |
| 94 | const { code, data } = await payAPI({ order_id: id.value }); | 95 | const { code, data } = await payAPI({ order_id: id.value }); |
| 95 | if (code) { | 96 | if (code) { |
| ... | @@ -128,6 +129,24 @@ const goToPay = async () => { | ... | @@ -128,6 +129,24 @@ const goToPay = async () => { |
| 128 | } | 129 | } |
| 129 | }); | 130 | }); |
| 130 | } | 131 | } |
| 132 | + } else { // 金额等于0 | ||
| 133 | + const { code, data } = await orderSuccessAPI({ id: id.value }); | ||
| 134 | + if (code) { | ||
| 135 | + let current_page = getCurrentPageUrl(); | ||
| 136 | + if (current_page === 'pages/my/index' || current_page === 'pages/confirm/index') { // 我的页面打开获取确认订单页价格为零 | ||
| 137 | + // 刷新当前页面 | ||
| 138 | + Taro.reLaunch({ | ||
| 139 | + url: '/pages/my/index?tab_index=5' | ||
| 140 | + }); | ||
| 141 | + } | ||
| 142 | + if (current_page === 'pages/detail/index') { // 订房确认页打开 | ||
| 143 | + // 跳转订单成功页 | ||
| 144 | + Taro.navigateTo({ | ||
| 145 | + url: '/pages/payInfo/index', | ||
| 146 | + }); | ||
| 147 | + } | ||
| 148 | + } | ||
| 149 | + } | ||
| 131 | } | 150 | } |
| 132 | </script> | 151 | </script> |
| 133 | 152 | ... | ... |
-
Please register or login to post a comment