增加前端格式检查配置
This commit is contained in:
@@ -24,7 +24,7 @@ const statusTabs = [
|
||||
{ key: 'pending_checkout_confirm', label: '待结账' },
|
||||
{ key: 'completed', label: '已完成' },
|
||||
]
|
||||
const tabKeys = new Set(statusTabs.map((item) => item.key))
|
||||
const tabKeys = new Set(statusTabs.map(item => item.key))
|
||||
const activeTab = ref(readTab(route.query.tab))
|
||||
const fallbackPendingPaymentMinutes = 15
|
||||
|
||||
@@ -32,14 +32,15 @@ const displayOrders = computed(() => {
|
||||
let filtered = orders.value
|
||||
|
||||
if (activeTab.value !== 'all') {
|
||||
filtered = filtered.filter((order) => order.status === activeTab.value)
|
||||
filtered = filtered.filter(order => order.status === activeTab.value)
|
||||
}
|
||||
|
||||
if (searchKeyword.value.trim()) {
|
||||
const keyword = searchKeyword.value.trim().toLowerCase()
|
||||
filtered = filtered.filter((order) =>
|
||||
order.order_no.toLowerCase().includes(keyword) ||
|
||||
order.title.toLowerCase().includes(keyword)
|
||||
filtered = filtered.filter(
|
||||
order =>
|
||||
order.order_no.toLowerCase().includes(keyword) ||
|
||||
order.title.toLowerCase().includes(keyword)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -48,9 +49,9 @@ const displayOrders = computed(() => {
|
||||
|
||||
const tabCounts = computed(() => {
|
||||
const counts: Record<string, number> = { all: orders.value.length }
|
||||
statusTabs.forEach((tab) => {
|
||||
statusTabs.forEach(tab => {
|
||||
if (tab.key !== 'all') {
|
||||
counts[tab.key] = orders.value.filter((order) => order.status === tab.key).length
|
||||
counts[tab.key] = orders.value.filter(order => order.status === tab.key).length
|
||||
}
|
||||
})
|
||||
return counts
|
||||
@@ -60,9 +61,9 @@ onMounted(loadOrders)
|
||||
|
||||
watch(
|
||||
() => route.query.tab,
|
||||
(tab) => {
|
||||
tab => {
|
||||
activeTab.value = readTab(tab)
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
function readTab(tab: unknown) {
|
||||
@@ -193,7 +194,9 @@ function getCountdownMinutes(order: Order) {
|
||||
<template #label>
|
||||
<span class="tab-label">
|
||||
{{ tab.label }}
|
||||
<span v-if="(tabCounts?.[tab.key] ?? 0) > 0" class="tab-count">{{ tabCounts?.[tab.key] }}</span>
|
||||
<span v-if="(tabCounts?.[tab.key] ?? 0) > 0" class="tab-count">{{
|
||||
tabCounts?.[tab.key]
|
||||
}}</span>
|
||||
</span>
|
||||
</template>
|
||||
</el-tab-pane>
|
||||
@@ -208,7 +211,9 @@ function getCountdownMinutes(order: Order) {
|
||||
<el-table-column label="订单号" min-width="180">
|
||||
<template #default="{ row }">
|
||||
<div class="order-no-cell">
|
||||
<span class="order-no-text" :title="row.order_no">{{ shortenOrderNo(row.order_no) }}</span>
|
||||
<span class="order-no-text" :title="row.order_no">{{
|
||||
shortenOrderNo(row.order_no)
|
||||
}}</span>
|
||||
<el-icon class="copy-icon" @click="copyOrderNo(row.order_no)">
|
||||
<CopyDocument />
|
||||
</el-icon>
|
||||
@@ -221,7 +226,9 @@ function getCountdownMinutes(order: Order) {
|
||||
<div class="amount-cell">
|
||||
<span class="amount-value">¥{{ money(orderRentAmount(row)) }}</span>
|
||||
<span class="amount-label">{{ amountLabel(row) }}</span>
|
||||
<span v-if="ownerActualIncome(row) !== null" class="amount-sub">实际到手 ¥{{ money(ownerActualIncome(row)) }}</span>
|
||||
<span v-if="ownerActualIncome(row) !== null" class="amount-sub"
|
||||
>实际到手 ¥{{ money(ownerActualIncome(row)) }}</span
|
||||
>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -239,7 +246,10 @@ function getCountdownMinutes(order: Order) {
|
||||
<template #default="{ row }">
|
||||
<div class="status-cell">
|
||||
<span>{{ orderStatusLabel(row.status) }}</span>
|
||||
<span v-if="row.status === 'pending_payment' && getCountdownMinutes(row) > 0" class="countdown-badge">
|
||||
<span
|
||||
v-if="row.status === 'pending_payment' && getCountdownMinutes(row) > 0"
|
||||
class="countdown-badge"
|
||||
>
|
||||
{{ getCountdownMinutes(row) }}分钟后超时
|
||||
</span>
|
||||
</div>
|
||||
@@ -270,10 +280,17 @@ function getCountdownMinutes(order: Order) {
|
||||
</el-table>
|
||||
|
||||
<div class="mobile-cards">
|
||||
<div v-for="order in displayOrders" :key="order.id" class="order-card" @click="router.push(`/orders/${order.id}`)">
|
||||
<div
|
||||
v-for="order in displayOrders"
|
||||
:key="order.id"
|
||||
class="order-card"
|
||||
@click="router.push(`/orders/${order.id}`)"
|
||||
>
|
||||
<div class="card-header">
|
||||
<div class="order-no-row">
|
||||
<span class="order-no-text" :title="order.order_no">{{ shortenOrderNo(order.order_no) }}</span>
|
||||
<span class="order-no-text" :title="order.order_no">{{
|
||||
shortenOrderNo(order.order_no)
|
||||
}}</span>
|
||||
<el-icon class="copy-icon" @click.stop="copyOrderNo(order.order_no)">
|
||||
<CopyDocument />
|
||||
</el-icon>
|
||||
@@ -304,7 +321,10 @@ function getCountdownMinutes(order: Order) {
|
||||
<div class="card-footer">
|
||||
<div class="status-info">
|
||||
<span class="status-label">{{ orderStatusLabel(order.status) }}</span>
|
||||
<span v-if="order.status === 'pending_payment' && getCountdownMinutes(order) > 0" class="countdown-badge">
|
||||
<span
|
||||
v-if="order.status === 'pending_payment' && getCountdownMinutes(order) > 0"
|
||||
class="countdown-badge"
|
||||
>
|
||||
{{ getCountdownMinutes(order) }}分钟后超时
|
||||
</span>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user