@2kog/pkg-widget 0.1.15 → 0.1.17
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/package.json +1 -2
- package/postcss.config.js +0 -1
- package/src/components/common/payment.vue +157 -46
- package/src/main.js +0 -1
- package/src/assets/css/external/tailwind.css +0 -3
- package/tailwind.config.js +0 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@2kog/pkg-widget",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite",
|
|
@@ -25,7 +25,6 @@
|
|
|
25
25
|
"autoprefixer": "^10.4.23",
|
|
26
26
|
"less": "^4.2.0",
|
|
27
27
|
"postcss": "^8.5.6",
|
|
28
|
-
"tailwindcss": "^3.4.19",
|
|
29
28
|
"vite": "^5.4.1",
|
|
30
29
|
"vite-plugin-require": "^1.2.14",
|
|
31
30
|
"vite-svg-loader": "^5.1.0"
|
package/postcss.config.js
CHANGED
|
@@ -1,44 +1,39 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="c-payment-component">
|
|
3
|
-
<div class="
|
|
3
|
+
<div class="c-payment__header">
|
|
4
4
|
<slot name="header"></slot>
|
|
5
5
|
</div>
|
|
6
6
|
|
|
7
7
|
<!-- 右侧:支付操作区 -->
|
|
8
8
|
<div class="modal-main m-purchase-pay-main">
|
|
9
9
|
<!-- 支付方式切换 -->
|
|
10
|
-
<div class="
|
|
10
|
+
<div class="payment-methods-grid">
|
|
11
11
|
<slot name="payment-methods" :methods="paymentMethods" :active="activeMethod" :switch="switchPay">
|
|
12
12
|
<button
|
|
13
13
|
v-for="method in paymentMethods"
|
|
14
14
|
:key="method.value"
|
|
15
15
|
@click="switchPay(method.value)"
|
|
16
|
-
class="pay-method-btn
|
|
16
|
+
class="pay-method-btn"
|
|
17
17
|
:class="[
|
|
18
18
|
activeMethod === method.value ? 'active ' + method.activeClass : '',
|
|
19
19
|
method.customClass || '',
|
|
20
20
|
]"
|
|
21
21
|
>
|
|
22
|
-
<i :class="method.icon" class="
|
|
23
|
-
<span class="
|
|
22
|
+
<i :class="method.icon" class="method-icon"></i>
|
|
23
|
+
<span class="method-label">{{ method.label }}</span>
|
|
24
24
|
</button>
|
|
25
25
|
</slot>
|
|
26
26
|
</div>
|
|
27
27
|
|
|
28
28
|
<!-- 二维码区 -->
|
|
29
|
-
<div class="
|
|
29
|
+
<div class="qrcode-container">
|
|
30
30
|
<div class="qr-wrapper">
|
|
31
31
|
<slot name="badge"></slot>
|
|
32
|
-
<div
|
|
33
|
-
class="w-44 h-44 bg-gray-50 rounded-xl flex items-center justify-center p-2 relative overflow-hidden"
|
|
34
|
-
>
|
|
32
|
+
<div class="qrcode-box">
|
|
35
33
|
<!-- Loading 状态 -->
|
|
36
|
-
<div
|
|
37
|
-
v-if="loading"
|
|
38
|
-
class="absolute inset-0 flex items-center justify-center bg-white rounded-xl"
|
|
39
|
-
>
|
|
34
|
+
<div v-if="loading" class="loading-overlay">
|
|
40
35
|
<slot name="loading">
|
|
41
|
-
<i class="fas fa-spinner fa-spin
|
|
36
|
+
<i class="fas fa-spinner fa-spin loading-icon"></i>
|
|
42
37
|
</slot>
|
|
43
38
|
</div>
|
|
44
39
|
|
|
@@ -46,7 +41,7 @@
|
|
|
46
41
|
<QrcodeVue
|
|
47
42
|
v-else-if="qrcodeUrl"
|
|
48
43
|
:value="qrcodeUrl"
|
|
49
|
-
class="
|
|
44
|
+
class="qrcode-image"
|
|
50
45
|
:size="160"
|
|
51
46
|
level="H"
|
|
52
47
|
/>
|
|
@@ -54,19 +49,19 @@
|
|
|
54
49
|
<!-- 默认图标 -->
|
|
55
50
|
<slot v-else name="placeholder" :activeMethod="activeMethod">
|
|
56
51
|
<i
|
|
57
|
-
class="
|
|
58
|
-
:class="currentPaymentMethod?.icon || 'fas fa-qrcode
|
|
52
|
+
class="placeholder-icon"
|
|
53
|
+
:class="currentPaymentMethod?.icon || 'fas fa-qrcode'"
|
|
59
54
|
></i>
|
|
60
55
|
</slot>
|
|
61
56
|
</div>
|
|
62
57
|
</div>
|
|
63
|
-
<div class="
|
|
64
|
-
<i class="fas fa-lock
|
|
58
|
+
<div class="secure-badge">
|
|
59
|
+
<i class="fas fa-lock secure-icon"></i>
|
|
65
60
|
{{ t("pay.secureChannel") }}
|
|
66
61
|
</div>
|
|
67
62
|
|
|
68
63
|
<!-- 错误提示 -->
|
|
69
|
-
<div v-if="errorMsg" class="
|
|
64
|
+
<div v-if="errorMsg" class="error-message">
|
|
70
65
|
<slot name="error" :message="errorMsg">
|
|
71
66
|
{{ errorMsg }}
|
|
72
67
|
</slot>
|
|
@@ -74,7 +69,7 @@
|
|
|
74
69
|
</div>
|
|
75
70
|
|
|
76
71
|
<!-- 底部插槽 -->
|
|
77
|
-
<div class="
|
|
72
|
+
<div class="footer-slot">
|
|
78
73
|
<slot name="footer" :texts="texts"></slot>
|
|
79
74
|
</div>
|
|
80
75
|
</div>
|
|
@@ -154,16 +149,16 @@ export default {
|
|
|
154
149
|
{
|
|
155
150
|
value: "wepay",
|
|
156
151
|
label: payI18n.global.t("pay.wechat"),
|
|
157
|
-
icon: "fab fa-weixin
|
|
158
|
-
activeClass: "
|
|
152
|
+
icon: "fab fa-weixin wepay-icon",
|
|
153
|
+
activeClass: "",
|
|
159
154
|
customClass: "wechat",
|
|
160
155
|
channel: "wepay",
|
|
161
156
|
},
|
|
162
157
|
{
|
|
163
158
|
value: "alipay",
|
|
164
159
|
label: payI18n.global.t("pay.alipay"),
|
|
165
|
-
icon: "fab fa-alipay
|
|
166
|
-
activeClass: "
|
|
160
|
+
icon: "fab fa-alipay alipay-icon",
|
|
161
|
+
activeClass: "",
|
|
167
162
|
customClass: "alipay",
|
|
168
163
|
channel: {
|
|
169
164
|
mobile: "alipay_wap",
|
|
@@ -447,6 +442,143 @@ export default {
|
|
|
447
442
|
border: 1px solid rgb(31 41 55);
|
|
448
443
|
}
|
|
449
444
|
|
|
445
|
+
.c-payment__header {
|
|
446
|
+
text-align: center;
|
|
447
|
+
margin-top: 2rem;
|
|
448
|
+
margin-bottom: 2rem;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
.payment-methods-grid {
|
|
452
|
+
display: grid;
|
|
453
|
+
grid-template-columns: repeat(2, 1fr);
|
|
454
|
+
gap: 1rem;
|
|
455
|
+
margin-bottom: 2rem;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
.pay-method-btn {
|
|
459
|
+
border-radius: 1rem;
|
|
460
|
+
padding: 1rem;
|
|
461
|
+
display: flex;
|
|
462
|
+
flex-direction: column;
|
|
463
|
+
align-items: center;
|
|
464
|
+
gap: 0.5rem;
|
|
465
|
+
cursor: pointer;
|
|
466
|
+
border: 2px solid rgba(255, 255, 255, 0.05);
|
|
467
|
+
transition: all 0.3s;
|
|
468
|
+
background: transparent;
|
|
469
|
+
|
|
470
|
+
.method-icon {
|
|
471
|
+
font-size: 1.5rem;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
.method-label {
|
|
475
|
+
font-size: 0.75rem;
|
|
476
|
+
font-weight: 500;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
}
|
|
480
|
+
.wepay-icon {
|
|
481
|
+
color: #10b981;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
.alipay-icon {
|
|
485
|
+
color: #3b82f6;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
.pay-method-btn.active.wechat {
|
|
489
|
+
border-color: #10b981;
|
|
490
|
+
background: rgba(16, 185, 129, 0.05);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
.pay-method-btn.active.alipay {
|
|
494
|
+
border-color: #3b82f6;
|
|
495
|
+
background: rgba(59, 130, 246, 0.05);
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
.qrcode-container {
|
|
499
|
+
display: flex;
|
|
500
|
+
flex-direction: column;
|
|
501
|
+
align-items: center;
|
|
502
|
+
justify-content: center;
|
|
503
|
+
position: relative;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
.qr-wrapper {
|
|
507
|
+
background: white;
|
|
508
|
+
padding: 12px;
|
|
509
|
+
border-radius: 24px;
|
|
510
|
+
position: relative;
|
|
511
|
+
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
.qrcode-box {
|
|
515
|
+
width: 11rem;
|
|
516
|
+
height: 11rem;
|
|
517
|
+
background-color: #f9fafb;
|
|
518
|
+
border-radius: 0.75rem;
|
|
519
|
+
display: flex;
|
|
520
|
+
align-items: center;
|
|
521
|
+
justify-content: center;
|
|
522
|
+
padding: 0.5rem;
|
|
523
|
+
position: relative;
|
|
524
|
+
overflow: hidden;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
.loading-overlay {
|
|
528
|
+
position: absolute;
|
|
529
|
+
top: 0;
|
|
530
|
+
right: 0;
|
|
531
|
+
bottom: 0;
|
|
532
|
+
left: 0;
|
|
533
|
+
display: flex;
|
|
534
|
+
align-items: center;
|
|
535
|
+
justify-content: center;
|
|
536
|
+
background-color: white;
|
|
537
|
+
border-radius: 0.75rem;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
.loading-icon {
|
|
541
|
+
font-size: 1.875rem;
|
|
542
|
+
color: #9ca3af;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
.qrcode-image {
|
|
546
|
+
width: 100%;
|
|
547
|
+
height: 100%;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
.placeholder-icon {
|
|
551
|
+
font-size: 4.5rem;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
.secure-badge {
|
|
555
|
+
margin-top: 1.5rem;
|
|
556
|
+
display: flex;
|
|
557
|
+
align-items: center;
|
|
558
|
+
gap: 0.5rem;
|
|
559
|
+
color: #9ca3af;
|
|
560
|
+
font-size: 0.75rem;
|
|
561
|
+
background-color: rgba(255, 255, 255, 0.05);
|
|
562
|
+
padding: 0.5rem 1rem;
|
|
563
|
+
border-radius: 9999px;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
.secure-icon {
|
|
567
|
+
color: #10b981;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
.error-message {
|
|
571
|
+
margin-top: 1rem;
|
|
572
|
+
color: #f87171;
|
|
573
|
+
font-size: 0.75rem;
|
|
574
|
+
text-align: center;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
.footer-slot {
|
|
578
|
+
margin-top: 2rem;
|
|
579
|
+
text-align: center;
|
|
580
|
+
}
|
|
581
|
+
|
|
450
582
|
.m-purchase-pay-main {
|
|
451
583
|
/* 左侧特权侧边栏 - 增加了图片背景风格 */
|
|
452
584
|
.modal-sidebar {
|
|
@@ -479,27 +611,6 @@ export default {
|
|
|
479
611
|
position: relative;
|
|
480
612
|
}
|
|
481
613
|
|
|
482
|
-
.pay-method-btn {
|
|
483
|
-
border: 2px solid rgba(255, 255, 255, 0.05);
|
|
484
|
-
transition: all 0.3s;
|
|
485
|
-
}
|
|
486
|
-
.pay-method-btn.active.wechat {
|
|
487
|
-
border-color: #10b981;
|
|
488
|
-
background: rgba(16, 185, 129, 0.05);
|
|
489
|
-
}
|
|
490
|
-
.pay-method-btn.active.alipay {
|
|
491
|
-
border-color: #3b82f6;
|
|
492
|
-
background: rgba(59, 130, 246, 0.05);
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
.qr-wrapper {
|
|
496
|
-
background: white;
|
|
497
|
-
padding: 12px;
|
|
498
|
-
border-radius: 24px;
|
|
499
|
-
position: relative;
|
|
500
|
-
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
|
|
501
|
-
}
|
|
502
|
-
|
|
503
614
|
.badge-discount {
|
|
504
615
|
position: absolute;
|
|
505
616
|
top: -10px;
|
package/src/main.js
CHANGED