|
|
@@ -374,18 +374,18 @@ const PaymentPage = () => {
|
|
|
<View className="p-5">
|
|
|
{/* 头部 */}
|
|
|
<View className="text-center py-6 bg-white rounded-2xl mb-5">
|
|
|
- <Text className="text-2xl font-bold text-gray-800">支付订单</Text>
|
|
|
+ <Text className="text-2xl font-bold text-gray-800" data-testid="payment-page-title">支付订单</Text>
|
|
|
</View>
|
|
|
|
|
|
{/* 订单信息 */}
|
|
|
- <View className="bg-white rounded-2xl p-6 mb-5">
|
|
|
+ <View className="bg-white rounded-2xl p-6 mb-5" data-testid="order-info">
|
|
|
<View className="flex justify-between items-center mb-4">
|
|
|
<Text className="text-sm text-gray-600">订单号:</Text>
|
|
|
- <Text className="text-sm text-gray-800">{orderNo || `ORD${orderId}`}</Text>
|
|
|
+ <Text className="text-sm text-gray-800" data-testid="order-no">{orderNo || `ORD${orderId}`}</Text>
|
|
|
</View>
|
|
|
<View className="flex justify-between items-center">
|
|
|
<Text className="text-sm text-gray-600">支付金额:</Text>
|
|
|
- <Text className="text-2xl font-bold text-orange-500">¥{amount.toFixed(2)}</Text>
|
|
|
+ <Text className="text-2xl font-bold text-orange-500" data-testid="payment-amount">¥{amount.toFixed(2)}</Text>
|
|
|
</View>
|
|
|
</View>
|
|
|
|
|
|
@@ -401,6 +401,7 @@ const PaymentPage = () => {
|
|
|
: 'border-gray-200'
|
|
|
}`}
|
|
|
onClick={() => setSelectedPaymentMethod(PaymentMethod.WECHAT)}
|
|
|
+ data-testid="wechat-payment-option"
|
|
|
>
|
|
|
<View className="flex items-center">
|
|
|
<View className="w-10 h-10 bg-green-100 rounded-full flex items-center justify-center mr-3">
|
|
|
@@ -412,7 +413,7 @@ const PaymentPage = () => {
|
|
|
</View>
|
|
|
</View>
|
|
|
{selectedPaymentMethod === PaymentMethod.WECHAT && (
|
|
|
- <View className="w-6 h-6 bg-blue-500 rounded-full flex items-center justify-center">
|
|
|
+ <View className="w-6 h-6 bg-blue-500 rounded-full flex items-center justify-center" data-testid="wechat-selected">
|
|
|
<Text className="text-white text-xs">✓</Text>
|
|
|
</View>
|
|
|
)}
|
|
|
@@ -430,6 +431,7 @@ const PaymentPage = () => {
|
|
|
setSelectedPaymentMethod(PaymentMethod.CREDIT)
|
|
|
}
|
|
|
}}
|
|
|
+ data-testid="credit-payment-option"
|
|
|
>
|
|
|
<View className="flex items-center">
|
|
|
<View className="w-10 h-10 bg-purple-100 rounded-full flex items-center justify-center mr-3">
|
|
|
@@ -440,17 +442,17 @@ const PaymentPage = () => {
|
|
|
{isCreditBalanceLoading ? (
|
|
|
<Text className="text-xs text-gray-500">加载中...</Text>
|
|
|
) : creditBalance?.isEnabled ? (
|
|
|
- <Text className="text-xs text-gray-500">
|
|
|
+ <Text className="text-xs text-gray-500" data-testid="available-amount-text">
|
|
|
可用额度: ¥{creditBalance?.availableAmount?.toFixed(2) || '0.00'}
|
|
|
{creditBalance?.availableAmount < amount && ` (不足)`}
|
|
|
</Text>
|
|
|
) : (
|
|
|
- <Text className="text-xs text-red-500">额度未启用</Text>
|
|
|
+ <Text className="text-xs text-red-500" data-testid="credit-disabled-text">额度未启用</Text>
|
|
|
)}
|
|
|
</View>
|
|
|
</View>
|
|
|
{selectedPaymentMethod === PaymentMethod.CREDIT ? (
|
|
|
- <View className="w-6 h-6 bg-blue-500 rounded-full flex items-center justify-center">
|
|
|
+ <View className="w-6 h-6 bg-blue-500 rounded-full flex items-center justify-center" data-testid="credit-selected">
|
|
|
<Text className="text-white text-xs">✓</Text>
|
|
|
</View>
|
|
|
) : (!creditBalance?.isEnabled || creditBalance?.availableAmount <= 0 || creditBalance?.availableAmount < amount) && (
|
|
|
@@ -460,7 +462,7 @@ const PaymentPage = () => {
|
|
|
|
|
|
{/* 额度支付说明 */}
|
|
|
{selectedPaymentMethod === PaymentMethod.CREDIT && creditBalance && (
|
|
|
- <View className="mt-4 p-3 bg-blue-50 rounded-lg">
|
|
|
+ <View className="mt-4 p-3 bg-blue-50 rounded-lg" data-testid="credit-payment-details">
|
|
|
<Text className="text-xs text-blue-700">
|
|
|
• 使用信用额度支付,无需立即付款{'\n'}
|
|
|
• 可用额度: ¥{creditBalance.availableAmount.toFixed(2)}{'\n'}
|
|
|
@@ -489,6 +491,7 @@ const PaymentPage = () => {
|
|
|
} text-white rounded-full text-lg font-bold ${
|
|
|
isProcessing ? 'bg-gray-400' : ''
|
|
|
}`}
|
|
|
+ data-testid="pay-button"
|
|
|
>
|
|
|
{isProcessing ? '支付中...' :
|
|
|
selectedPaymentMethod === PaymentMethod.CREDIT
|