完成发现,个人中心

This commit is contained in:
cbb
2026-01-06 16:35:57 +08:00
parent 07cd0f6b37
commit 578eafafa1
23 changed files with 740 additions and 61 deletions

View File

@@ -11,6 +11,10 @@
const formData = reactive({
type: '1'
})
const onTop = id => {
formData.type = id
}
</script>
<template>
@@ -83,6 +87,7 @@
<style lang="scss" scoped>
// @import './styles/public.scss';
@import '@/styles/top-selector.scss';
.comment-box {
padding: 32rpx 24rpx;
.card-box {

View File

@@ -4,7 +4,13 @@
import { reactive, ref } from 'vue'
import { formatRMB } from '@/utils'
import { getUserAddress } from '@/api'
import { getUserPayPwd } from '@/api/my-index'
import { navigateTo, redirectTo } from '@/utils/router'
import { useUI } from '@/utils/use-ui'
import { useUserStore } from '@/stores/user'
const { showToast, showDialog } = useUI()
const { refreshUserInfo } = useUserStore()
const viewData = ref({})
@@ -33,13 +39,13 @@
state: false,
loading: true
})
const tixian = ref(null)
/** 获取用户地址 */
const userRess = async () => {
topRessData.loading = true
const res = await getUserAddress({ pageNum: 1, pageSize: 99 }, false)
const data = res.rows.find(v => v.defaultAddress == 1)
console.log(data, '地址数据===')
topRessData.state = !data?.id
topRessData.name = data?.name || ''
topRessData.houseNum = data?.houseNum || ''
@@ -81,13 +87,33 @@
// 提交订单
const onConfirm = async () => {
if (!topRessData.id) {
showToast(`请选择地址`)
return
}
const res = await getUserPayPwd()
if (res?.data) {
tixian.value.open()
} else {
const show = await showDialog('提示', '请先设置支付密码')
if (show) {
navigateTo('/pages/my-index/wallet/edit-password', { type: 0 })
}
}
}
const submit = async e => {
const data = {
payPassword: e.join(''),
addressId: topRessData.id,
productId: viewData.value.id,
quantity: formData.num,
skuId: formData.spec
}
tixian.value.close()
const res = await addOrder(data)
await refreshUserInfo()
redirectTo('/pages/shop-together/detail', {
id: res.data.groupId,
type: 'add'
@@ -105,6 +131,8 @@
<template>
<view class="mall-confirm-order">
<uu-pwdModal ref="tixian" @success="submit"></uu-pwdModal>
<!-- 地址 -->
<view class="address-box" @click="onRess">
<text v-if="topRessData.state" class="wu-adres">

View File

@@ -36,6 +36,10 @@
isInput: {
type: Boolean,
default: true
},
disabled: {
type: Boolean,
default: false
}
})
@@ -49,6 +53,7 @@
<input
v-if="props.isInput"
v-model="name"
:disabled="props.disabled"
:type="props.type"
:placeholder-style="placeholderStyle"
:placeholder="props.placeholder"

View File

@@ -60,8 +60,12 @@
password: formData.confirmPassword
}
} else {
if (!formData.password) {
showToast('请输入设置交易密码')
const passwordValue = validateTransactionPassword(
formData.password,
'交易密码'
)
if (!passwordValue.valid) {
showToast(passwordValue.message)
return
}
data = {

View File

@@ -22,7 +22,16 @@
key: '1',
url: '/pages/my-index/wallet/bank-card/index'
},
{ title: '交易记录', key: '2', url: '' },
{
title: '积分记录',
key: '2',
url: '/pages/my-index/wallet/record'
},
{
title: '提现记录',
key: '5',
url: '/pages/my-index/wallet/withdrawal-record'
},
{
title: isSetPayPwd,
key: '3',

View File

@@ -10,6 +10,8 @@
const { showToast } = useUI()
const loading = ref(true)
/** 身份证状态0 新增 1 等待审核 2 编辑 3 不可以修改和新增 */
const stateData = ref(0)
const formData = reactive({
// 修改id
id: '',
@@ -34,9 +36,11 @@
formData.back = res.data.idCardBackUrl
formData.realName = res.data.realName
formData.idCard = res.data.idCardNumber
formData.frontList = [{ url: res.data.idCardFrontUrl }]
formData.backList = [{ url: res.data.idCardBackUrl }]
stateData.value = res.data.status
} else {
stateData.value = 0
}
loading.value = false
@@ -62,13 +66,14 @@
}
const data = {
id: formData.id,
idCardFrontUrl: formData.front,
idCardBackUrl: formData.back,
realName: formData.realName,
idCardNumber: formData.idCard
}
await addUserIdCard(data)
await addUserIdCard(data, stateData.value === 0 ? 'post' : 'put')
await showToast(`添加成功`, 'success')
navigateBack()
}
@@ -80,42 +85,55 @@
<template>
<view v-if="!loading" class="real-id">
<!-- 说明 -->
<text class="top-text">*为保证您的账户安全,请先完成实名认证</text>
<view v-if="[0, 2, 3].includes(stateData)">
<!-- 说明 -->
<text class="top-text">*为保证您的账户安全,请先完成实名认证</text>
<CardInput :is-input="false" title="收款码">
<view class="qrcode-box">
<cb-file-picker
v-model="formData.front"
v-model:list="formData.frontList"
:readonly="stateData === 3"
isFront
></cb-file-picker>
<cb-file-picker
v-model="formData.back"
v-model:list="formData.backList"
:readonly="stateData === 3"
isBack
></cb-file-picker>
</view>
</CardInput>
<CardInput :is-input="false" title="收款码">
<view class="qrcode-box">
<cb-file-picker
v-model="formData.front"
v-model:list="formData.frontList"
isFront
></cb-file-picker>
<cb-file-picker
v-model="formData.back"
v-model:list="formData.backList"
isBack
></cb-file-picker>
</view>
</CardInput>
<CardInput
v-model="formData.realName"
title="姓名"
placeholder="请输入姓名"
:disabled="stateData === 3"
></CardInput>
<CardInput
v-model="formData.realName"
title="姓名"
placeholder="请输入姓名"
></CardInput>
<CardInput
v-model="formData.idCard"
title="身份证号"
placeholder="请输入身份证号"
:disabled="stateData === 3"
></CardInput>
<CardInput
v-model="formData.idCard"
title="身份证号"
placeholder="请输入身份证号"
></CardInput>
<!-- 底部按钮 -->
<bottom-view>
<cb-button @click="onAddCode">
确认{{ formData.id ? '修改' : '添加' }}
</cb-button>
</bottom-view>
<!-- 底部按钮 -->
<bottom-view v-if="stateData !== 3">
<cb-button @click="onAddCode">
确认{{ formData.id ? '修改' : '添加' }}
</cb-button>
</bottom-view>
</view>
<view v-else class="wait-view">
<image
src="/static/images/my-index/date-icon.png"
mode="heightFix"
class="icon-img"
></image>
<text>等待审核</text>
</view>
</view>
</template>
@@ -132,7 +150,6 @@
font-weight: 500;
font-size: 24rpx;
color: #999999;
text-align: left;
margin-bottom: 32rpx;
}
@@ -141,4 +158,23 @@
justify-content: space-between;
}
}
.wait-view {
margin-top: 10vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.icon-img {
height: 60rpx;
}
text {
margin-top: 20rpx;
display: block;
font-weight: 500;
font-size: 30rpx;
color: #999999;
margin-bottom: 32rpx;
}
}
</style>

