refactor(ui): extract btn-stripe shared class, reuse btn-primary/btn-secondary

This commit is contained in:
erio
2026-04-07 23:57:00 +08:00
parent f1cb798856
commit f15500cd44
3 changed files with 10 additions and 3 deletions
+7
View File
@@ -141,6 +141,13 @@
@apply dark:shadow-amber-500/20;
}
.btn-stripe {
@apply bg-[#635bff] text-white shadow-md shadow-[#635bff]/25;
@apply hover:bg-[#5851ea] hover:shadow-lg hover:shadow-[#635bff]/30;
@apply dark:bg-[#7a73ff] dark:shadow-[#7a73ff]/20;
@apply dark:hover:bg-[#635bff];
}
.btn-sm {
@apply rounded-lg px-3 py-1.5 text-xs;
}
@@ -21,11 +21,11 @@
<p class="mt-2 text-sm text-gray-400 dark:text-gray-500">{{ t('payment.qr.waitingPayment') }}</p>
</div>
<a v-if="payUrl && !qrUrl && !expired" :href="payUrl" target="_blank" rel="noopener noreferrer"
class="inline-flex w-full items-center justify-center gap-2 rounded-lg bg-primary-500 py-3 text-sm font-medium text-white transition-colors hover:bg-primary-600 dark:bg-primary-600 dark:hover:bg-primary-500">
class="btn btn-primary w-full py-3">
{{ t('payment.qr.openPayWindow') }}
</a>
<!-- Cancel button -->
<button v-if="!expired && orderId" class="w-full rounded-lg border border-gray-300 bg-white py-2.5 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-50 dark:border-dark-600 dark:bg-dark-800 dark:text-gray-300 dark:hover:bg-dark-700" :disabled="cancelling" @click="handleCancel">
<button v-if="!expired && orderId" class="btn btn-secondary w-full" :disabled="cancelling" @click="handleCancel">
{{ cancelling ? t('common.processing') : t('payment.qr.cancelOrder') }}
</button>
</div>
@@ -26,7 +26,7 @@
<Icon name="checkCircle" size="md" />
<span class="text-sm font-medium">{{ t('payment.stripeSuccessProcessing') }}</span>
</div>
<button v-if="!stripeSuccess" class="mt-6 w-full rounded-lg bg-[#635bff] py-3 text-base font-semibold text-white transition-colors hover:bg-[#5851ea] disabled:opacity-50 dark:bg-[#7a73ff] dark:hover:bg-[#635bff]" :disabled="stripeSubmitting || !stripeReady" @click="handlePay">
<button v-if="!stripeSuccess" class="btn btn-stripe mt-6 w-full py-3 text-base" :disabled="stripeSubmitting || !stripeReady" @click="handlePay">
<span v-if="stripeSubmitting" class="flex items-center justify-center gap-2">
<span class="h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent"></span>
{{ t('common.processing') }}