Repository navigation
Expand file tree
/
Copy pathpreview.html
More file actions
executable file
·921 lines (880 loc) · 47.8 KB
/
Copy pathpreview.html
File metadata and controls
executable file
·921 lines (880 loc) · 47.8 KB
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
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>WeChat Ordering Menu · 最新预览</title>
<style>
:root {
--bg: #FAFAFC;
--glass: rgba(255,255,255,0.78);
--glass-strong: rgba(255,255,255,0.92);
--glass-border: rgba(0,0,0,0.06);
--label: #1C1C1E;
--label-2: rgba(60,60,67,0.6);
--label-3: rgba(60,60,67,0.3);
--separator: rgba(0,0,0,0.1);
--accent: #007AFF;
--accent-deep: #0062CC;
--glow: rgba(236,72,153,0.25);
--radius: 28rpx;
}
* { margin:0; padding:0; box-sizing:border-box; }
body {
background: #E9E9F0;
font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
color: var(--label);
min-height: 100vh;
display:flex; flex-direction:column; align-items:center;
padding: 26px 0 40px;
-webkit-font-smoothing: antialiased;
}
body::before {
content: "📱 WeChat Ordering Menu · 微信点餐(液态玻璃版)";
font-size: 12px; color:#8E8E98; margin-bottom:14px; font-weight:600; letter-spacing:.4px;
}
.phone {
width: 390px; height: 800px; position:relative;
background: var(--bg);
border-radius: 44px; border: 9px solid #1c1c1e;
overflow:hidden; display:flex; flex-direction:column;
box-shadow: 0 30px 70px rgba(0,0,0,0.30);
}
.notch {
position:absolute; top:0; left:50%; transform:translateX(-50%);
width:140px; height:28px; background:#1c1c1e;
border-radius:0 0 20px 20px; z-index:100;
}
/* 极光背景 */
.bg-decor {
position:absolute; inset:0; z-index:0; pointer-events:none;
background:
radial-gradient(270px 270px at 18% 12%, rgba(10,132,255,0.14), transparent 62%),
radial-gradient(290px 290px at 82% 8%, rgba(236,72,153,0.12), transparent 62%),
radial-gradient(320px 320px at 50% 88%, rgba(124,58,237,0.10), transparent 62%),
radial-gradient(160px 160px at -40px 220px, rgba(10,132,255,0.16), transparent 65%),
radial-gradient(125px 125px at 420px 340px, rgba(236,72,153,0.14), transparent 65%),
radial-gradient(175px 175px at 90px 640px, rgba(124,58,237,0.12), transparent 65%),
linear-gradient(180deg, #FFFFFF 0%, #F6F6FB 100%);
}
.screen { position:relative; z-index:1; flex:1; overflow:hidden; }
.page {
position:absolute; inset:0; overflow-y:auto; display:none;
padding-bottom: 110px; -webkit-overflow-scrolling:touch;
}
.page.active { display:block; }
.page::-webkit-scrollbar { display:none; }
/* ===== 顶部导航胶囊 ===== */
.nb-capsule { position:sticky; top:0; z-index:90; padding-top:34px; }
.nb-pill {
position:relative; height:44px; margin:4px 14px 0; border-radius:999px;
display:flex; align-items:center; justify-content:center;
background: rgba(255,255,255,0.60);
backdrop-filter: blur(24px) saturate(160%); -webkit-backdrop-filter: blur(24px) saturate(160%);
border:1px solid rgba(255,255,255,0.9);
box-shadow:
inset 0 1px 2px rgba(255,255,255,0.95),
inset 0 -7px 10px rgba(0,0,0,0.07),
0 8px 24px rgba(0,0,0,0.10),
0 0 20px rgba(10,132,255,0.16);
overflow:hidden;
}
.nb-pill::after {
content:''; position:absolute; inset:0; border-radius:inherit; pointer-events:none; z-index:2;
background: linear-gradient(180deg, rgba(255,255,255,0.42), rgba(255,255,255,0.10) 55%, transparent);
box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.7), inset 0 2px 3px rgba(255,255,255,0.5);
}
.nb-title { position:relative; z-index:3; font-size:17px; font-weight:600; text-shadow:0 1px 8px rgba(255,255,255,0.9); }
.nb-back { position:absolute; left:4px; width:44px; height:44px; display:flex; align-items:center; justify-content:center; font-size:30px; color:#0A84FF; z-index:4; cursor:pointer; }
/* 流动烟雾模拟 */
.flux { position:absolute; inset:0; border-radius:inherit; z-index:1; opacity:.55; pointer-events:none; overflow:hidden;
background:
radial-gradient(60px 30px at 20% 50%, rgba(10,132,255,.35), transparent 70%),
radial-gradient(70px 34px at 60% 60%, rgba(236,72,153,.30), transparent 70%),
radial-gradient(55px 26px at 85% 40%, rgba(124,58,237,.28), transparent 70%);
filter: blur(6px);
animation: fluxMove 7s ease-in-out infinite alternate;
}
@keyframes fluxMove {
0% { transform: translateX(-6%) scale(1); opacity:.5; }
100% { transform: translateX(6%) scale(1.15); opacity:.7; }
}
/* ===== 头部 ===== */
.appbar { padding: 14px 16px 8px; }
.header-row { display:flex; justify-content:space-between; align-items:center; gap:10px; }
.header-left { flex:1; min-width:0; }
.greet { font-size:15px; color:#48484A; font-weight:500; letter-spacing:.5px; margin-bottom:2px; }
.headline { position:relative; display:inline-block; font-size:32px; font-weight:700; letter-spacing:-.5px; line-height:1.12; }
.headline .hl { position:absolute; left:0; right:-4px; bottom:3px; height:10px; border-radius:6px;
background: linear-gradient(90deg, rgba(10,132,255,0.20), rgba(236,72,153,0.18)); }
.headline text { position:relative; z-index:1; }
.sub { font-size:14px; color:#48484A; margin-top:4px; }
/* 右侧入口 */
.entry-btns { display:flex; gap:6px; flex-shrink:0; }
.entry {
position:relative; display:flex; flex-direction:column; align-items:center;
background: rgba(255,255,255,0.45);
backdrop-filter: blur(16px) saturate(200%); -webkit-backdrop-filter: blur(16px) saturate(200%);
border:1px solid rgba(255,255,255,0.7); border-radius:999px;
padding:8px 13px;
box-shadow: inset 0 0 0 1px rgba(255,255,255,0.8), inset 0 1px 3px rgba(255,255,255,0.7),
0 8px 24px rgba(0,0,0,0.1), 0 0 20px rgba(10,132,255,0.2);
cursor:pointer; transition: transform .16s cubic-bezier(.23,1,.32,1);
}
.entry:active { transform: scale(.96); }
.entry::before { content:''; position:absolute; inset:0; border-radius:inherit; pointer-events:none;
background: linear-gradient(135deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.4) 33%, rgba(255,255,255,0.7) 66%, rgba(255,255,255,0) 100%); }
.e-ico { font-size:20px; line-height:1; }
.e-label { font-size:10px; color:var(--label-2); margin-top:3px; }
.entry-badge { position:absolute; top:-4px; right:-4px; z-index:5; background:var(--accent); color:#fff;
font-size:10px; font-weight:700; border-radius:999px; padding:1px 6px; display:none; }
.entry-badge.show { display:block; }
.entry-badge.bounce { animation: badge-bounce .4s ease; }
@keyframes badge-bounce { 0%{transform:scale(1);} 40%{transform:scale(1.5);} 100%{transform:scale(1);} }
/* 分类 segment */
.segment { display:flex; margin:10px 16px 14px; gap:6px; }
.seg {
flex:1; padding:8px 0; font-size:12px; color:#48484A; text-align:center; cursor:pointer;
display:flex; align-items:center; justify-content:center; gap:4px;
border-radius:999px; background: rgba(255,255,255,0.42); border:1px solid rgba(255,255,255,0.7);
box-shadow: inset 0 0 0 1px rgba(255,255,255,0.8), inset 0 1px 3px rgba(255,255,255,0.6), 0 4px 12px rgba(0,0,0,0.05);
transition: background .25s, box-shadow .25s, color .25s, transform .25s;
white-space:nowrap;
}
.seg.on {
color:#1C1C1E; font-weight:600;
background: rgba(255,255,255,0.78); border-color: rgba(255,255,255,0.9);
box-shadow: inset 0 1px 3px rgba(255,255,255,0.85), 0 4px 14px rgba(0,0,0,0.08), 0 0 18px rgba(10,132,255,0.30);
transform: translateY(-1px);
}
.seg-ico { font-size:15px; line-height:1; }
/* 菜品分组列表 */
.grouped {
position:relative; margin: 10px 16px 0;
background: rgba(255,255,255,0.95);
backdrop-filter: saturate(150%) blur(22px); -webkit-backdrop-filter: saturate(150%) blur(22px);
border-radius: 20px; overflow:hidden;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.28), 0 16px 44px rgba(0,0,0,0.08), 0 28px 60px var(--glow);
}
.grouped::before { content:''; position:absolute; inset:0; border-radius:inherit; pointer-events:none;
background: linear-gradient(135deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.22) 35%, rgba(255,255,255,0.45) 65%, rgba(255,255,255,0) 100%); }
.grow {
display:flex; align-items:center; padding:13px 14px; border-bottom:1px solid var(--separator);
cursor:pointer; position:relative; z-index:1;
}
.grow:last-child { border-bottom:none; }
.grow:active { background: rgba(0,0,0,0.03); }
.grouped.enter .grow { animation: row-in .32s cubic-bezier(.23,1,.32,1) both; }
@keyframes row-in { from{opacity:0; transform:translateY(7px);} to{opacity:1; transform:translateY(0);} }
.grow-emoji {
width:46px; height:46px; border-radius:50%; display:flex; align-items:center; justify-content:center;
font-size:26px; flex-shrink:0;
box-shadow: inset 0 2px 4px rgba(255,255,255,0.9), 0 8px 20px rgba(0,0,0,0.08);
}
.t0 { background: linear-gradient(135deg,#FFE8D6,#FFD0C2); }
.t1 { background: linear-gradient(135deg,#D8F3E3,#BFE8D8); }
.t2 { background: linear-gradient(135deg,#DCE9FF,#C7D9FF); }
.t3 { background: linear-gradient(135deg,#F3E0FF,#E6CDFF); }
.t4 { background: linear-gradient(135deg,#FFF3C9,#FFE7A0); }
.t5 { background: linear-gradient(135deg,#DDF3FF,#C4E9FF); }
.grow-info { flex:1; margin-left:12px; min-width:0; }
.grow-name { font-size:16px; font-weight:600; }
.grow-desc { font-size:12px; color:var(--label-2); margin-top:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.grow-right { display:flex; align-items:center; gap:10px; flex-shrink:0; margin-left:8px; }
.grow-price { font-size:16px; font-weight:700; }
.add-btn {
width:28px; height:28px; border-radius:50%;
background: rgba(255,255,255,0.18); border:1px solid rgba(255,255,255,0.95);
color:#1C1C1E; font-size:18px; font-weight:500;
display:flex; align-items:center; justify-content:center; line-height:1;
box-shadow: inset 0 0 0 1.5px #fff, inset 0 1px 4px rgba(255,255,255,0.9), 0 4px 12px rgba(0,0,0,0.06), 0 0 18px rgba(10,132,255,0.4);
transition: transform .12s cubic-bezier(.23,1,.32,1);
}
.add-btn:active { transform: scale(.92); }
/* 底部结算条 */
.settle-bar {
position:absolute; left:16px; right:16px; bottom:76px; z-index:50;
display:none; align-items:center; justify-content:space-between;
background: var(--glass-strong);
backdrop-filter: saturate(180%) blur(28px); -webkit-backdrop-filter: saturate(180%) blur(28px);
border:1px solid var(--glass-border); border-radius:999px; padding:10px 10px 10px 20px;
box-shadow: inset 0 0 0 1px rgba(255,255,255,0.8), inset 0 1px 3px rgba(255,255,255,0.7),
0 16px 44px rgba(0,0,0,0.08), 0 0 24px rgba(10,132,255,0.22);
cursor:pointer;
}
.sb-count { font-size:11px; color:var(--label-2); }
.sb-total { font-size:20px; font-weight:700; margin-top:1px; }
.sb-btn {
background: linear-gradient(135deg,#0A84FF,#0071E3); color:#fff; border-radius:999px;
padding:11px 22px; font-size:15px; font-weight:600; box-shadow: 0 8px 24px rgba(0,122,255,0.32);
}
/* 支付抽屉 */
.sheet-mask {
position:absolute; inset:0; background: rgba(0,0,0,0.3); z-index:200;
display:none; align-items:flex-end;
}
.sheet-mask.show { display:flex; }
.sheet {
width:100%; background: rgba(28,28,48,0.92);
backdrop-filter: saturate(180%) blur(32px); -webkit-backdrop-filter: saturate(180%) blur(32px);
border-radius: 24px 24px 0 0; padding: 14px 16px 24px; color:#fff;
animation: slide-up .3s cubic-bezier(.32,.72,0,1); max-height:84%;
overflow-y:auto;
}
@keyframes slide-up { from{transform:translateY(100%);} to{transform:translateY(0);} }
.grab { width:36px; height:4px; background: rgba(255,255,255,0.35); border-radius:999px; margin:0 auto 14px; }
.sheet-title { font-size:18px; font-weight:700; text-align:center; margin-bottom:14px; }
.dark-card {
background: rgba(255,255,255,0.08); border:1px solid rgba(255,255,255,0.12);
border-radius:20px; padding:14px; margin-bottom:10px;
}
.sheet .line { display:flex; justify-content:space-between; align-items:center; padding:4px 0; font-size:14px; color:rgba(255,255,255,0.9); }
.sheet .divider { height:1px; background: rgba(255,255,255,0.12); margin:10px 0; }
.sheet .line-price.big { font-size:18px; font-weight:700; color:#fff; }
.sec-title { font-size:12px; font-weight:600; color:var(--label-2); letter-spacing:.3px; margin:0 4px 8px; }
.sheet .sec-title { color:rgba(255,255,255,0.6); }
textarea.remark {
width:100%; min-height:60px; background: rgba(255,255,255,0.08); border:1px solid rgba(255,255,255,0.2);
border-radius:999px; padding:12px 16px; font-size:14px; color:#fff; font-family:inherit;
resize:none; outline:none; box-sizing:border-box; margin-top:8px;
}
.sheet textarea.remark { color:#fff; }
.btn-main {
background: var(--accent); color:#fff; border-radius:999px; text-align:center;
padding:14px 0; font-size:15px; font-weight:600; cursor:pointer;
box-shadow: 0 8px 24px rgba(0,122,255,0.32);
}
.sheet .btn-main { margin-top:12px; }
/* 通用卡片 */
.card {
position:relative; margin:0 16px 10px; background: var(--glass);
backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%);
border-radius:20px; padding:14px;
box-shadow: inset 0 0 0 1px rgba(255,255,255,0.8), inset 0 1px 3px rgba(255,255,255,0.7),
0 16px 44px rgba(0,0,0,0.06), 0 28px 60px var(--glow);
overflow:hidden;
}
.card::before { content:''; position:absolute; inset:0; border-radius:inherit; pointer-events:none;
background: linear-gradient(135deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.16) 35%, rgba(255,255,255,0.34) 65%, rgba(255,255,255,0) 100%); }
.card > * { position:relative; z-index:1; }
.divider { height:1px; background:var(--separator); margin:10px 0; }
.line { display:flex; justify-content:space-between; align-items:center; padding:4px 0; font-size:14px; }
.line-price.big { font-size:18px; font-weight:700; }
.empty { text-align:center; padding:80px 40px; color:var(--label-2); font-size:13px; }
.empty .e { font-size:48px; line-height:1; margin-bottom:12px; }
.empty .t { font-size:15px; font-weight:600; color:var(--label); margin-bottom:4px; }
/* 订单 */
.oi-item { display:flex; align-items:center; padding:4px 0; }
.oi-emoji { width:38px; height:38px; border-radius:12px; display:flex; align-items:center; justify-content:center; font-size:20px; flex-shrink:0; background:rgba(0,0,0,0.04); }
.oi-info { flex:1; margin-left:10px; }
.oi-name { font-size:14px; font-weight:600; }
.oi-price { font-size:12px; color:var(--label-2); margin-top:1px; }
.stepper { display:flex; align-items:center; gap:8px; }
.step-btn { width:24px; height:24px; border-radius:50%; background:rgba(0,0,0,0.05); color:var(--label); font-weight:700; display:flex; align-items:center; justify-content:center; cursor:pointer; font-size:15px; }
.step-btn.add { background:var(--accent); color:#fff; }
.step-num { min-width:20px; text-align:center; font-weight:600; font-size:14px; }
.order-card { margin:0 16px 10px; }
.order-head { display:flex; justify-content:space-between; align-items:center; }
.order-no { font-size:11px; color:var(--label-2); }
.tag { display:inline-flex; padding:2px 10px; border-radius:999px; font-size:10px; font-weight:700; }
.order-items { margin-top:8px; font-size:14px; font-weight:600; }
.order-remark { margin-top:4px; font-size:11px; color:var(--label-2); }
.order-foot { margin-top:8px; display:flex; justify-content:space-between; align-items:center; }
.order-time { font-size:11px; color:var(--label-2); }
.order-total { font-size:15px; font-weight:700; }
.order-actions { margin-top:10px; display:flex; justify-content:flex-end; gap:8px; }
.action-btn { background:var(--accent); color:#fff; border-radius:999px; padding:7px 18px; font-size:12px; font-weight:600; cursor:pointer; box-shadow:0 4px 12px rgba(0,122,255,0.25); }
.action-btn.ghost { background:rgba(255,255,255,0.7); color:var(--accent); border:1px solid var(--glass-border); box-shadow:none; }
.action-btn.done-btn { background:linear-gradient(135deg,#30D158,#28A745); box-shadow:0 4px 12px rgba(48,209,88,0.3); }
/* 心情 */
.mood-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin:0 16px 12px; }
.mood {
background: var(--glass); backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%);
border-radius:20px; padding:16px 0; display:flex; flex-direction:column; align-items:center; gap:4px;
box-shadow: inset 0 0 0 1px rgba(255,255,255,0.8), 0 16px 44px rgba(0,0,0,0.06), 0 28px 60px var(--glow);
cursor:pointer; transition: transform .12s cubic-bezier(.23,1,.32,1);
}
.mood:active { transform: scale(.94); }
.mood .mo { font-size:32px; line-height:1; }
.mood .ml { font-size:12px; color:var(--label-2); }
.mood-item { display:flex; align-items:center; gap:10px; background:var(--glass); backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%); border-radius:20px; padding:12px; margin:0 16px 8px; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.8), 0 16px 44px rgba(0,0,0,0.06); }
.mood-item .mo { font-size:24px; }
.mood-item .mi-info { flex:1; }
.mood-item .mi-label { font-size:14px; font-weight:600; }
.mood-item .mi-time { font-size:11px; color:var(--label-2); margin-top:2px; }
.day-tag { font-size:10px; color:var(--label-2); background:rgba(0,0,0,0.05); padding:2px 8px; border-radius:999px; }
.summary-card { margin:12px 16px 0; background:linear-gradient(135deg, rgba(10,132,255,0.10), rgba(236,72,153,0.08)); border-radius:20px; padding:14px; }
.sum-t { font-size:13px; font-weight:700; margin-bottom:4px; }
.sum-d { font-size:12px; color:var(--label-2); line-height:1.6; }
.sum-b { font-weight:700; color:var(--label); }
/* 陪伴 */
.miss-circle {
margin:10px 16px 12px; background: linear-gradient(135deg,#FF9DBB,#FF6F91);
border-radius:24px; padding:30px 16px; text-align:center; cursor:pointer;
box-shadow: 0 16px 44px rgba(255,111,145,0.35), inset 0 2px 4px rgba(255,255,255,0.5);
transition: transform .12s cubic-bezier(.23,1,.32,1);
}
.miss-circle:active { transform: scale(.96); }
.miss-circle .mc-emoji { font-size:44px; line-height:1; }
.miss-circle .mc-label { font-size:16px; font-weight:700; color:#fff; margin-top:8px; text-shadow:0 2px 8px rgba(0,0,0,0.15); }
.companion-row { display:flex; gap:10px; margin:0 16px 12px; }
.c-half { flex:1; background:var(--glass); backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%); border-radius:20px; padding:16px 0; text-align:center; cursor:pointer; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.8), 0 16px 44px rgba(0,0,0,0.06); }
.c-half:active { transform: scale(.96); }
.c-half .ch-emoji { font-size:28px; }
.c-half .ch-label { font-size:13px; font-weight:600; margin-top:6px; }
/* 心愿单 */
.wish-input { display:flex; gap:8px; align-items:center; margin:0 16px 12px; background:var(--glass); backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%); border-radius:999px; padding:8px 10px 8px 16px; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.8), 0 16px 44px rgba(0,0,0,0.06); }
.wish-input input { flex:1; border:none; outline:none; font-size:14px; color:var(--label); background:transparent; }
.wi-btn { background:var(--accent); color:#fff; border-radius:999px; padding:8px 18px; font-size:13px; font-weight:600; cursor:pointer; }
.wish-item { display:flex; align-items:center; justify-content:space-between; margin:0 16px 10px; }
.wish-content { font-size:14px; font-weight:600; }
.wish-content.done { color:var(--label-2); text-decoration:line-through; }
.wish-meta { margin-top:4px; font-size:11px; color:var(--label-2); display:flex; gap:8px; align-items:center; }
.wish-status { padding:1px 8px; border-radius:999px; background:rgba(255,149,0,0.14); color:#FF9500; font-weight:600; font-size:10px; }
.wish-status.done { background:rgba(52,199,89,0.14); color:#34C759; }
.wish-ops { display:flex; align-items:center; gap:8px; }
.wish-grant { background:var(--accent); color:#fff; border-radius:999px; padding:5px 12px; font-size:11px; font-weight:600; cursor:pointer; }
.wish-del { color:var(--label-2); cursor:pointer; padding:6px; font-size:15px; }
.page-sub { padding:6px 16px 10px; font-size:13px; color:var(--label-2); }
.back-btn { display:inline-block; margin-top:16px; background:var(--accent); color:#fff; border-radius:999px; padding:10px 24px; font-size:13px; font-weight:600; cursor:pointer; }
/* 动画层 */
.fly-ball {
position:fixed; z-index:9999; pointer-events:none; margin-left:-14px; margin-top:-14px;
transition: transform .6s cubic-bezier(.32,.6,.36,1); will-change:transform;
}
.fly-ball.flying { transform: translate3d(var(--dx),0,0); }
.fly-node { color:#FF7EB6; font-size:30px; line-height:1; text-shadow:0 4px 12px rgba(255,126,182,0.6), 0 0 2px #fff;
transition: transform .6s cubic-bezier(.55,0,.84,.42); will-change:transform; }
.fly-ball.flying .fly-node { transform: translate3d(0,var(--dy),0) scale(.4); }
.heart-anim { position:absolute; z-index:300; pointer-events:none; animation: floatHeart var(--dur) cubic-bezier(.2,.6,.3,1) forwards; }
@keyframes floatHeart {
0% { transform: translate(0,0) rotate(0) scale(.6); opacity:0; }
12% { opacity:1; }
100% { transform: translate(var(--dx),var(--dy)) rotate(var(--rot)) scale(1); opacity:0; }
}
.particle-anim { position:absolute; z-index:300; pointer-events:none; animation: floatParticle var(--dur) cubic-bezier(.2,.6,.3,1) forwards; }
@keyframes floatParticle {
0% { transform: translate(0,0) rotate(0) scale(.4); opacity:0; }
15% { opacity:1; }
100% { transform: translate(var(--dx),var(--dy)) rotate(var(--rot)) scale(1); opacity:0; }
}
.toast {
position:absolute; top:48%; left:50%; transform:translate(-50%,-50%);
background: rgba(40,30,20,0.88); color:#fff; padding:10px 18px; border-radius:999px;
font-size:13px; z-index:400; display:none; white-space:nowrap;
}
.toast.show { display:block; animation: pop 1.5s forwards; }
@keyframes pop { 0%{opacity:0;} 12%{opacity:1;} 80%{opacity:1;} 100%{opacity:0;} }
/* 底部导航栏(简约) */
.tabbar {
position:absolute; left:0; right:0; bottom:0; z-index:80;
height:56px;
background: rgba(255,255,255,0.85);
backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%);
border-top: 1px solid rgba(0,0,0,0.06);
display:flex; align-items:center;
}
.tab {
flex:1; height:100%; display:flex; flex-direction:column; align-items:center; justify-content:center;
cursor:pointer; gap:3px; padding-bottom:4px;
}
.tab .ico { font-size:21px; line-height:1; opacity:.45; transition: opacity .2s, transform .2s; }
.tab .lbl { font-size:10px; color:var(--label-2); transition: color .2s; }
.tab.on .ico { opacity:1; transform:translateY(-1px); }
.tab.on .lbl { color:var(--accent); font-weight:600; }
</style>
</head>
<body>
<div class="phone">
<div class="notch"></div>
<div class="bg-decor"></div>
<div class="screen" id="screen">
<!-- ========== 菜单 ========== -->
<section class="page active" id="page-index">
<div class="nb-capsule">
<div class="nb-pill"><div class="flux"></div><div class="nb-title">MengYu</div></div>
</div>
<div class="appbar">
<div class="header-row">
<div class="header-left">
<div class="greet" id="greet">上午好,MengYu</div>
<div class="headline"><div class="hl"></div><text>想吃点什么?</text></div>
<div class="sub" id="menuSub">共 12 道 · 今天也慢慢吃</div>
</div>
<div class="entry-btns">
<div class="entry" onclick="goPage('page-wishlist')"><div class="e-ico">🌟</div><div class="e-label">心愿单</div></div>
<div class="entry" onclick="goPage('page-orders')"><div class="e-ico">📖</div><div class="e-label">订单</div><div class="entry-badge" id="entryBadge">0</div></div>
<div class="entry" onclick="goPage('page-admin')"><div class="e-ico">👑</div><div class="e-label">管家</div></div>
</div>
</div>
</div>
<div class="segment" id="segment"></div>
<div class="grouped" id="dishList"></div>
</section>
<!-- ========== 订单 ========== -->
<section class="page" id="page-orders">
<div class="nb-capsule">
<div class="nb-pill"><div class="flux"></div><div class="nb-back" onclick="goBack()">‹</div><div class="nb-title">订单</div></div>
</div>
<div class="page-sub" id="ordersSub">点餐记录都在这里</div>
<div id="currentOrderWrap"></div>
<div class="sec-title" id="histTitle" style="display:none">历史订单</div>
<div id="orderList"></div>
<div class="empty" id="ordersEmpty" style="display:none"><div class="e">📭</div><div class="t">还没下过单</div><div>去菜单点几道吧</div></div>
</section>
<!-- ========== 心情 ========== -->
<section class="page" id="page-mood">
<div class="nb-capsule">
<div class="nb-pill"><div class="flux"></div><div class="nb-title">心情</div></div>
</div>
<div class="appbar">
<div class="greet">今天的心情</div>
<div class="headline"><div class="hl"></div><text>怎么样?</text></div>
<div class="sub">点一下记下</div>
</div>
<div class="sec-title">记一笔</div>
<div class="mood-grid" id="moodGrid"></div>
<div class="sec-title">最近记录</div>
<div id="moodList"></div>
<div id="summaryWrap"></div>
<div class="empty" id="moodEmpty" style="display:none"><div class="e">💛</div><div class="t">还没记录过</div><div>点一下上面的心情,记下此刻</div></div>
</section>
<!-- ========== 陪伴 ========== -->
<section class="page" id="page-companion">
<div class="nb-capsule">
<div class="nb-pill"><div class="flux"></div><div class="nb-title">陪伴</div></div>
</div>
<div class="miss-circle" id="missBtn">
<div class="mc-emoji">💗</div>
<div class="mc-label">想你了</div>
</div>
<div class="companion-row">
<div class="c-half" id="morningBtn"><div class="ch-emoji">☀️</div><div class="ch-label">早安</div></div>
<div class="c-half" id="nightBtn"><div class="ch-emoji">🌙</div><div class="ch-label">晚安</div></div>
</div>
<div class="sec-title">最近互动</div>
<div id="companionList"></div>
<div class="empty" id="companionEmpty" style="display:none"><div class="e">🫂</div><div class="t">还没点过</div><div>点一下上面的心,告诉 TA 你在想</div></div>
</section>
<!-- ========== 心愿单 ========== -->
<section class="page" id="page-wishlist">
<div class="nb-capsule">
<div class="nb-pill"><div class="flux"></div><div class="nb-back" onclick="goBack()">‹</div><div class="nb-title">心愿单</div></div>
</div>
<div class="page-sub">写下想要的</div>
<div class="wish-input">
<input id="wishInput" maxlength="40" placeholder="想吃什么 / 想要什么…" />
<div class="wi-btn" onclick="addWish()">记录</div>
</div>
<div class="sec-title" id="wishTitle" style="display:none">心愿 0 个</div>
<div id="wishList"></div>
<div class="empty" id="wishEmpty" style="display:none"><div class="e">🌙</div><div class="t">还没许过愿</div><div>把想要的写下来,等 TA 来实现</div></div>
</section>
<!-- ========== 管家 ========== -->
<section class="page" id="page-admin">
<div class="nb-capsule">
<div class="nb-pill"><div class="flux"></div><div class="nb-back" onclick="goBack()">‹</div><div class="nb-title">管家</div></div>
</div>
<div class="page-sub">宝贝点单,你来接</div>
<div class="sec-title">待处理</div>
<div id="adminList"></div>
<div class="empty" id="adminEmpty" style="display:none"><div class="e">📭</div><div class="t">没有待处理的单</div><div>宝贝还没下单呢</div></div>
</section>
<!-- 结算条 -->
<div class="settle-bar" id="settleBar" onclick="openPay()">
<div>
<div class="sb-count" id="sbCount">共 0 道</div>
<div class="sb-total" id="sbTotal">¥0</div>
</div>
<div class="sb-btn">去下单</div>
</div>
<!-- 底部 tabbar -->
<div class="tabbar" id="tabbar">
<div class="tab on" data-i="0" data-page="page-index"><div class="ico">🍽️</div><div class="lbl">菜单</div></div>
<div class="tab" data-i="1" data-page="page-mood"><div class="ico">💛</div><div class="lbl">心情</div></div>
<div class="tab" data-i="2" data-page="page-companion"><div class="ico">🫂</div><div class="lbl">陪伴</div></div>
</div>
</div>
<div class="toast" id="toast"></div>
<!-- 支付抽屉 -->
<div class="sheet-mask" id="payMask" onclick="closePay()">
<div class="sheet" onclick="event.stopPropagation()">
<div class="grab"></div>
<div class="sheet-title">确认订单</div>
<div class="dark-card">
<div id="payList"></div>
<div class="divider"></div>
<div class="line"><span>合计</span><span class="line-price big" id="payTotal">¥0</span></div>
</div>
<div class="dark-card">
<div class="sec-title">附言</div>
<textarea class="remark" id="payRemark" maxlength="60" placeholder="少放辣、多加点香菜…"></textarea>
</div>
<div class="btn-main" onclick="confirmPay()">确认支付</div>
</div>
</div>
</div>
<script>
/* ===== 数据(与 miniprogram 源码一致) ===== */
const DISHES = [
{ _id:'d1', name:'番茄炒蛋面', emoji:'🍜', price:18, category:'主食', desc:'酸甜开胃,暖胃又暖心' },
{ _id:'d2', name:'可乐鸡翅饭', emoji:'🍗', price:22, category:'主食', desc:'甜甜的可乐裹着嫩鸡翅' },
{ _id:'d3', name:'红烧肉配饭', emoji:'🥘', price:28, category:'主食', desc:'肥而不腻,入口即化' },
{ _id:'d4', name:'虾仁滑蛋饭', emoji:'🍤', price:26, category:'主食', desc:'滑嫩鸡蛋遇上弹弹虾仁' },
{ _id:'d5', name:'草莓小蛋糕', emoji:'🍰', price:15, category:'甜品', desc:'软fufu,甜到心里' },
{ _id:'d6', name:'红豆双皮奶', emoji:'🥛', price:12, category:'甜品', desc:'奶香浓郁,红豆绵密' },
{ _id:'d7', name:'蜂蜜柚子茶', emoji:'🍯', price:10, category:'饮品', desc:'清新润喉,暖暖的' },
{ _id:'d8', name:'珍珠奶茶', emoji:'🧋', price:12, category:'饮品', desc:'波霸多多,快乐加倍' },
{ _id:'d9', name:'热巧克力', emoji:'☕', price:14, category:'饮品', desc:'浓郁丝滑,治愈系' },
{ _id:'d10', name:'香辣烤串', emoji:'🍢', price:20, category:'夜宵', desc:'滋滋冒油,小心烫嘴' },
{ _id:'d11', name:'蒜蓉小龙虾', emoji:'🦞', price:45, category:'夜宵', desc:'红彤彤的一大盘' },
{ _id:'d12', name:'黄金炸鸡', emoji:'🍗', price:25, category:'夜宵', desc:'外酥里嫩,一口爆汁' }
]
const CAT_ICONS = { '全部':'🍽️', '主食':'🍚', '甜品':'🍰', '饮品':'🧋', '夜宵':'🌙' }
const MOODS = [
{ emoji:'😄', label:'开心' }, { emoji:'😌', label:'平静' }, { emoji:'🥰', label:'想你' },
{ emoji:'😢', label:'难过' }, { emoji:'😠', label:'生气' }, { emoji:'😴', label:'疲惫' }
]
const STATUS = {
pending: { text:'⏳ 待接单', color:'#FF9F0A', bg:'rgba(255,159,10,0.22)' },
cooking: { text:'🍳 制作中', color:'#0A84FF', bg:'rgba(10,132,255,0.22)' },
done: { text:'✅ 已完成', color:'#30D158', bg:'rgba(48,209,88,0.20)' },
cancelled: { text:'🚫 已取消', color:'#A1A1AA', bg:'rgba(161,161,170,0.22)' }
}
let cart = {}
let activeCat = '全部'
let wishlist = []
let orders = [
{ _id:'o1', orderNo:'K8X2QM', status:'pending', items:[{emoji:'🍜',name:'番茄炒蛋面',count:1},{emoji:'🧋',name:'珍珠奶茶',count:2}], remark:'少放辣', total:42, createdAt: Date.now()-1800000 },
{ _id:'o2', orderNo:'M3T9PL', status:'cooking', items:[{emoji:'🍗',name:'可乐鸡翅饭',count:1},{emoji:'🍰',name:'草莓小蛋糕',count:1}], remark:'', total:37, createdAt: Date.now()-86400000*2 }
]
let moods = [
{ emoji:'🥰', label:'想你', ts: Date.now()-3600000 },
{ emoji:'😄', label:'开心', ts: Date.now()-86400000*3 }
]
let companions = [
{ emoji:'💗', label:'想你了', ts: Date.now()-7200000 },
{ emoji:'☀️', label:'早安', ts: Date.now()-86400000 }
]
let tabSelected = 0
let seq = 0
const $ = id => document.getElementById(id)
/* ===== 通用 ===== */
function toast(msg) {
const t = $('toast'); t.textContent = msg; t.classList.remove('show'); void t.offsetWidth; t.classList.add('show')
}
function pad(n){ return n<10?'0'+n:''+n }
function fmtTime(ts){
if (Date.now()-ts < 60000) return '刚刚'
const d = new Date(ts)
return `${d.getMonth()+1}月${d.getDate()}日 ${pad(d.getHours())}:${pad(d.getMinutes())}`
}
function dayTag(ts){
const d=new Date(ts), now=new Date()
const s=new Date(now.getFullYear(),now.getMonth(),now.getDate()).getTime()
const t=new Date(d.getFullYear(),d.getMonth(),d.getDate()).getTime()
const diff=(s-t)/86400000
return diff===0?'今天':diff===1?'昨天':'更早'
}
function greeting(){
const h=new Date().getHours()
if(h<5)return'夜深了'; if(h<9)return'早上好'; if(h<12)return'上午好'
if(h<14)return'中午好'; if(h<18)return'下午好'; return'晚上好'
}
/* ===== 页面切换 ===== */
const TAB_PAGES = ['page-index','page-mood','page-companion']
function showPage(name, viaTab){
document.querySelectorAll('.page').forEach(p=>p.classList.remove('active'))
$(name).classList.add('active')
if (TAB_PAGES.includes(name)){
const i = TAB_PAGES.indexOf(name)
setTab(i)
$('settleBar').style.display = (name==='page-index' && cartCount()>0) ? 'flex' : 'none'
} else {
$('settleBar').style.display = 'none'
}
if(name==='page-orders') renderOrders()
if(name==='page-mood') renderMoods()
if(name==='page-companion') renderCompanion()
if(name==='page-wishlist') renderWish()
if(name==='page-admin') renderAdmin()
}
function goPage(name){ showPage(name) }
function goBack(){ showPage('page-index') }
/* tabbar 切换 */
function setTab(i){
tabSelected = i
document.querySelectorAll('.tab').forEach((t,idx)=>t.classList.toggle('on', idx===i))
}
document.querySelectorAll('.tab').forEach(t=>{
t.addEventListener('click', ()=>{ showPage(t.dataset.page) })
})
/* ===== 菜单 ===== */
function renderSegment(){
const cats=['全部',...new Set(DISHES.map(d=>d.category))]
$('segment').innerHTML=cats.map((c,idx)=>`
<div class="seg ${c===activeCat?'on':''}" onclick="setCat('${c}')">
<div class="seg-ico">${CAT_ICONS[c]||'🍽️'}</div><span>${c}</span>
</div>`).join('')
}
function setCat(c){ activeCat=c; renderSegment(); renderDishes(true) }
function renderDishes(anim){
const list = activeCat==='全部'?DISHES:DISHES.filter(d=>d.category===activeCat)
const g=$('dishList')
g.classList.remove('enter')
g.innerHTML = list.map((d,idx)=>`
<div class="grow" style="animation-delay:${idx*35}ms" onclick="addToCart('${d._id}',event,${idx})">
<div class="grow-emoji t${idx%6}">${d.emoji}</div>
<div class="grow-info">
<div class="grow-name">${d.name}</div>
<div class="grow-desc">${d.desc}</div>
</div>
<div class="grow-right">
<div class="grow-price">¥${d.price}</div>
<div id="add-${idx}" class="add-btn">+</div>
</div>
</div>`).join('')
if(anim){ void g.offsetWidth; g.classList.add('enter') }
$('menuSub').textContent = `共 ${DISHES.length} 道 · 今天也慢慢吃`
}
function cartCount(){ return Object.values(cart).reduce((s,i)=>s+i.count,0) }
function cartTotal(){ return Object.values(cart).reduce((s,i)=>s+i.count*i.dish.price,0) }
function cartList(){ return Object.values(cart) }
function refreshBadge(bounce){
const n=cartCount()
const b=$('entryBadge')
b.textContent=n; b.classList.toggle('show', n>0)
if(bounce){ b.classList.remove('bounce'); void b.offsetWidth; b.classList.add('bounce') }
}
function addToCart(id, ev, idx){
const dish=DISHES.find(d=>d._id===id)
if(cart[id]) cart[id].count++; else cart[id]={dish,count:1}
refreshBadge(true); refreshSettleBar()
if(ev) flyToCart(idx, ev)
toast('已加入购物车 🍽️')
}
function flyToCart(idx, ev){
const from=$('add-'+idx)
const to=$('settleBar')
if(!from) return
const fr=from.getBoundingClientRect(), tr=to.getBoundingClientRect()
const sx=fr.left+fr.width/2, sy=fr.top+fr.height/2
const ex=tr.left+50, ey=tr.top+tr.height/2
const ball=document.createElement('div'); ball.className='fly-ball'
ball.style.left=sx+'px'; ball.style.top=sy+'px'
ball.innerHTML='<div class="fly-node">♥</div>'
document.body.appendChild(ball)
ball.style.setProperty('--dx',(ex-sx)+'px')
ball.style.setProperty('--dy',(ey-sy)+'px')
requestAnimationFrame(()=>requestAnimationFrame(()=>ball.classList.add('flying')))
setTimeout(()=>ball.remove(),700)
}
function refreshSettleBar(){
const n=cartCount()
$('settleBar').style.display = (n>0 && $('page-index').classList.contains('active')) ? 'flex':'none'
$('sbCount').textContent='共 '+n+' 道'
$('sbTotal').textContent='¥'+cartTotal()
}
/* ===== 支付抽屉 ===== */
function openPay(){
if(!cartCount()){ toast('订单是空的'); return }
$('payList').innerHTML=cartList().map(i=>`<div class="line"><span>${i.dish.emoji} ${i.dish.name} ×${i.count}</span><span>¥${i.dish.price*i.count}</span></div>`).join('')
$('payTotal').textContent='¥'+cartTotal()
$('payMask').classList.add('show')
}
function closePay(){ $('payMask').classList.remove('show') }
function confirmPay(){
if(!cartCount()){ toast('订单是空的'); return }
const remark=$('payRemark').value
orders.unshift({
_id:'o'+Date.now(), orderNo:'D'+Date.now().toString(36).toUpperCase().slice(-6),
status:'pending', items:cartList().map(i=>({emoji:i.dish.emoji,name:i.dish.name,count:i.count})),
remark, total:cartTotal(), createdAt:Date.now()
})
cart={}; $('payRemark').value=''
closePay(); refreshBadge(); refreshSettleBar()
toast('下单成功!等宝贝接单吧 💕')
}
/* ===== 订单 ===== */
function renderOrders(){
const cl=cartList(), hasCurrent=cl.length>0
$('currentOrderWrap').innerHTML = hasCurrent ? `
<div class="card">
<div class="sec-title">今晚这单</div>
${cl.map(i=>`
<div class="oi-item">
<div class="oi-emoji">${i.dish.emoji}</div>
<div class="oi-info"><div class="oi-name">${i.dish.name}</div><div class="oi-price">¥${i.dish.price}</div></div>
<div class="stepper">
<div class="step-btn" onclick="decOrder('${i.dish._id}')">−</div>
<div class="step-num">${i.count}</div>
<div class="step-btn add" onclick="incOrder('${i.dish._id}')">+</div>
</div>
</div>`).join('')}
<div class="divider"></div>
<div class="line"><span>合计</span><span class="line-price big">¥${cartTotal()}</span></div>
<textarea class="remark" id="orderRemark" maxlength="60" placeholder="附言:少放辣、多加点香菜…" style="background:rgba(0,0,0,0.04);color:#1C1C1E"></textarea>
<div class="btn-main" style="margin-top:10px" onclick="submitOrder()">去下单</div>
</div>` : ''
const sub = hasCurrent ? `已点 ${cartCount()} 道,还没下单` : (orders.length ? `${orders.length} 条历史订单` : '点餐记录都在这里')
$('ordersSub').textContent = sub
$('histTitle').style.display = orders.length ? 'block' : 'none'
$('orderList').innerHTML = orders.map((o,idx)=>orderCard(o,idx,'user')).join('')
$('ordersEmpty').style.display = (!hasCurrent && !orders.length) ? 'block' : 'none'
}
function incOrder(id){ cart[id].count++; renderOrders(); refreshBadge(); refreshSettleBar() }
function decOrder(id){ if(--cart[id].count<=0) delete cart[id]; renderOrders(); refreshBadge(); refreshSettleBar() }
function submitOrder(){
if(!cartCount()){ toast('订单是空的'); return }
const remark=($('orderRemark')||{}).value||''
orders.unshift({
_id:'o'+Date.now(), orderNo:'D'+Date.now().toString(36).toUpperCase().slice(-6),
status:'pending', items:cartList().map(i=>({emoji:i.dish.emoji,name:i.dish.name,count:i.count})),
remark, total:cartTotal(), createdAt:Date.now()
})
cart={}; renderOrders(); refreshBadge(); refreshSettleBar()
toast('下单成功!等宝贝接单吧 💕')
}
function orderCard(o, idx, role){
const st=STATUS[o.status]||{text:'❓',color:'#8A817A',bg:'#F0EAE2'}
const names=o.items.map(i=>`${i.emoji}${i.name}×${i.count}`)
const summary=names.length>3?names.slice(0,3).join('、')+` 等${names.length}件`:names.join('、')
let acts=''
if(role==='user'){
if(o.status==='pending') acts=`<div class="action-btn ghost" onclick="cancelOrder('${o._id}')">取消</div>`
else if(o.status==='cooking') acts=`<div class="action-btn" onclick="pokeOrder('${o._id}')">催单 💗</div>`
} else {
if(o.status==='pending') acts=`<div class="action-btn done-btn" onclick="adminDone('${o._id}')">接单 ✅</div>`
else if(o.status==='cooking') acts=`<div class="action-btn done-btn" onclick="adminDone('${o._id}')">完成 ✅</div>`
}
return `
<div class="card order-card">
<div class="order-head"><span class="order-no">单号 ${o.orderNo}</span><span class="tag" style="color:${st.color};background:${st.bg}">${st.text}</span></div>
<div class="order-items">${summary}</div>
${o.remark?`<div class="order-remark">💬 ${o.remark}</div>`:''}
<div class="order-foot"><span class="order-time">${fmtTime(o.createdAt)}</span><span class="order-total">¥${o.total}</span></div>
${acts?`<div class="order-actions">${acts}</div>`:''}
</div>`
}
function cancelOrder(id){ const o=orders.find(x=>x._id===id); if(o){o.status='cancelled'; renderOrders(); toast('订单已取消')} }
function pokeOrder(id){ const o=orders.find(x=>x._id===id); if(o){o.status='cooking'; renderOrders(); toast('已经催宝贝啦 💗')} }
/* ===== 心情 ===== */
function renderMoods(){
$('moodGrid').innerHTML=MOODS.map(m=>`
<div class="mood" onclick="addMood('${m.emoji}','${m.label}')">
<div class="mo">${m.emoji}</div><div class="ml">${m.label}</div>
</div>`).join('')
$('moodEmpty').style.display = moods.length?'none':'block'
$('moodList').innerHTML=moods.map(m=>`
<div class="mood-item">
<div class="mo">${m.emoji}</div>
<div class="mi-info"><div class="mi-label">${m.label}</div><div class="mi-time">${fmtTime(m.ts)}</div></div>
<div class="day-tag">${dayTag(m.ts)}</div>
</div>`).join('')
renderSummary()
}
function renderSummary(){
if(!moods.length){ $('summaryWrap').innerHTML=''; return }
const week=moods.filter(r=>r.ts>=Date.now()-86400000*7)
if(!week.length){ $('summaryWrap').innerHTML=''; return }
const freq={}; week.forEach(r=>freq[r.label]=(freq[r.label]||0)+1)
let top='',n=0; for(const k in freq) if(freq[k]>n){n=freq[k];top=k}
const miss=week.filter(r=>r.label==='想你').length
$('summaryWrap').innerHTML=`<div class="summary-card">
<div class="sum-t">本周心情小结 💗</div>
<div class="sum-d">这周你记了 <span class="sum-b">${week.length}</span> 次,<span class="sum-b">${top}</span> 出现最多。${miss?`有 <span class="sum-b">${miss}</span> 个晚上是「想你」收尾的。`:''}</div>
</div>`
}
function addMood(emoji,label){
moods.unshift({emoji,label,ts:Date.now()})
renderMoods(); toast('已记录 '+emoji)
burstParticle(emoji)
}
function burstParticle(emoji){
const layer=document.createElement('div')
layer.style.cssText='position:absolute;inset:0;pointer-events:none;z-index:300'
$('screen').appendChild(layer)
const p=document.createElement('div')
p.className='particle-anim'
p.textContent=emoji
p.style.cssText=`left:${100+Math.random()*200}px;top:${250+Math.random()*150}px;font-size:${70+Math.random()*30}px;--dx:${(Math.random()-0.5)*240}px;--dy:${-(120+Math.random()*160)}px;--rot:${(Math.random()-0.5)*360}deg;--dur:${(1+Math.random()*0.6).toFixed(2)}s`
layer.appendChild(p)
setTimeout(()=>layer.remove(),1800)
}
/* ===== 陪伴 ===== */
function renderCompanion(){
$('companionEmpty').style.display = companions.length?'none':'block'
$('companionList').innerHTML=companions.map(c=>`
<div class="mood-item">
<div class="mo">${c.emoji}</div>
<div class="mi-info"><div class="mi-label">${c.label}</div><div class="mi-time">${fmtTime(c.ts)}</div></div>
<div class="day-tag">${dayTag(c.ts)}</div>
</div>`).join('')
}
function addCompanion(emoji,label,burst){
companions.unshift({emoji,label,ts:Date.now()})
renderCompanion(); toast(label+' '+emoji)
if(burst) burstHearts()
}
function burstHearts(){
const pool=['💗','❤️','💕','💖','💓','🩷','💘','💝']
const layer=document.createElement('div')
layer.style.cssText='position:absolute;inset:0;pointer-events:none;z-index:300'
$('screen').appendChild(layer)
for(let i=0;i<10;i++){
const h=document.createElement('div')
h.className='heart-anim'
h.textContent=pool[Math.floor(Math.random()*pool.length)]
const ang=(i/9-0.5)*1.4
const dist=120+Math.random()*90
h.style.cssText=`left:${170+Math.random()*50}px;top:${300+Math.random()*40}px;font-size:${18+Math.random()*14}px;--dx:${Math.round(Math.sin(ang)*dist)}px;--dy:${Math.round(-Math.cos(ang)*dist)}px;--rot:${Math.round((Math.random()-0.5)*60)}deg;--dur:${(1+Math.random()*0.4).toFixed(2)}s`
layer.appendChild(h)
}
setTimeout(()=>layer.remove(),1500)
}
/* ===== 心愿单 ===== */
function renderWish(){
$('wishEmpty').style.display = wishlist.length?'none':'block'
const t=$('wishTitle'); t.style.display=wishlist.length?'block':'none'
if(wishlist.length) t.textContent=`心愿 ${wishlist.length} 个`
$('wishList').innerHTML=wishlist.map((w,i)=>`
<div class="card wish-item">
<div>
<div class="wish-content ${w.done?'done':''}">${w.done?'✨':'🌟'} ${w.content}</div>
<div class="wish-meta"><span>${w.time}</span><span class="wish-status ${w.done?'done':''}">${w.done?'已实现':'想吃中'}</span></div>
</div>
<div class="wish-ops">
${!w.done?`<div class="wish-grant" onclick="grantWish(${i})">实现</div>`:''}
<span class="wish-del" onclick="delWish(${i})">✕</span>
</div>
</div>`).join('')
}
function addWish(){
const v=$('wishInput').value.trim()
if(!v){ toast('写下你的小愿望吧'); return }
wishlist.unshift({content:v,done:false,time:'刚刚'})
$('wishInput').value=''; renderWish(); toast('已记下 ✨')
}
function grantWish(i){ wishlist[i].done=true; renderWish(); toast('愿望已实现 ✨') }
function delWish(i){ wishlist.splice(i,1); renderWish() }
/* ===== 管家 ===== */
function renderAdmin(){
const pending=orders.filter(o=>o.status==='pending'||o.status==='cooking')
$('adminEmpty').style.display = pending.length?'none':'block'
$('adminList').innerHTML=pending.map((o,idx)=>orderCard(o,idx,'admin')).join('')
}
function adminDone(id){
const o=orders.find(x=>x._id===id)
if(o){ o.status = o.status==='pending' ? 'cooking' : 'done'; renderAdmin(); renderOrders(); toast(o.status==='done'?'订单已完成 ✅':'已接单,开始做 🍳') }
}
/* ===== 事件绑定 ===== */
$('missBtn').addEventListener('click', ()=>addCompanion('💗','想你了',true))
$('morningBtn').addEventListener('click', ()=>addCompanion('☀️','早安',false))
$('nightBtn').addEventListener('click', ()=>addCompanion('🌙','晚安',false))
$('wishInput').addEventListener('keydown', e=>{ if(e.key==='Enter') addWish() })
/* ===== 启动 ===== */
$('greet').textContent = greeting()+',MengYu'
renderSegment(); renderDishes(true); renderOrders(); renderMoods(); renderCompanion(); renderWish(); renderAdmin(); refreshBadge(); refreshSettleBar()
</script>
</body>
</html>