移动端浏览器支付 ok

This commit is contained in:
yml2213
2026-06-13 19:17:02 +08:00
parent 9d7184ecde
commit 6ce031160b
4 changed files with 337 additions and 39 deletions
@@ -23,8 +23,9 @@ import {
OrderResourceUsageEditor,
type HandoffRecord,
type Order,
type PaymentOrder,
} from '@/features/orders'
import MobilePaymentCashierPopup from '@/features/orders/components/MobilePaymentCashierPopup.vue'
import { useMobilePaymentCashier } from '@/features/orders/composables/useMobilePaymentCashier'
import {
amountYuan,
hydrateCounterFormFromCheckout,
@@ -92,6 +93,17 @@ const showCounterPopup = ref(false)
const showRejectPopup = ref(false)
let autoPayHandled = false
const {
paymentPopupVisible,
activePayment,
payURL,
paymentQRCodeURL,
qrGenerating,
checkingPayment,
openMobilePaymentCashier,
refreshPaymentStatus,
} = useMobilePaymentCashier()
const isOwner = computed(() => order.value?.owner_id === session.userId)
const isRenter = computed(() => order.value?.renter_id === session.userId)
const orderAmountLabel = computed(() => (isOwner.value ? '预计租金' : '支付租金'))
@@ -186,7 +198,7 @@ async function handlePay() {
showToast({ message: '支付成功,等待号主交接', icon: 'passed' })
await loadOrder()
} else {
openPaymentCashier(payment)
await openMobilePaymentCashier(payment, loadOrder)
}
} catch (error) {
showToast({ message: readError(error, '支付失败'), icon: 'cross' })
@@ -195,19 +207,6 @@ async function handlePay() {
}
}
function openPaymentCashier(payment: PaymentOrder) {
const payURL = payment.jspay_url || payment.td_code || payment.jspay_info || ''
if (payURL && /^https?:\/\//i.test(payURL)) {
window.location.href = payURL
return
}
showDialog({
title: '订单支付',
message: payURL || '支付单已创建,请稍后刷新订单状态。',
confirmButtonText: '知道了',
})
}
async function handleSubmitHandoff() {
if (!order.value) return
if (!handoffContent.value.trim()) {
@@ -764,6 +763,16 @@ async function copyListingCode() {
<van-empty image="search" description="订单不存在或已被删除" />
</div>
<MobilePaymentCashierPopup
v-model:show="paymentPopupVisible"
:payment="activePayment"
:pay-url="payURL"
:qr-code-url="paymentQRCodeURL"
:qr-generating="qrGenerating"
:checking="checkingPayment"
@refresh="refreshPaymentStatus(false)"
/>
<!-- POPUP: Owner Counter Checkout Adjustments -->
<van-popup v-model:show="showCounterPopup" position="bottom" round class="mobile-popup-form">
<header class="popup-header">