@uxda/appkit 4.3.13 → 4.3.15
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/COMPONENT_USAGE.md +3 -3
- package/dist/appkit.css +12 -105
- package/dist/index.js +449 -1060
- package/package.json +5 -2
- package/src/balance/api/index.ts +1 -1
- package/src/balance/components/PromoterCard.vue +0 -1
- package/src/notice/api/index.ts +1 -1
- package/src/notice/components/NoticeList2.vue +73 -234
- package/src/notice/components/useCommonList.ts +0 -1
- package/src/payment/api/endpoints.ts +14 -2
- package/src/payment/api/index.ts +1 -2
- package/src/payment/components/RechargeResult.vue +1 -0
- package/src/payment/components/RechargeView.vue +45 -13
- package/src/payment/components/TradeView.vue +153 -326
- package/src/payment/services/request-payment.ts +0 -2
- package/src/payment/types.ts +0 -1
- package/src/register/components/SelfRegistration.vue +1 -1
- package/src/shared/components/AppVerify.vue +6 -15
- package/src/shared/components/OcrBusinessLicense.vue +37 -20
- package/src/shared/components/OcrIcon.vue +67 -105
- package/src/shared/components/index.ts +1 -3
- package/src/shared/composables/index.ts +0 -1
- package/src/shared/composables/useDeviceEnv.ts +35 -1
- package/src/shared/composables/useUpload.ts +51 -96
- package/src/shared/http/Http.ts +0 -1
- package/src/shared/tracking/tracking-sdk.ts +1 -0
- package/src/shared/weixin/jssdk.ts +0 -1
- package/src/user/api/index.ts +1 -1
- package/src/user/components/UserAuth.vue +1 -1
- package/src/user/components/UserFeedback.vue +0 -1
- package/src/user/components/UserInfo.vue +0 -2
- package/types/global.d.ts +0 -2
- package/src/shared/components/OcrBank.vue +0 -202
- package/src/shared/components/OcrInvoice.vue +0 -322
- package/src/shared/composables/useCompress.ts +0 -64
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxda/appkit",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.15",
|
|
4
4
|
"description": "小程序应用开发包",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.ts",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@tarojs/shared": "^4.1.7",
|
|
35
35
|
"@tarojs/taro": "^4.1.7",
|
|
36
36
|
"@types/wechat-miniprogram": "^3.4.7",
|
|
37
|
-
"@uxda/nutshell": "^1.
|
|
37
|
+
"@uxda/nutshell": "^1.0.0",
|
|
38
38
|
"dayjs": "^1.11.18",
|
|
39
39
|
"dsbridge": "^3.1.4",
|
|
40
40
|
"lodash-es": "^4.17.21",
|
|
@@ -75,5 +75,8 @@
|
|
|
75
75
|
"unplugin-auto-import": "^20.2.0",
|
|
76
76
|
"unplugin-vue-components": "^29.1.0",
|
|
77
77
|
"webpack": "^5.78.0"
|
|
78
|
+
},
|
|
79
|
+
"peerDependencies": {
|
|
80
|
+
"@uxda/nutshell": "^1.0.0"
|
|
78
81
|
}
|
|
79
82
|
}
|
package/src/balance/api/index.ts
CHANGED
|
@@ -65,7 +65,7 @@ function useHttp() {
|
|
|
65
65
|
const headers = {
|
|
66
66
|
Token: appkitOptions.tempToken() || appkitOptions.token(),
|
|
67
67
|
Appcode: appkitOptions.app(),
|
|
68
|
-
|
|
68
|
+
cookie: `tid=${appkitOptions.tenant()}`,
|
|
69
69
|
gray: appkitOptions.gray ? appkitOptions.gray() : '0',
|
|
70
70
|
}
|
|
71
71
|
/**
|
package/src/notice/api/index.ts
CHANGED
|
@@ -65,7 +65,7 @@ function useHttp() {
|
|
|
65
65
|
const headers = {
|
|
66
66
|
Token: appkitOptions.tempToken() || appkitOptions.token(),
|
|
67
67
|
Appcode: appkitOptions.app(),
|
|
68
|
-
|
|
68
|
+
cookie: `tid=${appkitOptions.tenant()}`,
|
|
69
69
|
gray: appkitOptions.gray ? appkitOptions.gray() : '0',
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
@@ -1,106 +1,41 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<ns-page class="news-list">
|
|
3
3
|
<div class="tabContainer" :class="{ inH5: isWeb() }">
|
|
4
|
-
<!-- <ns-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
<!-- <ns-search
|
|
5
|
+
v-track-search="{
|
|
6
|
+
trackInput: false,
|
|
7
|
+
trackSubmit: true,
|
|
8
|
+
minLength: 2,
|
|
9
|
+
}"
|
|
10
|
+
style="margin: 0 12px"
|
|
11
|
+
placeholder="请输入关键字搜索"
|
|
12
|
+
v-model="state.search"
|
|
13
|
+
></ns-search> -->
|
|
14
|
+
<ns-tabs v-model="state.tab" fill="#fff" square size="xl" style="height: 46px" @change="onTabChange">
|
|
12
15
|
<ns-tabs-item key="全部" tab="全部"></ns-tabs-item>
|
|
13
16
|
<ns-tabs-item key="业务消息" tab="业务消息"></ns-tabs-item>
|
|
14
17
|
<ns-tabs-item key="系统公告" tab="系统公告"></ns-tabs-item>
|
|
15
18
|
<ns-tabs-item key="未读" tab="未读"></ns-tabs-item>
|
|
16
|
-
</ns-tabs> -->
|
|
17
|
-
<ns-tabs
|
|
18
|
-
v-model="state.tab"
|
|
19
|
-
fill="#fff"
|
|
20
|
-
square
|
|
21
|
-
size="xl"
|
|
22
|
-
style="height: 46px"
|
|
23
|
-
class="news-tab"
|
|
24
|
-
:items="tabList"
|
|
25
|
-
>
|
|
26
|
-
<template #titles>
|
|
27
|
-
<div
|
|
28
|
-
v-for="item in tabList"
|
|
29
|
-
:class="{ customLine: state.tab === item.value }"
|
|
30
|
-
:key="item.value"
|
|
31
|
-
class="nut-tabs__titles-item custom-tab-item"
|
|
32
|
-
@click="
|
|
33
|
-
state.tab = item.value;
|
|
34
|
-
onTabChange();
|
|
35
|
-
"
|
|
36
|
-
>
|
|
37
|
-
<div
|
|
38
|
-
class="custom-title"
|
|
39
|
-
:class="{ active: state.tab === item.value }"
|
|
40
|
-
>
|
|
41
|
-
<div>{{ item.label }}</div>
|
|
42
|
-
<div
|
|
43
|
-
class="custom-title-dot"
|
|
44
|
-
v-if="item.value === '未读' && noticeShow"
|
|
45
|
-
>
|
|
46
|
-
•••
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
</div>
|
|
50
|
-
</template>
|
|
51
19
|
</ns-tabs>
|
|
52
|
-
|
|
53
20
|
<div v-if="state.list.length > 0" class="read-all">
|
|
54
|
-
<div v-track-click class="btn"
|
|
21
|
+
<div v-track-click class="btn" @click="readAll">全部已读</div>
|
|
55
22
|
</div>
|
|
56
23
|
</div>
|
|
57
|
-
<ns-page-content
|
|
58
|
-
|
|
59
|
-
scrollable
|
|
60
|
-
refreshable
|
|
61
|
-
:refresh-triggered="isRefresh"
|
|
62
|
-
@pull-down-refresh="onRefresh"
|
|
63
|
-
@bottom-reached="nextPage"
|
|
64
|
-
>
|
|
24
|
+
<ns-page-content class="mt-68px" scrollable refreshable :refresh-triggered="isRefresh"
|
|
25
|
+
@pull-down-refresh="onRefresh" @bottom-reached="nextPage">
|
|
65
26
|
<ns-skeleton :row="8" v-if="显示骨架屏" />
|
|
66
27
|
|
|
67
28
|
<template v-else>
|
|
68
|
-
<ns-repeator
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
:show-no-more="paging.isLastPage"
|
|
75
|
-
>
|
|
76
|
-
<ns-card
|
|
77
|
-
v-track-click="'消息详情'"
|
|
78
|
-
:r="5"
|
|
79
|
-
fill="#fff"
|
|
80
|
-
class="news-item w-full"
|
|
81
|
-
@click="itemClick(item)"
|
|
82
|
-
>
|
|
83
|
-
<div
|
|
84
|
-
v-if="item.标题"
|
|
85
|
-
:style="{ color: item.已读 ? '#35353599' : '#353535' }"
|
|
86
|
-
class="news-item-title"
|
|
87
|
-
>
|
|
88
|
-
<img
|
|
89
|
-
v-if="item.是公告"
|
|
90
|
-
class="news-item-title-icon"
|
|
91
|
-
src="https://cdn.ddjf.com/static/images/fnfundkit/ic_msg_system_notice.png"
|
|
92
|
-
/>
|
|
29
|
+
<ns-repeator v-slot="item" align="stretch" direction="column" :gap="10" :data="state.list"
|
|
30
|
+
:show-no-more="paging.isLastPage">
|
|
31
|
+
<ns-card v-track-click="'消息详情'" :r="5" fill="#fff" class="news-item w-full" @click="itemClick(item)">
|
|
32
|
+
<div v-if="item.标题" :style="{ color: item.已读 ? '#35353599' : '#353535' }" class="news-item-title">
|
|
33
|
+
<img v-if="item.是公告" class="news-item-title-icon"
|
|
34
|
+
src="https://cdn.ddjf.com/static/images/loan-manage-app/ic_msg_system_notice.webp" />
|
|
93
35
|
{{ item.标题 }}
|
|
94
36
|
</div>
|
|
95
|
-
<nut-ellipsis
|
|
96
|
-
|
|
97
|
-
class="news-item-content"
|
|
98
|
-
direction="end"
|
|
99
|
-
rows="3"
|
|
100
|
-
expand-text="展开"
|
|
101
|
-
collapse-text="收起"
|
|
102
|
-
:content="item.内容"
|
|
103
|
-
></nut-ellipsis>
|
|
37
|
+
<nut-ellipsis :style="{ color: item.已读 ? '#35353566' : '#353535CC' }" class="news-item-content"
|
|
38
|
+
direction="end" rows="3" expand-text="展开" collapse-text="收起" :content="item.内容"></nut-ellipsis>
|
|
104
39
|
<div class="news-item-time">{{ item.时间 }}</div>
|
|
105
40
|
</ns-card>
|
|
106
41
|
</ns-repeator>
|
|
@@ -112,12 +47,12 @@
|
|
|
112
47
|
</template>
|
|
113
48
|
|
|
114
49
|
<script setup lang="ts">
|
|
115
|
-
import { useDidShow } from '@tarojs/taro'
|
|
116
|
-
import { showLoading, hideLoading } from '@tarojs/taro'
|
|
117
|
-
import { type WithPaging, usePaging } from '@uxda/nutshell/taro'
|
|
118
|
-
import { useHttp, endpoints } from '../api'
|
|
119
|
-
import { reactive, ref } from 'vue'
|
|
120
|
-
import { useAppKitOptions } from '../../Appkit'
|
|
50
|
+
import { useDidShow } from '@tarojs/taro'
|
|
51
|
+
import { showLoading, hideLoading } from '@tarojs/taro'
|
|
52
|
+
import { type WithPaging, usePaging } from '@uxda/nutshell/taro'
|
|
53
|
+
import { useHttp, endpoints } from '../api'
|
|
54
|
+
import { reactive, ref } from 'vue'
|
|
55
|
+
import { useAppKitOptions } from '../../Appkit'
|
|
121
56
|
import {
|
|
122
57
|
NsTabs,
|
|
123
58
|
NsTabsItem,
|
|
@@ -127,7 +62,7 @@ import {
|
|
|
127
62
|
NsPageContent,
|
|
128
63
|
NsSkeleton,
|
|
129
64
|
NsEmpty,
|
|
130
|
-
} from
|
|
65
|
+
} from "@uxda/nutshell/taro";
|
|
131
66
|
import { isWeb } from '../../utils/utils';
|
|
132
67
|
|
|
133
68
|
const props = withDefaults(
|
|
@@ -137,56 +72,31 @@ const props = withDefaults(
|
|
|
137
72
|
app: string;
|
|
138
73
|
}>(),
|
|
139
74
|
{
|
|
140
|
-
deviceType:
|
|
141
|
-
userId:
|
|
142
|
-
app:
|
|
75
|
+
deviceType: "2",
|
|
76
|
+
userId: "",
|
|
77
|
+
app: "",
|
|
143
78
|
}
|
|
144
79
|
);
|
|
145
80
|
|
|
146
|
-
interface tabListType {
|
|
147
|
-
label: string;
|
|
148
|
-
value: string;
|
|
149
|
-
hasRead?: boolean;
|
|
150
|
-
}
|
|
151
|
-
const tabList = ref<tabListType[]>([
|
|
152
|
-
{
|
|
153
|
-
label: '全部',
|
|
154
|
-
value: '全部',
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
label: '业务消息',
|
|
158
|
-
value: '业务消息',
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
label: '系统公告',
|
|
162
|
-
value: '系统公告',
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
label: '未读',
|
|
166
|
-
value: '未读',
|
|
167
|
-
},
|
|
168
|
-
]);
|
|
169
|
-
|
|
170
81
|
const $http = useHttp(),
|
|
171
|
-
显示骨架屏 = ref(true)
|
|
82
|
+
显示骨架屏 = ref(true)
|
|
172
83
|
|
|
173
84
|
useDidShow(() => {
|
|
174
|
-
nextPage(1)
|
|
175
|
-
|
|
176
|
-
});
|
|
85
|
+
nextPage(1)
|
|
86
|
+
})
|
|
177
87
|
const state = reactive({
|
|
178
88
|
search: '',
|
|
179
89
|
tab: '全部',
|
|
180
90
|
list: [] as any[],
|
|
181
|
-
})
|
|
91
|
+
})
|
|
182
92
|
|
|
183
93
|
async function load(page: number) {
|
|
184
94
|
if (!props.app?.replace(',cloudkitPro', '')) {
|
|
185
|
-
state.list = []
|
|
186
|
-
return { paging: { page: 1, pageSize: 10, total: 0 }, data: [] }
|
|
95
|
+
state.list = []
|
|
96
|
+
return { paging: { page: 1, pageSize: 10, total: 0 }, data: [] }
|
|
187
97
|
}
|
|
188
98
|
|
|
189
|
-
const appkitOptions = useAppKitOptions()
|
|
99
|
+
const appkitOptions = useAppKitOptions()
|
|
190
100
|
const data = {
|
|
191
101
|
page,
|
|
192
102
|
pageSize: 10,
|
|
@@ -195,109 +105,85 @@ async function load(page: number) {
|
|
|
195
105
|
userId: props.userId,
|
|
196
106
|
deviceType: props.deviceType,
|
|
197
107
|
readOrderStatus: '1',
|
|
198
|
-
}
|
|
108
|
+
}
|
|
199
109
|
|
|
200
110
|
if (state.tab == '业务消息') {
|
|
201
|
-
data['msgType'] = '1'
|
|
111
|
+
data['msgType'] = '1'
|
|
202
112
|
} else if (state.tab == '系统公告') {
|
|
203
|
-
data['msgType'] = '3'
|
|
113
|
+
data['msgType'] = '3'
|
|
204
114
|
}
|
|
205
115
|
|
|
206
116
|
if (state.tab == '未读') {
|
|
207
|
-
data['isRead'] = '0'
|
|
117
|
+
data['isRead'] = '0'
|
|
208
118
|
}
|
|
209
119
|
|
|
210
|
-
const ep = endpoints['消息列表']
|
|
120
|
+
const ep = endpoints['消息列表']
|
|
211
121
|
return $http.post<WithPaging<any[]>>(ep, data).then((res) => {
|
|
212
|
-
显示骨架屏.value = false
|
|
122
|
+
显示骨架屏.value = false
|
|
213
123
|
if (page === 1) {
|
|
214
|
-
state.list = []
|
|
124
|
+
state.list = []
|
|
215
125
|
}
|
|
216
|
-
state.list = [...state.list, ...res.data]
|
|
217
|
-
return { paging: res.paging, data: res.data }
|
|
218
|
-
})
|
|
126
|
+
state.list = [...state.list, ...res.data]
|
|
127
|
+
return { paging: res.paging, data: res.data }
|
|
128
|
+
})
|
|
219
129
|
}
|
|
220
130
|
|
|
221
|
-
const { paging, nextPage } = usePaging(load)
|
|
131
|
+
const { paging, nextPage } = usePaging(load)
|
|
222
132
|
|
|
223
133
|
function onTabChange() {
|
|
224
|
-
显示骨架屏.value = true
|
|
225
|
-
nextPage(1)
|
|
134
|
+
显示骨架屏.value = true
|
|
135
|
+
nextPage(1)
|
|
226
136
|
}
|
|
227
137
|
|
|
228
|
-
const isRefresh = ref(false)
|
|
138
|
+
const isRefresh = ref(false)
|
|
229
139
|
async function onRefresh() {
|
|
230
|
-
isRefresh.value = true
|
|
231
|
-
await nextPage(1)
|
|
232
|
-
isRefresh.value = false
|
|
140
|
+
isRefresh.value = true
|
|
141
|
+
await nextPage(1)
|
|
142
|
+
isRefresh.value = false
|
|
233
143
|
}
|
|
234
144
|
|
|
235
145
|
function itemClick(item: any) {
|
|
236
|
-
read(item)
|
|
237
|
-
|
|
238
|
-
emits('itemClick', item)
|
|
146
|
+
read(item)
|
|
147
|
+
|
|
148
|
+
emits('itemClick', item)
|
|
239
149
|
}
|
|
240
150
|
|
|
241
151
|
function read(item: any) {
|
|
242
|
-
if (item.isRead == '1') return
|
|
243
|
-
const ep = endpoints['已读']
|
|
152
|
+
if (item.isRead == '1') return
|
|
153
|
+
const ep = endpoints['已读']
|
|
244
154
|
$http.post(ep, [item.id]).then(() => {
|
|
245
|
-
item['已读'] = true
|
|
246
|
-
})
|
|
155
|
+
item['已读'] = true
|
|
156
|
+
})
|
|
247
157
|
}
|
|
248
158
|
|
|
249
159
|
async function readAll() {
|
|
250
160
|
try {
|
|
251
161
|
showLoading({
|
|
252
162
|
title: '请稍后...',
|
|
253
|
-
|
|
254
|
-
});
|
|
163
|
+
})
|
|
255
164
|
|
|
256
|
-
const appkitOptions = useAppKitOptions()
|
|
257
|
-
const ep = endpoints['全部已读']
|
|
165
|
+
const appkitOptions = useAppKitOptions()
|
|
166
|
+
const ep = endpoints['全部已读']
|
|
258
167
|
const data = {
|
|
259
168
|
tenantId: appkitOptions.tenant(),
|
|
260
169
|
userId: props.userId,
|
|
261
170
|
deviceType: props.deviceType,
|
|
262
|
-
}
|
|
171
|
+
}
|
|
263
172
|
$http.post(ep, data).then(() => {
|
|
264
173
|
state.list.forEach((item) => {
|
|
265
|
-
item['已读'] = true
|
|
266
|
-
})
|
|
267
|
-
})
|
|
174
|
+
item['已读'] = true
|
|
175
|
+
})
|
|
176
|
+
})
|
|
268
177
|
} finally {
|
|
269
|
-
|
|
270
|
-
getNotice();
|
|
271
|
-
}, 300);
|
|
272
|
-
hideLoading();
|
|
178
|
+
hideLoading()
|
|
273
179
|
}
|
|
274
180
|
}
|
|
275
181
|
|
|
276
|
-
|
|
277
|
-
const noticeShow = ref(false);
|
|
278
|
-
async function getNotice() {
|
|
279
|
-
const appkitOptions = useAppKitOptions();
|
|
280
|
-
const $http = useHttp();
|
|
281
|
-
|
|
282
|
-
$http
|
|
283
|
-
.get('/cas/msg/count-unread', {
|
|
284
|
-
deviceType: 2,
|
|
285
|
-
appCode: props.app,
|
|
286
|
-
tenantId: appkitOptions.tenant(),
|
|
287
|
-
userId: props.userId,
|
|
288
|
-
})
|
|
289
|
-
.then((result: any) => {
|
|
290
|
-
if (typeof result === 'object') return;
|
|
291
|
-
|
|
292
|
-
noticeShow.value = result > 0;
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
const emits = defineEmits(['itemClick']);
|
|
182
|
+
const emits = defineEmits(['itemClick'])
|
|
297
183
|
|
|
298
184
|
defineExpose({
|
|
299
185
|
readAll,
|
|
300
|
-
})
|
|
186
|
+
})
|
|
301
187
|
</script>
|
|
302
188
|
|
|
303
189
|
<style lang="scss">
|
|
@@ -351,51 +237,4 @@ defineExpose({
|
|
|
351
237
|
}
|
|
352
238
|
}
|
|
353
239
|
}
|
|
354
|
-
.news-tab {
|
|
355
|
-
.nut-tabs__list {
|
|
356
|
-
display: flex;
|
|
357
|
-
}
|
|
358
|
-
.custom-tab-item {
|
|
359
|
-
flex: 1;
|
|
360
|
-
display: flex;
|
|
361
|
-
flex-direction: column;
|
|
362
|
-
justify-content: center;
|
|
363
|
-
align-items: center;
|
|
364
|
-
padding: 10px;
|
|
365
|
-
}
|
|
366
|
-
.customLine {
|
|
367
|
-
position: relative;
|
|
368
|
-
}
|
|
369
|
-
.customLine::after {
|
|
370
|
-
content: '';
|
|
371
|
-
position: absolute;
|
|
372
|
-
width: 50px;
|
|
373
|
-
height: 2px;
|
|
374
|
-
background: #017fff;
|
|
375
|
-
bottom: 0;
|
|
376
|
-
left: 50%;
|
|
377
|
-
transform: translateX(-50%);
|
|
378
|
-
}
|
|
379
|
-
.custom-title {
|
|
380
|
-
color: #8a8a8a;
|
|
381
|
-
font-size: 15px;
|
|
382
|
-
display: flex;
|
|
383
|
-
align-items: center;
|
|
384
|
-
&-dot {
|
|
385
|
-
height: 12px;
|
|
386
|
-
line-height: 12px;
|
|
387
|
-
padding: 0 6px;
|
|
388
|
-
color: #fff;
|
|
389
|
-
border-radius: 8px;
|
|
390
|
-
background: #e04747;
|
|
391
|
-
margin-left: 2px;
|
|
392
|
-
font-size: 9px;
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
.custom-title.active {
|
|
396
|
-
color: #017fff;
|
|
397
|
-
font-weight: 600;
|
|
398
|
-
font-size: 17px;
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
240
|
</style>
|
|
@@ -13,6 +13,7 @@ const endpointsList: HttpEndpoints = {
|
|
|
13
13
|
appCode: data.app,
|
|
14
14
|
// caseCode: 'recharge', // 这个参数可以不要
|
|
15
15
|
tenantId: data.tenant,
|
|
16
|
+
scene: data.scene,
|
|
16
17
|
}),
|
|
17
18
|
transform: (data: any) =>
|
|
18
19
|
data.amountList.map((d: any) => ({
|
|
@@ -44,6 +45,9 @@ const endpointsList: HttpEndpoints = {
|
|
|
44
45
|
} catch (e) {}
|
|
45
46
|
return {
|
|
46
47
|
json, // 拉起微信支付用的JSON串
|
|
48
|
+
paymentType: data.paymentType,
|
|
49
|
+
prePayStr: data.prePayStr,
|
|
50
|
+
thirdPayId: data.thirdPayId,
|
|
47
51
|
paymentId: data.payId, // 查询用支付ID
|
|
48
52
|
}
|
|
49
53
|
},
|
|
@@ -59,16 +63,17 @@ const endpointsList: HttpEndpoints = {
|
|
|
59
63
|
accountAuthFlag: params.accountAuthFlag || false,
|
|
60
64
|
channelCode: params.channelCode || null,
|
|
61
65
|
payFinishJumpUrl: params.payFinishJumpUrl || null,
|
|
62
|
-
useCloudBean: params.useCloudBean || false,
|
|
63
66
|
}),
|
|
64
67
|
transform: (data: any) => {
|
|
65
|
-
console.log(data, 'data-----')
|
|
66
68
|
let json = null
|
|
67
69
|
try {
|
|
68
70
|
json = JSON.parse(data.prePayStr)
|
|
69
71
|
} catch (e) {}
|
|
70
72
|
return {
|
|
71
73
|
json, // 拉起微信支付用的JSON串
|
|
74
|
+
paymentType: data.paymentType,
|
|
75
|
+
prePayStr: data.prePayStr,
|
|
76
|
+
thirdPayId: data.thirdPayId,
|
|
72
77
|
paymentId: data.payId, // 查询用支付ID
|
|
73
78
|
}
|
|
74
79
|
},
|
|
@@ -77,6 +82,13 @@ const endpointsList: HttpEndpoints = {
|
|
|
77
82
|
path: '/payment/paymentCaseConfig/getBalanceAndRiskQueryPriceConfig',
|
|
78
83
|
transform: (data: any) => data,
|
|
79
84
|
},
|
|
85
|
+
获取支付结果: {
|
|
86
|
+
path: '/payment/outer/payment/getPayResult',
|
|
87
|
+
translate: (data: any) => ({
|
|
88
|
+
thirdPayId: data.thirdPayId,
|
|
89
|
+
}),
|
|
90
|
+
transform: (data: any) => data,
|
|
91
|
+
},
|
|
80
92
|
} as const
|
|
81
93
|
|
|
82
94
|
const keys = Object.keys(endpointsList as any)
|
package/src/payment/api/index.ts
CHANGED
|
@@ -51,7 +51,6 @@ const vendor = {
|
|
|
51
51
|
title: data.msg,
|
|
52
52
|
icon: 'none',
|
|
53
53
|
})
|
|
54
|
-
reject(data.msg)
|
|
55
54
|
}
|
|
56
55
|
})
|
|
57
56
|
.catch((e: any) => {
|
|
@@ -71,7 +70,7 @@ function useHttp(defaultHeader?: DefaultHeaderType) {
|
|
|
71
70
|
const headers = {
|
|
72
71
|
Token: appkitOptions.tempToken() || appkitOptions.token(),
|
|
73
72
|
Appcode: defaultHeader?.Appcode || appkitOptions.app(),
|
|
74
|
-
|
|
73
|
+
cookie: `tid=${defaultHeader?.Tenant || appkitOptions.tenant()}`,
|
|
75
74
|
gray: appkitOptions.gray ? appkitOptions.gray() : '0',
|
|
76
75
|
}
|
|
77
76
|
|
|
@@ -22,7 +22,7 @@ import AmountPicker from './AmountPicker.vue'
|
|
|
22
22
|
import { useHttp, endpoints } from '../api'
|
|
23
23
|
import { requestBrandWCPay, requestPayment } from '../services'
|
|
24
24
|
import Taro, { showToast, useRouter } from '@tarojs/taro'
|
|
25
|
-
import { isWechat } from '../../shared/composables/useDeviceEnv'
|
|
25
|
+
import { isAlipay, isAndroid, isChrome, isIOS, isSafari, isWechat } from '../../shared/composables/useDeviceEnv'
|
|
26
26
|
|
|
27
27
|
// 充值用户界面
|
|
28
28
|
// 配置了必须的属性后
|
|
@@ -61,6 +61,7 @@ const state = reactive({
|
|
|
61
61
|
selected: 0,
|
|
62
62
|
agreementOpen: false,
|
|
63
63
|
buttonLoading: false,
|
|
64
|
+
thirdPayId: '',
|
|
64
65
|
})
|
|
65
66
|
|
|
66
67
|
const amounts = ref<any[]>([])
|
|
@@ -81,7 +82,8 @@ onMounted(async () => {
|
|
|
81
82
|
|
|
82
83
|
$http.get<any[]>(endpoints.获取充值金额列表, {
|
|
83
84
|
app: props.app,
|
|
84
|
-
tenant: props.tenant
|
|
85
|
+
tenant: props.tenant,
|
|
86
|
+
scene: isWechat() ? '' : 'APP'
|
|
85
87
|
}).then(response => {
|
|
86
88
|
amounts.value = response
|
|
87
89
|
emit('loaded')
|
|
@@ -99,28 +101,30 @@ const onPayClick = () => {
|
|
|
99
101
|
state.buttonLoading = true
|
|
100
102
|
|
|
101
103
|
if (Taro.getEnv() === 'WEB') {
|
|
102
|
-
if (!isWechat()) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
104
|
+
// if (!isWechat()) {
|
|
105
|
+
// showToast({
|
|
106
|
+
// title: '请使用微信浏览器打开',
|
|
107
|
+
// icon: 'none',
|
|
108
|
+
// })
|
|
109
|
+
// state.buttonLoading = false
|
|
110
|
+
// return false
|
|
111
|
+
// }
|
|
110
112
|
requestBrandWCPay({
|
|
111
113
|
amount: amounts.value[state.selected].amount,
|
|
112
114
|
app: 'loankitMp',
|
|
113
115
|
tenant: props.tenant,
|
|
114
116
|
accountAuthFlag: false,
|
|
115
|
-
channelCode:
|
|
117
|
+
channelCode: getChannelCode(),
|
|
116
118
|
payFinishJumpUrl: props.payFinishJumpUrl,
|
|
117
119
|
fromMini: !!params.from,
|
|
118
120
|
clientInfo: 'H5'
|
|
119
|
-
}).then(result => {
|
|
120
|
-
console.log(result, '------requestBrandWCPay')
|
|
121
|
+
}).then((result: any) => {
|
|
121
122
|
state.buttonLoading = false
|
|
122
123
|
if (typeof result === 'boolean' && result) {
|
|
123
124
|
window.location.href = props.payFinishJumpUrl as string
|
|
125
|
+
} else if (typeof result === 'object' && result?.paymentType === 'H5' && result?.prePayStr) {
|
|
126
|
+
state.thirdPayId = result?.thirdPayId || ''
|
|
127
|
+
window.location.href = result?.prePayStr;
|
|
124
128
|
} else {
|
|
125
129
|
emit('complete', result)
|
|
126
130
|
}
|
|
@@ -143,6 +147,34 @@ const onPayClick = () => {
|
|
|
143
147
|
})
|
|
144
148
|
}
|
|
145
149
|
}
|
|
150
|
+
|
|
151
|
+
// 根据环境判断渠道编码
|
|
152
|
+
function getChannelCode() {
|
|
153
|
+
if (isWechat()) {
|
|
154
|
+
return 'centergzh';
|
|
155
|
+
} else if (isAlipay() || isAndroid() || (isIOS() && !isChrome() && !isSafari())) {
|
|
156
|
+
return 'YundouZfb';
|
|
157
|
+
} else {
|
|
158
|
+
return 'distributor';
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const payResultCheck = () => {
|
|
163
|
+
if (!state.thirdPayId) return
|
|
164
|
+
|
|
165
|
+
const $http = useHttp()
|
|
166
|
+
$http.get<any>(endpoints.获取支付结果, {
|
|
167
|
+
thirdPayId: state.thirdPayId
|
|
168
|
+
}).then(response => {
|
|
169
|
+
if (response.payStatus === 'paid') {
|
|
170
|
+
emit('complete', true)
|
|
171
|
+
}
|
|
172
|
+
})
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
defineExpose({
|
|
176
|
+
payResultCheck
|
|
177
|
+
})
|
|
146
178
|
</script>
|
|
147
179
|
|
|
148
180
|
<style lang="scss">
|