View File

@@ -0,0 +1,241 @@
<script setup>
import { ref, reactive, computed } from 'vue'
import {
getUserWithdrawList,
getUserTradeRecordList
} from '@/api/my-index'
const props = defineProps({
// 0 积分记录 1 提现记录
type: {
type: String,
default: '0'
}
})
const topNav = computed(() => {
const list =
props.type === '0'
? [
{ name: '全部', id: '' },
{ name: '拼单获得', id: '1', state: '+', color: '#2ecc71' },
{ name: '消费', id: '2', state: '-', color: '#e74c3c' },
{ name: '退款', id: '3', state: '-', color: '#f39c12' },
{ name: '系统赠送', id: '4', state: '+', color: '#2ecc71' },
{ name: '系统扣除', id: '5', state: '-', color: '#e74c3c' },
{ name: '签到', id: '6', state: '+', color: '#2ecc71' },
{ name: '提现', id: '7', state: '-', color: '#e74c3c' },
{ name: '提现冻结', id: '8', state: '-', color: '#f39c12' },
{
name: '提现拒绝释放',
id: '9',
state: '-',
color: '#e74c3c'
},
{
name: '提现成功扣除',
id: '10',
state: '-',
color: '#e74c3c'
}
]
: [
{ name: '全部', id: '' },
{ name: '待处理', id: '0', state: '', color: '#95a5a6' },
{ name: '处理中', id: '1', state: '', color: '#3498db' },
{ name: '提现成功', id: '2', state: '-', color: '#2ecc71' },
{ name: '提现失败', id: '3', state: '', color: '#e74c3c' },
{ name: '已取消', id: '4', state: '', color: '#95a5a6' }
]
return list
})
const paging = ref(null)
const dataList = ref([])
const formData = reactive({
type: '',
pageSize: 15
})
const getData = async (pageNum, pageSize) => {
try {
const isShow = props.type === '0'
const api = isShow ? getUserTradeRecordList : getUserWithdrawList
const res = await api({
pageNum,
pageSize,
[isShow ? 'changeType' : 'status']: formData.type
})
paging.value.complete(res.rows)
} catch (error) {
paging.value.complete(false)
}
}
const onTop = id => {
formData.type = id
getData(1, formData.pageSize)
}
// onLoad(() => {
// getData()
// })
</script>
<template>
<z-paging
ref="paging"
v-model="dataList"
:default-page-size="formData.pageSize"
safe-area-inset-bottom
use-safe-area-placeholder
@query="getData"
>
<template #top>
<view class="top-options">
<view
v-for="(item, index) in topNav"
:key="index"
:class="{ active: item.id === formData.type }"
class="text"
@click="onTop(item.id)"
>
{{ item.name }}
</view>
</view>
</template>
<view class="card-box">
<view
v-for="item in dataList"
:key="item.withdrawalId"
class="item-row"
>
<image
v-if="props.type === '0'"
src="/static/images/my-index/shangjia.png"
mode="heightFix"
class="left-icon"
></image>
<image
v-else
src="/static/images/my-index/shangjia1.png"
mode="heightFix"
class="left-icon"
></image>
<view class="right-box">
<view class="name-box">
<text>
{{
props.type === '0' ? item.description : item.withdrawalNo
}}
</text>
<text>
{{ props.type === '0' ? item.createTime : item.updateTime }}
</text>
</view>
<view class="state-box">
<text
:style="{
color:
topNav[
props.type === '0' ? item.changeType : item.status + 1
].color
}"
>
{{
topNav[
props.type === '0' ? item.changeType : item.status + 1
].name
}}
</text>
<text>
{{
topNav[
props.type === '0' ? item.changeType : item.status + 1
].state
}}{{
props.type === '0' ? item.changeAmount : item.actualAmount
}}
</text>
</view>
</view>
</view>
</view>
</z-paging>
</template>
<style lang="scss" scoped>
@import '@/styles/top-selector.scss';
// 全屏背景色
page {
background: #f9f9f9;
}
.top-options {
margin: 0;
background: #ffffff;
padding: 32rpx 24rpx;
overflow-x: auto;
}
.card-box {
padding: 32rpx 24rpx;
.item-row + .item-row {
margin-top: 16rpx;
}
.item-row {
display: flex;
align-items: center;
background: #ffffff;
border-radius: 16rpx;
padding: 16rpx 32rpx;
.left-icon {
height: 96rpx;
margin-right: 16rpx;
flex-shrink: 0;
}
.right-box {
width: 100%;
display: flex;
justify-content: space-between;
font-family: PingFang SC, PingFang SC;
font-style: normal;
text-transform: none;
.name-box,
.state-box {
display: flex;
flex-direction: column;
justify-content: space-between;
}
.name-box {
text {
font-weight: 500;
font-size: 28rpx;
color: #000000;
&:last-child {
font-size: 24rpx;
color: #999999;
}
}
}
.state-box {
margin-left: 16rpx;
flex-shrink: 0;
text-align: right;
text {
font-weight: 400;
font-size: 24rpx;
&:last-child {
font-weight: 500;
font-size: 32rpx;
color: #333333;
}
}
}
}
}
}
</style>

