@uxda/appkit 4.2.82 → 4.2.84
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/.eslintrc.mjs +7 -7
- package/README.md +187 -187
- package/babel.config.js +12 -12
- package/dist/appkit.css +41 -3
- package/dist/index.js +994 -535
- package/package.json +81 -81
- package/project.config.json +15 -15
- package/project.tt.json +13 -13
- package/rollup.config.mjs +77 -77
- package/src/Appkit.ts +67 -67
- package/src/balance/api/endpoints.ts +133 -133
- package/src/balance/api/index.ts +112 -106
- package/src/balance/components/AccountView.vue +773 -773
- package/src/balance/components/BalanceCard.vue +210 -210
- package/src/balance/components/BalanceReminder.vue +84 -84
- package/src/balance/components/ConsumptionFilter.vue +218 -218
- package/src/balance/components/ConsumptionRules.vue +68 -68
- package/src/balance/components/DateFilter.vue +259 -259
- package/src/balance/components/DateRange.vue +111 -111
- package/src/balance/components/ListFilter.vue +62 -62
- package/src/balance/components/ListFilterPicker.vue +191 -191
- package/src/balance/components/PromoterCard.vue +310 -310
- package/src/balance/components/SecondBalance.vue +77 -77
- package/src/balance/components/Tip.vue +45 -45
- package/src/balance/components/index.ts +8 -8
- package/src/balance/types.ts +99 -99
- package/src/components/bt-cropper/index.vue +730 -730
- package/src/components/bt-cropper/utils/calcCropper.js +42 -42
- package/src/components/bt-cropper/utils/calcImagePosition.js +23 -23
- package/src/components/bt-cropper/utils/calcImageSize.js +37 -37
- package/src/components/bt-cropper/utils/calcPointDistance.js +12 -12
- package/src/components/bt-cropper/utils/calcRightAndBottom.js +7 -7
- package/src/components/bt-cropper/utils/ratio.js +3 -3
- package/src/components/bt-cropper/utils/tools.js +25 -25
- package/src/components/dd-area/index.vue +225 -225
- package/src/components/dd-icon/doc.md +21 -21
- package/src/components/dd-icon/index.vue +23 -23
- package/src/components/dd-notice-bar/index.vue +78 -78
- package/src/components/dd-search/doc.md +34 -34
- package/src/components/dd-search/index.vue +168 -168
- package/src/components/dd-selector/index.vue +124 -124
- package/src/components/dd-skeleton/doc.md +19 -19
- package/src/components/dd-skeleton/index.vue +36 -36
- package/src/global.ts +6 -6
- package/src/index.ts +93 -93
- package/src/main.scss +1 -1
- package/src/notice/api/endpoints.ts +54 -17
- package/src/notice/api/index.ts +115 -106
- package/src/notice/components/NoticeBanner.vue +247 -247
- package/src/notice/components/NoticeEntry.vue +99 -99
- package/src/notice/components/NoticeList.vue +311 -311
- package/src/notice/components/NoticeList2.vue +243 -0
- package/src/notice/components/NoticePopup.vue +163 -163
- package/src/notice/components/index.ts +6 -5
- package/src/notice/components/useCommonList.ts +86 -86
- package/src/notice/components/useNotice.ts +35 -35
- package/src/notice/index.ts +1 -1
- package/src/notice/types.ts +25 -25
- package/src/payment/api/config.ts +7 -7
- package/src/payment/api/endpoints.ts +95 -95
- package/src/payment/api/index.ts +101 -101
- package/src/payment/components/AmountPicker.vue +90 -90
- package/src/payment/components/RechargeResult.vue +69 -69
- package/src/payment/components/RechargeView.vue +190 -190
- package/src/payment/components/RightsPicker.vue +105 -105
- package/src/payment/components/TradeView.vue +363 -363
- package/src/payment/components/UserAgreement.vue +234 -234
- package/src/payment/components/index.ts +22 -22
- package/src/payment/index.ts +5 -5
- package/src/payment/services/index.ts +16 -16
- package/src/payment/services/invoke-recharge.ts +25 -25
- package/src/payment/services/request-payment.ts +130 -130
- package/src/payment/types.ts +32 -32
- package/src/register/components/SelfRegistration.vue +233 -233
- package/src/register/components/index.ts +2 -2
- package/src/scenarios/components/SharePoster.vue +364 -364
- package/src/scenarios/components/index.ts +2 -2
- package/src/scenarios/components/poster-paste.vue +93 -93
- package/src/scenarios/components/share-poster.md +273 -273
- package/src/shared/components/AppDrawer.vue +53 -53
- package/src/shared/components/AppVerify.vue +128 -128
- package/src/shared/components/DeviceVersion.vue +78 -78
- package/src/shared/components/EmptyView.vue +33 -33
- package/src/shared/components/OcrBusinessLicense.vue +137 -137
- package/src/shared/components/OcrIcon.vue +229 -229
- package/src/shared/components/PageHeader.vue +84 -84
- package/src/shared/components/index.ts +8 -8
- package/src/shared/composables/index.ts +9 -9
- package/src/shared/composables/useAmount.ts +46 -46
- package/src/shared/composables/useCountdown.ts +46 -46
- package/src/shared/composables/useCrypto.ts +76 -76
- package/src/shared/composables/useDeviceEnv.ts +11 -11
- package/src/shared/composables/useDragBox.ts +97 -97
- package/src/shared/composables/useEncode.ts +43 -43
- package/src/shared/composables/useLogger.ts +131 -131
- package/src/shared/composables/useSafeArea.ts +46 -46
- package/src/shared/composables/useTabbar.ts +24 -24
- package/src/shared/composables/useUpload.ts +61 -61
- package/src/shared/composables/useValidator.ts +32 -32
- package/src/shared/composables/useWxAuth.ts +48 -48
- package/src/shared/http/Http.ts +148 -146
- package/src/shared/http/index.ts +1 -1
- package/src/shared/http/types.ts +163 -160
- package/src/shared/index.ts +8 -8
- package/src/shared/weixin/index.ts +9 -9
- package/src/shared/weixin/jssdk.ts +103 -103
- package/src/shared/weixin/payment.ts +38 -38
- package/src/styles/vars.scss +3 -3
- package/src/user/api/endpoints.ts +17 -17
- package/src/user/api/index.ts +117 -111
- package/src/user/components/LoginSetting.vue +114 -114
- package/src/user/components/UserAuth.vue +220 -220
- package/src/user/components/UserBinding.vue +277 -277
- package/src/user/components/UserBindingSuccess.vue +80 -80
- package/src/user/components/UserEntry.vue +139 -139
- package/src/user/components/UserFeedback.vue +427 -427
- package/src/user/components/UserFeedbackEntry.vue +175 -175
- package/src/user/components/UserHeadCrop.vue +65 -65
- package/src/user/components/UserInfo.vue +708 -708
- package/src/user/components/UserResourceEmpty.vue +75 -75
- package/src/user/components/index.ts +23 -23
- package/src/user/index.ts +1 -1
- package/src/utils/utils.ts +28 -28
- package/tsconfig.json +30 -30
- package/types/global.d.ts +22 -22
- package/types/vue.d.ts +10 -10
- /package/dist/assets/{asset-DcH8Kg-2 → asset-3B_CoPto} +0 -0
|
@@ -1,363 +1,363 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="view recharge-view2">
|
|
3
|
-
<view class="flex-grow">
|
|
4
|
-
<rights-picker :items="amounts" :selected="state.selected" @change="onAmountSelect" />
|
|
5
|
-
<div class="bean-buy" v-if="amounts[state.selected]">
|
|
6
|
-
<div class="left">
|
|
7
|
-
<div class="title">使用云豆支付</div>
|
|
8
|
-
<div class="amount" v-if="!selectBean">余额 {{ formatAmount(balance || 0) }}</div>
|
|
9
|
-
<div class="amount" v-else>扣减后余额 {{ formatAmount(balance - amounts[state.selected].paymentAmount) }}</div>
|
|
10
|
-
</div>
|
|
11
|
-
<div class="right" v-if="balance >= amounts[state.selected].paymentAmount" @click="selectBean = !selectBean">
|
|
12
|
-
<div class="amount">-{{ formatAmount(amounts[state.selected].paymentAmount || 0) }}</div>
|
|
13
|
-
<img class="icon"
|
|
14
|
-
:src="selectBean ? 'https://cdn.ddjf.com/static/images/appkit/select.svg' : 'https://cdn.ddjf.com/static/images/appkit/not-select.svg'" />
|
|
15
|
-
</div>
|
|
16
|
-
</div>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<slot name="banner"></slot>
|
|
20
|
-
</view>
|
|
21
|
-
|
|
22
|
-
<view class="amount-footer">
|
|
23
|
-
<view class="agreement" v-if="!selectBean">
|
|
24
|
-
<nut-checkbox v-model="state.agreed">我已阅读并同意<a class="link inline"
|
|
25
|
-
@click="onAgreementLinkClick">《大道云平台云豆充值服务协议》</a></nut-checkbox>
|
|
26
|
-
</view>
|
|
27
|
-
<div class="buy-amount">
|
|
28
|
-
<div class="left">
|
|
29
|
-
待支付:
|
|
30
|
-
<span class="amount">
|
|
31
|
-
<i>¥</i>{{ formatAmount(currentAmount) }}
|
|
32
|
-
</span>
|
|
33
|
-
</div>
|
|
34
|
-
<nut-button block shape="square" :loading="state.buttonLoading" @click="onPayClick"
|
|
35
|
-
class="recharge-button">购买</nut-button>
|
|
36
|
-
</div>
|
|
37
|
-
</view>
|
|
38
|
-
<nut-dialog title="确认购买" custom-class="trade-dialog" v-model:visible="showDialog" @cancel="showDialog = !showDialog"
|
|
39
|
-
@ok="beanPay">
|
|
40
|
-
<template v-if="amounts[state.selected]">
|
|
41
|
-
<div class="item">云豆扣减:{{ formatAmount(amounts[state.selected].paymentAmount || 0) }}</div>
|
|
42
|
-
<div class="item">权益增加:{{ formatAmount(amounts[state.selected].priceRightNum || 0) }}笔</div>
|
|
43
|
-
<div class="item">扣减后云豆余额:{{ formatAmount(balance - amounts[state.selected].paymentAmount) }}</div>
|
|
44
|
-
</template>
|
|
45
|
-
</nut-dialog>
|
|
46
|
-
</view>
|
|
47
|
-
</template>
|
|
48
|
-
|
|
49
|
-
<script lang="ts" setup>
|
|
50
|
-
import { computed, onMounted, reactive, ref } from 'vue'
|
|
51
|
-
import RightsPicker, { Amount } from './RightsPicker.vue'
|
|
52
|
-
import { endpoints, useHttp } from '../api'
|
|
53
|
-
import { requestBrandWCPayByBean, requestPaymentByBean } from '../services'
|
|
54
|
-
import Taro, { showToast, useRouter } from '@tarojs/taro'
|
|
55
|
-
import { useAmount } from '../../shared/composables/useAmount'
|
|
56
|
-
import { isWechat } from '../../shared/composables/useDeviceEnv'
|
|
57
|
-
|
|
58
|
-
// 充值用户界面
|
|
59
|
-
// 配置了必须的属性后
|
|
60
|
-
// 自动获取支付套餐包列表
|
|
61
|
-
// 并发起微信支付
|
|
62
|
-
export interface RechargeViewProps {
|
|
63
|
-
/**
|
|
64
|
-
* header头中的appcode,一般情况下与app参数一致,当无应用权限时,此参数未空
|
|
65
|
-
**/
|
|
66
|
-
headerApp: string,
|
|
67
|
-
/**
|
|
68
|
-
* 应用
|
|
69
|
-
**/
|
|
70
|
-
app: string,
|
|
71
|
-
/**
|
|
72
|
-
* 充值场景
|
|
73
|
-
*/
|
|
74
|
-
// stage?: string, // 这个参数暂时不用
|
|
75
|
-
/**
|
|
76
|
-
* 租户
|
|
77
|
-
*/
|
|
78
|
-
tenant: string,
|
|
79
|
-
/**
|
|
80
|
-
* h5支付完成后跳转地址
|
|
81
|
-
*/
|
|
82
|
-
payFinishJumpUrl?: ''
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const props = defineProps<RechargeViewProps>()
|
|
86
|
-
const { formatAmount } = useAmount()
|
|
87
|
-
const { params } = useRouter()
|
|
88
|
-
|
|
89
|
-
const emit = defineEmits<{
|
|
90
|
-
(event: 'complete', value: { result: boolean, type: string }): void,
|
|
91
|
-
(event: 'agree'): void,
|
|
92
|
-
}>()
|
|
93
|
-
|
|
94
|
-
const state = reactive({
|
|
95
|
-
agreed: false,
|
|
96
|
-
selected: 0,
|
|
97
|
-
// agreementOpen: false,
|
|
98
|
-
buttonLoading: false,
|
|
99
|
-
})
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
const balance = ref<number>(0)
|
|
103
|
-
const amounts = ref<Amount[]>([])
|
|
104
|
-
const selectBean = ref<boolean>(false)
|
|
105
|
-
|
|
106
|
-
const onAgreementLinkClick = (e) => {
|
|
107
|
-
e.preventDefault()
|
|
108
|
-
e.stopImmediatePropagation()
|
|
109
|
-
emit('agree')
|
|
110
|
-
// state.agreementOpen = true
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const onAmountSelect = (selected: number) => {
|
|
114
|
-
state.selected = selected
|
|
115
|
-
selectBean.value = false
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const currentAmount = computed(() => {
|
|
119
|
-
return amounts.value[state.selected] && !selectBean.value ? amounts.value[state.selected].paymentAmount : 0
|
|
120
|
-
})
|
|
121
|
-
|
|
122
|
-
onMounted(() => {
|
|
123
|
-
const $http = useHttp({ Appcode: props.headerApp, Tenant: props.tenant })
|
|
124
|
-
$http.get<any[]>(endpoints.获取增值权益类目, {
|
|
125
|
-
rightCode: props.app === 'corporateStar' ? 'riskQueryCompany' : 'riskQueryMulti',
|
|
126
|
-
}).then((res: any) => {
|
|
127
|
-
balance.value = res.balance
|
|
128
|
-
amounts.value = res.paymentCaseConfigVOS
|
|
129
|
-
})
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
// 云豆支付
|
|
133
|
-
const showDialog = ref<boolean>(false)
|
|
134
|
-
async function beanPay() {
|
|
135
|
-
const $http = useHttp({ Appcode: props.headerApp, Tenant: props.tenant })
|
|
136
|
-
$http.post(`/payment/paymentCaseConfig/purchase/${amounts.value[state.selected].id}`).then((response: any) => {
|
|
137
|
-
if (response) {
|
|
138
|
-
showDialog.value = false
|
|
139
|
-
emit('complete', { result: response, type: 'bean' })
|
|
140
|
-
} else {
|
|
141
|
-
showToast({
|
|
142
|
-
title: response.message,
|
|
143
|
-
icon: 'none',
|
|
144
|
-
})
|
|
145
|
-
}
|
|
146
|
-
})
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
const onPayClick = () => {
|
|
151
|
-
// 用云豆支付
|
|
152
|
-
if (selectBean.value) {
|
|
153
|
-
showDialog.value = true
|
|
154
|
-
return
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// 微信支付
|
|
158
|
-
if (!selectBean.value && !state.agreed) {
|
|
159
|
-
showToast({
|
|
160
|
-
title: '请勾选《大道云平台云豆充值协议》',
|
|
161
|
-
icon: 'none',
|
|
162
|
-
})
|
|
163
|
-
return false
|
|
164
|
-
}
|
|
165
|
-
state.buttonLoading = true
|
|
166
|
-
|
|
167
|
-
if (Taro.getEnv() === 'WEB') {
|
|
168
|
-
if (!isWechat()) {
|
|
169
|
-
showToast({
|
|
170
|
-
title: '请使用微信浏览器打开',
|
|
171
|
-
icon: 'none',
|
|
172
|
-
})
|
|
173
|
-
state.buttonLoading = false
|
|
174
|
-
return false
|
|
175
|
-
}
|
|
176
|
-
requestBrandWCPayByBean({
|
|
177
|
-
caseConfigId: amounts.value[state.selected].id,
|
|
178
|
-
amount: amounts.value[state.selected].paymentAmount,
|
|
179
|
-
app: 'cloudkitProMp',
|
|
180
|
-
tenant: props.tenant,
|
|
181
|
-
accountAuthFlag: false,
|
|
182
|
-
channelCode: 'centergzh',
|
|
183
|
-
payFinishJumpUrl: props.payFinishJumpUrl,
|
|
184
|
-
fromMini: !!params.from
|
|
185
|
-
}).then(result => {
|
|
186
|
-
console.log(result, '------requestBrandWCPay')
|
|
187
|
-
state.buttonLoading = false
|
|
188
|
-
if (typeof result === 'boolean' && result) {
|
|
189
|
-
window.location.href = props.payFinishJumpUrl as string
|
|
190
|
-
} else {
|
|
191
|
-
emit('complete', { result, type: 'wePay' })
|
|
192
|
-
}
|
|
193
|
-
})
|
|
194
|
-
} else {
|
|
195
|
-
wx.login({
|
|
196
|
-
success({ code }: { code: string }) {
|
|
197
|
-
requestPaymentByBean({
|
|
198
|
-
caseConfigId: amounts.value[state.selected].id,
|
|
199
|
-
amount: amounts.value[state.selected].paymentAmount,
|
|
200
|
-
app: props.app,
|
|
201
|
-
tenant: props.tenant,
|
|
202
|
-
user: code,
|
|
203
|
-
}, props.headerApp).then(result => {
|
|
204
|
-
state.buttonLoading = false
|
|
205
|
-
if (result) {
|
|
206
|
-
emit('complete', { result: true, type: 'wePay' })
|
|
207
|
-
}
|
|
208
|
-
})
|
|
209
|
-
}
|
|
210
|
-
})
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
</script>
|
|
214
|
-
|
|
215
|
-
<style lang="scss">
|
|
216
|
-
.recharge-view2 {
|
|
217
|
-
height: 100%;
|
|
218
|
-
display: flex;
|
|
219
|
-
flex-direction: column;
|
|
220
|
-
--nut-primary-color: #017fff;
|
|
221
|
-
|
|
222
|
-
.flex-grow {
|
|
223
|
-
flex-grow: 1;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
.bean-buy {
|
|
227
|
-
margin: 0 15px;
|
|
228
|
-
padding: 10px;
|
|
229
|
-
background: #FFFBF3;
|
|
230
|
-
border-radius: 5px;
|
|
231
|
-
display: flex;
|
|
232
|
-
justify-content: space-between;
|
|
233
|
-
align-items: center;
|
|
234
|
-
|
|
235
|
-
.left {
|
|
236
|
-
.title {
|
|
237
|
-
color: #FD6701;
|
|
238
|
-
font-size: 14px;
|
|
239
|
-
font-weight: 600;
|
|
240
|
-
line-height: 20px;
|
|
241
|
-
margin-bottom: 6px;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
.amount {
|
|
245
|
-
color: #353535;
|
|
246
|
-
font-size: 13px;
|
|
247
|
-
line-height: 16px;
|
|
248
|
-
background-image: url('https://cdn.ddjf.com/static/images/appkit/yundou.png');
|
|
249
|
-
background-repeat: no-repeat;
|
|
250
|
-
background-size: 16px 16px;
|
|
251
|
-
padding-left: 24px;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
.right {
|
|
256
|
-
display: flex;
|
|
257
|
-
align-items: center;
|
|
258
|
-
|
|
259
|
-
.amount {
|
|
260
|
-
color: #353535;
|
|
261
|
-
font-size: 15px;
|
|
262
|
-
line-height: 20px;
|
|
263
|
-
margin-right: 10px;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
.icon {
|
|
267
|
-
display: block;
|
|
268
|
-
width: 16px;
|
|
269
|
-
height: 16px;
|
|
270
|
-
font-size: 0;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
.amount-footer {
|
|
276
|
-
padding: 10px 0;
|
|
277
|
-
padding-bottom: 20px;
|
|
278
|
-
|
|
279
|
-
.agreement {
|
|
280
|
-
font-size: 12px;
|
|
281
|
-
display: flex;
|
|
282
|
-
justify-content: center;
|
|
283
|
-
align-items: cebter;
|
|
284
|
-
height: 40px;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
.buy-amount {
|
|
288
|
-
display: flex;
|
|
289
|
-
justify-content: space-between;
|
|
290
|
-
align-items: center;
|
|
291
|
-
padding: 0 10px;
|
|
292
|
-
border-radius: 0px;
|
|
293
|
-
box-shadow: 0px -5px 14px -5px rgba(0, 0, 0, 0.1);
|
|
294
|
-
|
|
295
|
-
/* 上边框阴影 */
|
|
296
|
-
.left {
|
|
297
|
-
width: 70%;
|
|
298
|
-
color: #353535;
|
|
299
|
-
font-size: 13px;
|
|
300
|
-
|
|
301
|
-
.amount {
|
|
302
|
-
color: #FD6701;
|
|
303
|
-
font-size: 20px;
|
|
304
|
-
font-weight: 600;
|
|
305
|
-
|
|
306
|
-
i {
|
|
307
|
-
font-size: 14px;
|
|
308
|
-
font-style: normal;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
.recharge-button {
|
|
314
|
-
background: linear-gradient(90deg, #FFEBC1 0%, #FFD7A7 52.29%, #FFB875 100%);
|
|
315
|
-
color: #353535;
|
|
316
|
-
margin: 12px 0;
|
|
317
|
-
border: 0;
|
|
318
|
-
border-radius: 8px;
|
|
319
|
-
flex: 1;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
.nut-checkbox {
|
|
324
|
-
line-height: 40px;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
.nut-checkbox__label {
|
|
328
|
-
margin-left: 8px;
|
|
329
|
-
flex: flex;
|
|
330
|
-
font-size: 12px;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
.link {
|
|
334
|
-
display: inline;
|
|
335
|
-
color: #FD6701;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
.trade-dialog {
|
|
341
|
-
.nut-dialog__header {
|
|
342
|
-
font-size: 16px;
|
|
343
|
-
color: #262626
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
.item {
|
|
347
|
-
font-size: 14px;
|
|
348
|
-
color: #666666;
|
|
349
|
-
line-height: 21px;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
.nut-dialog__footer-cancel {
|
|
353
|
-
color: #353535 !important;
|
|
354
|
-
border-color: #CCCCCC !important;
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
.nut-dialog__footer-ok {
|
|
358
|
-
border: none;
|
|
359
|
-
color: #353535;
|
|
360
|
-
background: linear-gradient(90deg, #FFEBC1 0%, #FFB875 100%);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<view class="view recharge-view2">
|
|
3
|
+
<view class="flex-grow">
|
|
4
|
+
<rights-picker :items="amounts" :selected="state.selected" @change="onAmountSelect" />
|
|
5
|
+
<div class="bean-buy" v-if="amounts[state.selected]">
|
|
6
|
+
<div class="left">
|
|
7
|
+
<div class="title">使用云豆支付</div>
|
|
8
|
+
<div class="amount" v-if="!selectBean">余额 {{ formatAmount(balance || 0) }}</div>
|
|
9
|
+
<div class="amount" v-else>扣减后余额 {{ formatAmount(balance - amounts[state.selected].paymentAmount) }}</div>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="right" v-if="balance >= amounts[state.selected].paymentAmount" @click="selectBean = !selectBean">
|
|
12
|
+
<div class="amount">-{{ formatAmount(amounts[state.selected].paymentAmount || 0) }}</div>
|
|
13
|
+
<img class="icon"
|
|
14
|
+
:src="selectBean ? 'https://cdn.ddjf.com/static/images/appkit/select.svg' : 'https://cdn.ddjf.com/static/images/appkit/not-select.svg'" />
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
<slot name="banner"></slot>
|
|
20
|
+
</view>
|
|
21
|
+
|
|
22
|
+
<view class="amount-footer">
|
|
23
|
+
<view class="agreement" v-if="!selectBean">
|
|
24
|
+
<nut-checkbox v-model="state.agreed">我已阅读并同意<a class="link inline"
|
|
25
|
+
@click="onAgreementLinkClick">《大道云平台云豆充值服务协议》</a></nut-checkbox>
|
|
26
|
+
</view>
|
|
27
|
+
<div class="buy-amount">
|
|
28
|
+
<div class="left">
|
|
29
|
+
待支付:
|
|
30
|
+
<span class="amount">
|
|
31
|
+
<i>¥</i>{{ formatAmount(currentAmount) }}
|
|
32
|
+
</span>
|
|
33
|
+
</div>
|
|
34
|
+
<nut-button block shape="square" :loading="state.buttonLoading" @click="onPayClick"
|
|
35
|
+
class="recharge-button">购买</nut-button>
|
|
36
|
+
</div>
|
|
37
|
+
</view>
|
|
38
|
+
<nut-dialog title="确认购买" custom-class="trade-dialog" v-model:visible="showDialog" @cancel="showDialog = !showDialog"
|
|
39
|
+
@ok="beanPay">
|
|
40
|
+
<template v-if="amounts[state.selected]">
|
|
41
|
+
<div class="item">云豆扣减:{{ formatAmount(amounts[state.selected].paymentAmount || 0) }}</div>
|
|
42
|
+
<div class="item">权益增加:{{ formatAmount(amounts[state.selected].priceRightNum || 0) }}笔</div>
|
|
43
|
+
<div class="item">扣减后云豆余额:{{ formatAmount(balance - amounts[state.selected].paymentAmount) }}</div>
|
|
44
|
+
</template>
|
|
45
|
+
</nut-dialog>
|
|
46
|
+
</view>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<script lang="ts" setup>
|
|
50
|
+
import { computed, onMounted, reactive, ref } from 'vue'
|
|
51
|
+
import RightsPicker, { Amount } from './RightsPicker.vue'
|
|
52
|
+
import { endpoints, useHttp } from '../api'
|
|
53
|
+
import { requestBrandWCPayByBean, requestPaymentByBean } from '../services'
|
|
54
|
+
import Taro, { showToast, useRouter } from '@tarojs/taro'
|
|
55
|
+
import { useAmount } from '../../shared/composables/useAmount'
|
|
56
|
+
import { isWechat } from '../../shared/composables/useDeviceEnv'
|
|
57
|
+
|
|
58
|
+
// 充值用户界面
|
|
59
|
+
// 配置了必须的属性后
|
|
60
|
+
// 自动获取支付套餐包列表
|
|
61
|
+
// 并发起微信支付
|
|
62
|
+
export interface RechargeViewProps {
|
|
63
|
+
/**
|
|
64
|
+
* header头中的appcode,一般情况下与app参数一致,当无应用权限时,此参数未空
|
|
65
|
+
**/
|
|
66
|
+
headerApp: string,
|
|
67
|
+
/**
|
|
68
|
+
* 应用
|
|
69
|
+
**/
|
|
70
|
+
app: string,
|
|
71
|
+
/**
|
|
72
|
+
* 充值场景
|
|
73
|
+
*/
|
|
74
|
+
// stage?: string, // 这个参数暂时不用
|
|
75
|
+
/**
|
|
76
|
+
* 租户
|
|
77
|
+
*/
|
|
78
|
+
tenant: string,
|
|
79
|
+
/**
|
|
80
|
+
* h5支付完成后跳转地址
|
|
81
|
+
*/
|
|
82
|
+
payFinishJumpUrl?: ''
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const props = defineProps<RechargeViewProps>()
|
|
86
|
+
const { formatAmount } = useAmount()
|
|
87
|
+
const { params } = useRouter()
|
|
88
|
+
|
|
89
|
+
const emit = defineEmits<{
|
|
90
|
+
(event: 'complete', value: { result: boolean, type: string }): void,
|
|
91
|
+
(event: 'agree'): void,
|
|
92
|
+
}>()
|
|
93
|
+
|
|
94
|
+
const state = reactive({
|
|
95
|
+
agreed: false,
|
|
96
|
+
selected: 0,
|
|
97
|
+
// agreementOpen: false,
|
|
98
|
+
buttonLoading: false,
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
const balance = ref<number>(0)
|
|
103
|
+
const amounts = ref<Amount[]>([])
|
|
104
|
+
const selectBean = ref<boolean>(false)
|
|
105
|
+
|
|
106
|
+
const onAgreementLinkClick = (e) => {
|
|
107
|
+
e.preventDefault()
|
|
108
|
+
e.stopImmediatePropagation()
|
|
109
|
+
emit('agree')
|
|
110
|
+
// state.agreementOpen = true
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const onAmountSelect = (selected: number) => {
|
|
114
|
+
state.selected = selected
|
|
115
|
+
selectBean.value = false
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const currentAmount = computed(() => {
|
|
119
|
+
return amounts.value[state.selected] && !selectBean.value ? amounts.value[state.selected].paymentAmount : 0
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
onMounted(() => {
|
|
123
|
+
const $http = useHttp({ Appcode: props.headerApp, Tenant: props.tenant })
|
|
124
|
+
$http.get<any[]>(endpoints.获取增值权益类目, {
|
|
125
|
+
rightCode: props.app === 'corporateStar' ? 'riskQueryCompany' : 'riskQueryMulti',
|
|
126
|
+
}).then((res: any) => {
|
|
127
|
+
balance.value = res.balance
|
|
128
|
+
amounts.value = res.paymentCaseConfigVOS
|
|
129
|
+
})
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
// 云豆支付
|
|
133
|
+
const showDialog = ref<boolean>(false)
|
|
134
|
+
async function beanPay() {
|
|
135
|
+
const $http = useHttp({ Appcode: props.headerApp, Tenant: props.tenant })
|
|
136
|
+
$http.post(`/payment/paymentCaseConfig/purchase/${amounts.value[state.selected].id}`).then((response: any) => {
|
|
137
|
+
if (response) {
|
|
138
|
+
showDialog.value = false
|
|
139
|
+
emit('complete', { result: response, type: 'bean' })
|
|
140
|
+
} else {
|
|
141
|
+
showToast({
|
|
142
|
+
title: response.message,
|
|
143
|
+
icon: 'none',
|
|
144
|
+
})
|
|
145
|
+
}
|
|
146
|
+
})
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
const onPayClick = () => {
|
|
151
|
+
// 用云豆支付
|
|
152
|
+
if (selectBean.value) {
|
|
153
|
+
showDialog.value = true
|
|
154
|
+
return
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// 微信支付
|
|
158
|
+
if (!selectBean.value && !state.agreed) {
|
|
159
|
+
showToast({
|
|
160
|
+
title: '请勾选《大道云平台云豆充值协议》',
|
|
161
|
+
icon: 'none',
|
|
162
|
+
})
|
|
163
|
+
return false
|
|
164
|
+
}
|
|
165
|
+
state.buttonLoading = true
|
|
166
|
+
|
|
167
|
+
if (Taro.getEnv() === 'WEB') {
|
|
168
|
+
if (!isWechat()) {
|
|
169
|
+
showToast({
|
|
170
|
+
title: '请使用微信浏览器打开',
|
|
171
|
+
icon: 'none',
|
|
172
|
+
})
|
|
173
|
+
state.buttonLoading = false
|
|
174
|
+
return false
|
|
175
|
+
}
|
|
176
|
+
requestBrandWCPayByBean({
|
|
177
|
+
caseConfigId: amounts.value[state.selected].id,
|
|
178
|
+
amount: amounts.value[state.selected].paymentAmount,
|
|
179
|
+
app: 'cloudkitProMp',
|
|
180
|
+
tenant: props.tenant,
|
|
181
|
+
accountAuthFlag: false,
|
|
182
|
+
channelCode: 'centergzh',
|
|
183
|
+
payFinishJumpUrl: props.payFinishJumpUrl,
|
|
184
|
+
fromMini: !!params.from
|
|
185
|
+
}).then(result => {
|
|
186
|
+
console.log(result, '------requestBrandWCPay')
|
|
187
|
+
state.buttonLoading = false
|
|
188
|
+
if (typeof result === 'boolean' && result) {
|
|
189
|
+
window.location.href = props.payFinishJumpUrl as string
|
|
190
|
+
} else {
|
|
191
|
+
emit('complete', { result, type: 'wePay' })
|
|
192
|
+
}
|
|
193
|
+
})
|
|
194
|
+
} else {
|
|
195
|
+
wx.login({
|
|
196
|
+
success({ code }: { code: string }) {
|
|
197
|
+
requestPaymentByBean({
|
|
198
|
+
caseConfigId: amounts.value[state.selected].id,
|
|
199
|
+
amount: amounts.value[state.selected].paymentAmount,
|
|
200
|
+
app: props.app,
|
|
201
|
+
tenant: props.tenant,
|
|
202
|
+
user: code,
|
|
203
|
+
}, props.headerApp).then(result => {
|
|
204
|
+
state.buttonLoading = false
|
|
205
|
+
if (result) {
|
|
206
|
+
emit('complete', { result: true, type: 'wePay' })
|
|
207
|
+
}
|
|
208
|
+
})
|
|
209
|
+
}
|
|
210
|
+
})
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
</script>
|
|
214
|
+
|
|
215
|
+
<style lang="scss">
|
|
216
|
+
.recharge-view2 {
|
|
217
|
+
height: 100%;
|
|
218
|
+
display: flex;
|
|
219
|
+
flex-direction: column;
|
|
220
|
+
--nut-primary-color: #017fff;
|
|
221
|
+
|
|
222
|
+
.flex-grow {
|
|
223
|
+
flex-grow: 1;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.bean-buy {
|
|
227
|
+
margin: 0 15px;
|
|
228
|
+
padding: 10px;
|
|
229
|
+
background: #FFFBF3;
|
|
230
|
+
border-radius: 5px;
|
|
231
|
+
display: flex;
|
|
232
|
+
justify-content: space-between;
|
|
233
|
+
align-items: center;
|
|
234
|
+
|
|
235
|
+
.left {
|
|
236
|
+
.title {
|
|
237
|
+
color: #FD6701;
|
|
238
|
+
font-size: 14px;
|
|
239
|
+
font-weight: 600;
|
|
240
|
+
line-height: 20px;
|
|
241
|
+
margin-bottom: 6px;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.amount {
|
|
245
|
+
color: #353535;
|
|
246
|
+
font-size: 13px;
|
|
247
|
+
line-height: 16px;
|
|
248
|
+
background-image: url('https://cdn.ddjf.com/static/images/appkit/yundou.png');
|
|
249
|
+
background-repeat: no-repeat;
|
|
250
|
+
background-size: 16px 16px;
|
|
251
|
+
padding-left: 24px;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.right {
|
|
256
|
+
display: flex;
|
|
257
|
+
align-items: center;
|
|
258
|
+
|
|
259
|
+
.amount {
|
|
260
|
+
color: #353535;
|
|
261
|
+
font-size: 15px;
|
|
262
|
+
line-height: 20px;
|
|
263
|
+
margin-right: 10px;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.icon {
|
|
267
|
+
display: block;
|
|
268
|
+
width: 16px;
|
|
269
|
+
height: 16px;
|
|
270
|
+
font-size: 0;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.amount-footer {
|
|
276
|
+
padding: 10px 0;
|
|
277
|
+
padding-bottom: 20px;
|
|
278
|
+
|
|
279
|
+
.agreement {
|
|
280
|
+
font-size: 12px;
|
|
281
|
+
display: flex;
|
|
282
|
+
justify-content: center;
|
|
283
|
+
align-items: cebter;
|
|
284
|
+
height: 40px;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.buy-amount {
|
|
288
|
+
display: flex;
|
|
289
|
+
justify-content: space-between;
|
|
290
|
+
align-items: center;
|
|
291
|
+
padding: 0 10px;
|
|
292
|
+
border-radius: 0px;
|
|
293
|
+
box-shadow: 0px -5px 14px -5px rgba(0, 0, 0, 0.1);
|
|
294
|
+
|
|
295
|
+
/* 上边框阴影 */
|
|
296
|
+
.left {
|
|
297
|
+
width: 70%;
|
|
298
|
+
color: #353535;
|
|
299
|
+
font-size: 13px;
|
|
300
|
+
|
|
301
|
+
.amount {
|
|
302
|
+
color: #FD6701;
|
|
303
|
+
font-size: 20px;
|
|
304
|
+
font-weight: 600;
|
|
305
|
+
|
|
306
|
+
i {
|
|
307
|
+
font-size: 14px;
|
|
308
|
+
font-style: normal;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.recharge-button {
|
|
314
|
+
background: linear-gradient(90deg, #FFEBC1 0%, #FFD7A7 52.29%, #FFB875 100%);
|
|
315
|
+
color: #353535;
|
|
316
|
+
margin: 12px 0;
|
|
317
|
+
border: 0;
|
|
318
|
+
border-radius: 8px;
|
|
319
|
+
flex: 1;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.nut-checkbox {
|
|
324
|
+
line-height: 40px;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.nut-checkbox__label {
|
|
328
|
+
margin-left: 8px;
|
|
329
|
+
flex: flex;
|
|
330
|
+
font-size: 12px;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.link {
|
|
334
|
+
display: inline;
|
|
335
|
+
color: #FD6701;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.trade-dialog {
|
|
341
|
+
.nut-dialog__header {
|
|
342
|
+
font-size: 16px;
|
|
343
|
+
color: #262626
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.item {
|
|
347
|
+
font-size: 14px;
|
|
348
|
+
color: #666666;
|
|
349
|
+
line-height: 21px;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.nut-dialog__footer-cancel {
|
|
353
|
+
color: #353535 !important;
|
|
354
|
+
border-color: #CCCCCC !important;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.nut-dialog__footer-ok {
|
|
358
|
+
border: none;
|
|
359
|
+
color: #353535;
|
|
360
|
+
background: linear-gradient(90deg, #FFEBC1 0%, #FFB875 100%);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
</style>
|