index.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722
  1. <template>
  2. <view class="diet-page">
  3. <scroll-view class="content" scroll-y>
  4. <!-- ===== 今日餐桌主视觉 ===== -->
  5. <view class="dining-hero">
  6. <view class="hero-top">
  7. <view class="hero-icon-wrap"><text class="hero-icon">🍳</text></view>
  8. <view class="hero-text">
  9. <text class="hero-title">今日共餐</text>
  10. <text class="hero-subtitle">{{ heroSubtitle }}</text>
  11. </view>
  12. </view>
  13. <view class="hero-meals" v-if="hasMealConfig">
  14. <view class="hero-meal" v-for="m in heroMeals" :key="m.key">
  15. <text class="hero-meal-emoji">{{ m.emoji }}</text>
  16. <text class="hero-meal-label">{{ m.label }}</text>
  17. <text class="hero-meal-count">{{ m.count || '—' }}</text>
  18. </view>
  19. </view>
  20. <view class="hero-empty" v-else @tap="navTo('/pages/diet/meal-config')">
  21. <text class="hero-empty-text">还没设置共餐?点这里安排家人一起吃饭</text>
  22. <view class="hero-empty-btn">去设置共餐</view>
  23. </view>
  24. </view>
  25. <!-- 食材推荐器 -->
  26. <view class="card">
  27. <view class="card-header">
  28. <view class="card-basket-icon"><text class="card-basket-emoji">🧺</text></view>
  29. <text class="card-title">今日菜篮</text>
  30. </view>
  31. <view class="card-body">
  32. <view class="action-bar">
  33. <view class="action-btn" @tap="refreshIngredients">
  34. <text class="action-btn-text">🔄 换一批</text>
  35. </view>
  36. <view class="action-btn action-btn-primary" @tap="showFoodPicker">
  37. <text class="action-btn-text-primary">+ 添加食材</text>
  38. </view>
  39. <view class="action-btn action-btn-accent" @tap="generateRecipe" :class="{'action-btn-disabled': selectedIngredients.length === 0}">
  40. <text class="action-btn-text-accent">✨ 生成食谱</text>
  41. </view>
  42. </view>
  43. <view class="ingredient-list" v-if="ingredients.length > 0">
  44. <view class="ingredient-item" v-for="(item, index) in ingredients" :key="getIngredientKey(item, index)">
  45. <view class="ingredient-left">
  46. <view class="ingredient-badge">
  47. <text class="ingredient-badge-text">{{ index + 1 }}</text>
  48. </view>
  49. <view class="ingredient-info">
  50. <text class="ingredient-name">{{ item.name }}</text>
  51. <text class="ingredient-reason" v-if="item.reason">{{ item.reason }}</text>
  52. </view>
  53. </view>
  54. <view class="ingredient-remove" @tap="removeIngredient(index)">
  55. <text class="remove-text">✕</text>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="empty-state" v-else>
  60. <text class="empty-icon">🥬</text>
  61. <text class="empty-text">{{ ingredientsLoading ? '加载中...' : '暂无推荐食材' }}</text>
  62. <text class="empty-sub" v-if="!ingredientsLoading">点击「添加食材」或「换一批」获取推荐</text>
  63. </view>
  64. </view>
  65. </view>
  66. <!-- 快捷入口 -->
  67. <view class="section-label">
  68. <text class="section-label-text">常用功能</text>
  69. </view>
  70. <view class="nav-grid">
  71. <view class="nav-item" @tap="navTo('/pages/diet/food-query')">
  72. <view class="nav-icon-wrap nav-icon-green">
  73. <text class="nav-icon">🥗</text>
  74. </view>
  75. <text class="nav-label">食材查询</text>
  76. </view>
  77. <view class="nav-item" @tap="navTo('/pages/diet/records')">
  78. <view class="nav-icon-wrap nav-icon-blue">
  79. <text class="nav-icon">📝</text>
  80. </view>
  81. <text class="nav-label">饮食记录</text>
  82. </view>
  83. <view class="nav-item" @tap="navTo('/pages/diet/preferences')">
  84. <view class="nav-icon-wrap nav-icon-orange">
  85. <text class="nav-icon">📋</text>
  86. </view>
  87. <text class="nav-label">调研表</text>
  88. </view>
  89. <view class="nav-item" @tap="navTo('/pages/diet/meal-config')">
  90. <view class="nav-icon-wrap nav-icon-purple">
  91. <text class="nav-icon">👨‍👩‍👧</text>
  92. </view>
  93. <text class="nav-label">共餐配置</text>
  94. </view>
  95. <view class="nav-item" @tap="navTo('/pages/diet/recommendation')">
  96. <view class="nav-icon-wrap nav-icon-red">
  97. <text class="nav-icon">🍽️</text>
  98. </view>
  99. <text class="nav-label">食谱推荐</text>
  100. </view>
  101. </view>
  102. <!-- 本周趋势 -->
  103. <view class="card" v-if="trendData.days > 0">
  104. <view class="card-header">
  105. <view class="card-dot"></view>
  106. <text class="card-title">本周饮食</text>
  107. </view>
  108. <view class="card-body">
  109. <view class="trend-row">
  110. <view class="trend-item">
  111. <text class="trend-num">{{ trendData.totalCalories || 0 }}</text>
  112. <text class="trend-unit">kcal</text>
  113. <text class="trend-label">总摄入</text>
  114. </view>
  115. <view class="trend-divider"></view>
  116. <view class="trend-item">
  117. <text class="trend-num">{{ trendData.days }}</text>
  118. <text class="trend-unit">天</text>
  119. <text class="trend-label">记录天数</text>
  120. </view>
  121. </view>
  122. </view>
  123. </view>
  124. <!-- 底部留白 -->
  125. <view class="bottom-space"></view>
  126. </scroll-view>
  127. <!-- 食材选择弹窗 -->
  128. <view class="modal" v-if="showPicker" @tap="closePicker">
  129. <view class="modal-mask"></view>
  130. <view class="modal-content" @tap.stop>
  131. <view class="modal-header">
  132. <text class="modal-title">选择食材</text>
  133. <view class="modal-close" @tap="closePicker">
  134. <text class="close-text">✕</text>
  135. </view>
  136. </view>
  137. <view class="search-wrap">
  138. <input class="search-input" placeholder="搜索食材..." placeholder-style="color:#bbb" v-model="searchQuery" @input="searchFood" />
  139. </view>
  140. <scroll-view class="food-list" scroll-y>
  141. <view class="food-item" v-for="food in searchResults" :key="food.id" @tap="addFood(food)">
  142. <text class="food-name">{{ food.name }}</text>
  143. <text class="food-tag">{{ food.category }}</text>
  144. </view>
  145. </scroll-view>
  146. <view class="empty-state" v-if="searchResults.length === 0 && searchQuery">
  147. <text class="empty-text">未找到匹配食材</text>
  148. </view>
  149. </view>
  150. </view>
  151. </view>
  152. </template>
  153. <script>
  154. import { getDietIngredients, refreshDietIngredients, addDietIngredient, removeDietIngredient, generateDietRecommendation, getMealConfig } from '@/utils/api.js'
  155. import { parseDate } from '@/utils/format.js'
  156. export default {
  157. data: function() {
  158. return {
  159. familyId: null,
  160. familyMemberId: null,
  161. ingredients: [],
  162. selectedIngredients: [],
  163. ingredientsLoading: false,
  164. mealSummary: {},
  165. trendData: {},
  166. showPicker: false,
  167. searchQuery: '',
  168. searchResults: [],
  169. uploadPromptShown: false
  170. }
  171. },
  172. computed: {
  173. heroSubtitle: function() {
  174. var self = this
  175. return (self.isWeekend(new Date()) ? '周末' : '工作日') + ' · 全家一起吃饭'
  176. },
  177. heroMeals: function() {
  178. var defs = [
  179. { key: 'breakfast', label: '早餐', emoji: '🌅' },
  180. { key: 'lunch', label: '午餐', emoji: '☀️' },
  181. { key: 'dinner', label: '晚餐', emoji: '🌙' }
  182. ]
  183. var self = this
  184. return defs.map(function(d) {
  185. return { key: d.key, label: d.label, emoji: d.emoji, count: self.mealSummary[d.key] || '' }
  186. })
  187. },
  188. hasMealConfig: function() {
  189. return !!(this.mealSummary.breakfast || this.mealSummary.lunch || this.mealSummary.dinner)
  190. }
  191. },
  192. onLoad: function() {
  193. this.familyId = uni.getStorageSync('familyId')
  194. this.familyMemberId = uni.getStorageSync('currentChildId') || uni.getStorageSync('currentMemberId') || uni.getStorageSync('userId')
  195. this.loadIngredients()
  196. this.loadMealSummary()
  197. },
  198. onShow: function() {
  199. // onLoad 已加载过,onShow 只刷新食材(共餐配置不重复请求)
  200. this.loadIngredients()
  201. },
  202. methods: {
  203. navTo: function(url) {
  204. uni.navigateTo({ url: url })
  205. },
  206. getIngredientKey: function(item, index) {
  207. return 'ing-' + (item.id || index)
  208. },
  209. loadIngredients: function() {
  210. var self = this
  211. self.ingredientsLoading = true
  212. getDietIngredients().then(function(res) {
  213. self.ingredientsLoading = false
  214. if (res && res.code === 200 && res.data && res.data.ingredients) {
  215. self.ingredients = res.data.ingredients
  216. if (self.ingredients.length === 0 && !self.uploadPromptShown) {
  217. self.uploadPromptShown = true
  218. uni.showModal({
  219. title: '暂无推荐食材',
  220. content: '还未上传菌群报告,无法生成个性化食材推荐。是否前往上传报告?',
  221. confirmText: '去上传',
  222. cancelText: '稍后',
  223. success: function(modalRes) {
  224. if (modalRes.confirm) {
  225. uni.navigateTo({ url: '/pages/health/report-upload' })
  226. }
  227. }
  228. })
  229. }
  230. }
  231. }).catch(function() {
  232. self.ingredientsLoading = false
  233. })
  234. },
  235. refreshIngredients: function() {
  236. var self = this
  237. self.ingredientsLoading = true
  238. refreshDietIngredients().then(function(res) {
  239. self.ingredientsLoading = false
  240. if (res && res.code === 200 && res.data && res.data.ingredients) {
  241. self.ingredients = res.data.ingredients
  242. }
  243. }).catch(function() {
  244. self.ingredientsLoading = false
  245. })
  246. },
  247. addIngredient: function(index) {
  248. var self = this
  249. var item = this.ingredients[index]
  250. addDietIngredient({ food_id: item.foodId, name: item.name }).then(function(res) {
  251. self.loadIngredients()
  252. })
  253. },
  254. removeIngredient: function(index) {
  255. var self = this
  256. var item = this.ingredients[index]
  257. removeDietIngredient({ food_id: item.foodId }).then(function(res) {
  258. self.loadIngredients()
  259. })
  260. },
  261. generateRecipe: function() {
  262. var self = this
  263. var foodIds = this.ingredients.map(function(item) { return { food_id: item.foodId, name: item.name } })
  264. generateDietRecommendation({
  265. date: self.formatDate(new Date()),
  266. meal_type: 'all',
  267. selected_foods: JSON.stringify(foodIds)
  268. }).then(function(res) {
  269. if (res && res.id) {
  270. uni.showToast({ title: '食谱生成成功', icon: 'success' })
  271. setTimeout(function() {
  272. self.navTo('/pages/diet/recommendation')
  273. }, 1000)
  274. }
  275. })
  276. },
  277. formatDate: function(date) {
  278. var d = parseDate(date)
  279. if (!d) return ''
  280. var m = (d.getMonth() + 1).toString()
  281. if (m.length < 2) m = '0' + m
  282. var day = d.getDate().toString()
  283. if (day.length < 2) day = '0' + day
  284. return d.getFullYear() + '-' + m + '-' + day
  285. },
  286. loadMealSummary: function() {
  287. var self = this
  288. var dateType = self.isWeekend(new Date()) ? 'weekend' : 'weekday'
  289. Promise.all([
  290. getMealConfig({ date_type: dateType, meal_type: 'breakfast' }),
  291. getMealConfig({ date_type: dateType, meal_type: 'lunch' }),
  292. getMealConfig({ date_type: dateType, meal_type: 'dinner' })
  293. ]).then(function(results) {
  294. self.mealSummary.breakfast = self.parseMembers(results[0])
  295. self.mealSummary.lunch = self.parseMembers(results[1])
  296. self.mealSummary.dinner = self.parseMembers(results[2])
  297. })
  298. },
  299. parseMembers: function(result) {
  300. if (!result || result.code !== 200 || !result.data) return ''
  301. var config = result.data
  302. if (!config || !config.participantMemberIds) return ''
  303. try {
  304. var ids = JSON.parse(config.participantMemberIds)
  305. return '共 ' + ids.length + ' 人'
  306. } catch (e) {
  307. return ''
  308. }
  309. },
  310. isWeekend: function(date) {
  311. var day = date.getDay()
  312. return day === 0 || day === 6
  313. },
  314. showFoodPicker: function() {
  315. this.showPicker = true
  316. },
  317. closePicker: function() {
  318. this.showPicker = false
  319. this.searchQuery = ''
  320. this.searchResults = []
  321. },
  322. searchFood: function() {
  323. if (!this.searchQuery) {
  324. this.searchResults = []
  325. return
  326. }
  327. this.searchResults = []
  328. },
  329. addFood: function(food) {
  330. var self = this
  331. addDietIngredient({ food_id: food.id, name: food.name }).then(function(res) {
  332. self.closePicker()
  333. self.loadIngredients()
  334. })
  335. }
  336. }
  337. }
  338. </script>
  339. <style scoped>
  340. /* ===== 页面令牌(暖灶·家的味道) ===== */
  341. .diet-page {
  342. min-height: 100vh;
  343. background: linear-gradient(180deg, #FFF7ED 0%, #FFF3E6 100%);
  344. overflow: hidden;
  345. }
  346. .dining-hero {
  347. background: linear-gradient(135deg, #FF8C42, #FFB366);
  348. border-radius: 32rpx;
  349. padding: 36rpx 32rpx;
  350. margin-bottom: 24rpx;
  351. box-shadow: 0 8rpx 32rpx rgba(255, 140, 66, 0.25);
  352. }
  353. .hero-top { display: flex; align-items: center; margin-bottom: 24rpx; }
  354. .hero-icon-wrap {
  355. width: 88rpx; height: 88rpx; border-radius: 50%;
  356. background: rgba(255,255,255,0.22);
  357. display: flex; align-items: center; justify-content: center;
  358. margin-right: 20rpx; flex-shrink: 0;
  359. }
  360. .hero-icon { font-size: 44rpx; }
  361. .hero-title { font-size: 38rpx; font-weight: 700; color: #FFFFFF; display: block; }
  362. .hero-subtitle { font-size: 24rpx; color: rgba(255,255,255,0.85); margin-top: 6rpx; display: block; }
  363. .hero-meals { display: flex; }
  364. .hero-meal {
  365. flex: 1; margin: 0 8rpx;
  366. background: rgba(255,255,255,0.18);
  367. border-radius: 20rpx; padding: 20rpx 8rpx;
  368. display: flex; flex-direction: column; align-items: center;
  369. }
  370. .hero-meal:first-child { margin-left: 0; }
  371. .hero-meal:last-child { margin-right: 0; }
  372. .hero-meal-emoji { font-size: 40rpx; margin-bottom: 8rpx; }
  373. .hero-meal-label { font-size: 24rpx; color: #FFFFFF; }
  374. .hero-meal-count { font-size: 22rpx; color: rgba(255,255,255,0.9); margin-top: 6rpx; font-weight: 600; }
  375. .hero-empty { display: flex; flex-direction: column; align-items: center; padding: 12rpx 0; }
  376. .hero-empty-text { font-size: 26rpx; color: #FFFFFF; margin-bottom: 20rpx; }
  377. .hero-empty-btn {
  378. background: #FFFFFF; color: #C2410C; font-size: 28rpx; font-weight: 600;
  379. padding: 18rpx 44rpx; border-radius: 999rpx;
  380. }
  381. .content {
  382. padding: 24rpx 32rpx;
  383. box-sizing: border-box;
  384. width: 100%;
  385. overflow: hidden;
  386. }
  387. /* 共餐格子 */
  388. .card {
  389. background: #FFFFFF;
  390. border-radius: 24rpx;
  391. margin-bottom: 24rpx;
  392. box-shadow: 0 4rpx 20rpx rgba(255, 140, 66, 0.08);
  393. overflow: hidden;
  394. box-sizing: border-box;
  395. width: 100%;
  396. }
  397. .card-header {
  398. display: flex;
  399. align-items: center;
  400. padding: 28rpx 28rpx 0;
  401. }
  402. .card-basket-icon {
  403. width: 64rpx; height: 64rpx; border-radius: 18rpx;
  404. background: linear-gradient(135deg, #FF8C42, #FFB366);
  405. display: flex; align-items: center; justify-content: center;
  406. margin-right: 16rpx; flex-shrink: 0;
  407. }
  408. .card-basket-emoji { font-size: 32rpx; }
  409. .card-title {
  410. font-size: 30rpx;
  411. font-weight: 600;
  412. color: #333;
  413. }
  414. .card-body {
  415. padding: 24rpx 28rpx 28rpx;
  416. }
  417. /* 操作按钮栏 */
  418. .action-bar {
  419. display: flex;
  420. margin-bottom: 24rpx;
  421. box-sizing: border-box;
  422. width: 100%;
  423. }
  424. .action-btn {
  425. padding: 14rpx 24rpx;
  426. border-radius: 32rpx;
  427. background: #F5F5F5;
  428. margin-right: 16rpx;
  429. }
  430. .action-btn:last-child {
  431. margin-right: 0;
  432. }
  433. .action-btn-primary {
  434. background: #FF8C42;
  435. }
  436. .action-btn-accent { background: linear-gradient(135deg, #10B981, #34D399); }
  437. .action-btn-text-accent { color: #FFFFFF; }
  438. .action-btn-disabled {
  439. opacity: 0.4;
  440. }
  441. .action-btn-text {
  442. font-size: 24rpx;
  443. color: #666;
  444. }
  445. .action-btn-text-primary {
  446. font-size: 24rpx;
  447. color: #FFFFFF;
  448. }
  449. .action-btn-text-accent {
  450. font-size: 24rpx;
  451. color: #FF8C42;
  452. }
  453. /* 食材列表 */
  454. .ingredient-list {
  455. margin-top: 8rpx;
  456. }
  457. .ingredient-item:active { background: #FFF9F0; }
  458. .ingredient-item {
  459. display: flex;
  460. align-items: center;
  461. justify-content: space-between;
  462. padding: 20rpx 0;
  463. border-bottom: 1rpx solid #F5F5F5;
  464. }
  465. .ingredient-item:last-child {
  466. border-bottom: none;
  467. }
  468. .ingredient-left {
  469. display: flex;
  470. align-items: center;
  471. flex: 1;
  472. }
  473. .ingredient-badge {
  474. width: 40rpx;
  475. height: 40rpx;
  476. border-radius: 12rpx;
  477. background: linear-gradient(135deg, #FF8C42, #FFB366);
  478. display: flex;
  479. align-items: center;
  480. justify-content: center;
  481. margin-right: 20rpx;
  482. flex-shrink: 0;
  483. }
  484. .ingredient-badge-text {
  485. font-size: 20rpx;
  486. color: #FFFFFF;
  487. font-weight: 600;
  488. }
  489. .ingredient-info {
  490. display: flex;
  491. flex-direction: column;
  492. flex: 1;
  493. }
  494. .ingredient-name {
  495. font-size: 28rpx;
  496. color: #333;
  497. font-weight: 500;
  498. }
  499. .ingredient-reason {
  500. font-size: 22rpx;
  501. color: #999;
  502. margin-top: 4rpx;
  503. }
  504. .ingredient-remove {
  505. width: 48rpx;
  506. height: 48rpx;
  507. display: flex;
  508. align-items: center;
  509. justify-content: center;
  510. flex-shrink: 0;
  511. }
  512. .remove-text {
  513. font-size: 28rpx;
  514. color: #ccc;
  515. }
  516. /* 区域标签 */
  517. .section-label {
  518. padding: 8rpx 0 16rpx;
  519. }
  520. .section-label-text {
  521. font-size: 28rpx;
  522. font-weight: 600;
  523. color: #333;
  524. }
  525. /* 快捷入口网格 */
  526. .nav-grid {
  527. display: flex;
  528. flex-wrap: wrap;
  529. margin-bottom: 24rpx;
  530. box-sizing: border-box;
  531. width: 100%;
  532. }
  533. .nav-item {
  534. width: 20%;
  535. display: flex;
  536. flex-direction: column;
  537. align-items: center;
  538. padding: 20rpx 0;
  539. position: relative;
  540. z-index: 1;
  541. }
  542. .nav-icon-wrap {
  543. width: 88rpx;
  544. height: 88rpx;
  545. border-radius: 24rpx;
  546. display: flex;
  547. align-items: center;
  548. justify-content: center;
  549. margin-bottom: 12rpx;
  550. }
  551. .nav-icon-green { background: linear-gradient(135deg, #FFF1E6, #FFE0C0); }
  552. .nav-icon-blue { background: linear-gradient(135deg, #FFF7ED, #FFEEDD); }
  553. .nav-icon-orange{ background: linear-gradient(135deg, #FF8C42, #FFB366); }
  554. .nav-icon-purple{ background: linear-gradient(135deg, #FFE8D6, #FFD4B0); }
  555. .nav-icon-red { background: linear-gradient(135deg, #E8F8F1, #C8F0E0); }
  556. .nav-item:active .nav-icon-wrap { transform: scale(0.92); }
  557. .nav-icon-wrap { transition: transform 0.15s ease; }
  558. .nav-icon {
  559. font-size: 36rpx;
  560. }
  561. .nav-label {
  562. font-size: 22rpx;
  563. color: #333;
  564. }
  565. /* 趋势卡片 */
  566. .trend-row {
  567. display: flex;
  568. align-items: center;
  569. box-sizing: border-box;
  570. width: 100%;
  571. }
  572. .trend-item {
  573. flex: 1;
  574. display: flex;
  575. flex-direction: column;
  576. align-items: center;
  577. }
  578. .trend-divider {
  579. width: 1rpx;
  580. height: 60rpx;
  581. background: #FDE8D0;
  582. }
  583. .trend-num {
  584. font-size: 48rpx;
  585. font-weight: 700;
  586. color: #FF8C42;
  587. }
  588. .trend-unit {
  589. font-size: 22rpx;
  590. color: #999;
  591. margin-top: 4rpx;
  592. }
  593. .trend-label {
  594. font-size: 22rpx;
  595. color: #666;
  596. margin-top: 4rpx;
  597. }
  598. /* 空状态 */
  599. .empty-state {
  600. display: flex;
  601. flex-direction: column;
  602. align-items: center;
  603. padding: 40rpx 0;
  604. }
  605. .empty-icon {
  606. font-size: 48rpx;
  607. margin-bottom: 12rpx;
  608. }
  609. .empty-text {
  610. font-size: 26rpx;
  611. color: #999;
  612. }
  613. .empty-sub {
  614. font-size: 22rpx;
  615. color: #ccc;
  616. margin-top: 8rpx;
  617. }
  618. /* 弹窗 */
  619. .modal {
  620. position: fixed;
  621. top: 0;
  622. left: 0;
  623. right: 0;
  624. bottom: 0;
  625. z-index: 999;
  626. display: flex;
  627. align-items: flex-end;
  628. justify-content: center;
  629. }
  630. .modal-mask {
  631. position: fixed;
  632. top: 0;
  633. left: 0;
  634. right: 0;
  635. bottom: 0;
  636. background: rgba(0, 0, 0, 0.5);
  637. }
  638. .modal-content {
  639. position: relative;
  640. width: 100%;
  641. max-height: 80vh;
  642. background: #FFFFFF;
  643. border-radius: 32rpx 32rpx 0 0;
  644. padding: 32rpx;
  645. z-index: 1;
  646. }
  647. .modal-header {
  648. display: flex;
  649. align-items: center;
  650. justify-content: space-between;
  651. margin-bottom: 24rpx;
  652. }
  653. .modal-title {
  654. font-size: 32rpx;
  655. font-weight: 600;
  656. color: #333;
  657. }
  658. .modal-close {
  659. width: 48rpx;
  660. height: 48rpx;
  661. display: flex;
  662. align-items: center;
  663. justify-content: center;
  664. }
  665. .close-text {
  666. font-size: 32rpx;
  667. color: #999;
  668. }
  669. .search-wrap {
  670. margin-bottom: 20rpx;
  671. }
  672. .search-input {
  673. border: 1rpx solid #eee;
  674. border-radius: 40rpx;
  675. padding: 20rpx 28rpx;
  676. font-size: 28rpx;
  677. background: #F8F8F8;
  678. }
  679. .food-list {
  680. max-height: 500rpx;
  681. }
  682. .food-item {
  683. display: flex;
  684. align-items: center;
  685. justify-content: space-between;
  686. padding: 24rpx 0;
  687. border-bottom: 1rpx solid #F5F5F5;
  688. }
  689. .food-name {
  690. font-size: 28rpx;
  691. color: #333;
  692. }
  693. .food-tag {
  694. font-size: 22rpx;
  695. color: #FF8C42;
  696. background: #FFF0E0;
  697. padding: 6rpx 16rpx;
  698. border-radius: 20rpx;
  699. }
  700. /* 底部留白 */
  701. .bottom-space {
  702. height: 40rpx;
  703. }
  704. </style>