samlax12 commited on
Commit
a838f61
·
verified ·
1 Parent(s): 0209fdb

Create index1.html

Browse files
Files changed (1) hide show
  1. index1.html +722 -0
index1.html ADDED
@@ -0,0 +1,722 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
6
+ <title>💖 收款 💖</title>
7
+ <style>
8
+ * {
9
+ margin: 0;
10
+ padding: 0;
11
+ box-sizing: border-box;
12
+ }
13
+
14
+ body {
15
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
16
+ background: linear-gradient(135deg, #fff4e6 0%, #ffe8d1 35%, #ffd4a3 100%);
17
+ min-height: 100vh;
18
+ color: #5a4a5a;
19
+ -webkit-user-select: none;
20
+ -moz-user-select: none;
21
+ -ms-user-select: none;
22
+ user-select: none;
23
+ }
24
+
25
+ .container {
26
+ max-width: 480px;
27
+ margin: 0 auto;
28
+ padding: 15px;
29
+ min-height: 100vh;
30
+ display: flex;
31
+ flex-direction: column;
32
+ }
33
+
34
+ .header {
35
+ text-align: center;
36
+ margin-bottom: 20px;
37
+ padding-top: 10px;
38
+ }
39
+
40
+ .header h1 {
41
+ font-size: 24px;
42
+ color: #ff8c42;
43
+ font-weight: 600;
44
+ text-shadow: 2px 2px 4px rgba(255, 140, 66, 0.3);
45
+ }
46
+
47
+ .profile-card {
48
+ background: rgba(255, 255, 255, 0.9);
49
+ border-radius: 20px;
50
+ padding: 20px;
51
+ box-shadow: 0 8px 32px rgba(255, 140, 66, 0.2);
52
+ backdrop-filter: blur(10px);
53
+ margin-bottom: 20px;
54
+ text-align: center;
55
+ display: flex;
56
+ align-items: center;
57
+ gap: 15px;
58
+ }
59
+
60
+ .avatar-wrapper {
61
+ position: relative;
62
+ flex-shrink: 0;
63
+ }
64
+
65
+ .avatar {
66
+ width: 60px;
67
+ height: 60px;
68
+ border-radius: 50%;
69
+ overflow: hidden;
70
+ box-shadow: 0 4px 15px rgba(255, 140, 66, 0.4);
71
+ background: #ffe8d1;
72
+ }
73
+
74
+ .avatar img {
75
+ width: 100%;
76
+ height: 100%;
77
+ object-fit: cover;
78
+ }
79
+
80
+ .sparkle {
81
+ position: absolute;
82
+ color: #ffab73;
83
+ font-size: 16px;
84
+ animation: sparkle 2s ease-in-out infinite;
85
+ }
86
+
87
+ .sparkle:nth-child(2) { top: -8px; right: -8px; animation-delay: 0.3s; }
88
+ .sparkle:nth-child(3) { bottom: -8px; left: -8px; animation-delay: 0.6s; }
89
+
90
+ @keyframes sparkle {
91
+ 0%, 100% { opacity: 0; transform: scale(0.8); }
92
+ 50% { opacity: 1; transform: scale(1.2); }
93
+ }
94
+
95
+ .profile-info {
96
+ text-align: left;
97
+ flex: 1;
98
+ }
99
+
100
+ .profile-info h2 {
101
+ font-size: 18px;
102
+ color: #ff8c42;
103
+ margin-bottom: 3px;
104
+ }
105
+
106
+ .profile-info p {
107
+ color: #a8a8a8;
108
+ font-size: 14px;
109
+ }
110
+
111
+ .amount-section {
112
+ background: rgba(255, 255, 255, 0.95);
113
+ border-radius: 20px;
114
+ padding: 20px 15px;
115
+ box-shadow: 0 8px 32px rgba(255, 140, 66, 0.2);
116
+ backdrop-filter: blur(10px);
117
+ flex: 1;
118
+ display: flex;
119
+ flex-direction: column;
120
+ }
121
+
122
+ .amount-display {
123
+ text-align: center;
124
+ margin-bottom: 20px;
125
+ }
126
+
127
+ .amount-label {
128
+ font-size: 13px;
129
+ color: #ff9966;
130
+ margin-bottom: 8px;
131
+ font-weight: 500;
132
+ }
133
+
134
+ .amount-value {
135
+ font-size: 36px;
136
+ font-weight: 700;
137
+ background: linear-gradient(135deg, #ff8c42 0%, #ff9966 100%);
138
+ -webkit-background-clip: text;
139
+ -webkit-text-fill-color: transparent;
140
+ background-clip: text;
141
+ }
142
+
143
+ .payment-items {
144
+ display: grid;
145
+ grid-template-columns: repeat(2, 1fr);
146
+ gap: 10px;
147
+ margin-bottom: 20px;
148
+ flex: 1;
149
+ align-content: start;
150
+ grid-auto-rows: min-content;
151
+ }
152
+
153
+ .payment-item {
154
+ background: rgba(255, 245, 235, 0.8);
155
+ padding: 12px;
156
+ border-radius: 12px;
157
+ text-align: center;
158
+ cursor: pointer;
159
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
160
+ border: 2px solid transparent;
161
+ position: relative;
162
+ overflow: hidden;
163
+ }
164
+
165
+ .payment-item:hover {
166
+ transform: translateY(-2px);
167
+ box-shadow: 0 4px 12px rgba(255, 140, 66, 0.25);
168
+ }
169
+
170
+ .payment-item.active {
171
+ border-color: #ff9966;
172
+ box-shadow: 0 0 0 3px rgba(255, 153, 102, 0.15);
173
+ }
174
+
175
+ .payment-item .emoji {
176
+ font-size: 20px;
177
+ margin-bottom: 6px;
178
+ display: block;
179
+ filter: drop-shadow(2px 2px 4px rgba(255, 140, 66, 0.3));
180
+ transition: transform 0.3s ease;
181
+ }
182
+
183
+ .payment-item:hover .emoji {
184
+ transform: scale(1.1);
185
+ }
186
+
187
+ .payment-item .price {
188
+ font-size: 15px;
189
+ font-weight: 600;
190
+ color: #ff8c42;
191
+ }
192
+
193
+ .payment-item .quantity {
194
+ position: absolute;
195
+ top: 50%;
196
+ right: 5px;
197
+ transform: translateY(-50%);
198
+ background: #ff9966;
199
+ color: white;
200
+ padding: 1px 6px;
201
+ border-radius: 8px;
202
+ font-size: 11px;
203
+ font-weight: 600;
204
+ min-width: 20px;
205
+ text-align: center;
206
+ }
207
+
208
+ .note-section {
209
+ margin-bottom: 15px;
210
+ }
211
+
212
+ .note-label {
213
+ font-size: 13px;
214
+ color: #ff9966;
215
+ margin-bottom: 6px;
216
+ font-weight: 500;
217
+ }
218
+
219
+ .note-input {
220
+ width: 100%;
221
+ padding: 10px 12px;
222
+ border: 2px solid #ffe8d1;
223
+ border-radius: 10px;
224
+ font-size: 14px;
225
+ background: rgba(255, 255, 255, 0.8);
226
+ transition: all 0.3s ease;
227
+ color: #5a4a5a;
228
+ -webkit-user-select: text;
229
+ -moz-user-select: text;
230
+ -ms-user-select: text;
231
+ user-select: text;
232
+ }
233
+
234
+ .note-input:focus {
235
+ outline: none;
236
+ border-color: #ffab73;
237
+ background: white;
238
+ box-shadow: 0 0 0 3px rgba(255, 171, 115, 0.2);
239
+ }
240
+
241
+ .note-input::placeholder {
242
+ color: #d4a574;
243
+ }
244
+
245
+ .pay-button {
246
+ background: linear-gradient(135deg, #ff8c42 0%, #ff9966 100%);
247
+ color: white;
248
+ border: none;
249
+ padding: 14px 30px;
250
+ font-size: 16px;
251
+ font-weight: 600;
252
+ border-radius: 25px;
253
+ cursor: pointer;
254
+ width: 100%;
255
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
256
+ box-shadow: 0 4px 15px rgba(255, 140, 66, 0.4);
257
+ position: relative;
258
+ overflow: hidden;
259
+ }
260
+
261
+ .pay-button::before {
262
+ content: '';
263
+ position: absolute;
264
+ top: 50%;
265
+ left: 50%;
266
+ width: 0;
267
+ height: 0;
268
+ background: rgba(255, 255, 255, 0.3);
269
+ border-radius: 50%;
270
+ transform: translate(-50%, -50%);
271
+ transition: width 0.6s, height 0.6s;
272
+ }
273
+
274
+ .pay-button:hover::before {
275
+ width: 300px;
276
+ height: 300px;
277
+ }
278
+
279
+ .pay-button:hover {
280
+ transform: translateY(-2px);
281
+ box-shadow: 0 6px 20px rgba(255, 140, 66, 0.5);
282
+ }
283
+
284
+ .pay-button:active {
285
+ transform: translateY(0);
286
+ }
287
+
288
+ /* 模态框样式 */
289
+ .modal {
290
+ display: none;
291
+ position: fixed;
292
+ top: 0;
293
+ left: 0;
294
+ width: 100%;
295
+ height: 100%;
296
+ background: rgba(255, 171, 115, 0.95);
297
+ backdrop-filter: blur(10px);
298
+ z-index: 1000;
299
+ align-items: center;
300
+ justify-content: center;
301
+ }
302
+
303
+ .modal-content {
304
+ background: white;
305
+ padding: 30px 25px;
306
+ border-radius: 25px;
307
+ text-align: center;
308
+ max-width: 320px;
309
+ width: 90%;
310
+ box-shadow: 0 20px 60px rgba(255, 140, 66, 0.3);
311
+ position: relative;
312
+ animation: modalFadeIn 0.4s ease-out;
313
+ }
314
+
315
+ @keyframes modalFadeIn {
316
+ from {
317
+ opacity: 0;
318
+ transform: scale(0.9) translateY(20px);
319
+ }
320
+ to {
321
+ opacity: 1;
322
+ transform: scale(1) translateY(0);
323
+ }
324
+ }
325
+
326
+ .modal-title {
327
+ font-size: 18px;
328
+ color: #ff8c42;
329
+ margin-bottom: 15px;
330
+ font-weight: 600;
331
+ }
332
+
333
+ .qr-wrapper {
334
+ position: relative;
335
+ display: inline-block;
336
+ padding: 12px;
337
+ background: linear-gradient(135deg, #fff5eb 0%, #ffe8d1 100%);
338
+ border-radius: 18px;
339
+ margin-bottom: 15px;
340
+ }
341
+
342
+ .qr-code-image {
343
+ width: 180px;
344
+ height: 180px;
345
+ border-radius: 12px;
346
+ overflow: hidden;
347
+ box-shadow: 0 4px 15px rgba(255, 140, 66, 0.3);
348
+ }
349
+
350
+ .qr-code-image img {
351
+ width: 100%;
352
+ height: 100%;
353
+ display: block;
354
+ }
355
+
356
+ .payment-tips {
357
+ font-size: 13px;
358
+ color: #a8a8a8;
359
+ line-height: 1.5;
360
+ margin-bottom: 15px;
361
+ }
362
+
363
+ .payment-amount-display {
364
+ font-size: 22px;
365
+ color: #ff8c42;
366
+ font-weight: 600;
367
+ margin: 10px 0;
368
+ }
369
+
370
+ .close-button {
371
+ position: absolute;
372
+ top: 12px;
373
+ right: 12px;
374
+ width: 32px;
375
+ height: 32px;
376
+ border-radius: 50%;
377
+ background: #ffe8d1;
378
+ border: none;
379
+ cursor: pointer;
380
+ display: flex;
381
+ align-items: center;
382
+ justify-content: center;
383
+ font-size: 18px;
384
+ color: #ff9966;
385
+ transition: all 0.3s ease;
386
+ }
387
+
388
+ .close-button:hover {
389
+ background: #ffab73;
390
+ color: white;
391
+ transform: rotate(90deg);
392
+ }
393
+
394
+ /* 使用说明样式 */
395
+ .usage-tip {
396
+ font-size: 12px;
397
+ color: #d4a574;
398
+ text-align: center;
399
+ margin-top: 10px;
400
+ opacity: 0.8;
401
+ }
402
+
403
+ /* 装饰元素 */
404
+ .decoration {
405
+ position: fixed;
406
+ pointer-events: none;
407
+ opacity: 0.5;
408
+ animation: float 6s ease-in-out infinite;
409
+ font-size: 20px;
410
+ }
411
+
412
+ .decoration:nth-child(1) { top: 10%; left: 5%; animation-delay: 0s; }
413
+ .decoration:nth-child(2) { top: 20%; right: 5%; animation-delay: 1s; }
414
+ .decoration:nth-child(3) { bottom: 20%; left: 10%; animation-delay: 2s; }
415
+ .decoration:nth-child(4) { bottom: 10%; right: 10%; animation-delay: 3s; }
416
+
417
+ @keyframes float {
418
+ 0%, 100% { transform: translateY(0) rotate(0deg); }
419
+ 50% { transform: translateY(-15px) rotate(10deg); }
420
+ }
421
+
422
+ /* 响应式优化 */
423
+ @media (max-height: 700px) {
424
+ .container {
425
+ padding: 10px;
426
+ }
427
+ .header {
428
+ margin-bottom: 15px;
429
+ padding-top: 5px;
430
+ }
431
+ .header h1 {
432
+ font-size: 22px;
433
+ }
434
+ .profile-card {
435
+ padding: 15px;
436
+ margin-bottom: 15px;
437
+ }
438
+ .avatar {
439
+ width: 50px;
440
+ height: 50px;
441
+ }
442
+ .amount-section {
443
+ padding: 15px 12px;
444
+ }
445
+ .amount-value {
446
+ font-size: 32px;
447
+ }
448
+ .payment-items {
449
+ gap: 8px;
450
+ }
451
+ .payment-item {
452
+ padding: 10px;
453
+ }
454
+ }
455
+
456
+ @media (max-height: 600px) {
457
+ .amount-display {
458
+ margin-bottom: 15px;
459
+ }
460
+ .payment-items {
461
+ margin-bottom: 15px;
462
+ }
463
+ .note-section {
464
+ margin-bottom: 12px;
465
+ }
466
+ .pay-button {
467
+ padding: 12px 25px;
468
+ font-size: 15px;
469
+ }
470
+ }
471
+ </style>
472
+ </head>
473
+ <body>
474
+ <!-- 装饰元素 -->
475
+ <div class="decoration">🧡</div>
476
+ <div class="decoration">✨</div>
477
+ <div class="decoration">🍊</div>
478
+ <div class="decoration">🌟</div>
479
+
480
+ <div class="container">
481
+ <div class="header">
482
+ <h1>ଘ(੭ˊ꒳ˋ)੭ 收款页面</h1>
483
+ </div>
484
+
485
+ <div class="profile-card">
486
+ <div class="avatar-wrapper">
487
+ <div class="avatar">
488
+ <!-- 自定义头像图片 -->
489
+ <img src="avatar.jpg" alt="头像" onerror="this.style.display='none'; this.parentElement.innerHTML='👧';">
490
+ </div>
491
+ <span class="sparkle">✨</span>
492
+ <span class="sparkle">✨</span>
493
+ </div>
494
+ <div class="profile-info">
495
+ <h2>给小可爱的打赏</h2>
496
+ <p>鱼习习(**怡)</p>
497
+ </div>
498
+ </div>
499
+
500
+ <div class="amount-section">
501
+ <div class="amount-display">
502
+ <div class="amount-label">打赏金额</div>
503
+ <div class="amount-value">¥<span id="totalAmount">1.00</span></div>
504
+ </div>
505
+
506
+ <div class="payment-items">
507
+ <div class="payment-item active" data-amount="1.00" onclick="selectItem(this)">
508
+ <span class="emoji">⊂(˃̶͈̀ε ˂̶͈́ ⊂ )</span>
509
+ <div class="price">¥1.00</div>
510
+ <span class="quantity">×1</span>
511
+ </div>
512
+ <div class="payment-item" data-amount="5.20" onclick="selectItem(this)">
513
+ <span class="emoji">ฅ՞•ﻌ•՞ฅ</span>
514
+ <div class="price">¥5.20</div>
515
+ </div>
516
+ <div class="payment-item" data-amount="6.66" onclick="selectItem(this)">
517
+ <span class="emoji">૮₍ ˃ ⤙ ˂ ₎ა</span>
518
+ <div class="price">¥6.66</div>
519
+ </div>
520
+ <div class="payment-item" data-amount="8.88" onclick="selectItem(this)">
521
+ <span class="emoji">(´・(oo)・`)</span>
522
+ <div class="price">¥8.88</div>
523
+ </div>
524
+ <div class="payment-item" data-amount="13.14" onclick="selectItem(this)">
525
+ <span class="emoji">((づ ̄ ³ ̄)づ</span>
526
+ <div class="price">¥13.14</div>
527
+ </div>
528
+ <div class="payment-item" data-amount="52.00" onclick="selectItem(this)">
529
+ <span class="emoji">(。・ω・。)ノ♡</span>
530
+ <div class="price">¥52.00</div>
531
+ </div>
532
+ </div>
533
+
534
+ <div class="usage-tip">
535
+ 点击选择项目 | 长按或右键减少数量
536
+ </div>
537
+
538
+ <div class="note-section">
539
+ <div class="note-label">💌 留言</div>
540
+ <input type="text" class="note-input" placeholder="写点什么暖心的话吧~ ♡">
541
+ </div>
542
+
543
+ <button class="pay-button" onclick="showPayment()">
544
+ 🧡 确认打赏 🧡
545
+ </button>
546
+ </div>
547
+ </div>
548
+
549
+ <!-- 支付模态框 -->
550
+ <div class="modal" id="paymentModal">
551
+ <div class="modal-content">
552
+ <button class="close-button" onclick="closeModal()">×</button>
553
+ <h3 class="modal-title">扫码支付 (。・ω・。)ノ♡</h3>
554
+ <div class="qr-wrapper">
555
+ <div class="qr-code-image">
556
+ <!-- 微信赞赏码 -->
557
+ <img src="wechat_pay.jpg" alt="赞赏码" onerror="this.src='data:image/svg+xml,%3Csvg xmlns=\'http://www.w3.org/2000/svg\' width=\'180\' height=\'180\' viewBox=\'0 0 180 180\'%3E%3Crect width=\'180\' height=\'180\' fill=\'%23ffe8d1\'/%3E%3Ctext x=\'90\' y=\'90\' text-anchor=\'middle\' dy=\'.3em\' font-size=\'13\' fill=\'%23ff9966\'%3E请添加赞赏码%3C/text%3E%3C/svg%3E'">
558
+ </div>
559
+ </div>
560
+ <div class="payment-amount-display">
561
+ ¥<span id="modalAmount">0.00</span>
562
+ </div>
563
+ <p class="payment-tips">
564
+ 请使用微信扫描上方二维码<br>
565
+ 完成支付 ~ 感谢您的支持<br>
566
+ ଘ(੭ˊ꒳ˋ)੭
567
+ </p>
568
+ </div>
569
+ </div>
570
+
571
+ <script>
572
+ let selectedItems = new Set();
573
+ let itemQuantities = {};
574
+
575
+ // 初始化第一个项目
576
+ selectedItems.add('1.00');
577
+ itemQuantities['1.00'] = 1;
578
+
579
+ function selectItem(element) {
580
+ const amount = element.dataset.amount;
581
+
582
+ if (selectedItems.has(amount)) {
583
+ // 已选中的项目,增加数量
584
+ itemQuantities[amount] = (itemQuantities[amount] || 1) + 1;
585
+
586
+ // 更新数量显示
587
+ const qtyElement = element.querySelector('.quantity');
588
+ if (qtyElement) {
589
+ qtyElement.textContent = `×${itemQuantities[amount]}`;
590
+ }
591
+ } else {
592
+ // 新选中项目
593
+ element.classList.add('active');
594
+ selectedItems.add(amount);
595
+ itemQuantities[amount] = 1;
596
+
597
+ const span = document.createElement('span');
598
+ span.className = 'quantity';
599
+ span.textContent = '×1';
600
+ element.appendChild(span);
601
+ }
602
+
603
+ updateTotalAmount();
604
+ }
605
+
606
+ // 添加长按或右键点击来减少数量的功能
607
+ function handleRightClick(element, event) {
608
+ event.preventDefault(); // 阻止默认的右键菜单
609
+ const amount = element.dataset.amount;
610
+
611
+ if (selectedItems.has(amount) && itemQuantities[amount] > 0) {
612
+ if (itemQuantities[amount] === 1) {
613
+ // 如果数量为1,取消选择
614
+ element.classList.remove('active');
615
+ selectedItems.delete(amount);
616
+ delete itemQuantities[amount];
617
+
618
+ // 移除数量标签
619
+ const qtyElement = element.querySelector('.quantity');
620
+ if (qtyElement) {
621
+ qtyElement.remove();
622
+ }
623
+ } else {
624
+ // 数量大于1,减少数量
625
+ itemQuantities[amount]--;
626
+ const qtyElement = element.querySelector('.quantity');
627
+ if (qtyElement) {
628
+ qtyElement.textContent = `×${itemQuantities[amount]}`;
629
+ }
630
+ }
631
+
632
+ // 确保至少有一个项目被选中
633
+ if (selectedItems.size === 0) {
634
+ const firstItem = document.querySelector('.payment-item');
635
+ firstItem.classList.add('active');
636
+ const firstAmount = firstItem.dataset.amount;
637
+ selectedItems.add(firstAmount);
638
+ itemQuantities[firstAmount] = 1;
639
+
640
+ const span = document.createElement('span');
641
+ span.className = 'quantity';
642
+ span.textContent = '×1';
643
+ firstItem.appendChild(span);
644
+ }
645
+
646
+ updateTotalAmount();
647
+ }
648
+ }
649
+
650
+ // 初始化事件监听
651
+ document.addEventListener('DOMContentLoaded', function() {
652
+ // 为所有付款项目添加右键点击事件
653
+ document.querySelectorAll('.payment-item').forEach(item => {
654
+ item.addEventListener('contextmenu', function(e) {
655
+ handleRightClick(this, e);
656
+ });
657
+
658
+ // 添加长按事件(移动端)
659
+ let pressTimer;
660
+ item.addEventListener('touchstart', function(e) {
661
+ pressTimer = setTimeout(() => {
662
+ handleRightClick(this, e);
663
+ // 添加触觉反馈(如果设备支持)
664
+ if (navigator.vibrate) {
665
+ navigator.vibrate(50);
666
+ }
667
+ }, 2000); // 2000毫秒(2秒)长按
668
+ });
669
+
670
+ item.addEventListener('touchend', function() {
671
+ clearTimeout(pressTimer);
672
+ });
673
+
674
+ item.addEventListener('touchmove', function() {
675
+ clearTimeout(pressTimer);
676
+ });
677
+ });
678
+ });
679
+
680
+ function updateTotalAmount() {
681
+ let total = 0;
682
+ selectedItems.forEach(amount => {
683
+ total += parseFloat(amount) * (itemQuantities[amount] || 1);
684
+ });
685
+ document.getElementById('totalAmount').textContent = total.toFixed(2);
686
+ document.getElementById('modalAmount').textContent = total.toFixed(2);
687
+ }
688
+
689
+ function showPayment() {
690
+ document.getElementById('paymentModal').style.display = 'flex';
691
+ setTimeout(() => {
692
+ document.querySelector('.modal-content').style.animation = 'modalFadeIn 0.4s ease-out';
693
+ }, 10);
694
+ }
695
+
696
+ function closeModal() {
697
+ const modal = document.getElementById('paymentModal');
698
+ modal.style.display = 'none';
699
+ }
700
+
701
+ // 点击模态框背景关闭
702
+ document.getElementById('paymentModal').addEventListener('click', function(e) {
703
+ if (e.target === this) {
704
+ closeModal();
705
+ }
706
+ });
707
+
708
+ // 初始化总金额
709
+ updateTotalAmount();
710
+
711
+ // 添加交互效果
712
+ document.querySelectorAll('.payment-item').forEach(item => {
713
+ item.addEventListener('mouseenter', function() {
714
+ this.querySelector('.emoji').style.transform = 'scale(1.1)';
715
+ });
716
+ item.addEventListener('mouseleave', function() {
717
+ this.querySelector('.emoji').style.transform = 'scale(1)';
718
+ });
719
+ });
720
+ </script>
721
+ </body>
722
+ </html>