feat(mobile-oa-h5): open protocol from payment as readonly detail

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-10-17 10:55:59 +08:00
1 parent 80d238d31d
commit e2fee1d9c5
3 files changed
+33 -6

No files matched your search

@@ -779,3 +779,16 @@ test('presign delete action calls the delete API exactly once', () => {
assert.ok(deleteBranch)
assert.equal((deleteBranch[1].match(/deletePresignOrder\(/g) || []).length, 1)
})
test('payment list openProtocol passes from=payment', () => {
const list = source('../views/market/MarketModuleList.vue')
assert.match(list, /from:\s*['"]payment['"]|from:\s*'payment'/)
assert.match(list, /openProtocol/)
})
test('protocol detail filters actions when from=payment', () => {
const detail = source('../views/market/MarketModuleDetail.vue')
assert.match(detail, /isPaymentEntryView|filterProtocolActionsForPaymentEntry/)
})
@@ -55,6 +55,10 @@ import {
withdrawPresignTransfer
} from '../../api/market.js'
import { collectAllowedActions } from '../../market/action-policy.js'
import {
isPaymentEntryView,
filterProtocolActionsForPaymentEntry
} from '../../market/payment-entry.js'
import { marketErrorMessage } from '../../market/market-error.js'
import { getMarketModule } from '../../market/module-registry.js'
import { resolveStatusTone } from '../../market/status-tone.js'
@@ -105,11 +109,17 @@ const statusTone = computed(() => resolveStatusTone(
))
const actionPending = ref(false)
const pendingAction = ref('')
const allowedActions = computed(() => collectAllowedActions(
context.value.module,
context.value.marketRole,
detail.value
))
const allowedActions = computed(() => {
const raw = collectAllowedActions(
context.value.module,
context.value.marketRole,
detail.value
)
if (context.value.module === 'protocol' && isPaymentEntryView(route.query)) {
return filterProtocolActionsForPaymentEntry(raw)
}
return raw
})
const sections = computed(() => {
if (moduleContract.value.detailSections) return moduleContract.value.detailSections(detail.value)
if (Array.isArray(detail.value?.sections)) return detail.value.sections
@@ -423,7 +423,11 @@ function openProtocol(item) {
router.push({
name: `market-${context.value.marketRole}-protocol-detail`,
params: { id },
query: { ...pickMarketNavigationQuery(route.query), source: item.source || 'cell_storage' }
query: {
...pickMarketNavigationQuery(route.query),
source: item.source || 'cell_storage',
...(context.value.module === 'payment' ? { from: 'payment' } : {})
}
})
}