Files
JayuCloud/YumiNail-Frontend/src/views/OrderView.vue
T

1729 lines
56 KiB
Vue
Raw Normal View History

<template>
2026-05-29 13:30:56 +08:00
<div class="order-page">
<header class="order-header">
<a-button class="order-header__back" type="text" aria-label="返回" @click="router.back()">
<LeftOutlined :style="{ fontSize: '19px' }" />
</a-button>
2026-05-29 13:30:56 +08:00
<div class="order-header__copy">
2026-05-30 18:31:35 +08:00
<span>指尖设计师</span>
2026-05-29 13:30:56 +08:00
<h1 class="order-header__title">订单中心</h1>
</div>
<div class="order-header__spacer" />
</header>
2026-05-29 13:30:56 +08:00
<main class="order-content">
<section v-if="orders.length" class="status-tabs" aria-label="订单状态筛选">
<button
v-for="tab in statusTabs"
:key="String(tab.value)"
class="status-tab"
:class="{ active: filters.status === tab.value }"
type="button"
@click="setStatusFilter(tab.value)"
>
<span>{{ tab.label }}</span>
<em>{{ tab.count }}</em>
</button>
</section>
<section class="growth-panel">
2026-05-29 13:30:56 +08:00
<div class="growth-panel__copy">
<span>会员成长</span>
<strong>{{ growthSummary.levelName || '成长会员' }}</strong>
2026-05-29 13:30:56 +08:00
<p>成长值 {{ growthSummary.growthValue ?? 0 }} · 预约 {{ growthSummary.appointmentCount ?? 0 }} 次 · 评价 {{ growthSummary.reviewCount ?? 0 }} 次</p>
</div>
<a-button size="small" @click="loadGrowthSummary">刷新</a-button>
</section>
<section v-if="myAfterSales.length" class="after-sale-panel">
2026-05-29 13:30:56 +08:00
<div class="section-title">
<span>售后进度</span>
<strong>我的售后</strong>
</div>
<div v-for="item in visibleAfterSales" :key="item.id" class="after-sale-row">
<span>{{ item.afterSaleNo || `售后 ${item.id}` }}</span>
<strong>{{ afterSaleStatusText(item.status) }}</strong>
</div>
</section>
<section v-if="orders.length" class="filter-panel">
<a-input v-model:value="filters.keyword" allow-clear placeholder="搜索订单号、作品、美甲师" />
<div class="filter-row">
<a-date-picker v-model:value="filters.date" class="filter-date" popup-class-name="yumi-date-picker-panel" placeholder="预约日期" />
2026-05-29 13:30:56 +08:00
<a-button class="filter-reset" @click="resetFilters">重置</a-button>
</div>
2026-05-29 13:30:56 +08:00
<div class="filter-row filter-row--amount">
<a-input-number v-model:value="filters.minAmount" class="filter-number" :min="0" placeholder="最低金额" />
<a-input-number v-model:value="filters.maxAmount" class="filter-number" :min="0" placeholder="最高金额" />
</div>
2026-05-29 13:30:56 +08:00
<div class="filter-summary">已显示 {{ filteredOrders.length }} / {{ orders.length }} 个订单</div>
</section>
2026-05-29 13:30:56 +08:00
<section v-if="!orders.length" class="empty-state">
<a-empty description="暂无订单">
<a-button type="primary" @click="router.push('/products')">去逛逛</a-button>
</a-empty>
</section>
<section v-else-if="!filteredOrders.length" class="empty-state">
<a-empty description="没有符合条件的订单">
<a-button @click="resetFilters">清空筛选</a-button>
</a-empty>
</section>
<section v-else class="order-list">
<article
v-for="order in filteredOrders"
:key="order.id"
class="order-card"
:class="{ focused: sameId(focusedOrderId, order.id) }"
>
2026-05-29 13:30:56 +08:00
<div class="order-card__head">
<div class="order-card__identity">
<span>订单号</span>
<strong>{{ order.orderNo }}</strong>
</div>
<div class="order-card__head-actions">
<a-button size="small" type="link" @click="copyOrderNo(order.orderNo)">复制</a-button>
<span class="status" :class="statusClass(order.status)">{{ order.statusText }}</span>
</div>
</div>
2026-05-29 13:30:56 +08:00
<div class="order-meta-grid">
<div>
<span>预约时间</span>
<strong>{{ orderAppointmentTime(order) }}</strong>
2026-05-23 15:16:40 +08:00
</div>
2026-05-29 13:30:56 +08:00
<div>
<span>实付金额</span>
<strong class="amount">{{ formatAmount(order.actualAmount) }}</strong>
2026-05-23 15:16:40 +08:00
</div>
2026-05-29 13:30:56 +08:00
<div class="order-meta-grid__shop">
<span>门店</span>
<strong>{{ order.shopName || '待确认' }}</strong>
</div>
</div>
<ol class="order-timeline">
<li
v-for="node in buildOrderTimeline(order)"
:key="`${order.id}-${node.key}`"
:class="{ active: node.active, done: node.done }"
>
<strong>{{ node.title }}</strong>
<span>{{ node.time || node.desc }}</span>
</li>
</ol>
<div class="order-items">
<div
v-for="item in order.items"
:key="item.id"
class="order-item"
:class="{ focused: sameId(focusedOrderItemId, item.id) }"
>
<div class="thumb">
<img v-if="item.productImage" :src="item.productImage" :alt="item.productTitle" loading="lazy" decoding="async" />
<span v-else>{{ item.productTitle?.[0] || '美' }}</span>
</div>
<div class="item-main">
<div class="item-title">{{ item.productTitle }}</div>
<div class="line">{{ formatAmount(item.price) }} x {{ item.quantity }}</div>
<div v-if="item.artistName" class="line">美甲师:{{ item.artistName }}</div>
<div v-if="item.appointmentTime" class="line appointment">预约时间:{{ formatAppointmentTime(item.appointmentTime) }}</div>
<div v-if="submittedReviewForItem(order, item)" class="review-summary">
已评价:{{ formatRating(submittedReviewForItem(order, item)?.rating) }} 分
<span v-if="submittedReviewForItem(order, item)?.content"> · {{ submittedReviewForItem(order, item)?.content }}</span>
</div>
<div v-else-if="pendingReviewForItem(order, item)" class="review-action">
<span>待评价:{{ pendingReviewForItem(order, item)?.artistName || item.artistName || '美甲师' }}</span>
<a-button size="small" type="primary" @click="openReviewModal(pendingReviewForItem(order, item))">评价</a-button>
</div>
<div v-if="pendingChangeRequestForItem(order, item)" class="change-request">
<div class="change-info">
<strong>待处理改派申请</strong>
<span>原美甲师:{{ artistChangeDisplay(pendingChangeRequestForItem(order, item), item).originalArtistName }}</span>
<span>新美甲师:{{ artistChangeDisplay(pendingChangeRequestForItem(order, item), item).requestedArtistName }}</span>
<span v-if="pendingChangeRequestForItem(order, item)?.reason">原因:{{ pendingChangeRequestForItem(order, item)?.reason }}</span>
<div class="impact-list">
<span v-for="line in artistChangeDisplay(pendingChangeRequestForItem(order, item), item).impactLines" :key="line">{{ line }}</span>
</div>
</div>
<div class="change-actions">
<a-button size="small" type="primary" @click="approveArtistChange(pendingChangeRequestForItem(order, item))">同意</a-button>
<a-button size="small" danger @click="openRejectArtistChange(pendingChangeRequestForItem(order, item))">拒绝</a-button>
</div>
</div>
2026-05-23 15:16:40 +08:00
</div>
</div>
</div>
2026-03-19 20:19:41 +08:00
2026-05-29 13:30:56 +08:00
<div class="footer">
<div class="footer-total">
<span>订单合计</span>
<strong>{{ formatAmount(order.actualAmount) }}</strong>
</div>
<div class="footer-actions">
<a-button size="small" @click="router.push(`/orders/${order.id}`)">详情</a-button>
<a-button v-if="canPreparePayment(order)" size="small" @click="preparePayment(order)">准备支付</a-button>
<a-button v-if="canMockPay(order)" size="small" type="primary" @click="mockPay(order)">模拟支付</a-button>
<a-button v-if="canApplyAfterSale(order)" size="small" @click="openAfterSaleModal(order)">申请售后</a-button>
<a-button v-if="hasRebookableItems(order)" size="small" type="primary" @click="rebookOrder(order)">复刻同款</a-button>
<a-button v-if="order.status === 1" size="small" danger @click="cancelOrder(order.id)">取消订单</a-button>
</div>
</div>
2026-05-29 13:30:56 +08:00
</article>
</section>
2026-03-19 20:19:41 +08:00
</main>
2026-05-23 15:16:40 +08:00
<a-modal
v-model:open="reviewModalOpen"
title="评价美甲师"
:confirm-loading="reviewSubmitting"
@ok="submitReview"
@cancel="closeReviewModal"
>
<a-form layout="vertical">
<a-form-item label="评分" required>
<a-input-number
v-model:value="reviewForm.rating"
class="rating-input"
:min="0.5"
:max="5"
:step="0.5"
placeholder="0.5-5 分"
/>
</a-form-item>
<a-form-item label="评价内容">
<a-textarea v-model:value="reviewForm.content" :rows="4" :maxlength="500" placeholder="写下这次服务体验" />
</a-form-item>
</a-form>
</a-modal>
<a-modal
v-model:open="rejectModalOpen"
title="拒绝改派申请"
:confirm-loading="changeProcessing"
@ok="submitRejectArtistChange"
@cancel="closeRejectArtistChange"
>
<a-form layout="vertical">
<div v-if="activeChangeRequest" class="reject-change-summary">
<span>原美甲师:{{ artistChangeDisplay(activeChangeRequest).originalArtistName }}</span>
<span>新美甲师:{{ artistChangeDisplay(activeChangeRequest).requestedArtistName }}</span>
<span v-if="activeChangeRequest.reason">原因:{{ activeChangeRequest.reason }}</span>
<span v-for="line in artistChangeDisplay(activeChangeRequest).impactLines" :key="line">{{ line }}</span>
</div>
2026-05-23 15:16:40 +08:00
<a-form-item label="拒绝原因">
<a-textarea v-model:value="rejectForm.rejectReason" :rows="3" :maxlength="300" placeholder="可选,请填写拒绝原因" />
</a-form-item>
</a-form>
</a-modal>
<a-modal
v-model:open="afterSaleModalOpen"
title="申请售后"
:confirm-loading="afterSaleSubmitting"
@ok="submitAfterSale"
@cancel="closeAfterSaleModal"
>
<a-form layout="vertical">
<a-form-item label="订单">
<a-input :value="activeAfterSaleOrder?.orderNo || ''" disabled />
</a-form-item>
<a-form-item label="订单项">
<a-select v-model:value="afterSaleForm.orderItemId" allow-clear placeholder="可选,默认整单">
<a-select-option v-for="item in activeAfterSaleOrder?.items || []" :key="item.id" :value="item.id">
{{ item.productTitle }}
</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="类型" required>
<a-select v-model:value="afterSaleForm.type">
<a-select-option value="REFUND">退款</a-select-option>
<a-select-option value="AFTER_SALE">售后</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="退款金额">
<a-input-number v-model:value="afterSaleForm.refundAmount" :min="0" :step="0.01" style="width: 100%" />
</a-form-item>
<a-form-item label="原因" required>
<a-textarea v-model:value="afterSaleForm.reason" :rows="4" :maxlength="300" placeholder="请说明申请原因" />
</a-form-item>
</a-form>
</a-modal>
</div>
</template>
<script setup lang="ts">
/**
* OrderView page script.
* Call guide: the template binds the reactive state below, and the methods are triggered by button clicks, lifecycle hooks, or router events.
*/
import { computed, inject, onMounted, reactive, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { LeftOutlined } from '@ant-design/icons-vue'
import { message, Modal } from 'ant-design-vue'
import { cartApi } from '../api/cart'
import { afterSaleApi, growthApi, orderApi, paymentApi } from '../api/order'
import type { AfterSaleVO, GrowthSummaryVO, OrderArtistChangeRequestVO, OrderArtistReviewVO } from '../api/order'
import { userApi } from '@/api/user'
2026-03-27 14:55:41 +08:00
import type { IdType } from '@/utils/id'
import { runWithGlobalLoading } from '@/utils/action-loading'
import { buildRecoveryActions, getRecoveryMessage } from '@/utils/recovery'
import { resolveOrderReviewFocus } from '@/utils/order-review-focus'
2026-05-29 13:30:56 +08:00
import { extractLegacyFileId, getCachedSignedImageUrl, getCachedSignedImageUrlSync } from '@/utils/signed-image-cache'
2026-05-23 18:44:57 +08:00
/**
* Purpose: router supports OrderView.vue by holding or executing the router page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const router = useRouter()
const route = useRoute()
const updateCartCount = inject<() => Promise<void>>('updateCartCount', async () => {})
2026-05-23 18:44:57 +08:00
/**
* Purpose: orders supports OrderView.vue by holding or executing the orders page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const orders = ref<any[]>([])
const myAfterSales = ref<AfterSaleVO[]>([])
const growthSummary = ref<GrowthSummaryVO>({})
2026-05-23 18:44:57 +08:00
/**
* Purpose: pendingReviews supports OrderView.vue by holding or executing the pending reviews page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
const pendingReviews = ref<OrderArtistReviewVO[]>([])
2026-05-23 18:44:57 +08:00
/**
* Purpose: orderReviews supports OrderView.vue by holding or executing the order reviews page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
const orderReviews = ref<Record<string, OrderArtistReviewVO[]>>({})
2026-05-23 18:44:57 +08:00
/**
* Purpose: pendingChangeRequests supports OrderView.vue by holding or executing the pending change requests page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
const pendingChangeRequests = ref<OrderArtistChangeRequestVO[]>([])
/** historicalChangeRequests stores handled change requests for order timelines. */
const historicalChangeRequests = ref<Record<string, OrderArtistChangeRequestVO[]>>({})
2026-05-23 18:44:57 +08:00
/**
* Purpose: reviewModalOpen supports OrderView.vue by holding or executing the review modal open page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
const reviewModalOpen = ref(false)
2026-05-23 18:44:57 +08:00
/**
* Purpose: reviewSubmitting supports OrderView.vue by holding or executing the review submitting page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
const reviewSubmitting = ref(false)
2026-05-23 18:44:57 +08:00
/**
* Purpose: activeReview supports OrderView.vue by holding or executing the active review page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
const activeReview = ref<OrderArtistReviewVO | null>(null)
2026-05-23 18:44:57 +08:00
/**
* Purpose: rejectModalOpen supports OrderView.vue by holding or executing the reject modal open page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
const rejectModalOpen = ref(false)
const afterSaleModalOpen = ref(false)
const afterSaleSubmitting = ref(false)
const activeAfterSaleOrder = ref<any | null>(null)
2026-05-23 18:44:57 +08:00
/**
* Purpose: changeProcessing supports OrderView.vue by holding or executing the change processing page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
const changeProcessing = ref(false)
2026-05-23 18:44:57 +08:00
/**
* Purpose: activeChangeRequest supports OrderView.vue by holding or executing the active change request page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
const activeChangeRequest = ref<OrderArtistChangeRequestVO | null>(null)
2026-05-23 18:44:57 +08:00
/**
* Purpose: filters supports OrderView.vue by holding or executing the filters page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const filters = reactive({
keyword: '',
status: 'all' as 'all' | number,
date: null as any,
minAmount: undefined as number | undefined,
maxAmount: undefined as number | undefined
})
2026-05-23 18:44:57 +08:00
/**
* Purpose: reviewForm supports OrderView.vue by holding or executing the review form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
const reviewForm = reactive({
rating: undefined as number | undefined,
content: ''
})
2026-05-23 18:44:57 +08:00
/**
* Purpose: rejectForm supports OrderView.vue by holding or executing the reject form page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
const rejectForm = reactive({
rejectReason: ''
})
const afterSaleForm = reactive({
orderItemId: undefined as IdType | undefined,
type: 'REFUND',
reason: '',
refundAmount: undefined as number | undefined
})
2026-05-29 13:30:56 +08:00
const statusTabs = computed(() => {
const tabs: Array<{ label: string, value: 'all' | number }> = [
{ label: '全部', value: 'all' },
{ label: '待使用', value: 1 },
{ label: '已完成', value: 2 },
{ label: '已取消', value: 3 }
]
return tabs.map(tab => ({
...tab,
count: tab.value === 'all'
? orders.value.length
: orders.value.filter(order => Number(order.status) === tab.value).length
}))
})
const visibleAfterSales = computed(() => myAfterSales.value.slice(0, 3))
const setStatusFilter = (value: 'all' | number) => {
filters.status = value
}
/** filteredOrders is a reactive state variable used by the template and event handlers. */
const filteredOrders = computed(() => {
const keyword = filters.keyword.trim().toLowerCase()
const targetDate = filters.date?.format?.('YYYY-MM-DD')
return orders.value.filter(order => {
if (filters.status !== 'all' && order.status !== filters.status) return false
const amount = Number(order.actualAmount || 0)
if (filters.minAmount !== undefined && amount < filters.minAmount) return false
if (filters.maxAmount !== undefined && amount > filters.maxAmount) return false
const items = order.items || []
if (targetDate && !items.some((item: any) => String(item.appointmentTime || '').slice(0, 10) === targetDate)) {
return false
}
if (keyword) {
const haystack = [
order.orderNo,
order.shopName,
order.statusText,
...items.flatMap((item: any) => [item.productTitle, item.artistName, item.appointmentTime])
].filter(Boolean).join(' ').toLowerCase()
if (!haystack.includes(keyword)) return false
}
return true
})
})
/** focusedOrderId stores message/deep-link focus for reviews or artist-change cards. */
const focusedOrderId = ref('')
/** focusedOrderItemId stores message/deep-link item focus. */
const focusedOrderItemId = ref('')
/** focusedReviewId stores message/deep-link review focus. */
const focusedReviewId = ref('')
/** statusClass is a local helper used by this page script. */
2026-03-19 20:19:41 +08:00
const statusClass = (status: number) => {
if (status === 1) return 'pending'
if (status === 2) return 'completed'
return 'cancelled'
}
const isOrderPaid = (order: any) => String(order.paymentStatus || '').toUpperCase() === 'PAID'
const canPreparePayment = (order: any) => Number(order.status) === 1 && !isOrderPaid(order)
const canMockPay = (order: any) => Number(order.status) === 1 && String(order.paymentStatus || '').toUpperCase() === 'PAYING'
const canApplyAfterSale = (order: any) => Number(order.status) === 2 || isOrderPaid(order)
const afterSaleStatusText = (status?: string) => {
if (status === 'PENDING') return '待处理'
if (status === 'APPROVED') return '已通过'
if (status === 'REJECTED') return '已驳回'
return status || '-'
}
2026-05-23 18:44:57 +08:00
/**
* Purpose: sameId supports OrderView.vue by holding or executing the same id page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
const sameId = (left: unknown, right: unknown) => {
return left !== undefined && left !== null && right !== undefined && right !== null && String(left) === String(right)
}
2026-05-23 18:44:57 +08:00
/**
* Purpose: embeddedForItem supports OrderView.vue by holding or executing the embedded for item page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
const embeddedForItem = <T extends { orderItemId?: IdType }>(order: any, item: any, field: string): T | undefined => {
const itemValue = item?.[field] as T | undefined
if (itemValue) return itemValue
const orderValue = order?.[field] as T | undefined
if (!orderValue) return undefined
return sameId(orderValue.orderItemId, item.id) || (order.items || []).length === 1 ? orderValue : undefined
}
2026-05-23 18:44:57 +08:00
/**
* Purpose: pendingReviewForItem supports OrderView.vue by holding or executing the pending review for item page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
const pendingReviewForItem = (order: any, item: any): OrderArtistReviewVO | undefined => {
const embedded = embeddedForItem<OrderArtistReviewVO>(order, item, 'pendingReview')
if (embedded) return embedded
return pendingReviews.value.find(review => sameId(review.orderId, order.id) && sameId(review.orderItemId, item.id))
}
2026-05-23 18:44:57 +08:00
/**
* Purpose: submittedReviewForItem supports OrderView.vue by holding or executing the submitted review for item page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
const submittedReviewForItem = (order: any, item: any): OrderArtistReviewVO | undefined => {
const embedded = embeddedForItem<OrderArtistReviewVO>(order, item, 'reviewSummary')
if (embedded) return embedded
return (orderReviews.value[String(order.id)] || []).find(review => sameId(review.orderItemId, item.id) && Number(review.status) === 1)
}
2026-05-23 18:44:57 +08:00
/**
* Purpose: pendingChangeRequestForItem supports OrderView.vue by holding or executing the pending change request for item page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
const pendingChangeRequestForItem = (order: any, item: any): OrderArtistChangeRequestVO | undefined => {
const embedded = embeddedForItem<OrderArtistChangeRequestVO>(order, item, 'pendingArtistChangeRequest')
if (embedded) return embedded
return pendingChangeRequests.value.find(request => sameId(request.orderId, order.id) && sameId(request.orderItemId, item.id))
}
/**
* Purpose: formatChangePrice supports OrderView.vue by turning optional impact prices into stable customer-facing copy.
* Usage: call it when rendering artist-change impact cards and confirmation dialogs.
*/
const formatChangePrice = (price?: number | string) => {
const value = Number(price)
return Number.isFinite(value) ? `¥${value.toFixed(2)}` : ''
}
/**
* Purpose: formatChangeTime supports OrderView.vue by normalizing backend or order-item appointment values for impact copy.
* Usage: call it when rendering artist-change impact cards and confirmation dialogs.
*/
const formatChangeTime = (time?: string) => {
return String(time || '').replace('T', ' ').slice(0, 16)
}
/**
* Purpose: artistChangeDisplay supports OrderView.vue by deriving visible impact text from a pending artist-change request.
* Usage: use it in cards and confirmation dialogs so the user sees the same time and price impact.
*/
const artistChangeDisplay = (request?: OrderArtistChangeRequestVO, item?: any) => {
const originalArtistName = request?.originalArtistName || request?.fromArtistName || item?.artistName || '原美甲师'
const requestedArtistName = request?.requestedArtistName || request?.toArtistName || '新美甲师'
const appointmentTime = formatChangeTime(request?.appointmentTime || item?.appointmentTime)
const timeImpactText = request?.timeImpactText || (request?.timeAffected ? '预约时间可能调整' : '预约时间不变')
const priceImpactText = request?.priceImpactText || (request?.priceAffected ? '订单价格可能调整' : '价格不变')
const priceValue = request?.priceAffected ? request?.newPrice : (request?.newPrice ?? request?.originalPrice ?? item?.price)
const priceText = formatChangePrice(priceValue)
const impactLines = [
appointmentTime ? `${timeImpactText}:${appointmentTime}` : timeImpactText,
priceText ? `${priceImpactText}:${priceText}` : priceImpactText
].filter(Boolean)
return {
originalArtistName,
requestedArtistName,
impactLines
}
}
/** formatTimelineTime normalizes backend timestamps for the compact order timeline. */
const formatTimelineTime = (value?: string) => {
return String(value || '').replace('T', ' ').slice(0, 16)
}
2026-05-29 13:30:56 +08:00
const formatAppointmentTime = (value?: string) => {
return formatTimelineTime(value) || '待确认'
}
const orderAppointmentTime = (order: any) => {
const firstAppointment = (order.items || []).map((item: any) => item.appointmentTime).find(Boolean)
return formatAppointmentTime(firstAppointment)
}
const formatAmount = (value: unknown) => {
const amount = Number(value || 0)
return `¥${Number.isFinite(amount) ? amount.toFixed(2) : '0.00'}`
}
/** buildOrderTimeline creates a customer-facing status path for one order. */
const buildOrderTimeline = (order: any) => {
const items = order.items || []
const firstAppointment = items.map((item: any) => item.appointmentTime).find(Boolean)
const changes = historicalChangeRequests.value[String(order.id)] || []
const latestHandledChange = changes.find(request => String(request.status || '').toUpperCase() !== 'PENDING')
const nodes = [
{
key: 'created',
title: '已下单',
time: formatTimelineTime(order.createTime),
desc: '订单已创建',
done: true,
active: Number(order.status) === 1
},
{
key: 'appointment',
title: '预约时间',
time: formatTimelineTime(firstAppointment),
desc: firstAppointment ? '' : '待确认',
done: Boolean(firstAppointment),
active: Number(order.status) === 1
}
]
if (changes.length) {
nodes.push({
key: 'artist-change',
title: '改派记录',
time: formatTimelineTime(latestHandledChange?.approvedTime || latestHandledChange?.rejectedTime || changes[0]?.createTime),
desc: `${changes.length} 次申请`,
done: String(latestHandledChange?.status || '').toUpperCase() !== 'PENDING',
active: changes.some(request => String(request.status || '').toUpperCase() === 'PENDING')
})
}
nodes.push({
key: Number(order.status) === 3 ? 'cancelled' : 'completed',
title: Number(order.status) === 3 ? '已取消' : '已完成',
time: formatTimelineTime(order.completeTime || order.cancelTime || order.updateTime),
desc: Number(order.status) === 2 ? '服务已完成' : (Number(order.status) === 3 ? '订单已取消' : '等待服务完成'),
done: Number(order.status) === 2 || Number(order.status) === 3,
active: Number(order.status) === 2 || Number(order.status) === 3
})
const orderReviewsForTimeline = orderReviews.value[String(order.id)] || []
nodes.push({
key: 'review',
title: '评价',
time: formatTimelineTime(orderReviewsForTimeline.find(review => Number(review.status) === 1)?.reviewTime),
desc: orderReviewsForTimeline.some(review => Number(review.status) === 1)
? '已评价'
: (pendingReviews.value.some(review => sameId(review.orderId, order.id)) ? '待评价' : '服务完成后可评价'),
done: orderReviewsForTimeline.some(review => Number(review.status) === 1),
active: pendingReviews.value.some(review => sameId(review.orderId, order.id))
})
return nodes
}
2026-05-23 18:44:57 +08:00
/**
* Purpose: formatRating supports OrderView.vue by holding or executing the format rating page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
const formatRating = (rating?: number) => {
return Number(rating || 0).toFixed(1)
}
/** resetFilters is a local helper used by this page script. */
const resetFilters = () => {
filters.keyword = ''
filters.status = 'all'
filters.date = null
filters.minAmount = undefined
filters.maxAmount = undefined
}
const loadGrowthSummary = async () => {
try {
growthSummary.value = await growthApi.getSummary()
} catch (error) {
console.error('加载成长摘要失败:', error)
growthSummary.value = {}
}
}
const loadMyAfterSales = async () => {
try {
const result = await afterSaleApi.listMy({ page: 1, size: 20 })
myAfterSales.value = result.list || []
} catch (error) {
console.error('加载售后列表失败:', error)
myAfterSales.value = []
}
}
const preparePayment = async (order: any) => {
try {
await runWithGlobalLoading(async () => {
await paymentApi.prepareOrderPayment(order.id)
await loadOrders()
})
message.success('支付单已准备,可继续模拟支付')
} catch (error: any) {
message.error(error?.message || '准备支付失败')
}
}
const mockPay = async (order: any) => {
try {
await runWithGlobalLoading(async () => {
await paymentApi.mockSuccess(order.id)
await loadOrders()
})
message.success('模拟支付成功')
} catch (error: any) {
message.error(error?.message || '模拟支付失败')
}
}
const openAfterSaleModal = (order: any) => {
activeAfterSaleOrder.value = order
const firstItem = (order.items || [])[0]
afterSaleForm.orderItemId = firstItem?.id
afterSaleForm.type = 'REFUND'
afterSaleForm.reason = ''
afterSaleForm.refundAmount = Number(order.actualAmount || order.totalAmount || 0)
afterSaleModalOpen.value = true
}
const closeAfterSaleModal = () => {
afterSaleModalOpen.value = false
activeAfterSaleOrder.value = null
afterSaleForm.orderItemId = undefined
afterSaleForm.type = 'REFUND'
afterSaleForm.reason = ''
afterSaleForm.refundAmount = undefined
}
const submitAfterSale = async () => {
if (!activeAfterSaleOrder.value) return
if (!afterSaleForm.reason.trim()) {
message.warning('请填写售后原因')
return
}
afterSaleSubmitting.value = true
try {
await runWithGlobalLoading(async () => {
await afterSaleApi.apply({
orderId: activeAfterSaleOrder.value.id,
orderItemId: afterSaleForm.orderItemId,
type: afterSaleForm.type,
reason: afterSaleForm.reason.trim(),
refundAmount: afterSaleForm.refundAmount
})
await loadMyAfterSales()
})
message.success('售后申请已提交')
closeAfterSaleModal()
} catch (error: any) {
message.error(error?.message || '提交售后失败')
} finally {
afterSaleSubmitting.value = false
}
}
const normalizeRebookQuantity = (quantity: unknown) => {
const value = Number(quantity)
return Number.isFinite(value) && value > 0 ? Math.max(1, Math.floor(value)) : 1
}
const getRebookableOrderItems = (order: any) => {
return (order.items || []).filter((item: any) => item?.productId !== undefined && item?.productId !== null)
}
const hasRebookableItems = (order: any) => {
return Number(order.status) === 2 && getRebookableOrderItems(order).length > 0
}
const rebookOrder = async (order: any) => {
if (Number(order.status) !== 2) {
message.warning('仅已完成订单支持再次预约')
return
}
const items = getRebookableOrderItems(order)
if (!items.length) {
message.warning('这笔订单暂无可复刻作品')
return
}
try {
await runWithGlobalLoading(async () => {
for (const item of items) {
await cartApi.addToCart({
productId: item.productId,
quantity: normalizeRebookQuantity(item.quantity)
})
}
await updateCartCount()
})
message.success('已加入购物车,请重新选择美甲师和时间')
router.push('/cart')
} catch (error: any) {
message.error(error?.message || '复刻同款失败,请稍后重试')
}
}
2026-05-23 18:44:57 +08:00
/**
* Purpose: copyOrderNo supports OrderView.vue by holding or executing the copy order no page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const copyOrderNo = async (orderNo: string) => {
try {
await navigator.clipboard.writeText(orderNo)
message.success('订单号已复制')
} catch {
message.warning('复制失败,请手动复制订单号')
}
}
2026-05-23 18:44:57 +08:00
/**
* Purpose: loadPendingReviews supports OrderView.vue by holding or executing the load pending reviews page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
const loadPendingReviews = async () => {
try {
pendingReviews.value = (await orderApi.getMyPendingReviews()) || []
} catch {
pendingReviews.value = []
}
}
2026-05-23 18:44:57 +08:00
/**
* Purpose: loadOrderReviews supports OrderView.vue by holding or executing the load order reviews page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
const loadOrderReviews = async () => {
const orderIds = orders.value.map(order => order.id).filter(Boolean)
const entries = await Promise.all(orderIds.map(async (orderId) => {
try {
return [String(orderId), await orderApi.getOrderReviews(orderId)] as const
} catch {
return [String(orderId), []] as const
}
}))
orderReviews.value = Object.fromEntries(entries)
}
2026-05-23 18:44:57 +08:00
/**
* Purpose: loadPendingArtistChangeRequests supports OrderView.vue by holding or executing the load pending artist change requests page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
const loadPendingArtistChangeRequests = async () => {
try {
pendingChangeRequests.value = (await orderApi.getMyPendingArtistChangeRequests()) || []
} catch {
pendingChangeRequests.value = []
}
}
2026-05-23 18:44:57 +08:00
/**
* Purpose: refreshOrderExtensions supports OrderView.vue by holding or executing the refresh order extensions page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
const refreshOrderExtensions = async () => {
await Promise.all([
loadPendingReviews(),
loadOrderReviews(),
loadPendingArtistChangeRequests()
])
await loadHistoricalArtistChangeRequests()
resolveRouteFocus()
}
/** loadHistoricalArtistChangeRequests loads handled and pending changes for the order timeline. */
const loadHistoricalArtistChangeRequests = async () => {
const orderIds = orders.value.map(order => order.id).filter(Boolean)
const entries = await Promise.all(orderIds.map(async (orderId) => {
try {
return [String(orderId), await orderApi.getOrderArtistChangeRequests(orderId)] as const
} catch {
return [String(orderId), []] as const
}
}))
historicalChangeRequests.value = Object.fromEntries(entries)
}
/** resolveRouteFocus handles message jumps for review or order focus. */
const resolveRouteFocus = () => {
const focus = resolveOrderReviewFocus({
orders: orders.value,
pendingReviews: pendingReviews.value,
orderReviews: orderReviews.value,
query: route.query
})
focusedOrderId.value = focus.focusOrderId
focusedOrderItemId.value = focus.focusOrderItemId
focusedReviewId.value = focus.focusReviewId
if (focus.message) {
message.info(focus.message)
}
}
const openOrdersRecovery = (error: unknown) => {
const actions = buildRecoveryActions([
{ key: 'retry', text: '重试' },
{ key: 'products', text: '去逛作品' }
])
const retryAction = actions[0]
const productsAction = actions[1]
Modal.confirm({
title: '订单列表加载失败',
content: `${getRecoveryMessage(error, '订单暂时没有加载出来,请重试或稍后再查看。')}。你可以重试,或先去浏览作品。`,
okText: retryAction?.text || '重试',
cancelText: productsAction?.text || '去逛作品',
onOk: () => loadOrders(),
onCancel: () => router.push(productsAction?.route || '/products')
})
2026-05-23 15:16:40 +08:00
}
/** loadOrders is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
2026-03-19 20:19:41 +08:00
const loadOrders = async () => {
try {
const userInfo = await userApi.getUserInfo()
if (userInfo.type === 2 || userInfo.type === 3) {
router.replace('/artist-orders')
2026-05-23 15:16:40 +08:00
return false
}
2026-03-19 20:19:41 +08:00
orders.value = (await orderApi.getOrderList() as unknown as any[]) || []
for (const order of orders.value) {
for (const item of order.items || []) {
2026-05-29 13:30:56 +08:00
const imageId = extractLegacyFileId(item.productImage)
if (!imageId) continue
const cachedUrl = getCachedSignedImageUrlSync(imageId)
if (cachedUrl) item.productImage = cachedUrl
item.productImage = await getCachedSignedImageUrl(imageId)
}
}
2026-05-23 15:16:40 +08:00
await refreshOrderExtensions()
return true
} catch (error) {
orders.value = []
openOrdersRecovery(error)
2026-05-23 15:16:40 +08:00
return false
}
}
2026-05-23 18:44:57 +08:00
/**
* Purpose: openReviewModal supports OrderView.vue by holding or executing the open review modal page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
const openReviewModal = (review?: OrderArtistReviewVO) => {
if (!review) return
activeReview.value = review
reviewForm.rating = review.rating ? Number(review.rating) : undefined
reviewForm.content = review.content || ''
reviewModalOpen.value = true
}
2026-05-23 18:44:57 +08:00
/**
* Purpose: closeReviewModal supports OrderView.vue by holding or executing the close review modal page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
const closeReviewModal = () => {
reviewModalOpen.value = false
activeReview.value = null
reviewForm.rating = undefined
reviewForm.content = ''
}
2026-05-23 18:44:57 +08:00
/**
* Purpose: submitReview supports OrderView.vue by holding or executing the submit review page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
const submitReview = async () => {
if (!activeReview.value) return
const rating = Number(reviewForm.rating)
if (!rating || rating < 0.5 || rating > 5) {
message.warning('请填写 0.5-5 分的评分')
return
}
const normalizedRating = Math.round(rating * 2) / 2
if (Math.abs(normalizedRating - rating) > 0.001) {
message.warning('评分请按 0.5 分递增')
return
}
reviewSubmitting.value = true
try {
await orderApi.submitArtistReview(activeReview.value.id, {
rating: normalizedRating,
content: reviewForm.content.trim() || undefined,
imageFileIds: []
})
message.success('评价已提交')
closeReviewModal()
await Promise.all([loadPendingReviews(), loadOrderReviews()])
} catch {
message.error('提交评价失败')
} finally {
reviewSubmitting.value = false
}
}
2026-05-23 18:44:57 +08:00
/**
* Purpose: approveArtistChange supports OrderView.vue by holding or executing the approve artist change page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
const approveArtistChange = (request?: OrderArtistChangeRequestVO) => {
if (!request) return
const display = artistChangeDisplay(request)
2026-05-23 15:16:40 +08:00
Modal.confirm({
title: '同意改派申请',
content: [
`原美甲师:${display.originalArtistName}`,
`新美甲师:${display.requestedArtistName}`,
request.reason ? `原因:${request.reason}` : '',
...display.impactLines
].filter(Boolean).join('\n'),
2026-05-23 15:16:40 +08:00
onOk: async () => {
try {
await runWithGlobalLoading(async () => {
await orderApi.approveArtistChange(request.id)
await loadOrders()
})
message.success('已同意改派')
} catch {
message.error('处理改派申请失败')
}
}
})
}
2026-05-23 18:44:57 +08:00
/**
* Purpose: openRejectArtistChange supports OrderView.vue by holding or executing the open reject artist change page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
const openRejectArtistChange = (request?: OrderArtistChangeRequestVO) => {
if (!request) return
activeChangeRequest.value = request
rejectForm.rejectReason = ''
rejectModalOpen.value = true
}
2026-05-23 18:44:57 +08:00
/**
* Purpose: closeRejectArtistChange supports OrderView.vue by holding or executing the close reject artist change page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
const closeRejectArtistChange = () => {
rejectModalOpen.value = false
activeChangeRequest.value = null
rejectForm.rejectReason = ''
}
2026-05-23 18:44:57 +08:00
/**
* Purpose: submitRejectArtistChange supports OrderView.vue by holding or executing the submit reject artist change page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
2026-05-23 15:16:40 +08:00
const submitRejectArtistChange = async () => {
if (!activeChangeRequest.value) return
changeProcessing.value = true
try {
await orderApi.rejectArtistChange(activeChangeRequest.value.id, {
rejectReason: rejectForm.rejectReason.trim() || undefined
})
message.success('已拒绝改派')
closeRejectArtistChange()
await loadOrders()
} catch {
message.error('拒绝改派申请失败')
} finally {
changeProcessing.value = false
}
}
/** cancelOrder is a local helper used by this page script. */
2026-03-27 14:55:41 +08:00
const cancelOrder = (orderId: IdType) => {
Modal.confirm({
title: '确认取消订单',
content: '确定要取消这个订单吗?',
onOk: async () => {
try {
await runWithGlobalLoading(() => orderApi.cancelOrder(orderId))
message.success('订单已取消')
2026-03-19 20:19:41 +08:00
await loadOrders()
} catch {
message.error('取消订单失败')
}
}
})
}
onMounted(async () => {
await Promise.all([loadGrowthSummary(), loadMyAfterSales()])
await loadOrders()
})
</script>
<style scoped>
2026-05-29 13:30:56 +08:00
.order-page {
2026-05-30 18:31:35 +08:00
--order-shell-width: var(--frontend-page-max-width);
2026-05-29 13:30:56 +08:00
min-height: 100vh;
min-height: 100svh;
padding-top: 64px;
padding-bottom: calc(28px + env(safe-area-inset-bottom));
overflow-x: hidden;
color: var(--text-primary);
background:
linear-gradient(180deg, color-mix(in srgb, var(--theme-primary-soft) 56%, var(--theme-page-bg)) 0%, var(--theme-page-bg) 42%, color-mix(in srgb, var(--theme-secondary-soft) 18%, var(--theme-page-bg)) 100%),
var(--theme-background-image),
var(--theme-page-bg);
background-size: auto, cover, auto;
background-position: center top;
}
2026-05-29 13:30:56 +08:00
.order-header {
position: fixed;
top: 0;
2026-05-30 18:31:35 +08:00
left: 50%;
2026-05-29 13:30:56 +08:00
z-index: 20;
display: grid;
grid-template-columns: 42px minmax(0, 1fr) 42px;
align-items: center;
gap: 10px;
2026-05-30 18:31:35 +08:00
width: min(100%, var(--order-shell-width));
2026-05-29 13:30:56 +08:00
height: 64px;
padding: 8px 18px;
border-bottom: 1px solid color-mix(in srgb, var(--theme-border) 72%, transparent);
background: color-mix(in srgb, var(--theme-card-bg) 88%, transparent);
-webkit-backdrop-filter: blur(18px);
backdrop-filter: blur(18px);
2026-05-30 18:31:35 +08:00
transform: translateX(-50%);
2026-05-29 13:30:56 +08:00
}
2026-03-24 09:50:55 +08:00
2026-05-29 13:30:56 +08:00
.order-header__back,
.order-header__spacer {
width: 40px;
height: 40px;
}
.order-header__back {
display: flex;
align-items: center;
justify-content: center;
padding: 0;
border-radius: 999px;
color: var(--theme-primary-action);
background: color-mix(in srgb, var(--theme-card-bg) 72%, transparent);
}
.order-header__copy {
display: grid;
justify-items: center;
min-width: 0;
}
.order-header__copy span {
color: var(--theme-primary-action);
font-size: 11px;
font-weight: 700;
line-height: 1.2;
}
.order-header__title {
margin: 0;
overflow: hidden;
color: var(--text-primary);
font-size: 19px;
font-weight: 700;
line-height: 1.2;
text-overflow: ellipsis;
white-space: nowrap;
}
.order-content {
2026-05-30 18:31:35 +08:00
width: min(100%, var(--order-shell-width));
max-width: var(--order-shell-width);
2026-05-29 13:30:56 +08:00
margin: 0 auto;
padding: 14px 16px 30px;
}
.status-tabs {
position: sticky;
top: 64px;
z-index: 12;
display: flex;
gap: 10px;
margin: 0 -16px 14px;
padding: 12px 16px;
overflow-x: auto;
background: linear-gradient(180deg, color-mix(in srgb, var(--theme-page-bg) 94%, transparent), color-mix(in srgb, var(--theme-page-bg) 76%, transparent));
-webkit-backdrop-filter: blur(12px);
backdrop-filter: blur(12px);
scrollbar-width: none;
}
.status-tabs::-webkit-scrollbar {
display: none;
}
.status-tab {
display: inline-flex;
flex: 0 0 auto;
align-items: center;
justify-content: center;
gap: 7px;
min-width: 82px;
height: 38px;
padding: 0 16px;
border: 1px solid var(--theme-border);
border-radius: 999px;
color: var(--text-secondary);
background: color-mix(in srgb, var(--theme-card-bg) 82%, transparent);
font-size: 13px;
font-weight: 700;
cursor: pointer;
transition: transform .18s ease, border-color .18s ease, background .18s ease, color .18s ease;
}
.status-tab em {
min-width: 18px;
font-style: normal;
font-size: 12px;
line-height: 1;
}
.status-tab.active {
color: var(--theme-card-bg);
border-color: var(--theme-primary-action);
background: var(--theme-primary-action);
box-shadow: var(--theme-button-shadow);
}
.status-tab:active {
transform: scale(.98);
}
.growth-panel,
.after-sale-panel,
.filter-panel,
.order-card,
.empty-state {
border: 1px solid color-mix(in srgb, var(--theme-card-bg) 72%, var(--theme-border));
border-radius: 24px;
background: color-mix(in srgb, var(--theme-card-bg) 84%, transparent);
box-shadow: 0 18px 44px color-mix(in srgb, var(--theme-neutral) 8%, transparent);
-webkit-backdrop-filter: blur(16px);
backdrop-filter: blur(16px);
}
.growth-panel {
display: flex;
align-items: center;
justify-content: space-between;
gap: 14px;
margin-bottom: 14px;
padding: 18px;
}
.growth-panel__copy {
display: grid;
gap: 4px;
min-width: 0;
}
.growth-panel__copy span,
.section-title span,
.order-card__identity span,
.order-meta-grid span,
.footer-total span {
color: var(--text-secondary);
font-size: 11px;
font-weight: 700;
line-height: 1.2;
}
.growth-panel__copy strong,
.section-title strong {
overflow-wrap: anywhere;
color: var(--text-primary);
font-size: 18px;
font-weight: 800;
line-height: 1.25;
}
.growth-panel__copy p {
margin: 0;
color: var(--text-secondary);
font-size: 13px;
line-height: 1.5;
}
.after-sale-panel {
display: grid;
gap: 12px;
margin-bottom: 14px;
padding: 18px;
}
.section-title {
display: grid;
gap: 3px;
}
.after-sale-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
min-width: 0;
padding-top: 10px;
border-top: 1px solid color-mix(in srgb, var(--theme-border) 72%, transparent);
color: var(--text-secondary);
font-size: 13px;
}
.after-sale-row span {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.after-sale-row strong {
flex: 0 0 auto;
color: var(--theme-primary-action);
font-size: 12px;
}
.filter-panel {
display: grid;
gap: 10px;
margin-bottom: 16px;
padding: 14px;
}
.filter-row {
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
gap: 10px;
align-items: center;
}
.filter-row--amount {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.filter-date,
.filter-number {
min-width: 0;
}
.filter-summary {
color: var(--text-secondary);
font-size: 12px;
text-align: right;
}
.empty-state {
padding: 28px 16px;
}
.order-list {
display: grid;
gap: 16px;
}
.order-card {
display: grid;
gap: 14px;
padding: 16px;
transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.order-card.focused {
border-color: var(--theme-primary-action);
box-shadow: 0 20px 48px color-mix(in srgb, var(--theme-primary) 22%, transparent);
}
.order-card:active {
transform: translateY(1px);
}
.order-card__head,
.footer {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
min-width: 0;
}
.order-card__identity {
display: grid;
gap: 4px;
min-width: 0;
}
.order-card__identity strong {
overflow: hidden;
color: var(--text-primary);
font-size: 15px;
line-height: 1.3;
text-overflow: ellipsis;
white-space: nowrap;
}
.order-card__head-actions {
display: flex;
flex: 0 0 auto;
align-items: center;
gap: 6px;
}
.status {
display: inline-flex;
align-items: center;
justify-content: center;
min-height: 26px;
padding: 4px 10px;
border: 1px solid var(--theme-border);
border-radius: 999px;
font-size: 12px;
font-weight: 700;
line-height: 1;
white-space: nowrap;
}
.pending {
color: var(--theme-secondary);
background: color-mix(in srgb, var(--theme-secondary-soft) 58%, var(--theme-card-bg));
}
.completed {
color: var(--theme-primary-action);
background: color-mix(in srgb, var(--theme-primary-soft) 70%, var(--theme-card-bg));
}
.cancelled {
color: var(--theme-accent);
background: color-mix(in srgb, var(--theme-border) 76%, var(--theme-card-bg));
}
.order-meta-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 1px;
overflow: hidden;
border: 1px solid color-mix(in srgb, var(--theme-border) 76%, transparent);
border-radius: 18px;
background: color-mix(in srgb, var(--theme-border) 70%, transparent);
}
.order-meta-grid div {
display: grid;
gap: 5px;
min-width: 0;
padding: 12px;
background: color-mix(in srgb, var(--theme-card-bg) 84%, transparent);
}
.order-meta-grid__shop {
grid-column: 1 / -1;
}
.order-meta-grid strong {
overflow-wrap: anywhere;
color: var(--text-primary);
font-size: 13px;
line-height: 1.35;
}
.order-meta-grid .amount {
color: var(--theme-primary-action);
}
.order-timeline {
display: grid;
grid-auto-flow: column;
grid-auto-columns: minmax(94px, 1fr);
gap: 8px;
margin: 0;
padding: 0 0 2px;
overflow-x: auto;
list-style: none;
scrollbar-width: none;
}
.order-timeline::-webkit-scrollbar {
display: none;
}
.order-timeline li {
display: grid;
gap: 4px;
min-width: 0;
padding: 9px 10px;
border: 1px solid color-mix(in srgb, var(--theme-border) 70%, transparent);
border-radius: 14px;
color: var(--text-secondary);
background: color-mix(in srgb, var(--theme-primary-soft) 42%, var(--theme-card-bg));
}
.order-timeline li.done {
color: var(--theme-primary-action);
}
.order-timeline li.active {
border-color: var(--theme-primary-action);
box-shadow: var(--theme-focus-shadow);
}
.order-timeline strong {
color: var(--text-primary);
font-size: 12px;
line-height: 1.2;
}
.order-timeline span {
overflow: hidden;
font-size: 11px;
line-height: 1.25;
text-overflow: ellipsis;
white-space: nowrap;
}
.order-items {
display: grid;
gap: 12px;
}
.order-item {
display: grid;
grid-template-columns: 94px minmax(0, 1fr);
gap: 13px;
min-width: 0;
padding: 10px;
border: 1px solid color-mix(in srgb, var(--theme-border) 66%, transparent);
border-radius: 20px;
background: color-mix(in srgb, var(--theme-primary-soft) 34%, var(--theme-card-bg));
}
.order-item.focused {
border-color: var(--theme-primary-action);
background: color-mix(in srgb, var(--theme-primary-soft) 70%, var(--theme-card-bg));
box-shadow: var(--theme-focus-shadow);
}
.thumb {
display: flex;
align-items: center;
justify-content: center;
width: 94px;
height: 94px;
overflow: hidden;
border-radius: 16px;
color: var(--theme-primary-action);
background: var(--theme-gradient-soft);
font-size: 26px;
font-weight: 800;
}
.thumb img {
width: 100%;
height: 100%;
object-fit: cover;
}
.item-main {
display: grid;
align-content: start;
min-width: 0;
}
.item-title {
margin-bottom: 5px;
overflow-wrap: anywhere;
color: var(--text-primary);
font-size: 16px;
font-weight: 800;
line-height: 1.35;
}
.line {
margin-top: 4px;
overflow-wrap: anywhere;
color: var(--text-secondary);
font-size: 13px;
line-height: 1.45;
}
.appointment {
color: var(--theme-primary-action);
}
.review-summary,
.review-action,
.change-request,
.reject-change-summary {
margin-top: 10px;
border: 1px solid color-mix(in srgb, var(--theme-border) 70%, transparent);
border-radius: 14px;
background: color-mix(in srgb, var(--theme-card-bg) 72%, var(--theme-primary-soft));
}
.review-summary {
padding: 9px 11px;
color: var(--theme-primary-action);
font-size: 13px;
line-height: 1.45;
}
.review-action {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
padding: 8px 10px;
color: var(--theme-primary-action);
font-size: 13px;
}
.review-action span {
min-width: 0;
overflow-wrap: anywhere;
}
.change-request {
display: grid;
gap: 10px;
padding: 10px;
}
.change-info,
.impact-list,
.reject-change-summary {
display: grid;
gap: 5px;
}
.change-info {
color: var(--text-secondary);
font-size: 13px;
line-height: 1.45;
}
.change-info strong {
color: var(--text-primary);
}
.impact-list {
color: var(--theme-primary-action);
}
.change-actions {
display: flex;
flex-wrap: wrap;
gap: 8px;
justify-content: flex-end;
}
.footer {
align-items: flex-end;
padding-top: 2px;
}
.footer-total {
display: grid;
gap: 4px;
flex: 1 1 90px;
min-width: 0;
}
.footer-total strong {
color: var(--theme-primary-action);
font-size: 18px;
line-height: 1.2;
}
.footer-actions {
display: flex;
flex: 1 1 190px;
flex-wrap: wrap;
gap: 8px;
justify-content: flex-end;
}
.rating-input {
width: 100%;
}
.reject-change-summary {
margin-bottom: 14px;
padding: 10px 12px;
color: var(--text-secondary);
font-size: 13px;
}
:deep(.ant-btn) {
border-radius: 999px;
}
:deep(.ant-btn-primary) {
border-color: var(--theme-primary-action);
background: var(--theme-primary-action);
box-shadow: var(--theme-button-shadow);
}
:deep(.ant-btn-link) {
color: var(--theme-primary-action);
}
:deep(.ant-btn-dangerous) {
color: var(--theme-accent);
border-color: color-mix(in srgb, var(--theme-accent) 46%, var(--theme-border));
background: color-mix(in srgb, var(--theme-card-bg) 82%, transparent);
}
.filter-panel :deep(.ant-input-affix-wrapper),
.filter-panel :deep(.ant-picker),
.filter-panel :deep(.ant-input-number),
.filter-panel :deep(.ant-select-selector) {
width: 100%;
border-color: var(--theme-border) !important;
border-radius: 16px !important;
background: color-mix(in srgb, var(--theme-card-bg) 82%, transparent) !important;
}
.filter-panel :deep(.ant-input-affix-wrapper-focused),
.filter-panel :deep(.ant-picker-focused),
.filter-panel :deep(.ant-input-number-focused),
.filter-panel :deep(.ant-select-focused .ant-select-selector) {
border-color: var(--theme-primary-action) !important;
box-shadow: var(--theme-focus-shadow) !important;
}
@media (max-width: 374px) {
.order-content {
padding-right: 12px;
padding-left: 12px;
}
.status-tabs {
margin-right: -12px;
margin-left: -12px;
padding-right: 12px;
padding-left: 12px;
}
.order-item {
grid-template-columns: 82px minmax(0, 1fr);
}
.thumb {
width: 82px;
height: 82px;
}
}
@media (min-width: 768px) {
.order-content {
2026-05-30 18:31:35 +08:00
padding: 14px 16px 30px;
2026-05-29 13:30:56 +08:00
}
.order-card {
2026-05-30 18:31:35 +08:00
padding: 18px;
2026-05-29 13:30:56 +08:00
}
.order-item {
2026-05-30 18:31:35 +08:00
grid-template-columns: 94px minmax(0, 1fr);
2026-05-29 13:30:56 +08:00
}
.thumb {
2026-05-30 18:31:35 +08:00
width: 94px;
height: 94px;
2026-05-29 13:30:56 +08:00
}
2026-03-24 09:50:55 +08:00
}
2026-03-19 20:19:41 +08:00
</style>