verce-vue-test 0.0.55 → 0.0.56

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.
@@ -1,13 +1,20 @@
1
1
  <script setup lang="ts">
2
+ import { useAppStore } from '@/stores/app'
3
+
2
4
  const route = useRoute()
3
5
  const router = useRouter()
6
+ const appStore = useAppStore()
4
7
 
5
- const tabItems = [
8
+ const baseTabItems = [
6
9
  { title: '首页', path: '/', icon: 'wap-home-o' },
7
10
  { title: '公告', path: '/articles', icon: 'records-o' },
8
11
  { title: '我的', path: '/mine', icon: 'manager-o' },
9
12
  ]
10
13
 
14
+ const tabItems = computed(() =>
15
+ baseTabItems.filter((item) => item.path !== '/articles' || appStore.showAnnouncementTab),
16
+ )
17
+
11
18
  const showTabbar = computed(() => route.meta.hideTabbar !== true)
12
19
 
13
20
  const activeTab = computed({
@@ -18,6 +18,8 @@ export type RmbForecastRecord = {
18
18
  groundBranch?: string
19
19
  /** 预报金额,接口按元返回,页面转换为亿元展示。 */
20
20
  predAmt?: string
21
+ /** 预报流水号,点击列表进入详情的主键。 */
22
+ predRefNo?: string
21
23
  /** 预报状态,用于判断列表状态标签。 */
22
24
  predStatus?: string
23
25
  /** 交易日期,列表日期展示字段。 */
@@ -48,6 +50,17 @@ export type RmbForecastQueryResult = {
48
50
  head: TamResponse<RmbForecastQueryResultBody>['head']
49
51
  }
50
52
 
53
+ export type RmbForecastDetailPayload = {
54
+ appHead: TamRequestPayload<RmbForecastDetailBody>['appHead']
55
+ body: RmbForecastDetailBody
56
+ head: TamRequestPayload<RmbForecastDetailBody>['head']
57
+ }
58
+
59
+ export type RmbForecastDetailResult = {
60
+ body: RmbForecastDetailRecord
61
+ head: TamResponse<RmbForecastDetailRecord>['head']
62
+ }
63
+
51
64
  type RmbForecastQueryBody = {
52
65
  /** 业务类型,当前视图未开放筛选,固定传空。 */
53
66
  busiType: string
@@ -80,13 +93,78 @@ type RmbForecastQueryResultBody = {
80
93
  totalCount: string
81
94
  }
82
95
 
96
+ type RmbForecastDetailBody = {
97
+ /** 预报流水号,详情查询主键。 */
98
+ predRefNo: string
99
+ }
100
+
101
+ export type RmbForecastDetailRecord = {
102
+ /** 出票日 */
103
+ billDate?: string
104
+ /** 票号 */
105
+ billNo?: string
106
+ /** 业务类型 */
107
+ busiType?: string
108
+ /** 客户名称 */
109
+ clientName?: string
110
+ /** 客户类型 */
111
+ clientType?: string
112
+ /** 交易对手账号 */
113
+ competAcct?: string
114
+ /** 交易对手名称 */
115
+ competName?: string
116
+ /** 额度标志 */
117
+ eduFlag?: string
118
+ /** 落地机构名称 */
119
+ groundBranch?: string
120
+ /** 落地机构代码 */
121
+ groundBranchCode?: string
122
+ /** 联系人 */
123
+ linkMan?: string
124
+ /** 支付渠道 */
125
+ payChannel?: string
126
+ /** 收支方向 */
127
+ payDirec?: string
128
+ /** 联系电话 */
129
+ phoneNo?: string
130
+ /** 预报金额 */
131
+ predAmt?: string
132
+ /** 预报机构 */
133
+ predBranch?: string
134
+ /** 预报机构 */
135
+ predBranchName?: string
136
+ /** 预报人员编号 */
137
+ predCode?: string
138
+ /** 预报日期 */
139
+ predDate?: string
140
+ /** 预报人员姓名 */
141
+ predName?: string
142
+ /** 预报流水号 */
143
+ predRefNo?: string
144
+ /** 预报状态 */
145
+ predStatus?: string
146
+ /** 用途 */
147
+ purpose?: string
148
+ /** 备注 */
149
+ remark?: string
150
+ /** 标准名称 */
151
+ standardName?: string
152
+ /** 交易日期 */
153
+ tranDate?: string
154
+ /** 已核销金额 */
155
+ verifyAmt?: string
156
+ /** 核销状态 */
157
+ verifyStatus?: string
158
+ }
159
+
83
160
  type QueryOptions = {
84
161
  form: RmbForecastQueryForm
85
162
  pageIndex: number
86
163
  pageSize: number
87
164
  }
88
165
 
89
- const TRAN_CODE = '/TAM/0001/140101001'
166
+ const QUERY_TRAN_CODE = '/TAM/0001/140101001'
167
+ const DETAIL_TRAN_CODE = '/TAM/0001/140101002'
90
168
 
91
169
  export function buildRmbForecastQueryPayload({
92
170
  form,
@@ -97,7 +175,7 @@ export function buildRmbForecastQueryPayload({
97
175
 
98
176
  // 当前视图只提供交易日期、落地机构、起始金额、截止金额,其余查询字段按接口约定传空。
99
177
  return buildTamRequestPayload({
100
- tranCode: TRAN_CODE,
178
+ tranCode: QUERY_TRAN_CODE,
101
179
  pageIndex,
102
180
  pageSize,
103
181
  body: {
@@ -124,6 +202,21 @@ export async function queryRmbForecastPage(
124
202
  return tamRequest<RmbForecastQueryBody, RmbForecastQueryResultBody>(payload)
125
203
  }
126
204
 
205
+ export function buildRmbForecastDetailPayload(predRefNo: string): RmbForecastDetailPayload {
206
+ return buildTamRequestPayload({
207
+ tranCode: DETAIL_TRAN_CODE,
208
+ body: {
209
+ predRefNo,
210
+ },
211
+ })
212
+ }
213
+
214
+ export async function queryRmbForecastDetail(
215
+ payload: RmbForecastDetailPayload,
216
+ ): Promise<RmbForecastDetailResult> {
217
+ return tamRequest<RmbForecastDetailBody, RmbForecastDetailRecord>(payload)
218
+ }
219
+
127
220
  function normalizeDate(value: string) {
128
221
  // 日期选择器产出 YYYY-MM-DD;接口需要 YYYYMMDD。
129
222
  if (/^\d{8}$/.test(value)) return value
@@ -21,6 +21,7 @@ export function getUserInfoApi(id: number) {
21
21
  export function getOrgByUserNameApi(username: string) {
22
22
  return request<UserOrg[]>({
23
23
  url: '/uaa/user/getOrgByUserName',
24
+ method: 'POST',
24
25
  params: {
25
26
  username,
26
27
  },
@@ -25,6 +25,7 @@ declare module 'vue' {
25
25
  VanLoading: typeof import('vant/es')['Loading']
26
26
  VanPopup: typeof import('vant/es')['Popup']
27
27
  VanSearch: typeof import('vant/es')['Search']
28
+ VanSwitch: typeof import('vant/es')['Switch']
28
29
  VanTabbar: typeof import('vant/es')['Tabbar']
29
30
  VanTabbarItem: typeof import('vant/es')['TabbarItem']
30
31
  }
@@ -1,6 +1,6 @@
1
1
  app_id=vue_demo;
2
- version_code=10001;
3
- version_name=1.0.0.01;
2
+ version_code=10002;
3
+ version_name=1.0.0.02;
4
4
  type=html5;
5
5
  frame=vue;
6
6
  platform=[mac,win,ios,android];
@@ -22,6 +22,18 @@ const router = createRouter({
22
22
  component: () => import('@/views/rmb-position/index.vue'),
23
23
  meta: { requiresAuth: true, hideTabbar: true },
24
24
  },
25
+ {
26
+ path: '/rmb-position/new',
27
+ name: 'RmbPositionCreate',
28
+ component: () => import('@/views/rmb-position-create/index.vue'),
29
+ meta: { requiresAuth: true, hideTabbar: true },
30
+ },
31
+ {
32
+ path: '/rmb-position/:predRefNo',
33
+ name: 'RmbPositionDetail',
34
+ component: () => import('@/views/rmb-position-detail/index.vue'),
35
+ meta: { requiresAuth: true, hideTabbar: true },
36
+ },
25
37
  {
26
38
  path: '/foreign-position',
27
39
  name: 'ForeignPosition',
@@ -88,6 +100,12 @@ const router = createRouter({
88
100
  component: () => import('@/views/mine/index.vue'),
89
101
  meta: { requiresAuth: true },
90
102
  },
103
+ {
104
+ path: '/settings',
105
+ name: 'Settings',
106
+ component: () => import('@/views/settings/index.vue'),
107
+ meta: { requiresAuth: true, hideTabbar: true },
108
+ },
91
109
  ],
92
110
  })
93
111
 
@@ -4,21 +4,37 @@ import { waitNativeReady } from '@/core/mxApi'
4
4
  /**
5
5
  * 应用级状态 Store
6
6
  *
7
- * 存放全局共享的运行时状态,不持久化。
7
+ * 存放全局共享的运行时状态,应用设置通过 persistedstate 持久化。
8
8
  * initNativeDetection 在 main.ts 挂载前调用,组件读取时值已就绪。
9
9
  */
10
- export const useAppStore = defineStore('app', () => {
11
- /** 是否在原生 APP WebView 环境中 */
12
- const isNative = ref(false)
10
+ export const useAppStore = defineStore(
11
+ 'app',
12
+ () => {
13
+ /** 是否在原生 APP WebView 环境中 */
14
+ const isNative = ref(false)
13
15
 
14
- /**
15
- * 初始化原生环境检测
16
- *
17
- * 等待敏行宿主注入完成后判断当前运行环境。
18
- */
19
- async function initNativeDetection() {
20
- isNative.value = await waitNativeReady()
21
- }
16
+ /** 是否在底部导航中显示公告入口 */
17
+ const showAnnouncementTab = ref(false)
22
18
 
23
- return { isNative, initNativeDetection }
24
- })
19
+ /**
20
+ * 初始化原生环境检测
21
+ *
22
+ * 等待敏行宿主注入完成后判断当前运行环境。
23
+ */
24
+ async function initNativeDetection() {
25
+ isNative.value = await waitNativeReady()
26
+ }
27
+
28
+ function setShowAnnouncementTab(value: boolean) {
29
+ showAnnouncementTab.value = value
30
+ }
31
+
32
+ return { isNative, showAnnouncementTab, initNativeDetection, setShowAnnouncementTab }
33
+ },
34
+ {
35
+ persist: {
36
+ key: 'mini2_app_settings',
37
+ pick: ['showAnnouncementTab'],
38
+ },
39
+ },
40
+ )
@@ -20,7 +20,7 @@ export const useUserStore = defineStore(
20
20
  // -------------------------------- State --------------------------------
21
21
 
22
22
  /** 登录凭证,登录成功后由后端返回,后续请求通过请求头携带 */
23
- const token = ref('')
23
+ const token = ref('1')
24
24
  const refreshToken = ref('')
25
25
  const username = ref('')
26
26
  const realName = ref('')
@@ -0,0 +1,84 @@
1
+ export type ForecastStatusCode = '1' | '2' | '3' | '4' | '5' | '6'
2
+
3
+ export type ForecastStatusOption = {
4
+ label: string
5
+ className: string
6
+ }
7
+
8
+ export const businessTypeMap: Record<string, string> = {
9
+ '1': '对公/个人客户收付',
10
+ '2': '本票签发/兑付',
11
+ '3': '三省一市汇票签发/兑付',
12
+ '4': '分行资金调拨',
13
+ '5': '同业业务',
14
+ '6': '资金业务',
15
+ '7': '理财业务',
16
+ '8': '债券承销业务',
17
+ '9': '司库业务',
18
+ '10': '现金出入库',
19
+ '11': '财政准备金退缴',
20
+ '12': '同业清算款项收付',
21
+ '13': '财政零余额业务',
22
+ '14': '银行承兑汇票',
23
+ '15': '托管业务',
24
+ '16': '票据业务',
25
+ }
26
+
27
+ export const clientTypeMap: Record<string, string> = {
28
+ '1': '公客户',
29
+ '2': '个人客户',
30
+ }
31
+
32
+ export const forecastStatusMap: Record<ForecastStatusCode, ForecastStatusOption> = {
33
+ '1': { label: '正常预报', className: 'status-tag-normal' },
34
+ '2': { label: '延迟预报', className: 'status-tag-delayed' },
35
+ '3': { label: '正常预报正常删除', className: 'status-tag-normal-delete' },
36
+ '4': { label: '正常预报延迟删除', className: 'status-tag-normal-delay-delete' },
37
+ '5': { label: '延迟预报延时删除', className: 'status-tag-delayed-late-delete' },
38
+ '6': { label: '延时预报延迟删除', className: 'status-tag-late-delay-delete' },
39
+ }
40
+
41
+ export const unknownForecastStatus: ForecastStatusOption = {
42
+ label: '未知状态',
43
+ className: 'status-tag-unknown',
44
+ }
45
+
46
+ export function resolveBusinessType(value?: string) {
47
+ return value ? businessTypeMap[value] || `业务类型${value}` : '业务类型-'
48
+ }
49
+
50
+ export function resolveClientType(value?: string) {
51
+ return value ? clientTypeMap[value] || '其他用户' : '其他用户'
52
+ }
53
+
54
+ export function resolveForecastStatus(value?: string): ForecastStatusOption {
55
+ if (value && value in forecastStatusMap) {
56
+ return forecastStatusMap[value as ForecastStatusCode]
57
+ }
58
+
59
+ return unknownForecastStatus
60
+ }
61
+
62
+ export function formatRmbForecastDate(value?: string) {
63
+ if (value && /^\d{8}$/.test(value)) {
64
+ return `${value.slice(0, 4)}-${value.slice(4, 6)}-${value.slice(6, 8)}`
65
+ }
66
+
67
+ return value || '-'
68
+ }
69
+
70
+ export function toBillionYuan(value?: string) {
71
+ const amount = Number(value || 0)
72
+ return Number.isFinite(amount) ? amount / 100000000 : 0
73
+ }
74
+
75
+ export function formatForecastAmount(value: number) {
76
+ const sign = value >= 0 ? '+' : '-'
77
+ return `${sign}${Math.abs(value).toFixed(2)}`
78
+ }
79
+
80
+ export function formatForecastAmountText(value?: string) {
81
+ if (!value?.trim()) return '-'
82
+
83
+ return `${formatForecastAmount(toBillionYuan(value))} 亿元`
84
+ }
@@ -11,6 +11,10 @@ const tokenText = computed(() => (userStore.token ? '已登录' : '未登录'))
11
11
  const displayName = computed(() => userStore.realName || userStore.username || tokenText.value)
12
12
  const organizationNameText = computed(() => userStore.organizationName || '暂无所属机构')
13
13
 
14
+ function openSettings() {
15
+ router.push('/settings')
16
+ }
17
+
14
18
  async function handleLogout() {
15
19
  try {
16
20
  await showConfirmDialog({
@@ -44,6 +48,7 @@ async function handleLogout() {
44
48
  <van-cell-group inset>
45
49
  <van-cell title="登录状态" :value="tokenText" />
46
50
  <van-cell title="应用版本" :value="`v${appVersion}`" />
51
+ <van-cell title="设置" icon="setting-o" is-link @click="openSettings" />
47
52
  </van-cell-group>
48
53
  </section>
49
54