完善添加银行卡功能

This commit is contained in:
cbb
2025-12-27 17:52:08 +08:00
parent 20455490f8
commit 3b9b142c21
44 changed files with 3434 additions and 28 deletions

View File

@@ -0,0 +1,72 @@
<script setup>
const name = defineModel({
type: String,
default: ''
})
const props = defineProps({
/**
* 输入框状态类型
* text: 文本
* password: 密码
* number: 数字
* tel: 手机号
* email: 邮箱
*/
type: {
type: String,
default: 'text'
},
title: {
type: String,
default: '标题'
},
placeholder: {
type: String,
default: '请输入'
}
})
const placeholderStyle = `font-family: PingFang SC, PingFang SC; font-weight: 500; color: #D9D9D9; font-size: 28rpx; font-style: normal; text-transform: none;`
</script>
<template>
<view class="card-input">
<text class="title">{{ props.title }}</text>
<input
v-model="name"
:type="props.type"
:placeholder-style="placeholderStyle"
:placeholder="props.placeholder"
/>
</view>
</template>
<style lang="scss" scoped>
.card-input + .card-input {
margin-top: 16rpx;
}
.card-input {
background: #ffffff;
border-radius: 16rpx;
padding: 20rpx 32rpx;
display: flex;
justify-content: space-between;
.title {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 28rpx;
color: #333333;
text-align: left;
font-style: normal;
text-transform: none;
}
input {
width: 340rpx;
text-align: right;
font-weight: 500;
font-size: 28rpx;
color: #333333;
}
}
</style>

View File

