style.css 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756
  1. * {
  2. margin: 0;
  3. padding: 0;
  4. box-sizing: border-box;
  5. }
  6. body {
  7. font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  8. background-color: #f5f5f5;
  9. padding-bottom: 65px;
  10. }
  11. /* 顶部商家信息 */
  12. .header {
  13. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  14. color: white;
  15. padding: 15px;
  16. position: sticky;
  17. top: 0;
  18. z-index: 100;
  19. box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  20. }
  21. .shop-name {
  22. font-size: 20px;
  23. margin-bottom: 8px;
  24. }
  25. .shop-tags {
  26. display: flex;
  27. gap: 10px;
  28. }
  29. .tag {
  30. background: rgba(255,255,255,0.2);
  31. padding: 4px 10px;
  32. border-radius: 12px;
  33. font-size: 12px;
  34. }
  35. /* 主体布局 */
  36. .main-container {
  37. display: flex;
  38. height: calc(100vh - 165px);
  39. overflow: hidden;
  40. }
  41. /* 左侧分类 */
  42. .category-sidebar {
  43. width: 90px;
  44. background: #f8f8f8;
  45. overflow-y: auto;
  46. border-right: 1px solid #e5e5e5;
  47. }
  48. .category-item {
  49. padding: 20px 10px;
  50. text-align: center;
  51. font-size: 14px;
  52. color: #666;
  53. cursor: pointer;
  54. transition: all 0.3s;
  55. border-left: 3px solid transparent;
  56. }
  57. .category-item:hover {
  58. background: #fff;
  59. }
  60. .category-item.active {
  61. background: #fff;
  62. color: #667eea;
  63. font-weight: bold;
  64. border-left-color: #667eea;
  65. }
  66. /* 右侧菜品列表 */
  67. .dish-content {
  68. flex: 1;
  69. overflow-y: auto;
  70. overflow-x: hidden;
  71. scroll-behavior: smooth;
  72. position: relative;
  73. padding: 15px;
  74. }
  75. .category-section {
  76. margin-bottom: 20px;
  77. }
  78. .category-title {
  79. font-size: 16px;
  80. font-weight: bold;
  81. color: #333;
  82. margin-bottom: 15px;
  83. padding-left: 10px;
  84. border-left: 4px solid #667eea;
  85. transition: all 0.3s;
  86. position: sticky;
  87. top: 0;
  88. background: #f5f5f5;
  89. padding-top: 10px;
  90. padding-bottom: 10px;
  91. z-index: 10;
  92. }
  93. .dish-list {
  94. display: flex;
  95. flex-direction: column;
  96. gap: 15px;
  97. }
  98. .dish-item {
  99. display: flex;
  100. background: white;
  101. border-radius: 12px;
  102. padding: 12px;
  103. box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  104. transition: transform 0.2s;
  105. cursor: pointer;
  106. }
  107. .dish-item:active {
  108. transform: scale(0.98);
  109. }
  110. .dish-img {
  111. width: 100px;
  112. height: 100px;
  113. border-radius: 8px;
  114. object-fit: cover;
  115. margin-right: 12px;
  116. }
  117. .dish-info {
  118. flex: 1;
  119. display: flex;
  120. flex-direction: column;
  121. justify-content: space-between;
  122. }
  123. .dish-name {
  124. font-size: 16px;
  125. font-weight: bold;
  126. color: #333;
  127. margin-bottom: 5px;
  128. }
  129. .dish-desc {
  130. font-size: 12px;
  131. color: #999;
  132. margin-bottom: 5px;
  133. overflow: hidden;
  134. text-overflow: ellipsis;
  135. display: -webkit-box;
  136. -webkit-line-clamp: 2;
  137. -webkit-box-orient: vertical;
  138. }
  139. .dish-tags {
  140. display: flex;
  141. gap: 5px;
  142. margin-bottom: 8px;
  143. }
  144. .dish-tag {
  145. background: #fff3e0;
  146. color: #ff9800;
  147. padding: 2px 8px;
  148. border-radius: 4px;
  149. font-size: 11px;
  150. }
  151. .dish-footer {
  152. display: flex;
  153. justify-content: space-between;
  154. align-items: center;
  155. }
  156. .dish-price {
  157. color: #ff6b6b;
  158. font-size: 18px;
  159. font-weight: bold;
  160. }
  161. .dish-sales {
  162. font-size: 12px;
  163. color: #999;
  164. margin-left: 10px;
  165. }
  166. .dish-controls {
  167. display: flex;
  168. align-items: center;
  169. gap: 10px;
  170. }
  171. .control-btn {
  172. width: 28px;
  173. height: 28px;
  174. border-radius: 50%;
  175. border: none;
  176. background: #667eea;
  177. color: white;
  178. font-size: 18px;
  179. cursor: pointer;
  180. display: flex;
  181. align-items: center;
  182. justify-content: center;
  183. transition: all 0.2s;
  184. }
  185. .control-btn:active {
  186. transform: scale(0.9);
  187. }
  188. .control-btn.minus {
  189. background: #e0e0e0;
  190. color: #666;
  191. }
  192. .dish-count {
  193. min-width: 20px;
  194. text-align: center;
  195. font-weight: bold;
  196. }
  197. /* 底部购物车 */
  198. .cart-bar {
  199. position: fixed;
  200. bottom: 0;
  201. left: 0;
  202. right: 0;
  203. height: 65px;
  204. background: #2c2c2c;
  205. display: flex;
  206. align-items: center;
  207. padding: 0 15px;
  208. box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  209. z-index: 200;
  210. gap: 10px;
  211. }
  212. .cart-icon-wrapper {
  213. position: relative;
  214. flex-shrink: 0;
  215. }
  216. .cart-icon {
  217. width: 45px;
  218. height: 45px;
  219. background: #667eea;
  220. border-radius: 50%;
  221. display: flex;
  222. align-items: center;
  223. justify-content: center;
  224. font-size: 20px;
  225. cursor: pointer;
  226. transition: transform 0.2s;
  227. position: relative;
  228. }
  229. .cart-icon:active {
  230. transform: scale(0.95);
  231. }
  232. .cart-count {
  233. position: absolute;
  234. top: -3px;
  235. right: -3px;
  236. background: #ff6b6b;
  237. color: white;
  238. border-radius: 9px;
  239. padding: 2px 5px;
  240. font-size: 11px;
  241. min-width: 18px;
  242. text-align: center;
  243. font-weight: bold;
  244. }
  245. .cart-info {
  246. flex: 1;
  247. color: white;
  248. min-width: 0;
  249. display: flex;
  250. flex-direction: column;
  251. justify-content: center;
  252. }
  253. .cart-price {
  254. font-size: 20px;
  255. font-weight: bold;
  256. color: #fff;
  257. line-height: 1.2;
  258. margin-bottom: 2px;
  259. }
  260. .price-label {
  261. font-size: 14px;
  262. }
  263. .delivery-fee {
  264. font-size: 11px;
  265. color: #999;
  266. line-height: 1.2;
  267. }
  268. .checkout-btn {
  269. background: #4caf50;
  270. color: white;
  271. border: none;
  272. padding: 10px 18px;
  273. border-radius: 18px;
  274. font-size: 13px;
  275. font-weight: bold;
  276. cursor: pointer;
  277. transition: all 0.3s;
  278. white-space: nowrap;
  279. flex-shrink: 0;
  280. }
  281. .checkout-btn:disabled {
  282. background: #555;
  283. cursor: not-allowed;
  284. }
  285. .checkout-btn:not(:disabled):active {
  286. transform: scale(0.95);
  287. }
  288. /* 购物车详情弹窗 */
  289. .cart-detail-mask {
  290. position: fixed;
  291. top: 0;
  292. left: 0;
  293. right: 0;
  294. bottom: 65px;
  295. background: rgba(0,0,0,0.5);
  296. z-index: 198;
  297. display: none;
  298. backdrop-filter: blur(2px);
  299. }
  300. .cart-detail-mask.show {
  301. display: block;
  302. animation: fadeIn 0.3s ease;
  303. }
  304. .cart-detail {
  305. position: fixed;
  306. bottom: 65px;
  307. left: 0;
  308. right: 0;
  309. max-height: 50vh;
  310. background: white;
  311. border-radius: 20px 20px 0 0;
  312. z-index: 199;
  313. transform: translateY(0);
  314. transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  315. box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
  316. opacity: 0;
  317. visibility: hidden;
  318. pointer-events: none;
  319. }
  320. .cart-detail.show {
  321. opacity: 1;
  322. visibility: visible;
  323. pointer-events: auto;
  324. }
  325. .cart-detail-header {
  326. display: flex;
  327. justify-content: space-between;
  328. padding: 15px 20px;
  329. border-bottom: 1px solid #f0f0f0;
  330. font-weight: bold;
  331. }
  332. .clear-cart {
  333. color: #999;
  334. cursor: pointer;
  335. }
  336. .cart-detail-list {
  337. max-height: calc(50vh - 60px);
  338. overflow-y: auto;
  339. padding: 10px 20px;
  340. }
  341. .cart-item {
  342. display: flex;
  343. justify-content: space-between;
  344. align-items: center;
  345. padding: 15px 0;
  346. border-bottom: 1px solid #f5f5f5;
  347. }
  348. .cart-item-name {
  349. flex: 1;
  350. font-size: 14px;
  351. }
  352. .cart-item-price {
  353. color: #ff6b6b;
  354. margin: 0 15px;
  355. }
  356. /* 菜品详情弹窗 */
  357. .dish-detail-mask {
  358. position: fixed;
  359. top: 0;
  360. left: 0;
  361. right: 0;
  362. bottom: 0;
  363. background: rgba(0,0,0,0.7);
  364. z-index: 400;
  365. display: none;
  366. }
  367. .dish-detail-mask.show {
  368. display: block;
  369. }
  370. .dish-detail {
  371. position: fixed;
  372. top: 50%;
  373. left: 50%;
  374. transform: translate(-50%, -50%) scale(0);
  375. width: 90%;
  376. max-width: 500px;
  377. background: white;
  378. border-radius: 16px;
  379. z-index: 401;
  380. transition: transform 0.3s;
  381. }
  382. .dish-detail.show {
  383. transform: translate(-50%, -50%) scale(1);
  384. }
  385. .dish-detail-content {
  386. padding: 20px;
  387. }
  388. .dish-detail-img {
  389. width: 100%;
  390. height: 200px;
  391. object-fit: cover;
  392. border-radius: 12px;
  393. margin-bottom: 15px;
  394. }
  395. .dish-detail-name {
  396. font-size: 20px;
  397. margin-bottom: 10px;
  398. }
  399. .dish-detail-desc {
  400. color: #666;
  401. font-size: 14px;
  402. line-height: 1.6;
  403. margin-bottom: 15px;
  404. }
  405. .dish-detail-tags {
  406. display: flex;
  407. gap: 8px;
  408. margin-bottom: 20px;
  409. }
  410. .dish-detail-footer {
  411. display: flex;
  412. justify-content: space-between;
  413. align-items: center;
  414. }
  415. .dish-detail-price {
  416. color: #ff6b6b;
  417. font-size: 24px;
  418. font-weight: bold;
  419. }
  420. .add-to-cart-btn {
  421. background: #667eea;
  422. color: white;
  423. border: none;
  424. padding: 12px 30px;
  425. border-radius: 25px;
  426. font-size: 16px;
  427. cursor: pointer;
  428. }
  429. .close-detail {
  430. position: absolute;
  431. top: 10px;
  432. right: 10px;
  433. width: 30px;
  434. height: 30px;
  435. background: rgba(0,0,0,0.5);
  436. color: white;
  437. border-radius: 50%;
  438. display: flex;
  439. align-items: center;
  440. justify-content: center;
  441. font-size: 24px;
  442. cursor: pointer;
  443. }
  444. /* 滚动条样式 */
  445. ::-webkit-scrollbar {
  446. width: 6px;
  447. }
  448. ::-webkit-scrollbar-thumb {
  449. background: #ccc;
  450. border-radius: 3px;
  451. }
  452. ::-webkit-scrollbar-track {
  453. background: #f5f5f5;
  454. }
  455. /* 支付二维码弹窗 */
  456. .payment-mask {
  457. position: fixed;
  458. top: 0;
  459. left: 0;
  460. right: 0;
  461. bottom: 0;
  462. background: rgba(0,0,0,0.7);
  463. z-index: 500;
  464. display: none;
  465. backdrop-filter: blur(4px);
  466. }
  467. .payment-mask.show {
  468. display: block;
  469. animation: fadeIn 0.3s ease;
  470. }
  471. .payment-modal {
  472. position: fixed;
  473. top: 50%;
  474. left: 50%;
  475. transform: translate(-50%, -50%) scale(0);
  476. width: 90%;
  477. max-width: 400px;
  478. background: white;
  479. border-radius: 16px;
  480. z-index: 501;
  481. transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  482. box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  483. }
  484. .payment-modal.show {
  485. transform: translate(-50%, -50%) scale(1);
  486. }
  487. .payment-header {
  488. display: flex;
  489. justify-content: space-between;
  490. align-items: center;
  491. padding: 20px;
  492. border-bottom: 1px solid #f0f0f0;
  493. }
  494. .payment-header h3 {
  495. font-size: 20px;
  496. color: #333;
  497. margin: 0;
  498. }
  499. .close-payment {
  500. width: 32px;
  501. height: 32px;
  502. background: #f5f5f5;
  503. color: #666;
  504. border-radius: 50%;
  505. display: flex;
  506. align-items: center;
  507. justify-content: center;
  508. font-size: 24px;
  509. cursor: pointer;
  510. transition: all 0.2s;
  511. }
  512. .close-payment:hover {
  513. background: #e0e0e0;
  514. color: #333;
  515. }
  516. .payment-content {
  517. padding: 20px;
  518. }
  519. .payment-info {
  520. margin-bottom: 20px;
  521. }
  522. .info-row {
  523. display: flex;
  524. justify-content: space-between;
  525. align-items: center;
  526. padding: 10px 0;
  527. font-size: 14px;
  528. }
  529. .info-row .label {
  530. color: #666;
  531. }
  532. .info-row .value {
  533. color: #333;
  534. font-weight: 500;
  535. }
  536. .info-row .amount {
  537. color: #ff6b6b;
  538. font-size: 20px;
  539. font-weight: bold;
  540. }
  541. .qrcode-container {
  542. display: flex;
  543. flex-direction: column;
  544. align-items: center;
  545. padding: 20px;
  546. background: #f8f8f8;
  547. border-radius: 12px;
  548. margin-bottom: 20px;
  549. }
  550. .qrcode-image {
  551. width: 200px;
  552. height: 200px;
  553. padding: 15px;
  554. background: white;
  555. border-radius: 8px;
  556. box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  557. object-fit: contain;
  558. }
  559. .qrcode-tip {
  560. margin-top: 15px;
  561. font-size: 13px;
  562. color: #666;
  563. text-align: center;
  564. }
  565. .payment-status {
  566. text-align: center;
  567. }
  568. .status-checking {
  569. display: flex;
  570. flex-direction: column;
  571. align-items: center;
  572. gap: 10px;
  573. }
  574. .loading-spinner {
  575. width: 40px;
  576. height: 40px;
  577. border: 4px solid #f0f0f0;
  578. border-top-color: #667eea;
  579. border-radius: 50%;
  580. animation: spin 1s linear infinite;
  581. }
  582. @keyframes spin {
  583. to { transform: rotate(360deg); }
  584. }
  585. .status-checking p {
  586. color: #666;
  587. font-size: 14px;
  588. margin: 0;
  589. }
  590. .status-success {
  591. display: none;
  592. flex-direction: column;
  593. align-items: center;
  594. gap: 10px;
  595. }
  596. .status-success.show {
  597. display: flex;
  598. }
  599. .success-icon {
  600. width: 60px;
  601. height: 60px;
  602. background: #4caf50;
  603. border-radius: 50%;
  604. display: flex;
  605. align-items: center;
  606. justify-content: center;
  607. font-size: 32px;
  608. color: white;
  609. animation: scaleIn 0.5s ease;
  610. }
  611. @keyframes scaleIn {
  612. 0% { transform: scale(0); }
  613. 50% { transform: scale(1.1); }
  614. 100% { transform: scale(1); }
  615. }
  616. .status-success p {
  617. color: #4caf50;
  618. font-size: 16px;
  619. font-weight: bold;
  620. margin: 0;
  621. }
  622. /* 支付失败样式 */
  623. .status-failure {
  624. display: none;
  625. flex-direction: column;
  626. align-items: center;
  627. gap: 10px;
  628. }
  629. .status-failure.show {
  630. display: flex;
  631. }
  632. .failure-icon {
  633. width: 60px;
  634. height: 60px;
  635. background: #f44336;
  636. border-radius: 50%;
  637. display: flex;
  638. align-items: center;
  639. justify-content: center;
  640. font-size: 32px;
  641. color: white;
  642. animation: shakeIn 0.5s ease;
  643. }
  644. @keyframes shakeIn {
  645. 0%, 100% { transform: translateX(0); }
  646. 25% { transform: translateX(-10px); }
  647. 75% { transform: translateX(10px); }
  648. }
  649. .status-failure p {
  650. color: #f44336;
  651. font-size: 16px;
  652. font-weight: bold;
  653. margin: 0;
  654. text-align: center;
  655. }