优化样式
This commit is contained in:
@@ -52,6 +52,7 @@
|
||||
<PaymentMethod
|
||||
:methods="payments"
|
||||
:selectedPlan="selectedPlan"
|
||||
:is-paying="isPaying"
|
||||
@pay="(id: number | string) => $emit('pay', id)"
|
||||
/>
|
||||
</div>
|
||||
@@ -76,6 +77,7 @@ const props = defineProps<{
|
||||
userInfo: { email: string }
|
||||
selectedPlanId: string
|
||||
selectedPlan: any
|
||||
isPaying: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits(['select-plan', 'pay', 'refresh'])
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
<PaymentMethod
|
||||
:methods="payments"
|
||||
:selectedPlan="selectedPlan"
|
||||
:is-paying="isPaying"
|
||||
@pay="(id: number | string) => $emit('pay', id)"
|
||||
/>
|
||||
</div>
|
||||
@@ -63,6 +64,7 @@ const props = defineProps<{
|
||||
userInfo: { email: string }
|
||||
selectedPlanId: string
|
||||
selectedPlan: any
|
||||
isPaying: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits(['select-plan', 'pay', 'refresh'])
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
:user-info="userSubInfo"
|
||||
:selected-plan-id="selectedPlanId"
|
||||
:selected-plan="activePlan"
|
||||
:is-paying="isPaying"
|
||||
@select-plan="handlePlanSelect"
|
||||
@pay="handlePay"
|
||||
@refresh="init"
|
||||
@@ -46,6 +47,7 @@
|
||||
:user-info="userSubInfo"
|
||||
:selected-plan-id="selectedPlanId"
|
||||
:selected-plan="activePlan"
|
||||
:is-paying="isPaying"
|
||||
@select-plan="handlePlanSelect"
|
||||
@pay="handlePay"
|
||||
@refresh="init"
|
||||
@@ -70,6 +72,7 @@ const route = useRoute()
|
||||
const router = useRouter()
|
||||
// --- State ---
|
||||
const selectedPlanId = ref('p2')
|
||||
const isPaying = ref(false)
|
||||
const orderStatusDialogRef = ref<InstanceType<typeof OrderStatusDialog> | null>(null)
|
||||
const selectedPayment = ref('alipay')
|
||||
|
||||
@@ -132,6 +135,7 @@ const handlePlanSelect = (id: string) => {
|
||||
}
|
||||
|
||||
const handlePay = (methodId: number | string) => {
|
||||
if (isPaying.value) return
|
||||
const plan = plans.value.find((p) => p.id === selectedPlanId.value)
|
||||
if (!plan) return
|
||||
|
||||
@@ -147,7 +151,7 @@ const handlePay = (methodId: number | string) => {
|
||||
if (isRenewal) {
|
||||
params.user_subscribe_id = already.id
|
||||
}
|
||||
console.log(params)
|
||||
isPaying.value = true
|
||||
request.post(api, params).then((res: any) => {
|
||||
request
|
||||
.post('/api/v1/public/portal/order/checkout', {
|
||||
@@ -163,6 +167,11 @@ const handlePay = (methodId: number | string) => {
|
||||
})
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
isPaying.value = false
|
||||
})
|
||||
}).catch(() => {
|
||||
isPaying.value = false
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user