完成JC-ArtList与JC-Salon端侧清理和统一命名

This commit is contained in:
2026-08-25 16:21:05 +08:00
parent aa93695704
commit abce4a2787
1839 changed files with 653 additions and 50415 deletions
@@ -0,0 +1,748 @@
<template>
<div class="page">
<header class="header">
<a-button type="text" @click="router.back()">
<LeftOutlined :style="{ fontSize: '20px' }" />
</a-button>
<h1>美甲师订单</h1>
<a-button v-if="showCalendarEntry" type="link" @click="router.push('/artist-calendar')">日历</a-button>
<div v-else class="placeholder" />
</header>
<main class="content">
<section v-if="orders.length" class="filter-panel">
<a-input v-model:value="filters.keyword" allow-clear placeholder="搜索订单号、客户、作品" />
<div class="filter-row">
<a-select v-model:value="filters.source" class="filter-select" placeholder="订单来源">
<a-select-option value="all">全部来源</a-select-option>
<a-select-option value="SERVICE">客户预约我的订单</a-select-option>
<a-select-option value="SHOP">本店美甲师订单</a-select-option>
<a-select-option value="SELF">我下的订单</a-select-option>
<a-select-option value="BOTH">两者都有</a-select-option>
</a-select>
<a-select v-model:value="filters.status" class="filter-select" placeholder="订单状态">
<a-select-option value="all">全部状态</a-select-option>
<a-select-option :value="0">确认价格中</a-select-option>
<a-select-option :value="1">待使用</a-select-option>
<a-select-option :value="2">已完成</a-select-option>
<a-select-option :value="3">已取消</a-select-option>
</a-select>
</div>
<div class="filter-row">
<a-date-picker v-model:value="filters.date" class="filter-date" popup-class-name="fingertip-designer-date-picker-panel" placeholder="预约日期" />
<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>
<div class="filter-actions">
<span>共 {{ filteredOrders.length }} / {{ orders.length }} 个订单</span>
<a-button @click="resetFilters">重置</a-button>
</div>
</section>
<a-empty v-if="!orders.length" description="暂无订单">
<a-button type="primary" @click="handleRefreshClick">刷新</a-button>
</a-empty>
<a-empty v-else-if="!filteredOrders.length" description="没有符合条件的订单">
<a-button @click="resetFilters">清空筛选</a-button>
</a-empty>
<a-card
v-for="order in filteredOrders"
:key="order.id"
:ref="(el: any) => setOrderRef(order.id, el)"
class="order-card"
:class="{ 'is-target': isTargetOrder(order.id) }"
>
<div class="order-head">
<div class="order-title">
<span>订单号:{{ order.orderNo }}</span>
<span v-if="order.artistOrderSourceText" class="source-tag" :class="sourceClass(order.artistOrderSource)">
{{ order.artistOrderSourceText }}
</span>
<span v-if="isQuoteOrder(order)" class="quote-tag">询价预约</span>
</div>
<span class="status" :class="statusClass(order.status)">{{ orderStatusText(order) }}</span>
</div>
<div class="customer-meta">
<span>预约用户:{{ order.customerNickname || '用户' }}</span>
<span v-if="order.customerPhoneMasked">联系电话:{{ order.customerPhoneMasked }}</span>
</div>
<div v-if="isQuoteOrder(order)" class="quote-summary">
<div class="quote-summary__head">
<strong>{{ quoteStatusText(order) }}</strong>
<span v-if="order.quoteExpireTime">过期时间:{{ order.quoteExpireTime }}</span>
</div>
<p v-if="order.customerRemark">客户备注:{{ order.customerRemark }}</p>
<div class="quote-summary__flags">
<span>客户{{ confirmationText(order.quoteUserConfirmed) }}</span>
<span>门店{{ confirmationText(order.quoteShopConfirmed) }}</span>
</div>
</div>
<div v-for="item in order.items" :key="item.id" class="item">
<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="main">
<div class="title">{{ item.productTitle }}</div>
<div class="line">{{ formatMoney(item.price) }} x {{ item.quantity }}</div>
<div v-if="hasItemQuoteInfo(item)" class="line quote-line">
参考 {{ formatMoney(item.referencePrice ?? item.price) }} · 报价 {{ formatMoney(item.quotedPrice) }} · 最终 {{ formatMoney(item.confirmedPrice) }}
</div>
<div v-if="item.appointmentTime" class="line appointment">预约时间:{{ item.appointmentTime }}</div>
<div v-if="pendingArtistChangeForItem(order, item)" class="change-status">
改派申请处理中:{{ pendingArtistChangeForItem(order, item)?.requestedArtistName || '新美甲师' }}
</div>
<div v-else-if="canRequestArtistChange(order, item)" class="change-action">
<span>需要更换服务美甲师</span>
<a-button size="small" @click="openArtistChangeModal(order, item)">申请改派</a-button>
</div>
</div>
</div>
<div class="footer">
<span>当前项目合计:{{ formatMoney(order.actualAmount) }}</span>
<div class="footer-actions">
<a-button v-if="canQuoteOrder(order)" size="small" type="primary" @click="openQuoteModal(order)">
报价/确认价格
</a-button>
<a-button v-if="canComplete(order)" size="small" type="primary" @click="completeOrder(order.id)">
完成服务
</a-button>
</div>
</div>
</a-card>
</main>
<a-modal
v-model:open="artistChangeModalOpen"
title="申请改派"
:confirm-loading="artistChangeSubmitting"
@ok="submitArtistChangeRequest"
@cancel="closeArtistChangeModal"
>
<a-form layout="vertical">
<a-form-item label="当前美甲师">
<span>{{ artistChangeOptions?.currentArtistName || activeArtistChangeItem?.artistName || '未分配' }}</span>
</a-form-item>
<a-form-item label="新美甲师" required>
<a-select
v-model:value="artistChangeForm.requestedArtistId"
:loading="artistChangeOptionsLoading"
placeholder="请选择新的美甲师"
>
<a-select-option
v-for="artist in selectableArtistOptions"
:key="String(artist.artistId)"
:value="artist.artistId"
>
{{ artist.artistName }}
</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="改派原因" required>
<a-textarea v-model:value="artistChangeForm.reason" :rows="4" :maxlength="300" placeholder="请说明申请改派的原因" />
</a-form-item>
</a-form>
</a-modal>
<a-modal
v-model:open="quoteModalOpen"
title="门店报价"
:footer="null"
@cancel="closeQuoteModal"
>
<a-form layout="vertical" class="quote-form">
<div class="quote-form__items">
<div v-for="item in activeQuoteOrder?.items || []" :key="item.id" class="quote-form__item">
<div class="quote-form__meta">
<strong>{{ item.productTitle || `订单项 ${item.id}` }}</strong>
<span>参考价 {{ formatMoney(item.referencePrice ?? item.price) }}</span>
</div>
<a-input-number
:value="quoteInputValue(item)"
:min="0"
:precision="2"
placeholder="报价"
class="quote-form__input"
@change="value => setQuoteInputValue(item, value)"
/>
</div>
</div>
<a-form-item label="报价备注">
<a-textarea v-model:value="quoteForm.remark" :rows="3" :maxlength="300" placeholder="填写给客户的报价说明" />
</a-form-item>
<div class="quote-form__actions">
<a-button type="primary" :loading="quoteSubmitting" @click="submitQuote">提交报价</a-button>
<a-button :loading="quoteConfirming" @click="confirmQuote">确认当前价格</a-button>
</div>
</a-form>
</a-modal>
</div>
</template>
<script setup lang="ts">
/**
* ArtistOrderView 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, nextTick, 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 { userApi } from '@/api/user'
import { orderApi } from '../api/order'
import type { OrderArtistChangeOptionsVO, OrderArtistChangeRequestVO } from '../api/order'
import type { IdType } from '@/utils/id'
import { runWithGlobalLoading } from '@/utils/action-loading'
import { extractLegacyFileId, getCachedSignedImageUrl, getCachedSignedImageUrlSync } from '@/utils/signed-image-cache'
/**
* Purpose: router supports ArtistOrderView.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()
/**
* Purpose: route supports ArtistOrderView.vue by holding or executing the route 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 route = useRoute()
/**
* Purpose: orders supports ArtistOrderView.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[]>([])
/**
* Purpose: orderRefs supports ArtistOrderView.vue by holding or executing the order refs 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 orderRefs = ref<Record<string, any>>({})
/**
* Purpose: showCalendarEntry supports ArtistOrderView.vue by holding or executing the show calendar entry 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 showCalendarEntry = ref(false)
/**
* Purpose: currentUserId supports ArtistOrderView.vue by holding or executing the current user 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.
*/
const currentUserId = ref<IdType>()
const currentUserType = ref<number>()
/**
* Purpose: artistChangeModalOpen supports ArtistOrderView.vue by holding or executing the artist change 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.
*/
const artistChangeModalOpen = ref(false)
const quoteModalOpen = ref(false)
const quoteSubmitting = ref(false)
const quoteConfirming = ref(false)
/**
* Purpose: artistChangeSubmitting supports ArtistOrderView.vue by holding or executing the artist change 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.
*/
const artistChangeSubmitting = ref(false)
/**
* Purpose: artistChangeOptionsLoading supports ArtistOrderView.vue by holding or executing the artist change options loading 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 artistChangeOptionsLoading = ref(false)
/**
* Purpose: artistChangeOptions supports ArtistOrderView.vue by holding or executing the artist change options 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 artistChangeOptions = ref<OrderArtistChangeOptionsVO | null>(null)
/**
* Purpose: activeArtistChangeOrder supports ArtistOrderView.vue by holding or executing the active artist change order 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 activeArtistChangeOrder = ref<any | null>(null)
/**
* Purpose: activeArtistChangeItem supports ArtistOrderView.vue by holding or executing the active artist change 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.
*/
const activeArtistChangeItem = ref<any | null>(null)
const activeQuoteOrder = ref<any | null>(null)
/**
* Purpose: filters supports ArtistOrderView.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: '',
source: 'all',
status: 'all' as 'all' | number,
date: null as any,
minAmount: undefined as number | undefined,
maxAmount: undefined as number | undefined
})
/**
* Purpose: artistChangeForm supports ArtistOrderView.vue by holding or executing the artist change 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.
*/
const artistChangeForm = reactive({
requestedArtistId: undefined as IdType | undefined,
reason: ''
})
const quoteForm = reactive({
remark: '',
items: {} as Record<string, number | undefined>
})
/** 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.source !== 'all' && order.artistOrderSource !== filters.source) return false
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.statusText,
order.quoteStatusText,
order.customerRemark,
order.artistOrderSourceText,
order.customerNickname,
order.customerPhoneMasked,
...items.flatMap((item: any) => [item.productTitle, item.appointmentTime])
].filter(Boolean).join(' ').toLowerCase()
if (!haystack.includes(keyword)) return false
}
return true
})
})
/** targetOrderId is a local helper used by this page script. */
const targetOrderId = () => String(route.query.orderId || '')
/** isTargetOrder is a local helper used by this page script. */
const isTargetOrder = (orderId: IdType) => targetOrderId() === String(orderId)
/** setOrderRef is a local helper used by this page script. */
const setOrderRef = (orderId: IdType, el: any) => {
if (!el) return
orderRefs.value[String(orderId)] = el
}
/** scrollToTargetOrder is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
const scrollToTargetOrder = async () => {
const id = targetOrderId()
if (!id) return
await nextTick()
const target = orderRefs.value[id]?.$el || orderRefs.value[id]
target?.scrollIntoView?.({ behavior: 'smooth', block: 'center' })
}
const isQuoteOrder = (order: any) => Number(order?.status) === 0
const orderStatusText = (order: any) => order?.statusText || (isQuoteOrder(order) ? '确认价格中' : '--')
const quoteStatusText = (order: any) => order?.quoteStatusText || (isQuoteOrder(order) ? '确认价格中' : '--')
const confirmationText = (confirmed?: boolean) => confirmed ? '已确认' : '待确认'
const formatMoney = (value?: unknown) => {
if (value === undefined || value === null || value === '') return '--'
const amount = Number(value)
return Number.isFinite(amount) ? `¥${amount.toFixed(2)}` : '--'
}
const hasItemQuoteInfo = (item: any) => {
return item?.referencePrice !== undefined || item?.quotedPrice !== undefined || item?.confirmedPrice !== undefined
}
/** statusClass is a local helper used by this page script. */
const statusClass = (status: number) => {
const normalized = Number(status)
if (normalized === 0) return 'quoting'
if (normalized === 1) return 'pending'
if (normalized === 2) return 'completed'
return 'cancelled'
}
/** sourceClass is a local helper used by this page script. */
const sourceClass = (source?: string) => {
if (source === 'SELF') return 'source-self'
if (source === 'BOTH') return 'source-both'
if (source === 'SHOP') return 'source-shop'
return 'source-service'
}
/**
* Purpose: sameId supports ArtistOrderView.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.
*/
const sameId = (left: unknown, right: unknown) => {
return left !== undefined && left !== null && right !== undefined && right !== null && String(left) === String(right)
}
/**
* Purpose: pendingArtistChangeForItem supports ArtistOrderView.vue by holding or executing the pending artist change 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.
*/
const pendingArtistChangeForItem = (order: any, item: any): OrderArtistChangeRequestVO | undefined => {
const itemValue = item?.pendingArtistChangeRequest as OrderArtistChangeRequestVO | undefined
if (itemValue) return itemValue
const orderValue = order?.pendingArtistChangeRequest as OrderArtistChangeRequestVO | undefined
if (!orderValue) return undefined
return sameId(orderValue.orderItemId, item.id) || (order.items || []).length === 1 ? orderValue : undefined
}
/** canComplete is a local helper used by this page script. */
const canComplete = (order: any) => {
return !isQuoteOrder(order) && Number(order.status) === 1 && order.artistOrderSource !== 'SELF' && order.artistOrderSource !== 'SHOP'
}
const canQuoteOrder = (order: any) => {
return currentUserType.value === 2 && isQuoteOrder(order) && order.artistOrderSource === 'SHOP'
}
const resetQuoteForm = (order: any) => {
quoteForm.remark = ''
Object.keys(quoteForm.items).forEach(key => {
delete quoteForm.items[key]
})
for (const item of order?.items || []) {
if (item?.id === undefined || item?.id === null) continue
quoteForm.items[String(item.id)] = Number(item.quotedPrice ?? item.confirmedPrice ?? item.referencePrice ?? item.price ?? 0)
}
}
const openQuoteModal = (order: any) => {
if (!canQuoteOrder(order)) return
activeQuoteOrder.value = order
resetQuoteForm(order)
quoteModalOpen.value = true
}
const closeQuoteModal = () => {
quoteModalOpen.value = false
activeQuoteOrder.value = null
resetQuoteForm(null)
}
const quoteInputValue = (item: any) => {
if (item?.id === undefined || item?.id === null) return undefined
return quoteForm.items[String(item.id)]
}
const setQuoteInputValue = (item: any, value: unknown) => {
if (item?.id === undefined || item?.id === null) return
const key = String(item.id)
if (value === undefined || value === null || value === '') {
quoteForm.items[key] = undefined
return
}
quoteForm.items[key] = Number(value)
}
const collectQuoteItems = (order: any) => {
const orderItems = order?.items || []
if (!orderItems.length) return null
const items: Array<{ orderItemId: IdType; quotedPrice: number }> = []
for (const item of orderItems) {
if (item?.id === undefined || item?.id === null) return null
const price = Number(quoteForm.items[String(item.id)])
if (!Number.isFinite(price) || price <= 0) return null
items.push({ orderItemId: item.id, quotedPrice: price })
}
return items
}
const syncActiveQuoteOrder = (orderId: IdType, fallback?: any) => {
if (!sameId(activeQuoteOrder.value?.id, orderId)) return
activeQuoteOrder.value = orders.value.find(order => sameId(order.id, orderId)) || fallback || activeQuoteOrder.value
resetQuoteForm(activeQuoteOrder.value)
}
/**
* Purpose: canRequestArtistChange supports ArtistOrderView.vue by holding or executing the can request 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.
*/
const canRequestArtistChange = (order: any, item: any) => {
const assignedToCurrentUser = !currentUserId.value || !item.artistId || sameId(item.artistId, currentUserId.value)
return !isQuoteOrder(order) && Number(order.status) === 1 && item.id && assignedToCurrentUser && !pendingArtistChangeForItem(order, item)
}
/**
* Purpose: selectableArtistOptions supports ArtistOrderView.vue by holding or executing the selectable artist options 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 selectableArtistOptions = computed(() => {
const options = artistChangeOptions.value?.artists || []
return options.filter(artist => !sameId(artist.artistId, artistChangeOptions.value?.currentArtistId))
})
/** resetFilters is a local helper used by this page script. */
const resetFilters = () => {
filters.keyword = ''
filters.source = 'all'
filters.status = 'all'
filters.date = null
filters.minAmount = undefined
filters.maxAmount = undefined
}
/** loadOrders is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
const loadOrders = async () => {
try {
orders.value = (await orderApi.getArtistOrders() as unknown as any[]) || []
for (const order of orders.value) {
for (const item of order.items || []) {
const imageId = extractLegacyFileId(item.productImage)
if (!imageId) continue
const cachedUrl = getCachedSignedImageUrlSync(imageId)
if (cachedUrl) item.productImage = cachedUrl
item.productImage = await getCachedSignedImageUrl(imageId)
}
}
await scrollToTargetOrder()
} catch {
message.error('获取订单列表失败')
}
}
/** loadCalendarAccess is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
const loadCalendarAccess = async () => {
showCalendarEntry.value = false
try {
const currentUser = await userApi.getUserInfo()
currentUserId.value = currentUser.id
currentUserType.value = currentUser.type
if (currentUser.type === 3) {
showCalendarEntry.value = true
return
}
if (currentUser.type === 2) {
const artistInfo = await userApi.getNailArtistInfo(currentUser.id).catch(() => null)
showCalendarEntry.value = Number(artistInfo?.participateProduction) === 1
}
} catch {
currentUserId.value = undefined
currentUserType.value = undefined
showCalendarEntry.value = false
}
}
/** handleRefreshClick is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
const handleRefreshClick = async () => {
await runWithGlobalLoading(() => loadOrders())
}
/**
* Purpose: openArtistChangeModal supports ArtistOrderView.vue by holding or executing the open artist change 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.
*/
const openArtistChangeModal = async (order: any, item: any) => {
if (!canRequestArtistChange(order, item)) return
activeArtistChangeOrder.value = order
activeArtistChangeItem.value = item
artistChangeOptions.value = null
artistChangeForm.requestedArtistId = undefined
artistChangeForm.reason = ''
artistChangeModalOpen.value = true
artistChangeOptionsLoading.value = true
try {
artistChangeOptions.value = await orderApi.getArtistChangeOptions(order.id, item.id)
if (!selectableArtistOptions.value.length) {
message.warning('暂无可改派的美甲师')
}
} catch {
message.error('获取可改派美甲师失败')
closeArtistChangeModal()
} finally {
artistChangeOptionsLoading.value = false
}
}
/**
* Purpose: closeArtistChangeModal supports ArtistOrderView.vue by holding or executing the close artist change 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.
*/
const closeArtistChangeModal = () => {
artistChangeModalOpen.value = false
activeArtistChangeOrder.value = null
activeArtistChangeItem.value = null
artistChangeOptions.value = null
artistChangeForm.requestedArtistId = undefined
artistChangeForm.reason = ''
}
/**
* Purpose: submitArtistChangeRequest supports ArtistOrderView.vue by holding or executing the submit artist 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.
*/
const submitArtistChangeRequest = async () => {
if (!activeArtistChangeOrder.value || !activeArtistChangeItem.value) return
if (!artistChangeForm.requestedArtistId) {
message.warning('请选择新的美甲师')
return
}
const reason = artistChangeForm.reason.trim()
if (!reason) {
message.warning('请填写改派原因')
return
}
if (sameId(artistChangeForm.requestedArtistId, artistChangeOptions.value?.currentArtistId)) {
message.warning('新美甲师不能与当前美甲师相同')
return
}
artistChangeSubmitting.value = true
try {
await orderApi.requestArtistChange({
orderId: activeArtistChangeOrder.value.id,
orderItemId: activeArtistChangeItem.value.id,
requestedArtistId: artistChangeForm.requestedArtistId,
reason
})
message.success('改派申请已提交')
closeArtistChangeModal()
await loadOrders()
} catch {
message.error('提交改派申请失败')
} finally {
artistChangeSubmitting.value = false
}
}
const submitQuote = async () => {
const order = activeQuoteOrder.value
if (!order || !canQuoteOrder(order)) return
const items = collectQuoteItems(order)
if (!items) {
message.warning('请填写每个项目的有效报价')
return
}
quoteSubmitting.value = true
try {
let updatedOrder: any
await runWithGlobalLoading(async () => {
updatedOrder = await orderApi.submitShopQuote(order.id, {
remark: quoteForm.remark.trim() || undefined,
items
})
await loadOrders()
})
syncActiveQuoteOrder(order.id, updatedOrder)
message.success('报价已提交')
} catch (error: any) {
message.error(error?.message || '提交报价失败')
} finally {
quoteSubmitting.value = false
}
}
const confirmQuote = async () => {
const order = activeQuoteOrder.value
if (!order || !canQuoteOrder(order)) return
quoteConfirming.value = true
try {
let updatedOrder: any
await runWithGlobalLoading(async () => {
updatedOrder = await orderApi.confirmShopQuote(order.id)
await loadOrders()
})
syncActiveQuoteOrder(order.id, updatedOrder)
message.success('当前价格已确认')
} catch (error: any) {
message.error(error?.message || '确认当前价格失败')
} finally {
quoteConfirming.value = false
}
}
/** completeOrder is a local helper used by this page script. */
const completeOrder = (orderId: IdType) => {
Modal.confirm({
title: '确认完成服务',
content: '确定要完成这个订单吗?',
onOk: async () => {
try {
await runWithGlobalLoading(async () => {
await orderApi.completeArtistOrder(orderId)
await loadOrders()
})
message.success('订单已完成')
} catch (error: any) {
message.error('完成订单失败')
}
}
})
}
onMounted(async () => {
await Promise.all([loadCalendarAccess(), loadOrders()])
})
</script>
<style scoped>
.page { min-height: 100vh; padding-top: 60px; background: linear-gradient(rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.92)), var(--theme-background-image), var(--theme-page-bg); background-size: cover, cover, auto; background-position: center top; color: var(--text-primary); }
.header { position: fixed; top: 0; left: 0; right: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; height: 60px; padding: 10px 15px; background: rgba(255, 255, 255, 0.92); border-bottom: 1px solid var(--theme-border); backdrop-filter: blur(14px); }
.header h1 { margin: 0; font-size: 18px; color: var(--text-primary); }
.placeholder { width: 40px; height: 40px; }
.content { padding: 15px; }
.filter-panel { display: grid; gap: 10px; margin-bottom: 12px; padding: 12px; border-radius: 14px; background: var(--theme-card-bg); border: 1px solid var(--theme-border); box-shadow: 0 14px 34px rgba(122, 67, 88, 0.08); }
.filter-row { display: flex; gap: 8px; align-items: center; }
.filter-select, .filter-date, .filter-number { flex: 1; min-width: 0; }
.filter-actions { display: flex; align-items: center; justify-content: space-between; color: var(--text-secondary); font-size: 12px; }
.order-card { margin-bottom: 12px; border-radius: 14px; border: 1px solid var(--theme-border); background: var(--theme-card-bg); box-shadow: 0 14px 34px rgba(122, 67, 88, 0.08); }
.order-card.is-target { border-color: var(--theme-primary); box-shadow: 0 0 0 2px rgba(198, 89, 125, .16); }
.order-head, .footer { display: flex; align-items: center; justify-content: space-between; }
.footer { gap: 10px; }
.footer-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.order-head { margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--theme-border); }
.order-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.source-tag { padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.source-service { background: var(--theme-primary-soft); color: var(--theme-primary); }
.source-shop { background: var(--theme-primary-soft); color: var(--theme-primary); }
.source-self { background: var(--theme-primary-soft); color: var(--theme-accent); }
.source-both { background: var(--theme-primary-soft); color: var(--theme-primary); }
.quote-tag { padding: 3px 8px; border-radius: 999px; background: rgba(22, 119, 255, .1); color: #1677ff; font-size: 12px; font-weight: 600; }
.customer-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 12px; color: var(--text-secondary); font-size: 13px; }
.quote-summary { display: grid; gap: 8px; margin-bottom: 12px; padding: 10px; border-radius: 8px; background: rgba(22, 119, 255, .08); color: var(--text-secondary); font-size: 13px; }
.quote-summary__head, .quote-summary__flags { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.quote-summary__head strong { color: #1677ff; }
.quote-summary p { margin: 0; }
.status { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.quoting { background: rgba(22, 119, 255, .1); color: #1677ff; }
.pending { background: var(--theme-primary-soft); color: var(--theme-primary); }
.completed { background: var(--theme-primary-soft); color: var(--theme-primary); }
.cancelled { background: var(--theme-primary-soft); color: var(--theme-accent); }
.item { display: flex; gap: 12px; margin-bottom: 12px; }
.thumb { width: 60px; height: 60px; border-radius: 10px; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--theme-primary-soft); color: var(--theme-primary); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.main { flex: 1; }
.title { font-weight: 600; color: var(--text-primary); }
.line { margin-top: 4px; color: var(--text-secondary); font-size: 13px; }
.quote-line { color: #1677ff; }
.appointment { color: var(--theme-primary); }
.change-status { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--theme-primary-soft); color: var(--theme-primary); font-size: 13px; }
.change-action { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--theme-primary-soft); color: var(--theme-primary); font-size: 13px; }
.quote-form { display: grid; gap: 12px; }
.quote-form__items { display: grid; gap: 10px; }
.quote-form__item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px; border: 1px solid var(--theme-border); border-radius: 8px; background: var(--theme-primary-soft); }
.quote-form__meta { display: grid; gap: 3px; min-width: 0; }
.quote-form__meta strong { color: var(--text-primary); }
.quote-form__meta span { color: var(--text-secondary); font-size: 12px; }
.quote-form__input { width: 140px; flex: 0 0 auto; }
.quote-form__actions { display: flex; justify-content: flex-end; gap: 8px; }
:deep(.ant-btn-primary) { background: var(--theme-primary); border-color: var(--theme-primary); }
:deep(.ant-btn-link) { color: var(--theme-primary); }
@media (min-width: 992px) {
.content {
max-width: 980px;
margin: 0 auto;
padding: 24px;
}
}
</style>