feat: 添加支付密码

This commit is contained in:
anonymous
2025-01-17 12:04:14 +08:00
parent 0cb7e1db1b
commit 3c06859b33
8 changed files with 193 additions and 5 deletions
+2 -2
View File
@@ -24,9 +24,9 @@
</view>
<view class="mt-50">
<view class="text-14 text-#333">支付密码</view>
<view class="text-14 text-#333">提现密码</view>
<view class="text-14 mt-15 text-#333 p-16 shadow-[0_0_10px_rgba(10,68,245,0.1)] rounded-10">
<input type="password" placeholder="请输入支付密码" class="text-14 text-#333" />
<input type="password" placeholder="请输入提现密码" class="text-14 text-#333" />
</view>
</view>
</view>
+136
View File
@@ -0,0 +1,136 @@
<route lang="json5">
{
style: {
navigationBarTitleText: '设置提现密码',
navigationStyle: 'custom',
},
notNeedLogin: true,
}
</route>
<template>
<view class="login-container relative">
<NavBar title-color="#333" />
<view class="pt-45">
<view class="mx-15 px-15 shadow-[0_0_10px_rgba(10,68,245,0.1)] rounded-10">
<template v-if="userStore.userInfo.tixianpass">
<view class="flex items-center py-15">
<view class="text-gradient">姓名</view>
<input
v-model="form.realname"
placeholder-class="text-#889BC6"
type="text"
class="text-right flex-1 text-14"
placeholder="请输入姓名"
/>
</view>
<view class="flex items-center py-15">
<view class="text-gradient">身份证号</view>
<input
v-model="form.cardnum"
placeholder-class="text-#889BC6"
type="text"
class="text-right flex-1 text-14"
placeholder="请输入身份证号"
/>
</view>
</template>
<view class="flex items-center py-15">
<view class="text-gradient">提现密码</view>
<input
v-model="form.tixianpass"
placeholder-class="text-#889BC6"
type="password"
class="text-right flex-1 text-14"
placeholder="请输入提现密码"
/>
</view>
<view class="flex items-center py-15">
<view class="text-gradient">确认提现密码</view>
<input
v-model="form.confirmtixianpass"
placeholder-class="text-#889BC6"
type="password"
class="text-right flex-1 text-14"
placeholder="请再次输入提现密码"
/>
</view>
</view>
<view
class="mt-50 text-center py-12 rounded-full mx-15 text-15 text-white btn-gradient"
@click="handleRegister"
>
确认
</view>
</view>
</view>
</template>
<script lang="ts" setup>
import NavBar from '@/components/NavBar.vue'
import { isLogged } from '@/interceptors/route'
import { setWithdrawalPasswordAPI, resetForgetWithdrawalPasswordAPI } from '@/service'
import { useUserStore } from '@/store/user'
import { mergeStep, showModal } from '@/utils'
const userStore = useUserStore()
const form = ref({
tixianpass: '',
confirmtixianpass: '',
realname: '',
cardnum: '',
})
let redirect = '/'
onLoad((options) => {
redirect = options.redirect ?? '/'
})
const handleRegister = mergeStep(async () => {
const isReset = !!userStore.userInfo.tixianpass
if (!form.value.realname && isReset) {
uni.showToast({
title: '请输入姓名',
icon: 'none',
})
return
}
if (!form.value.cardnum && isReset) {
uni.showToast({
title: '请输入身份证号',
icon: 'none',
})
return
}
if (!form.value.tixianpass) {
uni.showToast({
title: '请输入提现密码',
icon: 'none',
})
return
}
if (form.value.tixianpass !== form.value.confirmtixianpass) {
uni.showToast({
title: '两次输入的密码不一致',
icon: 'none',
})
return
}
const request = isReset ? resetForgetWithdrawalPasswordAPI : setWithdrawalPasswordAPI
const res = await request(form.value)
await showModal(res.msg ? res.msg : '设置成功')
uni.navigateBack({})
})
</script>
<style lang="scss" scoped>
.login-container {
box-sizing: border-box;
min-height: 100vh;
padding-bottom: 50px;
background-image: url('@/static/images/login-bg.jpg');
background-repeat: no-repeat;
background-size: cover;
}
</style>
+27
View File
@@ -47,6 +47,18 @@
</view>
</view>
<view class="mt-15 text-14 text-#333">提现密码</view>
<view
class="flex items-center text-14 mt-15 text-#333 p-16 shadow-[0_0_10px_rgba(10,68,245,0.1)] rounded-10"
>
<input
v-model="form.tixianpass"
type="password"
placeholder="请输入提现密码"
class="text-14 text-#333 flex-1"
/>
</view>
<view class="text-14 text-#889BC6 mt-30">提现说明TIPS</view>
<view class="text-12 text-#889BC6 mt-15">
<view>1如遇到系统结算繁忙结算将会延迟到账</view>
@@ -78,6 +90,7 @@ const userStore = useUserStore()
const form = ref({
money: '',
tixianpass: '',
})
const onWithdrawalDetail = () => {
@@ -105,6 +118,20 @@ const onSubmit = async () => {
})
}
if (!currentBank.value) {
return uni.showToast({
title: '请选择收款方式',
icon: 'none',
})
}
if (!form.value.tixianpass) {
return uni.showToast({
title: '请输入提现密码',
icon: 'none',
})
}
await showModal('确认提现?')
const res = await submitWithdrawalAPI(form.value)
await showModal(res.msg ? res.msg : '提交成功')
+9
View File
@@ -231,6 +231,15 @@
"navigationStyle": "custom"
}
},
{
"path": "pay-password/index",
"type": "page",
"style": {
"navigationBarTitleText": "设置提现密码",
"navigationStyle": "custom"
},
"notNeedLogin": true
},
{
"path": "realname/index",
"type": "page",
+2 -2
View File
@@ -60,7 +60,7 @@
placeholder-class="text-#889BC6"
type="password"
class="text-right flex-1 text-14"
placeholder="请输入支付密码"
placeholder="请输入提现密码"
/>
</view>
<view class="flex items-center py-15">
@@ -69,7 +69,7 @@
placeholder-class="text-#889BC6"
type="password"
class="text-right flex-1 text-14"
placeholder="请再次输入支付密码"
placeholder="请再次输入提现密码"
/>
</view>
</view>
+1 -1
View File
@@ -170,7 +170,7 @@ const commonList = [
handle: handleWithdrawalDetail,
},
{
title: '支付密码',
title: '提现密码',
icon: CommonIcon3,
handle: handlePayPassword,
},
+15
View File
@@ -229,3 +229,18 @@ export const getBankCardRecoverAPI = (data) =>
method: 'POST',
data,
})
// 设置提现密码
export const setWithdrawalPasswordAPI = (data) =>
http({
url: '/api/user/settixianpass',
method: 'POST',
data,
})
// 忘记提现密码
export const resetForgetWithdrawalPasswordAPI = (data) =>
http({
url: '/api/user/forgettixianpass',
method: 'POST',
data,
})
+1
View File
@@ -25,6 +25,7 @@ interface NavigateToOptions {
"/pages-sub/news/index" |
"/pages-sub/news-detail/index" |
"/pages-sub/official-community/index" |
"/pages-sub/pay-password/index" |
"/pages-sub/realname/index" |
"/pages-sub/team/index" |
"/pages-sub/withdrawal/index" |