@@ -1,8 +1,14 @@
<script setup>
import { useAuthUser } from '@/composables/useAuthUser'
import { onLoad } from '@dcloudio/uni-app'
import { navigateTo } from '@/utils/router'
const bottomList = [
{ name: '我的钱包', icon: 'wallet' },
{
name: '我的钱包',
icon: 'wallet',
url: '/pages/my-index/wallet/index'
},
{ name: '我的团队', icon: 'team' },
{ name: '会议记录', icon: 'meeting' },
{ name: '我的朋友圈', icon: 'circle' },
@@ -11,11 +17,19 @@
{ name: '系统设置', icon: 'system' }
]
const { userInfo } = useAuthUser()
onLoad(() => {
// 获取用户信息
console.log(userInfo.value, '===获取用户信息')
})
</script>
<template>
<view class="my-index">
<view class="top-info">
<view
class="top-info"
@click="navigateTo('/pages/my-index/personal-center/index')"
>
<view class="left-box">
<image
src="https://wx1.sinaimg.cn/mw690/92eeb099gy1i29hl0ne80j21jk2bcash.jpg"
@@ -38,7 +52,7 @@
<view class="top-box">
<view class="left-name">
<text>账户积分</text>
<text>2933</text>
<text>{{ userInfo?.totalPoints }}</text>
</view>
<view class="right-btn">
<button>充值</button>
@@ -50,6 +64,7 @@
v-for="(item, index) in bottomList"
:key="index"
class="item-box"
@click="item.url && navigateTo(item.url)"
>
<view class="item-name">
<image
@@ -82,7 +97,6 @@
.top-info {
padding: 32rpx 46rpx;
background: #ffffff;
height: 192rpx;
border-radius: 16rpx;
display: flex;
justify-content: space-between;

View File

@@ -0,0 +1,58 @@
<script setup>
import { useAuthUser } from '@/composables/useAuthUser'
const itemList = [
{ title: '我的二维码', key: '1', value: '' },
{ title: 'ID', key: '2', value: 'userId' },
{ title: '昵称', key: '3', value: 'userName' },
{ title: '性别', key: '4', value: '' },
{ title: '手机号码', key: '5', value: 'mobile' },
{ title: '个性签名', key: '6', value: '' }
]
const { userInfo } = useAuthUser()
</script>
<template>
<view class="personal-center">
<view class="public-card">
<view class="left-img">
<image
src="https://p4.itc.cn/images01/20220619/46660ed163164c14be90e605a73ee5e8.jpeg"
mode="aspectFill"
class="avatar"
></image>
</view>
<view class="right-box">
<text class="value">换头像</text>
<uni-icons type="right" size="16" color="#999999"></uni-icons>
</view>
</view>
<view
v-for="(item, index) in itemList"
:key="index"
class="public-card"
>
<view class="left-box">
<text>{{ item.title }}</text>
<text v-if="item.key === '6'" class="text">
这个人很懒什么也没有
</text>
</view>
<view class="right-box">
<text v-if="!['1', '6'].includes(item.key)" class="value">
{{ item.value ? userInfo[item.value] : '' }}
</text>
<uni-icons type="right" size="16" color="#999999"></uni-icons>
</view>
</view>
</view>
</template>
<style lang="scss" scoped>
@import '../styles/index.scss';
.personal-center {
padding: 32rpx 24rpx;
}
</style>

View File

@@ -0,0 +1,70 @@
page {
background: #f9f9f9;
}
.public-card + .public-card {
margin-top: 16rpx;
}
.public-card {
background: #ffffff;
border-radius: 16rpx;
padding: 20rpx 32rpx;
display: flex;
align-items: center;
justify-content: space-between;
font-family: PingFang SC, PingFang SC;
font-style: normal;
text-transform: none;
.left-box,
.left-img,
.right-box {
display: flex;
align-items: center;
}
.left-img {
.avatar {
width: 96rpx;
height: 96rpx;
border-radius: 96rpx;
margin-right: 16rpx;
}
.card {
width: 48rpx;
height: 48rpx;
margin-right: 16rpx;
}
text {
font-weight: 500;
font-size: 28rpx;
color: #333333;
}
}
.left-box {
display: flex;
flex-direction: column;
align-items: flex-start;
width: 70%;
text {
font-weight: 600;
font-size: 28rpx;
color: #333333;
}
.text {
margin-top: 8rpx;
font-size: 24rpx;
color: #999999;
}
}
.right-box {
align-items: flex-end;
.value {
font-weight: 600;
font-size: 28rpx;
color: #999999;
margin-right: 6rpx;
}
}
}

View File

@@ -0,0 +1,63 @@
<script setup>
import { onLoad } from '@dcloudio/uni-app'
import { reactive } from 'vue'
import CardInput from '../../components/card-input.vue'
const stateData = reactive({
title: '',
state: '0'
})
const formData = reactive({
// 银行卡名称
name: '',
// 开户行名称
khName: '',
// 银行卡号
cardNum: '',
// 微信/支付宝号
codeName: '',
// 图片链接
img: ''
})
onLoad(e => {
const titltData = {
0: '添加银行卡',
101: '添加支付宝账户',
102: '添加微信账户'
}[e.key]
stateData.title = titltData
stateData.state = e.key
})
</script>
<template>
<view>
<nav-bar isTopBg isPlaceholder :title="stateData.title"></nav-bar>
<view
v-if="!['101', '102'].includes(stateData.state)"
class="card-details"
>
<CardInput v-model="formData.name" title="银行名称"></CardInput>
<CardInput v-model="formData.khName" title="开户行"></CardInput>
<CardInput v-model="formData.cardNum" title="银行卡号"></CardInput>
</view>
<view v-else class="card-details">
<CardInput
v-model="formData.codeName"
:title="`${
stateData.state === '101' ? '支付宝账号' : '微信账号'
}`"
></CardInput>
</view>
</view>
</template>
<style lang="scss" scoped>
@import '../../styles/index.scss';
.card-details {
padding: 32rpx 24rpx;
}
</style>

View File

@@ -0,0 +1,56 @@
<script setup>
import { ref } from 'vue'
import { navigateTo } from '@/utils/router'
const itemList = ref([
{
title: '支付宝',
key: '101',
icon: '/static/images/my-index/zfb.png'
},
{ title: '微信', key: '102', icon: '/static/images/my-index/wx.png' }
])
const onAddCard = key => {
navigateTo('/pages/my-index/wallet/bank-card/card-details', { key })
}
</script>
<template>
<view class="bank-card">
<view
v-for="(item, index) in itemList"
:key="index"
class="public-card"
@click="onAddCard(item.key)"
>
<view class="left-img">
<image
:src="
item.icon
? item.icon
: 'https://nimg.ws.126.net/?url=http%3A%2F%2Fdingyue.ws.126.net%2F2024%2F1227%2F842e0e65j00sp543n001fd000i700iim.jpg&thumbnail=660x2147483647&quality=80&type=jpg'
"
mode="aspectFill"
class="card"
></image>
<text>{{ item.title }}</text>
</view>
<view class="right-box">
<uni-icons type="right" size="16" color="#999999"></uni-icons>
</view>
</view>
<!-- 底部按钮 -->
<bottom-view>
<cb-button @click="onAddCard('0')">+添加银行卡</cb-button>
</bottom-view>
</view>
</template>
<style lang="scss" scoped>
@import '../../styles/index.scss';
.bank-card {
padding: 38rpx 24rpx;
}
</style>

View File

@@ -0,0 +1,101 @@
<script setup>
import { reactive } from 'vue'
import CardInput from '../components/card-input.vue'
import { useUI } from '@/utils/use-ui'
import { validateTransactionPassword } from '@/utils/validate'
const { showToast } = useUI()
const formData = reactive({
// 旧密码
password: '',
// 新密码
newPassword: '',
// 确认密码
confirmPassword: ''
})
const onEdit = () => {
const passwordValue = validateTransactionPassword(
formData.password,
'旧密码'
)
if (!passwordValue.valid) {
showToast(passwordValue.message)
return
}
const newPasswordValue = validateTransactionPassword(
formData.newPassword,
'新的交易密码'
)
if (!newPasswordValue.valid) {
showToast(newPasswordValue.message)
return
}
const confirmPasswordValue = validateTransactionPassword(
formData.confirmPassword,
'确认交易密码'
)
if (!confirmPasswordValue.valid) {
showToast(confirmPasswordValue.message)
return
}
if (formData.newPassword !== formData.confirmPassword) {
showToast('两次密码不一致')
return
}
console.log('修改密码:', formData)
}
</script>
<template>
<view class="edit-password">
<nav-bar isTopBg isPlaceholder title="交易密码">
<template #right>
<text class="top-right-name" @click="onEdit">确认</text>
</template>
</nav-bar>
<view class="input-box">
<CardInput
v-model="formData.password"
title="旧密码"
type="password"
></CardInput>
<CardInput
v-model="formData.newPassword"
title="设置新的交易密码"
type="password"
></CardInput>
<CardInput
v-model="formData.confirmPassword"
title="重复新的交易密码"
type="password"
></CardInput>
</view>
</view>
</template>
<style lang="scss" scoped>
@import '../styles/index.scss';
.top-right-name {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 28rpx;
color: #ffffff;
text-align: center;
font-style: normal;
text-transform: none;
background: #00d993;
padding: 6rpx 20rpx;
border-radius: 8rpx;
}
.input-box {
padding: 32rpx 24rpx;
}
</style>

View File

@@ -0,0 +1,125 @@
<script setup>
import { navigateTo } from '@/utils/router'
const itemList = [
{
title: '提现卡',
key: '1',
url: '/pages/my-index/wallet/bank-card/index'
},
{ title: '交易记录', key: '2', url: '' },
{
title: '修改支付密码',
key: '3',
url: '/pages/my-index/wallet/edit-password'
},
{ title: '实名认证', key: '4', url: '' }
]
</script>
<template>
<view class="wallet">
<!-- 顶部样式 -->
<view class="top-card">
<view class="left-box">
<text>我的资产</text>
<text>2222</text>
</view>
<view class="right-box">
<button>充值</button>
<button>提现</button>
</view>
</view>
<view
v-for="(item, index) in itemList"
:key="index"
class="public-card"
@click="item.url && navigateTo(item.url)"
>
<view class="left-box">
<text>{{ item.title }}</text>
</view>
<view class="right-box">
<uni-icons type="right" size="16" color="#999999"></uni-icons>
</view>
</view>
</view>
</template>
<style lang="scss" scoped>
@import '../styles/index.scss';
.wallet {
padding: 32rpx 24rpx;
}
.top-card {
padding: 36rpx;
margin-bottom: 48rpx;
background: #ff4c54;
border-radius: 32rpx;
display: flex;
align-items: center;
justify-content: space-between;
position: relative;
font-family: PingFang SC, PingFang SC;
font-style: normal;
text-transform: none;
&::after {
width: 100%;
height: 100%;
right: 54rpx;
content: '';
position: absolute;
background: url('/static/images/my-index/wallet-bg.png');
background-size: 30%;
background-position: center;
background-repeat: no-repeat;
z-index: 1;
pointer-events: none;
}
.left-box {
display: flex;
flex-direction: column;
text {
font-weight: 500;
font-size: 28rpx;
color: #ffffff;
margin-bottom: 8rpx;
&:last-child {
font-weight: bold;
font-size: 64rpx;
text-align: left;
}
}
}
.right-box {
display: flex;
align-items: center;
button {
width: 128rpx;
height: 64rpx;
line-height: 64rpx;
border-radius: 100rpx 100rpx 100rpx 100rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 28rpx;
color: #ffffff;
text-align: center;
font-style: normal;
text-transform: none;
background: transparent;
border: 2rpx solid #ffffff;
&::after {
border: none;
}
&:last-child {
margin-left: 16rpx;
background: #ffffff;
color: #eb1c26;
border: none;
}
}
}
}
</style>