verce-vue-test 0.0.56 → 0.0.58
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.
- package/mini2.0-main/src/api/pbc-position.ts +170 -0
- package/mini2.0-main/src/components/AnnouncementTitleBar.vue +222 -0
- package/mini2.0-main/src/components.d.ts +1 -0
- package/mini2.0-main/src/core/mxApi/index.ts +103 -1
- package/mini2.0-main/src/router/index.ts +1 -1
- package/mini2.0-main/src/views/article-detail/index.vue +9 -49
- package/mini2.0-main/src/views/article-edit/index.vue +21 -50
- package/mini2.0-main/src/views/articles/index.vue +19 -5
- package/mini2.0-main/src/views/login/index.vue +28 -9
- package/mini2.0-main/src/views/pbc-position/index.vue +403 -26
- package/package.json +1 -1
|
@@ -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,222 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { hideWebViewTitle } from '@/core/mxApi'
|
|
3
|
+
|
|
4
|
+
defineOptions({ name: 'AnnouncementTitleBar' })
|
|
5
|
+
|
|
6
|
+
withDefaults(
|
|
7
|
+
defineProps<{
|
|
8
|
+
title?: string
|
|
9
|
+
showBack?: boolean
|
|
10
|
+
backAriaLabel?: string
|
|
11
|
+
}>(),
|
|
12
|
+
{
|
|
13
|
+
title: '公告',
|
|
14
|
+
showBack: true,
|
|
15
|
+
backAriaLabel: '返回',
|
|
16
|
+
},
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
const emit = defineEmits<{
|
|
20
|
+
back: []
|
|
21
|
+
capsuleMore: []
|
|
22
|
+
capsuleClose: []
|
|
23
|
+
}>()
|
|
24
|
+
|
|
25
|
+
onMounted(() => {
|
|
26
|
+
hideWebViewTitle()
|
|
27
|
+
})
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<header class="announcement-title-bar">
|
|
32
|
+
<div class="announcement-title-bar__inner">
|
|
33
|
+
<button
|
|
34
|
+
v-if="showBack"
|
|
35
|
+
class="announcement-title-bar__back"
|
|
36
|
+
type="button"
|
|
37
|
+
:aria-label="backAriaLabel"
|
|
38
|
+
@click="emit('back')"
|
|
39
|
+
>
|
|
40
|
+
<van-icon name="arrow-left" />
|
|
41
|
+
</button>
|
|
42
|
+
|
|
43
|
+
<h1 class="announcement-title-bar__title">{{ title }}</h1>
|
|
44
|
+
|
|
45
|
+
<div class="announcement-title-bar__capsule" role="group" aria-label="页面操作">
|
|
46
|
+
<button
|
|
47
|
+
class="announcement-title-bar__capsule-btn"
|
|
48
|
+
type="button"
|
|
49
|
+
aria-label="更多"
|
|
50
|
+
@click="emit('capsuleMore')"
|
|
51
|
+
>
|
|
52
|
+
<span class="announcement-title-bar__dots" aria-hidden="true">
|
|
53
|
+
<i></i>
|
|
54
|
+
<i></i>
|
|
55
|
+
<i></i>
|
|
56
|
+
</span>
|
|
57
|
+
</button>
|
|
58
|
+
<span class="announcement-title-bar__divider" aria-hidden="true"></span>
|
|
59
|
+
<button
|
|
60
|
+
class="announcement-title-bar__capsule-btn"
|
|
61
|
+
type="button"
|
|
62
|
+
aria-label="关闭"
|
|
63
|
+
@click="emit('capsuleClose')"
|
|
64
|
+
>
|
|
65
|
+
<span class="announcement-title-bar__circle" aria-hidden="true"></span>
|
|
66
|
+
</button>
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</header>
|
|
70
|
+
</template>
|
|
71
|
+
|
|
72
|
+
<style scoped>
|
|
73
|
+
.announcement-title-bar {
|
|
74
|
+
position: sticky;
|
|
75
|
+
top: 0;
|
|
76
|
+
z-index: 20;
|
|
77
|
+
width: 100%;
|
|
78
|
+
height: calc(50px + env(safe-area-inset-top));
|
|
79
|
+
padding-top: env(safe-area-inset-top);
|
|
80
|
+
color: #171b20;
|
|
81
|
+
background: rgba(247, 248, 250, 0.96);
|
|
82
|
+
backdrop-filter: blur(12px);
|
|
83
|
+
box-sizing: border-box;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.announcement-title-bar__inner {
|
|
87
|
+
position: relative;
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
justify-content: center;
|
|
91
|
+
width: 100%;
|
|
92
|
+
max-width: 750px;
|
|
93
|
+
height: 50px;
|
|
94
|
+
margin: 0 auto;
|
|
95
|
+
padding: 0 10px;
|
|
96
|
+
box-sizing: border-box;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.announcement-title-bar__back,
|
|
100
|
+
.announcement-title-bar__capsule-btn {
|
|
101
|
+
border: 0;
|
|
102
|
+
padding: 0;
|
|
103
|
+
font: inherit;
|
|
104
|
+
background: transparent;
|
|
105
|
+
appearance: none;
|
|
106
|
+
cursor: pointer;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.announcement-title-bar__back {
|
|
110
|
+
position: absolute;
|
|
111
|
+
left: 10px;
|
|
112
|
+
top: 50%;
|
|
113
|
+
display: flex;
|
|
114
|
+
align-items: center;
|
|
115
|
+
justify-content: center;
|
|
116
|
+
width: 36px;
|
|
117
|
+
height: 36px;
|
|
118
|
+
border-radius: 50%;
|
|
119
|
+
color: #171b20;
|
|
120
|
+
font-size: 22px;
|
|
121
|
+
transform: translateY(-50%);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.announcement-title-bar__back:active {
|
|
125
|
+
background: rgba(23, 27, 32, 0.06);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.announcement-title-bar__title {
|
|
129
|
+
position: absolute;
|
|
130
|
+
left: 106px;
|
|
131
|
+
right: 106px;
|
|
132
|
+
margin: 0;
|
|
133
|
+
overflow: hidden;
|
|
134
|
+
color: #171b20;
|
|
135
|
+
font-size: 17px;
|
|
136
|
+
font-weight: 700;
|
|
137
|
+
line-height: 1.2;
|
|
138
|
+
text-align: center;
|
|
139
|
+
text-overflow: ellipsis;
|
|
140
|
+
white-space: nowrap;
|
|
141
|
+
pointer-events: none;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.announcement-title-bar__capsule {
|
|
145
|
+
position: absolute;
|
|
146
|
+
right: 10px;
|
|
147
|
+
top: 50%;
|
|
148
|
+
display: flex;
|
|
149
|
+
align-items: center;
|
|
150
|
+
width: 88px;
|
|
151
|
+
height: 32px;
|
|
152
|
+
overflow: hidden;
|
|
153
|
+
border: 1px solid rgba(23, 27, 32, 0.12);
|
|
154
|
+
border-radius: 999px;
|
|
155
|
+
background: rgba(255, 255, 255, 0.82);
|
|
156
|
+
box-shadow:
|
|
157
|
+
0 6px 18px rgba(23, 27, 32, 0.08),
|
|
158
|
+
inset 0 0 0 0.5px rgba(255, 255, 255, 0.82);
|
|
159
|
+
backdrop-filter: blur(10px);
|
|
160
|
+
transform: translateY(-50%);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.announcement-title-bar__capsule-btn {
|
|
164
|
+
display: flex;
|
|
165
|
+
align-items: center;
|
|
166
|
+
justify-content: center;
|
|
167
|
+
width: 43px;
|
|
168
|
+
height: 100%;
|
|
169
|
+
color: #171b20;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.announcement-title-bar__capsule-btn:active {
|
|
173
|
+
background: rgba(23, 27, 32, 0.06);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.announcement-title-bar__divider {
|
|
177
|
+
width: 1px;
|
|
178
|
+
height: 18px;
|
|
179
|
+
background: rgba(23, 27, 32, 0.12);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.announcement-title-bar__dots {
|
|
183
|
+
display: flex;
|
|
184
|
+
align-items: center;
|
|
185
|
+
gap: 4px;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.announcement-title-bar__dots i {
|
|
189
|
+
width: 4px;
|
|
190
|
+
height: 4px;
|
|
191
|
+
border-radius: 50%;
|
|
192
|
+
background: #171b20;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.announcement-title-bar__circle {
|
|
196
|
+
position: relative;
|
|
197
|
+
width: 18px;
|
|
198
|
+
height: 18px;
|
|
199
|
+
border: 2px solid #171b20;
|
|
200
|
+
border-radius: 50%;
|
|
201
|
+
box-sizing: border-box;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.announcement-title-bar__circle::after {
|
|
205
|
+
position: absolute;
|
|
206
|
+
left: 50%;
|
|
207
|
+
top: 50%;
|
|
208
|
+
width: 6px;
|
|
209
|
+
height: 6px;
|
|
210
|
+
border-radius: 50%;
|
|
211
|
+
background: #171b20;
|
|
212
|
+
content: '';
|
|
213
|
+
transform: translate(-50%, -50%);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
@media (max-width: 360px) {
|
|
217
|
+
.announcement-title-bar__title {
|
|
218
|
+
left: 58px;
|
|
219
|
+
right: 106px;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
</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']
|
|
@@ -84,6 +84,54 @@ interface NXCommonHost {
|
|
|
84
84
|
ajax?: (options: MXAjaxParams) => void
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
export type MXWebuiSideSlot = {
|
|
88
|
+
default?: boolean
|
|
89
|
+
hidden?: boolean
|
|
90
|
+
disable?: boolean
|
|
91
|
+
content?: string | 'default'
|
|
92
|
+
action?: (() => void) | 'default' | 'custom' | 'native' | 'both'
|
|
93
|
+
preventDefault?: boolean
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export type MXWebuiTitleSlot = {
|
|
97
|
+
default?: boolean
|
|
98
|
+
hidden?: boolean
|
|
99
|
+
title?: string
|
|
100
|
+
subtitle?: string
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export type MXWebuiInteractiveSlot = {
|
|
104
|
+
default?: boolean
|
|
105
|
+
hidden?: boolean
|
|
106
|
+
title: string[]
|
|
107
|
+
action?: (idx: number) => void
|
|
108
|
+
active?: number
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export type MXWebuiHeaderSlot = {
|
|
112
|
+
left?: MXWebuiSideSlot
|
|
113
|
+
left_1?: MXWebuiSideSlot
|
|
114
|
+
left_2?: MXWebuiSideSlot
|
|
115
|
+
middle?: MXWebuiTitleSlot | MXWebuiInteractiveSlot
|
|
116
|
+
right_1?: MXWebuiSideSlot
|
|
117
|
+
right_2?: MXWebuiSideSlot
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export type MXWebuiCustomHeaderOptions = {
|
|
121
|
+
slot: MXWebuiHeaderSlot
|
|
122
|
+
onSuccess?: () => void
|
|
123
|
+
onFail?: (error: unknown) => void
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
interface MXWebuiHost {
|
|
127
|
+
hideWebViewTitle?: () => void
|
|
128
|
+
showWebViewTitle?: (title?: string) => void
|
|
129
|
+
setWebViewTitle?: (title: string) => void
|
|
130
|
+
setNavBgColor?: (bgColor: string) => void
|
|
131
|
+
setCustomHeader?: (options: MXWebuiCustomHeaderOptions) => void
|
|
132
|
+
updateCustomHeader?: (options: MXWebuiCustomHeaderOptions) => void
|
|
133
|
+
}
|
|
134
|
+
|
|
87
135
|
const DEFAULT_NATIVE_TIMEOUT = 5000
|
|
88
136
|
const NATIVE_POLL_INTERVAL = 100
|
|
89
137
|
|
|
@@ -92,12 +140,16 @@ declare global {
|
|
|
92
140
|
const MXCommon: MXCommonHost | undefined
|
|
93
141
|
/** 敏行新宿主命名空间,部分客户端使用 NXCommon。 */
|
|
94
142
|
const NXCommon: NXCommonHost | undefined
|
|
143
|
+
/** 敏行原生 UI 宿主命名空间。 */
|
|
144
|
+
const MXWebui: MXWebuiHost | undefined
|
|
95
145
|
|
|
96
146
|
interface Window {
|
|
97
147
|
/** 敏行旧宿主命名空间。 */
|
|
98
148
|
MXCommon?: MXCommonHost
|
|
99
149
|
/** 敏行新宿主命名空间,部分客户端使用 NXCommon。 */
|
|
100
150
|
NXCommon?: NXCommonHost
|
|
151
|
+
/** 敏行原生 UI 宿主命名空间。 */
|
|
152
|
+
MXWebui?: MXWebuiHost
|
|
101
153
|
}
|
|
102
154
|
}
|
|
103
155
|
|
|
@@ -115,11 +167,16 @@ const getMXCommon = () => (typeof MXCommon !== 'undefined' ? MXCommon : undefine
|
|
|
115
167
|
|
|
116
168
|
const getNXCommon = () => (typeof NXCommon !== 'undefined' ? NXCommon : undefined)
|
|
117
169
|
|
|
170
|
+
const getMXWebui = () => (typeof MXWebui !== 'undefined' ? MXWebui : undefined)
|
|
171
|
+
|
|
118
172
|
const getNativeSnapshot = () => ({
|
|
119
173
|
是否存在MXCommon: typeof MXCommon !== 'undefined',
|
|
120
174
|
是否存在NXCommon: typeof NXCommon !== 'undefined',
|
|
175
|
+
是否存在MXWebui: typeof MXWebui !== 'undefined',
|
|
121
176
|
是否存在MXCommonAjax: typeof MXCommon !== 'undefined' && typeof MXCommon.ajax === 'function',
|
|
122
177
|
是否存在NXCommonAjax: typeof NXCommon !== 'undefined' && typeof NXCommon.ajax === 'function',
|
|
178
|
+
是否存在隐藏原生标题栏方法:
|
|
179
|
+
typeof MXWebui !== 'undefined' && typeof MXWebui.hideWebViewTitle === 'function',
|
|
123
180
|
是否存在获取Token方法:
|
|
124
181
|
typeof MXCommon !== 'undefined' && typeof MXCommon.getEncryptString === 'function',
|
|
125
182
|
})
|
|
@@ -259,13 +316,58 @@ export function getAppToken(): Promise<string> {
|
|
|
259
316
|
*/
|
|
260
317
|
export const getEncryptString = getAppToken
|
|
261
318
|
|
|
319
|
+
function callMXWebui(method: keyof MXWebuiHost, ...args: unknown[]) {
|
|
320
|
+
const host = getMXWebui()
|
|
321
|
+
const api = host?.[method]
|
|
322
|
+
|
|
323
|
+
if (typeof api !== 'function') {
|
|
324
|
+
return false
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
try {
|
|
328
|
+
;(api as (...params: unknown[]) => unknown)(...args)
|
|
329
|
+
return true
|
|
330
|
+
} catch (error) {
|
|
331
|
+
console.error(`[敏行UI] ${String(method)} 调用失败`, error)
|
|
332
|
+
return false
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export function hideWebViewTitle() {
|
|
337
|
+
return callMXWebui('hideWebViewTitle')
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
export function showWebViewTitle(title?: string) {
|
|
341
|
+
return typeof title === 'string'
|
|
342
|
+
? callMXWebui('showWebViewTitle', title)
|
|
343
|
+
: callMXWebui('showWebViewTitle')
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export function setWebViewTitle(title: string) {
|
|
347
|
+
return callMXWebui('setWebViewTitle', title)
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export function setNavBgColor(bgColor: string) {
|
|
351
|
+
return callMXWebui('setNavBgColor', bgColor)
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export function setCustomHeader(options: MXWebuiCustomHeaderOptions) {
|
|
355
|
+
return callMXWebui('setCustomHeader', options)
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
export function updateCustomHeader(options: MXWebuiCustomHeaderOptions) {
|
|
359
|
+
return callMXWebui('updateCustomHeader', options)
|
|
360
|
+
}
|
|
361
|
+
|
|
262
362
|
/**
|
|
263
363
|
* 判断当前页面是否运行在敏行宿主环境中。
|
|
264
364
|
*
|
|
265
365
|
* 只要宿主注入了 MXCommon 或 NXCommon,就认为是原生环境。
|
|
266
366
|
*/
|
|
267
367
|
export const isNativeApp = (): boolean =>
|
|
268
|
-
typeof MXCommon !== 'undefined' ||
|
|
368
|
+
typeof MXCommon !== 'undefined' ||
|
|
369
|
+
typeof NXCommon !== 'undefined' ||
|
|
370
|
+
typeof MXWebui !== 'undefined'
|
|
269
371
|
|
|
270
372
|
/**
|
|
271
373
|
* 等待敏行宿主完成注入后再判断是否为 APP 环境。
|
|
@@ -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(() =>
|
|
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
|
-
<
|
|
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
|
-
.
|
|
144
|
-
|
|
145
|
-
|
|
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
|
|
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
|
-
<
|
|
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
|
|
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
|
-
.
|
|
395
|
-
|
|
396
|
-
|
|
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
|
-
<
|
|
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
|
|
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:
|
|
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
|
|
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
|
|
176
|
+
.hero-copy h2 {
|
|
163
177
|
margin-top: 6px;
|
|
164
178
|
color: #171b20;
|
|
165
179
|
font-size: 24px;
|
|
@@ -5,6 +5,7 @@ import { showToast } from 'vant'
|
|
|
5
5
|
import { useAppStore } from '@/stores/app'
|
|
6
6
|
import { useUserStore } from '@/stores/user'
|
|
7
7
|
import { getAppToken } from '@/core/mxApi'
|
|
8
|
+
import { appEnv } from '@/config/env'
|
|
8
9
|
import { saveAuthTokens, type AuthTokenResponse } from '@/utils/auth-token'
|
|
9
10
|
|
|
10
11
|
const router = useRouter()
|
|
@@ -20,6 +21,8 @@ const loading = ref(false)
|
|
|
20
21
|
const appVersion = __APP_VERSION__
|
|
21
22
|
const APP_TOKEN_TIMEOUT = 30000
|
|
22
23
|
const LOGIN_UNAVAILABLE_MESSAGE = '抱歉暂时无法登录'
|
|
24
|
+
const MOCK_APP_TOKEN = 'mock_token'
|
|
25
|
+
const isDevelopment = appEnv === 'development'
|
|
23
26
|
|
|
24
27
|
onMounted(() => {
|
|
25
28
|
if (!appStore.isNative) return
|
|
@@ -30,11 +33,7 @@ onMounted(() => {
|
|
|
30
33
|
async function loginWithAppToken() {
|
|
31
34
|
loading.value = true
|
|
32
35
|
try {
|
|
33
|
-
|
|
34
|
-
const res = await loginByAppTokenApi(appToken)
|
|
35
|
-
await saveBusinessTokenAndOrg(res)
|
|
36
|
-
showToast('登录成功')
|
|
37
|
-
router.push('/')
|
|
36
|
+
await loginByAppToken(await getLoginAppToken())
|
|
38
37
|
} catch (error) {
|
|
39
38
|
console.error('[登录页] APP token 自动登录失败', error)
|
|
40
39
|
if (!isLoginUnavailableError(error)) {
|
|
@@ -46,6 +45,10 @@ async function loginWithAppToken() {
|
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
47
|
|
|
48
|
+
function getLoginAppToken() {
|
|
49
|
+
return isDevelopment ? Promise.resolve(MOCK_APP_TOKEN) : getAppTokenWithTimeout()
|
|
50
|
+
}
|
|
51
|
+
|
|
49
52
|
function getAppTokenWithTimeout() {
|
|
50
53
|
return Promise.race([
|
|
51
54
|
getAppToken(),
|
|
@@ -60,10 +63,12 @@ function getAppTokenWithTimeout() {
|
|
|
60
63
|
async function onSubmit() {
|
|
61
64
|
loading.value = true
|
|
62
65
|
try {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
if (isDevelopment) {
|
|
67
|
+
await loginByAppToken(MOCK_APP_TOKEN)
|
|
68
|
+
return
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
await loginByPassword()
|
|
67
72
|
} catch (error) {
|
|
68
73
|
if (!isLoginUnavailableError(error)) {
|
|
69
74
|
console.error('[登录页] 账号密码登录失败', error)
|
|
@@ -74,6 +79,20 @@ async function onSubmit() {
|
|
|
74
79
|
}
|
|
75
80
|
}
|
|
76
81
|
|
|
82
|
+
async function loginByAppToken(appToken: string) {
|
|
83
|
+
const res = await loginByAppTokenApi(appToken)
|
|
84
|
+
await saveBusinessTokenAndOrg(res)
|
|
85
|
+
showToast('登录成功')
|
|
86
|
+
router.push('/')
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async function loginByPassword() {
|
|
90
|
+
const res = await loginApi(form.value)
|
|
91
|
+
await saveBusinessTokenAndOrg(res)
|
|
92
|
+
showToast('登录成功')
|
|
93
|
+
router.push('/')
|
|
94
|
+
}
|
|
95
|
+
|
|
77
96
|
async function saveBusinessTokenAndOrg(response: unknown) {
|
|
78
97
|
// 先保存 token,后续机构接口需要携带 Authorization 访问。
|
|
79
98
|
saveAuthTokens(response as AuthTokenResponse)
|
|
@@ -1,49 +1,426 @@
|
|
|
1
|
-
<script setup lang="ts"
|
|
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="
|
|
6
|
-
<button class="back-btn" type="button" @click="
|
|
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
|
-
|
|
10
|
-
|
|
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:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
216
|
+
|
|
217
|
+
button {
|
|
30
218
|
border: 0;
|
|
219
|
+
padding: 0;
|
|
220
|
+
font: inherit;
|
|
31
221
|
background: transparent;
|
|
32
|
-
|
|
33
|
-
cursor: pointer;
|
|
222
|
+
appearance: none;
|
|
34
223
|
}
|
|
35
|
-
|
|
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
|
-
|
|
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
|
-
|
|
41
|
-
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
|
|
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>
|