verce-vue-test 0.0.56 → 0.0.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,170 @@
1
+ import {
2
+ buildTamRequestPayload,
3
+ tamRequest,
4
+ type TamRequestPayload,
5
+ type TamResponse,
6
+ } from '@/api/tam'
7
+
8
+ export type PbcPositionSendPayload = {
9
+ appHead: TamRequestPayload<PbcPositionEmptyBody>['appHead']
10
+ body: PbcPositionEmptyBody
11
+ head: TamRequestPayload<PbcPositionEmptyBody>['head']
12
+ }
13
+
14
+ export type PbcPositionQueryPayload = {
15
+ appHead: TamRequestPayload<PbcPositionEmptyBody>['appHead']
16
+ body: PbcPositionEmptyBody
17
+ head: TamRequestPayload<PbcPositionEmptyBody>['head']
18
+ }
19
+
20
+ export type PbcPositionDetailPayload = {
21
+ appHead: TamRequestPayload<PbcPositionDetailRequestBody>['appHead']
22
+ body: PbcPositionDetailRequestBody
23
+ head: TamRequestPayload<PbcPositionDetailRequestBody>['head']
24
+ }
25
+
26
+ export type PbcPositionSendResult = {
27
+ body: PbcPositionSendBody
28
+ head: TamResponse<PbcPositionSendBody>['head']
29
+ }
30
+
31
+ export type PbcPositionQueryResult = {
32
+ body: PbcPositionQueryBody
33
+ head: TamResponse<PbcPositionQueryBody>['head']
34
+ }
35
+
36
+ export type PbcPositionDetailResult = {
37
+ body: PbcPositionDetailBody
38
+ head: TamResponse<PbcPositionDetailBody>['head']
39
+ }
40
+
41
+ export type PbcPositionRecord = {
42
+ /** 应答平台流水号,查询明细入参。 */
43
+ refNo?: string
44
+ /** 清算账户行号。 */
45
+ settleBankNo?: string
46
+ /** 清算账户余额,接口按元返回。 */
47
+ settleBal?: string
48
+ /** 可用头寸,接口按元返回。 */
49
+ avaAmt?: string
50
+ /** 预期头寸,接口按元返回。 */
51
+ expectAmt?: string
52
+ /** 更新时间。 */
53
+ updateTime?: string
54
+ }
55
+
56
+ export type PbcPositionDetailBody = PbcPositionRecord & {
57
+ /** 申请平台流水号。 */
58
+ refNo?: string
59
+ /** 应答平台流水号。 */
60
+ resRefNo?: string
61
+ /** 排队借记总金额,接口按元返回。 */
62
+ lineDrAmt?: string
63
+ /** 排队贷记总金额,接口按元返回。 */
64
+ lineCrAmt?: string
65
+ /** 所辖非清算账户数。 */
66
+ subAcctNumber?: string
67
+ /** 所辖非清算总余额,接口按元返回。 */
68
+ subAcctAmt?: string
69
+ }
70
+
71
+ export type PbcPositionBalance = PbcPositionRecord &
72
+ PbcPositionDetailBody & {
73
+ /** 发送交易返回的申请平台流水号。 */
74
+ requestRefNo?: string
75
+ }
76
+
77
+ type PbcPositionEmptyBody = Record<string, never>
78
+
79
+ type PbcPositionSendBody = {
80
+ refNo?: string
81
+ }
82
+
83
+ type PbcPositionQueryBody = {
84
+ resultList?: PbcPositionRecord[]
85
+ }
86
+
87
+ type PbcPositionDetailRequestBody = {
88
+ refNo: string
89
+ settleBankNo: string
90
+ }
91
+
92
+ const SEND_TRAN_CODE = '/TAM/0001/140104009'
93
+ const QUERY_TRAN_CODE = '/TAM/0001/140104010'
94
+ const DETAIL_TRAN_CODE = '/TAM/0001/140104011'
95
+
96
+ export function buildPbcPositionSendPayload(): PbcPositionSendPayload {
97
+ return buildTamRequestPayload({
98
+ tranCode: SEND_TRAN_CODE,
99
+ body: {},
100
+ })
101
+ }
102
+
103
+ export async function sendPbcPositionRequest(
104
+ payload: PbcPositionSendPayload,
105
+ ): Promise<PbcPositionSendResult> {
106
+ return tamRequest<PbcPositionEmptyBody, PbcPositionSendBody>(payload)
107
+ }
108
+
109
+ export function buildPbcPositionQueryPayload(): PbcPositionQueryPayload {
110
+ return buildTamRequestPayload({
111
+ tranCode: QUERY_TRAN_CODE,
112
+ body: {},
113
+ })
114
+ }
115
+
116
+ export async function queryPbcPositionList(
117
+ payload: PbcPositionQueryPayload,
118
+ ): Promise<PbcPositionQueryResult> {
119
+ return tamRequest<PbcPositionEmptyBody, PbcPositionQueryBody>(payload)
120
+ }
121
+
122
+ export function buildPbcPositionDetailPayload(
123
+ record: Pick<PbcPositionRecord, 'refNo' | 'settleBankNo'>,
124
+ ): PbcPositionDetailPayload {
125
+ return buildTamRequestPayload({
126
+ tranCode: DETAIL_TRAN_CODE,
127
+ body: {
128
+ refNo: record.refNo || '',
129
+ settleBankNo: record.settleBankNo || '',
130
+ },
131
+ })
132
+ }
133
+
134
+ export async function queryPbcPositionDetail(
135
+ payload: PbcPositionDetailPayload,
136
+ ): Promise<PbcPositionDetailResult> {
137
+ return tamRequest<PbcPositionDetailRequestBody, PbcPositionDetailBody>(payload)
138
+ }
139
+
140
+ export async function queryPbcPositionBalance(requestRefNo: string): Promise<PbcPositionBalance> {
141
+ const queryPayload = buildPbcPositionQueryPayload()
142
+ console.log('[人行头寸余额查询1入参]', queryPayload)
143
+
144
+ const queryResponse = await queryPbcPositionList(queryPayload)
145
+ const records = queryResponse.body.resultList || []
146
+
147
+ if (records.length === 0) {
148
+ throw new Error('人行头寸余额查询结果为空')
149
+ }
150
+
151
+ for (const record of records) {
152
+ if (!record.refNo || !record.settleBankNo) continue
153
+
154
+ const detailPayload = buildPbcPositionDetailPayload(record)
155
+ console.log('[人行头寸余额查询2入参]', detailPayload)
156
+
157
+ const detailResponse = await queryPbcPositionDetail(detailPayload)
158
+
159
+ if (detailResponse.body.refNo !== requestRefNo) continue
160
+
161
+ return {
162
+ ...record,
163
+ ...detailResponse.body,
164
+ requestRefNo,
165
+ resRefNo: detailResponse.body.resRefNo || record.refNo,
166
+ }
167
+ }
168
+
169
+ throw new Error(`未查询到编号 ${requestRefNo} 对应的余额结果`)
170
+ }
@@ -0,0 +1,216 @@
1
+ <script setup lang="ts">
2
+ defineOptions({ name: 'AnnouncementTitleBar' })
3
+
4
+ withDefaults(
5
+ defineProps<{
6
+ title?: string
7
+ showBack?: boolean
8
+ backAriaLabel?: string
9
+ }>(),
10
+ {
11
+ title: '公告',
12
+ showBack: true,
13
+ backAriaLabel: '返回',
14
+ },
15
+ )
16
+
17
+ const emit = defineEmits<{
18
+ back: []
19
+ capsuleMore: []
20
+ capsuleClose: []
21
+ }>()
22
+ </script>
23
+
24
+ <template>
25
+ <header class="announcement-title-bar">
26
+ <div class="announcement-title-bar__inner">
27
+ <button
28
+ v-if="showBack"
29
+ class="announcement-title-bar__back"
30
+ type="button"
31
+ :aria-label="backAriaLabel"
32
+ @click="emit('back')"
33
+ >
34
+ <van-icon name="arrow-left" />
35
+ </button>
36
+
37
+ <h1 class="announcement-title-bar__title">{{ title }}</h1>
38
+
39
+ <div class="announcement-title-bar__capsule" role="group" aria-label="页面操作">
40
+ <button
41
+ class="announcement-title-bar__capsule-btn"
42
+ type="button"
43
+ aria-label="更多"
44
+ @click="emit('capsuleMore')"
45
+ >
46
+ <span class="announcement-title-bar__dots" aria-hidden="true">
47
+ <i></i>
48
+ <i></i>
49
+ <i></i>
50
+ </span>
51
+ </button>
52
+ <span class="announcement-title-bar__divider" aria-hidden="true"></span>
53
+ <button
54
+ class="announcement-title-bar__capsule-btn"
55
+ type="button"
56
+ aria-label="关闭"
57
+ @click="emit('capsuleClose')"
58
+ >
59
+ <span class="announcement-title-bar__circle" aria-hidden="true"></span>
60
+ </button>
61
+ </div>
62
+ </div>
63
+ </header>
64
+ </template>
65
+
66
+ <style scoped>
67
+ .announcement-title-bar {
68
+ position: sticky;
69
+ top: 0;
70
+ z-index: 20;
71
+ width: 100%;
72
+ height: calc(50px + env(safe-area-inset-top));
73
+ padding-top: env(safe-area-inset-top);
74
+ color: #171b20;
75
+ background: rgba(247, 248, 250, 0.96);
76
+ backdrop-filter: blur(12px);
77
+ box-sizing: border-box;
78
+ }
79
+
80
+ .announcement-title-bar__inner {
81
+ position: relative;
82
+ display: flex;
83
+ align-items: center;
84
+ justify-content: center;
85
+ width: 100%;
86
+ max-width: 750px;
87
+ height: 50px;
88
+ margin: 0 auto;
89
+ padding: 0 10px;
90
+ box-sizing: border-box;
91
+ }
92
+
93
+ .announcement-title-bar__back,
94
+ .announcement-title-bar__capsule-btn {
95
+ border: 0;
96
+ padding: 0;
97
+ font: inherit;
98
+ background: transparent;
99
+ appearance: none;
100
+ cursor: pointer;
101
+ }
102
+
103
+ .announcement-title-bar__back {
104
+ position: absolute;
105
+ left: 10px;
106
+ top: 50%;
107
+ display: flex;
108
+ align-items: center;
109
+ justify-content: center;
110
+ width: 36px;
111
+ height: 36px;
112
+ border-radius: 50%;
113
+ color: #171b20;
114
+ font-size: 22px;
115
+ transform: translateY(-50%);
116
+ }
117
+
118
+ .announcement-title-bar__back:active {
119
+ background: rgba(23, 27, 32, 0.06);
120
+ }
121
+
122
+ .announcement-title-bar__title {
123
+ position: absolute;
124
+ left: 106px;
125
+ right: 106px;
126
+ margin: 0;
127
+ overflow: hidden;
128
+ color: #171b20;
129
+ font-size: 17px;
130
+ font-weight: 700;
131
+ line-height: 1.2;
132
+ text-align: center;
133
+ text-overflow: ellipsis;
134
+ white-space: nowrap;
135
+ pointer-events: none;
136
+ }
137
+
138
+ .announcement-title-bar__capsule {
139
+ position: absolute;
140
+ right: 10px;
141
+ top: 50%;
142
+ display: flex;
143
+ align-items: center;
144
+ width: 88px;
145
+ height: 32px;
146
+ overflow: hidden;
147
+ border: 1px solid rgba(23, 27, 32, 0.12);
148
+ border-radius: 999px;
149
+ background: rgba(255, 255, 255, 0.82);
150
+ box-shadow:
151
+ 0 6px 18px rgba(23, 27, 32, 0.08),
152
+ inset 0 0 0 0.5px rgba(255, 255, 255, 0.82);
153
+ backdrop-filter: blur(10px);
154
+ transform: translateY(-50%);
155
+ }
156
+
157
+ .announcement-title-bar__capsule-btn {
158
+ display: flex;
159
+ align-items: center;
160
+ justify-content: center;
161
+ width: 43px;
162
+ height: 100%;
163
+ color: #171b20;
164
+ }
165
+
166
+ .announcement-title-bar__capsule-btn:active {
167
+ background: rgba(23, 27, 32, 0.06);
168
+ }
169
+
170
+ .announcement-title-bar__divider {
171
+ width: 1px;
172
+ height: 18px;
173
+ background: rgba(23, 27, 32, 0.12);
174
+ }
175
+
176
+ .announcement-title-bar__dots {
177
+ display: flex;
178
+ align-items: center;
179
+ gap: 4px;
180
+ }
181
+
182
+ .announcement-title-bar__dots i {
183
+ width: 4px;
184
+ height: 4px;
185
+ border-radius: 50%;
186
+ background: #171b20;
187
+ }
188
+
189
+ .announcement-title-bar__circle {
190
+ position: relative;
191
+ width: 18px;
192
+ height: 18px;
193
+ border: 2px solid #171b20;
194
+ border-radius: 50%;
195
+ box-sizing: border-box;
196
+ }
197
+
198
+ .announcement-title-bar__circle::after {
199
+ position: absolute;
200
+ left: 50%;
201
+ top: 50%;
202
+ width: 6px;
203
+ height: 6px;
204
+ border-radius: 50%;
205
+ background: #171b20;
206
+ content: '';
207
+ transform: translate(-50%, -50%);
208
+ }
209
+
210
+ @media (max-width: 360px) {
211
+ .announcement-title-bar__title {
212
+ left: 58px;
213
+ right: 106px;
214
+ }
215
+ }
216
+ </style>
@@ -11,6 +11,7 @@ export {}
11
11
  /* prettier-ignore */
