DishOrderAdd.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425
  1. <template>
  2. <view class="dish-order-add">
  3. <view class="order-header">
  4. <view class="header-row">
  5. <view class="room-info">
  6. <view class="room-name">{{ currentRoom.roomName || '-' }}</view>
  7. <view class="room-no-chip">包房号 {{ currentRoom.roomNo || '-' }}</view>
  8. </view>
  9. <button class="mini-btn ghost" @click="backOrderDetail">返回订单</button>
  10. </view>
  11. <view class="dish-search">
  12. <input class="search-input" v-model="dishSearchName" placeholder="搜索菜品名称" confirm-type="search"
  13. @confirm="searchDish" />
  14. <button class="search-btn" @click="searchDish">搜索</button>
  15. </view>
  16. </view>
  17. <view class="order-main">
  18. <view class="dish-panel">
  19. <scroll-view scroll-x class="category-bar" :show-scrollbar="false">
  20. <view v-for="item in categoryList" :key="item.id" class="category-pill"
  21. :class="{ active: activeTypeId === item.id }" @click="changeType(item)">
  22. {{ item.name }}
  23. </view>
  24. </scroll-view>
  25. <scroll-view scroll-y class="dish-list">
  26. <view v-if="dishLoading" class="empty-box">加载中...</view>
  27. <view v-else-if="dishList.length === 0" class="empty-box">暂无菜品</view>
  28. <view v-else class="dish-grid">
  29. <view v-for="item in dishList" :key="item.id" class="dish-card">
  30. <image v-if="item.previewImageUrl" class="dish-image" :src="item.previewImageUrl"
  31. mode="aspectFill"></image>
  32. <view v-else class="dish-image dish-image-empty">暂无图片</view>
  33. <view class="dish-info">
  34. <view class="dish-name" @click="openDishDetail(item)">{{ item.dishName }}</view>
  35. <view class="dish-desc">{{ item.spec || item.taste || item.remarks || '暂无说明' }}</view>
  36. <view class="dish-bottom">
  37. <text class="dish-price">¥{{ formatMoney(item.salePrice) }}</text>
  38. <view v-if="orderedRow(item)" class="card-stepper">
  39. <button class="step-btn" @click="reduceDish(orderedRow(item))">-</button>
  40. <text class="step-qty">{{ orderedRow(item).quantity }}</text>
  41. <button class="step-btn plus" @click="increaseOrderedDish(orderedRow(item))">+</button>
  42. </view>
  43. <button v-else class="plain-btn" @click="addDish(item)">点菜</button>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </scroll-view>
  49. </view>
  50. </view>
  51. <view class="cart-bar">
  52. <view class="cart-bar-left" @click="cartSheetVisible = true">
  53. <view class="cart-badge">{{ orderQuantity }}</view>
  54. <view class="cart-bar-text">
  55. <text class="cart-bar-count">共 {{ orderedList.length }} 项</text>
  56. <text class="cart-bar-total">¥{{ formatMoney(orderTotal) }}</text>
  57. </view>
  58. </view>
  59. <view class="cart-bar-actions">
  60. <button class="bar-btn ghost" @click="cartSheetVisible = true">查看加菜</button>
  61. <button class="bar-btn primary" :disabled="submitting" @click="confirmSubmitOrder">下单</button>
  62. </view>
  63. </view>
  64. <view v-if="cartSheetVisible" class="modal-mask sheet-mask" @click="cartSheetVisible = false">
  65. <view class="cart-sheet" @click.stop>
  66. <view class="sheet-head">
  67. <text>本次加菜({{ orderedList.length }} 项)</text>
  68. <text class="sheet-close" @click="cartSheetVisible = false">收起</text>
  69. </view>
  70. <scroll-view scroll-y class="sheet-list">
  71. <view v-if="orderedList.length === 0" class="ordered-empty">
  72. <view class="ordered-empty-title">暂未加菜</view>
  73. <view class="ordered-empty-sub">从上方选择菜品后会显示在这里</view>
  74. </view>
  75. <view v-for="item in orderedList" :key="item.dishId" class="sheet-item">
  76. <view class="sheet-item-main">
  77. <view class="ordered-dish-name">{{ item.dishName }}</view>
  78. <view class="sheet-item-price">¥{{ formatMoney(item.salePrice) }} / 份</view>
  79. </view>
  80. <view class="ordered-qty">
  81. <button class="qty-btn" @click="reduceDish(item)">-</button>
  82. <text>{{ item.quantity }}</text>
  83. <button class="qty-btn plus" @click="increaseOrderedDish(item)">+</button>
  84. </view>
  85. </view>
  86. </scroll-view>
  87. <view class="sheet-foot">
  88. <text>总价 <strong>¥{{ formatMoney(orderTotal) }}</strong></text>
  89. <button class="bar-btn primary" :disabled="submitting" @click="confirmSubmitOrder">下单</button>
  90. </view>
  91. </view>
  92. </view>
  93. <view v-if="dishDetailVisible" class="modal-mask" @click="dishDetailVisible = false">
  94. <view class="modal-card dish-detail-card" @click.stop>
  95. <view class="detail-head">
  96. <text class="detail-title">菜品详情</text>
  97. <text class="detail-close" @click="dishDetailVisible = false">✕</text>
  98. </view>
  99. <scroll-view scroll-y class="dish-detail-body">
  100. <view class="detail-name-row">
  101. <text class="detail-name">{{ currentDish.dishName || '-' }}</text>
  102. <view v-if="currentDish.typeName" class="detail-type-chip">{{ currentDish.typeName }}</view>
  103. </view>
  104. <view class="detail-grid">
  105. <view class="detail-cell">
  106. <text class="detail-label">单位</text>
  107. <text class="detail-value">{{ currentDish.unit || '-' }}</text>
  108. </view>
  109. <view class="detail-cell">
  110. <text class="detail-label">规格</text>
  111. <text class="detail-value">{{ currentDish.spec || '-' }}</text>
  112. </view>
  113. <view class="detail-cell wide">
  114. <text class="detail-label">口味</text>
  115. <text class="detail-value">{{ currentDish.taste || '-' }}</text>
  116. </view>
  117. <view class="detail-cell wide">
  118. <text class="detail-label">备注</text>
  119. <text class="detail-value">{{ currentDish.remarks || '-' }}</text>
  120. </view>
  121. <view class="detail-cell wide">
  122. <text class="detail-label">菜品图片</text>
  123. <view v-if="!currentDish.previewImageList || currentDish.previewImageList.length === 0"
  124. class="detail-value">暂无图片</view>
  125. <view v-else class="detail-image-list">
  126. <image v-for="(url, index) in currentDish.previewImageList" :key="index"
  127. class="detail-image" :src="url" mode="aspectFill"
  128. @click="previewDetailImage(url)"></image>
  129. </view>
  130. </view>
  131. </view>
  132. </scroll-view>
  133. </view>
  134. </view>
  135. </view>
  136. </template>
  137. <script>
  138. import DishOrderService from '@/api/psi/DishOrderService'
  139. import OSSSerivce from '@/api/sys/OSSService'
  140. export default {
  141. data() {
  142. return {
  143. roomId: '',
  144. orderId: '',
  145. currentRoom: {},
  146. currentOrder: null,
  147. categoryList: [],
  148. activeTypeId: 'all',
  149. dishSearchName: '',
  150. dishList: [],
  151. orderedList: [],
  152. existDishSortMap: {},
  153. maxDishSort: 0,
  154. dishLoading: false,
  155. orderLoading: false,
  156. submitting: false,
  157. cartSheetVisible: false,
  158. dishDetailVisible: false,
  159. currentDish: {},
  160. dishOrderService: null,
  161. ossService: null
  162. }
  163. },
  164. computed: {
  165. orderTotal() {
  166. return this.orderedList.reduce((total, item) => total + this.itemTotal(item), 0)
  167. },
  168. orderQuantity() {
  169. return this.orderedList.reduce((total, item) => total + Number(item.quantity || 0), 0)
  170. },
  171. submitDetailList() {
  172. let appendIndex = 0
  173. return this.orderedList.map((item) => {
  174. let dishSort = this.existDishSortMap[item.dishId]
  175. if (!dishSort) {
  176. appendIndex += 1
  177. dishSort = this.maxDishSort + appendIndex
  178. }
  179. return {
  180. dishId: item.dishId,
  181. dishName: item.dishName,
  182. quantity: item.quantity,
  183. dishSort
  184. }
  185. })
  186. }
  187. },
  188. onLoad(option) {
  189. this.roomId = option && option.roomId ? option.roomId : ''
  190. this.orderId = option && option.orderId ? option.orderId : ''
  191. uni.setNavigationBarTitle({ title: '加菜' })
  192. this.dishOrderService = new DishOrderService()
  193. this.ossService = new OSSSerivce()
  194. this.initPage()
  195. },
  196. methods: {
  197. initPage() {
  198. if (!this.roomId) {
  199. this.backOrderDetail()
  200. return
  201. }
  202. this.orderedList = []
  203. this.activeTypeId = 'all'
  204. this.dishSearchName = ''
  205. this.loadRoom(this.roomId)
  206. this.loadCurrentOrder(this.roomId)
  207. this.loadCategoryList()
  208. this.loadDishList()
  209. },
  210. loadRoom(roomId) {
  211. this.dishOrderService.findRoomById(roomId).then((data) => {
  212. this.currentRoom = data || {}
  213. })
  214. },
  215. loadCurrentOrder(roomId) {
  216. this.orderLoading = true
  217. this.dishOrderService.currentOrder(roomId).then((data) => {
  218. this.currentOrder = data || null
  219. if (!this.currentOrder || !this.currentOrder.id) {
  220. uni.showToast({ title: '当前包房暂无未结账订单,请先下单', icon: 'none' })
  221. this.backOrderDetail()
  222. return
  223. }
  224. this.buildDishSortMap(this.currentOrder.detailList || [])
  225. }).finally(() => {
  226. this.orderLoading = false
  227. })
  228. },
  229. buildDishSortMap(detailList) {
  230. this.existDishSortMap = {}
  231. this.maxDishSort = 0
  232. detailList.forEach((item) => {
  233. const sort = Number(item.dishSort || 0)
  234. if (item.dishId && sort > 0) {
  235. this.existDishSortMap[item.dishId] = sort
  236. }
  237. if (sort > this.maxDishSort) {
  238. this.maxDishSort = sort
  239. }
  240. })
  241. },
  242. loadCategoryList() {
  243. this.dishOrderService.typeList().then((data) => {
  244. this.categoryList = [
  245. { id: 'all', name: '所有菜品' },
  246. ...(Array.isArray(data) ? data.map(item => ({ id: item.id, name: item.name })) : [])
  247. ]
  248. })
  249. },
  250. changeType(item) {
  251. this.activeTypeId = item.id
  252. this.dishSearchName = ''
  253. this.loadDishList()
  254. },
  255. searchDish() {
  256. this.activeTypeId = 'all'
  257. this.loadDishList()
  258. },
  259. loadDishList() {
  260. this.dishLoading = true
  261. this.dishOrderService.dishList({
  262. typeId: this.activeTypeId === 'all' ? '' : this.activeTypeId,
  263. dishName: this.dishSearchName
  264. }).then((data) => {
  265. this.dishList = Array.isArray(data) ? data : []
  266. this.loadDishImagePreview()
  267. }).finally(() => {
  268. this.dishLoading = false
  269. })
  270. },
  271. addDish(dish) {
  272. const row = this.orderedList.find(item => item.dishId === dish.id)
  273. if (row) {
  274. row.quantity += 1
  275. return
  276. }
  277. this.orderedList.push(this.toOrderedItem(dish, 1))
  278. },
  279. increaseOrderedDish(item) {
  280. item.quantity += 1
  281. },
  282. reduceDish(item) {
  283. if (item.quantity <= 1) {
  284. this.orderedList = this.orderedList.filter(row => row.dishId !== item.dishId)
  285. return
  286. }
  287. item.quantity -= 1
  288. },
  289. orderedRow(dish) {
  290. return this.orderedList.find(item => item.dishId === dish.id) || null
  291. },
  292. confirmSubmitOrder() {
  293. if (this.orderedList.length === 0) {
  294. uni.showToast({ title: '请先选择菜品', icon: 'none' })
  295. return
  296. }
  297. uni.showModal({
  298. title: '提示',
  299. content: '是否确认下单?',
  300. success: (res) => {
  301. if (res.confirm) {
  302. this.submitOrder()
  303. }
  304. }
  305. })
  306. },
  307. submitOrder() {
  308. this.submitting = true
  309. this.dishOrderService.submit({
  310. id: this.currentOrder ? this.currentOrder.id : this.orderId,
  311. roomId: this.roomId,
  312. settleFlag: '0',
  313. detailList: this.submitDetailList
  314. }).then((data) => {
  315. uni.showToast({ title: data || '下单成功', icon: 'none' })
  316. this.backOrderDetail()
  317. }).finally(() => {
  318. this.submitting = false
  319. })
  320. },
  321. toOrderedItem(item, quantity) {
  322. return {
  323. dishId: item.dishId || item.id,
  324. dishName: item.dishName,
  325. salePrice: Number(item.salePrice || 0),
  326. quantity
  327. }
  328. },
  329. itemTotal(item) {
  330. return Number(item.salePrice || 0) * Number(item.quantity || 0)
  331. },
  332. loadDishImagePreview() {
  333. this.dishList.forEach((row) => {
  334. const urls = this.getImageUrls(row.imageUrl)
  335. if (urls.length === 0) {
  336. this.$set ? this.$set(row, 'previewImageUrl', '') : row.previewImageUrl = ''
  337. this.$set ? this.$set(row, 'previewImageList', []) : row.previewImageList = []
  338. return
  339. }
  340. this.$set ? this.$set(row, 'previewImageUrl', urls[0]) : row.previewImageUrl = urls[0]
  341. this.$set ? this.$set(row, 'previewImageList', urls) : row.previewImageList = urls
  342. Promise.all(urls.map(url => this.getPreviewUrl(url))).then((list) => {
  343. row.previewImageUrl = list[0]
  344. row.previewImageList = list
  345. })
  346. })
  347. },
  348. getImageUrls(value) {
  349. if (!value) {
  350. return []
  351. }
  352. return value.split(',').map(item => item.trim()).filter(item => item)
  353. },
  354. getPreviewUrl(url) {
  355. if (!url) {
  356. return Promise.resolve('')
  357. }
  358. if (url.indexOf('http') === 0) {
  359. return Promise.resolve(url)
  360. }
  361. return this.ossService.getTemporaryUrl(url).catch(() => url)
  362. },
  363. openDishDetail(item) {
  364. this.currentDish = item || {}
  365. this.dishDetailVisible = true
  366. },
  367. previewDetailImage(url) {
  368. const urls = this.currentDish.previewImageList || []
  369. if (urls.length === 0) {
  370. return
  371. }
  372. uni.previewImage({
  373. urls,
  374. current: url
  375. })
  376. },
  377. formatMoney(value) {
  378. return Number(value || 0).toFixed(2)
  379. },
  380. backOrderDetail() {
  381. uni.navigateBack({
  382. fail: () => {
  383. uni.redirectTo({
  384. url: `/pages/psiManagement/dishManage/DishOrderDetail?roomId=${this.roomId}`
  385. })
  386. }
  387. })
  388. }
  389. }
  390. }
  391. </script>
  392. <style scoped>
  393. .dish-order-add {
  394. height: calc(100vh - var(--window-top, 0px));
  395. box-sizing: border-box;
  396. display: flex;
  397. flex-direction: column;
  398. overflow: hidden;
  399. padding: 20rpx;
  400. background: #f5f6fa;
  401. }
  402. .order-header {
  403. flex: none;
  404. box-sizing: border-box;
  405. margin-bottom: 18rpx;
  406. padding: 20rpx 24rpx;
  407. border-radius: 12rpx;
  408. background: #fff;
  409. box-shadow: 0 2rpx 10rpx rgba(31, 45, 61, 0.06);
  410. }
  411. .header-row {
  412. display: flex;
  413. align-items: center;
  414. justify-content: space-between;
  415. gap: 12rpx;
  416. }
  417. .room-info {
  418. display: flex;
  419. align-items: center;
  420. min-width: 0;
  421. }
  422. .room-name {
  423. overflow: hidden;
  424. white-space: nowrap;
  425. text-overflow: ellipsis;
  426. font-size: 34rpx;
  427. font-weight: 700;
  428. color: #303133;
  429. line-height: 44rpx;
  430. }
  431. .room-no-chip {
  432. flex: none;
  433. margin-left: 12rpx;
  434. padding: 2rpx 16rpx;
  435. border-radius: 999rpx;
  436. background: #ecf5ff;
  437. font-size: 24rpx;
  438. color: #2979ff;
  439. }
  440. .mini-btn,
  441. .plain-btn {
  442. margin: 0;
  443. padding: 0;
  444. border-radius: 8rpx;
  445. font-size: 26rpx;
  446. }
  447. .mini-btn {
  448. width: 160rpx;
  449. height: 64rpx;
  450. line-height: 64rpx;
  451. color: #fff;
  452. }
  453. .mini-btn.ghost {
  454. color: #2979ff;
  455. background: #ecf5ff;
  456. }
  457. .primary {
  458. color: #fff;
  459. background: #2979ff;
  460. }
  461. .order-main {
  462. flex: 1;
  463. min-height: 0;
  464. display: flex;
  465. gap: 18rpx;
  466. }
  467. .dish-panel,
  468. .ordered-panel {
  469. min-width: 0;
  470. min-height: 0;
  471. display: flex;
  472. flex-direction: column;
  473. border: 1rpx solid #ebeef5;
  474. border-radius: 10rpx;
  475. background: #fff;
  476. overflow: hidden;
  477. }
  478. .dish-panel {
  479. flex: 1;
  480. }
  481. /* 窄屏不展示加菜面板,改用底部购物车条 + 半屏弹窗 */
  482. .ordered-panel {
  483. display: none;
  484. }
  485. .dish-search {
  486. display: grid;
  487. grid-template-columns: minmax(0, 1fr) 120rpx;
  488. gap: 12rpx;
  489. margin-top: 16rpx;
  490. }
  491. .search-input {
  492. height: 64rpx;
  493. box-sizing: border-box;
  494. padding: 0 18rpx;
  495. border: 1rpx solid #dcdfe6;
  496. border-radius: 8rpx;
  497. font-size: 26rpx;
  498. }
  499. .search-btn {
  500. height: 64rpx;
  501. margin: 0;
  502. padding: 0;
  503. border-radius: 8rpx;
  504. font-size: 26rpx;
  505. line-height: 64rpx;
  506. color: #fff;
  507. background: #2979ff;
  508. }
  509. .category-bar {
  510. flex: none;
  511. white-space: nowrap;
  512. box-sizing: border-box;
  513. padding: 14rpx 16rpx;
  514. border-bottom: 1rpx solid #ebeef5;
  515. }
  516. .category-pill {
  517. display: inline-block;
  518. margin-right: 12rpx;
  519. padding: 10rpx 28rpx;
  520. border-radius: 999rpx;
  521. background: #f2f4f7;
  522. font-size: 26rpx;
  523. color: #606266;
  524. }
  525. .category-pill.active {
  526. color: #fff;
  527. background: #2979ff;
  528. font-weight: 700;
  529. }
  530. .dish-list {
  531. flex: 1;
  532. min-height: 0;
  533. box-sizing: border-box;
  534. padding: 16rpx;
  535. }
  536. .dish-grid {
  537. display: grid;
  538. grid-template-columns: repeat(auto-fill, minmax(240rpx, 1fr));
  539. gap: 16rpx;
  540. }
  541. .dish-card {
  542. min-width: 0;
  543. border: 1rpx solid #ebeef5;
  544. border-radius: 10rpx;
  545. overflow: hidden;
  546. background: #fff;
  547. }
  548. .dish-image {
  549. width: 100%;
  550. height: 200rpx;
  551. background: #f2f3f5;
  552. }
  553. .dish-image-empty {
  554. display: flex;
  555. align-items: center;
  556. justify-content: center;
  557. font-size: 24rpx;
  558. color: #909399;
  559. }
  560. .dish-info {
  561. padding: 12rpx;
  562. }
  563. .dish-name,
  564. .ordered-dish-name {
  565. overflow: hidden;
  566. white-space: nowrap;
  567. text-overflow: ellipsis;
  568. }
  569. .dish-name {
  570. font-size: 28rpx;
  571. font-weight: 700;
  572. color: #303133;
  573. line-height: 38rpx;
  574. }
  575. .dish-desc {
  576. height: 42rpx;
  577. margin-top: 8rpx;
  578. font-size: 24rpx;
  579. color: #606266;
  580. line-height: 32rpx;
  581. overflow: hidden;
  582. }
  583. .dish-bottom {
  584. display: flex;
  585. align-items: center;
  586. justify-content: space-between;
  587. gap: 10rpx;
  588. margin-top: 12rpx;
  589. }
  590. .dish-price {
  591. color: #fa3534;
  592. }
  593. .dish-price {
  594. font-size: 30rpx;
  595. font-weight: 700;
  596. }
  597. .plain-btn {
  598. width: 96rpx;
  599. height: 54rpx;
  600. line-height: 54rpx;
  601. color: #2979ff;
  602. background: #ecf5ff;
  603. }
  604. .card-stepper {
  605. display: flex;
  606. align-items: center;
  607. gap: 10rpx;
  608. }
  609. .step-btn {
  610. width: 48rpx;
  611. height: 48rpx;
  612. margin: 0;
  613. padding: 0;
  614. border-radius: 10rpx;
  615. font-size: 30rpx;
  616. line-height: 48rpx;
  617. text-align: center;
  618. color: #2979ff;
  619. background: #ecf5ff;
  620. }
  621. .step-btn.plus {
  622. color: #fff;
  623. background: #2979ff;
  624. }
  625. .step-qty {
  626. min-width: 40rpx;
  627. text-align: center;
  628. font-size: 28rpx;
  629. font-weight: 700;
  630. color: #303133;
  631. }
  632. .ordered-dish-name {
  633. font-size: 26rpx;
  634. font-weight: 700;
  635. color: #303133;
  636. }
  637. .ordered-qty {
  638. display: flex;
  639. align-items: center;
  640. justify-content: flex-end;
  641. gap: 10rpx;
  642. }
  643. .ordered-qty text {
  644. min-width: 36rpx;
  645. text-align: center;
  646. font-size: 26rpx;
  647. font-weight: 700;
  648. color: #303133;
  649. }
  650. .qty-btn {
  651. width: 44rpx;
  652. height: 44rpx;
  653. margin: 0;
  654. padding: 0;
  655. border-radius: 10rpx;
  656. font-size: 28rpx;
  657. font-weight: 700;
  658. line-height: 44rpx;
  659. text-align: center;
  660. color: #2979ff;
  661. background: #ecf5ff;
  662. }
  663. .qty-btn.plus {
  664. color: #fff;
  665. background: #2979ff;
  666. }
  667. .ordered-empty,
  668. .empty-box {
  669. min-height: 240rpx;
  670. display: flex;
  671. flex-direction: column;
  672. align-items: center;
  673. justify-content: center;
  674. color: #909399;
  675. font-size: 26rpx;
  676. }
  677. .ordered-empty-title {
  678. font-size: 30rpx;
  679. color: #606266;
  680. }
  681. .ordered-empty-sub {
  682. margin-top: 8rpx;
  683. font-size: 24rpx;
  684. }
  685. .cart-bar {
  686. flex: none;
  687. display: flex;
  688. align-items: center;
  689. justify-content: space-between;
  690. gap: 16rpx;
  691. margin-top: 16rpx;
  692. padding: 14rpx 22rpx;
  693. border: 1rpx solid #ebeef5;
  694. border-radius: 12rpx;
  695. background: #fff;
  696. box-shadow: 0 4rpx 16rpx rgba(31, 45, 61, 0.08);
  697. }
  698. .cart-bar-left {
  699. display: flex;
  700. align-items: center;
  701. gap: 16rpx;
  702. }
  703. .cart-badge {
  704. min-width: 40rpx;
  705. height: 40rpx;
  706. padding: 0 10rpx;
  707. box-sizing: border-box;
  708. display: flex;
  709. align-items: center;
  710. justify-content: center;
  711. border-radius: 999rpx;
  712. background: #fa3534;
  713. font-size: 24rpx;
  714. color: #fff;
  715. }
  716. .cart-bar-text {
  717. display: flex;
  718. flex-direction: column;
  719. }
  720. .cart-bar-count {
  721. font-size: 22rpx;
  722. color: #909399;
  723. }
  724. .cart-bar-total {
  725. font-size: 34rpx;
  726. font-weight: 700;
  727. color: #fa3534;
  728. }
  729. .cart-bar-actions {
  730. display: flex;
  731. gap: 12rpx;
  732. }
  733. .bar-btn {
  734. height: 68rpx;
  735. margin: 0;
  736. padding: 0 30rpx;
  737. border-radius: 10rpx;
  738. font-size: 28rpx;
  739. line-height: 68rpx;
  740. }
  741. .bar-btn.ghost {
  742. color: #2979ff;
  743. background: #ecf5ff;
  744. }
  745. .bar-btn.primary {
  746. color: #fff;
  747. background: #2979ff;
  748. }
  749. .modal-mask {
  750. position: fixed;
  751. left: 0;
  752. right: 0;
  753. top: 0;
  754. bottom: 0;
  755. z-index: 999;
  756. display: flex;
  757. align-items: center;
  758. justify-content: center;
  759. padding: 36rpx;
  760. box-sizing: border-box;
  761. background: rgba(0, 0, 0, 0.45);
  762. }
  763. .sheet-mask {
  764. align-items: flex-end;
  765. padding: 0;
  766. }
  767. .cart-sheet {
  768. width: 100%;
  769. max-height: 70vh;
  770. display: flex;
  771. flex-direction: column;
  772. border-radius: 20rpx 20rpx 0 0;
  773. background: #fff;
  774. }
  775. .sheet-head {
  776. flex: none;
  777. display: flex;
  778. align-items: center;
  779. justify-content: space-between;
  780. height: 88rpx;
  781. padding: 0 26rpx;
  782. box-sizing: border-box;
  783. border-bottom: 1rpx solid #ebeef5;
  784. font-size: 30rpx;
  785. font-weight: 700;
  786. color: #303133;
  787. }
  788. .sheet-close {
  789. font-size: 28rpx;
  790. font-weight: 400;
  791. color: #2979ff;
  792. }
  793. .sheet-list {
  794. flex: 1;
  795. min-height: 0;
  796. box-sizing: border-box;
  797. padding: 10rpx 26rpx;
  798. }
  799. .sheet-item {
  800. display: flex;
  801. align-items: center;
  802. justify-content: space-between;
  803. gap: 16rpx;
  804. min-height: 96rpx;
  805. padding: 12rpx 10rpx;
  806. box-sizing: border-box;
  807. border-bottom: 1rpx solid #ebeef5;
  808. }
  809. .sheet-item-main {
  810. flex: 1;
  811. min-width: 0;
  812. }
  813. .sheet-item-price {
  814. margin-top: 6rpx;
  815. font-size: 24rpx;
  816. color: #909399;
  817. }
  818. .sheet-foot {
  819. flex: none;
  820. display: flex;
  821. align-items: center;
  822. justify-content: space-between;
  823. padding: 18rpx 26rpx;
  824. border-top: 1rpx solid #ebeef5;
  825. font-size: 28rpx;
  826. color: #606266;
  827. }
  828. .sheet-foot strong {
  829. font-size: 36rpx;
  830. color: #fa3534;
  831. }
  832. .modal-card {
  833. width: 680rpx;
  834. max-height: 90vh;
  835. box-sizing: border-box;
  836. padding: 26rpx;
  837. border-radius: 12rpx;
  838. background: #fff;
  839. overflow: auto;
  840. }
  841. .dish-detail-card {
  842. width: 640rpx;
  843. display: flex;
  844. flex-direction: column;
  845. padding: 0;
  846. overflow: hidden;
  847. }
  848. .detail-head {
  849. flex: none;
  850. display: flex;
  851. align-items: center;
  852. justify-content: space-between;
  853. gap: 16rpx;
  854. padding: 24rpx 26rpx;
  855. border-bottom: 1rpx solid #ebeef5;
  856. }
  857. .detail-title {
  858. font-size: 32rpx;
  859. font-weight: 700;
  860. color: #303133;
  861. }
  862. .detail-close {
  863. padding: 6rpx 10rpx;
  864. font-size: 30rpx;
  865. color: #909399;
  866. }
  867. .dish-detail-body {
  868. flex: 1;
  869. min-height: 0;
  870. box-sizing: border-box;
  871. padding: 24rpx 26rpx;
  872. }
  873. .detail-name-row {
  874. display: flex;
  875. align-items: center;
  876. justify-content: space-between;
  877. gap: 16rpx;
  878. margin-bottom: 20rpx;
  879. }
  880. .detail-name {
  881. flex: 1;
  882. min-width: 0;
  883. font-size: 36rpx;
  884. font-weight: 700;
  885. color: #303133;
  886. }
  887. .detail-type-chip {
  888. flex: none;
  889. padding: 4rpx 18rpx;
  890. border-radius: 999rpx;
  891. background: #ecf5ff;
  892. font-size: 24rpx;
  893. color: #2979ff;
  894. }
  895. .detail-grid {
  896. display: grid;
  897. grid-template-columns: repeat(2, minmax(0, 1fr));
  898. gap: 16rpx;
  899. }
  900. .detail-cell {
  901. min-width: 0;
  902. padding: 14rpx 18rpx;
  903. border-radius: 10rpx;
  904. background: #f7f8fa;
  905. }
  906. .detail-cell.wide {
  907. grid-column: span 2;
  908. }
  909. .detail-label {
  910. display: block;
  911. font-size: 22rpx;
  912. color: #909399;
  913. line-height: 30rpx;
  914. }
  915. .detail-value {
  916. display: block;
  917. margin-top: 6rpx;
  918. font-size: 26rpx;
  919. color: #303133;
  920. line-height: 36rpx;
  921. word-break: break-all;
  922. }
  923. .detail-image-list {
  924. display: flex;
  925. flex-wrap: wrap;
  926. gap: 12rpx;
  927. margin-top: 10rpx;
  928. }
  929. .detail-image {
  930. width: 180rpx;
  931. height: 180rpx;
  932. border-radius: 10rpx;
  933. background: #eceef1;
  934. }
  935. @media (min-width: 768px) {
  936. .room-name {
  937. font-size: 22px;
  938. line-height: 30px;
  939. }
  940. .order-header {
  941. margin-bottom: 12px;
  942. padding: 14px 18px;
  943. border-radius: 10px;
  944. }
  945. .room-no-chip {
  946. margin-left: 10px;
  947. padding: 2px 12px;
  948. font-size: 14px;
  949. }
  950. .mini-btn {
  951. width: 96px;
  952. height: 40px;
  953. font-size: 15px;
  954. line-height: 40px;
  955. }
  956. .dish-search {
  957. grid-template-columns: minmax(0, 1fr) 88px;
  958. margin-top: 12px;
  959. }
  960. .search-input {
  961. height: 40px;
  962. font-size: 15px;
  963. }
  964. .search-btn {
  965. height: 40px;
  966. font-size: 15px;
  967. line-height: 40px;
  968. }
  969. .category-bar {
  970. padding: 10px 12px;
  971. }
  972. .category-pill {
  973. margin-right: 8px;
  974. padding: 7px 18px;
  975. font-size: 15px;
  976. }
  977. .dish-list {
  978. padding: 12px;
  979. }
  980. .dish-grid {
  981. grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  982. gap: 12px;
  983. }
  984. .dish-image {
  985. height: 140px;
  986. }
  987. .dish-info {
  988. padding: 10px;
  989. }
  990. .dish-name {
  991. font-size: 16px;
  992. line-height: 22px;
  993. }
  994. .dish-desc {
  995. height: 20px;
  996. margin-top: 4px;
  997. font-size: 13px;
  998. line-height: 20px;
  999. }
  1000. .dish-price {
  1001. font-size: 18px;
  1002. }
  1003. .plain-btn {
  1004. width: 60px;
  1005. height: 32px;
  1006. font-size: 14px;
  1007. line-height: 32px;
  1008. }
  1009. .card-stepper {
  1010. gap: 8px;
  1011. }
  1012. .step-btn {
  1013. width: 32px;
  1014. height: 32px;
  1015. border-radius: 8px;
  1016. font-size: 18px;
  1017. line-height: 32px;
  1018. }
  1019. .step-qty {
  1020. min-width: 26px;
  1021. font-size: 16px;
  1022. }
  1023. .ordered-dish-name {
  1024. font-size: 15px;
  1025. }
  1026. .qty-btn {
  1027. width: 30px;
  1028. height: 30px;
  1029. border-radius: 8px;
  1030. font-size: 17px;
  1031. font-weight: 700;
  1032. line-height: 30px;
  1033. }
  1034. .ordered-qty text {
  1035. min-width: 24px;
  1036. font-size: 15px;
  1037. }
  1038. .cart-bar {
  1039. margin-top: 12px;
  1040. padding: 10px 16px;
  1041. border-radius: 10px;
  1042. }
  1043. .cart-badge {
  1044. min-width: 24px;
  1045. height: 24px;
  1046. font-size: 13px;
  1047. }
  1048. .cart-bar-count {
  1049. font-size: 12px;
  1050. }
  1051. .cart-bar-total {
  1052. font-size: 20px;
  1053. }
  1054. .bar-btn {
  1055. height: 40px;
  1056. padding: 0 20px;
  1057. font-size: 15px;
  1058. line-height: 40px;
  1059. border-radius: 8px;
  1060. }
  1061. .sheet-head {
  1062. height: 50px;
  1063. font-size: 16px;
  1064. }
  1065. .sheet-close {
  1066. font-size: 14px;
  1067. }
  1068. .sheet-item {
  1069. min-height: 56px;
  1070. }
  1071. .sheet-item-price {
  1072. font-size: 13px;
  1073. }
  1074. .sheet-foot {
  1075. padding: 12px 16px;
  1076. font-size: 14px;
  1077. }
  1078. .sheet-foot strong {
  1079. font-size: 20px;
  1080. }
  1081. .dish-detail-card {
  1082. width: 460px;
  1083. }
  1084. .detail-head {
  1085. padding: 14px 18px;
  1086. }
  1087. .detail-title {
  1088. font-size: 17px;
  1089. }
  1090. .detail-close {
  1091. padding: 4px 6px;
  1092. font-size: 18px;
  1093. }
  1094. .dish-detail-body {
  1095. padding: 16px 18px;
  1096. }
  1097. .detail-name {
  1098. font-size: 20px;
  1099. line-height: 28px;
  1100. }
  1101. .detail-type-chip {
  1102. padding: 3px 12px;
  1103. font-size: 13px;
  1104. }
  1105. .detail-grid {
  1106. gap: 10px;
  1107. }
  1108. .detail-cell {
  1109. padding: 10px 12px;
  1110. border-radius: 8px;
  1111. }
  1112. .detail-label {
  1113. font-size: 12px;
  1114. line-height: 18px;
  1115. }
  1116. .detail-value {
  1117. margin-top: 4px;
  1118. font-size: 15px;
  1119. line-height: 22px;
  1120. }
  1121. .detail-image {
  1122. width: 110px;
  1123. height: 110px;
  1124. border-radius: 8px;
  1125. }
  1126. }
  1127. @media (min-width: 1024px) and (orientation: landscape) {
  1128. .dish-grid {
  1129. grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  1130. }
  1131. .dish-image {
  1132. height: 160px;
  1133. }
  1134. .dish-name {
  1135. font-size: 17px;
  1136. }
  1137. .dish-price {
  1138. font-size: 20px;
  1139. }
  1140. .plain-btn {
  1141. width: 68px;
  1142. height: 36px;
  1143. font-size: 15px;
  1144. line-height: 36px;
  1145. }
  1146. }
  1147. /* 大屏竖屏(如 1032×1376):放大卡片与字号,避免版面稀疏 */
  1148. @media (min-width: 1024px) and (orientation: portrait) {
  1149. .dish-detail-card {
  1150. width: 520px;
  1151. }
  1152. .detail-image {
  1153. width: 130px;
  1154. height: 130px;
  1155. }
  1156. .room-name {
  1157. font-size: 26px;
  1158. line-height: 34px;
  1159. }
  1160. .room-no-chip {
  1161. font-size: 15px;
  1162. }
  1163. .mini-btn {
  1164. width: 110px;
  1165. height: 44px;
  1166. font-size: 16px;
  1167. line-height: 44px;
  1168. }
  1169. .search-input {
  1170. height: 44px;
  1171. font-size: 16px;
  1172. }
  1173. .search-btn {
  1174. height: 44px;
  1175. font-size: 16px;
  1176. line-height: 44px;
  1177. }
  1178. .category-pill {
  1179. padding: 8px 22px;
  1180. font-size: 16px;
  1181. }
  1182. .dish-grid {
  1183. grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  1184. gap: 16px;
  1185. }
  1186. .dish-image {
  1187. height: 220px;
  1188. }
  1189. .dish-info {
  1190. padding: 14px;
  1191. }
  1192. .dish-name {
  1193. font-size: 18px;
  1194. line-height: 26px;
  1195. }
  1196. .dish-desc {
  1197. height: 22px;
  1198. font-size: 14px;
  1199. line-height: 22px;
  1200. }
  1201. .dish-price {
  1202. font-size: 22px;
  1203. }
  1204. .plain-btn {
  1205. width: 76px;
  1206. height: 38px;
  1207. font-size: 16px;
  1208. line-height: 38px;
  1209. }
  1210. .step-btn {
  1211. width: 38px;
  1212. height: 38px;
  1213. font-size: 20px;
  1214. line-height: 38px;
  1215. }
  1216. .step-qty {
  1217. min-width: 30px;
  1218. font-size: 17px;
  1219. }
  1220. .qty-btn {
  1221. width: 34px;
  1222. height: 34px;
  1223. font-size: 19px;
  1224. line-height: 34px;
  1225. }
  1226. .ordered-qty text {
  1227. min-width: 26px;
  1228. font-size: 16px;
  1229. }
  1230. .cart-bar {
  1231. padding: 12px 20px;
  1232. }
  1233. .cart-bar-count {
  1234. font-size: 13px;
  1235. }
  1236. .cart-bar-total {
  1237. font-size: 22px;
  1238. }
  1239. .bar-btn {
  1240. height: 44px;
  1241. padding: 0 24px;
  1242. font-size: 16px;
  1243. line-height: 44px;
  1244. }
  1245. .sheet-head {
  1246. height: 54px;
  1247. font-size: 17px;
  1248. }
  1249. .sheet-item {
  1250. min-height: 64px;
  1251. }
  1252. .sheet-foot {
  1253. font-size: 15px;
  1254. }
  1255. .sheet-foot strong {
  1256. font-size: 22px;
  1257. }
  1258. }
  1259. </style>