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