fix(api): 替换所有接口请求的域名为 guilixu-api.websoft.top
- 将获取 STS Token 的接口地址由 paopao-api 改为 guilixu-api - 更新图片上传接口地址为新的 guilixu-api 域名 - 修改用户推广页面中邀请码链接和二维码接口的域名 - 更改注册页微信登录接口请求的域名为 guilixu-api
This commit is contained in:
105
src/pages/user/withdraw/index.scss
Normal file
105
src/pages/user/withdraw/index.scss
Normal file
@@ -0,0 +1,105 @@
|
||||
.withdraw-page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.withdraw-card {
|
||||
margin: 24rpx;
|
||||
padding: 32rpx;
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-bottom: 32rpx;
|
||||
}
|
||||
|
||||
.amount-input-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 24rpx 0;
|
||||
border-bottom: 2rpx solid #eee;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.currency-symbol {
|
||||
font-size: 48rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
margin-right: 16rpx;
|
||||
}
|
||||
|
||||
.amount-input {
|
||||
flex: 1;
|
||||
font-size: 48rpx;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.amount-tips {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.all-withdraw {
|
||||
color: #ff6b35;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.fee-tips {
|
||||
margin-top: 12rpx;
|
||||
font-size: 22rpx;
|
||||
color: #ff9a56;
|
||||
}
|
||||
|
||||
.config-card {
|
||||
margin: 0 24rpx 24rpx;
|
||||
padding: 24rpx 32rpx;
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
}
|
||||
|
||||
.config-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 16rpx 0;
|
||||
border-bottom: 1rpx solid #f5f5f5;
|
||||
}
|
||||
|
||||
.config-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.config-label {
|
||||
font-size: 26rpx;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.config-value {
|
||||
font-size: 26rpx;
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.submit-btn {
|
||||
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;
|
||||
}
|
||||
|
||||
.submit-btn.disabled {
|
||||
opacity: 0.5;
|
||||
}
|
||||
163
src/pages/user/withdraw/index.tsx
Normal file
163
src/pages/user/withdraw/index.tsx
Normal file
@@ -0,0 +1,163 @@
|
||||
import { View, Text, Input } from '@tarojs/components';
|
||||
import Taro from '@tarojs/taro';
|
||||
import { useState, useEffect } from 'react';
|
||||
import { getWithdrawConfig, getWithdrawStats, applyWithdraw } from '@/api/shop/shopWithdrawRecord';
|
||||
import PayModal from '@/components/business/PayModal';
|
||||
|
||||
import './index.scss';
|
||||
|
||||
definePageConfig({
|
||||
navigationBarTitleText: '提现',
|
||||
});
|
||||
|
||||
export default function WithdrawPage() {
|
||||
const [config, setConfig] = useState<any>({});
|
||||
const [stats, setStats] = useState<any>({});
|
||||
const [amount, setAmount] = useState('');
|
||||
const [showPayModal, setShowPayModal] = useState(false);
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
loadConfig();
|
||||
loadStats();
|
||||
}, []);
|
||||
|
||||
const loadConfig = async () => {
|
||||
try {
|
||||
const res = await getWithdrawConfig();
|
||||
if (res.code === 200) {
|
||||
setConfig(res.data);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载配置失败', error);
|
||||
}
|
||||
};
|
||||
|
||||
const loadStats = async () => {
|
||||
try {
|
||||
const res = await getWithdrawStats();
|
||||
if (res.code === 200) {
|
||||
setStats(res.data);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载统计失败', error);
|
||||
}
|
||||
};
|
||||
|
||||
const handleWithdraw = () => {
|
||||
if (!amount || parseFloat(amount) <= 0) {
|
||||
Taro.showToast({ title: '请输入提现金额', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
const amountNum = parseFloat(amount);
|
||||
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 > maxAmount) {
|
||||
Taro.showToast({ title: `单次最大提现金额为${maxAmount}元`, icon: 'none' });
|
||||
return;
|
||||
}
|
||||
|
||||
setShowPayModal(true);
|
||||
};
|
||||
|
||||
const handlePayConfirm = async (payType: number) => {
|
||||
setShowPayModal(false);
|
||||
if (payType !== 0) return; // 0微信支付
|
||||
|
||||
setSubmitting(true);
|
||||
try {
|
||||
const res = await applyWithdraw({ amount: parseFloat(amount) });
|
||||
if (res.code === 200) {
|
||||
Taro.showToast({ title: '提现申请已提交', icon: 'success' });
|
||||
setTimeout(() => {
|
||||
Taro.navigateBack();
|
||||
}, 1500);
|
||||
} else {
|
||||
Taro.showToast({ title: res.message || '提交失败', icon: 'none' });
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('提现申请失败', error);
|
||||
Taro.showToast({ title: '提交失败', icon: 'none' });
|
||||
} finally {
|
||||
setSubmitting(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleAllWithdraw = () => {
|
||||
// 可提现余额
|
||||
const available = stats.withdrawingTotal || '0';
|
||||
setAmount(available);
|
||||
};
|
||||
|
||||
return (
|
||||
<View className="withdraw-page">
|
||||
<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="请输入提现金额"
|
||||
value={amount}
|
||||
onInput={(e) => setAmount(e.detail.value)}
|
||||
/>
|
||||
</View>
|
||||
|
||||
<View className="amount-tips">
|
||||
<Text>可提现佣金: ¥{stats.withdrawingTotal || '0.00'}</Text>
|
||||
<Text className="all-withdraw" onClick={handleAllWithdraw}>
|
||||
全部提现
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
{config.withdraw_fee_rate && parseFloat(config.withdraw_fee_rate) > 0 && (
|
||||
<View className="fee-tips">
|
||||
手续费: {config.withdraw_fee_rate}%
|
||||
</View>
|
||||
)}
|
||||
</View>
|
||||
|
||||
<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="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={`submit-btn ${amount && !submitting ? '' : 'disabled'}`}
|
||||
onClick={handleWithdraw}
|
||||
>
|
||||
{submitting ? '提交中...' : '确认提现'}
|
||||
</View>
|
||||
|
||||
<PayModal
|
||||
visible={showPayModal}
|
||||
amount={parseFloat(amount) || 0}
|
||||
onConfirm={handlePayConfirm}
|
||||
onClose={() => setShowPayModal(false)}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user