View File

@@ -0,0 +1,7 @@
<script setup>
import record from './record.vue'
</script>
<template>
<record type="1"></record>
</template>

View File

@@ -8,12 +8,14 @@
getUserBankList,
getUserWithdrawConfig,
getUserIntegral,
addUserWithdraw
} from '/api/my-index'
addUserWithdraw,
getUserPayPwd
} from '@/api/my-index'
import { useUI } from '@/utils/use-ui'
const { showToast, showDialog } = useUI()
const tixian = ref(null)
const popup = ref(null)
const topData = ref({})
const formData = reactive({
@@ -99,14 +101,36 @@
return
}
const data = {
amount: formData.nuber,
withdrawalType: topData.value.withdrawalType,
paymentAccountId: formData.paymentAccountId
const res = await getUserPayPwd()
if (res?.data) {
tixian.value.open()
} else {
const show = await showDialog('提示', '请先设置支付密码')
if (show) {
navigateTo('/pages/my-index/wallet/edit-password', { type: 0 })
}
}
// await addUserWithdraw(data)
// await showToast(`提现成功`, 'success')
// navigateBack()
}
const submit = async e => {
try {
const data = {
payPassword: e.join(''),
amount: formData.nuber,
withdrawalType: topData.value.withdrawalType,
paymentAccountId: formData.paymentAccountId
}
tixian.value.close()
await addUserWithdraw(data)
await showToast(`提现成功`, 'success')
navigateBack()
} catch (error) {
tixian.value.close()
console.log(error)
}
await addUserWithdraw(data)
await showToast(`提现成功`, 'success')
navigateBack()
}
onShow(() => {
@@ -119,6 +143,8 @@
<view class="withdraw-box">
<nav-bar isTopBg isPlaceholder title="提现"></nav-bar>
<uu-pwdModal ref="tixian" @success="submit"></uu-pwdModal>
<view class="view-box">
<!-- 选择提现方式 -->
<view class="withdraw-way">