fix(weapp): 修复支付页nutui组件导致内容空白问题
- 替换支付页中nutui的Button、Cell、Price、Divider组件为Taro原生组件或项目自定义组件 - 修正商品名称、价格类型和支付金额显示,使用flex布局及Text组件自绘内容 - 调整按钮样式,统一为带蓝色背景和圆角的自定义样式 - 移除nutui Price组件中的thousands属性,使用项目自定义Price组件 - 解决微信小程序中nutui组件因div渲染缺失导致UI元素不显示的问题 - 保持支付流程及状态逻辑无改动,仅优化展示兼容性和稳定性
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import React, { useState, useEffect, useCallback } from 'react'
|
||||
import { View, Text } from '@tarojs/components'
|
||||
import { Button, Cell, Price, Divider } from '@nutui/nutui-react-taro'
|
||||
import { Check, Close, Tips, Clock } from '@nutui/icons-react-taro'
|
||||
import { View, Text, Button } from '@tarojs/components'
|
||||
import { Tips, Check, Close, Clock } from '@nutui/icons-react-taro'
|
||||
import Taro from '@tarojs/taro'
|
||||
import { request } from '@/utils/request'
|
||||
import { getOpenId, loginByOpenId } from '@/api/passport/wx-login'
|
||||
import type { User } from '@/api/system/user/model'
|
||||
import { saveStorageByLoginUser } from '@/utils/server'
|
||||
import { TenantId, WebsopyBaseUrl } from '@/config/app'
|
||||
import Price from '@/components/common/Price'
|
||||
|
||||
/**
|
||||
* 小程序支付页面
|
||||
@@ -312,7 +312,12 @@ const PayPage: React.FC = () => {
|
||||
<Close className="text-red-500 mb-4" size="48" />
|
||||
<Text className="block text-gray-800 text-lg mb-2">获取订单失败</Text>
|
||||
<Text className="block text-gray-500 mb-6">{errorMsg}</Text>
|
||||
<Button type="primary" onClick={handleBack}>返回</Button>
|
||||
<Button
|
||||
onClick={handleBack}
|
||||
className="bg-blue-500 text-white rounded-full px-6"
|
||||
>
|
||||
返回
|
||||
</Button>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
@@ -333,7 +338,12 @@ const PayPage: React.FC = () => {
|
||||
已支付 ¥{Number(detail.payPrice).toFixed(2)}
|
||||
</Text>
|
||||
) : null}
|
||||
<Button type="primary" onClick={handleBack}>完成</Button>
|
||||
<Button
|
||||
onClick={handleBack}
|
||||
className="bg-blue-500 text-white rounded-full px-6"
|
||||
>
|
||||
完成
|
||||
</Button>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
@@ -347,21 +357,26 @@ const PayPage: React.FC = () => {
|
||||
<View className="bg-white rounded-lg shadow-sm p-4 mb-4">
|
||||
<Text className="block text-lg font-bold text-gray-800 mb-3">确认支付</Text>
|
||||
|
||||
<Cell title="商品名称" description={detail?.productName || '-'} />
|
||||
<Cell title="价格类型" description={getPriceDesc()} />
|
||||
|
||||
<View className="flex items-center justify-between px-4 py-3">
|
||||
<Text className="text-gray-600">支付金额</Text>
|
||||
<Price
|
||||
price={detail?.payPrice}
|
||||
size="large"
|
||||
thousands
|
||||
/>
|
||||
{/* 商品名称 */}
|
||||
<View className="flex items-center justify-between px-4 py-3 border-b border-gray-100">
|
||||
<Text className="text-gray-600">商品名称</Text>
|
||||
<Text className="text-gray-800">{detail?.productName || '-'}</Text>
|
||||
</View>
|
||||
|
||||
<Divider />
|
||||
{/* 价格类型 */}
|
||||
<View className="flex items-center justify-between px-4 py-3 border-b border-gray-100">
|
||||
<Text className="text-gray-600">价格类型</Text>
|
||||
<Text className="text-gray-800">{getPriceDesc() || '-'}</Text>
|
||||
</View>
|
||||
|
||||
<View className="flex items-start px-4 py-2">
|
||||
{/* 支付金额 */}
|
||||
<View className="flex items-center justify-between px-4 py-3">
|
||||
<Text className="text-gray-600">支付金额</Text>
|
||||
<Price price={detail?.payPrice} size="large" />
|
||||
</View>
|
||||
|
||||
{/* 提示 */}
|
||||
<View className="flex items-start px-4 py-2 mt-2 border-t border-gray-100">
|
||||
<Tips className="text-orange-500 mr-2 mt-1" size="16" />
|
||||
<Text className="text-sm text-gray-500">
|
||||
支付成功后即可在「已购产品」中使用该应用
|
||||
@@ -373,18 +388,15 @@ const PayPage: React.FC = () => {
|
||||
<View className="fixed bottom-0 left-0 right-0 p-4 bg-white border-t border-gray-100">
|
||||
<View className="flex gap-3">
|
||||
<Button
|
||||
block
|
||||
onClick={handleBack}
|
||||
className="flex-1"
|
||||
className="flex-1 bg-gray-100 text-gray-700 rounded-full border-0"
|
||||
>
|
||||
取消
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
block
|
||||
loading={paying}
|
||||
onClick={handlePay}
|
||||
className="flex-1"
|
||||
className="flex-1 bg-blue-500 text-white rounded-full border-0"
|
||||
>
|
||||
{paying ? '支付中...' : '立即支付'}
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user