purchase-let/pageQuota/Balance/bindAccout.vue

235 lines
6.1 KiB
Vue
Raw Normal View History

2024-05-11 16:43:09 +08:00
<template>
<view class="content">
2024-05-13 18:05:23 +08:00
<view class="action">
<view class="">
提现至
</view>
<view style="font-weight: bold;">
2024-05-15 10:40:23 +08:00
{{form.is_own}}
2024-05-13 18:05:23 +08:00
<!-- 请选择提现账户 -->
{{form.is_own?'对公账户':'个人账户'}}
</view>
<view style="display: flex;align-items: center;color: #20B128;" @click="showPop1=true">
2024-05-14 22:36:29 +08:00
<text>账户绑定</text> <up-icon color="#20B128" name="arrow-right"></up-icon>
2024-05-13 18:05:23 +08:00
</view>
2024-05-11 16:43:09 +08:00
</view>
2024-05-13 18:05:23 +08:00
<view class="form">
2024-05-14 22:36:29 +08:00
<up-form labelPosition="left" borderBottom :label-style="{fontSize:'30rpx'}" labelWidth='70'>
2024-05-13 18:05:23 +08:00
<up-form-item label="开户银行" prop="userInfo.name" borderBottom ref="item1" @click="showPop=true">
2024-05-15 10:40:23 +08:00
<text style="padding-left: 20rpx;" v-if="form.bank_name">{{form.bank_name}}</text>
2024-05-13 18:05:23 +08:00
<text v-else style="color: #20B128;padding-left: 20rpx;">点击选择开户银行</text>
</up-form-item>
<up-form-item label="账户名称" prop="userInfo.name" borderBottom ref="item1">
<up-input style="border: none;" v-model="form.name" placeholder="请输入账户名称" />
</up-form-item>
<up-form-item label="银行账号" prop="userInfo.name" borderBottom ref="item1">
<up-input maxlength="19" style="border: none;" v-model="form.bank_code" type='number'
placeholder="请输入银行账号" />
</up-form-item>
<up-form-item label="开户网点" prop="userInfo.name" borderBottom ref="item1">
<up-input style="border: none;" v-model="form.bank_branch" placeholder="请输入开户网点" />
</up-form-item>
<up-form-item v-if="!form.is_own" label="身份证" prop="userInfo.name" borderBottom ref="item1">
<up-input style="border: none;" v-model="form.id_card" placeholder="请输入身份证" />
</up-form-item>
<up-form-item v-if="!form.is_own" label="电话" prop="userInfo.name" borderBottom ref="item1">
<up-input style="border: none;" v-model="form.phone" placeholder="请输入电话" />
</up-form-item>
</up-form>
</view>
2024-05-16 18:03:25 +08:00
<view class="" style="margin-top: 20rpx;color: red;" v-if="false">
审核失败,请重新提交审核
</view>
2024-05-13 18:05:23 +08:00
<view class="submit-btn">
<up-button text="提交绑定" @click="submit" shape="circle" color="#50C758"></up-button>
</view>
<up-popup :show="showPop" :round="10" mode="bottom" @close="showPop=false" @open="showPop=true">
<view class="popContent">
<view style="text-align: center;font-weight: bold;">请选择银行</view>
<up-icon name="close" color="#303133" size="24" @click="showPop=false"
style="position: absolute;top: 20rpx;right: 20rpx;"></up-icon>
<view class="bank-list">
<view class="bank-li" v-for="item in bankList" :key='item.id' @click="choseBank(item)">
<up-image :show-loading="true" :src="item.image" width="60rpx" height="60rpx"></up-image>
<text style="margin-left: 20rpx;">{{item.name}}</text>
</view>
</view>
</view>
</up-popup>
<up-popup :show="showPop1" :round="10" mode="bottom" @close="showPop1=false" @open="showPop1=true">
<view class="popContent">
<view style="text-align: center;font-weight: bold;">请选择提现账户</view>
<up-icon name="close" color="#303133" size="24" @click="showPop1=false"
style="position: absolute;top: 20rpx;right: 20rpx;"></up-icon>
<view class="bank-list">
2024-05-14 22:36:29 +08:00
<view class="bank-li" @click="choseAccount(0)">
2024-05-13 18:05:23 +08:00
<text>个人账户</text>
</view>
2024-05-14 22:36:29 +08:00
<view class="bank-li" @click="choseAccount(1)">
2024-05-13 18:05:23 +08:00
<text>对公账户</text>
</view>
</view>
</view>
</up-popup>
2024-05-11 16:43:09 +08:00
</view>
</template>
2024-05-13 18:05:23 +08:00
<script setup>
import {
bankListApi,
2024-05-14 22:36:29 +08:00
bindCradApi,
amountAccountApi
2024-05-13 18:05:23 +08:00
} from "@/api/balance.js"
2024-05-16 18:03:25 +08:00
import {
onPullDownRefresh
} from "@dcloudio/uni-app"
2024-05-13 18:05:23 +08:00
import {
ref,
reactive
} from 'vue';
2024-05-14 15:18:50 +08:00
import useUserStore from '@/store/user';
const userStore = useUserStore();
2024-05-13 18:05:23 +08:00
const showPop = ref(false)
const showPop1 = ref(false)
const bankList = ref([])
const getBankList = async () => {
let res = await bankListApi()
bankList.value = res.data.lists
}
2024-05-14 22:36:29 +08:00
const bank_list = ref([])
2024-05-16 18:03:25 +08:00
const getBanlance = (refresh) => {
2024-05-14 22:36:29 +08:00
amountAccountApi().then(res => {
bank_list.value = res.data.bank_list
getFormData(form, res.data.bank_list[0])
2024-05-16 18:03:25 +08:00
if (refresh) {
uni.stopPullDownRefresh();
}
2024-05-14 22:36:29 +08:00
})
}
getBanlance()
const form = reactive({
"name": "",
"bank_id": 1,
"bank_name": '',
"bank_code": "",
"bank_branch": "",
"financial_img": "",
"is_own": 0,
phone: '',
"id_card": "",
"mer_id": userStore?.userInfo?.merchant?.mer_id,
supplier_id: userStore?.userInfo?.supplier?.id,
user_type: userStore?.userInfo?.merchant?.mer_id ? '1' : '2'
})
const getFormData = (form, target) => {
2024-05-15 10:40:23 +08:00
if (!target) {
form.value = {}
return
}
2024-05-14 22:36:29 +08:00
form.name = target.name || ''
form.bank_id = target.bank_id || ''
form.bank_name = target.bank_name || ''
form.bank_code = target.bank_code || ''
form.bank_branch = target.bank_branch || ''
form.phone = target.phone || ''
form.id_card = target.id_card || ''
form.is_own = target.is_own
}
const choseAccount = (type) => {
getFormData(form, bank_list.value[type])
2024-05-15 10:40:23 +08:00
form.is_own = type
2024-05-14 22:36:29 +08:00
showPop1.value = false
}
2024-05-13 18:05:23 +08:00
const choseBank = (item) => {
form.bank_name = item.name
form.bank_id = item.id
showPop.value = false
}
const navgo = (url) => {
uni.navigateTo({
url
})
}
2024-05-14 22:36:29 +08:00
2024-05-13 18:05:23 +08:00
const submit = () => {
bindCradApi({
...form
}).then(res => {
uni.navigateBack()
}).catch(err => {
console.log(err)
})
}
getBankList()
2024-05-16 18:03:25 +08:00
onPullDownRefresh(() => {
getBanlance(true)
// getBanlance(true)
})
2024-05-11 16:43:09 +08:00
</script>
2024-05-13 18:05:23 +08:00
<style lang="scss">
.content {
padding: 20rpx;
}
.popContent {
padding: 20rpx;
.bank-list {
overflow-y: auto;
position: relative;
max-height: 40vh;
.bank-li {
display: flex;
align-items: center;
justify-content: center;
padding: 20rpx;
border-bottom: 1px solid #F8F9FA;
}
}
}
.action {
background-color: white;
border-radius: 16rpx 16rpx 16rpx 16rpx;
padding: 30rpx;
display: flex;
justify-content: space-between;
margin-bottom: 30rpx;
}
.form {
padding: 28rpx 30rpx;
background-color: white;
border-radius: 20rpx;
}
.submit-btn {
position: fixed;
bottom: 146rpx;
width: 710rpx;
}
2024-05-11 16:43:09 +08:00
</style>