Browse Source

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

Co-authored-by: Cursor <cursoragent@cursor.com>
zlwu 1 week ago
parent
commit
e2fee1d9c5

+ 13 - 0
mobile-oa-h5/src/market/mobile-parity-ui.test.js

@@ -779,3 +779,16 @@ test('presign delete action calls the delete API exactly once', () => {
   assert.ok(deleteBranch)
   assert.ok(deleteBranch)
   assert.equal((deleteBranch[1].match(/deletePresignOrder\(/g) || []).length, 1)
   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/)
+})

+ 15 - 5
mobile-oa-h5/src/views/market/MarketModuleDetail.vue

@@ -55,6 +55,10 @@ import {
   withdrawPresignTransfer
   withdrawPresignTransfer
 } from '../../api/market.js'
 } from '../../api/market.js'
 import { collectAllowedActions } from '../../market/action-policy.js'
 import { collectAllowedActions } from '../../market/action-policy.js'
+import {
+  isPaymentEntryView,
+  filterProtocolActionsForPaymentEntry
+} from '../../market/payment-entry.js'
 import { marketErrorMessage } from '../../market/market-error.js'
 import { marketErrorMessage } from '../../market/market-error.js'
 import { getMarketModule } from '../../market/module-registry.js'
 import { getMarketModule } from '../../market/module-registry.js'
 import { resolveStatusTone } from '../../market/status-tone.js'
 import { resolveStatusTone } from '../../market/status-tone.js'
@@ -105,11 +109,17 @@ const statusTone = computed(() => resolveStatusTone(
 ))
 ))
 const actionPending = ref(false)
 const actionPending = ref(false)
 const pendingAction = ref('')
 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(() => {
 const sections = computed(() => {
   if (moduleContract.value.detailSections) return moduleContract.value.detailSections(detail.value)
   if (moduleContract.value.detailSections) return moduleContract.value.detailSections(detail.value)
   if (Array.isArray(detail.value?.sections)) return detail.value.sections
   if (Array.isArray(detail.value?.sections)) return detail.value.sections

+ 5 - 1
mobile-oa-h5/src/views/market/MarketModuleList.vue

@@ -423,7 +423,11 @@ function openProtocol(item) {
   router.push({
   router.push({
     name: `market-${context.value.marketRole}-protocol-detail`,
     name: `market-${context.value.marketRole}-protocol-detail`,
     params: { id },
     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' } : {})
+    }
   })
   })
 }
 }