fix(order): show authoritative progress and billing in customer detail

This commit is contained in:
2026-10-15 19:39:35 +08:00
parent 4d7b6eb6dc
commit d89830fe41
13 changed files with 139 additions and 11 deletions
@@ -1,6 +1,7 @@
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
import ts from 'typescript'
const routes = readFileSync(new URL('./routes.ts', import.meta.url), 'utf8')
const services = readFileSync(new URL('./views/WarehouseServiceView.vue', import.meta.url), 'utf8')
@@ -41,13 +42,31 @@ test('opens warehouse service and return receipt details as dedicated protected
})
test('returns to the labeling list after a labeling application is submitted', () => {
assert.match(services, /ElMessage\.success\(`\$\{config\.value\.title\}提交成功`\)[\s\S]*?router\.push\(\{ name: serviceListRouteName\(props\.service\) \}\)/)
assert.match(services, /ElMessage\.success\(`\$\{config\.value\.title\}提交成功`\)[\s\S]*?await goToServiceList\(\)/)
// Return-carton sources use the unified relabel application and its file endpoint.
assert.match(services, /returnCartonId: item\.returnCartonId/)
assert.match(services, /uploadRelabelFile\(created\.application\.relabelNo,[\s\S]*?router\.push\(\{ name: serviceListRouteName\(props\.service\) \}\)/)
assert.match(services, /uploadRelabelFile\(created\.application\.relabelNo,[\s\S]*?await goToServiceList\(\)/)
assert.match(services, /申请已创建,附件待补传/)
})
test('service list return navigates standalone pages and refreshes embedded lists', async () => {
const source = services.slice(services.indexOf('function serviceListRouteName('), services.indexOf('async function openEdit('))
const javascript = ts.transpileModule(source, { compilerOptions: { target: ts.ScriptTarget.ES2022 } }).outputText
for (const props of [
{ service: 'labeling', createPage: true, detailPage: false },
{ service: 'labeling', createPage: false, detailPage: true },
{ service: 'labeling', createPage: false, detailPage: false },
]) {
const calls = [], mode = { value: 'create' }
const goToServiceList = new Function('props', 'router', 'mode', 'loadPage', `${javascript}; return goToServiceList`)(
props, { push: async route => calls.push(route) }, mode, async () => calls.push('refresh'),
)
await goToServiceList()
assert.deepEqual(calls, props.createPage || props.detailPage ? [{ name: 'overseas-labeling' }] : ['refresh'])
if (!props.createPage && !props.detailPage) assert.equal(mode.value, 'list')
}
})
test('keeps overseas warehouse writes behind operation-specific button permissions', () => {
for (const permission of [
'merchant:overseas-warehouse:relabel:create',