feat(user): 新增收货地址管理及售后申请页面

- 新增地址类型定义,增强前端地址数据结构
- 新增地址编辑页面,支持地址智能识别和定位选点功能
- 地址编辑支持省市区选择及默认地址设置
- 新增地址列表页面,支持地址展示、删除、编辑和选择功能
- 实现售后申请页面,支持选择售后类型和退款原因
- 售后申请支持商品选择、退款金额计算和凭证上传
- 新增售后详情页面,支持售后状态展示及申请取消
- 优化页面加载和用户交互体验,增加错误提示和权限处理
This commit is contained in:
2026-07-01 12:11:56 +08:00
parent bf6ed504cc
commit 1fa58040f3
636 changed files with 58878 additions and 716 deletions

View File

@@ -0,0 +1,3 @@
export default {
navigationBarTitleText: '关于我们',
}

View File

@@ -0,0 +1,85 @@
import React from 'react'
import { View, Text, ScrollView } from '@tarojs/components'
definePageConfig({
navigationBarTitleText: '关于我们',
})
const AboutPage: React.FC = () => {
return (
<ScrollView scrollY className='min-h-screen bg-gray-50'>
{/* 头部品牌区 */}
<View className='bg-white py-10 flex flex-col items-center'>
<View className='w-20 h-20 rounded-2xl bg-gradient-to-br from-blue-400 to-blue-600 flex items-center justify-center shadow-lg mb-4'>
<Text className='text-white text-4xl font-bold'></Text>
</View>
<Text className='text-xl font-bold text-gray-800'></Text>
<Text className='text-sm text-gray-400 mt-1'> v1.0.0</Text>
</View>
{/* 公司简介 */}
<View className='bg-white mx-3 mt-3 rounded-xl p-4' style={{ boxShadow: '0 2px 8px rgba(0,0,0,0.04)' }}>
<Text className='text-base font-medium text-gray-800 mb-3 block'></Text>
<Text className='text-sm text-gray-600 leading-relaxed'>
</Text>
<Text className='text-sm text-gray-600 leading-relaxed mt-2'>
"诚信经营、服务至上"
便
</Text>
</View>
{/* 核心业务 */}
<View className='bg-white mx-3 mt-3 rounded-xl p-4' style={{ boxShadow: '0 2px 8px rgba(0,0,0,0.04)' }}>
<Text className='text-base font-medium text-gray-800 mb-3 block'></Text>
{[
{ icon: '📺', title: '家电零售', desc: '电视、冰箱、洗衣机等全品类家电销售' },
{ icon: '❄️', title: '空调服务', desc: '空调销售、安装、加氟、清洗及维修' },
{ icon: '🍳', title: '厨房电器', desc: '油烟机、燃气灶、热水器等厨卫电器' },
{ icon: '🛠️', title: '安装维修', desc: '专业师傅上门安装、检测及故障维修' },
{ icon: '🔧', title: '保养维护', desc: '定期清洗保养,延长家电使用寿命' },
{ icon: '✅', title: '品质保障', desc: '正品货源、透明报价、售后无忧' },
].map((item, idx) => (
<View
key={idx}
className={`flex items-start gap-3 py-3 ${idx < 5 ? 'border-b border-gray-50' : ''}`}
>
<Text className='text-2xl mt-0.5'>{item.icon}</Text>
<View className='flex-1'>
<Text className='text-sm font-medium text-gray-700'>{item.title}</Text>
<Text className='text-xs text-gray-400 mt-0.5'>{item.desc}</Text>
</View>
</View>
))}
</View>
{/* 联系我们 */}
<View className='bg-white mx-3 mt-3 rounded-xl p-4' style={{ boxShadow: '0 2px 8px rgba(0,0,0,0.04)' }}>
<Text className='text-base font-medium text-gray-800 mb-3 block'></Text>
<View className='flex flex-col gap-2'>
{[
{ label: '经营部名称', value: '玉林市玉州区鑫龙家电经营部' },
{ label: '经营地址', value: '大新里南718号' },
{ label: '联系电话', value: '13260472256' },
{ label: '营业时间', value: '9:00 ~ 18:00' },
].map((item, idx) => (
<View key={idx} className='flex items-start justify-between'>
<Text className='text-sm text-gray-500 flex-shrink-0'>{item.label}</Text>
<Text className='text-sm text-gray-700 text-right ml-2'>{item.value}</Text>
</View>
))}
</View>
</View>
{/* 底部版权 */}
<View className='flex flex-col items-center py-8'>
<Text className='text-xs text-gray-400'>Copyright © 2024 </Text>
<Text className='text-xs text-gray-400 mt-1'>All Rights Reserved</Text>
</View>
</ScrollView>
)
}
export default AboutPage