12
12
  declare module 'vue' {
13
13
  export interface GlobalComponents {
14
+ AnnouncementTitleBar: typeof import('./components/AnnouncementTitleBar.vue')['default']
14
15
  RouterLink: typeof import('vue-router')['RouterLink']
15
16
  RouterView: typeof import('vue-router')['RouterView']
16
17
  VanButton: typeof import('vant/es')['Button']
@@ -44,7 +44,7 @@ const router = createRouter({
44
44
  path: '/pbc-position',
45
45
  name: 'PbcPosition',
46
46
  component: () => import('@/views/pbc-position/index.vue'),
47
- meta: { requiresAuth: true },
47
+ meta: { requiresAuth: true, hideTabbar: true },
48
48
  },
49
49
  {
50
50
  path: '/position-estimate',
@@ -1,4 +1,5 @@
1
1
  <script setup lang="ts">
2
+ import AnnouncementTitleBar from '@/components/AnnouncementTitleBar.vue'
2
3
  import { highlightArticleHtml } from '@/utils/code-highlight'
3
4
  import { copyText } from '@/utils/copy'
4
5
  import { formatArticleDate, getArticleDetail, type Article } from '@/api/announcement'
@@ -12,7 +13,9 @@ const articleId = computed(() => String(route.params.id || ''))
12
13
  const article = ref<Article>()
13
14
  const loading = ref(false)
14
15
  const loadError = ref(false)
15
- const highlightedContent = computed(() => (article.value ? highlightArticleHtml(article.value.content) : ''))
16
+ const highlightedContent = computed(() =>
17
+ article.value ? highlightArticleHtml(article.value.content) : '',
18
+ )
16
19
 
17
20
  onMounted(() => {
18
21
  loadArticle()
@@ -86,15 +89,7 @@ function articleContentToText(html: string) {
86
89
 
87
90
  <template>
88
91
  <main class="article-detail-page">
89
- <header class="detail-header">
90
- <button class="header-icon-btn" type="button" aria-label="返回" @click="goBack">
91
- <van-icon name="arrow-left" />
92
- </button>
93
- <h1>公告详情</h1>
94
- <button class="header-icon-btn accent" type="button" aria-label="编辑公告" @click="editArticle">
95
- <van-icon name="edit" />
96
- </button>
97
- </header>
92
+ <AnnouncementTitleBar class="article-title-bar" title="公告详情" @back="goBack" />
98
93
 
99
94
  <section v-if="loading" class="state-section">
100
95
  <van-loading vertical>加载中...</van-loading>
@@ -140,48 +135,13 @@ function articleContentToText(html: string) {
140
135
  box-sizing: border-box;
141
136
  }
142
137
 
143
- .detail-header {
144
- position: sticky;
145
- top: 0;
146
- z-index: 10;
147
- display: grid;
148
- grid-template-columns: 40px minmax(0, 1fr) 40px;
149
- align-items: center;
150
- height: 50px;
151
- background: rgba(247, 248, 250, 0.96);
152
- backdrop-filter: blur(10px);
153
- }
154
-
155
- .detail-header h1 {
156
- margin: 0;
157
- color: #171b20;
158
- font-size: 17px;
159
- font-weight: 700;
160
- line-height: 1.2;
161
- text-align: center;
162
- }
163
-
164
- .header-icon-btn {
165
- display: flex;
166
- align-items: center;
167
- justify-content: center;
168
- width: 34px;
169
- height: 34px;
170
- border: 0;
171
- border-radius: 50%;
172
- color: #171b20;
173
- font-size: 20px;
174
- background: transparent;
175
- cursor: pointer;
176
- }
177
-
178
- .header-icon-btn.accent {
179
- justify-self: end;
180
- color: #f22f3d;
181
- background: #fff0f1;
138
+ .article-title-bar {
139
+ width: calc(100% + 22px);
140
+ margin: 0 -11px;
182
141
  }
183
142
 
184
143
  .article-detail {
144
+ margin-top: 12px;
185
145
  padding: 18px 15px 20px;
186
146
  border: 1px solid #edf0f4;
187
147
  border-radius: 8px;
@@ -1,4 +1,5 @@
1
1
  <script setup lang="ts">
2
+ import AnnouncementTitleBar from '@/components/AnnouncementTitleBar.vue'
2
3
  import {
3
4
  createArticle,
4
5
  extractTextFromHtml,
@@ -244,27 +245,17 @@ function escapeAttribute(value: string) {
244
245
  }
245
246
 
246
247
  function normalizeCodeLanguage(value: string) {
247
- return value.trim().toLowerCase().replace(/[^a-z0-9_-]/g, '').slice(0, 24)
248
+ return value
249
+ .trim()
250
+ .toLowerCase()
251
+ .replace(/[^a-z0-9_-]/g, '')
252
+ .slice(0, 24)
248
253
  }
249
254
  </script>
250
255
 
251
256
  <template>
252
257
  <main class="article-edit-page">
253
- <header class="edit-header">
254
- <button class="header-icon-btn" type="button" aria-label="返回" @click="handleCancel">
255
- <van-icon name="arrow-left" />
256
- </button>
257
- <h1>{{ pageTitle }}</h1>
258
- <van-button
259
- size="small"
260
- type="danger"
261
- :loading="saving"
262
- :disabled="detailLoading"
263
- @click="handleSave"
264
- >
265
- {{ isEditing ? '保存' : '发布' }}
266
- </van-button>
267
- </header>
258
+ <AnnouncementTitleBar class="article-title-bar" :title="pageTitle" @back="handleCancel" />
268
259
 
269
260
  <section class="form-panel">
270
261
  <van-field
@@ -326,7 +317,13 @@ function normalizeCodeLanguage(value: string) {
326
317
 
327
318
  <footer class="edit-actions">
328
319
  <van-button block plain type="default" @click="handleCancel">取消</van-button>
329
- <van-button block type="danger" :loading="saving" :disabled="detailLoading" @click="handleSave">
320
+ <van-button
321
+ block
322
+ type="danger"
323
+ :loading="saving"
324
+ :disabled="detailLoading"
325
+ @click="handleSave"
326
+ >
330
327
  {{ isEditing ? '保存公告' : '发布公告' }}
331
328
  </van-button>
332
329
  </footer>
@@ -391,39 +388,9 @@ function normalizeCodeLanguage(value: string) {
391
388
  box-sizing: border-box;
392
389
  }
393
390
 
394
- .edit-header {
395
- position: sticky;
396
- top: 0;
397
- z-index: 10;
398
- display: grid;
399
- grid-template-columns: 44px minmax(0, 1fr) 72px;
400
- align-items: center;
401
- height: 50px;
402
- background: rgba(247, 248, 250, 0.96);
403
- backdrop-filter: blur(10px);
404
- }
405
-
406
- .edit-header h1 {
407
- margin: 0;
408
- color: #171b20;
409
- font-size: 17px;
410
- font-weight: 700;
411
- line-height: 1.2;
412
- text-align: center;
413
- }
414
-
415
- .header-icon-btn {
416
- display: flex;
417
- align-items: center;
418
- justify-content: center;
419
- width: 34px;
420
- height: 34px;
421
- border: 0;
422
- border-radius: 50%;
423
- color: #171b20;
424
- font-size: 20px;
425
- background: transparent;
426
- cursor: pointer;
391
+ .article-title-bar {
392
+ width: calc(100% + 22px);
393
+ margin: 0 -11px;
427
394
  }
428
395
 
429
396
  .form-panel,
@@ -435,6 +402,10 @@ function normalizeCodeLanguage(value: string) {
435
402
  box-shadow: 0 5px 16px rgba(23, 27, 32, 0.04);
436
403
  }
437
404
 
405
+ .form-panel {
406
+ margin-top: 12px;
407
+ }
408
+
438
409
  .form-panel :deep(.van-cell) {
439
410
  --van-cell-vertical-padding: 14px;
440
411
  --van-field-label-width: 44px;
@@ -1,4 +1,5 @@
1
1
  <script setup lang="ts">
2
+ import AnnouncementTitleBar from '@/components/AnnouncementTitleBar.vue'
2
3
  import {
3
4
  extractTextFromHtml,
4
5
  formatArticleDate,
@@ -67,10 +68,12 @@ function openEdit(article: Article) {
67
68
 
68
69
  <template>
69
70
  <main class="article-list-page">
71
+ <AnnouncementTitleBar class="article-title-bar" title="公告" :show-back="false" />
72
+
70
73
  <header class="article-hero">
71
74
  <div class="hero-copy">
72
75
  <p>Announcement Center</p>
73
- <h1>公告</h1>
76
+ <h2>公告中心</h2>
74
77
  <span>{{ articles.length }} 篇内容</span>
75
78
  </div>
76
79
  <van-button size="small" type="danger" icon="plus" @click="openPublish">发布</van-button>
@@ -101,7 +104,12 @@ function openEdit(article: Article) {
101
104
  <span><van-icon name="manager-o" />{{ article.author }}</span>
102
105
  </div>
103
106
  </div>
104
- <button class="article-edit-btn" type="button" aria-label="编辑公告" @click.stop="openEdit(article)">
107
+ <button
108
+ class="article-edit-btn"
109
+ type="button"
110
+ aria-label="编辑公告"
111
+ @click.stop="openEdit(article)"
112
+ >
105
113
  <van-icon name="edit" />
106
114
  </button>
107
115
  </article>
@@ -122,7 +130,7 @@ function openEdit(article: Article) {
122
130
  max-width: 750px;
123
131
  min-height: 100vh;
124
132
  margin: 0 auto;
125
- padding: 14px 11px 86px;
133
+ padding: 0 11px 86px;
126
134
  color: #171b20;
127
135
  background:
128
136
  radial-gradient(circle at 12% 0%, rgba(242, 47, 61, 0.11), transparent 118px),
@@ -130,11 +138,17 @@ function openEdit(article: Article) {
130
138
  box-sizing: border-box;
131
139
  }
132
140
 
141
+ .article-title-bar {
142
+ width: calc(100% + 22px);
143
+ margin: 0 -11px;
144
+ }
145
+
133
146
  .article-hero {
134
147
  display: flex;
135
148
  align-items: center;
136
149
  justify-content: space-between;
137
150
  gap: 12px;
151
+ margin-top: 14px;
138
152
  min-height: 96px;
139
153
  padding: 18px 16px;
140
154
  border-radius: 8px;
@@ -148,7 +162,7 @@ function openEdit(article: Article) {
148
162
  }
149
163
 
150
164
  .hero-copy p,
151
- .hero-copy h1 {
165
+ .hero-copy h2 {
152
166
  margin: 0;
153
167
  }
154
168
 
@@ -159,7 +173,7 @@ function openEdit(article: Article) {
159
173
  line-height: 1.2;
160
174
  }
161
175
 
162
- .hero-copy h1 {
176
+ .hero-copy h2 {
163
177
  margin-top: 6px;
164
178
  color: #171b20;
165
179
  font-size: 24px;
@@ -1,49 +1,426 @@
1
- <script setup lang="ts"></script>
1
+ <script setup lang="ts">
2
+ import {
3
+ buildPbcPositionSendPayload,
4
+ queryPbcPositionBalance,
5
+ sendPbcPositionRequest,
6
+ type PbcPositionBalance,
7
+ } from '@/api/pbc-position'
8
+
9
+ defineOptions({ name: 'PbcPositionPage' })
10
+
11
+ type PositionItem = {
12
+ label: string
13
+ value: string
14
+ icon: string
15
+ highlight?: boolean
16
+ }
17
+
18
+ type PositionSection = {
19
+ key: string
20
+ items: PositionItem[]
21
+ }
22
+
23
+ const router = useRouter()
24
+ const balanceDetail = ref<PbcPositionBalance | null>(null)
25
+ const sending = ref(false)
26
+ const querying = ref(false)
27
+
28
+ const actionDisabled = computed(() => sending.value || querying.value)
29
+ const requestRefNo = computed(() => balanceDetail.value?.requestRefNo || '')
30
+
31
+ const positionSections = computed<PositionSection[]>(() => {
32
+ const detail = balanceDetail.value
33
+
34
+ return [
35
+ {
36
+ key: 'basic',
37
+ items: [
38
+ { label: '清算账户账号', value: fieldText(detail?.settleBankNo), icon: 'manager' },
39
+ { label: '更新时间', value: fieldText(detail?.updateTime), icon: 'clock' },
40
+ {
41
+ label: '申请平台流水号',
42
+ value: fieldText(detail?.refNo || detail?.requestRefNo),
43
+ icon: 'description',
44
+ },
45
+ { label: '清算账户行号', value: fieldText(detail?.settleBankNo), icon: 'hotel-o' },
46
+ { label: '应答平台流水号', value: fieldText(detail?.resRefNo), icon: 'cluster' },
47
+ ],
48
+ },
49
+ {
50
+ key: 'balance',
51
+ items: [
52
+ {
53
+ label: '清算账户余额(亿元)',
54
+ value: formatAmount(detail?.settleBal),
55
+ icon: 'balance-o',
56
+ highlight: true,
57
+ },
58
+ { label: '可用头寸(亿元)', value: formatAmount(detail?.avaAmt), icon: 'card' },
59
+ {
60
+ label: '预期头寸(亿元)',
61
+ value: formatAmount(detail?.expectAmt),
62
+ icon: 'chart-trending-o',
63
+ },
64
+ ],
65
+ },
66
+ {
67
+ key: 'queue',
68
+ items: [
69
+ {
70
+ label: '排队借记总金额(亿元)',
71
+ value: formatAmount(detail?.lineDrAmt),
72
+ icon: 'gold-coin-o',
73
+ },
74
+ { label: '排队贷记总金额(亿元)', value: formatAmount(detail?.lineCrAmt), icon: 'card' },
75
+ { label: '所辖非清算账户数', value: fieldText(detail?.subAcctNumber), icon: 'friends' },
76
+ { label: '所辖非清算总余额(亿元)', value: formatAmount(detail?.subAcctAmt), icon: 'paid' },
77
+ ],
78
+ },
79
+ ]
80
+ })
81
+
82
+ async function handleSend() {
83
+ if (actionDisabled.value) return
84
+
85
+ sending.value = true
86
+ const payload = buildPbcPositionSendPayload()
87
+ console.log('[人行头寸余额发送入参]', payload)
88
+
89
+ try {
90
+ const response = await sendPbcPositionRequest(payload)
91
+ const refNo = response.body.refNo || ''
92
+
93
+ balanceDetail.value = {
94
+ requestRefNo: refNo,
95
+ refNo,
96
+ }
97
+ showToast(refNo ? `发送成功:${refNo}` : '发送成功')
98
+ } catch (error) {
99
+ console.error('[人行头寸余额发送失败]', error)
100
+ showToast(getErrorMessage(error, '发送失败,请重试'))
101
+ } finally {
102
+ sending.value = false
103
+ }
104
+ }
105
+
106
+ async function handleQuery() {
107
+ if (actionDisabled.value) return
108
+
109
+ if (!requestRefNo.value) {
110
+ showDialog({
111
+ title: '提示',
112
+ message: '请先点击发送获取编号',
113
+ confirmButtonText: '知道了',
114
+ })
115
+ return
116
+ }
117
+
118
+ querying.value = true
119
+
120
+ try {
121
+ balanceDetail.value = await queryPbcPositionBalance(requestRefNo.value)
122
+ showToast('查询完成')
123
+ } catch (error) {
124
+ console.error('[人行头寸余额查询失败]', error)
125
+ showToast(getErrorMessage(error, '查询失败,请重试'))
126
+ } finally {
127
+ querying.value = false
128
+ }
129
+ }
130
+
131
+ function fieldText(value?: string) {
132
+ const text = value?.trim()
133
+ return text || '-'
134
+ }
135
+
136
+ function formatAmount(value?: string) {
137
+ if (!value?.trim()) return '-'
138
+
139
+ const amount = Number(value)
140
+ if (!Number.isFinite(amount)) return '-'
141
+
142
+ return new Intl.NumberFormat('zh-CN', {
143
+ minimumFractionDigits: 2,
144
+ maximumFractionDigits: 2,
145
+ }).format(amount / 100000000)
146
+ }
147
+
148
+ function getErrorMessage(error: unknown, fallback: string) {
149
+ return error instanceof Error && error.message ? error.message : fallback
150
+ }
151
+ </script>
2
152
 
3
153
  <template>
4
- <main class="page">
5
- <header class="page-header">
6
- <button class="back-btn" type="button" @click="$router.back()">←</button>
154
+ <main class="pbc-page">
155
+ <header class="pbc-header">
156
+ <button class="back-btn" type="button" aria-label="返回" @click="router.back()">
157
+ <van-icon name="arrow-left" />
158
+ <span>返回</span>
159
+ </button>
7
160
  <h1>人行头寸余额查询</h1>
161
+ <span class="header-spacer" aria-hidden="true"></span>
8
162
  </header>
9
- <section class="page-body">
10
- <p class="placeholder">页面建设中…</p>
163
+
164
+ <section class="balance-card" aria-label="人行头寸余额">
165
+ <div v-for="section in positionSections" :key="section.key" class="info-section">
166
+ <dl class="info-list">
167
+ <div v-for="item in section.items" :key="`${section.key}-${item.label}`" class="info-row">
168
+ <dt>
169
+ <span class="field-icon" aria-hidden="true">
170
+ <van-icon :name="item.icon" />
171
+ </span>
172
+ <span class="field-label">{{ item.label }}</span>
173
+ </dt>
174
+ <dd :class="{ highlight: item.highlight }">{{ item.value }}</dd>
175
+ </div>
176
+ </dl>
177
+ </div>
11
178
  </section>
179
+
180
+ <nav class="action-bar" aria-label="人行头寸操作">
181
+ <button
182
+ class="action-btn send-btn"
183
+ type="button"
184
+ :disabled="actionDisabled"
185
+ @click="handleSend"
186
+ >
187
+ <van-icon :name="sending ? 'underway-o' : 'guide-o'" />
188
+ <span>{{ sending ? '发送中' : '发送' }}</span>
189
+ </button>
190
+ <button
191
+ class="action-btn query-btn"
192
+ type="button"
193
+ :disabled="actionDisabled"
194
+ @click="handleQuery"
195
+ >
196
+ <van-icon :name="querying ? 'underway-o' : 'search'" />
197
+ <span>{{ querying ? '查询中' : '查询' }}</span>
198
+ </button>
199
+ </nav>
12
200
  </main>
13
201
  </template>
14
202
 
15
203
  <style scoped>
16
- .page {
204
+ .pbc-page {
205
+ width: 100%;
17
206
  max-width: 750px;
18
207
  min-height: 100vh;
19
208
  margin: 0 auto;
20
- padding: 0 11px;
21
- background: #f7f8fa;
22
- }
23
- .page-header {
24
- display: flex;
25
- align-items: center;
26
- gap: 8px;
27
- height: 48px;
209
+ padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 82px);
210
+ color: #181d28;
211
+ background:
212
+ linear-gradient(180deg, rgba(255, 255, 255, 0) 0 68px, #ffffff 68px),
213
+ radial-gradient(circle at 50% 28%, rgba(255, 237, 238, 0.95), transparent 118px), #ffffff;
214
+ box-sizing: border-box;
28
215
  }
29
- .back-btn {
216
+
217
+ button {
30
218
  border: 0;
219
+ padding: 0;
220
+ font: inherit;
31
221
  background: transparent;
32
- font-size: 20px;
33
- cursor: pointer;
222
+ appearance: none;
34
223
  }
35
- .page-header h1 {
224
+
225
+ .pbc-header {
226
+ position: relative;
227
+ display: grid;
228
+ grid-template-columns: 88px minmax(0, 1fr) 88px;
229
+ align-items: end;
230
+ height: calc(env(safe-area-inset-top, 0px) + 68px);
231
+ padding: calc(env(safe-area-inset-top, 0px) + 15px) 14px 14px;
232
+ color: #ffffff;
233
+ background:
234
+ radial-gradient(circle at 80% 12%, rgba(255, 126, 126, 0.24), transparent 86px),
235
+ linear-gradient(135deg, #ff2c31 0%, #ff2029 58%, #ff3337 100%);
236
+ box-shadow: 0 2px 7px rgba(230, 30, 36, 0.2);
237
+ box-sizing: border-box;
238
+ }
239
+
240
+ .back-btn {
241
+ display: inline-flex;
242
+ align-items: center;
243
+ justify-self: start;
244
+ min-width: 74px;
245
+ height: 38px;
246
+ color: #ffffff;
247
+ font-size: 19px;
248
+ font-weight: 520;
249
+ line-height: 1;
250
+ }
251
+
252
+ .back-btn .van-icon {
253
+ margin-right: 5px;
254
+ font-size: 29px;
255
+ }
256
+
257
+ .pbc-header h1 {
258
+ min-width: 0;
36
259
  margin: 0;
37
- font-size: 17px;
260
+ overflow: hidden;
261
+ color: #ffffff;
262
+ font-size: 20px;
38
263
  font-weight: 700;
264
+ line-height: 38px;
265
+ text-align: center;
266
+ text-overflow: ellipsis;
267
+ white-space: nowrap;
39
268
  }
40
- .page-body {
41
- padding: 24px 0;
269
+
270
+ .balance-card {
271
+ overflow: hidden;
272
+ margin: 17px 13px 0;
273
+ border: 1px solid #edf0f4;
274
+ border-radius: 19px;
275
+ background: rgba(255, 255, 255, 0.98);
276
+ box-shadow: 0 8px 24px rgba(32, 38, 55, 0.06);
42
277
  }
43
- .placeholder {
44
- text-align: center;
45
- color: #969799;
278
+
279
+ .info-section + .info-section {
280
+ border-top: 8px solid #f7f7f8;
281
+ }
282
+
283
+ .info-list {
284
+ margin: 0;
285
+ padding: 8px 13px;
286
+ }
287
+
288
+ .info-row {
289
+ display: grid;
290
+ grid-template-columns: minmax(0, 1fr) auto;
291
+ align-items: center;
292
+ min-height: 37px;
293
+ column-gap: 10px;
294
+ }
295
+
296
+ .info-row + .info-row {
297
+ border-top: 1px solid #edf0f2;
298
+ }
299
+
300
+ .info-row dt {
301
+ display: flex;
302
+ align-items: center;
303
+ min-width: 0;
304
+ margin: 0;
305
+ }
306
+
307
+ .field-icon {
308
+ display: inline-flex;
309
+ align-items: center;
310
+ justify-content: center;
311
+ width: 26px;
312
+ height: 26px;
313
+ flex: 0 0 26px;
314
+ border-radius: 7px;
315
+ color: #ef252d;
316
+ font-size: 18px;
317
+ background: linear-gradient(135deg, #fff1f2 0%, #ffe8ea 100%);
318
+ box-shadow: 0 4px 11px rgba(236, 42, 50, 0.1);
319
+ }
320
+
321
+ .field-label {
322
+ overflow: hidden;
323
+ margin-left: 14px;
324
+ color: #202532;
325
+ font-size: 14px;
326
+ font-weight: 520;
327
+ line-height: 1.25;
328
+ text-overflow: ellipsis;
329
+ white-space: nowrap;
330
+ }
331
+
332
+ .info-row dd {
333
+ margin: 0;
334
+ color: #1a1f2a;
46
335
  font-size: 14px;
47
- padding-top: 120px;
336
+ font-weight: 500;
337
+ line-height: 1.2;
338
+ text-align: right;
339
+ white-space: nowrap;
340
+ }
341
+
342
+ .info-row dd.highlight {
343
+ color: #c91b20;
344
+ font-size: 22px;
345
+ font-weight: 760;
346
+ letter-spacing: 0;
347
+ }
348
+
349
+ .action-bar {
350
+ position: fixed;
351
+ right: 0;
352
+ bottom: calc(env(safe-area-inset-bottom, 0px) + 15px);
353
+ left: 50%;
354
+ z-index: 10;
355
+ display: grid;
356
+ grid-template-columns: 1fr 1fr;
357
+ gap: 19px;
358
+ width: 100%;
359
+ max-width: 750px;
360
+ padding: 0 13px;
361
+ transform: translateX(-50%);
362
+ box-sizing: border-box;
363
+ pointer-events: none;
364
+ }
365
+
366
+ .action-btn {
367
+ display: inline-flex;
368
+ align-items: center;
369
+ justify-content: center;
370
+ gap: 12px;
371
+ height: 44px;
372
+ border-radius: 24px;
373
+ font-size: 18px;
374
+ font-weight: 580;
375
+ line-height: 1;
376
+ pointer-events: auto;
377
+ }
378
+
379
+ .action-btn:disabled {
380
+ cursor: not-allowed;
381
+ opacity: 0.68;
382
+ }
383
+
384
+ .action-btn .van-icon {
385
+ font-size: 22px;
386
+ }
387
+
388
+ .send-btn {
389
+ color: #ffffff;
390
+ background: linear-gradient(135deg, #ff3338 0%, #ff232b 100%);
391
+ box-shadow:
392
+ 0 12px 22px rgba(255, 44, 50, 0.24),
393
+ inset 0 1px 0 rgba(255, 255, 255, 0.22);
394
+ }
395
+
396
+ .query-btn {
397
+ border: 1px solid #ff3038;
398
+ color: #ef252d;
399
+ background: rgba(255, 255, 255, 0.98);
400
+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
401
+ }
402
+
403
+ @media (max-width: 350px) {
404
+ .pbc-header {
405
+ grid-template-columns: 92px minmax(0, 1fr) 92px;
406
+ }
407
+
408
+ .back-btn {
409
+ min-width: 76px;
410
+ font-size: 17px;
411
+ }
412
+
413
+ .pbc-header h1 {
414
+ font-size: 18px;
415
+ }
416
+
417
+ .field-label,
418
+ .info-row dd {
419
+ font-size: 13px;
420
+ }
421
+
422
+ .info-row dd.highlight {
423
+ font-size: 19px;
424
+ }
48
425
  }
49
426
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "verce-vue-test",
3
- "version": "0.0.56",
3
+ "version": "0.0.57",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {