first commit
This commit is contained in:
137
pages/bank/addBankCard.vue
Normal file
137
pages/bank/addBankCard.vue
Normal file
@@ -0,0 +1,137 @@
|
||||
<template>
|
||||
<view class="addBankCard p30">
|
||||
<view style="height: 30rpx"></view>
|
||||
<view>
|
||||
<view class="addBankCard_input_tit">请输入{{ enterprise.role == 1 ? '姓名' : '企业名称' }}:</view>
|
||||
<view class="addBankCard_input">
|
||||
<up-input :border="false" placeholder="请输入" v-model="enterprise.realname"></up-input>
|
||||
</view>
|
||||
|
||||
<!-- <view v-if="enterprise.type == 2">
|
||||
<view class="addBankCard_input_tit">请输入纳税人识别号:</view>
|
||||
<view class="addBankCard_input">
|
||||
<up-input :border="false" placeholder="请输入" v-model="enterprise.taxNo"></up-input>
|
||||
</view>
|
||||
</view> -->
|
||||
<view v-if="enterprise.role == 1">
|
||||
<view class="addBankCard_input_tit">请输入手机号:</view>
|
||||
<view class="addBankCard_input">
|
||||
<up-input :border="false" placeholder="请输入" v-model="enterprise.mobile"></up-input>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="enterprise.role == 1">
|
||||
<view class="addBankCard_input_tit">请输入身份证号:</view>
|
||||
<view class="addBankCard_input">
|
||||
<up-input :border="false" placeholder="请输入" v-model="enterprise.idcard"></up-input>
|
||||
</view>
|
||||
</view>
|
||||
<!--
|
||||
<view class="addBankCard_input_tit">请输入开户行名称:</view>
|
||||
<view class="addBankCard_input">
|
||||
<up-input :border="false" placeholder="请输入" v-model="enterprise.bankName"></up-input>
|
||||
</view> -->
|
||||
<view class="addBankCard_input_tit" v-if="enterprise.role == 2">请输入开户行:</view>
|
||||
<view class="addBankCard_input" v-if="enterprise.role == 2">
|
||||
<up-input :border="false" placeholder="请输入" v-model="enterprise.subname"></up-input>
|
||||
</view>
|
||||
<view class="addBankCard_input_tit">请输入银行卡卡号:</view>
|
||||
<view class="addBankCard_input">
|
||||
<up-input :border="false" placeholder="请输入" v-model="enterprise.num"></up-input>
|
||||
</view>
|
||||
</view>
|
||||
<view style="margin: 30rpx 0">
|
||||
<view style="font-size: 28rpx; color: coral">请仔细核对信息,填写错误会导致提现失败。</view>
|
||||
</view>
|
||||
|
||||
<view style="display: flex; justify-content: center">
|
||||
<view class="addBankCard_btn" @click="addBank">确定</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { addUsersAccountInfo, smsCode } from '@/api/api.js';
|
||||
let tips = ref('');
|
||||
let uCode = ref(null);
|
||||
let codeChange2 = (text) => {
|
||||
tips.value = text;
|
||||
};
|
||||
|
||||
let enterprise = reactive({
|
||||
role: 1
|
||||
});
|
||||
|
||||
onLoad((options) => {
|
||||
enterprise.role = options.role;
|
||||
});
|
||||
|
||||
let getCode2 = () => {
|
||||
if (!enterprise.phone) return uni.showToast({ title: '请输入手机号', icon: 'none' });
|
||||
if (uCode.value.canGetCode) {
|
||||
// 模拟向后端请求验证码
|
||||
uni.showLoading({
|
||||
title: '正在获取验证码'
|
||||
});
|
||||
smsCode({
|
||||
phone: enterprise.phone
|
||||
}).then((res) => {
|
||||
uni.hideLoading();
|
||||
uni.$u.toast('验证码已发送');
|
||||
uCode.value.start();
|
||||
});
|
||||
} else {
|
||||
uni.$u.toast('倒计时结束后再发送');
|
||||
}
|
||||
};
|
||||
|
||||
let addBank = async () => {
|
||||
// if (enterprise.type == 2) {
|
||||
// enterprise.taxNo = '';
|
||||
// enterprise.bankName = '';
|
||||
// } else {
|
||||
// enterprise.bankName = '';
|
||||
// }
|
||||
|
||||
let _res = await addUsersAccountInfo(enterprise);
|
||||
uni.showToast({ title: '添加成功', icon: 'none' });
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 1500);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.addBankCard {
|
||||
// @include flex();
|
||||
&_input {
|
||||
width: 690rpx;
|
||||
height: 70rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||||
@include flex;
|
||||
margin-bottom: 30rpx;
|
||||
padding: 0 30rpx;
|
||||
|
||||
&_tit {
|
||||
width: 100%;
|
||||
font-weight: bold;
|
||||
font-size: 26rpx;
|
||||
color: #232323;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
}
|
||||
|
||||
&_btn {
|
||||
width: 488rpx;
|
||||
height: 86rpx;
|
||||
background: #4874e5;
|
||||
border-radius: 44rpx 44rpx 44rpx 44rpx;
|
||||
@include flex($space: center);
|
||||
font-weight: bold;
|
||||
font-size: 28rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
127
pages/bank/bank.vue
Normal file
127
pages/bank/bank.vue
Normal file
@@ -0,0 +1,127 @@
|
||||
<template>
|
||||
<view class="bankCard">
|
||||
<z-paging ref="paging" v-model="dataList" @query="queryList">
|
||||
<view class="p30">
|
||||
<view class="bankCard_add" @click="addBank">
|
||||
<up-icon name="plus" color="#333" size="28"></up-icon>
|
||||
<view style="font-size: 26rpx; color: #333; margin-top: 15rpx">添加银行卡</view>
|
||||
</view>
|
||||
</view>
|
||||
<view style="height: 30rpx"></view>
|
||||
<view v-for="(item, index) in dataList" :key="index" @click="bankSele(item)">
|
||||
<view class="p30">
|
||||
<view style="background-color: #ffffff; border-radius: 12rpx; padding: 20rpx; margin-bottom: 20rpx">
|
||||
<view class="u-flex u-flex-y-center" style="font-size: 28rpx">
|
||||
<view>
|
||||
<u-tag :text="item.role == 1 ? '个人' : '企业'" size="mini" :type="item.role == 1 ? 'success' : 'error'" plain plainFill></u-tag>
|
||||
</view>
|
||||
<view style="width: 30rpx"></view>
|
||||
<view style="font-size: 26rpx">{{ item.realname }}</view>
|
||||
<view style="width: 30rpx"></view>
|
||||
<view style="font-size: 26rpx">{{ item.mobile || '' }}</view>
|
||||
</view>
|
||||
<view style="height: 20rpx"></view>
|
||||
<view style="color: #232323">
|
||||
<!-- <view style="font-size: 28rpx">开户行:{{ item.bankName }}</view>
|
||||
<view style="height: 10rpx"></view> -->
|
||||
<view style="font-size: 28rpx" v-if="item.role == 2">开户行:{{ item.subname }}</view>
|
||||
<view style="height: 10rpx"></view>
|
||||
<view style="font-size: 28rpx">银行卡号:{{ item.num }}</view>
|
||||
<view style="height: 10rpx"></view>
|
||||
<!-- <view style="font-size: 28rpx" v-if="item.type == 2 && item.taxNo">纳税人识别号:{{ item.taxNo}}</view>
|
||||
<view style="height: 10rpx"></view> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</z-paging>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref } from 'vue';
|
||||
import { getUsersAccountInfo } from '@/api/api.js';
|
||||
import { onShow, onLoad } from '@dcloudio/uni-app';
|
||||
|
||||
const paging = ref(null);
|
||||
let dataList = ref([]);
|
||||
let numiNDE = ref(1);
|
||||
let role = ref('');
|
||||
const type = ref("");
|
||||
|
||||
onShow(() => {
|
||||
if (numiNDE.value != 1) {
|
||||
paging.value.reload();
|
||||
}
|
||||
numiNDE.value++;
|
||||
});
|
||||
|
||||
onLoad((options) => {
|
||||
type.value = options.type;
|
||||
});
|
||||
|
||||
let addBank = () => {
|
||||
uni.showActionSheet({
|
||||
itemList: ['个人', '企业'],
|
||||
success: (res) => {
|
||||
if(res.tapIndex + 1 == 0){
|
||||
console.log('选中了第' + (res.tapIndex + 1) + '个按钮');
|
||||
}else{
|
||||
uni.navigateTo({
|
||||
url: `/pages/bank/addBankCard?role=${res.tapIndex + 1}`
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: function (res) {
|
||||
console.log(res.errMsg);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const queryList = (pageNo, pageSize) => {
|
||||
const params = {
|
||||
current: pageNo,
|
||||
pageSize: pageSize
|
||||
};
|
||||
getUsersAccountInfo(params)
|
||||
.then((res) => {
|
||||
paging.value.complete(res);
|
||||
})
|
||||
.catch((res) => {
|
||||
paging.value.complete(false);
|
||||
});
|
||||
};
|
||||
|
||||
function maskCardNumber(cardNumber) {
|
||||
if (!cardNumber || typeof cardNumber !== 'string') {
|
||||
throw new Error('Invalid card number');
|
||||
}
|
||||
const sanitizedNumber = cardNumber.replace(/\D/g, '');
|
||||
if (sanitizedNumber.length < 4) {
|
||||
throw new Error('Card number is too short');
|
||||
}
|
||||
const lastFourDigits = sanitizedNumber.slice(-4);
|
||||
const maskedNumber = '*'.repeat(sanitizedNumber.length - 4) + lastFourDigits;
|
||||
return maskedNumber;
|
||||
}
|
||||
|
||||
let bankSele = (e) => {
|
||||
if (type.value) {
|
||||
uni.$emit('bank', e);
|
||||
uni.navigateBack();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.bankCard {
|
||||
&_add {
|
||||
width: 690rpx;
|
||||
height: 174rpx;
|
||||
background: #eeeeee;
|
||||
border-radius: 16rpx 16rpx 16rpx 16rpx;
|
||||
@include flex($direction: column, $space: center);
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user