mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-31 08:25:35 +00:00
feat(payment): add mobile Alipay precreate deep link
This commit is contained in:
@@ -7035,6 +7035,38 @@
|
||||
}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label class="input-label">{{
|
||||
t("admin.settings.payment.alipayMobilePrecreateDeepLink")
|
||||
}}</label>
|
||||
<div class="flex items-center gap-2">
|
||||
<button
|
||||
type="button"
|
||||
:class="[
|
||||
'relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2',
|
||||
form.payment_alipay_mobile_precreate_deep_link
|
||||
? 'bg-primary-500'
|
||||
: 'bg-gray-300 dark:bg-dark-600',
|
||||
]"
|
||||
@click="
|
||||
form.payment_alipay_mobile_precreate_deep_link =
|
||||
!form.payment_alipay_mobile_precreate_deep_link
|
||||
"
|
||||
>
|
||||
<span
|
||||
:class="[
|
||||
'pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out',
|
||||
form.payment_alipay_mobile_precreate_deep_link
|
||||
? 'translate-x-5'
|
||||
: 'translate-x-0',
|
||||
]"
|
||||
/>
|
||||
</button>
|
||||
<span class="text-sm text-gray-500 dark:text-gray-400">{{
|
||||
t("admin.settings.payment.alipayMobilePrecreateDeepLinkHint")
|
||||
}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Row 4: Enabled payment types (provider badges like sub2apipay) -->
|
||||
<div>
|
||||
@@ -8425,6 +8457,7 @@ const form = reactive<SettingsForm>({
|
||||
payment_cancel_rate_limit_unit: "day",
|
||||
payment_cancel_rate_limit_window_mode: "rolling",
|
||||
payment_alipay_force_qrcode: false,
|
||||
payment_alipay_mobile_precreate_deep_link: false,
|
||||
table_default_page_size: tablePageSizeDefault,
|
||||
table_page_size_options: [10, 20, 50, 100],
|
||||
custom_menu_items: [] as Array<{
|
||||
@@ -10096,6 +10129,8 @@ async function saveSettings() {
|
||||
payment_cancel_rate_limit_window_mode:
|
||||
form.payment_cancel_rate_limit_window_mode,
|
||||
payment_alipay_force_qrcode: form.payment_alipay_force_qrcode,
|
||||
payment_alipay_mobile_precreate_deep_link:
|
||||
form.payment_alipay_mobile_precreate_deep_link,
|
||||
openai_low_upstream_rate_priority_enabled:
|
||||
form.openai_low_upstream_rate_priority_enabled,
|
||||
openai_oauth_scheduling_rate_multiplier:
|
||||
|
||||
@@ -16,12 +16,16 @@
|
||||
<template v-if="paymentPhase === 'paying'">
|
||||
<PaymentStatusPanel
|
||||
:order-id="paymentState.orderId"
|
||||
:amount="paymentState.amount"
|
||||
:pay-amount="paymentState.payAmount"
|
||||
:qr-code="paymentState.qrCode"
|
||||
:expires-at="paymentState.expiresAt"
|
||||
:payment-type="paymentState.paymentType"
|
||||
:pay-url="paymentState.payUrl"
|
||||
:order-type="paymentState.orderType"
|
||||
:currency="paymentState.currency || selectedCurrency"
|
||||
:out-trade-no="paymentState.outTradeNo"
|
||||
:mobile-alipay-deep-link="paymentState.alipayMobilePrecreateDeepLink"
|
||||
@done="onPaymentDone"
|
||||
@success="onPaymentSuccess"
|
||||
@settled="onPaymentSettled"
|
||||
@@ -360,6 +364,7 @@ function emptyPaymentState(): PaymentRecoverySnapshot {
|
||||
orderType: '',
|
||||
paymentMode: '',
|
||||
resumeToken: '',
|
||||
alipayMobilePrecreateDeepLink: false,
|
||||
createdAt: 0,
|
||||
}
|
||||
}
|
||||
@@ -480,12 +485,14 @@ function onPaymentDone() {
|
||||
}
|
||||
}
|
||||
|
||||
function onPaymentSuccess() {
|
||||
async function onPaymentSuccess() {
|
||||
const completedPayment = { ...paymentState.value }
|
||||
removeRecoverySnapshot()
|
||||
authStore.refreshUser()
|
||||
if (paymentState.value.orderType === 'subscription') {
|
||||
subscriptionStore.fetchActiveSubscriptions(true).catch(() => {})
|
||||
}
|
||||
await redirectToPaymentResult(completedPayment)
|
||||
}
|
||||
|
||||
function onPaymentSettled() {
|
||||
@@ -772,6 +779,7 @@ async function createOrder(orderAmount: number, orderType: OrderType, planId?: n
|
||||
isMobile: isMobileDevice(),
|
||||
isWechatBrowser: typeof window !== 'undefined' && /MicroMessenger/i.test(window.navigator.userAgent),
|
||||
forceQRCode: !!(checkout.value.alipay_force_qrcode && normalizeVisibleMethod(requestType) === 'alipay'),
|
||||
mobilePrecreateDeepLink: checkout.value.alipay_mobile_precreate_deep_link === true,
|
||||
})
|
||||
if (options.openid) {
|
||||
payload.openid = options.openid
|
||||
@@ -820,6 +828,7 @@ async function createOrder(orderAmount: number, orderType: OrderType, planId?: n
|
||||
isMobile: isMobileDevice(),
|
||||
isWechatBrowser: typeof window !== 'undefined' && /MicroMessenger/i.test(window.navigator.userAgent),
|
||||
forceQRCode: !!(checkout.value.alipay_force_qrcode && visibleMethod === 'alipay'),
|
||||
mobilePrecreateDeepLink: checkout.value.alipay_mobile_precreate_deep_link === true,
|
||||
stripePopupUrl: stripeRouteUrl,
|
||||
stripeRouteUrl,
|
||||
airwallexRouteUrl,
|
||||
|
||||
Reference in New Issue
Block a user