|
@@ -215,9 +215,9 @@ const handleScanInput = (event: KeyboardEvent) => {
|
|
|
orderPay({ oid: currentDesk.oid, code: code })
|
|
|
.then((res) => {
|
|
|
console.log(res)
|
|
|
- if (res.data) {
|
|
|
+ if (res != null) {
|
|
|
console.log('支付中')
|
|
|
- return queryPayStatusWithRetry(res.data)
|
|
|
+ return queryPayStatusWithRetry(res)
|
|
|
.then((paySuccess) => {
|
|
|
if (paySuccess) {
|
|
|
feedback.notifySuccess('成功结账' + currentDesk.amount + '元')
|
|
@@ -251,7 +251,7 @@ const handleScanInput = (event: KeyboardEvent) => {
|
|
|
}
|
|
|
|
|
|
// 定义查询支付状态的函数
|
|
|
-const queryPayStatusWithRetry = (sn: string): Promise<boolean> => {
|
|
|
+const queryPayStatusWithRetry = (data): Promise<boolean> => {
|
|
|
const intervals = [3000, 5000, 10000]
|
|
|
let currentIndex = 0
|
|
|
payingDialogVisible.value = true
|
|
@@ -259,9 +259,9 @@ const queryPayStatusWithRetry = (sn: string): Promise<boolean> => {
|
|
|
const tryQuery = () => {
|
|
|
return new Promise<boolean>((resolve) => {
|
|
|
setTimeout(() => {
|
|
|
- queryPayStatus({ sn })
|
|
|
+ queryPayStatus({ orderId: data.orderId,sn: data.sn })
|
|
|
.then((result) => {
|
|
|
- if (result.success) {
|
|
|
+ if (result.result_code == '200' && result.biz_response.data.order_status == 'SUCCESS') {
|
|
|
resolve(true)
|
|
|
} else if (currentIndex < intervals.length - 1) {
|
|
|
currentIndex++
|
|
@@ -285,9 +285,9 @@ const queryPayStatusWithRetry = (sn: string): Promise<boolean> => {
|
|
|
return tryQuery().then((success) => {
|
|
|
payingDialogVisible.value = false
|
|
|
if (!success) {
|
|
|
- return cancelOrder({ sn })
|
|
|
+ return cancelOrder({ orderId: data.orderId,sn: data.sn })
|
|
|
.then(() => {
|
|
|
- feedback.notifyWarning('支付超时,订单已自动撤销')
|
|
|
+ feedback.notifyWarning('支付超时,已自动撤销本次支付')
|
|
|
return false
|
|
|
})
|
|
|
.catch((error) => {
|