index.vue 19 KB

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