修复回归安全问题并补充验证
This commit is contained in:
@@ -157,9 +157,6 @@ export interface GrowthSummaryVO {
|
||||
export const paymentApi = {
|
||||
prepareOrderPayment: async (orderId: IdType): Promise<PaymentOrderVO> => {
|
||||
return await api.post<PaymentOrderVO>(`/payment/order/${orderId}/prepare`) as unknown as PaymentOrderVO
|
||||
},
|
||||
mockSuccess: async (orderId: IdType): Promise<PaymentOrderVO> => {
|
||||
return await api.post<PaymentOrderVO>(`/payment/order/${orderId}/mock-success`) as unknown as PaymentOrderVO
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@ 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(() => !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(() => {
|
||||
@@ -206,15 +205,6 @@ const preparePayment = async () => {
|
||||
message.success('支付单已准备')
|
||||
}
|
||||
|
||||
const mockPay = async () => {
|
||||
if (!order.value?.id) return
|
||||
await runWithGlobalLoading(async () => {
|
||||
await paymentApi.mockSuccess(order.value.id)
|
||||
await loadOrder()
|
||||
})
|
||||
message.success('模拟支付成功')
|
||||
}
|
||||
|
||||
const cancelOrder = () => {
|
||||
if (!order.value?.id) return
|
||||
Modal.confirm({
|
||||
@@ -358,7 +348,6 @@ onMounted(loadOrder)
|
||||
|
||||
<section class="action-bar">
|
||||
<a-button v-if="canPreparePayment" @click="preparePayment">准备支付</a-button>
|
||||
<a-button v-if="canMockPay" type="primary" @click="mockPay">模拟支付</a-button>
|
||||
<a-button v-if="canApplyAfterSale" @click="router.push({ path: '/after-sale/apply', query: { orderId } })">申请售后</a-button>
|
||||
<a-button v-if="order.status === 1" danger @click="cancelOrder">取消订单</a-button>
|
||||
</section>
|
||||
|
||||
@@ -201,7 +201,6 @@
|
||||
<div class="order-card__actions">
|
||||
<button v-if="orderNeedsReview(order)" type="button" class="order-action order-action--primary" @click="openReviewModal(firstPendingReview(order))">去评价</button>
|
||||
<button v-if="canPreparePayment(order)" type="button" class="order-action order-action--primary" @click="preparePayment(order)">立即支付</button>
|
||||
<button v-if="canMockPay(order)" type="button" class="order-action order-action--primary" @click="mockPay(order)">立即支付</button>
|
||||
<button type="button" class="order-action" @click="router.push(`/orders/${order.id}`)">查看详情</button>
|
||||
<button v-if="canApplyAfterSale(order)" type="button" class="order-action" @click="openAfterSaleModal(order)">申请售后</button>
|
||||
<button v-if="hasRebookableItems(order)" type="button" class="order-action order-action--primary" @click="rebookOrder(order)">复刻同款</button>
|
||||
@@ -470,8 +469,7 @@ 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 canPreparePayment = (order: any) => orderNeedsPayment(order)
|
||||
const canApplyAfterSale = (order: any) => !isQuoteConfirming(order) && (Number(order.status) === 2 || isOrderPaid(order))
|
||||
|
||||
/**
|
||||
@@ -779,18 +777,6 @@ const preparePayment = async (order: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
const mockPay = async (order: any) => {
|
||||
try {
|
||||
await runWithGlobalLoading(async () => {
|
||||
await paymentApi.mockSuccess(order.id)
|
||||
await loadOrders()
|
||||
})
|
||||
message.success('支付成功')
|
||||
} catch (error: any) {
|
||||
message.error(error?.message || '支付失败')
|
||||
}
|
||||
}
|
||||
|
||||
const submitQuoteReply = async (order: any) => {
|
||||
const key = quoteOrderKey(order)
|
||||
const remark = String(quoteReplyForms[key] || '').trim()
|
||||
|
||||
@@ -68,7 +68,7 @@ describe('web theme governance', () => {
|
||||
|
||||
it('keeps frontend and backend platform overview permission allowlists aligned', () => {
|
||||
const frontend = readSource('utils/platform-admin-permissions.ts')
|
||||
const backend = readFileSync(join(coreRoot, 'com', 'xiaowang', 'yuminailcore', 'support', 'PermissionCatalog.java'), 'utf-8')
|
||||
const backend = readFileSync(join(coreRoot, 'com', 'xiaowang', 'yuminailcore', 'modules', 'security', 'support', 'PermissionCatalog.java'), 'utf-8')
|
||||
|
||||
expect(backend).toContain('"security:audit:view"')
|
||||
expect(frontend).toContain("'security:audit:view'")
|
||||
|
||||
@@ -109,14 +109,12 @@ describe('vNext API contracts', () => {
|
||||
api.defaults.adapter = captureAdapter(requests)
|
||||
|
||||
await paymentApi.prepareOrderPayment(42)
|
||||
await paymentApi.mockSuccess(42)
|
||||
await afterSaleApi.apply({ orderId: 42, type: 'REFUND', reason: 'schedule changed', refundAmount: 88 })
|
||||
await afterSaleApi.listMy({ page: 1, size: 5 })
|
||||
await growthApi.getSummary()
|
||||
|
||||
expect(requests).toEqual([
|
||||
{ method: 'post', url: '/payment/order/42/prepare', params: undefined, data: undefined },
|
||||
{ method: 'post', url: '/payment/order/42/mock-success', params: undefined, data: undefined },
|
||||
{ method: 'post', url: '/after-sale/apply', params: undefined, data: { orderId: 42, type: 'REFUND', reason: 'schedule changed', refundAmount: 88 } },
|
||||
{ method: 'get', url: '/after-sale/my', params: { page: 1, size: 5 }, data: undefined },
|
||||
{ method: 'get', url: '/growth/summary', params: undefined, data: undefined }
|
||||
|
||||
Reference in New Issue
Block a user