完成Salon SIT整改并清理旧接口

This commit is contained in:
2026-11-01 16:21:43 +08:00
parent 9e47371442
commit fc3d38b247
14 changed files with 57 additions and 267 deletions
-81
View File
@@ -21,74 +21,11 @@ export interface OrderItem {
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface CreateOrderRequest {
couponId?: IdType
couponSourceType?: string
remark?: string
clientRequestId?: string
items: OrderItem[]
}
export type CheckoutPreviewRequest = CreateOrderRequest
export interface CheckoutCouponPreview {
id: IdType
couponId?: IdType
userCouponId?: IdType
sourceType?: string
couponName: string
couponType: number
couponTypeName?: string
discountValue?: number
minAmount?: number
reduceAmount?: number
discountAmount?: number
available?: boolean
best?: boolean
vipAuto?: boolean
displayText?: string
savingText?: string
unavailableReason?: string
startTime?: string
endTime?: string
}
export interface CheckoutIssue {
code: string
message: string
itemId?: IdType
productId?: IdType
productTitle?: string
}
export interface CheckoutPreview {
subtotalAmount: number
savedAmount: number
payableAmount: number
bestCoupon?: CheckoutCouponPreview
availableCoupons: CheckoutCouponPreview[]
unavailableCoupons: CheckoutCouponPreview[]
bookingAvailable?: boolean
bookingIssues?: CheckoutIssue[]
vipTip?: string
summaryText?: string
}
export interface PaymentOrderVO {
id: IdType
payNo?: string
orderId: IdType
orderNo?: string
userId?: IdType
shopId?: IdType
channel?: string
status?: string
payAmount?: number
paidAmount?: number
payTime?: string
expireTime?: string
remark?: string
}
export interface OrderQuoteItem {
orderItemId: IdType
quotedPrice?: number
@@ -147,14 +84,6 @@ export interface PageResult<T> {
size: number
}
export interface GrowthSummaryVO {
userId?: IdType
growthValue?: number
levelName?: string
appointmentCount?: number
reviewCount?: number
}
export const afterSaleApi = {
apply: async (data: AfterSaleApplyRequest): Promise<AfterSaleVO> => {
return await api.post<AfterSaleVO>('/after-sale/apply', data) as unknown as AfterSaleVO
@@ -164,12 +93,6 @@ export const afterSaleApi = {
}
}
export const growthApi = {
getSummary: async (): Promise<GrowthSummaryVO> => {
return await api.get<GrowthSummaryVO>('/growth/summary') as unknown as GrowthSummaryVO
}
}
/**
* Purpose: ArtistCalendarAppointment supports order.ts by holding or executing the artist calendar appointment 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.
@@ -329,10 +252,6 @@ export const orderApi = {
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
},
+1 -1
View File
@@ -155,7 +155,7 @@ body {
}
.app-container--phone-shell :where(.nav-button, .icon-btn, .back-btn, .jayucloud-salon-icon-button) :where(.anticon),
.app-container--phone-shell :where(.header, .shop-topbar, .detail-header, .artist-topbar, .artist-list-topbar, .auth-topbar, .not-found-topbar, .cart-topbar, .vip-header) :where(.ant-btn .anticon, button .anticon),
.app-container--phone-shell :where(.header, .shop-topbar, .detail-header, .artist-topbar, .artist-list-topbar, .auth-topbar, .not-found-topbar) :where(.ant-btn .anticon, button .anticon),
.app-container--admin :where(.mobile-icon-btn, .mobile-avatar-btn) :where(.anticon) {
font-size: 21px !important;
line-height: 1;
@@ -1,19 +0,0 @@
import { describe, expect, it } from 'vitest'
import { BUY_NOW_MODE, getBuyNowProductIdFromQuery, isBuyNowCartItem } from './buy-now'
describe('buy-now checkout mode', () => {
it('reads the target product id only when cart query is in buyNow mode', () => {
expect(getBuyNowProductIdFromQuery({ mode: BUY_NOW_MODE, productId: '1001' })).toBe('1001')
expect(getBuyNowProductIdFromQuery({ mode: 'cart', productId: '1001' })).toBe('')
})
it('uses the first query value when vue-router provides array values', () => {
expect(getBuyNowProductIdFromQuery({ mode: [BUY_NOW_MODE], productId: ['2002', '3003'] })).toBe('2002')
})
it('matches numeric and string product ids for cart selection', () => {
expect(isBuyNowCartItem(1001, '1001')).toBe(true)
expect(isBuyNowCartItem('1002', '1001')).toBe(false)
})
})
-15
View File
@@ -1,15 +0,0 @@
export const BUY_NOW_MODE = 'buyNow'
type QueryValue = string | string[] | null | undefined
const firstQueryValue = (value: QueryValue) => Array.isArray(value) ? value[0] : value
export const getBuyNowProductIdFromQuery = (query: Record<string, unknown>) => {
const mode = firstQueryValue(query.mode as QueryValue)
const productId = firstQueryValue(query.productId as QueryValue)
return mode === BUY_NOW_MODE && productId ? String(productId) : ''
}
export const isBuyNowCartItem = (itemProductId: unknown, buyNowProductId: string) => {
return Boolean(buyNowProductId) && String(itemProductId || '') === String(buyNowProductId)
}
@@ -21,7 +21,7 @@ describe('request signature', () => {
const config = {
method: 'post',
baseURL: '/api',
url: '/order/checkout-preview',
url: '/order/42/quote/reply',
headers: {
'Content-Type': 'application/json'
},
@@ -36,7 +36,7 @@ describe('request signature', () => {
const payloadHash = createHash('sha256').update(JSON.stringify({ items: [] })).digest('hex')
const canonical = [
'POST',
'/order/checkout-preview',
'/order/42/quote/reply',
'1700000000000',
'1700000000000-fallback-id',
payloadHash