|
|
@ -14,25 +14,25 @@ |
|
|
<view>我要提现</view> |
|
|
<view>我要提现</view> |
|
|
<view class="from-line"> |
|
|
<view class="from-line"> |
|
|
<input |
|
|
<input |
|
|
placeholder="请输入提现金额" |
|
|
|
|
|
|
|
|
placeholder="请输入提现积分" |
|
|
v-model="withdrawAmount" |
|
|
v-model="withdrawAmount" |
|
|
type="digit" |
|
|
type="digit" |
|
|
@input="onAmountInput" |
|
|
@input="onAmountInput" |
|
|
/> |
|
|
/> |
|
|
</view> |
|
|
</view> |
|
|
<view class="tips" v-if="userInfo.price"> |
|
|
|
|
|
可提现金额:¥{{userInfo.price}} |
|
|
|
|
|
|
|
|
<view class="tips" v-if="userInfo.money"> |
|
|
|
|
|
可提现:¥{{userInfo.money}} |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
<!-- 快捷金额选择 --> |
|
|
|
|
|
<view class="quick-amounts" v-if="userInfo.price && parseFloat(userInfo.price) > 0"> |
|
|
|
|
|
|
|
|
<!-- 快捷积分选择 --> |
|
|
|
|
|
<view class="quick-amounts" v-if="userInfo.money && parseFloat(userInfo.money) > 0"> |
|
|
<view class="quick-label">快捷选择:</view> |
|
|
<view class="quick-label">快捷选择:</view> |
|
|
<view class="amount-buttons"> |
|
|
<view class="amount-buttons"> |
|
|
<view |
|
|
<view |
|
|
class="amount-btn" |
|
|
class="amount-btn" |
|
|
v-for="amount in quickAmounts" |
|
|
v-for="amount in quickAmounts" |
|
|
:key="amount" |
|
|
:key="amount" |
|
|
:class="{'disabled': amount > parseFloat(userInfo.price)}" |
|
|
|
|
|
|
|
|
:class="{'disabled': amount > parseFloat(userInfo.money)}" |
|
|
@click="selectQuickAmount(amount)" |
|
|
@click="selectQuickAmount(amount)" |
|
|
> |
|
|
> |
|
|
¥{{amount}} |
|
|
¥{{amount}} |
|
|
@ -88,9 +88,9 @@ |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
notice: '', |
|
|
notice: '', |
|
|
withdrawAmount: '', // 提现金额 |
|
|
|
|
|
|
|
|
withdrawAmount: '', // 提现积分 |
|
|
isSubmitting: false, // 是否正在提交 |
|
|
isSubmitting: false, // 是否正在提交 |
|
|
quickAmounts: [10, 50, 100, 200, 500], // 快捷金额选项 |
|
|
|
|
|
|
|
|
quickAmounts: [10, 50, 100, 200, 500], // 快捷积分选项 |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
computed: { |
|
|
computed: { |
|
|
@ -102,20 +102,20 @@ |
|
|
this.$store.commit('getUserInfo'); |
|
|
this.$store.commit('getUserInfo'); |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
// 选择快捷金额 |
|
|
|
|
|
|
|
|
// 选择快捷积分 |
|
|
selectQuickAmount(amount) { |
|
|
selectQuickAmount(amount) { |
|
|
if (amount > parseFloat(this.userInfo.price)) return; |
|
|
|
|
|
|
|
|
if (amount > parseFloat(this.userInfo.money)) return; |
|
|
this.withdrawAmount = amount.toString(); |
|
|
this.withdrawAmount = amount.toString(); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 选择全部金额 |
|
|
|
|
|
|
|
|
// 选择全部积分 |
|
|
selectAllAmount() { |
|
|
selectAllAmount() { |
|
|
if (this.userInfo.price) { |
|
|
|
|
|
this.withdrawAmount = parseFloat(this.userInfo.price).toString(); |
|
|
|
|
|
|
|
|
if (this.userInfo.money) { |
|
|
|
|
|
this.withdrawAmount = parseFloat(this.userInfo.money).toString(); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 金额输入处理 |
|
|
|
|
|
|
|
|
// 积分输入处理 |
|
|
onAmountInput(e) { |
|
|
onAmountInput(e) { |
|
|
let value = e.detail.value; |
|
|
let value = e.detail.value; |
|
|
// 只允许输入数字和小数点 |
|
|
// 只允许输入数字和小数点 |
|
|
@ -132,11 +132,11 @@ |
|
|
this.withdrawAmount = value; |
|
|
this.withdrawAmount = value; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 验证提现金额 |
|
|
|
|
|
|
|
|
// 验证提现积分 |
|
|
validateAmount() { |
|
|
validateAmount() { |
|
|
if (!this.withdrawAmount) { |
|
|
if (!this.withdrawAmount) { |
|
|
uni.showToast({ |
|
|
uni.showToast({ |
|
|
title: '请输入提现金额', |
|
|
|
|
|
|
|
|
title: '请输入提现积分', |
|
|
icon: 'none' |
|
|
icon: 'none' |
|
|
}); |
|
|
}); |
|
|
return false; |
|
|
return false; |
|
|
@ -145,25 +145,25 @@ |
|
|
const amount = parseFloat(this.withdrawAmount); |
|
|
const amount = parseFloat(this.withdrawAmount); |
|
|
if (isNaN(amount) || amount <= 0) { |
|
|
if (isNaN(amount) || amount <= 0) { |
|
|
uni.showToast({ |
|
|
uni.showToast({ |
|
|
title: '请输入正确的提现金额', |
|
|
|
|
|
|
|
|
title: '请输入正确的提现积分', |
|
|
icon: 'none' |
|
|
icon: 'none' |
|
|
}); |
|
|
}); |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 检查提现金额是否超过可用余额 |
|
|
|
|
|
if (this.userInfo.price && amount > parseFloat(this.userInfo.price)) { |
|
|
|
|
|
|
|
|
// 检查提现积分是否超过可用余额 |
|
|
|
|
|
if (this.userInfo.money && amount > parseFloat(this.userInfo.money)) { |
|
|
uni.showToast({ |
|
|
uni.showToast({ |
|
|
title: '提现金额不能超过可用余额', |
|
|
|
|
|
|
|
|
title: '提现积分不能超过可用余额', |
|
|
icon: 'none' |
|
|
icon: 'none' |
|
|
}); |
|
|
}); |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 检查最小提现金额(假设最小提现1元) |
|
|
|
|
|
|
|
|
// 检查最小提现积分(假设最小提现1元) |
|
|
if (amount < 1) { |
|
|
if (amount < 1) { |
|
|
uni.showToast({ |
|
|
uni.showToast({ |
|
|
title: '最小提现金额为1元', |
|
|
|
|
|
|
|
|
title: '最小提现积分为1元', |
|
|
icon: 'none' |
|
|
icon: 'none' |
|
|
}); |
|
|
}); |
|
|
return false; |
|
|
return false; |
|
|
@ -176,7 +176,7 @@ |
|
|
submitWithdraw() { |
|
|
submitWithdraw() { |
|
|
if (this.isSubmitting) return; |
|
|
if (this.isSubmitting) return; |
|
|
|
|
|
|
|
|
// 验证提现金额 |
|
|
|
|
|
|
|
|
// 验证提现积分 |
|
|
if (!this.validateAmount()) return; |
|
|
if (!this.validateAmount()) return; |
|
|
|
|
|
|
|
|
// 确认提现 |
|
|
// 确认提现 |
|
|
|