refactor(after-sales): 删除独立售后页面并整合至订单列表

- 删除 afterSales.vue 独立页面,将售后入口统一至 myOrder 页面
- 修改售后相关页面跳转路径为 /pages/order/myOrder?status=5
- 重构 applySuccess 页面,增加微信订阅消息授权与视觉优化
- 重构预存款明细页面,增加收支筛选与日志解析功能
- 新增 store 端 API 基础地址配置
This commit is contained in:
pikachu1995@126.com
2026-11-02 16:57:29 +08:00
parent 1411f15679
commit e1a48d6d11
34 changed files with 7082 additions and 1361 deletions

View File

@@ -72,10 +72,10 @@ import { onLoad, onBackPress } from '@dcloudio/uni-app'
import { useStore } from '@/store'
import * as API_Trade from '@/api/trade'
import { payCallback } from '@/api/members'
import { unitPrice } from '@/utils/filters.js'
import { unitPrice } from '@/utils/filters.js'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const { proxy } = getCurrentInstance()!
@@ -126,15 +126,20 @@ function hideLoadingIfNeeded() {
}
function callback(paymentMethod: string) {
uni.redirectTo({
url:
'/pages/cart/payment/success?paymentMethod=' +
paymentMethod +
'&payPrice=' +
cashierParams.value.price +
'&orderType=' +
orderType.value,
})
const goSuccess = () => {
uni.redirectTo({
url:
'/pages/cart/payment/success?paymentMethod=' +
paymentMethod +
'&payPrice=' +
cashierParams.value.price +
'&orderType=' +
orderType.value +
'&orderPromotionType=' +
(cashierParams.value.orderPromotionType || ''),
})
}
goSuccess()
}
function cashierData() {

View File

@@ -1,154 +1,188 @@
<template>
<div :style="themeStyle" class="wrapper">
<div class="pay-wrapper">
<div class="pay-money">
¥{{unitPrice(Number(payPrice)) }}
</div>
<div class="pay-btns">
<div v-show="!from" @click="checkOrder">查看{{ orderType == "RECHARGE" ? '余额' : '订单' }}</div>
<div @click="navigateTo('/pages/tabbar/home/index', 'switch')">回到首页</div>
</div>
</div>
<div class="pay-box">
<div class="pay-tag-box">
<h2>订单支付成功!</h2>
<div class="pay-item">
<div>
支付方式:
</div>
<div>{{ paymentTypeFilter(paymentMethod) }}</div>
</div>
</div>
</div>
<goodsRecommend />
</div>
</template>
<script setup lang="ts">
import { ref, computed } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import goodsRecommend from '@/components/m-goods-recommend'
<template>
<div :style="themeStyle" class="wrapper">
<div class="pay-wrapper">
<div class="pay-money">
¥{{ unitPrice(Number(payPrice)) }}
</div>
<div class="pay-btns">
<div v-show="!from" @click="checkOrder">查看{{ orderType == "RECHARGE" ? '余额' : '订单' }}</div>
<div @click="navigateTo('/pages/tabbar/home/index', 'switch')">回到首页</div>
</div>
</div>
<div class="pay-box">
<div class="pay-tag-box">
<h2>订单支付成功!</h2>
<div class="pay-item">
<div>
支付方式:
</div>
<div>{{ paymentTypeFilter(paymentMethod) }}</div>
</div>
</div>
</div>
<goodsRecommend />
</div>
</template>
<script setup lang="ts">
import { ref, computed } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import goodsRecommend from '@/components/m-goods-recommend'
import { unitPrice } from '@/utils/filters.js'
import { useStore } from '@/store'
import { getThemeStyle } from '@/utils/theme'
import {
prefetchMpMessageTemplates,
subscribePayMessageThen,
} from '@/js_sdk/lili-pay/wx-pay.js'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const paymentMethod = ref('')
const from = ref('')
const payPrice = ref<number | string>(0)
const orderType = ref('')
onLoad((options) => {
paymentMethod.value = options.paymentMethod || ''
from.value = options.from || ''
payPrice.value = options.payPrice || 0
orderType.value = options.orderType || ''
})
function paymentTypeFilter(val: string) {
switch (val) {
case 'WECHAT':
return '微信'
case 'ALIPAY':
return '支付宝'
case 'WALLET':
return '余额支付'
default:
return ''
}
}
function checkOrder() {
if (orderType.value == 'RECHARGE') {
uni.reLaunch({
url: '/pages/mine/deposit/operation',
})
return
}
uni.reLaunch({
url: '/pages/order/myOrder?status=0',
})
}
function navigateTo(url: string, type?: string) {
if (type === 'switch') {
uni.switchTab({ url })
} else {
uni.redirectTo({ url })
}
}
</script><style scoped lang="scss">
.subscribe {
justify-content: space-between;
align-items: center;
margin: 0 auto 40rpx auto;
padding: 0 20rpx 20rpx;
width: 80%;
}
.pay-btns {
display: flex;
width: 50%;
justify-content: space-between;
margin: 0 auto;
color: #fff;
>div {
padding: 6px 12px;
border: 1px solid #fff;
border-radius: 100px;
}
}
.pay-money {
line-height: 1;
font-size: 50rpx;
color: #fff;
margin-bottom: 100rpx;
}
.pay-item {
font-weight: bold;
margin: 32rpx 0;
display: flex;
justify-content: space-between;
font-size: 24rpx;
color: var(--theme-primary-70, rgba(255, 60, 42, 0.7));
}
.pay-box {
overflow: hidden;
}
.pay-tag-box {
width: 80%;
margin: 80rpx auto 40rpx auto;
padding: 20rpx;
border-radius: 20rpx;
background: var(--theme-primary-20, rgba(255, 60, 42, 0.2));
>h2 {
margin-top: 20rpx;
font-size: 40rpx;
color: $main-color;
}
}
.pay-wrapper {
background-image: linear-gradient(90deg, $main-color, $light-color, $aider-light-color);
height: 480rpx;
position: relative;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
.pay-box {
transform: translateY(-100rpx);
width: 100%;
background: #fff;
border-top-right-radius: 100rpx;
}
</style>
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const paymentMethod = ref('')
const from = ref('')
const payPrice = ref<number | string>(0)
const orderType = ref('')
const orderPromotionType = ref('')
onLoad((options) => {
paymentMethod.value = options.paymentMethod || ''
from.value = options.from || ''
payPrice.value = options.payPrice || 0
orderType.value = options.orderType || ''
orderPromotionType.value = options.orderPromotionType || ''
// #ifdef MP-WEIXIN
prefetchMpMessageTemplates()
// #endif
})
function paymentTypeFilter(val: string) {
switch (val) {
case 'WECHAT':
return '微信'
case 'ALIPAY':
return '支付宝'
case 'WALLET':
return '余额支付'
default:
return ''
}
}
function checkOrder() {
if (orderType.value == 'RECHARGE') {
uni.reLaunch({
url: '/pages/mine/deposit/operation',
})
return
}
const doGoOrder = () => {
uni.reLaunch({
url: '/pages/order/myOrder?status=0',
})
}
// #ifdef MP-WEIXIN
subscribePayMessageThen(doGoOrder, {
orderPromotionType: orderPromotionType.value,
})
// #endif
// #ifndef MP-WEIXIN
doGoOrder()
// #endif
}
function navigateTo(url: string, type?: string) {
const doNavigate = () => {
if (type === 'switch') {
uni.switchTab({ url })
} else {
uni.redirectTo({ url })
}
}
if (orderType.value == 'RECHARGE') {
doNavigate()
return
}
// #ifdef MP-WEIXIN
subscribePayMessageThen(doNavigate, {
orderPromotionType: orderPromotionType.value,
})
// #endif
// #ifndef MP-WEIXIN
doNavigate()
// #endif
}
</script>
<style scoped lang="scss">
.subscribe {
justify-content: space-between;
align-items: center;
margin: 0 auto 40rpx auto;
padding: 0 20rpx 20rpx;
width: 80%;
}
.pay-btns {
display: flex;
width: 50%;
justify-content: space-between;
margin: 0 auto;
color: #fff;
>div {
padding: 6px 12px;
border: 1px solid #fff;
border-radius: 100px;
}
}
.pay-money {
line-height: 1;
font-size: 50rpx;
color: #fff;
margin-bottom: 100rpx;
}
.pay-item {
font-weight: bold;
margin: 32rpx 0;
display: flex;
justify-content: space-between;
font-size: 24rpx;
color: var(--theme-primary-70, rgba(255, 60, 42, 0.7));
}
.pay-box {
overflow: hidden;
}
.pay-tag-box {
width: 80%;
margin: 80rpx auto 40rpx auto;
padding: 20rpx;
border-radius: 20rpx;
background: var(--theme-primary-20, rgba(255, 60, 42, 0.2));
>h2 {
margin-top: 20rpx;
font-size: 40rpx;
color: $main-color;
}
}
.pay-wrapper {
background-image: linear-gradient(90deg, $main-color, $light-color, $aider-light-color);
height: 480rpx;
position: relative;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
.pay-box {
transform: translateY(-100rpx);
width: 100%;
background: #fff;
border-top-right-radius: 100rpx;
}
</style>

View File

@@ -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>

View File

@@ -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) {

View File

@@ -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>

View File

@@ -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() {

View File

@@ -1,5 +1,13 @@
<template>
<view :style="themeStyle" class="content">
<u-navbar
title="我的积分"
:fixed="true"
:placeholder="true"
:border="false"
:auto-back="false"
@leftClick="handleBack"
></u-navbar>
<view class="portrait-box">
<image src="/pages/mine/static/point_bg_1.png" mode=""></image>
<image class="point-img" src="/pages/mine/static/tradehall.png" />
@@ -41,6 +49,10 @@ import { onLoad, onReachBottom } from '@dcloudio/uni-app'
import { useStore } from '@/store'
import { getPointsData, getMemberPointSum } from '@/api/members.js'
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))
@@ -51,10 +63,29 @@ const params = ref({ pageNumber: 1, pageSize: 10 })
const pointSummary = ref<Record<string, any>>({})
onLoad(() => {
// #ifdef MP-WEIXIN
prefetchMpMessageTemplates()
// #endif
fetchPointSummary()
fetchPointLogList()
})
function handleBack() {
const doBack = () => {
uni.navigateBack({
fail: () => {
uni.switchTab({ url: '/pages/tabbar/user/my' })
},
})
}
// #ifdef MP-WEIXIN
subscribeMpMessageByScenes(['POINT_CHANGE'], doBack)
// #endif
// #ifndef MP-WEIXIN
doBack()
// #endif
}
onReachBottom(() => {
params.value.pageNumber++
fetchPointLogList()

View File

@@ -0,0 +1,320 @@
<template>
<view :style="themeStyle" class="notice-page">
<u-navbar title="消息通知" :auto-back="true" :placeholder="true" :border="false"></u-navbar>
<view class="content">
<view class="tip-card">
<u-icon name="volume" color="#ff7a00" size="18"></u-icon>
<text class="tip-text">开启通知后,可第一时间接收订单发货、售后审核及资金变动提醒。</text>
</view>
<!-- 微信公众号通知设置 -->
<view v-if="oaSetting.enabled" class="card">
<view class="card-head">
<view class="card-title-wrap">
<view class="icon-badge oa-badge">
<u-icon name="weixin-fill" color="#fff" size="20"></u-icon>
</view>
<view class="title-box">
<view class="title-row">
<text class="card-title">{{ oaSetting.accountName || '微信公众号通知' }}</text>
<text class="status-tag" :class="oaSetting.bound ? 'status-open' : 'status-close'">
{{ oaSetting.bound ? '已开启' : '未开启' }}
</text>
</view>
<text class="card-desc">关注官方公众号,长期接收服务与订单通知</text>
</view>
</view>
</view>
<view class="card-body">
<view class="notice-points">
<view class="point-item">
<text class="dot">•</text>
<text class="point-text">订单发货、完成及拼团进度实时推送</text>
</view>
<view class="point-item">
<text class="dot">•</text>
<text class="point-text">售后申请审核结果、商家退款提醒</text>
</view>
<view class="point-item">
<text class="dot">•</text>
<text class="point-text">余额变动、提现审核与到账结果通知</text>
</view>
</view>
</view>
<view class="card-foot">
<view
class="action-btn"
:class="oaSetting.bound ? 'btn-bound' : 'btn-primary'"
@click="handleOaAction"
>
{{ oaSetting.bound ? '查看公众号文章' : '关注公众号开启通知' }}
</view>
</view>
</view>
<!-- 微信小程序订阅消息说明 -->
<view class="card">
<view class="card-head">
<view class="card-title-wrap">
<view class="icon-badge mp-badge">
<u-icon name="chat-fill" color="#fff" size="20"></u-icon>
</view>
<view class="title-box">
<view class="title-row">
<text class="card-title">小程序订阅消息</text>
<text class="status-tag status-open">已支持</text>
</view>
<text class="card-desc">在支付成功、售后提交、积分与提现等页面主动提示</text>
</view>
</view>
</view>
<view class="card-body">
<text class="mp-intro">
小程序订阅消息支持:订单发货提醒、订单已完成提醒、拼团成功通知、售后申请审核通知、积分变更提醒、账户余额变动通知、提现结果通知。您在相关操作时点击授权即可生效。
</text>
</view>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { ref, computed } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import { getWechatOfficialAccountSetting } from '@/api/message.js'
import { useStore } from '@/store'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const oaSetting = ref({
enabled: false,
accountName: '',
articleUrl: '',
bound: false,
})
onShow(() => {
fetchSetting()
})
function fetchSetting() {
getWechatOfficialAccountSetting()
.then((res: any) => {
if (res && res.data && res.data.success && res.data.result) {
oaSetting.value = res.data.result
}
})
.catch(() => {})
}
function handleOaAction() {
const url = (oaSetting.value.articleUrl || '').trim()
if (!url) {
uni.showToast({ title: '暂未配置公众号文章', icon: 'none' })
return
}
// #ifdef MP-WEIXIN
if (wx.openOfficialAccountArticle) {
wx.openOfficialAccountArticle({
url,
fail: () => {
fallbackOpen(url)
},
})
return
}
// #endif
fallbackOpen(url)
}
function fallbackOpen(url: string) {
uni.setClipboardData({
data: url,
success: () => {
uni.showModal({
title: '提示',
content: '公众号引导文章链接已复制到剪贴板,请在微信中粘贴发送并打开关注公众号',
showCancel: false,
})
},
})
}
</script>
<style lang="scss" scoped>
.notice-page {
min-height: 100vh;
background: #f7f8fa;
padding-bottom: 40rpx;
}
.content {
padding: 24rpx;
}
.tip-card {
display: flex;
align-items: center;
background: #fff7eb;
border-radius: 12rpx;
padding: 20rpx 24rpx;
margin-bottom: 24rpx;
}
.tip-text {
flex: 1;
font-size: 24rpx;
color: #ff7a00;
line-height: 1.5;
margin-left: 12rpx;
}
.card {
background: #fff;
border-radius: 20rpx;
padding: 32rpx;
margin-bottom: 24rpx;
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.03);
}
.card-head {
display: flex;
align-items: center;
justify-content: space-between;
padding-bottom: 24rpx;
border-bottom: 1px solid #f2f3f5;
}
.card-title-wrap {
display: flex;
align-items: center;
flex: 1;
}
.icon-badge {
width: 72rpx;
height: 72rpx;
border-radius: 18rpx;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
margin-right: 20rpx;
}
.oa-badge {
background: linear-gradient(135deg, #07c160, #0ab155);
}
.mp-badge {
background: linear-gradient(135deg, #2b85e4, #007aff);
}
.title-box {
flex: 1;
min-width: 0;
}
.title-row {
display: flex;
align-items: center;
}
.card-title {
font-size: 30rpx;
font-weight: 600;
color: #1d2129;
}
.status-tag {
font-size: 20rpx;
padding: 4rpx 14rpx;
border-radius: 20rpx;
margin-left: 14rpx;
font-weight: 500;
}
.status-open {
background: #e8f8f0;
color: #07c160;
}
.status-close {
background: #f2f3f5;
color: #86909c;
}
.card-desc {
display: block;
font-size: 24rpx;
color: #86909c;
margin-top: 6rpx;
}
.card-body {
padding: 24rpx 0 12rpx;
}
.notice-points {
display: flex;
flex-direction: column;
gap: 12rpx;
}
.point-item {
display: flex;
align-items: flex-start;
font-size: 26rpx;
color: #4e5969;
line-height: 1.6;
}
.dot {
color: #07c160;
font-size: 32rpx;
line-height: 1;
margin-right: 12rpx;
}
.point-text {
flex: 1;
}
.card-foot {
margin-top: 24rpx;
}
.action-btn {
height: 80rpx;
line-height: 80rpx;
text-align: center;
border-radius: 40rpx;
font-size: 28rpx;
font-weight: 500;
}
.btn-primary {
background: linear-gradient(135deg, #07c160, #05a04e);
color: #fff;
box-shadow: 0 6rpx 18rpx rgba(7, 193, 96, 0.25);
}
.btn-bound {
background: #f2f3f5;
color: #4e5969;
}
.mp-intro {
font-size: 26rpx;
color: #4e5969;
line-height: 1.8;
}
</style>

View File

@@ -26,6 +26,11 @@
></u-cell>
<!-- #endif -->
<u-cell is-link title="用户注销" v-if="userInfo.id" @click="logoff"></u-cell>
<u-cell
is-link
title="消息通知"
@click="navigateTo('/pages/mine/set/messageNotice')"
></u-cell>
<u-cell is-link title="意见反馈" @click="navigateTo('/pages/mine/set/feedBack')"></u-cell>
<u-cell
is-link
@@ -42,10 +47,10 @@
import { ref, computed } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import config from '@/config/config'
import { isLogin, tipsToLogin, quiteLoginOut, logoff } from '@/utils/filters.js'
import { useStore } from '@/store'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
import { isLogin, tipsToLogin, quiteLoginOut, logoff } from '@/utils/filters.js'
import { useStore } from '@/store'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const userImage = config.defaultUserPhoto

View File

@@ -1,585 +0,0 @@
<template>
<view :style="themeStyle" class="content">
<view class="u-tabs-box">
<u-tabs
:list="list"
:scrollable="false"
v-model:current="current"
@change="change"
:lineColor="lightColor"
:activeStyle="{ color: lightColor }"
></u-tabs>
</view>
<div class="u-tabs-search">
<u-search
placeholder="请输入订单编号/商品名称/售后单号"
@search="submitSearchOrderList(current)"
@clear="clear(current)"
@custom="submitSearchOrderList(current)"
v-model="keywords"
>
</u-search>
</div>
<scroll-view class="body-view" scroll-y @scrolltolower="renderDate">
<view
class="seller-view"
v-for="(order, orderIndex) in orderList"
:key="orderIndex"
>
<!-- 店铺名称 -->
<view class="seller-info" v-if="current == 0">
<view class="seller-name wes">{{ order.storeName }}</view>
<view class="order-sn wes">订单编号:{{ order.sn }}</view>
</view>
<!-- 申请记录 选项卡 -->
<view class="seller-info" v-if="current != 0">
<view class="order-sn wes">售后单号:{{ order.service_sn || order.sn }}</view>
<view class="order-sn service-type">{{ order.serviceType_text }}</view>
</view>
<view v-for="(sku, goodsIndex) in order.orderItems" :key="goodsIndex">
<view class="goods-item-view" @click="onDetail(order, sku)">
<view class="goods-img">
<u-image
border-radius="6"
width="131rpx"
height="131rpx"
mode="aspectFill"
:src="getGoodsImage(sku, order, goodsIndex)"
></u-image>
</view>
<view class="goods-info">
<view class="goods-title">{{ getGoodsName(sku) }}</view>
<!-- 如果商品多个则不显示每个商品价格-->
<view class="goods-price" v-if="order.orderItems.length <= 1">
¥{{ unitPrice(order.flowPrice) }}
</view>
</view>
<view class="goods-num">
<view>x{{ sku.num }}</view>
</view>
</view>
<view class="description">
<!-- 售后申请 -->
<view v-if="current === 0 && sku.afterSaleStatus">
<view
v-if="sku.afterSaleStatus.includes('ALREADY_APPLIED')"
class="cannot_apply not_center"
>
<u-icon class="icon" name="info-circle-fill"></u-icon>
该商品已申请售后服务
</view>
</view>
<view v-if="current === 0 && sku.afterSaleStatus">
<view
v-if="sku.afterSaleStatus.includes('EXPIRED')"
class="cannot_apply not_center"
@click="tipsShow = true"
>
<u-icon class="icon" name="info-circle-fill"></u-icon>
该商品无法申请售后
</view>
</view>
<div v-if="current === 1 || current === 2">
<!-- 申请中 -->
<view
class="cannot_apply not_center"
v-if="order.serviceType == 'RETURN_GOODS'"
>
退货处理-{{serviceStatusList(order.serviceStatus) }}</view
>
<view
class="cannot_apply not_center"
v-if="order.serviceType == 'SUPPLY_AGAIN_GOODS'"
>
补发商品-{{serviceStatusList(order.serviceStatus) }}</view
>
<view
class="cannot_apply not_center"
v-if="order.serviceType == 'RETURN_MONEY'"
>
退款-{{serviceStatusList(order.serviceStatus) }}</view
>
<view
class="cannot_apply not_center"
v-if="order.serviceType == 'EXCHANGE_GOODS'"
>
换货-{{serviceStatusList(order.serviceStatus) }}</view
>
<view
class="cannot_apply not_center"
v-if="order.serviceType == 'CANCEL'"
>
取消订单-{{serviceStatusList(order.serviceStatus) }}</view
>
</div>
<!-- 申请记录 -->
</view>
<view class="btn-view">
<!-- 售后申请 -->
<div class="sale" v-if="current === 0 && sku.afterSaleStatus && !isECouponOrder(order.orderType)">
<div
v-if="
order.flowPrice != 0 &&
sku.afterSaleStatus.includes('NOT_APPLIED') ||
sku.afterSaleStatus.includes('PART_AFTER_SALE')
"
@click="applyService(sku.sn, order, sku)"
>
<view class="default-btn border"> 申请售后 </view>
</div>
</div>
<view class="after-line">
<!-- 申请中 -->
<view
class="default-btn border"
v-if="
current === 2 &&
order.serviceStatus &&
order.serviceStatus == 'PASS' &&
order.serviceType != 'RETURN_MONEY'
"
@click="onExpress(order, sku)"
>
提交物流
</view>
<view
@click="close(order, sku)"
v-if="current === 1"
class="default-btn close"
>
取消售后
</view>
<view
@click="afterDetails(order, sku)"
v-if="current === 1 || current === 2"
class="default-btn border"
>
售后详情
</view>
</view>
</view>
</view>
<view
v-if="
current === 0 &&
order.groupAfterSaleStatus &&
order.groupAfterSaleStatus != 'ALREADY_APPLIED' &&
order.orderItems.length >= 1
"
class="btn-view order-total"
>
<!-- 多个商品显示订单总价格 -->
<view class="cannot_apply">
订单总金额:<span class="countMoney"
>¥{{unitPrice(order.flowPrice) }}</span
>
</view>
</view>
</view>
<u-loadmore bg-color="#f8f8f8" :status="status" />
</scroll-view>
<u-modal
show-cancel-button
@confirm="closeService"
v-model:show="cancelShow"
content="确认取消售后"
></u-modal>
<u-modal
v-model:show="tipsShow"
content="当订单未确认收货|已过售后服务有效期|已申请售后服务时,不能申请售后"
></u-modal>
</view>
</template>
<script setup lang="ts">
import { ref, reactive, computed } from 'vue'
import { onLoad, onPullDownRefresh } from '@dcloudio/uni-app'
import { useStore } from '@/store'
import { unitPrice, serviceStatusList, parseGoodsImageUrl } from '@/utils/filters.js'
// E_COUPON 订单列表不展示「申请售后」入口(FR-B-04)
import { isECouponOrder } from '@/utils/goodsType.js'
import { getAfterSaleList, cancelAfterSale } from '@/api/after-sale.js'
import { getOrderList } from '@/api/order.js'
import storage from '@/utils/storage'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const lightColor = computed(() => store.getters.lightColor)
const list = [
{ name: '售后申请' },
{ name: '申请中' },
{ name: '申请记录' },
]
const current = ref(0)
const tipsShow = ref(false)
const cancelShow = ref(false)
const selectedOrder = ref<any>(null)
const orderList = ref<any[]>([])
const params = reactive<Record<string, any>>({
pageNumber: 1,
pageSize: 10,
sort: 'createTime',
flowPrice: 0,
order: 'desc',
})
const logParams = reactive<Record<string, any>>({
pageNumber: 1,
pageSize: 10,
})
const status = ref('loadmore')
const keywords = ref('')
onLoad((options) => {
orderList.value = []
params.pageNumber = 1
if (options?.orderSn) params.keywords = options.orderSn
searchOrderList(current.value)
})
onPullDownRefresh(() => {
change(current.value)
})
function hideLoadingIfNeeded() {
if (store.state.isShowToast) uni.hideLoading()
}
function getGoodsName(sku: any) {
return sku.goodsName || sku.name || ''
}
function getGoodsImage(goods: any, order: any, index: number) {
let image = goods.image || goods.goodsImage || goods.thumbnail
if (!image && order.groupImages) {
const images = String(order.groupImages).split(',')
image = images[index] || images[0]
}
return parseGoodsImageUrl(image)
}
function submitSearchOrderList(tabIndex: number) {
params.pageNumber = 1
logParams.pageNumber = 1
orderList.value = []
searchOrderList(tabIndex)
}
function clear(tabIndex: number) {
params.pageNumber = 1
logParams.pageNumber = 1
params.keywords = ''
orderList.value = []
searchOrderList(tabIndex)
}
function change(e: number | { index: number }) {
const index = typeof e === 'object' && e != null ? e.index : e
current.value = index
Object.assign(params, { pageNumber: 1, pageSize: 10 })
orderList.value = []
searchOrderList(index)
uni.stopPullDownRefresh()
}
function searchOrderList(index: number) {
if (index == 0) {
if (keywords.value) params.keywords = keywords.value
fetchOrderList()
} else {
Object.assign(logParams, {
pageNumber: 1,
pageSize: 10,
sort: 'createTime',
order: 'desc',
})
if (index === 1) {
logParams.serviceStatus = 'APPLY'
}
if (keywords.value) logParams.keywords = keywords.value
orderList.value = []
fetchAfterSaleLogList()
}
}
function fetchOrderList() {
uni.showLoading({ title: '加载中', mask: true })
getOrderList(params).then((res) => {
hideLoadingIfNeeded()
const records = res.data.result.records
if (records.length > 0) {
orderList.value = orderList.value.concat(records)
params.pageNumber += 1
}
status.value = records.length < 10 ? 'nomore' : 'loading'
})
}
function close(order: any, _sku: any) {
selectedOrder.value = order
cancelShow.value = true
}
async function closeService() {
uni.showLoading({ title: '加载中' })
const res = await cancelAfterSale(selectedOrder.value.sn)
if (res.data.success) {
uni.showToast({ title: '取消成功!', duration: 2000, icon: 'none' })
}
orderList.value = []
searchOrderList(current.value)
hideLoadingIfNeeded()
}
function afterDetails(order: any, _sku?: any) {
uni.navigateTo({ url: './applyDetail?sn=' + order.sn })
}
function fetchAfterSaleLogList() {
getAfterSaleList(logParams).then((res) => {
const afterSaleLogList = res.data.result.records
afterSaleLogList.forEach((item: any) => {
item.orderItems = [
{
image: item.goodsImage,
skuId: item.skuId,
name: item.goodsName,
num: item.num,
price: item.flowPrice,
},
]
})
orderList.value = orderList.value.concat(afterSaleLogList)
status.value = afterSaleLogList.length < 10 ? 'nomore' : 'loading'
})
}
function applyService(sn: string, order: any, sku: any) {
storage.setAfterSaleData({ ...order, ...sku })
uni.navigateTo({ url: `/pages/order/afterSales/afterSalesSelect?sn=${sn}` })
}
function onExpress(order: any, sku: any) {
sku.storeName = order.storeName
storage.setAfterSaleData({ ...order, ...sku })
uni.navigateTo({ url: `./afterSalesDetailExpress?serviceSn=${order.sn}` })
}
function onDetail(goods: any, sku: any) {
if (current.value == 0) {
uni.navigateTo({
url: `/pages/product/goods?id=${sku.skuId}&goodsId=${sku.goodsId || sku.goodsId}`,
})
} else {
uni.navigateTo({
url: `/pages/product/goods?id=${goods.skuId}&goodsId=${goods.goodsId || goods.goodsId}`,
})
}
}
function renderDate() {
if (current.value === 0) {
params.pageNumber += 1
fetchOrderList()
} else {
logParams.pageNumber += 1
fetchAfterSaleLogList()
}
}
</script>
<style lang="scss">
page,
.content {
background: $page-color-base;
height: 100%;
}
.body-view {
overflow-y: auto;
height: calc(100vh - 44px - 80rpx - 104rpx);
padding: 0 20rpx;
box-sizing: border-box;
}
.u-tabs-search {
padding: 20rpx;
background: #fff;
}
.countMoney {
margin-left: 7rpx;
color: $main-color;
font-size: 28rpx;
}
.seller-view {
background-color: #fff;
margin: 20rpx 0;
padding: 0 20rpx 24rpx;
border-radius: 20rpx;
.seller-info {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
min-height: 70rpx;
padding: 20rpx 0 16rpx;
gap: 20rpx;
.seller-name {
flex-shrink: 0;
max-width: 40%;
font-size: 28rpx;
font-weight: 600;
color: #333;
}
.order-sn {
flex: 1;
min-width: 0;
font-size: 22rpx;
color: #909399;
text-align: right;
}
.service-type {
flex-shrink: 0;
text-align: right;
}
}
.goods-item-view {
display: flex;
flex-direction: row;
align-items: flex-start;
padding: 16rpx 0;
.goods-img {
flex-shrink: 0;
width: 131rpx;
height: 131rpx;
border-radius: 6rpx;
overflow: hidden;
}
.goods-info {
flex: 1;
min-width: 0;
padding: 0 20rpx;
.goods-title {
margin-bottom: 10rpx;
color: #333333;
font-size: 26rpx;
line-height: 1.4;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
word-break: break-all;
}
.goods-specs {
font-size: 24rpx;
margin-bottom: 10rpx;
color: #cccccc;
}
.goods-price {
font-size: 28rpx;
color: #ff5a10;
}
}
.goods-num {
flex-shrink: 0;
min-width: 60rpx;
text-align: right;
color: $main-color;
font-size: 26rpx;
line-height: 1.4;
}
}
.btn-view {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
padding: 16rpx 0 0;
.after-line {
display: flex;
flex-direction: row;
align-items: center;
gap: 15rpx;
}
}
.order-total {
justify-content: flex-start;
padding-top: 8rpx;
padding-bottom: 4rpx;
.cannot_apply {
text-align: left;
height: auto;
line-height: 1.5;
}
}
}
.description {
color: #909399;
size: 25rpx;
}
.cannot_apply {
text-align: center;
font-size: 22rpx;
color: #999999;
height: 70rpx;
line-height: 70rpx;
}
.not_center {
text-align: left;
}
.icon {
margin-right: 10rpx;
}
.sale {
width: 100%;
display: flex;
justify-content: flex-end;
}
.default-btn {
background-color: #ffffff;
margin-left: 15rpx;
height: 60rpx;
line-height: 60rpx;
text-align: center;
font-size: 24rpx;
padding: 0 24rpx;
border-radius: 200px;
}
.close {
color: $light-color;
}
.border {
border: 2rpx solid $light-color;
color: $light-color;
}
</style>

View File

@@ -158,7 +158,7 @@ function onSubmit() {
title: '提交成功',
type: 'success',
back: true,
url: '/pages/order/afterSales/afterSales',
url: '/pages/order/myOrder?status=5',
})
}
})

View File

@@ -1,80 +1,275 @@
<template>
<view :style="themeStyle">
<view class="header">
<u-icon name='checkmark' size="150" color="#ff6b35"></u-icon>
<view class="success-text">售后申请提交成功</view>
<view class="btn-view">
<view class="btn-item">
<u-button ripple class="btn1" shape="circle" @click="navigateToAfterSales()">查看记录</u-button>
<view :style="themeStyle" class="apply-success-page">
<u-navbar
title="提交成功"
:border="false"
:fixed="true"
:placeholder="true"
:auto-back="false"
@leftClick="handleBack"
></u-navbar>
<view class="page-body">
<!-- 核心状态卡片 -->
<view class="result-card">
<view class="icon-halo">
<view class="icon-circle">
<u-icon name="checkmark" size="52rpx" color="#ffffff"></u-icon>
</view>
</view>
<view class="btn-item">
<u-button ripple class="btn2" shape="circle" @click="navigateToHome()">回到主页</u-button>
<view class="success-title">售后申请提交成功</view>
<view class="success-sub">商家将尽快为您审核处理,请留意消息通知</view>
<view class="btn-group">
<view class="action-btn btn-outline" @click="navigateToHome()">
回到主页
</view>
<view class="action-btn btn-primary" @click="navigateToAfterSales()">
查看记录
</view>
</view>
</view>
<!-- 温馨提示卡片 -->
<view class="tips-card">
<view class="tips-header">
<view class="tips-bar"></view>
<text class="tips-title">温馨提示</text>
</view>
<view class="tips-list">
<view class="tip-item">
<view class="tip-dot"></view>
<text class="tip-text">商品寄回地址将在商家审核通过后,在「我的订单 - 售后」详情中展示。</text>
</view>
<view class="tip-item">
<view class="tip-dot"></view>
<text class="tip-text">提交服务单后,售后专员可能与您电话沟通,请保持手机畅通。</text>
</view>
<view class="tip-item">
<view class="tip-dot"></view>
<text class="tip-text">售后处理完成后,退款金额将原路退回至您的原支付账户中。</text>
</view>
</view>
</view>
</view>
<view class="text-view">
<view style="display: flex; margin-bottom: 20rpx; align-items: center">温馨提示:</view>
<view>• 商品寄回地址将在审核通过后在申请记录中查询。</view>
<view>• 提交服务单后,售后专员可能与您电话沟通,请保持手机畅通。</view>
<view>• 退货处理成功后退款金额将原路返回到您的支持账户中;</view>
</view>
</view>
</template>
<script setup lang="ts">import { computed } from 'vue'
<script setup lang="ts">
import { computed } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
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))
onLoad(() => {
// #ifdef MP-WEIXIN
prefetchMpMessageTemplates()
// #endif
})
function handleBack() {
const doBack = () => {
uni.navigateBack({
fail: () => {
uni.redirectTo({
url: '/pages/order/myOrder?status=5',
})
},
})
}
// #ifdef MP-WEIXIN
subscribeMpMessageByScenes(['AFTER_SALE_AUDIT'], doBack)
// #endif
// #ifndef MP-WEIXIN
doBack()
// #endif
}
function navigateToAfterSales() {
uni.redirectTo({
url: '/pages/order/afterSales/afterSales',
})
const goAfterSales = () => {
uni.redirectTo({
url: '/pages/order/myOrder?status=5',
})
}
// #ifdef MP-WEIXIN
subscribeMpMessageByScenes(['AFTER_SALE_AUDIT'], goAfterSales)
// #endif
// #ifndef MP-WEIXIN
goAfterSales()
// #endif
}
function navigateToHome() {
uni.switchTab({
url: '/pages/tabbar/home/index',
})
const goHome = () => {
uni.switchTab({
url: '/pages/tabbar/home/index',
})
}
// #ifdef MP-WEIXIN
subscribeMpMessageByScenes(['AFTER_SALE_AUDIT'], goHome)
// #endif
// #ifndef MP-WEIXIN
goHome()
// #endif
}
</script>
<style lang="scss" scoped>
page {
background: $page-color-base;
padding-bottom: 100rpx;
.apply-success-page {
min-height: 100vh;
background: #f5f6fa;
box-sizing: border-box;
}
.btn1 {
background: $light-color;
color: #fff;
.page-body {
padding: 28rpx 24rpx 60rpx;
}
.btn2 {
color: $light-color;
}
.header {
background-color: #fff;
height: 500rpx;
.result-card {
background: #ffffff;
border-radius: 24rpx;
padding: 64rpx 40rpx 52rpx;
display: flex;
flex-direction: column;
align-items: center;
box-shadow: 0 4rpx 20rpx rgba(17, 30, 79, 0.04);
}
.icon-halo {
width: 140rpx;
height: 140rpx;
border-radius: 50%;
background: rgba(255, 107, 53, 0.12);
display: flex;
align-items: center;
justify-content: center;
.success-text {
font-size: 40rpx;
font-weight: 400;
margin: 20rpx 0;
}
.btn-view {
display: flex;
flex-direction: row;
margin: 40rpx 0rpx;
.btn-item {
margin: 0rpx 20rpx;
}
}
.icon-circle {
width: 104rpx;
height: 104rpx;
border-radius: 50%;
background: linear-gradient(135deg, $main-color 0%, $light-color 100%);
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 8rpx 20rpx rgba(229, 50, 56, 0.25);
}
.success-title {
margin-top: 32rpx;
font-size: 36rpx;
font-weight: 700;
color: #1d2129;
letter-spacing: 0.5rpx;
}
.success-sub {
margin-top: 12rpx;
font-size: 25rpx;
color: #86909c;
text-align: center;
}
.btn-group {
margin-top: 48rpx;
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
gap: 24rpx;
}
.action-btn {
flex: 1;
height: 82rpx;
line-height: 82rpx;
border-radius: 999rpx;
font-size: 28rpx;
font-weight: 600;
text-align: center;
box-sizing: border-box;
transition: opacity 0.15s;
&:active {
opacity: 0.85;
}
}
.text-view {
margin: 40rpx;
color: #909399;
.btn-primary {
background: linear-gradient(135deg, $main-color 0%, $light-color 100%);
color: #ffffff;
box-shadow: 0 6rpx 16rpx rgba(229, 50, 56, 0.22);
}
.btn-outline {
background: #fff6f3;
color: $main-color;
border: 2rpx solid rgba(229, 50, 56, 0.28);
}
.tips-card {
margin-top: 24rpx;
background: #ffffff;
border-radius: 24rpx;
padding: 32rpx 32rpx 36rpx;
box-shadow: 0 4rpx 20rpx rgba(17, 30, 79, 0.03);
}
.tips-header {
display: flex;
align-items: center;
margin-bottom: 20rpx;
}
.tips-bar {
width: 6rpx;
height: 26rpx;
border-radius: 4rpx;
background: linear-gradient(180deg, $main-color 0%, $light-color 100%);
margin-right: 14rpx;
}
.tips-title {
font-size: 28rpx;
font-weight: 600;
color: #1d2129;
}
.tips-list {
display: flex;
flex-direction: column;
gap: 16rpx;
}
.tip-item {
display: flex;
align-items: flex-start;
}
.tip-dot {
flex-shrink: 0;
width: 10rpx;
height: 10rpx;
border-radius: 50%;
background: #c9cdd4;
margin-top: 14rpx;
margin-right: 16rpx;
}
.tip-text {
flex: 1;
font-size: 25rpx;
line-height: 1.65;
color: #4e5969;
}
</style>

View File

@@ -38,6 +38,8 @@
<view class="btn-view u-flex u-row-between">
<view class="description">{{ afterSaleTypeText(order.serviceType) }}</view>
<view class="goods-btn flex flex-a-c">
<view class="cancel-btn" v-if="order.serviceStatus === 'APPLY'" @click="onCancelAfterSale(order)">取消售后</view>
<view class="pay-btn" v-if="order.serviceStatus === 'PASS' && order.serviceType !== 'RETURN_MONEY'" @click="onAfterSaleExpress(order)">提交物流</view>
<view class="pay-btn" @click="openOrder(order)">售后详情</view>
</view>
</view>
@@ -131,6 +133,8 @@
<u-toast ref="uToast" />
<u-modal :confirm-color="lightColor" v-model:show="rogShow" :show-cancel-button="true" :content="'是否确认收货?'"
@confirm="confirmRog"></u-modal>
<u-modal :confirm-color="lightColor" v-model:show="cancelAfterSaleShow" :show-cancel-button="true" content="确认取消售后?"
@confirm="confirmCancelAfterSale"></u-modal>
</view>
</template>
@@ -141,7 +145,8 @@ import { useStore } from '@/store'
import { getThemeStyle } from '@/utils/theme'
import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue'
import { getOrderList, cancelOrder, confirmReceipt } from '@/api/order.js'
import { getClearReason, getAfterSaleList } from '@/api/after-sale.js'
import { getClearReason, getAfterSaleList, cancelAfterSale } from '@/api/after-sale.js'
import storage from '@/utils/storage'
import LiLiWXPay from '@/js_sdk/lili-pay/wx-pay.js'
import {
unitPrice,
@@ -200,6 +205,8 @@ const orderSn = ref('')
const reason = ref('')
const cancelList = ref<any[]>([])
const rogShow = ref(false)
const cancelAfterSaleShow = ref(false)
const pendingAfterSaleSn = ref('')
function hideLoadingIfNeeded() {
if (store.state.isShowToast) uni.hideLoading()
@@ -418,6 +425,30 @@ function openOrder(order: any) {
navigateToOrderDetail(order.sn)
}
function onCancelAfterSale(order: any) {
pendingAfterSaleSn.value = order?.serviceSn || order?.sn || ''
cancelAfterSaleShow.value = true
}
async function confirmCancelAfterSale() {
if (!pendingAfterSaleSn.value) return
uni.showLoading({ title: '加载中' })
const res = await cancelAfterSale(pendingAfterSaleSn.value)
hideLoadingIfNeeded()
if (res?.data?.success) {
uni.showToast({ title: '取消成功!', duration: 2000, icon: 'none' })
initData(tabCurrentIndex.value)
}
}
function onAfterSaleExpress(order: any) {
const sku = (order?.orderItems && order.orderItems[0]) || {}
storage.setAfterSaleData({ ...order, ...sku, storeName: order.storeName })
uni.navigateTo({
url: `./afterSales/afterSalesDetailExpress?serviceSn=${order.serviceSn || order.sn}`,
})
}
function changeTab(e: any) {
// H5 的 swiper change 把下标放在 detail.current。
// 读 target.current 会得到 undefined,选中态被清掉,列表就停在「全部」。

View File

@@ -109,7 +109,7 @@
</view>
<!-- 服务工具卡片(分组化重构) -->
<tool />
<tool :user-info="userInfo" />
</view>
</view>
</template>

View File

@@ -76,6 +76,11 @@
<text class="grid-label">店铺入驻</text>
</view>
<view v-if="hasMerchantPermission" class="service-grid-item" @click="toMerchantWorkbench">
<image class="grid-icon" src="/static/mine/setting.png" mode="aspectFit"></image>
<text class="grid-label">商家工作台</text>
</view>
<view class="service-grid-item" @click="linkMsgDetail()">
<image class="grid-icon" src="/static/mine/mycommit.png" mode="aspectFit"></image>
<text class="grid-label">我的消息</text>
@@ -115,7 +120,7 @@
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { ref, computed } from 'vue'
import { distribution as fetchDistribution } from '@/api/distribution'
import configs from '@/config/config'
import storage from '@/utils/storage'
@@ -128,9 +133,47 @@ import {
DISTRIBUTION_STATUS,
} from '@/utils/distributionStatus'
const props = withDefaults(
defineProps<{
userInfo?: any
}>(),
{
userInfo: () => ({}),
}
)
const sharingShow = ref(false)
const sharingLink = ref('')
// 只有商家权限(店主 haveStore / 绑有 storeId 的店员 / 本地已有有效商家 token)的用户才展示入口
const hasMerchantPermission = computed(() => {
if (storage.getStoreAccessToken()) {
return true
}
const u = (props.userInfo && props.userInfo.id) ? props.userInfo : (storage.getUserInfo() || {})
return Boolean(u.haveStore === true || u.haveStore === 'true' || u.storeId)
})
function toMerchantWorkbench() {
if (!hasMerchantPermission.value) {
uni.showToast({
title: '暂无商家权限',
icon: 'none',
})
return
}
const storeToken = storage.getStoreAccessToken()
if (storeToken) {
uni.navigateTo({
url: '/pages-sub/merchant/pages/index/index',
})
} else {
uni.navigateTo({
url: '/pages-sub/merchant/pages/login/index',
})
}
}
function handleNavigate(url: string) {
uni.navigateTo({ url })
}