| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425 |
- <template>
- <view class="dish-order-add">
- <view class="order-header">
- <view class="header-row">
- <view class="room-info">
- <view class="room-name">{{ currentRoom.roomName || '-' }}</view>
- <view class="room-no-chip">包房号 {{ currentRoom.roomNo || '-' }}</view>
- </view>
- <button class="mini-btn ghost" @click="backOrderDetail">返回订单</button>
- </view>
- <view class="dish-search">
- <input class="search-input" v-model="dishSearchName" placeholder="搜索菜品名称" confirm-type="search"
- @confirm="searchDish" />
- <button class="search-btn" @click="searchDish">搜索</button>
- </view>
- </view>
- <view class="order-main">
- <view class="dish-panel">
- <scroll-view scroll-x class="category-bar" :show-scrollbar="false">
- <view v-for="item in categoryList" :key="item.id" class="category-pill"
- :class="{ active: activeTypeId === item.id }" @click="changeType(item)">
- {{ item.name }}
- </view>
- </scroll-view>
- <scroll-view scroll-y class="dish-list">
- <view v-if="dishLoading" class="empty-box">加载中...</view>
- <view v-else-if="dishList.length === 0" class="empty-box">暂无菜品</view>
- <view v-else class="dish-grid">
- <view v-for="item in dishList" :key="item.id" class="dish-card">
- <image v-if="item.previewImageUrl" class="dish-image" :src="item.previewImageUrl"
- mode="aspectFill"></image>
- <view v-else class="dish-image dish-image-empty">暂无图片</view>
- <view class="dish-info">
- <view class="dish-name" @click="openDishDetail(item)">{{ item.dishName }}</view>
- <view class="dish-desc">{{ item.spec || item.taste || item.remarks || '暂无说明' }}</view>
- <view class="dish-bottom">
- <text class="dish-price">¥{{ formatMoney(item.salePrice) }}</text>
- <view v-if="orderedRow(item)" class="card-stepper">
- <button class="step-btn" @click="reduceDish(orderedRow(item))">-</button>
- <text class="step-qty">{{ orderedRow(item).quantity }}</text>
- <button class="step-btn plus" @click="increaseOrderedDish(orderedRow(item))">+</button>
- </view>
- <button v-else class="plain-btn" @click="addDish(item)">点菜</button>
- </view>
- </view>
- </view>
- </view>
- </scroll-view>
- </view>
- </view>
- <view class="cart-bar">
- <view class="cart-bar-left" @click="cartSheetVisible = true">
- <view class="cart-badge">{{ orderQuantity }}</view>
- <view class="cart-bar-text">
- <text class="cart-bar-count">共 {{ orderedList.length }} 项</text>
- <text class="cart-bar-total">¥{{ formatMoney(orderTotal) }}</text>
- </view>
- </view>
- <view class="cart-bar-actions">
- <button class="bar-btn ghost" @click="cartSheetVisible = true">查看加菜</button>
- <button class="bar-btn primary" :disabled="submitting" @click="confirmSubmitOrder">下单</button>
- </view>
- </view>
- <view v-if="cartSheetVisible" class="modal-mask sheet-mask" @click="cartSheetVisible = false">
- <view class="cart-sheet" @click.stop>
- <view class="sheet-head">
- <text>本次加菜({{ orderedList.length }} 项)</text>
- <text class="sheet-close" @click="cartSheetVisible = false">收起</text>
- </view>
- <scroll-view scroll-y class="sheet-list">
- <view v-if="orderedList.length === 0" class="ordered-empty">
- <view class="ordered-empty-title">暂未加菜</view>
- <view class="ordered-empty-sub">从上方选择菜品后会显示在这里</view>
- </view>
- <view v-for="item in orderedList" :key="item.dishId" class="sheet-item">
- <view class="sheet-item-main">
- <view class="ordered-dish-name">{{ item.dishName }}</view>
- <view class="sheet-item-price">¥{{ formatMoney(item.salePrice) }} / 份</view>
- </view>
- <view class="ordered-qty">
- <button class="qty-btn" @click="reduceDish(item)">-</button>
- <text>{{ item.quantity }}</text>
- <button class="qty-btn plus" @click="increaseOrderedDish(item)">+</button>
- </view>
- </view>
- </scroll-view>
- <view class="sheet-foot">
- <text>总价 <strong>¥{{ formatMoney(orderTotal) }}</strong></text>
- <button class="bar-btn primary" :disabled="submitting" @click="confirmSubmitOrder">下单</button>
- </view>
- </view>
- </view>
- <view v-if="dishDetailVisible" class="modal-mask" @click="dishDetailVisible = false">
- <view class="modal-card dish-detail-card" @click.stop>
- <view class="detail-head">
- <text class="detail-title">菜品详情</text>
- <text class="detail-close" @click="dishDetailVisible = false">✕</text>
- </view>
- <scroll-view scroll-y class="dish-detail-body">
- <view class="detail-name-row">
- <text class="detail-name">{{ currentDish.dishName || '-' }}</text>
- <view v-if="currentDish.typeName" class="detail-type-chip">{{ currentDish.typeName }}</view>
- </view>
- <view class="detail-grid">
- <view class="detail-cell">
- <text class="detail-label">单位</text>
- <text class="detail-value">{{ currentDish.unit || '-' }}</text>
- </view>
- <view class="detail-cell">
- <text class="detail-label">规格</text>
- <text class="detail-value">{{ currentDish.spec || '-' }}</text>
- </view>
- <view class="detail-cell wide">
- <text class="detail-label">口味</text>
- <text class="detail-value">{{ currentDish.taste || '-' }}</text>
- </view>
- <view class="detail-cell wide">
- <text class="detail-label">备注</text>
- <text class="detail-value">{{ currentDish.remarks || '-' }}</text>
- </view>
- <view class="detail-cell wide">
- <text class="detail-label">菜品图片</text>
- <view v-if="!currentDish.previewImageList || currentDish.previewImageList.length === 0"
- class="detail-value">暂无图片</view>
- <view v-else class="detail-image-list">
- <image v-for="(url, index) in currentDish.previewImageList" :key="index"
- class="detail-image" :src="url" mode="aspectFill"
- @click="previewDetailImage(url)"></image>
- </view>
- </view>
- </view>
- </scroll-view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import DishOrderService from '@/api/psi/DishOrderService'
- import OSSSerivce from '@/api/sys/OSSService'
- export default {
- data() {
- return {
- roomId: '',
- orderId: '',
- currentRoom: {},
- currentOrder: null,
- categoryList: [],
- activeTypeId: 'all',
- dishSearchName: '',
- dishList: [],
- orderedList: [],
- existDishSortMap: {},
- maxDishSort: 0,
- dishLoading: false,
- orderLoading: false,
- submitting: false,
- cartSheetVisible: false,
- dishDetailVisible: false,
- currentDish: {},
- dishOrderService: null,
- ossService: null
- }
- },
- computed: {
- orderTotal() {
- return this.orderedList.reduce((total, item) => total + this.itemTotal(item), 0)
- },
- orderQuantity() {
- return this.orderedList.reduce((total, item) => total + Number(item.quantity || 0), 0)
- },
- submitDetailList() {
- let appendIndex = 0
- return this.orderedList.map((item) => {
- let dishSort = this.existDishSortMap[item.dishId]
- if (!dishSort) {
- appendIndex += 1
- dishSort = this.maxDishSort + appendIndex
- }
- return {
- dishId: item.dishId,
- dishName: item.dishName,
- quantity: item.quantity,
- dishSort
- }
- })
- }
- },
- onLoad(option) {
- this.roomId = option && option.roomId ? option.roomId : ''
- this.orderId = option && option.orderId ? option.orderId : ''
- uni.setNavigationBarTitle({ title: '加菜' })
- this.dishOrderService = new DishOrderService()
- this.ossService = new OSSSerivce()
- this.initPage()
- },
- methods: {
- initPage() {
- if (!this.roomId) {
- this.backOrderDetail()
- return
- }
- this.orderedList = []
- this.activeTypeId = 'all'
- this.dishSearchName = ''
- this.loadRoom(this.roomId)
- this.loadCurrentOrder(this.roomId)
- this.loadCategoryList()
- this.loadDishList()
- },
- loadRoom(roomId) {
- this.dishOrderService.findRoomById(roomId).then((data) => {
- this.currentRoom = data || {}
- })
- },
- loadCurrentOrder(roomId) {
- this.orderLoading = true
- this.dishOrderService.currentOrder(roomId).then((data) => {
- this.currentOrder = data || null
- if (!this.currentOrder || !this.currentOrder.id) {
- uni.showToast({ title: '当前包房暂无未结账订单,请先下单', icon: 'none' })
- this.backOrderDetail()
- return
- }
- this.buildDishSortMap(this.currentOrder.detailList || [])
- }).finally(() => {
- this.orderLoading = false
- })
- },
- buildDishSortMap(detailList) {
- this.existDishSortMap = {}
- this.maxDishSort = 0
- detailList.forEach((item) => {
- const sort = Number(item.dishSort || 0)
- if (item.dishId && sort > 0) {
- this.existDishSortMap[item.dishId] = sort
- }
- if (sort > this.maxDishSort) {
- this.maxDishSort = sort
- }
- })
- },
- loadCategoryList() {
- this.dishOrderService.typeList().then((data) => {
- this.categoryList = [
- { id: 'all', name: '所有菜品' },
- ...(Array.isArray(data) ? data.map(item => ({ id: item.id, name: item.name })) : [])
- ]
- })
- },
- changeType(item) {
- this.activeTypeId = item.id
- this.dishSearchName = ''
- this.loadDishList()
- },
- searchDish() {
- this.activeTypeId = 'all'
- this.loadDishList()
- },
- loadDishList() {
- this.dishLoading = true
- this.dishOrderService.dishList({
- typeId: this.activeTypeId === 'all' ? '' : this.activeTypeId,
- dishName: this.dishSearchName
- }).then((data) => {
- this.dishList = Array.isArray(data) ? data : []
- this.loadDishImagePreview()
- }).finally(() => {
- this.dishLoading = false
- })
- },
- addDish(dish) {
- const row = this.orderedList.find(item => item.dishId === dish.id)
- if (row) {
- row.quantity += 1
- return
- }
- this.orderedList.push(this.toOrderedItem(dish, 1))
- },
- increaseOrderedDish(item) {
- item.quantity += 1
- },
- reduceDish(item) {
- if (item.quantity <= 1) {
- this.orderedList = this.orderedList.filter(row => row.dishId !== item.dishId)
- return
- }
- item.quantity -= 1
- },
- orderedRow(dish) {
- return this.orderedList.find(item => item.dishId === dish.id) || null
- },
- confirmSubmitOrder() {
- if (this.orderedList.length === 0) {
- uni.showToast({ title: '请先选择菜品', icon: 'none' })
- return
- }
- uni.showModal({
- title: '提示',
- content: '是否确认下单?',
- success: (res) => {
- if (res.confirm) {
- this.submitOrder()
- }
- }
- })
- },
- submitOrder() {
- this.submitting = true
- this.dishOrderService.submit({
- id: this.currentOrder ? this.currentOrder.id : this.orderId,
- roomId: this.roomId,
- settleFlag: '0',
- detailList: this.submitDetailList
- }).then((data) => {
- uni.showToast({ title: data || '下单成功', icon: 'none' })
- this.backOrderDetail()
- }).finally(() => {
- this.submitting = false
- })
- },
- toOrderedItem(item, quantity) {
- return {
- dishId: item.dishId || item.id,
- dishName: item.dishName,
- salePrice: Number(item.salePrice || 0),
- quantity
- }
- },
- itemTotal(item) {
- return Number(item.salePrice || 0) * Number(item.quantity || 0)
- },
- loadDishImagePreview() {
- this.dishList.forEach((row) => {
- const urls = this.getImageUrls(row.imageUrl)
- if (urls.length === 0) {
- this.$set ? this.$set(row, 'previewImageUrl', '') : row.previewImageUrl = ''
- this.$set ? this.$set(row, 'previewImageList', []) : row.previewImageList = []
- return
- }
- this.$set ? this.$set(row, 'previewImageUrl', urls[0]) : row.previewImageUrl = urls[0]
- this.$set ? this.$set(row, 'previewImageList', urls) : row.previewImageList = urls
- Promise.all(urls.map(url => this.getPreviewUrl(url))).then((list) => {
- row.previewImageUrl = list[0]
- row.previewImageList = list
- })
- })
- },
- getImageUrls(value) {
- if (!value) {
- return []
- }
- return value.split(',').map(item => item.trim()).filter(item => item)
- },
- getPreviewUrl(url) {
- if (!url) {
- return Promise.resolve('')
- }
- if (url.indexOf('http') === 0) {
- return Promise.resolve(url)
- }
- return this.ossService.getTemporaryUrl(url).catch(() => url)
- },
- openDishDetail(item) {
- this.currentDish = item || {}
- this.dishDetailVisible = true
- },
- previewDetailImage(url) {
- const urls = this.currentDish.previewImageList || []
- if (urls.length === 0) {
- return
- }
- uni.previewImage({
- urls,
- current: url
- })
- },
- formatMoney(value) {
- return Number(value || 0).toFixed(2)
- },
- backOrderDetail() {
- uni.navigateBack({
- fail: () => {
- uni.redirectTo({
- url: `/pages/psiManagement/dishManage/DishOrderDetail?roomId=${this.roomId}`
- })
- }
- })
- }
- }
- }
- </script>
- <style scoped>
- .dish-order-add {
- height: calc(100vh - var(--window-top, 0px));
- box-sizing: border-box;
- display: flex;
- flex-direction: column;
- overflow: hidden;
- padding: 20rpx;
- background: #f5f6fa;
- }
- .order-header {
- flex: none;
- box-sizing: border-box;
- margin-bottom: 18rpx;
- padding: 20rpx 24rpx;
- border-radius: 12rpx;
- background: #fff;
- box-shadow: 0 2rpx 10rpx rgba(31, 45, 61, 0.06);
- }
- .header-row {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 12rpx;
- }
- .room-info {
- display: flex;
- align-items: center;
- min-width: 0;
- }
- .room-name {
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- font-size: 34rpx;
- font-weight: 700;
- color: #303133;
- line-height: 44rpx;
- }
- .room-no-chip {
- flex: none;
- margin-left: 12rpx;
- padding: 2rpx 16rpx;
- border-radius: 999rpx;
- background: #ecf5ff;
- font-size: 24rpx;
- color: #2979ff;
- }
- .mini-btn,
- .plain-btn {
- margin: 0;
- padding: 0;
- border-radius: 8rpx;
- font-size: 26rpx;
- }
- .mini-btn {
- width: 160rpx;
- height: 64rpx;
- line-height: 64rpx;
- color: #fff;
- }
- .mini-btn.ghost {
- color: #2979ff;
- background: #ecf5ff;
- }
- .primary {
- color: #fff;
- background: #2979ff;
- }
- .order-main {
- flex: 1;
- min-height: 0;
- display: flex;
- gap: 18rpx;
- }
- .dish-panel,
- .ordered-panel {
- min-width: 0;
- min-height: 0;
- display: flex;
- flex-direction: column;
- border: 1rpx solid #ebeef5;
- border-radius: 10rpx;
- background: #fff;
- overflow: hidden;
- }
- .dish-panel {
- flex: 1;
- }
- /* 窄屏不展示加菜面板,改用底部购物车条 + 半屏弹窗 */
- .ordered-panel {
- display: none;
- }
- .dish-search {
- display: grid;
- grid-template-columns: minmax(0, 1fr) 120rpx;
- gap: 12rpx;
- margin-top: 16rpx;
- }
- .search-input {
- height: 64rpx;
- box-sizing: border-box;
- padding: 0 18rpx;
- border: 1rpx solid #dcdfe6;
- border-radius: 8rpx;
- font-size: 26rpx;
- }
- .search-btn {
- height: 64rpx;
- margin: 0;
- padding: 0;
- border-radius: 8rpx;
- font-size: 26rpx;
- line-height: 64rpx;
- color: #fff;
- background: #2979ff;
- }
- .category-bar {
- flex: none;
- white-space: nowrap;
- box-sizing: border-box;
- padding: 14rpx 16rpx;
- border-bottom: 1rpx solid #ebeef5;
- }
- .category-pill {
- display: inline-block;
- margin-right: 12rpx;
- padding: 10rpx 28rpx;
- border-radius: 999rpx;
- background: #f2f4f7;
- font-size: 26rpx;
- color: #606266;
- }
- .category-pill.active {
- color: #fff;
- background: #2979ff;
- font-weight: 700;
- }
- .dish-list {
- flex: 1;
- min-height: 0;
- box-sizing: border-box;
- padding: 16rpx;
- }
- .dish-grid {
- display: grid;
- grid-template-columns: repeat(auto-fill, minmax(240rpx, 1fr));
- gap: 16rpx;
- }
- .dish-card {
- min-width: 0;
- border: 1rpx solid #ebeef5;
- border-radius: 10rpx;
- overflow: hidden;
- background: #fff;
- }
- .dish-image {
- width: 100%;
- height: 200rpx;
- background: #f2f3f5;
- }
- .dish-image-empty {
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 24rpx;
- color: #909399;
- }
- .dish-info {
- padding: 12rpx;
- }
- .dish-name,
- .ordered-dish-name {
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- .dish-name {
- font-size: 28rpx;
- font-weight: 700;
- color: #303133;
- line-height: 38rpx;
- }
- .dish-desc {
- height: 42rpx;
- margin-top: 8rpx;
- font-size: 24rpx;
- color: #606266;
- line-height: 32rpx;
- overflow: hidden;
- }
- .dish-bottom {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 10rpx;
- margin-top: 12rpx;
- }
- .dish-price {
- color: #fa3534;
- }
- .dish-price {
- font-size: 30rpx;
- font-weight: 700;
- }
- .plain-btn {
- width: 96rpx;
- height: 54rpx;
- line-height: 54rpx;
- color: #2979ff;
- background: #ecf5ff;
- }
- .card-stepper {
- display: flex;
- align-items: center;
- gap: 10rpx;
- }
- .step-btn {
- width: 48rpx;
- height: 48rpx;
- margin: 0;
- padding: 0;
- border-radius: 10rpx;
- font-size: 30rpx;
- line-height: 48rpx;
- text-align: center;
- color: #2979ff;
- background: #ecf5ff;
- }
- .step-btn.plus {
- color: #fff;
- background: #2979ff;
- }
- .step-qty {
- min-width: 40rpx;
- text-align: center;
- font-size: 28rpx;
- font-weight: 700;
- color: #303133;
- }
- .ordered-dish-name {
- font-size: 26rpx;
- font-weight: 700;
- color: #303133;
- }
- .ordered-qty {
- display: flex;
- align-items: center;
- justify-content: flex-end;
- gap: 10rpx;
- }
- .ordered-qty text {
- min-width: 36rpx;
- text-align: center;
- font-size: 26rpx;
- font-weight: 700;
- color: #303133;
- }
- .qty-btn {
- width: 44rpx;
- height: 44rpx;
- margin: 0;
- padding: 0;
- border-radius: 10rpx;
- font-size: 28rpx;
- font-weight: 700;
- line-height: 44rpx;
- text-align: center;
- color: #2979ff;
- background: #ecf5ff;
- }
- .qty-btn.plus {
- color: #fff;
- background: #2979ff;
- }
- .ordered-empty,
- .empty-box {
- min-height: 240rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- color: #909399;
- font-size: 26rpx;
- }
- .ordered-empty-title {
- font-size: 30rpx;
- color: #606266;
- }
- .ordered-empty-sub {
- margin-top: 8rpx;
- font-size: 24rpx;
- }
- .cart-bar {
- flex: none;
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 16rpx;
- margin-top: 16rpx;
- padding: 14rpx 22rpx;
- border: 1rpx solid #ebeef5;
- border-radius: 12rpx;
- background: #fff;
- box-shadow: 0 4rpx 16rpx rgba(31, 45, 61, 0.08);
- }
- .cart-bar-left {
- display: flex;
- align-items: center;
- gap: 16rpx;
- }
- .cart-badge {
- min-width: 40rpx;
- height: 40rpx;
- padding: 0 10rpx;
- box-sizing: border-box;
- display: flex;
- align-items: center;
- justify-content: center;
- border-radius: 999rpx;
- background: #fa3534;
- font-size: 24rpx;
- color: #fff;
- }
- .cart-bar-text {
- display: flex;
- flex-direction: column;
- }
- .cart-bar-count {
- font-size: 22rpx;
- color: #909399;
- }
- .cart-bar-total {
- font-size: 34rpx;
- font-weight: 700;
- color: #fa3534;
- }
- .cart-bar-actions {
- display: flex;
- gap: 12rpx;
- }
- .bar-btn {
- height: 68rpx;
- margin: 0;
- padding: 0 30rpx;
- border-radius: 10rpx;
- font-size: 28rpx;
- line-height: 68rpx;
- }
- .bar-btn.ghost {
- color: #2979ff;
- background: #ecf5ff;
- }
- .bar-btn.primary {
- color: #fff;
- background: #2979ff;
- }
- .modal-mask {
- position: fixed;
- left: 0;
- right: 0;
- top: 0;
- bottom: 0;
- z-index: 999;
- display: flex;
- align-items: center;
- justify-content: center;
- padding: 36rpx;
- box-sizing: border-box;
- background: rgba(0, 0, 0, 0.45);
- }
- .sheet-mask {
- align-items: flex-end;
- padding: 0;
- }
- .cart-sheet {
- width: 100%;
- max-height: 70vh;
- display: flex;
- flex-direction: column;
- border-radius: 20rpx 20rpx 0 0;
- background: #fff;
- }
- .sheet-head {
- flex: none;
- display: flex;
- align-items: center;
- justify-content: space-between;
- height: 88rpx;
- padding: 0 26rpx;
- box-sizing: border-box;
- border-bottom: 1rpx solid #ebeef5;
- font-size: 30rpx;
- font-weight: 700;
- color: #303133;
- }
- .sheet-close {
- font-size: 28rpx;
- font-weight: 400;
- color: #2979ff;
- }
- .sheet-list {
- flex: 1;
- min-height: 0;
- box-sizing: border-box;
- padding: 10rpx 26rpx;
- }
- .sheet-item {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 16rpx;
- min-height: 96rpx;
- padding: 12rpx 10rpx;
- box-sizing: border-box;
- border-bottom: 1rpx solid #ebeef5;
- }
- .sheet-item-main {
- flex: 1;
- min-width: 0;
- }
- .sheet-item-price {
- margin-top: 6rpx;
- font-size: 24rpx;
- color: #909399;
- }
- .sheet-foot {
- flex: none;
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 18rpx 26rpx;
- border-top: 1rpx solid #ebeef5;
- font-size: 28rpx;
- color: #606266;
- }
- .sheet-foot strong {
- font-size: 36rpx;
- color: #fa3534;
- }
- .modal-card {
- width: 680rpx;
- max-height: 90vh;
- box-sizing: border-box;
- padding: 26rpx;
- border-radius: 12rpx;
- background: #fff;
- overflow: auto;
- }
- .dish-detail-card {
- width: 640rpx;
- display: flex;
- flex-direction: column;
- padding: 0;
- overflow: hidden;
- }
- .detail-head {
- flex: none;
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 16rpx;
- padding: 24rpx 26rpx;
- border-bottom: 1rpx solid #ebeef5;
- }
- .detail-title {
- font-size: 32rpx;
- font-weight: 700;
- color: #303133;
- }
- .detail-close {
- padding: 6rpx 10rpx;
- font-size: 30rpx;
- color: #909399;
- }
- .dish-detail-body {
- flex: 1;
- min-height: 0;
- box-sizing: border-box;
- padding: 24rpx 26rpx;
- }
- .detail-name-row {
- display: flex;
- align-items: center;
- justify-content: space-between;
- gap: 16rpx;
- margin-bottom: 20rpx;
- }
- .detail-name {
- flex: 1;
- min-width: 0;
- font-size: 36rpx;
- font-weight: 700;
- color: #303133;
- }
- .detail-type-chip {
- flex: none;
- padding: 4rpx 18rpx;
- border-radius: 999rpx;
- background: #ecf5ff;
- font-size: 24rpx;
- color: #2979ff;
- }
- .detail-grid {
- display: grid;
- grid-template-columns: repeat(2, minmax(0, 1fr));
- gap: 16rpx;
- }
- .detail-cell {
- min-width: 0;
- padding: 14rpx 18rpx;
- border-radius: 10rpx;
- background: #f7f8fa;
- }
- .detail-cell.wide {
- grid-column: span 2;
- }
- .detail-label {
- display: block;
- font-size: 22rpx;
- color: #909399;
- line-height: 30rpx;
- }
- .detail-value {
- display: block;
- margin-top: 6rpx;
- font-size: 26rpx;
- color: #303133;
- line-height: 36rpx;
- word-break: break-all;
- }
- .detail-image-list {
- display: flex;
- flex-wrap: wrap;
- gap: 12rpx;
- margin-top: 10rpx;
- }
- .detail-image {
- width: 180rpx;
- height: 180rpx;
- border-radius: 10rpx;
- background: #eceef1;
- }
- @media (min-width: 768px) {
- .room-name {
- font-size: 22px;
- line-height: 30px;
- }
- .order-header {
- margin-bottom: 12px;
- padding: 14px 18px;
- border-radius: 10px;
- }
- .room-no-chip {
- margin-left: 10px;
- padding: 2px 12px;
- font-size: 14px;
- }
- .mini-btn {
- width: 96px;
- height: 40px;
- font-size: 15px;
- line-height: 40px;
- }
- .dish-search {
- grid-template-columns: minmax(0, 1fr) 88px;
- margin-top: 12px;
- }
- .search-input {
- height: 40px;
- font-size: 15px;
- }
- .search-btn {
- height: 40px;
- font-size: 15px;
- line-height: 40px;
- }
- .category-bar {
- padding: 10px 12px;
- }
- .category-pill {
- margin-right: 8px;
- padding: 7px 18px;
- font-size: 15px;
- }
- .dish-list {
- padding: 12px;
- }
- .dish-grid {
- grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
- gap: 12px;
- }
- .dish-image {
- height: 140px;
- }
- .dish-info {
- padding: 10px;
- }
- .dish-name {
- font-size: 16px;
- line-height: 22px;
- }
- .dish-desc {
- height: 20px;
- margin-top: 4px;
- font-size: 13px;
- line-height: 20px;
- }
- .dish-price {
- font-size: 18px;
- }
- .plain-btn {
- width: 60px;
- height: 32px;
- font-size: 14px;
- line-height: 32px;
- }
- .card-stepper {
- gap: 8px;
- }
- .step-btn {
- width: 32px;
- height: 32px;
- border-radius: 8px;
- font-size: 18px;
- line-height: 32px;
- }
- .step-qty {
- min-width: 26px;
- font-size: 16px;
- }
- .ordered-dish-name {
- font-size: 15px;
- }
- .qty-btn {
- width: 30px;
- height: 30px;
- border-radius: 8px;
- font-size: 17px;
- font-weight: 700;
- line-height: 30px;
- }
- .ordered-qty text {
- min-width: 24px;
- font-size: 15px;
- }
- .cart-bar {
- margin-top: 12px;
- padding: 10px 16px;
- border-radius: 10px;
- }
- .cart-badge {
- min-width: 24px;
- height: 24px;
- font-size: 13px;
- }
- .cart-bar-count {
- font-size: 12px;
- }
- .cart-bar-total {
- font-size: 20px;
- }
- .bar-btn {
- height: 40px;
- padding: 0 20px;
- font-size: 15px;
- line-height: 40px;
- border-radius: 8px;
- }
- .sheet-head {
- height: 50px;
- font-size: 16px;
- }
- .sheet-close {
- font-size: 14px;
- }
- .sheet-item {
- min-height: 56px;
- }
- .sheet-item-price {
- font-size: 13px;
- }
- .sheet-foot {
- padding: 12px 16px;
- font-size: 14px;
- }
- .sheet-foot strong {
- font-size: 20px;
- }
- .dish-detail-card {
- width: 460px;
- }
- .detail-head {
- padding: 14px 18px;
- }
- .detail-title {
- font-size: 17px;
- }
- .detail-close {
- padding: 4px 6px;
- font-size: 18px;
- }
- .dish-detail-body {
- padding: 16px 18px;
- }
- .detail-name {
- font-size: 20px;
- line-height: 28px;
- }
- .detail-type-chip {
- padding: 3px 12px;
- font-size: 13px;
- }
- .detail-grid {
- gap: 10px;
- }
- .detail-cell {
- padding: 10px 12px;
- border-radius: 8px;
- }
- .detail-label {
- font-size: 12px;
- line-height: 18px;
- }
- .detail-value {
- margin-top: 4px;
- font-size: 15px;
- line-height: 22px;
- }
- .detail-image {
- width: 110px;
- height: 110px;
- border-radius: 8px;
- }
- }
- @media (min-width: 1024px) and (orientation: landscape) {
- .dish-grid {
- grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
- }
- .dish-image {
- height: 160px;
- }
- .dish-name {
- font-size: 17px;
- }
- .dish-price {
- font-size: 20px;
- }
- .plain-btn {
- width: 68px;
- height: 36px;
- font-size: 15px;
- line-height: 36px;
- }
- }
- /* 大屏竖屏(如 1032×1376):放大卡片与字号,避免版面稀疏 */
- @media (min-width: 1024px) and (orientation: portrait) {
- .dish-detail-card {
- width: 520px;
- }
- .detail-image {
- width: 130px;
- height: 130px;
- }
- .room-name {
- font-size: 26px;
- line-height: 34px;
- }
- .room-no-chip {
- font-size: 15px;
- }
- .mini-btn {
- width: 110px;
- height: 44px;
- font-size: 16px;
- line-height: 44px;
- }
- .search-input {
- height: 44px;
- font-size: 16px;
- }
- .search-btn {
- height: 44px;
- font-size: 16px;
- line-height: 44px;
- }
- .category-pill {
- padding: 8px 22px;
- font-size: 16px;
- }
- .dish-grid {
- grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
- gap: 16px;
- }
- .dish-image {
- height: 220px;
- }
- .dish-info {
- padding: 14px;
- }
- .dish-name {
- font-size: 18px;
- line-height: 26px;
- }
- .dish-desc {
- height: 22px;
- font-size: 14px;
- line-height: 22px;
- }
- .dish-price {
- font-size: 22px;
- }
- .plain-btn {
- width: 76px;
- height: 38px;
- font-size: 16px;
- line-height: 38px;
- }
- .step-btn {
- width: 38px;
- height: 38px;
- font-size: 20px;
- line-height: 38px;
- }
- .step-qty {
- min-width: 30px;
- font-size: 17px;
- }
- .qty-btn {
- width: 34px;
- height: 34px;
- font-size: 19px;
- line-height: 34px;
- }
- .ordered-qty text {
- min-width: 26px;
- font-size: 16px;
- }
- .cart-bar {
- padding: 12px 20px;
- }
- .cart-bar-count {
- font-size: 13px;
- }
- .cart-bar-total {
- font-size: 22px;
- }
- .bar-btn {
- height: 44px;
- padding: 0 24px;
- font-size: 16px;
- line-height: 44px;
- }
- .sheet-head {
- height: 54px;
- font-size: 17px;
- }
- .sheet-item {
- min-height: 64px;
- }
- .sheet-foot {
- font-size: 15px;
- }
- .sheet-foot strong {
- font-size: 22px;
- }
- }
- </style>
|