功能:重建指尖管理师规划系统
This commit is contained in:
@@ -1402,6 +1402,14 @@ export interface OrderVO {
|
||||
paymentOrderNo?: string
|
||||
payTime?: string
|
||||
refundStatus?: string
|
||||
customerRemark?: string
|
||||
quoteStatus?: string
|
||||
quoteStatusText?: string
|
||||
quoteUserConfirmed?: boolean
|
||||
quoteShopConfirmed?: boolean
|
||||
quoteExpireTime?: string
|
||||
quoteConfirmedTime?: string
|
||||
quoteMessages?: any[]
|
||||
couponName?: string
|
||||
customerName?: string
|
||||
customerPhone?: string
|
||||
@@ -1415,6 +1423,9 @@ export interface OrderVO {
|
||||
artistName?: string
|
||||
appointmentTime?: string
|
||||
price: number
|
||||
referencePrice?: number
|
||||
quotedPrice?: number
|
||||
confirmedPrice?: number
|
||||
quantity: number
|
||||
}>
|
||||
status: number
|
||||
@@ -1448,6 +1459,12 @@ export const adminOrderApi = {
|
||||
},
|
||||
manualConfirmPayment: (id: IdType, remark?: string) => {
|
||||
return adminPaymentApi.manualConfirmOrder(id, remark)
|
||||
},
|
||||
submitQuote: (id: IdType, data: { remark?: string; items: Array<{ orderItemId: IdType; quotedPrice: number }> }) => {
|
||||
return adminApi.post<OrderVO>(`/order/${id}/quote`, data)
|
||||
},
|
||||
confirmQuote: (id: IdType) => {
|
||||
return adminApi.put<OrderVO>(`/order/${id}/quote/confirm`)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ export interface OrderItem {
|
||||
export interface CreateOrderRequest {
|
||||
couponId?: IdType
|
||||
couponSourceType?: string
|
||||
remark?: string
|
||||
items: OrderItem[]
|
||||
}
|
||||
|
||||
@@ -50,6 +51,14 @@ export interface CheckoutCouponPreview {
|
||||
endTime?: string
|
||||
}
|
||||
|
||||
export interface CheckoutIssue {
|
||||
code: string
|
||||
message: string
|
||||
itemId?: IdType
|
||||
productId?: IdType
|
||||
productTitle?: string
|
||||
}
|
||||
|
||||
export interface CheckoutPreview {
|
||||
subtotalAmount: number
|
||||
savedAmount: number
|
||||
@@ -57,6 +66,8 @@ export interface CheckoutPreview {
|
||||
bestCoupon?: CheckoutCouponPreview
|
||||
availableCoupons: CheckoutCouponPreview[]
|
||||
unavailableCoupons: CheckoutCouponPreview[]
|
||||
bookingAvailable?: boolean
|
||||
bookingIssues?: CheckoutIssue[]
|
||||
vipTip?: string
|
||||
summaryText?: string
|
||||
}
|
||||
@@ -77,6 +88,33 @@ export interface PaymentOrderVO {
|
||||
remark?: string
|
||||
}
|
||||
|
||||
export interface OrderQuoteItem {
|
||||
orderItemId: IdType
|
||||
quotedPrice?: number
|
||||
}
|
||||
|
||||
export interface OrderQuoteSubmitRequest {
|
||||
remark?: string
|
||||
items: OrderQuoteItem[]
|
||||
}
|
||||
|
||||
export interface OrderQuoteReplyRequest {
|
||||
remark?: string
|
||||
}
|
||||
|
||||
export interface OrderQuoteMessage {
|
||||
id: IdType
|
||||
orderId: IdType
|
||||
actorId?: IdType
|
||||
actorType?: string
|
||||
actorTypeText?: string
|
||||
action?: string
|
||||
actionText?: string
|
||||
remark?: string
|
||||
items?: any[]
|
||||
createTime?: string
|
||||
}
|
||||
|
||||
export interface AfterSaleApplyRequest {
|
||||
orderId: IdType
|
||||
orderItemId?: IdType
|
||||
@@ -295,9 +333,29 @@ export const orderApi = {
|
||||
return api.post('/order/create', data)
|
||||
},
|
||||
|
||||
createInquiryAppointment: (data: CreateOrderRequest) => {
|
||||
return api.post('/order/create', data)
|
||||
},
|
||||
|
||||
checkoutPreview: async (data: CheckoutPreviewRequest): Promise<CheckoutPreview> => {
|
||||
return await api.post<CheckoutPreview>('/order/checkout-preview', data) as unknown as CheckoutPreview
|
||||
},
|
||||
|
||||
replyQuote: async (orderId: IdType, data?: OrderQuoteReplyRequest): Promise<any> => {
|
||||
return await api.post(`/order/${orderId}/quote/reply`, data || {}) as unknown as any
|
||||
},
|
||||
|
||||
confirmUserQuote: async (orderId: IdType): Promise<any> => {
|
||||
return await api.put(`/order/${orderId}/quote/confirm`) as unknown as any
|
||||
},
|
||||
|
||||
submitShopQuote: async (orderId: IdType, data: OrderQuoteSubmitRequest): Promise<any> => {
|
||||
return await api.post(`/order/${orderId}/quote/shop`, data) as unknown as any
|
||||
},
|
||||
|
||||
confirmShopQuote: async (orderId: IdType): Promise<any> => {
|
||||
return await api.put(`/order/${orderId}/quote/shop/confirm`) as unknown as any
|
||||
},
|
||||
|
||||
// 获取订单列表
|
||||
getOrderList: async (): Promise<any[]> => {
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
// @vitest-environment jsdom
|
||||
|
||||
import type { InternalAxiosRequestConfig } from 'axios'
|
||||
import { createHash, createHmac } from 'node:crypto'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { attachRequestSignature } from './request-signature'
|
||||
|
||||
describe('request signature', () => {
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks()
|
||||
vi.unstubAllGlobals()
|
||||
localStorage.clear()
|
||||
})
|
||||
|
||||
it('falls back when Web Crypto subtle digest is unavailable', async () => {
|
||||
vi.spyOn(Date, 'now').mockReturnValue(1700000000000)
|
||||
vi.stubGlobal('crypto', {
|
||||
randomUUID: () => 'fallback-id'
|
||||
})
|
||||
|
||||
const config = {
|
||||
method: 'post',
|
||||
baseURL: '/api',
|
||||
url: '/order/checkout-preview',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
data: {
|
||||
items: []
|
||||
}
|
||||
} as unknown as InternalAxiosRequestConfig
|
||||
|
||||
await attachRequestSignature(config, 'access-token')
|
||||
|
||||
const headers = config.headers as Record<string, string>
|
||||
const payloadHash = createHash('sha256').update(JSON.stringify({ items: [] })).digest('hex')
|
||||
const canonical = [
|
||||
'POST',
|
||||
'/order/checkout-preview',
|
||||
'1700000000000',
|
||||
'1700000000000-fallback-id',
|
||||
payloadHash
|
||||
].join('\n')
|
||||
const expectedSignature = createHmac('sha256', 'access-token').update(canonical).digest('hex')
|
||||
|
||||
expect(headers['X-Timestamp']).toBe('1700000000000')
|
||||
expect(headers['X-Nonce']).toBe('1700000000000-fallback-id')
|
||||
expect(headers['X-Sign-Version']).toBe('v1')
|
||||
expect(headers['X-Signature']).toBe(expectedSignature)
|
||||
})
|
||||
})
|
||||
@@ -45,6 +45,17 @@ type HeaderContainer = Record<string, unknown> & {
|
||||
get?: (name: string) => unknown
|
||||
}
|
||||
|
||||
const SHA256_K = new Uint32Array([
|
||||
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
|
||||
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
|
||||
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
|
||||
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
|
||||
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
|
||||
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
|
||||
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
|
||||
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
|
||||
])
|
||||
|
||||
/**
|
||||
* Purpose: RequestSignatureOptions supports request-signature.ts by holding or executing the request signature options page or API role.
|
||||
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
@@ -65,18 +76,137 @@ function isSafeMethod(method?: string) {
|
||||
* Purpose: toHex supports request-signature.ts by holding or executing the to hex page or API role.
|
||||
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
function toHex(bytes: ArrayBuffer) {
|
||||
return Array.from(new Uint8Array(bytes))
|
||||
function toHex(bytes: ArrayBuffer | Uint8Array) {
|
||||
const view = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes)
|
||||
return Array.from(view)
|
||||
.map(byte => byte.toString(16).padStart(2, '0'))
|
||||
.join('')
|
||||
}
|
||||
|
||||
function encodeUtf8(text: string) {
|
||||
return new TextEncoder().encode(text)
|
||||
}
|
||||
|
||||
function rightRotate(value: number, bits: number) {
|
||||
return (value >>> bits) | (value << (32 - bits))
|
||||
}
|
||||
|
||||
function concatBytes(left: Uint8Array, right: Uint8Array) {
|
||||
const result = new Uint8Array(left.length + right.length)
|
||||
result.set(left, 0)
|
||||
result.set(right, left.length)
|
||||
return result
|
||||
}
|
||||
|
||||
function sha256Bytes(input: Uint8Array) {
|
||||
const paddedLength = Math.ceil((input.length + 9) / 64) * 64
|
||||
const padded = new Uint8Array(paddedLength)
|
||||
padded.set(input)
|
||||
padded[input.length] = 0x80
|
||||
|
||||
const bitLength = input.length * 8
|
||||
const view = new DataView(padded.buffer)
|
||||
view.setUint32(paddedLength - 8, Math.floor(bitLength / 0x100000000), false)
|
||||
view.setUint32(paddedLength - 4, bitLength >>> 0, false)
|
||||
|
||||
let h0 = 0x6a09e667
|
||||
let h1 = 0xbb67ae85
|
||||
let h2 = 0x3c6ef372
|
||||
let h3 = 0xa54ff53a
|
||||
let h4 = 0x510e527f
|
||||
let h5 = 0x9b05688c
|
||||
let h6 = 0x1f83d9ab
|
||||
let h7 = 0x5be0cd19
|
||||
const words = new Uint32Array(64)
|
||||
|
||||
for (let offset = 0; offset < paddedLength; offset += 64) {
|
||||
for (let index = 0; index < 16; index++) {
|
||||
words[index] = view.getUint32(offset + index * 4, false)
|
||||
}
|
||||
for (let index = 16; index < 64; index++) {
|
||||
const word15 = words[index - 15]!
|
||||
const word2 = words[index - 2]!
|
||||
const s0 = rightRotate(word15, 7) ^ rightRotate(word15, 18) ^ (word15 >>> 3)
|
||||
const s1 = rightRotate(word2, 17) ^ rightRotate(word2, 19) ^ (word2 >>> 10)
|
||||
words[index] = (words[index - 16]! + s0 + words[index - 7]! + s1) >>> 0
|
||||
}
|
||||
|
||||
let a = h0
|
||||
let b = h1
|
||||
let c = h2
|
||||
let d = h3
|
||||
let e = h4
|
||||
let f = h5
|
||||
let g = h6
|
||||
let h = h7
|
||||
|
||||
for (let index = 0; index < 64; index++) {
|
||||
const s1 = rightRotate(e, 6) ^ rightRotate(e, 11) ^ rightRotate(e, 25)
|
||||
const ch = (e & f) ^ (~e & g)
|
||||
const temp1 = (h + s1 + ch + SHA256_K[index]! + words[index]!) >>> 0
|
||||
const s0 = rightRotate(a, 2) ^ rightRotate(a, 13) ^ rightRotate(a, 22)
|
||||
const maj = (a & b) ^ (a & c) ^ (b & c)
|
||||
const temp2 = (s0 + maj) >>> 0
|
||||
h = g
|
||||
g = f
|
||||
f = e
|
||||
e = (d + temp1) >>> 0
|
||||
d = c
|
||||
c = b
|
||||
b = a
|
||||
a = (temp1 + temp2) >>> 0
|
||||
}
|
||||
|
||||
h0 = (h0 + a) >>> 0
|
||||
h1 = (h1 + b) >>> 0
|
||||
h2 = (h2 + c) >>> 0
|
||||
h3 = (h3 + d) >>> 0
|
||||
h4 = (h4 + e) >>> 0
|
||||
h5 = (h5 + f) >>> 0
|
||||
h6 = (h6 + g) >>> 0
|
||||
h7 = (h7 + h) >>> 0
|
||||
}
|
||||
|
||||
const output = new Uint8Array(32)
|
||||
const outputView = new DataView(output.buffer)
|
||||
;[h0, h1, h2, h3, h4, h5, h6, h7].forEach((value, index) => {
|
||||
outputView.setUint32(index * 4, value, false)
|
||||
})
|
||||
return output
|
||||
}
|
||||
|
||||
function hmacSha256Bytes(secret: string, message: string) {
|
||||
const blockSize = 64
|
||||
let key = encodeUtf8(secret)
|
||||
if (key.length > blockSize) {
|
||||
key = sha256Bytes(key)
|
||||
}
|
||||
|
||||
const paddedKey = new Uint8Array(blockSize)
|
||||
paddedKey.set(key)
|
||||
const outer = new Uint8Array(blockSize)
|
||||
const inner = new Uint8Array(blockSize)
|
||||
for (let index = 0; index < blockSize; index++) {
|
||||
outer[index] = paddedKey[index]! ^ 0x5c
|
||||
inner[index] = paddedKey[index]! ^ 0x36
|
||||
}
|
||||
return sha256Bytes(concatBytes(outer, sha256Bytes(concatBytes(inner, encodeUtf8(message)))))
|
||||
}
|
||||
|
||||
function getSubtleCrypto() {
|
||||
return globalThis.crypto?.subtle
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: sha256Hex supports request-signature.ts by holding or executing the sha256 hex page or API role.
|
||||
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
async function sha256Hex(text: string) {
|
||||
const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(text))
|
||||
const subtle = getSubtleCrypto()
|
||||
if (!subtle) {
|
||||
return toHex(sha256Bytes(encodeUtf8(text)))
|
||||
}
|
||||
const digest = await subtle.digest('SHA-256', encodeUtf8(text))
|
||||
return toHex(digest)
|
||||
}
|
||||
|
||||
@@ -85,14 +215,18 @@ async function sha256Hex(text: string) {
|
||||
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
async function hmacSha256Hex(secret: string, message: string) {
|
||||
const key = await crypto.subtle.importKey(
|
||||
const subtle = getSubtleCrypto()
|
||||
if (!subtle) {
|
||||
return toHex(hmacSha256Bytes(secret, message))
|
||||
}
|
||||
const key = await subtle.importKey(
|
||||
'raw',
|
||||
new TextEncoder().encode(secret),
|
||||
encodeUtf8(secret),
|
||||
{ name: 'HMAC', hash: 'SHA-256' },
|
||||
false,
|
||||
['sign']
|
||||
)
|
||||
const signature = await crypto.subtle.sign('HMAC', key, new TextEncoder().encode(message))
|
||||
const signature = await subtle.sign('HMAC', key, encodeUtf8(message))
|
||||
return toHex(signature)
|
||||
}
|
||||
|
||||
@@ -101,8 +235,8 @@ async function hmacSha256Hex(secret: string, message: string) {
|
||||
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
function randomNonce() {
|
||||
if (typeof crypto.randomUUID === 'function') {
|
||||
return `${Date.now()}-${crypto.randomUUID()}`
|
||||
if (typeof globalThis.crypto?.randomUUID === 'function') {
|
||||
return `${Date.now()}-${globalThis.crypto.randomUUID()}`
|
||||
}
|
||||
return `${Date.now()}-${Math.random().toString(36).slice(2, 12)}`
|
||||
}
|
||||
|
||||
@@ -16,11 +16,13 @@
|
||||
<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>
|
||||
@@ -57,8 +59,9 @@
|
||||
<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)">{{ order.statusText }}</span>
|
||||
<span class="status" :class="statusClass(order.status)">{{ orderStatusText(order) }}</span>
|
||||
</div>
|
||||
|
||||
<div class="customer-meta">
|
||||
@@ -66,6 +69,18 @@
|
||||
<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" />
|
||||
@@ -73,7 +88,10 @@
|
||||
</div>
|
||||
<div class="main">
|
||||
<div class="title">{{ item.productTitle }}</div>
|
||||
<div class="line">¥{{ item.price.toFixed(2) }} x {{ item.quantity }}</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 || '新美甲师' }}
|
||||
@@ -86,10 +104,15 @@
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
<span>当前项目合计:¥{{ order.actualAmount.toFixed(2) }}</span>
|
||||
<a-button v-if="canComplete(order)" size="small" type="primary" @click="completeOrder(order.id)">
|
||||
完成服务
|
||||
</a-button>
|
||||
<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>
|
||||
@@ -125,6 +148,39 @@
|
||||
</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>
|
||||
|
||||
@@ -174,11 +230,15 @@ const showCalendarEntry = ref(false)
|
||||
* 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.
|
||||
@@ -204,6 +264,7 @@ const activeArtistChangeOrder = ref<any | null>(null)
|
||||
* 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.
|
||||
@@ -224,6 +285,10 @@ 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(() => {
|
||||
@@ -243,6 +308,8 @@ const filteredOrders = computed(() => {
|
||||
const haystack = [
|
||||
order.orderNo,
|
||||
order.statusText,
|
||||
order.quoteStatusText,
|
||||
order.customerRemark,
|
||||
order.artistOrderSourceText,
|
||||
order.customerNickname,
|
||||
order.customerPhoneMasked,
|
||||
@@ -274,10 +341,30 @@ const scrollToTargetOrder = async () => {
|
||||
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) => {
|
||||
if (status === 1) return 'pending'
|
||||
if (status === 2) return 'completed'
|
||||
const normalized = Number(status)
|
||||
if (normalized === 0) return 'quoting'
|
||||
if (normalized === 1) return 'pending'
|
||||
if (normalized === 2) return 'completed'
|
||||
return 'cancelled'
|
||||
}
|
||||
|
||||
@@ -285,6 +372,7 @@ const statusClass = (status: number) => {
|
||||
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'
|
||||
}
|
||||
|
||||
@@ -310,7 +398,69 @@ const pendingArtistChangeForItem = (order: any, item: any): OrderArtistChangeReq
|
||||
|
||||
/** canComplete is a local helper used by this page script. */
|
||||
const canComplete = (order: any) => {
|
||||
return order.status === 1 && order.artistOrderSource !== 'SELF'
|
||||
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)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -319,7 +469,7 @@ const canComplete = (order: any) => {
|
||||
*/
|
||||
const canRequestArtistChange = (order: any, item: any) => {
|
||||
const assignedToCurrentUser = !currentUserId.value || !item.artistId || sameId(item.artistId, currentUserId.value)
|
||||
return order.status === 1 && item.id && assignedToCurrentUser && !pendingArtistChangeForItem(order, item)
|
||||
return !isQuoteOrder(order) && Number(order.status) === 1 && item.id && assignedToCurrentUser && !pendingArtistChangeForItem(order, item)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -366,6 +516,7 @@ const loadCalendarAccess = async () => {
|
||||
try {
|
||||
const currentUser = await userApi.getUserInfo()
|
||||
currentUserId.value = currentUser.id
|
||||
currentUserType.value = currentUser.type
|
||||
if (currentUser.type === 3) {
|
||||
showCalendarEntry.value = true
|
||||
return
|
||||
@@ -376,6 +527,7 @@ const loadCalendarAccess = async () => {
|
||||
}
|
||||
} catch {
|
||||
currentUserId.value = undefined
|
||||
currentUserType.value = undefined
|
||||
showCalendarEntry.value = false
|
||||
}
|
||||
}
|
||||
@@ -461,6 +613,52 @@ const submitArtistChangeRequest = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
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({
|
||||
@@ -498,14 +696,23 @@ onMounted(async () => {
|
||||
.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); }
|
||||
@@ -515,9 +722,18 @@ onMounted(async () => {
|
||||
.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); }
|
||||
|
||||
@@ -9,7 +9,11 @@
|
||||
</header>
|
||||
|
||||
<main class="content cart-content">
|
||||
<a-empty v-if="!cartItems.length" class="empty-cart" description="购物车还是空的">
|
||||
<div v-if="cartLoading && !cartLoaded" class="cart-loading-state" role="status" aria-label="加载购物车">
|
||||
<a-spin />
|
||||
</div>
|
||||
|
||||
<a-empty v-else-if="cartLoaded && !cartItems.length" class="empty-cart" description="购物车还是空的">
|
||||
<a-button type="primary" class="empty-action" @click="router.push('/products')">去逛作品</a-button>
|
||||
</a-empty>
|
||||
|
||||
@@ -46,11 +50,11 @@
|
||||
|
||||
<p class="product-meta">
|
||||
<span>{{ item.tagNames || item.tags || checkoutShopName }}</span>
|
||||
<span v-if="item.approximateDuration">预计 {{ item.approximateDuration }}</span>
|
||||
<span>预计 {{ displayCartDuration(item) }}</span>
|
||||
</p>
|
||||
|
||||
<div class="product-bottom">
|
||||
<strong class="product-price">¥{{ Number(item.price || 0).toFixed(2) }}</strong>
|
||||
<strong class="product-price">参考价 ¥{{ Number(item.price || 0).toFixed(2) }}</strong>
|
||||
<div class="product-qty" aria-label="调整数量">
|
||||
<button type="button" :disabled="item.quantity <= 1" @click="changeQuantity(item, -1)">−</button>
|
||||
<span>{{ item.quantity }}</span>
|
||||
@@ -71,7 +75,7 @@
|
||||
<div v-if="selectedCount && firstCheckoutIssue" class="issue-callout stitch-issue">
|
||||
<div>
|
||||
<strong>{{ firstCheckoutIssue.message }}</strong>
|
||||
<span>完善服务信息后即可提交订单</span>
|
||||
<span>完善服务信息后即可发起询价预约</span>
|
||||
</div>
|
||||
<a-button size="small" @click="focusFirstIssue">去完善</a-button>
|
||||
</div>
|
||||
@@ -128,7 +132,7 @@
|
||||
</div>
|
||||
<div class="service-time-grid">
|
||||
<button
|
||||
v-for="slot in quickAppointmentSlots"
|
||||
v-for="slot in getQuickAppointmentSlots(item)"
|
||||
:key="`${item.id}-${slot.value}`"
|
||||
type="button"
|
||||
class="service-time-option"
|
||||
@@ -168,11 +172,15 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="cart-section summary-panel stitch-summary" aria-label="订单摘要">
|
||||
<h3>订单摘要</h3>
|
||||
<div class="summary-row"><span>小计</span><strong>¥{{ subtotal.toFixed(2) }}</strong></div>
|
||||
<div v-if="discountAmount > 0" class="summary-row discount"><span>优惠</span><strong>- ¥{{ discountAmount.toFixed(2) }}</strong></div>
|
||||
<div class="summary-row total"><span>合计</span><strong>¥{{ totalAmount.toFixed(2) }}</strong></div>
|
||||
<section class="cart-section summary-panel stitch-summary" aria-label="询价预约摘要">
|
||||
<h3>询价预约摘要</h3>
|
||||
<label class="quote-remark-field">
|
||||
<span>备注</span>
|
||||
<a-textarea v-model:value="quoteRemark" :rows="3" :maxlength="300" placeholder="可填写款式偏好、到店需求或其他说明" />
|
||||
</label>
|
||||
<div class="summary-row"><span>参考小计</span><strong>¥{{ subtotal.toFixed(2) }}</strong></div>
|
||||
<div v-if="discountAmount > 0" class="summary-row discount"><span>预估优惠</span><strong>- ¥{{ discountAmount.toFixed(2) }}</strong></div>
|
||||
<div class="summary-row total"><span>预估应付</span><strong>¥{{ totalAmount.toFixed(2) }}</strong></div>
|
||||
</section>
|
||||
</template>
|
||||
</main>
|
||||
@@ -183,11 +191,11 @@
|
||||
size="large"
|
||||
class="checkout-button"
|
||||
:loading="submittingOrder"
|
||||
:disabled="submittingOrder || !selectedCount"
|
||||
:disabled="submittingOrder || !selectedCount || Boolean(firstCheckoutIssue)"
|
||||
@click="checkout"
|
||||
>
|
||||
<CheckCircleOutlined />
|
||||
确认订单
|
||||
发起询价预约
|
||||
</a-button>
|
||||
</footer>
|
||||
|
||||
@@ -219,7 +227,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="coupon-tip">
|
||||
{{ checkoutPreview?.vipTip || '系统会按本次订单金额自动预选减免最高的一张券,也可以手动选择不使用优惠。' }}
|
||||
{{ checkoutPreview?.vipTip || '系统会按本次询价预约的参考金额预估减免最高的一张券,也可以手动选择不使用优惠。' }}
|
||||
</div>
|
||||
</a-modal>
|
||||
|
||||
@@ -298,7 +306,7 @@ import { cartApi } from '../api/cart'
|
||||
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
import { orderApi } from '../api/order'
|
||||
import type { CheckoutCouponPreview, CheckoutPreview } from '../api/order'
|
||||
import type { CheckoutCouponPreview, CheckoutIssue as ApiCheckoutIssue, CheckoutPreview } from '../api/order'
|
||||
import { shopApi } from '../api/shop'
|
||||
import type { IdType } from '@/utils/id'
|
||||
import { sameId, toOptionalIdString } from '@/utils/id'
|
||||
@@ -364,6 +372,9 @@ interface CartItem {
|
||||
tags: string
|
||||
tagNames?: string
|
||||
approximateDuration?: string
|
||||
serviceDurationMinutes?: number
|
||||
estimatedTime?: number
|
||||
businessHours?: string
|
||||
bookableArtists?: string
|
||||
availableBookableArtistCount?: number
|
||||
bookableArtistRestricted?: boolean
|
||||
@@ -382,6 +393,8 @@ interface CheckoutIssue {
|
||||
key: string
|
||||
message: string
|
||||
itemId?: IdType
|
||||
productId?: IdType
|
||||
productTitle?: string
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -389,6 +402,8 @@ interface CheckoutIssue {
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const cartItems = ref<CartItem[]>([])
|
||||
const cartLoading = ref(false)
|
||||
const cartLoaded = ref(false)
|
||||
/**
|
||||
* Purpose: itemRefs supports CartView.vue by holding or executing the item 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.
|
||||
@@ -406,6 +421,7 @@ const checkoutPreview = ref<CheckoutPreview | null>(null)
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const selectedCoupon = ref<CheckoutCouponPreview | null>(null)
|
||||
const quoteRemark = ref('')
|
||||
/** couponSelectionKey is a reactive state variable used by the template and event handlers. */
|
||||
const couponSelectionKey = ref(NO_COUPON_KEY)
|
||||
/** couponSelectionTouched is a reactive state variable used by the template and event handlers. */
|
||||
@@ -433,6 +449,7 @@ const draftArtistId = ref<IdType>()
|
||||
const draftAppointmentTime = ref('')
|
||||
/** currentShopHours is a reactive state variable used by the template and event handlers. */
|
||||
const currentShopHours = ref('')
|
||||
const shopHoursById = ref<Record<string, string>>({})
|
||||
/** submittingOrder is a reactive state variable used by the template and event handlers. */
|
||||
const submittingOrder = ref(false)
|
||||
/** buyNowProductId limits checkout selection to the product that opened cart from "立即预约". */
|
||||
@@ -478,11 +495,19 @@ const bookingTitle = computed(() => currentItem.value ? `为 ${currentItem.value
|
||||
const bookingHelperText = computed(() => {
|
||||
const texts: string[] = []
|
||||
if (currentShopHours.value) texts.push(`门店营业时间:${currentShopHours.value}`)
|
||||
if (currentItem.value?.approximateDuration) texts.push(`预计时长:${currentItem.value.approximateDuration}`)
|
||||
if (currentItem.value) texts.push(`预计时长:${displayCartDuration(currentItem.value)}`)
|
||||
return texts.join(' · ') || '请选择至少晚于当前 5 分钟的预约时间'
|
||||
})
|
||||
/** quickAppointmentSlots is a reactive state variable used by the template and event handlers. */
|
||||
const quickAppointmentSlots = computed(() => {
|
||||
if (currentItem.value) {
|
||||
return getQuickAppointmentSlots(currentItem.value)
|
||||
}
|
||||
|
||||
return buildQuickAppointmentSlots()
|
||||
})
|
||||
|
||||
const buildQuickAppointmentSlots = (item?: CartItem) => {
|
||||
const now = getMinAppointmentDate()
|
||||
const today = new Date(now)
|
||||
const nextHour = new Date(now)
|
||||
@@ -497,14 +522,20 @@ const quickAppointmentSlots = computed(() => {
|
||||
const weekendMorning = nextWeekendMorning(today)
|
||||
|
||||
return [nextHour, tomorrowMorning, tomorrowAfternoon, afterTomorrowAfternoon, weekendMorning]
|
||||
.filter((date, index, list) => date.getTime() >= now.getTime() && list.findIndex(item => item.getTime() === date.getTime()) === index)
|
||||
.filter((date, index, list) =>
|
||||
date.getTime() >= now.getTime()
|
||||
&& list.findIndex(current => current.getTime() === date.getTime()) === index
|
||||
&& isAppointmentWithinBusinessHours(date, item)
|
||||
)
|
||||
.slice(0, 5)
|
||||
.map(date => ({
|
||||
value: formatAppointmentValue(date),
|
||||
label: quickDateLabel(date),
|
||||
time: `${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}`
|
||||
}))
|
||||
})
|
||||
}
|
||||
|
||||
const getQuickAppointmentSlots = (item: CartItem) => buildQuickAppointmentSlots(item)
|
||||
|
||||
/** getMinAppointmentDate is a local helper used by this page script. */
|
||||
const getMinAppointmentDate = () => {
|
||||
@@ -546,6 +577,61 @@ const formatAppointmentValue = (date: Date) => {
|
||||
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:00`
|
||||
}
|
||||
|
||||
const parseDurationMinutes = (value?: string | number | null): number | null => {
|
||||
if (value == null || value === '') return null
|
||||
if (typeof value === 'number') return Number.isFinite(value) && value > 0 ? value : null
|
||||
const text = String(value).trim()
|
||||
const hourMatch = text.match(/(\d+(?:\.\d+)?)\s*(?:小时|h|hour)/i)
|
||||
const minuteMatch = text.match(/(\d+(?:\.\d+)?)\s*(?:分钟|min|minute)/i)
|
||||
if (hourMatch || minuteMatch) {
|
||||
const hours = hourMatch ? Number(hourMatch[1]) : 0
|
||||
const minutes = minuteMatch ? Number(minuteMatch[1]) : 0
|
||||
const total = Math.round(hours * 60 + minutes)
|
||||
return total > 0 ? total : null
|
||||
}
|
||||
const numberMatch = text.match(/\d+(?:\.\d+)?/)
|
||||
if (!numberMatch) return null
|
||||
const total = Math.round(Number(numberMatch[0]))
|
||||
return total > 0 ? total : null
|
||||
}
|
||||
|
||||
const getCartDurationMinutes = (item: CartItem): number | null => {
|
||||
return parseDurationMinutes(item.approximateDuration)
|
||||
?? parseDurationMinutes(item.serviceDurationMinutes)
|
||||
?? parseDurationMinutes(item.estimatedTime)
|
||||
}
|
||||
|
||||
const displayCartDuration = (item: CartItem) => {
|
||||
const duration = item.approximateDuration?.trim()
|
||||
if (duration) return duration
|
||||
const minutes = getCartDurationMinutes(item)
|
||||
return minutes ? `${minutes}分钟` : '时长待定'
|
||||
}
|
||||
|
||||
const parseBusinessHoursRange = (value?: string | null): { open: number; close: number } | null => {
|
||||
const text = String(value || '').replace(/[:]/g, ':').replace(/[-—–]/g, '-')
|
||||
const match = text.match(/(\d{1,2}):(\d{2})\s*-\s*(\d{1,2}):(\d{2})/)
|
||||
if (!match) return null
|
||||
const open = Number(match[1]) * 60 + Number(match[2])
|
||||
const close = Number(match[3]) * 60 + Number(match[4])
|
||||
if (!Number.isFinite(open) || !Number.isFinite(close) || close <= open) return null
|
||||
return { open, close }
|
||||
}
|
||||
|
||||
const getItemBusinessHours = (item?: CartItem) => {
|
||||
if (!item) return ''
|
||||
const shopKey = toOptionalIdString(item.shopId)
|
||||
return item.businessHours || (shopKey ? shopHoursById.value[shopKey] : '') || ''
|
||||
}
|
||||
|
||||
const isAppointmentWithinBusinessHours = (date: Date, item?: CartItem) => {
|
||||
const range = parseBusinessHoursRange(getItemBusinessHours(item))
|
||||
if (!range) return true
|
||||
const start = date.getHours() * 60 + date.getMinutes()
|
||||
const duration = item ? getCartDurationMinutes(item) || 0 : 0
|
||||
return start >= range.open && start + duration <= range.close
|
||||
}
|
||||
|
||||
/** quickDateLabel is a local helper used by this page script. */
|
||||
const quickDateLabel = (date: Date) => {
|
||||
const today = new Date()
|
||||
@@ -637,6 +723,20 @@ const appointmentStatusText = (item: CartItem) => {
|
||||
return '已完成'
|
||||
}
|
||||
|
||||
const mapApiCheckoutIssue = (issue: ApiCheckoutIssue): CheckoutIssue | null => {
|
||||
if (!issue?.message) return null
|
||||
const matchedItem = selectedItems.value.find(item => issue.itemId != null && sameId(item.id, issue.itemId))
|
||||
|| selectedItems.value.find(item => issue.productId != null && sameId(item.productId, issue.productId))
|
||||
|
||||
return {
|
||||
key: `server-${issue.code || issue.message}`,
|
||||
message: issue.message,
|
||||
itemId: matchedItem?.id || issue.itemId,
|
||||
productId: issue.productId,
|
||||
productTitle: issue.productTitle || matchedItem?.productTitle
|
||||
}
|
||||
}
|
||||
|
||||
// 购物车结算口径要求单店铺、单美甲师、完整预约信息,避免后端拆单和排班出现歧义。
|
||||
const checkoutIssues = computed<CheckoutIssue[]>(() => {
|
||||
const items = selectedItems.value
|
||||
@@ -674,6 +774,12 @@ const checkoutIssues = computed<CheckoutIssue[]>(() => {
|
||||
issues.push({ key: 'artist-mix', message: '不同美甲师的项目请分开结算', itemId: items[0]?.id })
|
||||
}
|
||||
|
||||
const apiIssues = checkoutPreview.value?.bookingIssues || []
|
||||
apiIssues
|
||||
.map(mapApiCheckoutIssue)
|
||||
.filter((issue): issue is CheckoutIssue => Boolean(issue))
|
||||
.forEach(issue => issues.push(issue))
|
||||
|
||||
return issues
|
||||
})
|
||||
|
||||
@@ -699,34 +805,101 @@ const focusFirstIssue = () => {
|
||||
scrollToIssue(checkoutIssues.value[0])
|
||||
}
|
||||
|
||||
const isDisplayableImageSource = (value?: string | null) => {
|
||||
const source = String(value || '').trim()
|
||||
return source.startsWith('http://')
|
||||
|| source.startsWith('https://')
|
||||
|| source.startsWith('/')
|
||||
|| source.startsWith('data:image/')
|
||||
|| source.startsWith('blob:')
|
||||
}
|
||||
|
||||
const getInitialCartImage = (rawImage?: string, previousImage?: string) => {
|
||||
const imageId = extractLegacyFileId(rawImage)
|
||||
const cachedUrl = imageId ? getCachedSignedImageUrlSync(imageId) : ''
|
||||
if (cachedUrl) return cachedUrl
|
||||
if (previousImage) return previousImage
|
||||
return isDisplayableImageSource(rawImage) ? String(rawImage) : ''
|
||||
}
|
||||
|
||||
/** loadCartItems is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
|
||||
const loadCartItems = async () => {
|
||||
const response = await cartApi.getCartList() as unknown as any[]
|
||||
cartItems.value = (response || []).map(item => ({
|
||||
...item,
|
||||
selected: isBuyNowMode.value ? isBuyNowCartItem(item.productId, buyNowProductId.value) : true,
|
||||
originalProductImage: item.productImage,
|
||||
productImage: '',
|
||||
appointmentTime: item.appointmentTime
|
||||
}))
|
||||
couponSelectionTouched.value = false
|
||||
couponSelectionKey.value = NO_COUPON_KEY
|
||||
selectedCoupon.value = null
|
||||
await Promise.all([loadProductImages(), loadAvailableCoupons()])
|
||||
cartLoading.value = true
|
||||
try {
|
||||
const response = await cartApi.getCartList() as unknown as any[]
|
||||
const previousItems = cartItems.value
|
||||
cartItems.value = (response || []).map(item => {
|
||||
const previous = previousItems.find(current => sameId(current.id, item.id))
|
||||
|| previousItems.find(current => sameId(current.productId, item.productId))
|
||||
const originalProductImage = item.productImage || previous?.originalProductImage || ''
|
||||
const shopKey = toOptionalIdString(item.shopId)
|
||||
return {
|
||||
...item,
|
||||
selected: isBuyNowMode.value ? isBuyNowCartItem(item.productId, buyNowProductId.value) : previous?.selected ?? true,
|
||||
originalProductImage,
|
||||
productImage: getInitialCartImage(originalProductImage, previous?.productImage),
|
||||
appointmentTime: item.appointmentTime,
|
||||
businessHours: item.businessHours || previous?.businessHours || (shopKey ? shopHoursById.value[shopKey] : '')
|
||||
}
|
||||
})
|
||||
couponSelectionTouched.value = false
|
||||
couponSelectionKey.value = NO_COUPON_KEY
|
||||
selectedCoupon.value = null
|
||||
await Promise.all([loadProductImages(), loadCartItemShopHours()])
|
||||
await loadAvailableCoupons()
|
||||
} finally {
|
||||
cartLoading.value = false
|
||||
cartLoaded.value = true
|
||||
}
|
||||
}
|
||||
|
||||
/** loadProductImages is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
|
||||
const loadProductImages = async () => {
|
||||
for (const item of cartItems.value) {
|
||||
if (!item.originalProductImage) continue
|
||||
if (!item.originalProductImage) {
|
||||
continue
|
||||
}
|
||||
const imageId = extractLegacyFileId(item.originalProductImage)
|
||||
if (!imageId) continue
|
||||
if (!imageId) {
|
||||
if (!item.productImage && isDisplayableImageSource(item.originalProductImage)) {
|
||||
item.productImage = item.originalProductImage
|
||||
}
|
||||
continue
|
||||
}
|
||||
const cachedUrl = getCachedSignedImageUrlSync(imageId)
|
||||
if (cachedUrl) item.productImage = cachedUrl
|
||||
item.productImage = await getCachedSignedImageUrl(imageId)
|
||||
const signedUrl = await getCachedSignedImageUrl(imageId, item.productImage || item.originalProductImage)
|
||||
if (signedUrl) item.productImage = signedUrl
|
||||
}
|
||||
}
|
||||
|
||||
const loadCartItemShopHours = async () => {
|
||||
const shopIds = Array.from(new Set(
|
||||
cartItems.value
|
||||
.map(item => toOptionalIdString(item.shopId))
|
||||
.filter((shopId): shopId is string => Boolean(shopId))
|
||||
.filter(shopId => !shopHoursById.value[shopId])
|
||||
))
|
||||
await Promise.all(shopIds.map(async shopId => {
|
||||
try {
|
||||
const shop = await shopApi.getShopById(shopId) as any
|
||||
const businessHours = String(shop?.businessHours || '')
|
||||
if (businessHours) {
|
||||
shopHoursById.value = { ...shopHoursById.value, [shopId]: businessHours }
|
||||
}
|
||||
} catch {
|
||||
shopHoursById.value = { ...shopHoursById.value, [shopId]: '' }
|
||||
}
|
||||
}))
|
||||
|
||||
cartItems.value.forEach(item => {
|
||||
const shopKey = toOptionalIdString(item.shopId)
|
||||
if (shopKey && !item.businessHours && shopHoursById.value[shopKey]) {
|
||||
item.businessHours = shopHoursById.value[shopKey]
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** loadAvailableCoupons is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
|
||||
const loadAvailableCoupons = async () => {
|
||||
const currentSelectedKey = selectedCoupon.value ? getCouponKey(selectedCoupon.value) : couponSelectionKey.value
|
||||
@@ -744,6 +917,7 @@ const loadAvailableCoupons = async () => {
|
||||
const preview = await orderApi.checkoutPreview({
|
||||
couponId: selectedCoupon.value?.id,
|
||||
couponSourceType: selectedCoupon.value?.sourceType || (couponSelectionTouched.value && currentSelectedKey === NO_COUPON_KEY ? NO_COUPON_KEY : undefined),
|
||||
remark: quoteRemark.value.trim() || undefined,
|
||||
items: selectedItems.value.map(item => ({
|
||||
productId: item.productId,
|
||||
quantity: item.quantity,
|
||||
@@ -876,9 +1050,17 @@ const loadArtists = async (item: CartItem) => {
|
||||
const loadShopHours = async (shopId?: IdType) => {
|
||||
currentShopHours.value = ''
|
||||
if (!shopId) return
|
||||
const shopKey = toOptionalIdString(shopId)
|
||||
if (shopKey && shopHoursById.value[shopKey]) {
|
||||
currentShopHours.value = shopHoursById.value[shopKey]
|
||||
return
|
||||
}
|
||||
try {
|
||||
const shop = await shopApi.getShopById(shopId) as any
|
||||
currentShopHours.value = shop?.businessHours || ''
|
||||
if (shopKey) {
|
||||
shopHoursById.value = { ...shopHoursById.value, [shopKey]: currentShopHours.value }
|
||||
}
|
||||
} catch {
|
||||
currentShopHours.value = ''
|
||||
}
|
||||
@@ -958,15 +1140,15 @@ const applyCouponSelection = async () => {
|
||||
|
||||
const openCheckoutRecovery = (error: unknown) => {
|
||||
const actions = buildRecoveryActions([
|
||||
{ key: 'retry', text: '重试下单' },
|
||||
{ key: 'retry', text: '重试发起询价' },
|
||||
{ key: 'orders', text: '查看订单' }
|
||||
])
|
||||
const retryAction = actions[0]
|
||||
const ordersAction = actions[1]
|
||||
Modal.confirm({
|
||||
title: '下单失败',
|
||||
content: `${getRecoveryMessage(error, '订单创建失败')}。如果担心重复下单,请先查看订单;仍失败时请联系客服。`,
|
||||
okText: retryAction?.text || '重试下单',
|
||||
title: '发起询价预约失败',
|
||||
content: `${getRecoveryMessage(error, '询价预约发起失败')}。如果担心重复提交,请先查看订单;仍失败时请联系客服。`,
|
||||
okText: retryAction?.text || '重试发起询价',
|
||||
cancelText: ordersAction?.text || '查看订单',
|
||||
onOk: () => checkout(),
|
||||
onCancel: () => router.push(ordersAction?.route || '/orders')
|
||||
@@ -992,9 +1174,10 @@ const checkout = async () => {
|
||||
|
||||
submittingOrder.value = true
|
||||
try {
|
||||
await runWithGlobalLoading(() => orderApi.createOrder({
|
||||
await runWithGlobalLoading(() => orderApi.createInquiryAppointment({
|
||||
couponId: selectedCoupon.value?.id,
|
||||
couponSourceType: selectedCoupon.value?.sourceType || (couponSelectionTouched.value && !selectedCoupon.value ? NO_COUPON_KEY : undefined),
|
||||
remark: quoteRemark.value.trim() || undefined,
|
||||
items: items.map(item => ({
|
||||
productId: item.productId,
|
||||
quantity: item.quantity,
|
||||
@@ -1002,7 +1185,7 @@ const checkout = async () => {
|
||||
appointmentTime: item.appointmentTime
|
||||
}))
|
||||
}))
|
||||
message.success('订单创建成功')
|
||||
message.success('询价预约已发起,等待门店确认价格')
|
||||
|
||||
let followupWarningShown = false
|
||||
try {
|
||||
@@ -1010,16 +1193,16 @@ const checkout = async () => {
|
||||
await updateCartCount()
|
||||
} catch (followupError) {
|
||||
followupWarningShown = true
|
||||
console.error('订单创建后刷新购物车失败:', followupError)
|
||||
message.warning('订单已创建,但购物车刷新失败,请前往订单页查看')
|
||||
console.error('询价预约发起后刷新购物车失败:', followupError)
|
||||
message.warning('询价预约已发起,但购物车刷新失败,请前往订单页查看')
|
||||
}
|
||||
|
||||
try {
|
||||
await router.push('/orders')
|
||||
} catch (navigationError) {
|
||||
console.error('订单创建后跳转订单页失败:', navigationError)
|
||||
console.error('询价预约发起后跳转订单页失败:', navigationError)
|
||||
if (!followupWarningShown) {
|
||||
message.warning('订单已创建,但跳转订单页失败,请手动前往订单页查看')
|
||||
message.warning('询价预约已发起,但跳转订单页失败,请手动前往订单页查看')
|
||||
}
|
||||
}
|
||||
} catch (error: any) {
|
||||
@@ -1108,6 +1291,12 @@ onMounted(async () => {
|
||||
box-shadow: 0 18px 44px color-mix(in srgb, var(--theme-neutral) 8%, transparent);
|
||||
}
|
||||
|
||||
.cart-loading-state {
|
||||
display: grid;
|
||||
min-height: 56vh;
|
||||
place-items: center;
|
||||
}
|
||||
|
||||
.empty-cart :deep(.ant-empty-description) {
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
@@ -1715,6 +1904,14 @@ onMounted(async () => {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.quote-remark-field {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
margin-bottom: 14px;
|
||||
color: var(--text-secondary);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.summary-row.discount strong,
|
||||
.summary-row.total strong {
|
||||
color: var(--theme-accent);
|
||||
|
||||
@@ -345,7 +345,7 @@ const page = ref(1)
|
||||
*/
|
||||
const pageSize = 8
|
||||
const now = ref(new Date())
|
||||
let greetingTimer: ReturnType<typeof window.setInterval> | undefined
|
||||
let greetingTimer: number | undefined
|
||||
|
||||
/** isLoggedIn is a reactive state variable used by the template and event handlers. */
|
||||
const isLoggedIn = computed(() => Boolean(localStorage.getItem('accessToken') || sessionStorage.getItem('accessToken')))
|
||||
|
||||
@@ -19,6 +19,9 @@ const reviews = ref<OrderArtistReviewVO[]>([])
|
||||
const changeRequests = ref<OrderArtistChangeRequestVO[]>([])
|
||||
const afterSales = ref<AfterSaleVO[]>([])
|
||||
const contact = ref<ContactInfoVO | null>(null)
|
||||
const quoteReply = ref('')
|
||||
const quoteSubmitting = ref(false)
|
||||
const quoteConfirming = ref(false)
|
||||
|
||||
const orderId = computed(() => String(route.params.id || route.query.orderId || ''))
|
||||
const items = computed(() => Array.isArray(order.value?.items) ? order.value.items : [])
|
||||
@@ -29,16 +32,27 @@ const formatMoney = (value?: number | string) => {
|
||||
}
|
||||
|
||||
const formatDateTime = (value?: string) => value ? String(value).replace('T', ' ').slice(0, 16) : '--'
|
||||
const statusClass = (status?: number) => status === 2 ? 'done' : status === 3 ? 'cancelled' : 'pending'
|
||||
const isQuoteStatus = (status?: unknown) => Number(status) === 0
|
||||
const isQuoteConfirming = computed(() => isQuoteStatus(order.value?.status))
|
||||
const statusClass = (status?: number) => isQuoteStatus(status) ? 'quote' : status === 2 ? 'done' : status === 3 ? 'cancelled' : 'pending'
|
||||
const isOrderPaid = (target: any) => String(target?.paymentStatus || '').toUpperCase() === 'PAID'
|
||||
const canPreparePayment = computed(() => Number(order.value?.status) === 1 && !isOrderPaid(order.value))
|
||||
const canMockPay = computed(() => Number(order.value?.status) === 1 && String(order.value?.paymentStatus || '').toUpperCase() === 'PAYING')
|
||||
const canApplyAfterSale = computed(() => Number(order.value?.status) === 2 || isOrderPaid(order.value))
|
||||
const canPreparePayment = computed(() => !isQuoteConfirming.value && Number(order.value?.status) === 1 && !isOrderPaid(order.value))
|
||||
const canMockPay = computed(() => !isQuoteConfirming.value && Number(order.value?.status) === 1 && String(order.value?.paymentStatus || '').toUpperCase() === 'PAYING')
|
||||
const canApplyAfterSale = computed(() => !isQuoteConfirming.value && (Number(order.value?.status) === 2 || isOrderPaid(order.value)))
|
||||
|
||||
const timeline = computed(() => {
|
||||
const current = order.value || {}
|
||||
const firstAppointment = items.value.map((item: any) => item.appointmentTime).find(Boolean)
|
||||
const status = Number(current.status)
|
||||
if (status === 0) {
|
||||
return [
|
||||
{ key: 'created', title: '已创建', text: formatDateTime(current.createTime), done: true, active: false },
|
||||
{ key: 'quote', title: '确认价格', text: current.quoteStatusText || '等待双方确认', done: Boolean(current.quoteUserConfirmed && current.quoteShopConfirmed), active: true },
|
||||
{ key: 'appointment', title: '预约时间', text: firstAppointment ? formatDateTime(firstAppointment) : '价格确认后安排', done: Boolean(firstAppointment), active: false },
|
||||
{ key: 'service', title: '服务完成', text: '待服务', done: false, active: false },
|
||||
{ key: 'review', title: '评价', text: '完成后可评价', done: false, active: false }
|
||||
]
|
||||
}
|
||||
return [
|
||||
{ key: 'created', title: '已创建', text: formatDateTime(current.createTime), done: true, active: false },
|
||||
{ key: 'appointment', title: '预约时间', text: formatDateTime(firstAppointment), done: Boolean(firstAppointment), active: status === 1 },
|
||||
@@ -48,6 +62,51 @@ const timeline = computed(() => {
|
||||
]
|
||||
})
|
||||
|
||||
const hasAmount = (value: unknown) => value !== undefined && value !== null && value !== '' && Number.isFinite(Number(value))
|
||||
|
||||
const formatQuoteAmount = (value: unknown, fallback = '--') => hasAmount(value) ? formatMoney(value as number | string) : fallback
|
||||
|
||||
const quoteReferencePrice = (item: any) => item?.referencePrice ?? item?.price
|
||||
|
||||
const quoteMessages = computed(() => Array.isArray(order.value?.quoteMessages) ? order.value.quoteMessages : [])
|
||||
|
||||
const quoteStatusText = computed(() => order.value?.quoteStatusText || order.value?.statusText || '确认价格中')
|
||||
|
||||
const quoteExpireText = computed(() => {
|
||||
const expireTime = formatDateTime(order.value?.quoteExpireTime)
|
||||
return expireTime !== '--' ? `有效期至 ${expireTime}` : '等待门店报价'
|
||||
})
|
||||
|
||||
const quoteMessageItems = (quoteMessage: any) => Array.isArray(quoteMessage?.items) ? quoteMessage.items : []
|
||||
|
||||
const quoteActorText = (quoteMessage: any) => {
|
||||
if (quoteMessage?.actorTypeText) return quoteMessage.actorTypeText
|
||||
if (String(quoteMessage?.actorType || '').toUpperCase() === 'USER') return '用户'
|
||||
if (String(quoteMessage?.actorType || '').toUpperCase() === 'SHOP') return '门店'
|
||||
return '系统'
|
||||
}
|
||||
|
||||
const quoteActionText = (quoteMessage: any) => quoteMessage?.actionText || quoteMessage?.action || '报价更新'
|
||||
|
||||
const quoteMessageKey = (quoteMessage: any, index: string | number) => {
|
||||
return String(quoteMessage?.id ?? `${quoteMessage?.createTime || 'quote'}-${quoteMessage?.action || index}`)
|
||||
}
|
||||
|
||||
const quoteMessageItemKey = (quoteItem: any) => {
|
||||
return String(quoteItem?.orderItemId ?? quoteItem?.productId ?? quoteItem?.id ?? JSON.stringify(quoteItem))
|
||||
}
|
||||
|
||||
const quoteMessageItemText = (quoteItem: any) => {
|
||||
const sourceItem = items.value.find((item: any) => String(item.id) === String(quoteItem?.orderItemId) || String(item.productId) === String(quoteItem?.productId))
|
||||
const title = quoteItem?.productTitle || sourceItem?.productTitle || '预约项目'
|
||||
const amount = quoteItem?.confirmedPrice ?? quoteItem?.quotedPrice ?? quoteItem?.price
|
||||
return hasAmount(amount) ? `${title}:${formatMoney(amount)}` : title
|
||||
}
|
||||
|
||||
const orderHasCurrentQuote = computed(() => {
|
||||
return items.value.some((item: any) => hasAmount(item?.quotedPrice ?? item?.confirmedPrice))
|
||||
})
|
||||
|
||||
const resolveOrderImages = async () => {
|
||||
for (const item of items.value) {
|
||||
const imageId = extractLegacyFileId(item.productImage)
|
||||
@@ -90,6 +149,54 @@ const loadOrder = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const submitQuoteReply = async () => {
|
||||
if (!order.value?.id) return
|
||||
const remark = quoteReply.value.trim()
|
||||
if (!remark) {
|
||||
message.warning('请先填写回复内容')
|
||||
return
|
||||
}
|
||||
quoteSubmitting.value = true
|
||||
try {
|
||||
await runWithGlobalLoading(async () => {
|
||||
await orderApi.replyQuote(order.value.id, { remark })
|
||||
await loadOrder()
|
||||
})
|
||||
quoteReply.value = ''
|
||||
message.success('报价回复已发送')
|
||||
} catch (error: any) {
|
||||
message.error(error?.message || '发送报价回复失败')
|
||||
} finally {
|
||||
quoteSubmitting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const confirmQuote = () => {
|
||||
if (!order.value?.id) return
|
||||
if (!orderHasCurrentQuote.value) {
|
||||
message.warning('当前暂无可确认报价')
|
||||
return
|
||||
}
|
||||
Modal.confirm({
|
||||
title: '确认当前报价',
|
||||
content: '确认后门店会继续处理预约,请确认当前报价无误。',
|
||||
onOk: async () => {
|
||||
quoteConfirming.value = true
|
||||
try {
|
||||
await runWithGlobalLoading(async () => {
|
||||
await orderApi.confirmUserQuote(order.value.id)
|
||||
await loadOrder()
|
||||
})
|
||||
message.success('已确认当前报价')
|
||||
} catch (error: any) {
|
||||
message.error(error?.message || '确认报价失败')
|
||||
} finally {
|
||||
quoteConfirming.value = false
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const preparePayment = async () => {
|
||||
if (!order.value?.id) return
|
||||
await runWithGlobalLoading(async () => {
|
||||
@@ -142,12 +249,12 @@ onMounted(loadOrder)
|
||||
|
||||
<template v-else>
|
||||
<section class="hero-card">
|
||||
<span class="eyebrow">预约订单</span>
|
||||
<span class="eyebrow">{{ isQuoteConfirming ? '询价预约' : '预约订单' }}</span>
|
||||
<h2>{{ order.orderNo || `订单 ${order.id}` }}</h2>
|
||||
<p>{{ order.shopName || '当前门店' }}</p>
|
||||
<div class="hero-meta">
|
||||
<strong>{{ formatMoney(order.actualAmount || order.totalAmount) }}</strong>
|
||||
<span :class="['status-pill', statusClass(order.status)]">{{ order.statusText || '处理中' }}</span>
|
||||
<span :class="['status-pill', statusClass(order.status)]">{{ isQuoteConfirming ? quoteStatusText : (order.statusText || '处理中') }}</span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -158,6 +265,63 @@ onMounted(loadOrder)
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<section v-if="isQuoteConfirming" class="section-card quote-detail-panel">
|
||||
<div class="section-head">
|
||||
<div>
|
||||
<h3>报价确认</h3>
|
||||
<p>{{ quoteStatusText }} · {{ quoteExpireText }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<p>客户备注:{{ order.customerRemark || '暂无备注' }}</p>
|
||||
<div class="quote-flags">
|
||||
<span :class="{ active: order.quoteUserConfirmed }">用户{{ order.quoteUserConfirmed ? '已确认' : '待确认' }}</span>
|
||||
<span :class="{ active: order.quoteShopConfirmed }">门店{{ order.quoteShopConfirmed ? '已确认' : '待确认' }}</span>
|
||||
</div>
|
||||
<div class="quote-items">
|
||||
<article v-for="item in items" :key="item.id || item.productId" class="quote-item">
|
||||
<strong>{{ item.productTitle || '预约项目' }}</strong>
|
||||
<span>参考价 {{ formatQuoteAmount(quoteReferencePrice(item), '待确认') }}</span>
|
||||
<span>当前报价 {{ formatQuoteAmount(item.quotedPrice, '待报价') }}</span>
|
||||
<span>最终价 {{ formatQuoteAmount(item.confirmedPrice, '待确认') }}</span>
|
||||
</article>
|
||||
</div>
|
||||
<div class="quote-history">
|
||||
<strong>报价历史</strong>
|
||||
<div v-if="quoteMessages.length" class="quote-history__list">
|
||||
<article v-for="(quoteMessage, index) in quoteMessages" :key="quoteMessageKey(quoteMessage, index)" class="quote-history__item">
|
||||
<div>
|
||||
<span>{{ quoteActorText(quoteMessage) }}</span>
|
||||
<em>{{ quoteActionText(quoteMessage) }}</em>
|
||||
<small>{{ formatDateTime(quoteMessage.createTime) }}</small>
|
||||
</div>
|
||||
<p v-if="quoteMessage.remark">{{ quoteMessage.remark }}</p>
|
||||
<div v-if="quoteMessageItems(quoteMessage).length" class="quote-history__prices">
|
||||
<span v-for="quoteItem in quoteMessageItems(quoteMessage)" :key="quoteMessageItemKey(quoteItem)">
|
||||
{{ quoteMessageItemText(quoteItem) }}
|
||||
</span>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
<p v-else>暂无报价历史</p>
|
||||
</div>
|
||||
<div class="quote-reply">
|
||||
<a-textarea v-model:value="quoteReply" :rows="3" :maxlength="300" placeholder="给门店补充说明或回复当前报价" />
|
||||
<div class="quote-reply__actions">
|
||||
<a-button :loading="quoteSubmitting" @click="submitQuoteReply">发送回复</a-button>
|
||||
<a-button
|
||||
v-if="!order.quoteUserConfirmed"
|
||||
type="primary"
|
||||
:loading="quoteConfirming"
|
||||
:disabled="!orderHasCurrentQuote"
|
||||
@click="confirmQuote"
|
||||
>
|
||||
确认当前报价
|
||||
</a-button>
|
||||
<span v-else class="quote-confirmed">你已确认当前报价</span>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="section-card">
|
||||
<div class="section-head">
|
||||
<h3>预约项目</h3>
|
||||
@@ -170,7 +334,7 @@ onMounted(loadOrder)
|
||||
</div>
|
||||
<div class="item-main">
|
||||
<strong>{{ item.productTitle || '预约项目' }}</strong>
|
||||
<span>{{ formatMoney(item.price) }} x {{ item.quantity || 1 }}</span>
|
||||
<span>{{ isQuoteConfirming ? '参考价 ' : '' }}{{ formatMoney(item.price) }} x {{ item.quantity || 1 }}</span>
|
||||
<span v-if="item.artistName">美甲师:{{ item.artistName }}</span>
|
||||
<span v-if="item.appointmentTime">预约:{{ formatDateTime(item.appointmentTime) }}</span>
|
||||
</div>
|
||||
@@ -217,6 +381,7 @@ onMounted(loadOrder)
|
||||
.hero-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
|
||||
.hero-meta strong { font-size: 20px; }
|
||||
.status-pill { padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--theme-primary-soft); color: var(--theme-primary); }
|
||||
.status-pill.quote { color: #6b4600; background: #fff2cc; }
|
||||
.status-pill.cancelled { color: var(--theme-accent); }
|
||||
.timeline-card { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; overflow: hidden; margin-top: 14px; background: var(--theme-border); }
|
||||
.timeline-card article { min-width: 0; padding: 12px 8px; background: var(--theme-card-bg); color: var(--text-secondary); }
|
||||
@@ -229,6 +394,24 @@ onMounted(loadOrder)
|
||||
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
|
||||
.section-card h3 { margin: 0 0 12px; font-size: 17px; }
|
||||
.section-card p { margin: 8px 0 0; color: var(--text-secondary); line-height: 1.6; }
|
||||
.section-head p { margin: 4px 0 0; font-size: 13px; }
|
||||
.quote-detail-panel { display: grid; gap: 12px; }
|
||||
.quote-flags { display: flex; flex-wrap: wrap; gap: 8px; }
|
||||
.quote-flags span { padding: 4px 9px; border-radius: 999px; color: var(--text-secondary); background: var(--theme-primary-soft); font-size: 12px; }
|
||||
.quote-flags span.active { color: var(--theme-primary); font-weight: 700; }
|
||||
.quote-items, .quote-history, .quote-history__list, .quote-reply { display: grid; gap: 8px; }
|
||||
.quote-item { display: grid; grid-template-columns: minmax(0, 1.35fr) repeat(3, minmax(82px, auto)); gap: 8px; align-items: center; min-width: 0; padding: 10px; border-radius: 12px; background: color-mix(in srgb, var(--theme-primary-soft) 48%, var(--theme-card-bg)); }
|
||||
.quote-item strong { min-width: 0; overflow-wrap: anywhere; color: var(--text-primary); font-size: 13px; }
|
||||
.quote-item span, .quote-history__item small, .quote-confirmed { color: var(--text-secondary); font-size: 12px; }
|
||||
.quote-history > strong { color: var(--text-primary); font-size: 13px; }
|
||||
.quote-history__item { display: grid; gap: 6px; padding: 10px; border-radius: 12px; background: color-mix(in srgb, var(--theme-primary-soft) 42%, var(--theme-card-bg)); }
|
||||
.quote-history__item div { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
|
||||
.quote-history__item span, .quote-history__item em { color: var(--theme-primary); font-size: 12px; font-style: normal; font-weight: 700; }
|
||||
.quote-history__item p { margin: 0; overflow-wrap: anywhere; font-size: 13px; }
|
||||
.quote-history__prices { display: flex; flex-wrap: wrap; gap: 6px; }
|
||||
.quote-history__prices span { padding: 3px 7px; border-radius: 8px; color: var(--text-secondary); background: var(--theme-card-bg); font-size: 12px; }
|
||||
.quote-reply__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
|
||||
.quote-confirmed { display: inline-flex; align-items: center; min-height: 32px; color: var(--theme-primary); font-weight: 700; }
|
||||
.item-row { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--theme-border); }
|
||||
.item-row:first-of-type { border-top: 0; padding-top: 0; }
|
||||
.thumb { width: 64px; height: 64px; flex: 0 0 auto; border-radius: 14px; overflow: hidden; display: grid; place-items: center; background: var(--theme-primary-soft); color: var(--theme-primary); font-weight: 700; }
|
||||
@@ -238,4 +421,9 @@ onMounted(loadOrder)
|
||||
.action-bar { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 16px; }
|
||||
:deep(.ant-btn-primary) { background: var(--theme-primary); border-color: var(--theme-primary); }
|
||||
:deep(.ant-btn-link) { color: var(--theme-primary); }
|
||||
@media (max-width: 640px) {
|
||||
.quote-item { grid-template-columns: 1fr; }
|
||||
.quote-reply__actions { justify-content: stretch; }
|
||||
.quote-reply__actions :deep(.ant-btn) { flex: 1 1 140px; }
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -85,6 +85,86 @@
|
||||
<button type="button" @click="copyOrderNo(order.orderNo)">复制订单号</button>
|
||||
</div>
|
||||
|
||||
<section v-if="isQuoteConfirming(order)" class="quote-panel" :class="{ 'quote-panel--collapsed': isQuoteHistoryCollapsed(order) }">
|
||||
<div class="quote-panel__head">
|
||||
<div>
|
||||
<span>报价摘要</span>
|
||||
<strong>{{ quoteStatusText(order) }}</strong>
|
||||
</div>
|
||||
<div class="quote-panel__head-actions">
|
||||
<em>{{ quoteExpireText(order) }}</em>
|
||||
<button
|
||||
v-if="order.quoteUserConfirmed"
|
||||
type="button"
|
||||
class="quote-history-toggle"
|
||||
@click="toggleQuoteHistory(order)"
|
||||
>
|
||||
{{ isQuoteHistoryCollapsed(order) ? '展开历史' : '收起历史' }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="isQuoteHistoryCollapsed(order)" class="quote-collapsed-summary">
|
||||
<span>你已确认当前报价</span>
|
||||
<span>{{ quoteHistoryCountText(order) }}</span>
|
||||
<span>{{ quoteExpireText(order) }}</span>
|
||||
</div>
|
||||
<template v-else>
|
||||
<p class="quote-remark">客户备注:{{ order.customerRemark || '暂无备注' }}</p>
|
||||
<div class="quote-flags">
|
||||
<span :class="{ active: order.quoteUserConfirmed }">用户{{ order.quoteUserConfirmed ? '已确认' : '待确认' }}</span>
|
||||
<span :class="{ active: order.quoteShopConfirmed }">门店{{ order.quoteShopConfirmed ? '已确认' : '待确认' }}</span>
|
||||
</div>
|
||||
<div class="quote-items">
|
||||
<div v-for="item in orderItems(order)" :key="item.id || item.productId" class="quote-item">
|
||||
<strong>{{ item.productTitle || '预约项目' }}</strong>
|
||||
<span>参考价 {{ formatQuoteAmount(quoteReferencePrice(item), '待确认') }}</span>
|
||||
<span>当前报价 {{ formatQuoteAmount(item.quotedPrice, '待报价') }}</span>
|
||||
<span>最终价 {{ formatQuoteAmount(item.confirmedPrice, '待确认') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="quote-history">
|
||||
<strong>报价历史</strong>
|
||||
<div v-if="quoteMessages(order).length" class="quote-history__list">
|
||||
<article v-for="(quoteMessage, index) in quoteMessages(order)" :key="quoteMessageKey(quoteMessage, index)" class="quote-history__item">
|
||||
<div>
|
||||
<span>{{ quoteActorText(quoteMessage) }}</span>
|
||||
<em>{{ quoteActionText(quoteMessage) }}</em>
|
||||
<small>{{ formatTimelineTime(quoteMessage.createTime) || '--' }}</small>
|
||||
</div>
|
||||
<p v-if="quoteMessage.remark">{{ quoteMessage.remark }}</p>
|
||||
<div v-if="quoteMessageItems(quoteMessage).length" class="quote-history__prices">
|
||||
<span v-for="quoteItem in quoteMessageItems(quoteMessage)" :key="quoteMessageItemKey(quoteItem)">
|
||||
{{ quoteMessageItemText(order, quoteItem) }}
|
||||
</span>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
<p v-else>暂无报价历史</p>
|
||||
</div>
|
||||
<div v-if="!order.quoteUserConfirmed" class="quote-reply">
|
||||
<a-textarea
|
||||
v-model:value="quoteReplyForms[String(order.id)]"
|
||||
:rows="2"
|
||||
:maxlength="300"
|
||||
placeholder="给门店补充说明或回复当前报价"
|
||||
/>
|
||||
<div class="quote-reply__actions">
|
||||
<button type="button" class="order-action" :disabled="isQuoteBusy(order)" @click="submitQuoteReply(order)">发送回复</button>
|
||||
<button
|
||||
type="button"
|
||||
class="order-action order-action--primary"
|
||||
:disabled="isQuoteBusy(order) || !orderHasCurrentQuote(order)"
|
||||
@click="confirmQuote(order)"
|
||||
>
|
||||
确认当前报价
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="quote-confirmed-bar">你已确认当前报价,报价内容已归档为历史</div>
|
||||
</template>
|
||||
</section>
|
||||
|
||||
<div v-if="orderExtensionItems(order).length" class="order-extension-list">
|
||||
<div
|
||||
v-for="item in orderExtensionItems(order)"
|
||||
@@ -257,7 +337,12 @@ const orderReviews = ref<Record<string, OrderArtistReviewVO[]>>({})
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const pendingChangeRequests = ref<OrderArtistChangeRequestVO[]>([])
|
||||
type OrderStatusFilter = 'all' | 'pendingPayment' | 'active' | 'pendingReview' | 'completed'
|
||||
type OrderStatusFilter = 'all' | 'priceConfirming' | 'pendingPayment' | 'active' | 'pendingReview' | 'completed'
|
||||
const ORDER_STATUS_FILTER_VALUES: OrderStatusFilter[] = ['all', 'priceConfirming', 'pendingPayment', 'active', 'pendingReview', 'completed']
|
||||
const normalizeRouteStatusFilter = (value: unknown): OrderStatusFilter | undefined => {
|
||||
const raw = Array.isArray(value) ? value[0] : value
|
||||
return ORDER_STATUS_FILTER_VALUES.includes(raw as OrderStatusFilter) ? raw as OrderStatusFilter : undefined
|
||||
}
|
||||
/**
|
||||
* 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.
|
||||
@@ -302,6 +387,10 @@ const filters = reactive({
|
||||
minAmount: undefined as number | undefined,
|
||||
maxAmount: undefined as number | undefined
|
||||
})
|
||||
const routeStatusFilter = normalizeRouteStatusFilter(route.query.status)
|
||||
if (routeStatusFilter) {
|
||||
filters.status = routeStatusFilter
|
||||
}
|
||||
/**
|
||||
* 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.
|
||||
@@ -324,10 +413,14 @@ const afterSaleForm = reactive({
|
||||
reason: '',
|
||||
refundAmount: undefined as number | undefined
|
||||
})
|
||||
const quoteReplyForms = reactive<Record<string, string>>({})
|
||||
const quoteActionLoading = reactive<Record<string, boolean>>({})
|
||||
const quoteHistoryExpanded = reactive<Record<string, boolean>>({})
|
||||
|
||||
const statusTabs = computed(() => {
|
||||
const tabs: Array<{ label: string, value: OrderStatusFilter }> = [
|
||||
{ label: '全部', value: 'all' },
|
||||
{ label: '确认价格中', value: 'priceConfirming' },
|
||||
{ label: '待支付', value: 'pendingPayment' },
|
||||
{ label: '预约中', value: 'active' },
|
||||
{ label: '待评价', value: 'pendingReview' },
|
||||
@@ -373,12 +466,13 @@ const focusedOrderItemId = ref('')
|
||||
/** focusedReviewId stores message/deep-link review focus. */
|
||||
const focusedReviewId = ref('')
|
||||
|
||||
const isQuoteConfirming = (order: any) => Number(order?.status) === 0
|
||||
const orderPaymentStatus = (order: any) => String(order.paymentStatus || order.payStatus || '').toUpperCase()
|
||||
const isOrderPaid = (order: any) => orderPaymentStatus(order) === 'PAID'
|
||||
const orderNeedsPayment = (order: any) => Number(order.status) === 1 && !isOrderPaid(order)
|
||||
const canPreparePayment = (order: any) => orderNeedsPayment(order) && orderPaymentStatus(order) !== 'PAYING'
|
||||
const canMockPay = (order: any) => Number(order.status) === 1 && orderPaymentStatus(order) === 'PAYING'
|
||||
const canApplyAfterSale = (order: any) => Number(order.status) === 2 || isOrderPaid(order)
|
||||
const canApplyAfterSale = (order: any) => !isQuoteConfirming(order) && (Number(order.status) === 2 || isOrderPaid(order))
|
||||
|
||||
/**
|
||||
* Purpose: sameId supports OrderView.vue by holding or executing the same id page or API role.
|
||||
@@ -466,6 +560,7 @@ const orderIsActive = (order: any) => {
|
||||
|
||||
const orderMatchesStatus = (order: any, status: OrderStatusFilter) => {
|
||||
if (status === 'all') return true
|
||||
if (status === 'priceConfirming') return isQuoteConfirming(order)
|
||||
if (status === 'pendingPayment') return orderNeedsPayment(order)
|
||||
if (status === 'active') return orderIsActive(order)
|
||||
if (status === 'pendingReview') return orderNeedsReview(order)
|
||||
@@ -474,6 +569,7 @@ const orderMatchesStatus = (order: any, status: OrderStatusFilter) => {
|
||||
}
|
||||
|
||||
const orderDisplayStatus = (order: any) => {
|
||||
if (isQuoteConfirming(order)) return order.statusText || '确认价格中'
|
||||
if (Number(order.status) === 3) return '已取消'
|
||||
if (orderNeedsPayment(order)) return '待支付'
|
||||
if (orderNeedsReview(order)) return '待评价'
|
||||
@@ -483,6 +579,7 @@ const orderDisplayStatus = (order: any) => {
|
||||
}
|
||||
|
||||
const orderStatusClass = (order: any) => {
|
||||
if (isQuoteConfirming(order)) return 'price-confirming'
|
||||
if (Number(order.status) === 3) return 'cancelled'
|
||||
if (orderNeedsPayment(order)) return 'pending-payment'
|
||||
if (orderNeedsReview(order)) return 'pending-review'
|
||||
@@ -492,10 +589,14 @@ const orderStatusClass = (order: any) => {
|
||||
}
|
||||
|
||||
const orderTimeLabel = (order: any) => {
|
||||
if (isQuoteConfirming(order)) return '报价有效期'
|
||||
return Number(order.status) === 2 ? '完成时间' : '预约时间'
|
||||
}
|
||||
|
||||
const orderTimeText = (order: any) => {
|
||||
if (isQuoteConfirming(order)) {
|
||||
return formatTimelineTime(order.quoteExpireTime) || '待门店确认'
|
||||
}
|
||||
if (Number(order.status) === 2) {
|
||||
return formatTimelineTime(order.completeTime || order.updateTime) || orderAppointmentTime(order)
|
||||
}
|
||||
@@ -506,6 +607,7 @@ const orderTimeText = (order: any) => {
|
||||
}
|
||||
|
||||
const orderAmountLabel = (order: any) => {
|
||||
if (isQuoteConfirming(order)) return '参考金额'
|
||||
return orderNeedsPayment(order) ? '订单金额' : '实付金额'
|
||||
}
|
||||
|
||||
@@ -577,6 +679,77 @@ const formatAmount = (value: unknown) => {
|
||||
return `¥${Number.isFinite(amount) ? amount.toFixed(2) : '0.00'}`
|
||||
}
|
||||
|
||||
const hasAmount = (value: unknown) => value !== undefined && value !== null && value !== '' && Number.isFinite(Number(value))
|
||||
|
||||
const formatQuoteAmount = (value: unknown, fallback = '--') => {
|
||||
return hasAmount(value) ? formatAmount(value) : fallback
|
||||
}
|
||||
|
||||
const quoteReferencePrice = (item: any) => item?.referencePrice ?? item?.price
|
||||
|
||||
const quoteMessages = (order: any) => Array.isArray(order?.quoteMessages) ? order.quoteMessages : []
|
||||
|
||||
const quoteMessageItems = (quoteMessage: any) => Array.isArray(quoteMessage?.items) ? quoteMessage.items : []
|
||||
|
||||
const quoteStatusText = (order: any) => order?.quoteStatusText || order?.statusText || '确认价格中'
|
||||
|
||||
const quoteExpireText = (order: any) => {
|
||||
const expireTime = formatTimelineTime(order?.quoteExpireTime)
|
||||
return expireTime ? `有效期至 ${expireTime}` : '等待门店报价'
|
||||
}
|
||||
|
||||
const quoteActorText = (quoteMessage: any) => {
|
||||
if (quoteMessage?.actorTypeText) return quoteMessage.actorTypeText
|
||||
if (String(quoteMessage?.actorType || '').toUpperCase() === 'USER') return '用户'
|
||||
if (String(quoteMessage?.actorType || '').toUpperCase() === 'SHOP') return '门店'
|
||||
return '系统'
|
||||
}
|
||||
|
||||
const quoteActionText = (quoteMessage: any) => quoteMessage?.actionText || quoteMessage?.action || '报价更新'
|
||||
|
||||
const quoteMessageKey = (quoteMessage: any, index: string | number) => {
|
||||
return String(quoteMessage?.id ?? `${quoteMessage?.createTime || 'quote'}-${quoteMessage?.action || index}`)
|
||||
}
|
||||
|
||||
const quoteMessageItemKey = (quoteItem: any) => {
|
||||
return String(quoteItem?.orderItemId ?? quoteItem?.productId ?? quoteItem?.id ?? JSON.stringify(quoteItem))
|
||||
}
|
||||
|
||||
const quoteMessageItemText = (order: any, quoteItem: any) => {
|
||||
const sourceItem = orderItems(order).find((item: any) => sameId(item.id, quoteItem?.orderItemId) || sameId(item.productId, quoteItem?.productId))
|
||||
const title = quoteItem?.productTitle || sourceItem?.productTitle || '预约项目'
|
||||
const amount = quoteItem?.confirmedPrice ?? quoteItem?.quotedPrice ?? quoteItem?.price
|
||||
return hasAmount(amount) ? `${title}:${formatAmount(amount)}` : title
|
||||
}
|
||||
|
||||
const orderHasCurrentQuote = (order: any) => {
|
||||
return orderItems(order).some((item: any) => hasAmount(item?.quotedPrice ?? item?.confirmedPrice))
|
||||
}
|
||||
|
||||
const quoteOrderKey = (order: any) => String(order?.id || '')
|
||||
|
||||
const isQuoteHistoryCollapsed = (order: any) => {
|
||||
return Boolean(order?.quoteUserConfirmed) && !quoteHistoryExpanded[quoteOrderKey(order)]
|
||||
}
|
||||
|
||||
const toggleQuoteHistory = (order: any) => {
|
||||
const key = quoteOrderKey(order)
|
||||
if (!key) return
|
||||
quoteHistoryExpanded[key] = !quoteHistoryExpanded[key]
|
||||
}
|
||||
|
||||
const quoteHistoryCountText = (order: any) => {
|
||||
const count = quoteMessages(order).length
|
||||
return count > 0 ? `${count} 条报价历史` : '暂无报价历史'
|
||||
}
|
||||
|
||||
const isQuoteBusy = (order: any) => Boolean(quoteActionLoading[quoteOrderKey(order)])
|
||||
|
||||
const setQuoteBusy = (order: any, busy: boolean) => {
|
||||
const key = quoteOrderKey(order)
|
||||
if (key) quoteActionLoading[key] = busy
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
@@ -618,6 +791,53 @@ const mockPay = async (order: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
const submitQuoteReply = async (order: any) => {
|
||||
const key = quoteOrderKey(order)
|
||||
const remark = String(quoteReplyForms[key] || '').trim()
|
||||
if (!remark) {
|
||||
message.warning('请先填写回复内容')
|
||||
return
|
||||
}
|
||||
setQuoteBusy(order, true)
|
||||
try {
|
||||
await runWithGlobalLoading(async () => {
|
||||
await orderApi.replyQuote(order.id, { remark })
|
||||
await loadOrders()
|
||||
})
|
||||
quoteReplyForms[key] = ''
|
||||
message.success('报价回复已发送')
|
||||
} catch (error: any) {
|
||||
message.error(error?.message || '发送报价回复失败')
|
||||
} finally {
|
||||
setQuoteBusy(order, false)
|
||||
}
|
||||
}
|
||||
|
||||
const confirmQuote = (order: any) => {
|
||||
if (!orderHasCurrentQuote(order)) {
|
||||
message.warning('当前暂无可确认报价')
|
||||
return
|
||||
}
|
||||
Modal.confirm({
|
||||
title: '确认当前报价',
|
||||
content: '确认后门店会继续处理预约,请确认当前报价无误。',
|
||||
onOk: async () => {
|
||||
setQuoteBusy(order, true)
|
||||
try {
|
||||
await runWithGlobalLoading(async () => {
|
||||
await orderApi.confirmUserQuote(order.id)
|
||||
await loadOrders()
|
||||
})
|
||||
message.success('已确认当前报价')
|
||||
} catch (error: any) {
|
||||
message.error(error?.message || '确认报价失败')
|
||||
} finally {
|
||||
setQuoteBusy(order, false)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const openAfterSaleModal = (order: any) => {
|
||||
activeAfterSaleOrder.value = order
|
||||
const firstItem = (order.items || [])[0]
|
||||
@@ -1741,30 +1961,30 @@ onMounted(async () => {
|
||||
.order-content {
|
||||
width: var(--order-shell-width);
|
||||
max-width: var(--order-shell-width);
|
||||
padding: 24px 20px 36px;
|
||||
padding: 8px 16px 32px;
|
||||
}
|
||||
|
||||
.status-tabs {
|
||||
position: sticky;
|
||||
top: 64px;
|
||||
position: static;
|
||||
top: auto;
|
||||
z-index: 40;
|
||||
gap: 16px;
|
||||
margin: 0 -20px 32px;
|
||||
padding: 16px 20px;
|
||||
gap: 8px;
|
||||
margin: 0 -16px 14px;
|
||||
padding: 10px 16px 12px;
|
||||
background: rgba(255, 248, 244, 0.72);
|
||||
backdrop-filter: blur(12px);
|
||||
}
|
||||
|
||||
.status-tab {
|
||||
gap: 8px;
|
||||
gap: 6px;
|
||||
min-width: auto;
|
||||
height: 38px;
|
||||
padding: 0 24px;
|
||||
height: 36px;
|
||||
padding: 0 16px;
|
||||
border: 1px solid rgba(212, 194, 195, 0.38);
|
||||
border-radius: 999px;
|
||||
color: var(--order-muted);
|
||||
background: var(--order-surface-solid);
|
||||
font-size: 14px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
box-shadow: none;
|
||||
}
|
||||
@@ -1783,7 +2003,7 @@ onMounted(async () => {
|
||||
}
|
||||
|
||||
.order-list {
|
||||
gap: 24px;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.order-card,
|
||||
@@ -1796,10 +2016,11 @@ onMounted(async () => {
|
||||
}
|
||||
|
||||
.order-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 24px;
|
||||
padding: 20px;
|
||||
display: grid;
|
||||
grid-template-columns: 116px minmax(0, 1fr);
|
||||
gap: 12px;
|
||||
align-items: start;
|
||||
padding: 12px;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
@@ -1814,6 +2035,7 @@ onMounted(async () => {
|
||||
|
||||
.order-card__cover {
|
||||
display: grid;
|
||||
grid-row: 1 / span 3;
|
||||
width: 100%;
|
||||
aspect-ratio: 1;
|
||||
place-items: center;
|
||||
@@ -1838,7 +2060,7 @@ onMounted(async () => {
|
||||
}
|
||||
|
||||
.order-card__body {
|
||||
display: grid;
|
||||
display: contents;
|
||||
flex: 1;
|
||||
gap: 12px;
|
||||
min-width: 0;
|
||||
@@ -1848,7 +2070,9 @@ onMounted(async () => {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 14px;
|
||||
gap: 8px;
|
||||
grid-column: 2;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.order-card__title-block {
|
||||
@@ -1862,7 +2086,7 @@ onMounted(async () => {
|
||||
overflow-wrap: anywhere;
|
||||
color: var(--order-text);
|
||||
font-family: Georgia, 'Times New Roman', serif;
|
||||
font-size: 24px;
|
||||
font-size: 17px;
|
||||
font-weight: 500;
|
||||
line-height: 1.3;
|
||||
}
|
||||
@@ -1870,10 +2094,10 @@ onMounted(async () => {
|
||||
.order-card__title-block p {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
gap: 6px;
|
||||
margin: 0;
|
||||
color: var(--order-primary);
|
||||
font-size: 14px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
line-height: 1.35;
|
||||
}
|
||||
@@ -1902,6 +2126,11 @@ onMounted(async () => {
|
||||
background: var(--order-gold-soft);
|
||||
}
|
||||
|
||||
.status-pill.price-confirming {
|
||||
color: #6b4600;
|
||||
background: #fff2cc;
|
||||
}
|
||||
|
||||
.status-pill.active,
|
||||
.status-pill.pending-review {
|
||||
color: #623c40;
|
||||
@@ -1920,9 +2149,11 @@ onMounted(async () => {
|
||||
|
||||
.order-info-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 16px;
|
||||
padding: 12px 0;
|
||||
grid-column: 2;
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
padding: 8px 0;
|
||||
border-top: 1px solid rgba(212, 194, 195, 0.22);
|
||||
border-bottom: 1px solid rgba(212, 194, 195, 0.22);
|
||||
}
|
||||
@@ -1956,8 +2187,10 @@ onMounted(async () => {
|
||||
.order-card__meta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
grid-column: 2;
|
||||
gap: 8px 12px;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
color: var(--order-muted);
|
||||
font-size: 12px;
|
||||
line-height: 1.45;
|
||||
@@ -1973,8 +2206,257 @@ onMounted(async () => {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.quote-panel {
|
||||
display: grid;
|
||||
grid-column: 1 / -1;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
||||
gap: 8px 10px;
|
||||
min-width: 0;
|
||||
padding: 10px;
|
||||
border: 1px solid rgba(212, 194, 195, 0.36);
|
||||
border-radius: 12px;
|
||||
background: rgba(255, 248, 236, 0.72);
|
||||
}
|
||||
|
||||
.quote-panel--collapsed {
|
||||
gap: 7px;
|
||||
}
|
||||
|
||||
.quote-panel__head {
|
||||
display: grid;
|
||||
grid-column: 1 / -1;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
gap: 8px;
|
||||
align-items: start;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.quote-panel__head-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
gap: 6px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.quote-panel__head div {
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.quote-panel__head span,
|
||||
.quote-panel__head em,
|
||||
.quote-collapsed-summary span,
|
||||
.quote-flags span,
|
||||
.quote-item span,
|
||||
.quote-history__item small,
|
||||
.quote-confirmed {
|
||||
color: var(--order-muted);
|
||||
font-size: 12px;
|
||||
font-style: normal;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.quote-history-toggle {
|
||||
min-height: 24px;
|
||||
padding: 0 9px;
|
||||
border: 1px solid rgba(130, 116, 116, 0.28);
|
||||
border-radius: 999px;
|
||||
color: var(--order-primary);
|
||||
background: rgba(255, 255, 255, 0.62);
|
||||
font: inherit;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.quote-collapsed-summary,
|
||||
.quote-confirmed-bar {
|
||||
grid-column: 1 / -1;
|
||||
min-width: 0;
|
||||
border-radius: 10px;
|
||||
background: rgba(255, 255, 255, 0.56);
|
||||
}
|
||||
|
||||
.quote-collapsed-summary {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
gap: 5px 10px;
|
||||
padding: 8px 10px;
|
||||
}
|
||||
|
||||
.quote-collapsed-summary span:first-child {
|
||||
color: var(--order-primary);
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.quote-collapsed-summary span:last-child {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.quote-confirmed-bar {
|
||||
padding: 8px 10px;
|
||||
color: var(--order-primary);
|
||||
font-size: 12px;
|
||||
font-weight: 800;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.quote-panel__head strong {
|
||||
color: var(--order-text);
|
||||
font-size: 14px;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.quote-remark {
|
||||
margin: 0;
|
||||
overflow-wrap: anywhere;
|
||||
color: var(--order-muted);
|
||||
font-size: 12px;
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.quote-flags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.quote-flags span {
|
||||
padding: 3px 8px;
|
||||
border-radius: 999px;
|
||||
background: rgba(255, 255, 255, 0.56);
|
||||
}
|
||||
|
||||
.quote-flags span.active {
|
||||
color: var(--order-primary);
|
||||
background: rgba(124, 83, 87, 0.12);
|
||||
}
|
||||
|
||||
.quote-items {
|
||||
display: grid;
|
||||
grid-column: 1 / -1;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.quote-item {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
|
||||
gap: 5px 10px;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
padding: 8px 10px;
|
||||
border-radius: 10px;
|
||||
background: rgba(255, 255, 255, 0.58);
|
||||
}
|
||||
|
||||
.quote-item strong {
|
||||
min-width: 0;
|
||||
overflow-wrap: anywhere;
|
||||
color: var(--order-text);
|
||||
font-size: 13px;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.quote-history {
|
||||
display: grid;
|
||||
grid-column: 1 / -1;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.quote-history > strong {
|
||||
color: var(--order-text);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.quote-history > p {
|
||||
margin: 0;
|
||||
color: var(--order-muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.quote-history__list {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.quote-history__item {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
gap: 5px 10px;
|
||||
min-width: 0;
|
||||
padding: 8px 10px;
|
||||
border-radius: 10px;
|
||||
background: rgba(255, 255, 255, 0.58);
|
||||
}
|
||||
|
||||
.quote-history__item div {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
grid-column: 1 / -1;
|
||||
gap: 5px 8px;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.quote-history__item span,
|
||||
.quote-history__item em {
|
||||
color: var(--order-primary);
|
||||
font-size: 12px;
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.quote-history__item p {
|
||||
grid-column: 1 / -1;
|
||||
margin: 0;
|
||||
overflow-wrap: anywhere;
|
||||
color: var(--order-muted);
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.quote-history__prices {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
grid-column: 1 / -1;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.quote-history__prices span {
|
||||
padding: 3px 7px;
|
||||
border-radius: 8px;
|
||||
color: var(--order-muted);
|
||||
background: rgba(252, 242, 234, 0.82);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.quote-reply {
|
||||
display: grid;
|
||||
grid-column: 1 / -1;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.quote-reply__actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.quote-confirmed {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-height: 38px;
|
||||
color: var(--order-primary);
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.order-extension-list {
|
||||
display: grid;
|
||||
grid-column: 1 / -1;
|
||||
gap: 10px;
|
||||
padding-top: 2px;
|
||||
}
|
||||
@@ -2040,6 +2522,12 @@ onMounted(async () => {
|
||||
transform: scale(.98);
|
||||
}
|
||||
|
||||
.order-action:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: .55;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.change-request {
|
||||
padding: 12px;
|
||||
}
|
||||
@@ -2060,6 +2548,7 @@ onMounted(async () => {
|
||||
.order-card__actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
grid-column: 1 / -1;
|
||||
gap: 12px;
|
||||
justify-content: flex-end;
|
||||
padding-top: 4px;
|
||||
@@ -2081,23 +2570,29 @@ onMounted(async () => {
|
||||
|
||||
@media (max-width: 374px) {
|
||||
.order-content {
|
||||
padding-right: 16px;
|
||||
padding-left: 16px;
|
||||
padding-top: 6px;
|
||||
padding-right: 12px;
|
||||
padding-left: 12px;
|
||||
}
|
||||
|
||||
.status-tabs {
|
||||
margin-right: -16px;
|
||||
margin-left: -16px;
|
||||
padding-right: 16px;
|
||||
padding-left: 16px;
|
||||
gap: 6px;
|
||||
margin-right: -12px;
|
||||
margin-bottom: 12px;
|
||||
margin-left: -12px;
|
||||
padding-right: 12px;
|
||||
padding-left: 12px;
|
||||
}
|
||||
|
||||
.status-tab {
|
||||
padding: 0 18px;
|
||||
height: 34px;
|
||||
padding: 0 14px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.order-card {
|
||||
padding: 16px;
|
||||
grid-template-columns: 96px minmax(0, 1fr);
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.order-card__head,
|
||||
@@ -2107,18 +2602,27 @@ onMounted(async () => {
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.order-page {
|
||||
--order-shell-width: min(calc(100vw - 48px), var(--frontend-content-max-width, 1120px));
|
||||
}
|
||||
|
||||
.order-content {
|
||||
padding: 24px 64px 42px;
|
||||
padding: 18px 0 42px;
|
||||
}
|
||||
|
||||
.status-tabs {
|
||||
position: sticky;
|
||||
top: 64px;
|
||||
margin-right: 0;
|
||||
margin-bottom: 20px;
|
||||
margin-left: 0;
|
||||
padding-right: 0;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.order-card {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
flex-direction: row;
|
||||
gap: 24px;
|
||||
padding: 24px;
|
||||
@@ -2126,7 +2630,37 @@ onMounted(async () => {
|
||||
|
||||
.order-card__cover {
|
||||
flex: 0 0 160px;
|
||||
grid-row: auto;
|
||||
width: 160px;
|
||||
height: 160px;
|
||||
align-self: flex-start;
|
||||
}
|
||||
|
||||
.order-card__body {
|
||||
display: grid;
|
||||
}
|
||||
|
||||
.order-card__head,
|
||||
.order-info-grid,
|
||||
.order-card__meta,
|
||||
.quote-panel,
|
||||
.order-extension-list,
|
||||
.order-card__actions {
|
||||
grid-column: auto;
|
||||
}
|
||||
|
||||
.order-info-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 16px;
|
||||
padding: 12px 0;
|
||||
}
|
||||
|
||||
.order-card__title-block h2 {
|
||||
font-size: 24px;
|
||||
}
|
||||
|
||||
.quote-item {
|
||||
grid-template-columns: minmax(0, 1.35fr) repeat(3, minmax(82px, auto));
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<a-button class="nav-button" type="text" aria-label="返回" @click="router.back()">
|
||||
<LeftOutlined />
|
||||
</a-button>
|
||||
<strong class="detail-floating-title">{{ shopDisplayName }}</strong>
|
||||
<a-button class="nav-button" type="text" aria-label="分享作品" @click="copyShareLink">
|
||||
<ShareAltOutlined />
|
||||
</a-button>
|
||||
@@ -20,33 +21,41 @@
|
||||
<section class="hero-section" aria-label="作品图片">
|
||||
<a-carousel
|
||||
v-if="productImages.length > 1"
|
||||
:key="heroCarouselKey"
|
||||
class="hero-carousel"
|
||||
dots
|
||||
autoplay
|
||||
:initial-slide="0"
|
||||
:autoplay-speed="3500"
|
||||
>
|
||||
<div v-for="(image, index) in productImages" :key="`${image}-${index}`" class="hero-slide-frame">
|
||||
<a-image
|
||||
class="hero-image"
|
||||
:src="image"
|
||||
:alt="`${productTitle} 图片 ${index + 1}`"
|
||||
:preview="{ src: image }"
|
||||
:loading="index === 0 ? 'eager' : 'lazy'"
|
||||
decoding="async"
|
||||
/>
|
||||
<button class="hero-image-button" type="button" @click="openProductImagePreview(index)">
|
||||
<img
|
||||
class="hero-image"
|
||||
:src="image"
|
||||
:alt="`${productTitle} 图片 ${index + 1}`"
|
||||
:loading="index === 0 ? 'eager' : 'lazy'"
|
||||
decoding="async"
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
</a-carousel>
|
||||
<div v-else-if="productImagesReady || productImages.length" class="hero-carousel hero-carousel-single">
|
||||
<a-image
|
||||
v-for="(image, index) in (productImages.length ? productImages : [DEFAULT_PRODUCT_IMAGE])"
|
||||
<button
|
||||
v-for="(image, index) in heroPreviewImages"
|
||||
:key="`${image}-${index}`"
|
||||
class="hero-image"
|
||||
:src="image"
|
||||
:alt="`${productTitle} 图片 ${index + 1}`"
|
||||
:preview="{ src: image }"
|
||||
:loading="index === 0 ? 'eager' : 'lazy'"
|
||||
decoding="async"
|
||||
/>
|
||||
class="hero-image-button"
|
||||
type="button"
|
||||
@click="openProductImagePreview(index)"
|
||||
>
|
||||
<img
|
||||
class="hero-image"
|
||||
:src="image"
|
||||
:alt="`${productTitle} 图片 ${index + 1}`"
|
||||
:loading="index === 0 ? 'eager' : 'lazy'"
|
||||
decoding="async"
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
<div v-else class="hero-carousel hero-carousel-single" aria-hidden="true"></div>
|
||||
</section>
|
||||
@@ -60,7 +69,7 @@
|
||||
<span>预计时长 {{ displayDurationText }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<p class="price">¥{{ Number(product.price || 0).toFixed(2) }}</p>
|
||||
<p class="price">参考价 ¥{{ Number(product.price || 0).toFixed(2) }}</p>
|
||||
</div>
|
||||
|
||||
<button class="shop-card" type="button" :disabled="!shopInfo?.id" @click="openShopDetail">
|
||||
@@ -253,6 +262,17 @@
|
||||
</a-button>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<a-modal
|
||||
v-model:open="productImagePreviewVisible"
|
||||
:title="productTitle"
|
||||
:footer="null"
|
||||
:width="820"
|
||||
class="product-image-preview-modal"
|
||||
@cancel="closeProductImagePreview"
|
||||
>
|
||||
<img :src="currentPreviewImage" :alt="`${productTitle} 预览图`" class="product-image-preview" />
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -339,6 +359,8 @@ const shopInfo = ref<ShopVO | null>(null)
|
||||
const productImages = ref<string[]>([])
|
||||
/** productImagesReady prevents the default fallback image from flashing before cached URLs are restored. */
|
||||
const productImagesReady = ref(false)
|
||||
const productImagePreviewVisible = ref(false)
|
||||
const productImagePreviewIndex = ref(0)
|
||||
/**
|
||||
* Purpose: comments supports ProductDetailView.vue by holding or executing the comments 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.
|
||||
@@ -393,6 +415,14 @@ const artistCountText = computed(() => artistCount.value > 0 ? `${artistCount.va
|
||||
/** earliestBookableText is a reactive state variable used by the template and event handlers. */
|
||||
const earliestBookableText = computed(() => shopInfo.value?.businessHours || '以门店安排为准')
|
||||
const shopDisplayName = computed(() => shopInfo.value?.shopName || product.value.shopName || '当前门店')
|
||||
const heroPreviewImages = computed(() => productImages.value.length ? productImages.value : [DEFAULT_PRODUCT_IMAGE])
|
||||
const heroCarouselKey = computed(() => {
|
||||
const productKey = toOptionalIdString(product.value.id) || toOptionalIdString(route.params.id) || 'pending'
|
||||
return `${productKey}-${heroPreviewImages.value[0] || DEFAULT_PRODUCT_IMAGE}-${heroPreviewImages.value.length}`
|
||||
})
|
||||
const currentPreviewImage = computed(() => {
|
||||
return heroPreviewImages.value[productImagePreviewIndex.value] || heroPreviewImages.value[0] || DEFAULT_PRODUCT_IMAGE
|
||||
})
|
||||
const shopMetaText = computed(() => {
|
||||
const details = [shopInfo.value?.businessHours, shopInfo.value?.address].filter(Boolean)
|
||||
return details.length ? details.join(' · ') : '门店信息待完善'
|
||||
@@ -433,6 +463,15 @@ const copyShareLink = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const openProductImagePreview = (index: number) => {
|
||||
productImagePreviewIndex.value = Math.max(0, Math.min(index, heroPreviewImages.value.length - 1))
|
||||
productImagePreviewVisible.value = true
|
||||
}
|
||||
|
||||
const closeProductImagePreview = () => {
|
||||
productImagePreviewVisible.value = false
|
||||
}
|
||||
|
||||
/** requireLogin is a local helper used by this page script. */
|
||||
const requireLogin = (actionText: string) => {
|
||||
if (isLoggedIn.value) return true
|
||||
@@ -444,6 +483,7 @@ const requireLogin = (actionText: string) => {
|
||||
/** loadProductImages is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
|
||||
const loadProductImages = async () => {
|
||||
productImagesReady.value = false
|
||||
productImagePreviewIndex.value = 0
|
||||
const fileIds = parseImageFileIds(product.value.imageFileIds)
|
||||
if (!fileIds.length) {
|
||||
const fallbackImages = [DEFAULT_PRODUCT_IMAGE]
|
||||
@@ -492,6 +532,10 @@ const checkInteractionStatus = async () => {
|
||||
/** fetchProductDetail is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
|
||||
const fetchProductDetail = async () => {
|
||||
loadError.value = ''
|
||||
productImages.value = []
|
||||
productImagesReady.value = false
|
||||
productImagePreviewVisible.value = false
|
||||
productImagePreviewIndex.value = 0
|
||||
try {
|
||||
const productId = toOptionalIdString(route.params.id)
|
||||
if (!productId) throw new Error('作品不存在')
|
||||
@@ -720,10 +764,11 @@ onMounted(() => {
|
||||
top: 0;
|
||||
left: 50%;
|
||||
z-index: 50;
|
||||
display: flex;
|
||||
display: grid;
|
||||
grid-template-columns: 44px minmax(0, 1fr) 44px;
|
||||
gap: 10px;
|
||||
width: min(100%, var(--detail-shell-width));
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: calc(12px + env(safe-area-inset-top)) 20px 0;
|
||||
pointer-events: none;
|
||||
transform: translateX(-50%);
|
||||
@@ -744,6 +789,27 @@ onMounted(() => {
|
||||
backdrop-filter: blur(16px);
|
||||
}
|
||||
|
||||
.detail-floating-title {
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
align-self: center;
|
||||
justify-self: center;
|
||||
padding: 9px 14px;
|
||||
border: 1px solid color-mix(in srgb, var(--detail-surface) 36%, transparent);
|
||||
border-radius: 999px;
|
||||
color: var(--detail-text);
|
||||
background: color-mix(in srgb, var(--detail-surface) 82%, transparent);
|
||||
box-shadow: 0 10px 26px color-mix(in srgb, var(--theme-neutral) 12%, transparent);
|
||||
font-size: 15px;
|
||||
font-weight: 800;
|
||||
line-height: 1.2;
|
||||
text-align: center;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
pointer-events: auto;
|
||||
backdrop-filter: blur(16px);
|
||||
}
|
||||
|
||||
.detail-floating-nav :deep(.ant-btn:hover),
|
||||
.detail-floating-nav :deep(.ant-btn:focus) {
|
||||
border-color: var(--detail-blush);
|
||||
@@ -874,21 +940,20 @@ onMounted(() => {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.hero-image-button {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
cursor: zoom-in;
|
||||
}
|
||||
|
||||
.hero-image {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
cursor: zoom-in;
|
||||
}
|
||||
|
||||
.hero-image :deep(.ant-image),
|
||||
.hero-image :deep(.ant-image-img) {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.hero-image :deep(.ant-image-img) {
|
||||
object-fit: cover;
|
||||
object-position: center;
|
||||
}
|
||||
@@ -912,6 +977,15 @@ onMounted(() => {
|
||||
background: var(--detail-surface);
|
||||
}
|
||||
|
||||
.product-image-preview {
|
||||
display: block;
|
||||
width: 100%;
|
||||
max-height: 78vh;
|
||||
border-radius: 14px;
|
||||
object-fit: contain;
|
||||
object-position: center;
|
||||
}
|
||||
|
||||
.info-section {
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
<p v-if="item.shopName" class="shop-name">{{ item.shopName }}</p>
|
||||
<div class="duration">
|
||||
<ClockCircleOutlined />
|
||||
<span>{{ item.approximateDuration || '时长待定' }}</span>
|
||||
<span>{{ displayProductDuration(item) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
@@ -125,7 +125,7 @@
|
||||
</div>
|
||||
|
||||
<div class="card-foot">
|
||||
<p class="price">¥{{ Number(item.price || 0).toFixed(2) }}</p>
|
||||
<p class="price">参考价 ¥{{ Number(item.price || 0).toFixed(2) }}</p>
|
||||
<div class="stats">
|
||||
<span><HeartOutlined />{{ item.likeCount || 0 }}</span>
|
||||
<span><StarOutlined />{{ item.collectCount || 0 }}</span>
|
||||
@@ -341,6 +341,13 @@ const loadImageUrls = async (productList: ProductVO[]) => {
|
||||
/** getProductImages is a local helper used by this page script. */
|
||||
const getProductImages = (product: ProductVO): string[] => imageUrls.value[String(product.id)] || [DEFAULT_PRODUCT_IMAGE]
|
||||
|
||||
const displayProductDuration = (product: ProductVO) => {
|
||||
const duration = product.approximateDuration?.trim()
|
||||
if (duration) return duration
|
||||
const minutes = Number(product.serviceDurationMinutes || product.estimatedTime || 0)
|
||||
return minutes > 0 ? `${minutes}分钟` : '时长待定'
|
||||
}
|
||||
|
||||
/** markProductsInCart is a local helper used by this page script. */
|
||||
const markProductsInCart = (productList: ProductVO[]) => {
|
||||
return (Array.isArray(productList) ? productList : []).map(item => ({
|
||||
|
||||
@@ -79,33 +79,29 @@
|
||||
</div>
|
||||
|
||||
<div class="order-grid">
|
||||
<button class="order-tile" type="button" @click="openOrders">
|
||||
<button class="order-tile" type="button" @click="router.push('/orders?status=priceConfirming&source=profile')">
|
||||
<span class="order-icon order-icon--primary">
|
||||
<ShoppingOutlined />
|
||||
</span>
|
||||
<strong>{{ orderCount }}</strong>
|
||||
<small>全部预约</small>
|
||||
<span class="order-label">待报价</span>
|
||||
</button>
|
||||
<button class="order-tile" type="button" @click="openPendingReviews">
|
||||
<span class="order-icon order-icon--gold">
|
||||
<BellOutlined />
|
||||
</span>
|
||||
<strong>{{ pendingReviewCount }}</strong>
|
||||
<small>待评价</small>
|
||||
<span class="order-label">待评价</span>
|
||||
</button>
|
||||
<button class="order-tile" type="button" @click="router.push('/wishlist')">
|
||||
<span class="order-icon order-icon--rose">
|
||||
<HeartOutlined />
|
||||
</span>
|
||||
<strong>{{ wishlistCount }}</strong>
|
||||
<small>收藏</small>
|
||||
<span class="order-label">收藏</span>
|
||||
</button>
|
||||
<button class="order-tile" type="button" @click="router.push('/coupons')">
|
||||
<span class="order-icon order-icon--cream">
|
||||
<CreditCardOutlined />
|
||||
</span>
|
||||
<strong>{{ couponCount }}</strong>
|
||||
<small>优惠券</small>
|
||||
<span class="order-label">优惠券</span>
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
@@ -265,7 +261,6 @@ import DraftActions from '@/components/DraftActions.vue'
|
||||
import { authApi } from '@/api/auth'
|
||||
import { couponApi } from '@/api/coupon'
|
||||
import { fileApi } from '@/api/file'
|
||||
import { orderApi } from '@/api/order'
|
||||
/**
|
||||
* Purpose: UserVO supports ProfileView.vue by holding or executing the user vo page or API role.
|
||||
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
@@ -277,7 +272,6 @@ import { userApi, type UserVO } from '@/api/user'
|
||||
*/
|
||||
import { createChunkUploadTask, type ChunkUploadTask } from '@/utils/chunk-upload'
|
||||
import { buildDraftStorageKey, clearDraftRecord, loadDraftRecord, saveDraftRecord } from '@/utils/form-draft'
|
||||
import { wishlistApi } from '@/api/wishlist'
|
||||
import { DEFAULT_AVATAR } from '@/constants'
|
||||
import { runWithGlobalLoading } from '@/utils/action-loading'
|
||||
import { notifyShopThemeChanged } from '@/utils/shop-theme'
|
||||
@@ -338,14 +332,8 @@ const needSetPassword = ref(false)
|
||||
const hasNotification = ref(false)
|
||||
/** unreadMessageCount is a reactive state variable used by the template and event handlers. */
|
||||
const unreadMessageCount = ref(0)
|
||||
/** pendingReviewCount is the number of completed services waiting for customer review. */
|
||||
const pendingReviewCount = ref(0)
|
||||
/** orderCount is a reactive state variable used by the template and event handlers. */
|
||||
const orderCount = ref(0)
|
||||
/** couponCount is a reactive state variable used by the template and event handlers. */
|
||||
const couponCount = ref(0)
|
||||
/** wishlistCount is a reactive state variable used by the template and event handlers. */
|
||||
const wishlistCount = ref(0)
|
||||
/** artistCalendarAccessible controls whether the appointment calendar entry is shown. */
|
||||
const artistCalendarAccessible = ref(false)
|
||||
/** shopSwitchVisible is a reactive state variable used by the template and event handlers. */
|
||||
@@ -574,19 +562,12 @@ const fetchUserInfo = async () => {
|
||||
/** loadCounts is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
|
||||
const loadCounts = async () => {
|
||||
try {
|
||||
const orderListRequest = isServiceUser.value ? orderApi.getArtistOrders() : orderApi.getOrderList()
|
||||
const [orders, coupons, wishlist, unreadMessages, pendingReviews] = await Promise.all([
|
||||
orderListRequest,
|
||||
const [coupons, unreadMessages] = await Promise.all([
|
||||
couponApi.listUserCoupons(),
|
||||
wishlistApi.getWishlist(),
|
||||
userApi.getMyUnreadMessageCount(),
|
||||
isServiceUser.value ? Promise.resolve([]) : orderApi.getMyPendingReviews().catch(() => [])
|
||||
userApi.getMyUnreadMessageCount()
|
||||
])
|
||||
orderCount.value = Array.isArray(orders) ? orders.length : 0
|
||||
couponCount.value = Array.isArray(coupons) ? coupons.length : 0
|
||||
wishlistCount.value = Array.isArray(wishlist) ? wishlist.length : 0
|
||||
unreadMessageCount.value = Number(unreadMessages?.unreadCount || 0)
|
||||
pendingReviewCount.value = Array.isArray(pendingReviews) ? pendingReviews.length : 0
|
||||
hasNotification.value = unreadMessageCount.value > 0
|
||||
} catch (error) {
|
||||
console.error('加载个人中心统计失败:', error)
|
||||
@@ -600,7 +581,7 @@ const openOrders = () => {
|
||||
|
||||
/** openPendingReviews jumps directly to the first pending review on the order page. */
|
||||
const openPendingReviews = () => {
|
||||
router.push('/orders?review=pending&source=profile')
|
||||
router.push('/orders?status=pendingReview&review=pending&source=profile')
|
||||
}
|
||||
|
||||
/** handleEditProfile is a local helper used by this page script. */
|
||||
@@ -1260,8 +1241,8 @@ onMounted(async () => {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
min-width: 0;
|
||||
min-height: 96px;
|
||||
padding: 10px 4px;
|
||||
min-height: 76px;
|
||||
padding: 12px 4px;
|
||||
border-radius: 20px;
|
||||
color: var(--text-primary);
|
||||
background: color-mix(in srgb, var(--theme-card-bg) 72%, var(--theme-primary-soft));
|
||||
@@ -1273,7 +1254,6 @@ onMounted(async () => {
|
||||
justify-content: center;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
margin-bottom: 6px;
|
||||
border-radius: 14px;
|
||||
font-size: 18px;
|
||||
}
|
||||
@@ -1298,18 +1278,11 @@ onMounted(async () => {
|
||||
background: color-mix(in srgb, var(--theme-secondary-soft) 74%, var(--theme-card-bg));
|
||||
}
|
||||
|
||||
.order-tile strong {
|
||||
color: var(--text-primary);
|
||||
font-size: 19px;
|
||||
font-weight: 820;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.order-tile small {
|
||||
margin-top: 6px;
|
||||
.order-label {
|
||||
margin-top: 8px;
|
||||
color: var(--text-secondary);
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
font-size: 12px;
|
||||
font-weight: 760;
|
||||
line-height: 1.2;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
<span class="section-kicker">Works</span>
|
||||
<h3>特色作品</h3>
|
||||
</div>
|
||||
<button class="section-link" type="button" @click="openShopProducts">查看更多</button>
|
||||
<button class="section-link" type="button" @click="openShopProducts()">查看更多</button>
|
||||
</div>
|
||||
<div class="featured-products">
|
||||
<button
|
||||
@@ -161,7 +161,7 @@
|
||||
</span>
|
||||
<span class="featured-product__copy">
|
||||
<strong>{{ product.title || '美甲作品' }}</strong>
|
||||
<span>¥{{ Number(product.price || 0).toFixed(2) }}</span>
|
||||
<span>参考价 ¥{{ Number(product.price || 0).toFixed(2) }}</span>
|
||||
<small>{{ product.bookingHint || '下单前选择美甲师和时间' }}</small>
|
||||
</span>
|
||||
</button>
|
||||
@@ -212,7 +212,7 @@
|
||||
<WechatOutlined />
|
||||
一键联系
|
||||
</button>
|
||||
<button class="booking-primary" type="button" @click="openShopProducts">
|
||||
<button class="booking-primary" type="button" @click="openShopProducts()">
|
||||
立即预约
|
||||
</button>
|
||||
</footer>
|
||||
|
||||
@@ -28,7 +28,12 @@ const plans = ref<VipRechargePlanVO[]>([])
|
||||
const selectedPlan = ref<VipRechargePlanVO | null>(null)
|
||||
const rechargeSectionRef = ref<HTMLElement | null>(null)
|
||||
|
||||
const levelSteps = [
|
||||
interface LevelStep {
|
||||
name: string
|
||||
amount: number
|
||||
}
|
||||
|
||||
const levelSteps: [LevelStep, ...LevelStep[]] = [
|
||||
{ name: '普通会员', amount: 0 },
|
||||
{ name: '玫瑰金会员', amount: 1000 },
|
||||
{ name: '钻石会员', amount: 5000 }
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
:collapsed-width="80"
|
||||
>
|
||||
<div class="logo">
|
||||
<h1 v-if="!collapsed">YumiNail 管理台</h1>
|
||||
<h1 v-if="!collapsed">指尖设计师管理台</h1>
|
||||
<h1 v-else>YN</h1>
|
||||
</div>
|
||||
<a-menu
|
||||
|
||||
@@ -65,19 +65,19 @@
|
||||
<a-table v-if="!isMobile" :columns="columns" :data-source="filteredOrders" :loading="loading" row-key="id" :scroll="{ x: 'max-content' }">
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'status'">
|
||||
<a-tag :color="statusColor(record.status)">{{ record.statusText }}</a-tag>
|
||||
<a-tag :color="statusColor(record.status)">{{ orderStatusText(record) }}</a-tag>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'totalAmount'">
|
||||
¥{{ record.totalAmount.toFixed(2) }}
|
||||
{{ formatMoney(record.totalAmount) }}
|
||||
</template>
|
||||
<template v-else-if="column.key === 'actualAmount'">
|
||||
¥{{ record.actualAmount.toFixed(2) }}
|
||||
{{ formatMoney(record.actualAmount) }}
|
||||
</template>
|
||||
<template v-else-if="column.key === 'actions'">
|
||||
<a-space>
|
||||
<a-button type="link" size="small" @click="currentOrder = record">查看</a-button>
|
||||
<a-button type="link" size="small" @click="openDetail(record)">查看</a-button>
|
||||
<a-button
|
||||
v-if="canManagePayments && record.paymentStatus !== 'PAID'"
|
||||
v-if="canManualConfirmPayment(record)"
|
||||
type="link"
|
||||
size="small"
|
||||
@click="openManualPay(record)"
|
||||
@@ -85,7 +85,7 @@
|
||||
手动确认支付
|
||||
</a-button>
|
||||
<a-button
|
||||
v-if="canViewAfterSales"
|
||||
v-if="canOpenAfterSales(record)"
|
||||
type="link"
|
||||
size="small"
|
||||
@click="openAfterSales(record)"
|
||||
@@ -123,16 +123,16 @@
|
||||
用户 {{ item.userId }} · {{ item.createTime }}
|
||||
</div>
|
||||
</div>
|
||||
<a-tag :color="statusColor(item.status)">{{ item.statusText }}</a-tag>
|
||||
<a-tag :color="statusColor(item.status)">{{ orderStatusText(item) }}</a-tag>
|
||||
</div>
|
||||
<div class="admin-mobile-card__rows">
|
||||
<div class="admin-mobile-card__row">
|
||||
<span>总金额</span>
|
||||
<strong>¥{{ item.totalAmount.toFixed(2) }}</strong>
|
||||
<strong>{{ formatMoney(item.totalAmount) }}</strong>
|
||||
</div>
|
||||
<div class="admin-mobile-card__row">
|
||||
<span>实付金额</span>
|
||||
<strong>¥{{ item.actualAmount.toFixed(2) }}</strong>
|
||||
<strong>{{ formatMoney(item.actualAmount) }}</strong>
|
||||
</div>
|
||||
<div class="admin-mobile-card__row">
|
||||
<span>优惠券</span>
|
||||
@@ -144,16 +144,16 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="admin-mobile-card__actions">
|
||||
<a-button size="small" @click="currentOrder = item">查看详情</a-button>
|
||||
<a-button size="small" @click="openDetail(item)">查看详情</a-button>
|
||||
<a-button
|
||||
v-if="canManagePayments && item.paymentStatus !== 'PAID'"
|
||||
v-if="canManualConfirmPayment(item)"
|
||||
size="small"
|
||||
@click="openManualPay(item)"
|
||||
>
|
||||
确认支付
|
||||
</a-button>
|
||||
<a-button
|
||||
v-if="canViewAfterSales"
|
||||
v-if="canOpenAfterSales(item)"
|
||||
size="small"
|
||||
@click="openAfterSales(item)"
|
||||
>
|
||||
@@ -191,13 +191,34 @@
|
||||
<a-descriptions :column="isMobile ? 1 : 2" bordered size="small">
|
||||
<a-descriptions-item label="订单编号">{{ currentOrder.orderNo }}</a-descriptions-item>
|
||||
<a-descriptions-item label="用户ID">{{ currentOrder.userId }}</a-descriptions-item>
|
||||
<a-descriptions-item label="订单总额">¥{{ currentOrder.totalAmount.toFixed(2) }}</a-descriptions-item>
|
||||
<a-descriptions-item label="实付金额">¥{{ currentOrder.actualAmount.toFixed(2) }}</a-descriptions-item>
|
||||
<a-descriptions-item label="订单总额">{{ formatMoney(currentOrder.totalAmount) }}</a-descriptions-item>
|
||||
<a-descriptions-item label="实付金额">{{ formatMoney(currentOrder.actualAmount) }}</a-descriptions-item>
|
||||
<a-descriptions-item label="优惠券">{{ currentOrder.couponName || '无' }}</a-descriptions-item>
|
||||
<a-descriptions-item label="订单状态">{{ currentOrder.statusText }}</a-descriptions-item>
|
||||
<a-descriptions-item label="订单状态">{{ orderStatusText(currentOrder) }}</a-descriptions-item>
|
||||
<a-descriptions-item label="创建时间" :span="isMobile ? 1 : 2">{{ currentOrder.createTime }}</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
|
||||
<template v-if="hasQuoteInfo(currentOrder)">
|
||||
<a-divider>询价信息</a-divider>
|
||||
<a-descriptions :column="isMobile ? 1 : 2" bordered size="small">
|
||||
<a-descriptions-item label="客户备注" :span="isMobile ? 1 : 2">
|
||||
{{ currentOrder.customerRemark || '无' }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="报价状态">
|
||||
<a-tag :color="quoteStatusColor(currentOrder.quoteStatus)">{{ quoteStatusText(currentOrder) }}</a-tag>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="客户确认">
|
||||
<a-tag :color="confirmationColor(currentOrder.quoteUserConfirmed)">{{ confirmationText(currentOrder.quoteUserConfirmed) }}</a-tag>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="门店确认">
|
||||
<a-tag :color="confirmationColor(currentOrder.quoteShopConfirmed)">{{ confirmationText(currentOrder.quoteShopConfirmed) }}</a-tag>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="过期时间">
|
||||
{{ currentOrder.quoteExpireTime || '--' }}
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
</template>
|
||||
|
||||
<a-divider>订单项目</a-divider>
|
||||
|
||||
<a-table
|
||||
@@ -209,8 +230,11 @@
|
||||
:scroll="{ x: 'max-content' }"
|
||||
>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'price'">¥{{ record.price.toFixed(2) }}</template>
|
||||
<template v-else-if="column.key === 'totalPrice'">¥{{ (record.price * record.quantity).toFixed(2) }}</template>
|
||||
<template v-if="column.key === 'price'">{{ formatMoney(record.price) }}</template>
|
||||
<template v-else-if="column.key === 'referencePrice'">{{ formatMoney(record.referencePrice) }}</template>
|
||||
<template v-else-if="column.key === 'quotedPrice'">{{ formatMoney(record.quotedPrice) }}</template>
|
||||
<template v-else-if="column.key === 'confirmedPrice'">{{ formatMoney(record.confirmedPrice) }}</template>
|
||||
<template v-else-if="column.key === 'totalPrice'">{{ formatMoney(Number(record.price || 0) * Number(record.quantity || 0)) }}</template>
|
||||
</template>
|
||||
</a-table>
|
||||
|
||||
@@ -225,7 +249,19 @@
|
||||
</div>
|
||||
<div class="admin-mobile-card__row">
|
||||
<span>单价</span>
|
||||
<strong>¥{{ item.price.toFixed(2) }}</strong>
|
||||
<strong>{{ formatMoney(item.price) }}</strong>
|
||||
</div>
|
||||
<div class="admin-mobile-card__row">
|
||||
<span>参考价</span>
|
||||
<strong>{{ formatMoney(item.referencePrice) }}</strong>
|
||||
</div>
|
||||
<div class="admin-mobile-card__row">
|
||||
<span>报价</span>
|
||||
<strong>{{ formatMoney(item.quotedPrice) }}</strong>
|
||||
</div>
|
||||
<div class="admin-mobile-card__row">
|
||||
<span>最终价</span>
|
||||
<strong>{{ formatMoney(item.confirmedPrice) }}</strong>
|
||||
</div>
|
||||
<div class="admin-mobile-card__row">
|
||||
<span>数量</span>
|
||||
@@ -233,11 +269,66 @@
|
||||
</div>
|
||||
<div class="admin-mobile-card__row">
|
||||
<span>小计</span>
|
||||
<strong>¥{{ (item.price * item.quantity).toFixed(2) }}</strong>
|
||||
<strong>{{ formatMoney(Number(item.price || 0) * Number(item.quantity || 0)) }}</strong>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
<template v-if="hasQuoteInfo(currentOrder)">
|
||||
<a-divider>报价历史</a-divider>
|
||||
<div v-if="quoteHistory(currentOrder).length" class="quote-history">
|
||||
<article
|
||||
v-for="(history, index) in quoteHistory(currentOrder)"
|
||||
:key="quoteHistoryKey(history, index)"
|
||||
class="quote-history__item"
|
||||
>
|
||||
<div class="quote-history__head">
|
||||
<strong>{{ history.actionText || history.action || history.actorTypeText || '报价记录' }}</strong>
|
||||
<span>{{ history.createTime || '--' }}</span>
|
||||
</div>
|
||||
<p v-if="history.remark" class="quote-history__remark">{{ history.remark }}</p>
|
||||
<div v-if="quoteHistoryItems(history).length" class="quote-history__prices">
|
||||
<span
|
||||
v-for="(line, lineIndex) in quoteHistoryItems(history)"
|
||||
:key="`${quoteHistoryKey(history, index)}-${lineIndex}`"
|
||||
>
|
||||
{{ line }}
|
||||
</span>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
<a-empty v-else description="暂无报价历史" />
|
||||
</template>
|
||||
|
||||
<template v-if="isQuoteOrder(currentOrder) && canQuoteCurrentOrder">
|
||||
<a-divider>门店报价</a-divider>
|
||||
<a-form layout="vertical" class="quote-form">
|
||||
<div class="quote-form__items">
|
||||
<div v-for="item in currentOrder.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="报价"
|
||||
style="width: 180px"
|
||||
@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>
|
||||
</template>
|
||||
</template>
|
||||
</AdminResponsiveModal>
|
||||
|
||||
@@ -271,9 +362,9 @@
|
||||
* OrdersView 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, onMounted, ref } from 'vue'
|
||||
import { computed, onMounted, reactive, ref, watch } from 'vue'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
/**
|
||||
* Purpose: Shop supports OrdersView.vue by holding or executing the shop page or API role.
|
||||
* Usage: import, call, read, or update this type from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
@@ -290,6 +381,7 @@ import AdminResponsiveModal from '@/components/admin/AdminResponsiveModal.vue'
|
||||
|
||||
const { isMobile } = useAdminViewport()
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
/**
|
||||
* Purpose: orders supports OrdersView.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.
|
||||
@@ -311,6 +403,12 @@ const manualPayOpen = ref(false)
|
||||
const manualPayLoading = ref(false)
|
||||
const manualPayOrder = ref<any | null>(null)
|
||||
const manualPayRemark = ref('')
|
||||
const quoteSubmitting = ref(false)
|
||||
const quoteConfirming = ref(false)
|
||||
const quoteForm = reactive({
|
||||
remark: '',
|
||||
items: {} as Record<string, number | undefined>
|
||||
})
|
||||
/**
|
||||
* Purpose: currentUserType supports OrdersView.vue by holding or executing the current user type 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.
|
||||
@@ -395,7 +493,8 @@ const isArtist = computed(() => currentUserType.value === 3)
|
||||
*/
|
||||
const statusOptions = [
|
||||
{ label: '全部状态', value: 'all' },
|
||||
{ label: '待处理', value: '1' },
|
||||
{ label: '待报价', value: '0' },
|
||||
{ label: '待完成', value: '1' },
|
||||
{ label: '已完成', value: '2' },
|
||||
{ label: '已取消', value: '3' }
|
||||
]
|
||||
@@ -434,6 +533,8 @@ const filteredOrders = computed(() => {
|
||||
order.orderNo,
|
||||
order.userId,
|
||||
order.couponName,
|
||||
order.customerRemark,
|
||||
order.quoteStatusText,
|
||||
...(order.items || []).map((item: any) => `${item.productTitle || ''} ${item.artistName || ''}`)
|
||||
].join(' ').toLowerCase()
|
||||
return haystack.includes(keywordValue)
|
||||
@@ -508,19 +609,37 @@ const itemColumns = [
|
||||
{ title: '美甲师', dataIndex: 'artistName', key: 'artistName', width: 120 },
|
||||
{ title: '预约时间', dataIndex: 'appointmentTime', key: 'appointmentTime', width: 180 },
|
||||
{ title: '单价', key: 'price', width: 100 },
|
||||
{ title: '参考价', key: 'referencePrice', width: 100 },
|
||||
{ title: '报价', key: 'quotedPrice', width: 100 },
|
||||
{ title: '最终价', key: 'confirmedPrice', width: 100 },
|
||||
{ title: '数量', dataIndex: 'quantity', key: 'quantity', width: 80 },
|
||||
{ title: '总价', key: 'totalPrice', width: 100 }
|
||||
]
|
||||
|
||||
/** statusColor is a local helper used by this page script. */
|
||||
const statusColor = (status: number) => {
|
||||
if (status === 1) return 'orange'
|
||||
if (status === 2) return 'green'
|
||||
if (status === 3) return 'red'
|
||||
const normalized = Number(status)
|
||||
if (normalized === 0) return 'blue'
|
||||
if (normalized === 1) return 'orange'
|
||||
if (normalized === 2) return 'green'
|
||||
if (normalized === 3) return 'red'
|
||||
return 'default'
|
||||
}
|
||||
|
||||
const moneyText = (value?: number) => Number(value || 0).toFixed(2)
|
||||
const isQuoteOrder = (order: any) => Number(order?.status) === 0
|
||||
|
||||
const orderStatusText = (order: any) => order?.statusText || (isQuoteOrder(order) ? '确认价格中' : '--')
|
||||
|
||||
const moneyText = (value?: unknown) => {
|
||||
const amount = Number(value ?? 0)
|
||||
return Number.isFinite(amount) ? amount.toFixed(2) : '0.00'
|
||||
}
|
||||
|
||||
const formatMoney = (value?: unknown) => {
|
||||
if (value === undefined || value === null || value === '') return '--'
|
||||
const amount = Number(value)
|
||||
return Number.isFinite(amount) ? `¥${amount.toFixed(2)}` : '--'
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: normalizeUserType supports OrdersView.vue by holding or executing the normalize user type page or API role.
|
||||
@@ -553,6 +672,157 @@ const normalizeShopId = (value: unknown) => {
|
||||
*/
|
||||
const getShopOptionValue = (shop: Shop) => normalizeShopId((shop as any).id) || ''
|
||||
|
||||
const belongsToCurrentShop = (order: any) => {
|
||||
const currentShopId = normalizeShopId(currentUserInfo?.shopId)
|
||||
const orderShopId = normalizeShopId(order?.shopId)
|
||||
return !currentShopId || !orderShopId || sameId(orderShopId, currentShopId)
|
||||
}
|
||||
|
||||
const canQuoteOrder = (order: any) => {
|
||||
return isQuoteOrder(order) && canProcessOrders.value && currentUserType.value !== 4 && belongsToCurrentShop(order)
|
||||
}
|
||||
|
||||
const canQuoteCurrentOrder = computed(() => canQuoteOrder(currentOrder.value))
|
||||
|
||||
const canManualConfirmPayment = (order: any) => {
|
||||
return canManagePayments.value && !isQuoteOrder(order) && order?.paymentStatus !== 'PAID'
|
||||
}
|
||||
|
||||
const canOpenAfterSales = (order: any) => canViewAfterSales.value && !isQuoteOrder(order)
|
||||
|
||||
const quoteHistory = (order: any) => Array.isArray(order?.quoteMessages) ? order.quoteMessages : []
|
||||
|
||||
const hasQuoteInfo = (order: any) => {
|
||||
return isQuoteOrder(order) ||
|
||||
Boolean(order?.customerRemark || order?.quoteStatus || order?.quoteStatusText || order?.quoteExpireTime || quoteHistory(order).length) ||
|
||||
(order?.items || []).some((item: any) =>
|
||||
item.referencePrice !== undefined || item.quotedPrice !== undefined || item.confirmedPrice !== undefined
|
||||
)
|
||||
}
|
||||
|
||||
const quoteStatusText = (order: any) => order?.quoteStatusText || (isQuoteOrder(order) ? '确认价格中' : '--')
|
||||
|
||||
const quoteStatusColor = (status?: string) => {
|
||||
const normalized = String(status || '').toUpperCase()
|
||||
if (normalized.includes('CONFIRM') || normalized.includes('SUCCESS')) return 'green'
|
||||
if (normalized.includes('EXPIRE') || normalized.includes('CANCEL') || normalized.includes('REJECT')) return 'red'
|
||||
if (normalized.includes('WAIT') || normalized.includes('PENDING')) return 'orange'
|
||||
return 'blue'
|
||||
}
|
||||
|
||||
const confirmationText = (confirmed?: boolean) => confirmed ? '已确认' : '待确认'
|
||||
|
||||
const confirmationColor = (confirmed?: boolean) => confirmed ? 'green' : 'orange'
|
||||
|
||||
const quoteHistoryKey = (history: any, index: string | number) => String(history?.id || `${history?.createTime || 'quote'}-${index}`)
|
||||
|
||||
const quoteHistoryItems = (history: any) => {
|
||||
const items = Array.isArray(history?.items) ? history.items : []
|
||||
return items.map((item: any, index: number) => {
|
||||
const title = item.productTitle || item.productName || item.orderItemTitle || item.orderItemId || `项目 ${index + 1}`
|
||||
const price = item.quotedPrice ?? item.confirmedPrice ?? item.price
|
||||
return price === undefined || price === null ? String(title) : `${title}:${formatMoney(price)}`
|
||||
})
|
||||
}
|
||||
|
||||
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 openDetail = (order: any) => {
|
||||
currentOrder.value = order
|
||||
resetQuoteForm(order)
|
||||
}
|
||||
|
||||
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 syncCurrentOrder = (orderId: IdType, fallback?: any) => {
|
||||
if (!sameId(currentOrder.value?.id, orderId)) return
|
||||
currentOrder.value = orders.value.find(order => sameId(order.id, orderId)) || fallback || currentOrder.value
|
||||
resetQuoteForm(currentOrder.value)
|
||||
}
|
||||
|
||||
const submitQuote = async () => {
|
||||
const order = currentOrder.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 adminOrderApi.submitQuote(order.id, {
|
||||
remark: quoteForm.remark.trim() || undefined,
|
||||
items
|
||||
})
|
||||
await loadOrders()
|
||||
})
|
||||
syncCurrentOrder(order.id, updatedOrder)
|
||||
message.success('报价已提交')
|
||||
} catch (error: any) {
|
||||
console.error('提交报价失败:', error)
|
||||
message.error(error?.message || '提交报价失败')
|
||||
} finally {
|
||||
quoteSubmitting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const confirmQuote = async () => {
|
||||
const order = currentOrder.value
|
||||
if (!order || !canQuoteOrder(order)) return
|
||||
quoteConfirming.value = true
|
||||
try {
|
||||
let updatedOrder: any
|
||||
await runWithGlobalLoading(async () => {
|
||||
updatedOrder = await adminOrderApi.confirmQuote(order.id)
|
||||
await loadOrders()
|
||||
})
|
||||
syncCurrentOrder(order.id, updatedOrder)
|
||||
message.success('当前价格已确认')
|
||||
} catch (error: any) {
|
||||
console.error('确认当前价格失败:', error)
|
||||
message.error(error?.message || '确认当前价格失败')
|
||||
} finally {
|
||||
quoteConfirming.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: loadShopOptions supports OrdersView.vue by holding or executing the load shop 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.
|
||||
@@ -591,6 +861,20 @@ const loadOrders = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const focusRouteOrder = () => {
|
||||
const routeOrderId = route.query.orderId
|
||||
const orderId = Array.isArray(routeOrderId) ? routeOrderId[0] : routeOrderId
|
||||
if (!orderId) return
|
||||
|
||||
const matchedOrder = orders.value.find(order => sameId(order.id, orderId))
|
||||
if (matchedOrder) {
|
||||
openDetail(matchedOrder)
|
||||
return
|
||||
}
|
||||
|
||||
message.warning('当前门店未找到这笔询价预约,请确认后台已切换到对应店铺')
|
||||
}
|
||||
|
||||
/** process is an async page action. Trigger it from the template or lifecycle hook, then await the result. */
|
||||
const process = async (orderId: IdType, status: number) => {
|
||||
try {
|
||||
@@ -652,7 +936,17 @@ onMounted(async () => {
|
||||
await loadUserPermissions()
|
||||
await loadShopOptions()
|
||||
await loadOrders()
|
||||
focusRouteOrder()
|
||||
})
|
||||
|
||||
watch(
|
||||
() => route.query.orderId,
|
||||
async value => {
|
||||
if (!value) return
|
||||
await loadOrders()
|
||||
focusRouteOrder()
|
||||
}
|
||||
)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@@ -668,4 +962,92 @@ onMounted(async () => {
|
||||
.order-action-alert {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.quote-history {
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.quote-history__item {
|
||||
padding: 12px;
|
||||
border: 1px solid #f0f0f0;
|
||||
border-radius: 8px;
|
||||
background: #fafafa;
|
||||
}
|
||||
|
||||
.quote-history__head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
}
|
||||
|
||||
.quote-history__head span,
|
||||
.quote-history__remark,
|
||||
.quote-history__prices {
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.quote-history__remark {
|
||||
margin: 8px 0 0;
|
||||
}
|
||||
|
||||
.quote-history__prices {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px 12px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.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: 12px;
|
||||
border: 1px solid #f0f0f0;
|
||||
border-radius: 8px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.quote-form__meta {
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.quote-form__meta span {
|
||||
color: rgba(0, 0, 0, 0.45);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.quote-form__actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.quote-form__item,
|
||||
.quote-form__actions {
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.quote-form__item :deep(.ant-input-number) {
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user