@2kog/pkg-widget 0.1.15 → 0.1.16
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 +144 -41
- 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.16",
|
|
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="
|
|
52
|
+
class="placeholder-icon"
|
|
58
53
|
:class="currentPaymentMethod?.icon || 'fas fa-qrcode text-gray-400'"
|
|
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>
|
|
@@ -447,6 +442,135 @@ 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
|
+
.pay-method-btn.active.wechat {
|
|
481
|
+
border-color: #10b981;
|
|
482
|
+
background: rgba(16, 185, 129, 0.05);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
.pay-method-btn.active.alipay {
|
|
486
|
+
border-color: #3b82f6;
|
|
487
|
+
background: rgba(59, 130, 246, 0.05);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
.qrcode-container {
|
|
491
|
+
display: flex;
|
|
492
|
+
flex-direction: column;
|
|
493
|
+
align-items: center;
|
|
494
|
+
justify-content: center;
|
|
495
|
+
position: relative;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
.qr-wrapper {
|
|
499
|
+
background: white;
|
|
500
|
+
padding: 12px;
|
|
501
|
+
border-radius: 24px;
|
|
502
|
+
position: relative;
|
|
503
|
+
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
.qrcode-box {
|
|
507
|
+
width: 11rem;
|
|
508
|
+
height: 11rem;
|
|
509
|
+
background-color: #f9fafb;
|
|
510
|
+
border-radius: 0.75rem;
|
|
511
|
+
display: flex;
|
|
512
|
+
align-items: center;
|
|
513
|
+
justify-content: center;
|
|
514
|
+
padding: 0.5rem;
|
|
515
|
+
position: relative;
|
|
516
|
+
overflow: hidden;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
.loading-overlay {
|
|
520
|
+
position: absolute;
|
|
521
|
+
top: 0;
|
|
522
|
+
right: 0;
|
|
523
|
+
bottom: 0;
|
|
524
|
+
left: 0;
|
|
525
|
+
display: flex;
|
|
526
|
+
align-items: center;
|
|
527
|
+
justify-content: center;
|
|
528
|
+
background-color: white;
|
|
529
|
+
border-radius: 0.75rem;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
.loading-icon {
|
|
533
|
+
font-size: 1.875rem;
|
|
534
|
+
color: #9ca3af;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
.qrcode-image {
|
|
538
|
+
width: 100%;
|
|
539
|
+
height: 100%;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
.placeholder-icon {
|
|
543
|
+
font-size: 4.5rem;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
.secure-badge {
|
|
547
|
+
margin-top: 1.5rem;
|
|
548
|
+
display: flex;
|
|
549
|
+
align-items: center;
|
|
550
|
+
gap: 0.5rem;
|
|
551
|
+
color: #9ca3af;
|
|
552
|
+
font-size: 0.75rem;
|
|
553
|
+
background-color: rgba(255, 255, 255, 0.05);
|
|
554
|
+
padding: 0.5rem 1rem;
|
|
555
|
+
border-radius: 9999px;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
.secure-icon {
|
|
559
|
+
color: #10b981;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
.error-message {
|
|
563
|
+
margin-top: 1rem;
|
|
564
|
+
color: #f87171;
|
|
565
|
+
font-size: 0.75rem;
|
|
566
|
+
text-align: center;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
.footer-slot {
|
|
570
|
+
margin-top: 2rem;
|
|
571
|
+
text-align: center;
|
|
572
|
+
}
|
|
573
|
+
|
|
450
574
|
.m-purchase-pay-main {
|
|
451
575
|
/* 左侧特权侧边栏 - 增加了图片背景风格 */
|
|
452
576
|
.modal-sidebar {
|
|
@@ -479,27 +603,6 @@ export default {
|
|
|
479
603
|
position: relative;
|
|
480
604
|
}
|
|
481
605
|
|
|
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
606
|
.badge-discount {
|
|
504
607
|
position: absolute;
|
|
505
608
|
top: -10px;
|
package/src/main.js
CHANGED