View File

@@ -5,7 +5,6 @@ import { listShopGoodsFavorite } from '@/api/shop/shopGoodsFavorite'
import type { ShopGoodsFavorite } from '@/api/shop/shopGoodsFavorite/model'
import EmptyState from '@/components/common/EmptyState'
import LoadMore from '@/components/common/LoadMore'
import Price from '@/components/common/Price'
definePageConfig({
navigationBarTitleText: '我的收藏',
@@ -77,9 +76,9 @@ const FavoriteListPage: React.FC = () => {
<Text className='text-sm text-gray-800 line-clamp-2 block'>
{item.goodsName}
</Text>
<View className='mt-1'>
<Price price={item.salePrice || '0'} size='small' loginMask />
</View>
<Text className='text-red-500 text-sm font-medium mt-1 block'>
¥{item.salePrice || '0'}
</Text>
</View>
</View>
))}

View File

@@ -36,7 +36,7 @@ const helpData: HelpCategory[] = [
title: '支付与退款',
icon: '💰',
questions: [
{ id: 201, title: '支持哪些支付方式?', content: '我们支持微信支付、支付宝支付(如有)、货到付款、积分抵扣等多种支付方式。' },
{ id: 201, title: '支持哪些支付方式?', content: '我们支持微信支付、支付宝支付(如有)、余额支付、积分抵扣等多种支付方式。' },
{ id: 202, title: '如何申请退款?', content: '在订单详情页点击"申请退款"按钮,填写退款原因和说明,提交后等待商家审核。' },
{ id: 203, title: '退款多久到账?', content: '退款审核通过后原路退回您的支付账户。微信支付一般1-3个工作日到账余额支付即时到账。' },
]

View File

@@ -7,6 +7,17 @@ import MemberBadge from '@/components/business/MemberBadge'
const UserPage: React.FC = () => {
const { user, isLoggedIn } = useUser()
// TabBar 页面列表
const tabBarPages = ['/pages/index/index', '/pages/shop/index', '/pages/order/list', '/pages/user/user']
const handleNavigate = (url: string) => {
if (tabBarPages.includes(url)) {
Taro.switchTab({ url })
} else {
Taro.navigateTo({ url })
}
}
const menuItems = [
{ icon: '📦', label: '我的订单', url: '/pages/order/list' },
{ icon: '📅', label: '预约订单', url: '/pages/booking/list' },
@@ -30,68 +41,56 @@ const UserPage: React.FC = () => {
<ScrollView scrollY className='flex-1'>
{/* 顶部渐变背景区域 */}
<View className='relative'>
{/* 渐变背景 — 绿色系 */}
{/* 渐变背景 */}
<View
className='absolute inset-0'
style={{
background: 'linear-gradient(135deg, #0d9488 0%, #059669 50%, #10b981 100%)',
background: 'linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%)',
}}
/>
{/* 装饰圆形 */}
<View
className='absolute'
style={{
width: '240px',
height: '240px',
borderRadius: '120px',
width: '200px',
height: '200px',
borderRadius: '100px',
background: 'rgba(255, 255, 255, 0.1)',
top: '-80px',
right: '-60px',
}}
/>
<View
className='absolute'
style={{
width: '150px',
height: '150px',
borderRadius: '75px',
background: 'rgba(255, 255, 255, 0.08)',
top: '-100px',
right: '-80px',
}}
/>
<View
className='absolute'
style={{
width: '180px',
height: '180px',
borderRadius: '90px',
background: 'rgba(255, 255, 255, 0.06)',
top: '-60px',
left: '-60px',
}}
/>
<View
className='absolute'
style={{
width: '120px',
height: '120px',
borderRadius: '60px',
background: 'rgba(255, 255, 255, 0.05)',
bottom: '20px',
right: '-30px',
top: '-40px',
left: '-40px',
}}
/>
{/* 用户信息卡片 */}
<View className='relative mx-3 mt-3 p-4 rounded-2xl' style={{
background: 'rgba(255, 255, 255, 0.15)',
backdropFilter: 'blur(10px)',
border: '1px solid rgba(255, 255, 255, 0.2)',
background: 'rgba(255, 255, 255, 0.95)',
boxShadow: '0 8px 32px rgba(0, 0, 0, 0.1)',
}}>
<View className='flex items-center gap-4' onClick={handleLogin}>
{/* 头像区域 */}
<View className='relative'>
{isLoggedIn && user?.avatar ? (
<Image
className='w-16 h-16 rounded-full border-3 border-white/30'
style={{ boxShadow: '0 4px 16px rgba(0, 0, 0, 0.2)' }}
className='w-16 h-16 rounded-full border-4 border-white'
style={{ boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)' }}
src={user.avatar}
mode='aspectFill'
/>
) : (
<View
className='w-16 h-16 rounded-full border-3 border-white/30 flex items-center justify-center'
style={{ background: 'rgba(255, 255, 255, 0.25)', boxShadow: '0 4px 16px rgba(0, 0, 0, 0.2)' }}
className='w-16 h-16 rounded-full border-4 border-white flex items-center justify-center'
style={{ background: 'linear-gradient(135deg, #667eea, #764ba2)', boxShadow: '0 4px 12px rgba(0, 0, 0, 0.15)' }}
>
<Text className='text-2xl text-white'>👤</Text>
</View>
@@ -100,7 +99,7 @@ const UserPage: React.FC = () => {
{isLoggedIn && user?.memberLevelName && (
<View
className='absolute -bottom-1 -right-1 px-1 py-1 rounded text-xs text-white'
style={{ background: 'linear-gradient(135deg, #fbbf24, #f59e0b)' }}
style={{ background: 'linear-gradient(135deg, #f093fb, #f5576c)' }}
>
VIP
</View>
@@ -110,7 +109,7 @@ const UserPage: React.FC = () => {
{/* 用户信息 */}
<View className='flex-1'>
<View className='flex items-center gap-2'>
<Text className='text-lg font-bold text-white'>
<Text className='text-lg font-bold text-gray-800'>
{isLoggedIn ? (user?.nickname || user?.phone || '用户') : '点击登录'}
</Text>
{isLoggedIn && user?.memberLevelName && (
@@ -118,59 +117,50 @@ const UserPage: React.FC = () => {
)}
</View>
{isLoggedIn ? (
<Text className='text-xs text-white/60 mt-1'>ID: {(user as any)?.id || '暂无'}</Text>
<Text className='text-xs text-gray-400 mt-1'>ID: {(user as any)?.id || '暂无'}</Text>
) : (
<Text className='text-xs text-white/60 mt-1'></Text>
<Text className='text-xs text-gray-400 mt-1'></Text>
)}
</View>
{/* 箭头 */}
<View className='w-6 h-6 rounded-full bg-white/20 flex items-center justify-center'>
<Text className='text-white/80 text-xs'>{'>'}</Text>
<View className='w-6 h-6 rounded-full bg-gray-100 flex items-center justify-center'>
<Text className='text-gray-400 text-xs'>{'>'}</Text>
</View>
</View>
{/* 数据概览 — 4列白色文字 */}
{/* 数据概览 */}
{isLoggedIn && (
<View
className='grid grid-cols-4 gap-2 mt-4 pt-4'
style={{ borderTop: '1px solid rgba(255, 255, 255, 0.2)' }}
className='grid grid-cols-3 gap-2 mt-4 pt-4 rounded-xl'
style={{ background: 'rgba(102, 126, 234, 0.05)' }}
>
<View
className='text-center py-2'
onClick={() => Taro.navigateTo({ url: '/pages/user/wallet' })}
className='text-center py-2 rounded-lg'
onClick={() => Taro.switchTab({ url: '/pages/points/index' })}
>
<Text className='text-xl font-bold text-white'>
¥{((user as any)?.balance || '0.00')}
</Text>
<Text className='text-xs text-white/70 mt-1 block'></Text>
</View>
<View
className='text-center py-2'
onClick={() => Taro.navigateTo({ url: '/pages/points/index' })}
>
<Text className='text-xl font-bold text-white'>
<Text className='text-xl font-bold text-transparent' style={{ background: 'linear-gradient(135deg, #667eea, #764ba2)', WebkitBackgroundClip: 'text', WebkitTextFillColor: 'transparent' }}>
{(user as any)?.points || 0}
</Text>
<Text className='text-xs text-white/70 mt-1 block'></Text>
<Text className='text-xs text-gray-500 mt-1'></Text>
</View>
<View
className='text-center py-2'
className='text-center py-2 rounded-lg'
onClick={() => Taro.navigateTo({ url: '/pages/user/coupon-list' })}
>
<Text className='text-xl font-bold text-white'>
<Text className='text-xl font-bold text-transparent' style={{ background: 'linear-gradient(135deg, #f093fb, #f5576c)', WebkitBackgroundClip: 'text', WebkitTextFillColor: 'transparent' }}>
0
</Text>
<Text className='text-xs text-white/70 mt-1 block'></Text>
<Text className='text-xs text-gray-500 mt-1'></Text>
</View>
<View
className='text-center py-2'
onClick={() => Taro.navigateTo({ url: '/pages/order/list' })}
className='text-center py-2 rounded-lg'
onClick={() => Taro.switchTab({ url: '/pages/order/list' })}
>
<Text className='text-xl font-bold text-white'>
<Text className='text-xl font-bold text-transparent' style={{ background: 'linear-gradient(135deg, #4facfe, #00f2fe)', WebkitBackgroundClip: 'text', WebkitTextFillColor: 'transparent' }}>
0
</Text>
<Text className='text-xs text-white/70 mt-1 block'></Text>
<Text className='text-xs text-gray-500 mt-1'></Text>
</View>
</View>
)}
@@ -182,7 +172,7 @@ const UserPage: React.FC = () => {
<View className='bg-white rounded-xl mx-3 mt-3 p-4' style={{ boxShadow: '0 2px 8px rgba(0, 0, 0, 0.05)' }}>
<View className='flex justify-between items-center mb-3'>
<Text className='text-base font-medium text-gray-800'></Text>
<Text className='text-xs text-gray-400' onClick={() => Taro.navigateTo({ url: '/pages/order/list' })}>
<Text className='text-xs text-gray-400' onClick={() => Taro.switchTab({ url: '/pages/order/list' })}>
{'>'}
</Text>
</View>
@@ -197,7 +187,7 @@ const UserPage: React.FC = () => {
key={item.status}
className='flex flex-col items-center py-2 rounded-lg'
style={{ background: `${item.color}10` }}
onClick={() => Taro.navigateTo({ url: `/pages/order/list?tab=${item.status}` })}
onClick={() => { Taro.setStorageSync('order_tab', item.status); Taro.switchTab({ url: '/pages/order/list' }) }}
>
<Text className='text-xl mb-1'>{item.icon}</Text>
<Text className='text-xs text-gray-600'>{item.label}</Text>
@@ -213,7 +203,7 @@ const UserPage: React.FC = () => {
className={`flex items-center justify-between px-4 py-3 ${
idx < menuItems.length - 1 ? 'border-b border-gray-50' : ''
}`}
onClick={() => Taro.navigateTo({ url: item.url })}
onClick={() => handleNavigate(item.url)}
>
<View className='flex items-center gap-3'>
<Text className='text-base'>{item.icon}</Text>

View File

@@ -39,7 +39,7 @@ const SettingPage: React.FC = () => {
const menuItems = [
{ label: '清除缓存', action: handleClearCache },
{ label: '关于我们', action: () => Taro.showToast({ title: 'v1.0.0', icon: 'none' }) },
{ label: '关于我们', action: () => Taro.navigateTo({ url: '/pages/user/about/index' }) },
{ label: '用户协议', action: () => Taro.navigateTo({ url: '/passport/agreement' }) },
{ label: '隐私政策', action: () => Taro.navigateTo({ url: '/passport/agreement' }) },
]

View File

@@ -155,7 +155,7 @@ const UserPage: React.FC = () => {
<View className='bg-white rounded-xl mx-3 mt-3 p-4'>
<View className='flex justify-between items-center mb-3'>
<Text className='text-base font-medium text-gray-800'></Text>
<Text className='text-xs text-gray-400' onClick={() => Taro.navigateTo({ url: '/pages/order/list' })}>
<Text className='text-xs text-gray-400' onClick={() => Taro.switchTab({ url: '/pages/order/list' })}>
{'>'}
</Text>
</View>
@@ -169,7 +169,7 @@ const UserPage: React.FC = () => {
<View
key={item.status}
className='flex flex-col items-center py-2 relative'
onClick={() => Taro.navigateTo({ url: `/pages/order/list?tab=${item.status}` })}
onClick={() => { Taro.setStorageSync('order_tab', item.status); Taro.switchTab({ url: '/pages/order/list' }) }}
>
<Text className='text-xl mb-1'>{item.icon}</Text>
<Text className='text-xs text-gray-600'>{item.label}</Text>

View File

@@ -45,10 +45,17 @@ const WalletPage: React.FC = () => {
<View
className='flex-1 py-2 rounded-full text-center'
style={{ backgroundColor: 'rgba(255,255,255,0.2)' }}
onClick={() => Taro.navigateTo({ url: '/pages/user/recharge' })}
onClick={() => Taro.navigateTo({ url: '/pages/user/redeem/index' })}
>
<Text className='text-white text-sm font-medium'></Text>
</View>
{/*<View*/}
{/* className='flex-1 py-2 rounded-full text-center'*/}
{/* style={{ backgroundColor: 'rgba(255,255,255,0.2)' }}*/}
{/* onClick={() => Taro.navigateTo({ url: '/pages/user/withdraw/index' })}*/}
{/*>*/}
{/* <Text className='text-white text-sm font-medium'>提现</Text>*/}
{/*</View>*/}
</View>
</View>
@@ -76,6 +83,13 @@ const WalletPage: React.FC = () => {
<Text className='text-lg mb-1'>🎫</Text>
<Text className='text-xs text-gray-600'></Text>
</View>
{/*<View*/}
{/* className='flex-1 flex flex-col items-center py-2'*/}
{/* onClick={() => Taro.navigateTo({ url: '/pages/user/withdraw/index' })}*/}
{/*>*/}
{/* <Text className='text-lg mb-1'>💰</Text>*/}
{/* <Text className='text-xs text-gray-600'>提现记录</Text>*/}
{/*</View>*/}
</View>
</View>

View File

@@ -1,76 +1,28 @@
.withdraw-page {
display: flex;
flex-direction: column;
min-height: 100vh;
background: #f5f6fa;
padding-bottom: env(safe-area-inset-bottom);
height: 100vh;
background: #f5f5f5;
}
/* ========== 余额卡片 ========== */
.balance-card {
margin: 24rpx;
padding: 40rpx 32rpx 32rpx;
background: linear-gradient(135deg, #ff6b35 0%, #ff8c42 100%);
border-radius: 20rpx;
color: #fff;
}
.balance-header {
margin-bottom: 16rpx;
}
.balance-label {
font-size: 26rpx;
color: rgba(255, 255, 255, 0.85);
}
.balance-amount-row {
display: flex;
align-items: baseline;
}
.currency-symbol-lg {
font-size: 40rpx;
font-weight: bold;
color: #fff;
margin-right: 8rpx;
}
.balance-number {
font-size: 72rpx;
font-weight: bold;
color: #fff;
line-height: 1;
}
.balance-tips {
margin-top: 16rpx;
}
.balance-tip-text {
font-size: 24rpx;
color: rgba(255, 255, 255, 0.7);
}
/* ========== 提现输入卡片 ========== */
.withdraw-card {
margin: 24rpx;
padding: 32rpx;
background: #fff;
border-radius: 20rpx;
border-radius: 16rpx;
}
.card-title {
font-size: 30rpx;
font-size: 28rpx;
font-weight: bold;
color: #333;
margin-bottom: 28rpx;
margin-bottom: 32rpx;
}
.amount-input-wrap {
display: flex;
align-items: center;
padding: 20rpx 0;
padding: 24rpx 0;
border-bottom: 2rpx solid #eee;
margin-bottom: 16rpx;
}
@@ -89,162 +41,65 @@
color: #333;
}
.all-withdraw {
flex-shrink: 0;
padding: 8rpx 20rpx;
background: #fff3ee;
color: #ff6b35;
.amount-tips {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 24rpx;
color: #999;
}
.all-withdraw {
color: #ff6b35;
font-weight: bold;
border-radius: 24rpx;
border: 2rpx solid #ffd4bc;
}
.fee-tips {
display: flex;
align-items: center;
gap: 8rpx;
margin-top: 16rpx;
padding: 12rpx 16rpx;
font-size: 24rpx;
color: #e67e22;
background: #fef9f5;
border-radius: 8rpx;
margin-top: 12rpx;
font-size: 22rpx;
color: #ff9a56;
}
.fee-free {
color: #27ae60;
background: #f0faf4;
}
.fee-icon {
font-size: 24rpx;
}
/* ========== 提现规则区域(核心审核项)========== */
.rules-section {
.config-card {
margin: 0 24rpx 24rpx;
padding: 24rpx 32rpx;
background: #fff;
border-radius: 20rpx;
overflow: hidden;
border-radius: 16rpx;
}
/* 标题栏 */
.rules-header {
.config-item {
display: flex;
align-items: center;
gap: 12rpx;
padding: 28rpx 32rpx 20rpx;
background: linear-gradient(135deg, #fef0eb 0%, #fff8f5 100%);
border-bottom: 2rpx solid #fce8e1;
}
.rules-header-icon {
font-size: 36rpx;
}
.rules-header-title {
font-size: 30rpx;
font-weight: bold;
color: #c0392b;
}
/* 规则网格 - 两列 */
.rules-grid {
display: grid;
grid-template-columns: 1fr 1fr;
padding: 24rpx 24rpx 8rpx;
gap: 16rpx;
}
.rule-cell {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 20rpx 12rpx;
background: #fafafa;
border-radius: 12rpx;
border: 2rpx solid #f0f0f0;
}
.rule-cell-wide {
grid-column: span 2;
flex-direction: row;
justify-content: space-between;
padding: 18rpx 24rpx;
padding: 16rpx 0;
border-bottom: 1rpx solid #f5f5f5;
}
.rule-cell-label {
font-size: 23rpx;
color: #999;
margin-bottom: 8rpx;
.config-item:last-child {
border-bottom: none;
}
.rule-cell-value {
font-size: 28rpx;
font-weight: bold;
color: #333;
}
.rule-cell-wide .rule-cell-label {
margin-bottom: 0;
}
/* 详细规则文字列表 */
.rules-detail {
padding: 20rpx 32rpx 28rpx;
}
.detail-item {
display: flex;
align-items: flex-start;
gap: 10rpx;
padding: 10rpx 0;
}
.detail-bullet {
flex-shrink: 0;
.config-label {
font-size: 26rpx;
color: #ff6b35;
margin-top: 2rpx;
}
.detail-text {
font-size: 25rpx;
color: #666;
line-height: 1.7;
}
/* ========== 底部按钮区 ========== */
.bottom-area {
margin-top: auto;
padding: 20rpx 40rpx 40rpx;
.config-value {
font-size: 26rpx;
color: #333;
font-weight: bold;
}
.submit-btn {
width: 100%;
padding: 26rpx 0;
margin: 48rpx 24rpx;
padding: 24rpx 0;
text-align: center;
background: linear-gradient(135deg, #ff6b35 0%, #ff9a56 100%);
color: #fff;
font-size: 32rpx;
font-weight: bold;
border-radius: 48rpx;
box-shadow: 0 8rpx 24rpx rgba(255, 107, 53, 0.35);
}
.submit-btn.disabled {
opacity: 0.45;
box-shadow: none;
}
.submit-disclaimer {
text-align: center;
margin-top: 16rpx;
}
.disclaimer-text {
font-size: 22rpx;
color: #bbb;
opacity: 0.5;
}

View File

@@ -24,9 +24,9 @@ export default function WithdrawPage() {
const loadConfig = async () => {
try {
const res: any = await getWithdrawConfig();
if (res.code === 200 || res.code === 0) {
setConfig(res.data || {});
const res = await getWithdrawConfig();
if (res.code === 200) {
setConfig(res.data);
}
} catch (error) {
console.error('加载配置失败', error);
@@ -35,25 +35,15 @@ export default function WithdrawPage() {
const loadStats = async () => {
try {
const res: any = await getWithdrawStats();
if (res.code === 200 || res.code === 0) {
setStats(res.data || {});
const res = await getWithdrawStats();
if (res.code === 200) {
setStats(res.data);
}
} catch (error) {
console.error('加载统计失败', error);
}
};
// 从配置或默认值读取
const minAmount = config.withdraw_min_amount || '10';
const maxAmount = config.withdraw_max_amount || '200';
const dailyLimit = config.withdraw_daily_limit || '2000';
const dailyCount = config.withdraw_daily_count || 3;
const timeStart = config.withdraw_time_start || '';
const timeEnd = config.withdraw_time_end || '';
const feeRate = config.withdraw_fee_rate || '0';
const arrivalTime = config.arrival_time || '';
const handleWithdraw = () => {
if (!amount || parseFloat(amount) <= 0) {
Taro.showToast({ title: '请输入提现金额', icon: 'none' });
@@ -61,12 +51,15 @@ export default function WithdrawPage() {
}
const amountNum = parseFloat(amount);
if (amountNum < parseFloat(minAmount)) {
const minAmount = parseFloat(config.withdraw_min_amount || '10');
const maxAmount = parseFloat(config.withdraw_max_amount || '200');
if (amountNum < minAmount) {
Taro.showToast({ title: `最低提现金额为${minAmount}`, icon: 'none' });
return;
}
if (amountNum > parseFloat(maxAmount)) {
if (amountNum > maxAmount) {
Taro.showToast({ title: `单次最大提现金额为${maxAmount}`, icon: 'none' });
return;
}
@@ -76,12 +69,12 @@ export default function WithdrawPage() {
const handlePayConfirm = async (payType: number) => {
setShowPayModal(false);
if (payType !== 0) return;
if (payType !== 0) return; // 0微信支付
setSubmitting(true);
try {
const res: any = await applyWithdraw({ amount: parseFloat(amount) });
if (res.code === 200 || res.code === 0) {
const res = await applyWithdraw({ amount: parseFloat(amount) });
if (res.code === 200) {
Taro.showToast({ title: '提现申请已提交', icon: 'success' });
setTimeout(() => {
Taro.navigateBack();
@@ -98,156 +91,65 @@ export default function WithdrawPage() {
};
const handleAllWithdraw = () => {
const available = stats.withdrawingTotal || stats.balance || '0.00';
// 可提现余额
const available = stats.withdrawingTotal || '0';
setAmount(available);
};
const availableBalance = stats.withdrawingTotal || stats.balance || '0.00';
return (
<View className="withdraw-page">
{/* 余额卡片 */}
<View className="balance-card">
<View className="balance-header">
<Text className="balance-label"></Text>
</View>
<View className="balance-amount-row">
<Text className="currency-symbol-lg">¥</Text>
<Text className="balance-number">{availableBalance}</Text>
</View>
<View className="balance-tips">
<Text className="balance-tip-text"></Text>
</View>
</View>
{/* 提现输入 */}
<View className="withdraw-card">
<View className="card-title"></View>
<View className="amount-input-wrap">
<Text className="currency-symbol">¥</Text>
<Input
className="amount-input"
type="digit"
placeholder={`最低 ${minAmount}`}
placeholder="请输入提现金额"
value={amount}
onInput={(e) => setAmount(e.detail.value)}
/>
<Text
className="all-withdraw"
onClick={handleAllWithdraw}
>
</View>
<View className="amount-tips">
<Text>: ¥{stats.withdrawingTotal || '0.00'}</Text>
<Text className="all-withdraw" onClick={handleAllWithdraw}>
</Text>
</View>
{feeRate && parseFloat(feeRate) > 0 ? (
{config.withdraw_fee_rate && parseFloat(config.withdraw_fee_rate) > 0 && (
<View className="fee-tips">
<Text className="fee-icon"></Text>
<Text> {feeRate}% </Text>
</View>
) : (
<View className="fee-tips fee-free">
<Text className="fee-icon"></Text>
<Text></Text>
: {config.withdraw_fee_rate}%
</View>
)}
</View>
{/* ====== 提现规则展示(核心审核项)====== */}
<View className="rules-section">
{/* 标题栏 */}
<View className="rules-header">
<Text className="rules-header-icon">📋</Text>
<Text className="rules-header-title"></Text>
<View className="config-card">
<View className="config-item">
<Text className="config-label"></Text>
<Text className="config-value">¥{config.withdraw_max_amount || '200'}</Text>
</View>
{/* 规则网格 - 两列布局更醒目 */}
<View className="rules-grid">
<View className="rule-cell">
<Text className="rule-cell-label"></Text>
<Text className="rule-cell-value">{minAmount} </Text>
</View>
<View className="rule-cell">
<Text className="rule-cell-label"></Text>
<Text className="rule-cell-value">{maxAmount} /</Text>
</View>
<View className="rule-cell">
<Text className="rule-cell-label"></Text>
<Text className="rule-cell-value">{dailyLimit} /</Text>
</View>
<View className="rule-cell">
<Text className="rule-cell-label"></Text>
<Text className="rule-cell-value">{dailyCount} /</Text>
</View>
<View className="rule-cell">
<Text className="rule-cell-label"></Text>
<Text className="rule-cell-value">{timeStart && timeEnd ? `${timeStart}-${timeEnd}` : '全天可提'}</Text>
</View>
<View className="rule-cell">
<Text className="rule-cell-label"></Text>
<Text className="rule-cell-value">{arrivalTime || '1-3个工作日'}</Text>
</View>
<View className="rule-cell rule-cell-wide">
<Text className="rule-cell-label"></Text>
<Text className="rule-cell-value">
{feeRate && parseFloat(feeRate) > 0 ? `${feeRate}%` : '免手续费'}
<View className="config-item">
<Text className="config-label"></Text>
<Text className="config-value">¥{config.withdraw_daily_limit || '2000'}</Text>
</View>
{config.withdraw_time_start && (
<View className="config-item">
<Text className="config-label"></Text>
<Text className="config-value">
{config.withdraw_time_start} - {config.withdraw_time_end}
</Text>
</View>
</View>
{/* 详细规则文字 */}
<View className="rules-detail">
<View className="detail-item">
<Text className="detail-bullet"></Text>
<Text className="detail-text"> ¥{minAmount} ~ ¥{maxAmount}</Text>
</View>
<View className="detail-item">
<Text className="detail-bullet"></Text>
<Text className="detail-text"> {dailyCount} ¥{dailyLimit}</Text>
</View>
{timeStart && timeEnd ? (
<View className="detail-item">
<Text className="detail-bullet"></Text>
<Text className="detail-text"> {timeStart} {timeEnd} </Text>
</View>
) : (
<View className="detail-item">
<Text className="detail-bullet"></Text>
<Text className="detail-text"> 24 </Text>
</View>
)}
<View className="detail-item">
<Text className="detail-bullet"></Text>
<Text className="detail-text"> {arrivalTime || '1-3个工作日'} </Text>
</View>
{feeRate && parseFloat(feeRate) > 0 ? (
<View className="detail-item">
<Text className="detail-bullet"></Text>
<Text className="detail-text"> {feeRate}% </Text>
</View>
) : (
<View className="detail-item">
<Text className="detail-bullet"></Text>
<Text className="detail-text"></Text>
</View>
)}
<View className="detail-item">
<Text className="detail-bullet"></Text>
<Text className="detail-text">退</Text>
</View>
</View>
)}
</View>
{/* 底部按钮 */}
<View className="bottom-area">
<View
className={`submit-btn ${amount && !submitting ? '' : 'disabled'}`}
onClick={handleWithdraw}
>
{submitting ? '提交中...' : '确认提现'}
</View>
<View className="submit-disclaimer">
<Text className="disclaimer-text"></Text>
</View>
<View
className={`submit-btn ${amount && !submitting ? '' : 'disabled'}`}
onClick={handleWithdraw}
>
{submitting ? '提交中...' : '确认提现'}
</View>
<PayModal