@uxda/appkit 1.2.8 → 1.2.12
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 +289 -71
- package/dist/index.js +862 -341
- package/dist/styles.css +1 -0
- package/package.json +78 -78
- package/project.config.json +15 -15
- package/project.tt.json +13 -13
- package/rollup.config.mjs +54 -54
- package/src/Appkit.ts +65 -65
- package/src/balance/api/endpoints.ts +125 -122
- package/src/balance/api/index.ts +82 -82
- package/src/balance/components/AccountView.vue +754 -649
- package/src/balance/components/BalanceCard.vue +209 -209
- package/src/balance/components/BalanceReminder.vue +83 -83
- package/src/balance/components/ConsumptionFilter.vue +218 -218
- package/src/balance/components/ConsumptionRules.vue +68 -68
- package/src/balance/components/DateFilter.vue +235 -235
- package/src/balance/components/SecondBalance.vue +71 -71
- package/src/balance/components/Tip.vue +46 -0
- package/src/balance/components/index.ts +9 -9
- package/src/balance/types.ts +90 -88
- package/src/components/dd-area/index.vue +222 -222
- package/src/components/dd-icon/doc.md +21 -21
- package/src/components/dd-icon/index.vue +23 -23
- package/src/components/dd-selector/index.vue +124 -124
- package/src/components/ocr-id/index.vue +110 -110
- package/src/components/ocr-id/types.d.ts +12 -12
- package/src/global.ts +6 -6
- package/src/index.ts +88 -86
- package/src/main.scss +1 -1
- package/src/payment/api/config.ts +7 -7
- package/src/payment/api/endpoints.ts +103 -78
- package/src/payment/api/index.ts +71 -71
- package/src/payment/components/AmountPicker.vue +93 -93
- package/src/payment/components/RechargeResult.vue +66 -54
- package/src/payment/components/RechargeView.vue +154 -154
- package/src/payment/components/RightsPicker.vue +106 -0
- package/src/payment/components/TradeView.vue +298 -0
- package/src/payment/components/UserAgreement.vue +141 -141
- package/src/payment/components/index.ts +22 -19
- 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 +58 -31
- package/src/payment/types.ts +28 -23
- package/src/register/components/SelfRegistration.vue +227 -227
- package/src/register/components/index.ts +2 -2
- package/src/shared/components/AppDrawer.vue +58 -58
- package/src/shared/components/EmptyView.vue +33 -33
- package/src/shared/components/PageHeader.vue +79 -79
- package/src/shared/components/index.ts +6 -6
- package/src/shared/composables/index.ts +2 -2
- package/src/shared/composables/useSafeArea.ts +43 -43
- package/src/shared/composables/useTabbar.ts +24 -24
- package/src/shared/http/Http.ts +126 -126
- package/src/shared/http/index.ts +1 -1
- package/src/shared/http/types.ts +157 -157
- package/src/shared/index.ts +3 -3
- package/src/shared/weixin/payment.ts +38 -38
- package/src/styles/fonts.scss +2 -2
- package/src/styles/vars.scss +3 -3
- package/tsconfig.json +30 -30
- package/types/global.d.ts +21 -21
- package/types/vue.d.ts +10 -10
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<nut-grid
|
|
3
|
+
class="trade-picker"
|
|
4
|
+
:column-num="3"
|
|
5
|
+
:gutter="10"
|
|
6
|
+
:border="false">
|
|
7
|
+
<nut-grid-item
|
|
8
|
+
class="tile"
|
|
9
|
+
v-for="(amount, index) in items"
|
|
10
|
+
:class="{selected: state.selected === index}"
|
|
11
|
+
@click="() => onGridItemClick(index)"
|
|
12
|
+
:key="index">
|
|
13
|
+
<div class="tag">{{ amount.paymentDesc }}</div>
|
|
14
|
+
<h4 class="token-line number">{{ amount.priceRightNum }}笔</h4>
|
|
15
|
+
<h5>¥<span class="number">{{ amount.paymentAmount }}</span></h5>
|
|
16
|
+
</nut-grid-item>
|
|
17
|
+
</nut-grid>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script lang="ts" setup>
|
|
21
|
+
import { reactive } from 'vue'
|
|
22
|
+
|
|
23
|
+
// 充值金额选取
|
|
24
|
+
|
|
25
|
+
export type Amount = {
|
|
26
|
+
id: string,
|
|
27
|
+
paymentAmount: number
|
|
28
|
+
paymentDesc: string
|
|
29
|
+
priceRightNum: number
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface AmountPickerProps {
|
|
33
|
+
items: Amount[],
|
|
34
|
+
selected?: number
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const emit = defineEmits<{
|
|
38
|
+
(event: 'change', selected: number): void
|
|
39
|
+
}>()
|
|
40
|
+
|
|
41
|
+
withDefaults(
|
|
42
|
+
defineProps<AmountPickerProps>(),
|
|
43
|
+
{
|
|
44
|
+
items: () => [],
|
|
45
|
+
selected: () => 0
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
const state = reactive({
|
|
50
|
+
selected: 0
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
const onGridItemClick = (index: number) => {
|
|
54
|
+
state.selected = index
|
|
55
|
+
emit('change', state.selected)
|
|
56
|
+
}
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<style lang="scss">
|
|
60
|
+
.trade-picker {
|
|
61
|
+
padding: 14px 0 14px 14px;
|
|
62
|
+
.nut-grid-item__content {
|
|
63
|
+
border: solid 2px transparent;
|
|
64
|
+
background: linear-gradient(#f5f5f5, #f5f5f5) padding-box,
|
|
65
|
+
linear-gradient(to bottom, #cccccc88, #cccccc88) border-box;
|
|
66
|
+
border-radius: 5px;
|
|
67
|
+
}
|
|
68
|
+
.tile {
|
|
69
|
+
height: 80px;
|
|
70
|
+
position: relative;
|
|
71
|
+
overflow: hidden;
|
|
72
|
+
&.selected {
|
|
73
|
+
.nut-grid-item__content {
|
|
74
|
+
background: linear-gradient(#FFF7E3, #FEFDE6) padding-box,
|
|
75
|
+
linear-gradient(to bottom, #efd082, #ffb877) border-box;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
.tag{
|
|
79
|
+
position: absolute;
|
|
80
|
+
left: 0;
|
|
81
|
+
top: 0;
|
|
82
|
+
background: linear-gradient(90deg, #FD6701 0%, #FF9349 100%);
|
|
83
|
+
color: #fff;
|
|
84
|
+
font-size: 10px;
|
|
85
|
+
padding:0 10px;
|
|
86
|
+
line-height: 17px;
|
|
87
|
+
height: 17px;;
|
|
88
|
+
border-radius: 10px 100px 100px 0px;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
h4.token-line {
|
|
92
|
+
color: #FD6701;
|
|
93
|
+
font-weight: 600;
|
|
94
|
+
line-height: 25px;
|
|
95
|
+
font-size: 18px;
|
|
96
|
+
}
|
|
97
|
+
h5 {
|
|
98
|
+
line-height: 18px;
|
|
99
|
+
color: #353535;
|
|
100
|
+
font-weight: 600;
|
|
101
|
+
opacity: 0.6;
|
|
102
|
+
margin-top: 4px;
|
|
103
|
+
font-size: 12px;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
</style>
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="view recharge-view2">
|
|
3
|
+
<view class="flex-grow">
|
|
4
|
+
<rights-picker :items="amounts"
|
|
5
|
+
:selected="state.selected"
|
|
6
|
+
@change="onAmountSelect" />
|
|
7
|
+
<div class="bean-buy" v-if="amounts[state.selected]">
|
|
8
|
+
<div class="left">
|
|
9
|
+
<div class="title">使用云豆支付</div>
|
|
10
|
+
<div class="amount" v-if="!selectBean">余额 {{balance}}</div>
|
|
11
|
+
<div class="amount" v-else>扣减后余额 {{balance - amounts[state.selected].paymentAmount}}</div>
|
|
12
|
+
</div>
|
|
13
|
+
<div class="right" v-if="balance >= amounts[state.selected].paymentAmount" @click="selectBean = !selectBean">
|
|
14
|
+
<div class="amount">-{{ amounts[state.selected].paymentAmount }}</div>
|
|
15
|
+
<img class="icon" :src="selectBean ? 'https://cdn.ddjf.com/static/images/appkit/select.svg' : 'https://cdn.ddjf.com/static/images/appkit/not-select.svg'" />
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
</view>
|
|
19
|
+
<view class="amount-footer">
|
|
20
|
+
<view class="agreement" v-if="!selectBean">
|
|
21
|
+
<nut-checkbox v-model="state.agreed">我已阅读并同意<a class="link inline" @click="onAgreementLinkClick">《大道云平台云豆充值服务协议》</a></nut-checkbox>
|
|
22
|
+
</view>
|
|
23
|
+
<div class="buy-amount">
|
|
24
|
+
<div class="left">
|
|
25
|
+
待支付:
|
|
26
|
+
<span class="amount">
|
|
27
|
+
<i>¥</i>{{ currentAmount }}
|
|
28
|
+
</span>
|
|
29
|
+
</div>
|
|
30
|
+
<nut-button block
|
|
31
|
+
shape="square"
|
|
32
|
+
:loading="state.buttonLoading"
|
|
33
|
+
@click="onPayClick"
|
|
34
|
+
class="recharge-button">购买</nut-button>
|
|
35
|
+
</div>
|
|
36
|
+
|
|
37
|
+
</view>
|
|
38
|
+
<app-drawer
|
|
39
|
+
v-model="state.agreementOpen"
|
|
40
|
+
title="充值协议">
|
|
41
|
+
<user-agreement />
|
|
42
|
+
</app-drawer>
|
|
43
|
+
<nut-dialog title="确认购买" custom-class="trade-dialog" v-model:visible="showDialog" @cancel="showDialog = !showDialog" @ok="beanPay" >
|
|
44
|
+
<template v-if="amounts[state.selected]">
|
|
45
|
+
<div class="item">云豆扣减:{{ amounts[state.selected].paymentAmount }}</div>
|
|
46
|
+
<div class="item">权益增加:{{ amounts[state.selected].priceRightNum }}笔</div>
|
|
47
|
+
<div class="item">扣减后云豆余额:{{ balance - amounts[state.selected].paymentAmount }}</div>
|
|
48
|
+
</template>
|
|
49
|
+
</nut-dialog>
|
|
50
|
+
</view>
|
|
51
|
+
</template>
|
|
52
|
+
|
|
53
|
+
<script lang="ts" setup>
|
|
54
|
+
import { computed, onMounted, reactive, ref } from 'vue'
|
|
55
|
+
import RightsPicker, { Amount } from './RightsPicker.vue'
|
|
56
|
+
import UserAgreement from './UserAgreement.vue'
|
|
57
|
+
import { AppDrawer } from '../../shared'
|
|
58
|
+
import { endpoints, useHttp } from '../api'
|
|
59
|
+
import { requestPaymentByBean } from '../services'
|
|
60
|
+
import Taro from '@tarojs/taro'
|
|
61
|
+
|
|
62
|
+
// 充值用户界面
|
|
63
|
+
// 配置了必须的属性后
|
|
64
|
+
// 自动获取支付套餐包列表
|
|
65
|
+
// 并发起微信支付
|
|
66
|
+
export interface RechargeViewProps {
|
|
67
|
+
/**
|
|
68
|
+
* 应用
|
|
69
|
+
**/
|
|
70
|
+
app: string,
|
|
71
|
+
/**
|
|
72
|
+
* 充值场景
|
|
73
|
+
*/
|
|
74
|
+
// stage?: string, // 这个参数暂时不用
|
|
75
|
+
/**
|
|
76
|
+
* 租户
|
|
77
|
+
*/
|
|
78
|
+
tenant: string
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const props = defineProps<RechargeViewProps>()
|
|
82
|
+
|
|
83
|
+
const emit = defineEmits<{
|
|
84
|
+
(event: 'complete', value: boolean): void
|
|
85
|
+
}>()
|
|
86
|
+
|
|
87
|
+
const state = reactive({
|
|
88
|
+
agreed: false,
|
|
89
|
+
selected: 0,
|
|
90
|
+
agreementOpen: false,
|
|
91
|
+
buttonLoading: false,
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
const balance = ref<number>(0)
|
|
96
|
+
const amounts = ref<Amount[]>([])
|
|
97
|
+
const selectBean = ref<boolean>(false)
|
|
98
|
+
|
|
99
|
+
const onAgreementLinkClick = ($event) => {
|
|
100
|
+
state.agreementOpen = true
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const onAmountSelect = (selected: number) => {
|
|
104
|
+
state.selected = selected
|
|
105
|
+
selectBean.value = false
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const currentAmount = computed(()=>{
|
|
109
|
+
return amounts.value[state.selected] && !selectBean.value ? amounts.value[state.selected].paymentAmount : 0
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
onMounted(() => {
|
|
113
|
+
const $http = useHttp()
|
|
114
|
+
$http.get<any[]>(endpoints.获取增值权益类目).then((res: any) => {
|
|
115
|
+
balance.value = res.balance
|
|
116
|
+
amounts.value = res.paymentCaseConfigVOS
|
|
117
|
+
})
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
// 云豆支付
|
|
121
|
+
const showDialog = ref<boolean>(false)
|
|
122
|
+
async function beanPay(){
|
|
123
|
+
const $http = useHttp()
|
|
124
|
+
$http.post( `/payment/paymentCaseConfig/purchase/${amounts.value[state.selected].id}`).then((response: any) => {
|
|
125
|
+
if (response) {
|
|
126
|
+
showDialog.value = false
|
|
127
|
+
emit('complete', response)
|
|
128
|
+
}else {
|
|
129
|
+
Taro.showToast({
|
|
130
|
+
title: response.message,
|
|
131
|
+
icon: 'none',
|
|
132
|
+
})
|
|
133
|
+
}
|
|
134
|
+
})
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
const onPayClick = () => {
|
|
139
|
+
// 用云豆支付
|
|
140
|
+
if(selectBean.value){
|
|
141
|
+
showDialog.value = true
|
|
142
|
+
return
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// 微信支付
|
|
146
|
+
if (!selectBean.value && !state.agreed) {
|
|
147
|
+
Taro.showToast({
|
|
148
|
+
title: '请勾选《大道云平台云豆充值协议》',
|
|
149
|
+
icon: 'none',
|
|
150
|
+
})
|
|
151
|
+
return false
|
|
152
|
+
}
|
|
153
|
+
state.buttonLoading = true
|
|
154
|
+
wx.login({
|
|
155
|
+
success ({code}: {code: string}) {
|
|
156
|
+
requestPaymentByBean({
|
|
157
|
+
caseConfigId: amounts.value[state.selected].id,
|
|
158
|
+
amount: amounts.value[state.selected].paymentAmount,
|
|
159
|
+
app: 'corporateStar', // 'crm',
|
|
160
|
+
tenant: props.tenant, // '17454646',
|
|
161
|
+
user: code
|
|
162
|
+
}).then(result => {
|
|
163
|
+
state.buttonLoading = false
|
|
164
|
+
if (result) {
|
|
165
|
+
emit('complete', true)
|
|
166
|
+
}
|
|
167
|
+
})
|
|
168
|
+
}
|
|
169
|
+
})
|
|
170
|
+
}
|
|
171
|
+
</script>
|
|
172
|
+
|
|
173
|
+
<style lang="scss">
|
|
174
|
+
.recharge-view2 {
|
|
175
|
+
height: 100%;
|
|
176
|
+
display: flex;
|
|
177
|
+
flex-direction: column;
|
|
178
|
+
.flex-grow {
|
|
179
|
+
flex-grow: 1;
|
|
180
|
+
}
|
|
181
|
+
.bean-buy{
|
|
182
|
+
margin: 0 15px;
|
|
183
|
+
padding: 10px;
|
|
184
|
+
background: #FFFBF3;
|
|
185
|
+
border-radius: 5px;
|
|
186
|
+
display: flex;
|
|
187
|
+
justify-content: space-between;
|
|
188
|
+
align-items: center;
|
|
189
|
+
.left{
|
|
190
|
+
.title{
|
|
191
|
+
color:#FD6701;
|
|
192
|
+
font-size: 14px;
|
|
193
|
+
font-weight: 600;
|
|
194
|
+
line-height: 20px;
|
|
195
|
+
margin-bottom: 6px;
|
|
196
|
+
}
|
|
197
|
+
.amount{
|
|
198
|
+
color:#353535;
|
|
199
|
+
font-size: 13px;
|
|
200
|
+
line-height: 16px;
|
|
201
|
+
background-image: url('https://cdn.ddjf.com/static/images/appkit/yundou.png');
|
|
202
|
+
background-repeat: no-repeat;
|
|
203
|
+
background-size: 16px 16px;
|
|
204
|
+
padding-left: 24px;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
.right{
|
|
208
|
+
display: flex;
|
|
209
|
+
align-items: center;
|
|
210
|
+
.amount{
|
|
211
|
+
color:#353535;
|
|
212
|
+
font-size: 15px;
|
|
213
|
+
line-height: 20px;
|
|
214
|
+
margin-right: 10px;
|
|
215
|
+
}
|
|
216
|
+
.icon{
|
|
217
|
+
display: block;
|
|
218
|
+
width: 16px;
|
|
219
|
+
height: 16px;
|
|
220
|
+
font-size: 0;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
.amount-footer {
|
|
225
|
+
padding: 10px 0;
|
|
226
|
+
padding-bottom: 20px;
|
|
227
|
+
.agreement {
|
|
228
|
+
font-size: 12px;
|
|
229
|
+
display: flex;
|
|
230
|
+
justify-content: center;
|
|
231
|
+
align-items: cebter;
|
|
232
|
+
height: 40px;
|
|
233
|
+
}
|
|
234
|
+
.buy-amount{
|
|
235
|
+
display: flex;
|
|
236
|
+
justify-content: space-between;
|
|
237
|
+
align-items: center;
|
|
238
|
+
padding: 0 10px;
|
|
239
|
+
border-radius: 0px;
|
|
240
|
+
box-shadow: 0px -5px 14px -5px rgba(0, 0, 0, 0.1); /* 上边框阴影 */
|
|
241
|
+
.left{
|
|
242
|
+
width: 70%;
|
|
243
|
+
color:#353535;
|
|
244
|
+
font-size: 13px;
|
|
245
|
+
.amount{
|
|
246
|
+
color:#FD6701;
|
|
247
|
+
font-size: 20px;
|
|
248
|
+
font-weight: 600;
|
|
249
|
+
i{
|
|
250
|
+
font-size: 14px;
|
|
251
|
+
font-style: normal;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
.recharge-button {
|
|
256
|
+
background: linear-gradient(90deg, #FFEBC1 0%, #FFD7A7 52.29%, #FFB875 100%);
|
|
257
|
+
color: #353535;
|
|
258
|
+
margin: 12px 0;
|
|
259
|
+
border: 0;
|
|
260
|
+
border-radius: 8px;
|
|
261
|
+
flex: 1;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
.nut-checkbox {
|
|
265
|
+
line-height: 40px;
|
|
266
|
+
}
|
|
267
|
+
.nut-checkbox__label {
|
|
268
|
+
margin-left: 8px;
|
|
269
|
+
flex: flex;
|
|
270
|
+
font-size: 12px;
|
|
271
|
+
}
|
|
272
|
+
.link {
|
|
273
|
+
display: inline;
|
|
274
|
+
color: #FD6701;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
.trade-dialog{
|
|
279
|
+
.nut-dialog__header{
|
|
280
|
+
font-size: 16px;
|
|
281
|
+
color: #262626
|
|
282
|
+
}
|
|
283
|
+
.item{
|
|
284
|
+
font-size: 14px;
|
|
285
|
+
color:#666666;
|
|
286
|
+
line-height: 21px;
|
|
287
|
+
}
|
|
288
|
+
.nut-dialog__footer-cancel{
|
|
289
|
+
color: #353535 !important;
|
|
290
|
+
border-color: #CCCCCC !important;
|
|
291
|
+
}
|
|
292
|
+
.nut-dialog__footer-ok {
|
|
293
|
+
border:none;
|
|
294
|
+
color: #353535;
|
|
295
|
+
background: linear-gradient(90deg, #FFEBC1 0%, #FFB875 100%);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
</style>
|