Files
kangyuan-mobile/pages/home/pay/withdraw1.vue
T
2026-05-26 15:52:30 +08:00

194 lines
4.8 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<s-layout :bgStyle="{ color: 'var(--color1)' }" title="提现">
<view class="pages p-y-28 p-x-40 c0">
<view class="bg24 radius12 m-b-32 p-y-30 p-x-28">
<view class="title c0">收款人</view>
<view
class="flex-center border-bottom"
style="height: 100rpx"
v-for="(v, i) in list"
:key="i"
>
<view class="c0">{{ v.title }}</view>
<uni-easyinput
style="text-align: right"
class="flex1"
v-model="dataObj[v.value]"
:type="v.type || 'text'"
:placeholder="v.placeholder"
:inputBorder="false"
/>
</view>
</view>
<view class="bg24 radius12 p-y-30 p-x-28 card2 pay">
<view class="weight500 c0">提现金额</view>
<view class="m-b-26 flex-row border-bottom"
><span class="size92 m-r-32">¥</span
><uni-easyinput
class="flex1"
v-model="dataObj.price"
type="number"
placeholder=""
placeholder-style="font-size: 92rpx;"
@confirm="submit"
:inputBorder="false"
:min="0"
@blur="blur"
:clearSize="50"
/></view>
<view class="m-b-12 c0">
当前可提现<span>{{ point }}</span
>元, <span class="c3" @click="dataObj.price = point">全部提现</span>
</view>
<view></view>
</view>
<view class="size24 m-t-36 m-b-74">
<view class="m-b-24"> <span class="c_FF2D2D">*</span>最低提现金额为0元 </view>
<view class="c0">
<span class="c_FF2D2D">*</span>提现费率为0%,最低收取0元,最高收取0元
</view>
</view>
<view class="submit-btn" @click="submit">提现</view>
</view>
</s-layout>
</template>
<script setup>
import { ref, getCurrentInstance } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import * as api from '@/sheep/api/home/pay';
import sheep from '@/sheep';
const { proxy } = getCurrentInstance();
let list = ref([
{
title: '姓名',
value: 'userName',
placeholder: '请输入姓名',
},
{
title: '账号',
value: 'userAccount',
type: 'number',
placeholder: '请输入银行账号',
},
{
title: '银行',
value: 'bankName',
placeholder: '请输入银行名称',
},
]);
let dataObj = ref({
type: 1,
transferChannelCode: 'wx_lite',
price: 0,
});
let point = ref(0);
const getData = () => {
api.getWallet().then((res) => {
if (res.code === 0) {
point.value = proxy.$fen2yuan(res.data.balance);
}
});
};
const submit = () => {
if (dataObj.value.price > point.value) {
sheep.$helper.toast('提现金额不能大于可提现金额');
dataObj.value.price = point.value;
return;
}
if (!dataObj.value.userName) {
sheep.$helper.toast('请输入姓名');
return;
}
if (!dataObj.value.userAccount) {
sheep.$helper.toast('请输入账号账号');
return;
}
if (!dataObj.value.bankName) {
sheep.$helper.toast('请输入银行名称');
return;
}
if (!dataObj.value.price) {
sheep.$helper.toast('请输入提现金额');
return;
}
let obj = JSON.parse(JSON.stringify(dataObj.value));
obj.price = obj.price * 100;
api.createBrokerageWithdraw(obj).then((res) => {
if (res.code === 0) {
dataObj.value = {
type: 2,
transferChannelCode: 'wx_lite',
price: 0,
};
getData();
}
console.log(res);
});
};
const blur = () => {
if (dataObj.value.price < 0) {
sheep.$helper.toast('提现金额不能小于0');
dataObj.value.price = 0;
return;
}
if (dataObj.value.price > point.value) {
sheep.$helper.toast('提现金额不能大于可提现金额');
dataObj.value.price = point.value;
return;
}
};
onShow(() => {
getData();
});
</script>
<style scoped lang="scss">
.bc_white {
background-color: #fff;
}
:deep(.uni-icons) {
font-size: 24rpx !important;
}
.pay {
:deep(.uni-easyinput__content) {
height: 108rpx;
font-size: 92rpx;
}
:deep(.uni-easyinput__content-input) {
height: 108rpx;
font-size: 92rpx;
}
:deep(.uni-easyinput__placeholder-class) {
font-size: 92rpx;
}
}
:deep(.uni-input-input) {
color: #ffffff;
}
.infotext {
height: 62rpx;
background: #f2f2f2;
border-radius: 12rpx;
}
.c_FA7E31 {
color: #fa7e31;
}
.c_FF2D2D {
color: #ff2d2d;
}
.c_666 {
color: #666;
}
.size92 {
font-size: 92rpx;
}
:deep(.uniui-left) {
font-size: 44rpx !important;
}
:deep(.uni-icons) {
font-size: 44rpx !important;
}
</style>