@uxda/appkit 1.0.66 → 1.0.70
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/dist/appkit.css +155 -110
- package/dist/index.js +636 -443
- package/package.json +2 -1
- package/src/balance/api/endpoints.ts +38 -34
- package/src/balance/api/index.ts +62 -10
- package/src/balance/components/AccountView.vue +274 -211
- package/src/balance/components/BalanceCard.vue +3 -3
- package/src/balance/components/ConsumptionFilter.vue +49 -26
- package/src/balance/components/DateFilter.vue +11 -4
- package/src/balance/components/SecondBalance.vue +72 -0
- package/src/balance/types.ts +20 -15
- package/src/index.ts +0 -4
- package/src/payment/api/endpoints.ts +8 -4
- package/src/payment/api/index.ts +53 -14
- package/src/payment/components/RechargeView.vue +3 -3
- package/src/payment/services/request-payment.ts +3 -3
- package/src/shared/components/EmptyView.vue +34 -0
- package/src/shared/components/PageHeader.vue +23 -15
- package/src/shared/composables/index.ts +1 -5
- package/src/shared/composables/useSafeArea.ts +42 -0
- package/src/shared/http/Http.ts +76 -83
- package/src/shared/http/types.ts +106 -48
- package/src/shared/index.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxda/appkit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.70",
|
|
4
4
|
"description": "小程序应用开发包",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.ts",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"@tarojs/taro": "^3.5.6",
|
|
40
40
|
"@tarojs/taro-h5": "^3.5.6",
|
|
41
41
|
"@types/wechat-miniprogram": "^3.4.7",
|
|
42
|
+
"dayjs": "^1.11.10",
|
|
42
43
|
"vue": "^3.3.0"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { HttpEndpoints } from '../../shared/http'
|
|
2
|
-
import {
|
|
2
|
+
import { 账户流水筛选项, ConsumptionType } from '../types'
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* 流水交易类型映射
|
|
6
|
+
*/
|
|
4
7
|
const typeMappings: Record<string, ConsumptionType> = {
|
|
5
8
|
'CZ': '充值',
|
|
6
9
|
'JF': '缴费',
|
|
@@ -11,6 +14,9 @@ const typeMappings: Record<string, ConsumptionType> = {
|
|
|
11
14
|
'TH': '退回',
|
|
12
15
|
}
|
|
13
16
|
|
|
17
|
+
/**
|
|
18
|
+
* 映射还能反过来
|
|
19
|
+
*/
|
|
14
20
|
const typeMappingsReversed = Object.fromEntries(
|
|
15
21
|
Object.entries(typeMappings).map(([x, y]) => [y, x])
|
|
16
22
|
)
|
|
@@ -34,56 +40,54 @@ const directionMappingsReversed = Object.fromEntries(
|
|
|
34
40
|
)
|
|
35
41
|
|
|
36
42
|
const endpointsList: HttpEndpoints = {
|
|
37
|
-
|
|
38
|
-
* 余额明细
|
|
39
|
-
*/
|
|
40
|
-
getBalance: {
|
|
43
|
+
获取余额明细: {
|
|
41
44
|
path: '/ac-app/account/info/detail/app', // /app
|
|
42
|
-
translate: (data: any) => ({
|
|
43
|
-
}),
|
|
44
45
|
transform (result: any) {
|
|
45
46
|
return {
|
|
46
47
|
total: result.commonAccount,
|
|
47
48
|
privileges: result.rightsAccountBalList.map((r: any) => ({
|
|
48
49
|
title: r.rightsName,
|
|
49
|
-
|
|
50
|
+
count: r.rightsAccount
|
|
50
51
|
}))
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
},
|
|
54
|
-
|
|
55
|
-
* 账户流水明细
|
|
56
|
-
*/
|
|
57
|
-
getOperations: {
|
|
55
|
+
获取账户流水: {
|
|
58
56
|
path: '/ac-app/account/record/detail/mobile',
|
|
59
|
-
translate: (data:
|
|
57
|
+
translate: (data: 账户流水筛选项) => {
|
|
60
58
|
return {
|
|
61
|
-
accountType: positionMappingsReversed[data
|
|
62
|
-
inOrOut: directionMappingsReversed[data
|
|
63
|
-
changeType: typeMappingsReversed[data
|
|
59
|
+
accountType: positionMappingsReversed[data.账户类型] || '',
|
|
60
|
+
inOrOut: directionMappingsReversed[data.收入还是支出] || '',
|
|
61
|
+
changeType: typeMappingsReversed[data.交易类型] || '',
|
|
64
62
|
operateTimeStart: data.dateFrom || '',
|
|
65
63
|
operateTimeEnd: data.dateTo || '',
|
|
64
|
+
rightsCode: data.权益类目,
|
|
65
|
+
pageNum: data.page,
|
|
66
|
+
pageSize: 10,
|
|
66
67
|
}
|
|
67
68
|
},
|
|
68
|
-
transform (
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
direction: directionMappings[d.inOrOut],
|
|
79
|
-
amount: d.changeValue,
|
|
80
|
-
title: d.rightsName,
|
|
81
|
-
description: d.remark,
|
|
82
|
-
}))
|
|
83
|
-
}))
|
|
84
|
-
}
|
|
69
|
+
transform (response: any) {
|
|
70
|
+
const data = response.list.map((d: any) => ({
|
|
71
|
+
账户类型: positionMappings[d.accountType],
|
|
72
|
+
交易类型: typeMappings[d.changeType],
|
|
73
|
+
收入还是支出: directionMappings[d.inOrOut],
|
|
74
|
+
amount: d.changeValue,
|
|
75
|
+
title: d.rightsName,
|
|
76
|
+
time: Date.parse(d.operateTime), // 后台返回的是日期字符串,这里格式化成 timestamp
|
|
77
|
+
description: d.remark,
|
|
78
|
+
}))
|
|
85
79
|
return data
|
|
86
80
|
}
|
|
81
|
+
},
|
|
82
|
+
获取权益类目: {
|
|
83
|
+
path: '/ac-app/rights/item/list',
|
|
84
|
+
// translate (data: ConsumptionFiltering) {
|
|
85
|
+
// // return { appCode: data.appCode }
|
|
86
|
+
// },
|
|
87
|
+
transform: (data: any[]) => data.map(d => ({
|
|
88
|
+
name: d.rightsName,
|
|
89
|
+
code: d.rightsCode,
|
|
90
|
+
}))
|
|
87
91
|
}
|
|
88
92
|
}
|
|
89
93
|
|
|
@@ -103,4 +107,4 @@ export {
|
|
|
103
107
|
endpoints,
|
|
104
108
|
translates,
|
|
105
109
|
transforms,
|
|
106
|
-
}
|
|
110
|
+
}
|
package/src/balance/api/index.ts
CHANGED
|
@@ -1,21 +1,73 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Taro from '@tarojs/taro'
|
|
2
|
+
import { HttpRequestConfig, PagingData, PagingParams, ResponseRaw, createHttp } from '../../shared'
|
|
2
3
|
import { translates, transforms } from './endpoints'
|
|
3
4
|
import { useAppKitOptions } from '../../Appkit'
|
|
4
5
|
|
|
5
|
-
const makeHttp = () => {
|
|
6
|
-
const appkitOptions = useAppKitOptions()
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* 小程序端 Http
|
|
9
|
+
* 使用 Taro.request 实现
|
|
10
|
+
*/
|
|
11
|
+
const vendor = {
|
|
12
|
+
async request <T>(config: HttpRequestConfig) {
|
|
13
|
+
return new Promise<ResponseRaw<T>>((resolve, reject) => {
|
|
14
|
+
Taro.request({
|
|
15
|
+
url: config.url,
|
|
16
|
+
method: config.method,
|
|
17
|
+
header: config.headers,
|
|
18
|
+
data: config.data
|
|
19
|
+
}).then(({data}) => {
|
|
20
|
+
resolve({
|
|
21
|
+
status: +data.code,
|
|
22
|
+
message: data.msg,
|
|
23
|
+
data: data.result as T
|
|
24
|
+
})
|
|
25
|
+
}).catch((e: any) => {
|
|
26
|
+
reject(e)
|
|
27
|
+
})
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function useHttp () {
|
|
33
|
+
const appkitOptions = useAppKitOptions()
|
|
34
|
+
const headers = {
|
|
9
35
|
Token: appkitOptions.token(),
|
|
10
36
|
Appcode: appkitOptions.app(),
|
|
11
37
|
cookie: `tid=${appkitOptions.tenant()}`
|
|
12
38
|
}
|
|
13
|
-
|
|
14
|
-
|
|
39
|
+
/**
|
|
40
|
+
* 传入配置获取 Http instanse
|
|
41
|
+
*/
|
|
42
|
+
const $http = createHttp({
|
|
43
|
+
vendor,
|
|
15
44
|
baseUrl: appkitOptions.baseUrl(),
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
45
|
+
headers,
|
|
46
|
+
interceptors: [
|
|
47
|
+
raw => {
|
|
48
|
+
if (raw.status == 401) {
|
|
49
|
+
appkitOptions[401]()
|
|
50
|
+
return true
|
|
51
|
+
}
|
|
52
|
+
return false
|
|
53
|
+
},
|
|
54
|
+
raw => {
|
|
55
|
+
if (raw.status > 500) {
|
|
56
|
+
return true
|
|
57
|
+
}
|
|
58
|
+
return false
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
paging: {
|
|
62
|
+
translate: (params: PagingParams) => ({
|
|
63
|
+
pageNum: params.page,
|
|
64
|
+
pageSize: params.pageSize
|
|
65
|
+
}),
|
|
66
|
+
transform (data: any): PagingData {
|
|
67
|
+
return {
|
|
68
|
+
totalPages: data.pages
|
|
69
|
+
}
|
|
70
|
+
}
|
|
19
71
|
},
|
|
20
72
|
translates,
|
|
21
73
|
transforms,
|
|
@@ -24,7 +76,7 @@ const makeHttp = () => {
|
|
|
24
76
|
}
|
|
25
77
|
|
|
26
78
|
export {
|
|
27
|
-
|
|
79
|
+
useHttp
|
|
28
80
|
}
|
|
29
81
|
|
|
30
82
|
export * from './endpoints'
|