mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
synced 2026-11-13 12:28:50 +08:00
refactor(after-sales): 删除独立售后页面并整合至订单列表
- 删除 afterSales.vue 独立页面,将售后入口统一至 myOrder 页面 - 修改售后相关页面跳转路径为 /pages/order/myOrder?status=5 - 重构 applySuccess 页面,增加微信订阅消息授权与视觉优化 - 重构预存款明细页面,增加收支筛选与日志解析功能 - 新增 store 端 API 基础地址配置
This commit is contained in:
@@ -1,239 +1,484 @@
|
||||
<template>
|
||||
<view :style="themeStyle" class="wap">
|
||||
<u-navbar
|
||||
title="预存款列表"
|
||||
:fixed="true"
|
||||
:placeholder="true"
|
||||
:border="false"
|
||||
:auto-back="true"
|
||||
></u-navbar>
|
||||
|
||||
<view class="wrapper-show-money">
|
||||
<view class="money-view">
|
||||
<text class="money-label">预存款金额</text>
|
||||
<text class="money">¥{{ unitPrice(walletNum) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="wrapper-tabs">
|
||||
<swiper class="swiper-box" :current="swiperCurrent">
|
||||
<swiper-item class="swiper-item" v-for="index in list.length" :key="index">
|
||||
<scroll-view
|
||||
class="scroll-v view-wrapper"
|
||||
enable-back-to-top
|
||||
scroll-with-animation
|
||||
scroll-y
|
||||
@scrolltolower="loadMore"
|
||||
>
|
||||
<view v-if="depositData.length != 0" class="list-card">
|
||||
<view
|
||||
class="view-item"
|
||||
v-for="(logItem, logIndex) in depositData"
|
||||
:key="logIndex"
|
||||
>
|
||||
<view class="view-item-detail">
|
||||
<text class="item-title">{{ logItem.detail }}</text>
|
||||
</view>
|
||||
<view class="view-item-change">
|
||||
<text
|
||||
class="item-money"
|
||||
:class="getMoneyClass(logItem.serviceType)"
|
||||
>{{ formatLogMoney(logItem) }}</text>
|
||||
<text class="item-time">{{ logItem.createTime }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<u-empty v-if="depositData.length == 0" mode="history" text="暂无记录" />
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, computed } from 'vue'
|
||||
import { getWalletLog, getUserWallet } from '@/api/members'
|
||||
<template>
|
||||
<view :style="themeStyle" class="deposit-log-page">
|
||||
<u-navbar
|
||||
title="预存款明细"
|
||||
:fixed="true"
|
||||
:placeholder="true"
|
||||
:border="false"
|
||||
:auto-back="true"
|
||||
></u-navbar>
|
||||
|
||||
<!-- 顶部余额概览卡片 -->
|
||||
<view class="header-wrap">
|
||||
<view class="balance-hero">
|
||||
<view class="hero-glow hero-glow-1"></view>
|
||||
<view class="hero-glow hero-glow-2"></view>
|
||||
<view class="hero-top">
|
||||
<text class="money-label">当前预存款余额 (元)</text>
|
||||
</view>
|
||||
<view class="money-row">
|
||||
<text class="money-symbol">¥</text>
|
||||
<text class="money-value">{{ unitPrice(walletNum) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 收支筛选栏 -->
|
||||
<view class="filter-bar">
|
||||
<view
|
||||
v-for="(tab, idx) in filterTabs"
|
||||
:key="tab.key"
|
||||
class="filter-pill"
|
||||
:class="{ active: activeFilter === idx }"
|
||||
@click="activeFilter = idx"
|
||||
>
|
||||
{{ tab.name }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 明细列表区 -->
|
||||
<view class="list-container">
|
||||
<view v-if="filteredData.length > 0" class="list-card">
|
||||
<view
|
||||
class="log-item"
|
||||
v-for="(item, logIndex) in filteredData"
|
||||
:key="logIndex"
|
||||
>
|
||||
<!-- 第一行:类型标签 + 标题 | 变动金额 -->
|
||||
<view class="log-row-main">
|
||||
<view class="log-title-wrap">
|
||||
<text class="type-tag" :class="item.parsed.tagClass">{{ item.parsed.tagText }}</text>
|
||||
<text class="log-title">{{ item.parsed.title }}</text>
|
||||
</view>
|
||||
<text class="log-amount" :class="item.parsed.moneyClass">
|
||||
{{ item.parsed.formattedMoney }}
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<!-- 第二行:提取出的单号或备注说明 -->
|
||||
<view v-if="item.parsed.metaList.length > 0" class="log-meta-box">
|
||||
<view
|
||||
class="log-meta-line"
|
||||
v-for="(meta, mIdx) in item.parsed.metaList"
|
||||
:key="mIdx"
|
||||
>
|
||||
<text class="meta-label">{{ meta.label }}:</text>
|
||||
<text class="meta-val">{{ meta.value }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 第三行:变动时间 -->
|
||||
<view class="log-row-foot">
|
||||
<text class="log-time">{{ item.createTime }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-else-if="loaded" class="empty-box">
|
||||
<u-empty mode="history" text="暂无预存款变动记录" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, computed } from 'vue'
|
||||
import { onReachBottom } from '@dcloudio/uni-app'
|
||||
import { getWalletLog, getUserWallet } from '@/api/members'
|
||||
import { unitPrice } from '@/utils/filters.js'
|
||||
import { useStore } from '@/store'
|
||||
import { getThemeStyle } from '@/utils/theme'
|
||||
|
||||
const store = useStore()
|
||||
const themeStyle = computed(() => getThemeStyle(store.state.theme))
|
||||
|
||||
const walletNum = ref(0)
|
||||
const swiperCurrent = ref(0)
|
||||
const params = ref({
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
order: 'desc',
|
||||
})
|
||||
const depositData = ref<any[]>([])
|
||||
const list = [{ name: '预存款变动明细' }]
|
||||
|
||||
onMounted(async () => {
|
||||
getWallet()
|
||||
const result = await getUserWallet()
|
||||
walletNum.value = result.data.result.memberWallet
|
||||
})
|
||||
|
||||
function isOutgoing(serviceType: string) {
|
||||
return serviceType === 'WALLET_PAY' || serviceType === 'WALLET_WITHDRAWAL'
|
||||
}
|
||||
|
||||
function isIncoming(serviceType: string) {
|
||||
return (
|
||||
serviceType === 'WALLET_REFUND' ||
|
||||
serviceType === 'WALLET_RECHARGE' ||
|
||||
serviceType === 'WALLET_COMMISSION'
|
||||
)
|
||||
}
|
||||
|
||||
function getMoneyClass(serviceType: string) {
|
||||
if (isOutgoing(serviceType)) return 'out'
|
||||
if (isIncoming(serviceType)) return 'in'
|
||||
return ''
|
||||
}
|
||||
|
||||
function formatLogMoney(logItem: any) {
|
||||
const amount = unitPrice(logItem.money)
|
||||
if (isOutgoing(logItem.serviceType)) return `-${amount}`
|
||||
if (isIncoming(logItem.serviceType)) return `+${amount}`
|
||||
return amount
|
||||
}
|
||||
|
||||
function getWallet() {
|
||||
getWalletLog(params.value).then((res) => {
|
||||
if (res.data.success && res.data.result.records.length) {
|
||||
depositData.value.push(...res.data.result.records)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function loadMore() {
|
||||
params.value.pageNumber++
|
||||
getWallet()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.wap {
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.wrapper-show-money {
|
||||
flex-shrink: 0;
|
||||
height: 200rpx;
|
||||
}
|
||||
|
||||
.money-view {
|
||||
height: 100%;
|
||||
padding: 32rpx 40rpx;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
color: #fff;
|
||||
background-image: linear-gradient(
|
||||
25deg,
|
||||
$main-color,
|
||||
$light-color,
|
||||
$aider-light-color
|
||||
);
|
||||
}
|
||||
|
||||
.money-label {
|
||||
font-size: 28rpx;
|
||||
opacity: 0.95;
|
||||
}
|
||||
|
||||
.money {
|
||||
margin-top: 12rpx;
|
||||
max-width: 100%;
|
||||
font-size: 56rpx;
|
||||
font-weight: 600;
|
||||
line-height: 1.2;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.wrapper-tabs {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
padding: 24rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.swiper-box,
|
||||
.swiper-item,
|
||||
.scroll-v {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.list-card {
|
||||
background: #fff;
|
||||
border-radius: 16rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.view-item {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
padding: 28rpx 32rpx;
|
||||
border-bottom: 1px solid #f5f5f5;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
|
||||
.view-item-detail {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
padding-right: 24rpx;
|
||||
}
|
||||
|
||||
.item-title {
|
||||
font-size: 28rpx;
|
||||
color: #333;
|
||||
line-height: 1.5;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.view-item-change {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
align-self: center;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.item-money {
|
||||
font-size: 34rpx;
|
||||
font-weight: 600;
|
||||
line-height: 1.3;
|
||||
white-space: nowrap;
|
||||
|
||||
&.in {
|
||||
color: $aider-color-green;
|
||||
}
|
||||
|
||||
&.out {
|
||||
color: #ff5a5f;
|
||||
}
|
||||
}
|
||||
|
||||
.item-time {
|
||||
margin-top: 8rpx;
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
line-height: 1.3;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
const themeStyle = computed(() => getThemeStyle(store.state.theme))
|
||||
|
||||
const walletNum = ref(0)
|
||||
const loaded = ref(false)
|
||||
const hasMore = ref(true)
|
||||
const activeFilter = ref(0)
|
||||
const filterTabs = [
|
||||
{ key: 'ALL', name: '全部明细' },
|
||||
{ key: 'IN', name: '收入 / 退款' },
|
||||
{ key: 'OUT', name: '支出 / 提现' },
|
||||
]
|
||||
|
||||
const params = ref({
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
order: 'desc',
|
||||
})
|
||||
const depositData = ref<any[]>([])
|
||||
|
||||
onMounted(async () => {
|
||||
getWallet()
|
||||
const result = await getUserWallet()
|
||||
walletNum.value = result.data?.result?.memberWallet ?? 0
|
||||
})
|
||||
|
||||
onReachBottom(() => {
|
||||
if (!hasMore.value) return
|
||||
loadMore()
|
||||
})
|
||||
|
||||
function isOutgoing(logItem: any) {
|
||||
const money = Number(logItem?.money) || 0
|
||||
if (money < 0) return true
|
||||
const serviceType = logItem?.serviceType
|
||||
return serviceType === 'WALLET_PAY' || serviceType === 'WALLET_WITHDRAWAL'
|
||||
}
|
||||
|
||||
function isIncoming(logItem: any) {
|
||||
const money = Number(logItem?.money) || 0
|
||||
if (money > 0) return true
|
||||
const serviceType = logItem?.serviceType
|
||||
return (
|
||||
serviceType === 'WALLET_REFUND' ||
|
||||
serviceType === 'WALLET_RECHARGE' ||
|
||||
serviceType === 'WALLET_COMMISSION'
|
||||
)
|
||||
}
|
||||
|
||||
function parseLogDetail(logItem: any) {
|
||||
const raw = String(logItem?.detail || '').trim()
|
||||
const serviceType = logItem?.serviceType || ''
|
||||
const out = isOutgoing(logItem)
|
||||
const inc = isIncoming(logItem)
|
||||
|
||||
const absAmount = unitPrice(Math.abs(Number(logItem?.money) || 0))
|
||||
const formattedMoney = out ? `-${absAmount}` : inc ? `+${absAmount}` : absAmount
|
||||
const moneyClass = out ? 'out' : inc ? 'in' : ''
|
||||
|
||||
let title = '余额变动'
|
||||
let tagText = '变动'
|
||||
let tagClass = 'tag-default'
|
||||
|
||||
const orderMatch = raw.match(/订单\[([^\]]+)\]/)
|
||||
const afterSaleMatch = raw.match(/售后单\[([^\]]+)\]/)
|
||||
const rechargeMatch = raw.match(/充值单号为[::]\s*([A-Za-z0-9_-]+)/)
|
||||
|
||||
if (afterSaleMatch && afterSaleMatch[1] === 'ORDER_CANCEL') {
|
||||
title = '订单取消退回'
|
||||
tagText = '退款'
|
||||
tagClass = 'tag-in'
|
||||
} else if (serviceType === 'WALLET_REFUND' || raw.includes('退还') || raw.includes('返还')) {
|
||||
title = '售后退款入账'
|
||||
tagText = '退款'
|
||||
tagClass = 'tag-in'
|
||||
} else if (serviceType === 'WALLET_PAY' || raw.includes('支付金额')) {
|
||||
title = '订单余额支付'
|
||||
tagText = '消费'
|
||||
tagClass = 'tag-out'
|
||||
} else if (serviceType === 'WALLET_RECHARGE') {
|
||||
title = raw.includes('后台') ? '平台余额充值' : '预存款充值'
|
||||
tagText = '充值'
|
||||
tagClass = 'tag-in'
|
||||
} else if (serviceType === 'WALLET_WITHDRAWAL') {
|
||||
title = out ? '余额提现申请' : '提现退回解冻'
|
||||
tagText = '提现'
|
||||
tagClass = out ? 'tag-out' : 'tag-in'
|
||||
} else if (serviceType === 'WALLET_COMMISSION') {
|
||||
title = '分销佣金入账'
|
||||
tagText = '佣金'
|
||||
tagClass = 'tag-in'
|
||||
}
|
||||
|
||||
const metaList: Array<{ label: string; value: string }> = []
|
||||
if (orderMatch && orderMatch[1]) {
|
||||
metaList.push({ label: '订单编号', value: orderMatch[1] })
|
||||
}
|
||||
if (afterSaleMatch && afterSaleMatch[1] && afterSaleMatch[1] !== 'ORDER_CANCEL') {
|
||||
metaList.push({ label: '售后单号', value: afterSaleMatch[1] })
|
||||
}
|
||||
if (rechargeMatch && rechargeMatch[1]) {
|
||||
metaList.push({ label: '充值单号', value: rechargeMatch[1] })
|
||||
}
|
||||
|
||||
if (metaList.length === 0 && raw && !raw.includes('???')) {
|
||||
const cleaned = raw
|
||||
.replace(/[,,]?\s*(支付金额|退还金额|余额返还)\[[^\]]+\]/g, '')
|
||||
.replace(/:\s*\d+(\.\d+)?$/, '')
|
||||
.trim()
|
||||
if (cleaned && cleaned !== title) {
|
||||
metaList.push({ label: '变动说明', value: cleaned })
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
title,
|
||||
tagText,
|
||||
tagClass,
|
||||
formattedMoney,
|
||||
moneyClass,
|
||||
isOut: out,
|
||||
isIn: inc,
|
||||
metaList,
|
||||
}
|
||||
}
|
||||
|
||||
const decoratedList = computed(() =>
|
||||
depositData.value.map((item) => ({
|
||||
...item,
|
||||
parsed: parseLogDetail(item),
|
||||
}))
|
||||
)
|
||||
|
||||
const filteredData = computed(() => {
|
||||
if (activeFilter.value === 1) {
|
||||
return decoratedList.value.filter((item) => item.parsed.isIn)
|
||||
}
|
||||
if (activeFilter.value === 2) {
|
||||
return decoratedList.value.filter((item) => item.parsed.isOut)
|
||||
}
|
||||
return decoratedList.value
|
||||
})
|
||||
|
||||
function getWallet() {
|
||||
getWalletLog(params.value).then((res) => {
|
||||
loaded.value = true
|
||||
const records = (res.data?.success && res.data?.result?.records) || []
|
||||
if (records.length) {
|
||||
depositData.value.push(...records)
|
||||
}
|
||||
if (records.length < params.value.pageSize) {
|
||||
hasMore.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function loadMore() {
|
||||
params.value.pageNumber++
|
||||
getWallet()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.deposit-log-page {
|
||||
min-height: 100vh;
|
||||
background: #f5f6fa;
|
||||
padding-bottom: 48rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.header-wrap {
|
||||
padding: 24rpx 24rpx 8rpx;
|
||||
}
|
||||
|
||||
.balance-hero {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
border-radius: 24rpx;
|
||||
padding: 36rpx 36rpx 34rpx;
|
||||
color: #ffffff;
|
||||
background: linear-gradient(135deg, $main-color 0%, $light-color 60%, $aider-light-color 100%);
|
||||
box-shadow: 0 12rpx 28rpx rgba(229, 50, 56, 0.18);
|
||||
}
|
||||
|
||||
.hero-glow {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
background: rgba(255, 255, 255, 0.12);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.hero-glow-1 {
|
||||
width: 220rpx;
|
||||
height: 220rpx;
|
||||
right: -60rpx;
|
||||
top: -70rpx;
|
||||
}
|
||||
|
||||
.hero-glow-2 {
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
right: 90rpx;
|
||||
bottom: -60rpx;
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
|
||||
.hero-top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.money-label {
|
||||
font-size: 25rpx;
|
||||
color: rgba(255, 255, 255, 0.88);
|
||||
letter-spacing: 0.5rpx;
|
||||
}
|
||||
|
||||
.money-row {
|
||||
margin-top: 14rpx;
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
.money-symbol {
|
||||
font-size: 34rpx;
|
||||
font-weight: 600;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
|
||||
.money-value {
|
||||
font-size: 58rpx;
|
||||
font-weight: 700;
|
||||
line-height: 1.15;
|
||||
letter-spacing: 1rpx;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.filter-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
margin-top: 24rpx;
|
||||
}
|
||||
|
||||
.filter-pill {
|
||||
padding: 12rpx 28rpx;
|
||||
border-radius: 999rpx;
|
||||
font-size: 25rpx;
|
||||
color: #666666;
|
||||
background: #ffffff;
|
||||
font-weight: 500;
|
||||
transition: all 0.2s;
|
||||
|
||||
&.active {
|
||||
background: $main-color;
|
||||
color: #ffffff;
|
||||
font-weight: 600;
|
||||
box-shadow: 0 4rpx 12rpx rgba(229, 50, 56, 0.2);
|
||||
}
|
||||
}
|
||||
|
||||
.list-container {
|
||||
padding: 16rpx 24rpx 0;
|
||||
}
|
||||
|
||||
.list-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 18rpx;
|
||||
}
|
||||
|
||||
.log-item {
|
||||
background: #ffffff;
|
||||
border-radius: 20rpx;
|
||||
padding: 28rpx 30rpx;
|
||||
box-shadow: 0 2rpx 12rpx rgba(17, 30, 79, 0.03);
|
||||
}
|
||||
|
||||
.log-row-main {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.log-title-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.type-tag {
|
||||
flex-shrink: 0;
|
||||
font-size: 20rpx;
|
||||
font-weight: 600;
|
||||
padding: 4rpx 12rpx;
|
||||
border-radius: 8rpx;
|
||||
line-height: 1.3;
|
||||
|
||||
&.tag-in {
|
||||
color: #00a870;
|
||||
background: rgba(0, 168, 112, 0.1);
|
||||
}
|
||||
|
||||
&.tag-out {
|
||||
color: #ff4d4f;
|
||||
background: rgba(255, 77, 79, 0.1);
|
||||
}
|
||||
|
||||
&.tag-default {
|
||||
color: #666666;
|
||||
background: #f0f2f5;
|
||||
}
|
||||
}
|
||||
|
||||
.log-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: #1d2129;
|
||||
line-height: 1.35;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.log-amount {
|
||||
flex-shrink: 0;
|
||||
font-size: 34rpx;
|
||||
font-weight: 700;
|
||||
line-height: 1.2;
|
||||
font-variant-numeric: tabular-nums;
|
||||
color: #1d2129;
|
||||
|
||||
&.in {
|
||||
color: #00a870;
|
||||
}
|
||||
|
||||
&.out {
|
||||
color: #ff4d4f;
|
||||
}
|
||||
}
|
||||
|
||||
.log-meta-box {
|
||||
margin-top: 16rpx;
|
||||
padding: 14rpx 18rpx;
|
||||
background: #f8f9fb;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6rpx;
|
||||
}
|
||||
|
||||
.log-meta-line {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 23rpx;
|
||||
line-height: 1.45;
|
||||
color: #4e5969;
|
||||
}
|
||||
|
||||
.meta-label {
|
||||
flex-shrink: 0;
|
||||
color: #86909c;
|
||||
}
|
||||
|
||||
.meta-val {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
color: #4e5969;
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.log-row-foot {
|
||||
margin-top: 16rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.log-time {
|
||||
font-size: 22rpx;
|
||||
color: #999999;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.empty-box {
|
||||
padding-top: 120rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -45,6 +45,11 @@ import { getUserWallet } from '@/api/members'
|
||||
import { isLogin, navigateToLogin, unitPrice } from '@/utils/filters.js'
|
||||
import { useStore } from '@/store'
|
||||
import { getThemeStyle } from '@/utils/theme'
|
||||
import {
|
||||
prefetchMpMessageTemplates,
|
||||
subscribeMpMessageByScenes,
|
||||
} from '@/js_sdk/lili-pay/wx-pay.js'
|
||||
|
||||
const store = useStore()
|
||||
const themeStyle = computed(() => getThemeStyle(store.state.theme))
|
||||
|
||||
@@ -52,6 +57,9 @@ const walletNum = ref(0)
|
||||
|
||||
onShow(async () => {
|
||||
if (isLogin('auth')) {
|
||||
// #ifdef MP-WEIXIN
|
||||
prefetchMpMessageTemplates()
|
||||
// #endif
|
||||
const result = await getUserWallet()
|
||||
walletNum.value = result.data.result.memberWallet
|
||||
} else {
|
||||
@@ -60,7 +68,15 @@ onShow(async () => {
|
||||
})
|
||||
|
||||
function back() {
|
||||
uni.switchTab({ url: '/pages/tabbar/user/my' })
|
||||
const doBack = () => {
|
||||
uni.switchTab({ url: '/pages/tabbar/user/my' })
|
||||
}
|
||||
// #ifdef MP-WEIXIN
|
||||
subscribeMpMessageByScenes(['WALLET_CHANGE'], doBack)
|
||||
// #endif
|
||||
// #ifndef MP-WEIXIN
|
||||
doBack()
|
||||
// #endif
|
||||
}
|
||||
|
||||
function navigateTo(url: string) {
|
||||
|
||||
@@ -1,41 +1,114 @@
|
||||
<template>
|
||||
<view :style="themeStyle" class="wap">
|
||||
<view :style="themeStyle" class="withdraw-log-page">
|
||||
<u-navbar
|
||||
title="提现记录"
|
||||
:fixed="true"
|
||||
:placeholder="true"
|
||||
:border="false"
|
||||
:auto-back="true"
|
||||
:auto-back="false"
|
||||
@leftClick="back"
|
||||
></u-navbar>
|
||||
<scroll-view class="scroll-v view-wrapper" enableBackToTop="true" scroll-with-animation scroll-y @scrolltolower="loadMore">
|
||||
<view v-if="records.length != 0" class="view-item" v-for="(item, index) in records" :key="index">
|
||||
<view class="view-item-detail">
|
||||
<view class="-title">{{ withdrawStatusText(item.applyStatus) }}</view>
|
||||
<view class="-number" v-if="item.inspectRemark || item.errorMessage">{{ item.inspectRemark || item.errorMessage }}</view>
|
||||
</view>
|
||||
<view class="view-item-change">
|
||||
<view class="-money">-{{unitPrice(item.applyMoney) }}</view>
|
||||
<view class="-time">{{ item.createTime || item.inspectTime || "" }}</view>
|
||||
<view v-if="item.applyStatus === 'WAIT_USER_CONFIRM'" class="confirm-btn" @click.stop="confirmWechatReceive(item)">确认收款</view>
|
||||
|
||||
<!-- 状态筛选胶囊栏 -->
|
||||
<view class="filter-bar">
|
||||
<view
|
||||
v-for="(tab, idx) in filterTabs"
|
||||
:key="tab.key"
|
||||
class="filter-pill"
|
||||
:class="{ active: activeFilter === idx }"
|
||||
@click="activeFilter = idx"
|
||||
>
|
||||
{{ tab.name }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 提现记录列表 -->
|
||||
<view class="list-container">
|
||||
<view v-if="filteredRecords.length > 0" class="list-card">
|
||||
<view
|
||||
class="record-card"
|
||||
v-for="(item, index) in filteredRecords"
|
||||
:key="item.id || index"
|
||||
>
|
||||
<!-- 第一行:状态标签 + 标题 | 提现金额 -->
|
||||
<view class="card-row-main">
|
||||
<view class="title-wrap">
|
||||
<text class="status-tag" :class="item.parsed.statusClass">
|
||||
{{ item.parsed.statusText }}
|
||||
</text>
|
||||
<text class="card-title">余额提现</text>
|
||||
</view>
|
||||
<view class="amount-wrap">
|
||||
<text class="amount-symbol">¥</text>
|
||||
<text class="amount-val">{{ unitPrice(item.applyMoney) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 第二行:单号、审核备注或失败原因 -->
|
||||
<view
|
||||
v-if="item.sn || item.inspectRemark || item.errorMessage || item.inspectTime"
|
||||
class="meta-box"
|
||||
>
|
||||
<view v-if="item.sn" class="meta-line">
|
||||
<text class="meta-label">提现单号:</text>
|
||||
<text class="meta-val mono">{{ item.sn }}</text>
|
||||
</view>
|
||||
<view v-if="item.inspectTime" class="meta-line">
|
||||
<text class="meta-label">审核时间:</text>
|
||||
<text class="meta-val">{{ item.inspectTime }}</text>
|
||||
</view>
|
||||
<view v-if="item.inspectRemark || item.errorMessage" class="meta-line">
|
||||
<text class="meta-label">备注说明:</text>
|
||||
<text class="meta-val remark-text">{{ item.inspectRemark || item.errorMessage }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 第三行:申请时间 + 确认收款按钮 -->
|
||||
<view class="card-row-foot">
|
||||
<text class="apply-time">申请时间:{{ item.createTime || item.inspectTime || '-' }}</text>
|
||||
<view
|
||||
v-if="item.applyStatus === 'WAIT_USER_CONFIRM'"
|
||||
class="confirm-btn"
|
||||
@click.stop="confirmWechatReceive(item)"
|
||||
>
|
||||
确认收款
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<u-empty v-if="loaded && records.length == 0" mode="history" text="暂无记录" />
|
||||
</scroll-view>
|
||||
<view v-else-if="loaded" class="empty-box">
|
||||
<u-empty mode="history" text="暂无提现记录" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, computed } from 'vue'
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import { onShow, onReachBottom } from '@dcloudio/uni-app'
|
||||
import { getWithdrawApplyPage, getWithdrawApplyWechatTransferInfo } from '@/api/members'
|
||||
import { unitPrice } from '@/utils/filters.js'
|
||||
import { useStore } from '@/store'
|
||||
import { getThemeStyle } from '@/utils/theme'
|
||||
import {
|
||||
prefetchMpMessageTemplates,
|
||||
subscribeMpMessageByScenes,
|
||||
} from '@/js_sdk/lili-pay/wx-pay.js'
|
||||
|
||||
const store = useStore()
|
||||
const themeStyle = computed(() => getThemeStyle(store.state.theme))
|
||||
|
||||
const loaded = ref(false)
|
||||
const hasMore = ref(true)
|
||||
const activeFilter = ref(0)
|
||||
const filterTabs = [
|
||||
{ key: 'ALL', name: '全部' },
|
||||
{ key: 'PENDING', name: '处理中' },
|
||||
{ key: 'SUCCESS', name: '已到账' },
|
||||
{ key: 'FAIL', name: '未通过/失败' },
|
||||
]
|
||||
|
||||
const params = ref({
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
@@ -44,40 +117,88 @@ const params = ref({
|
||||
const records = ref<any[]>([])
|
||||
|
||||
onShow(() => {
|
||||
// #ifdef MP-WEIXIN
|
||||
// 预拉取订阅模板,保证点击左上角返回时可同步拉起微信订阅弹窗
|
||||
prefetchMpMessageTemplates()
|
||||
// #endif
|
||||
reloadData()
|
||||
})
|
||||
|
||||
// 左上角返回:提示订阅「提现结果通知」后再返回
|
||||
function back() {
|
||||
const doBack = () => {
|
||||
if (getCurrentPages().length > 1) {
|
||||
uni.navigateBack({ delta: 1 })
|
||||
} else {
|
||||
uni.redirectTo({ url: '/pages/mine/deposit/operation' })
|
||||
}
|
||||
}
|
||||
// #ifdef MP-WEIXIN
|
||||
subscribeMpMessageByScenes(['WALLET_WITHDRAWAL_AUDIT_ERROR'], doBack)
|
||||
// #endif
|
||||
// #ifndef MP-WEIXIN
|
||||
doBack()
|
||||
// #endif
|
||||
}
|
||||
|
||||
onReachBottom(() => {
|
||||
if (!hasMore.value) return
|
||||
loadMore()
|
||||
})
|
||||
|
||||
function reloadData() {
|
||||
params.value.pageNumber = 1
|
||||
hasMore.value = true
|
||||
records.value = []
|
||||
loaded.value = false
|
||||
getData()
|
||||
})
|
||||
}
|
||||
|
||||
function withdrawStatusText(applyStatus: string) {
|
||||
function parseWithdrawStatus(applyStatus: string) {
|
||||
switch (applyStatus) {
|
||||
case 'APPLY':
|
||||
return '申请中'
|
||||
return { statusText: '申请中', statusClass: 'tag-pending', group: 'PENDING' }
|
||||
case 'VIA_AUDITING':
|
||||
return '审核通过'
|
||||
return { statusText: '审核通过', statusClass: 'tag-pending', group: 'PENDING' }
|
||||
case 'D_VIA_AUDITING':
|
||||
return '分销提现审核通过'
|
||||
case 'FAIL_AUDITING':
|
||||
return '审核未通过'
|
||||
case 'D_FAIL_AUDITING':
|
||||
return '分销提现审核未通过'
|
||||
return { statusText: '分销审核通过', statusClass: 'tag-pending', group: 'PENDING' }
|
||||
case 'WAIT_USER_CONFIRM':
|
||||
return '等待用户确认'
|
||||
return { statusText: '待确认收款', statusClass: 'tag-action', group: 'PENDING' }
|
||||
case 'SUCCESS':
|
||||
return '提现成功'
|
||||
return { statusText: '提现成功', statusClass: 'tag-success', group: 'SUCCESS' }
|
||||
case 'FAIL_AUDITING':
|
||||
return { statusText: '审核未通过', statusClass: 'tag-fail', group: 'FAIL' }
|
||||
case 'D_FAIL_AUDITING':
|
||||
return { statusText: '分销审核未通过', statusClass: 'tag-fail', group: 'FAIL' }
|
||||
case 'ERROR':
|
||||
return '提现失败'
|
||||
return { statusText: '提现失败', statusClass: 'tag-fail', group: 'FAIL' }
|
||||
default:
|
||||
return applyStatus || ''
|
||||
return { statusText: applyStatus || '处理中', statusClass: 'tag-pending', group: 'PENDING' }
|
||||
}
|
||||
}
|
||||
|
||||
const decoratedRecords = computed(() =>
|
||||
records.value.map((item) => ({
|
||||
...item,
|
||||
parsed: parseWithdrawStatus(item.applyStatus),
|
||||
}))
|
||||
)
|
||||
|
||||
const filteredRecords = computed(() => {
|
||||
const targetKey = filterTabs[activeFilter.value]?.key || 'ALL'
|
||||
if (targetKey === 'ALL') return decoratedRecords.value
|
||||
return decoratedRecords.value.filter((item) => item.parsed.group === targetKey)
|
||||
})
|
||||
|
||||
function getData() {
|
||||
getWithdrawApplyPage(params.value).then((res) => {
|
||||
loaded.value = true
|
||||
if (res.data.success && res.data.result.records.length != 0) {
|
||||
records.value.push(...res.data.result.records)
|
||||
const list = (res.data?.success && res.data?.result?.records) || []
|
||||
if (list.length > 0) {
|
||||
records.value.push(...list)
|
||||
}
|
||||
if (list.length < params.value.pageSize) {
|
||||
hasMore.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -119,7 +240,8 @@ function confirmWechatReceive(item: any) {
|
||||
|
||||
const openResultToast = (errMsg?: string) => {
|
||||
if (errMsg === 'requestMerchantTransfer:ok') {
|
||||
uni.showToast({ title: '已唤起确认页面', duration: 2000, icon: 'none' })
|
||||
uni.showToast({ title: '已确认收款', duration: 2000, icon: 'none' })
|
||||
setTimeout(() => reloadData(), 800)
|
||||
return
|
||||
}
|
||||
if (errMsg === 'requestMerchantTransfer:cancel') {
|
||||
@@ -175,55 +297,191 @@ function confirmWechatReceive(item: any) {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.view-item {
|
||||
padding: 32rpx;
|
||||
.withdraw-log-page {
|
||||
min-height: 100vh;
|
||||
background: #f5f6fa;
|
||||
padding-bottom: 48rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.filter-bar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
padding: 24rpx 24rpx 8rpx;
|
||||
overflow-x: auto;
|
||||
}
|
||||
.view-item-change {
|
||||
text-align: right;
|
||||
> .-money {
|
||||
font-size: 36rpx;
|
||||
color: $main-color;
|
||||
font-weight: bold;
|
||||
}
|
||||
> .-time {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
}
|
||||
> .confirm-btn {
|
||||
display: inline-block;
|
||||
margin-top: 12rpx;
|
||||
padding: 12rpx 20rpx;
|
||||
font-size: 24rpx;
|
||||
border-radius: 8rpx;
|
||||
|
||||
.filter-pill {
|
||||
flex-shrink: 0;
|
||||
padding: 12rpx 28rpx;
|
||||
border-radius: 999rpx;
|
||||
font-size: 25rpx;
|
||||
color: #666666;
|
||||
background: #ffffff;
|
||||
font-weight: 500;
|
||||
transition: all 0.2s;
|
||||
|
||||
&.active {
|
||||
background: $main-color;
|
||||
color: #fff;
|
||||
color: #ffffff;
|
||||
font-weight: 600;
|
||||
box-shadow: 0 4rpx 12rpx rgba(229, 50, 56, 0.2);
|
||||
}
|
||||
}
|
||||
.view-item-detail {
|
||||
line-height: 1.75;
|
||||
|
||||
.list-container {
|
||||
padding: 16rpx 24rpx 0;
|
||||
}
|
||||
|
||||
.list-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 18rpx;
|
||||
}
|
||||
|
||||
.record-card {
|
||||
background: #ffffff;
|
||||
border-radius: 20rpx;
|
||||
padding: 28rpx 30rpx;
|
||||
box-shadow: 0 2rpx 12rpx rgba(17, 30, 79, 0.03);
|
||||
}
|
||||
|
||||
.card-row-main {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.title-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
> .-title {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.status-tag {
|
||||
flex-shrink: 0;
|
||||
font-size: 21rpx;
|
||||
font-weight: 600;
|
||||
padding: 4rpx 14rpx;
|
||||
border-radius: 8rpx;
|
||||
line-height: 1.35;
|
||||
|
||||
&.tag-pending {
|
||||
color: #ff7d00;
|
||||
background: rgba(255, 125, 0, 0.1);
|
||||
}
|
||||
> .-number {
|
||||
font-size: 22rpx;
|
||||
color: #999;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
|
||||
&.tag-action {
|
||||
color: $main-color;
|
||||
background: rgba(229, 50, 56, 0.1);
|
||||
}
|
||||
|
||||
&.tag-success {
|
||||
color: #00a870;
|
||||
background: rgba(0, 168, 112, 0.1);
|
||||
}
|
||||
|
||||
&.tag-fail {
|
||||
color: #f53f3f;
|
||||
background: rgba(245, 63, 63, 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
.wap {
|
||||
width: 100%;
|
||||
height: calc(100vh - 44px);
|
||||
.card-title {
|
||||
font-size: 30rpx;
|
||||
font-weight: 600;
|
||||
color: #1d2129;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.scroll-v {
|
||||
height: calc(100vh - 88rpx);
|
||||
.amount-wrap {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
color: #1d2129;
|
||||
}
|
||||
|
||||
.amount-symbol {
|
||||
font-size: 24rpx;
|
||||
font-weight: 600;
|
||||
margin-right: 4rpx;
|
||||
}
|
||||
|
||||
.amount-val {
|
||||
font-size: 36rpx;
|
||||
font-weight: 700;
|
||||
line-height: 1.2;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.meta-box {
|
||||
margin-top: 16rpx;
|
||||
padding: 14rpx 18rpx;
|
||||
background: #f8f9fb;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6rpx;
|
||||
}
|
||||
|
||||
.meta-line {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
font-size: 23rpx;
|
||||
line-height: 1.45;
|
||||
color: #4e5969;
|
||||
}
|
||||
|
||||
.meta-label {
|
||||
flex-shrink: 0;
|
||||
color: #86909c;
|
||||
}
|
||||
|
||||
.meta-val {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
color: #4e5969;
|
||||
word-break: break-all;
|
||||
|
||||
&.mono {
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
|
||||
}
|
||||
|
||||
&.remark-text {
|
||||
color: #f53f3f;
|
||||
}
|
||||
}
|
||||
|
||||
.card-row-foot {
|
||||
margin-top: 18rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.apply-time {
|
||||
font-size: 22rpx;
|
||||
color: #999999;
|
||||
line-height: 1.2;
|
||||
}
|
||||
|
||||
.confirm-btn {
|
||||
flex-shrink: 0;
|
||||
padding: 10rpx 28rpx;
|
||||
font-size: 24rpx;
|
||||
font-weight: 600;
|
||||
border-radius: 999rpx;
|
||||
background: linear-gradient(135deg, $main-color 0%, $light-color 100%);
|
||||
color: #ffffff;
|
||||
box-shadow: 0 4rpx 12rpx rgba(229, 50, 56, 0.22);
|
||||
}
|
||||
|
||||
.empty-box {
|
||||
padding-top: 140rpx;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -118,12 +118,23 @@ onMounted(async () => {
|
||||
withdrawRule.value = res.data.result.withdrawRule || ''
|
||||
})
|
||||
|
||||
let submitting = false
|
||||
|
||||
function cashd() {
|
||||
if (submitting) return
|
||||
const amount = Number(price.value)
|
||||
if (!proxy.$u.test.amount(parseInt(String(amount)))) {
|
||||
if (!(amount > 0) || !proxy.$u.test.amount(parseInt(String(amount)))) {
|
||||
uni.showToast({ title: '请输入正确金额', duration: 2000, icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (minPrice.value && amount < Number(minPrice.value)) {
|
||||
uni.showToast({ title: `最低提现金额为 ${minPrice.value} 元`, duration: 2000, icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (amount > Number(walletNum.value || 0)) {
|
||||
uni.showToast({ title: '提现金额不能大于可提现金额', duration: 2000, icon: 'none' })
|
||||
return
|
||||
}
|
||||
|
||||
const params: Record<string, any> = { price: amount }
|
||||
if (type.value === 'ALI') {
|
||||
@@ -139,14 +150,23 @@ function cashd() {
|
||||
params.realName = realName.value
|
||||
}
|
||||
|
||||
withdrawalApply(params).then((res) => {
|
||||
if (res.data.success) {
|
||||
uni.showToast({ title: '提现成功!', duration: 2000, icon: 'none' })
|
||||
setTimeout(() => {
|
||||
uni.navigateBack({ delta: 1 })
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
const doSubmit = () => {
|
||||
submitting = true
|
||||
withdrawalApply(params)
|
||||
.then((res) => {
|
||||
if (res.data.success) {
|
||||
uni.showToast({ title: '提现申请已提交', duration: 2000, icon: 'none' })
|
||||
setTimeout(() => {
|
||||
uni.navigateBack({ delta: 1 })
|
||||
}, 1000)
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
submitting = false
|
||||
})
|
||||
}
|
||||
|
||||
doSubmit()
|
||||
}
|
||||
|
||||
function handleAll() {
|
||||
|
||||
Reference in New Issue
Block a user