DishOrder.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. <template>
  2. <view class="dish-order-page">
  3. <view class="query-bar">
  4. <input class="query-input" v-model="searchForm.roomName" placeholder="请输入包房名称" confirm-type="search"
  5. @confirm="refreshRoomList" />
  6. <input class="query-input" v-model="searchForm.roomNo" placeholder="请输入包房编号" confirm-type="search"
  7. @confirm="refreshRoomList" />
  8. <button class="query-btn primary" @click="refreshRoomList">查询</button>
  9. <button class="query-btn" @click="resetSearch">重置</button>
  10. </view>
  11. <view v-if="roomLoading" class="state-box">
  12. <u-loading-icon text="加载中" textSize="14"></u-loading-icon>
  13. </view>
  14. <scroll-view v-else scroll-y class="room-scroll">
  15. <view class="room-grid">
  16. <view v-for="item in roomList" :key="item.id" class="room-card"
  17. :class="{ disabled: item.status === '1' }" @click="enterOrder(item)">
  18. <view class="room-card-top">
  19. <view class="room-title-wrap">
  20. <view class="room-name">{{ item.roomName || '-' }}</view>
  21. <view class="room-no">包房号:{{ item.roomNo || '-' }}</view>
  22. </view>
  23. <view class="room-status" :class="item.useStatus === '0' ? 'free' : 'busy'">
  24. {{ item.useStatus === '0' ? '空闲中' : '使用中' }}
  25. </view>
  26. </view>
  27. <view class="room-meta">
  28. <view>
  29. <text>容纳人数</text>
  30. <strong>{{ item.capacity || 0 }} 人</strong>
  31. </view>
  32. </view>
  33. <view class="room-remarks">{{ item.remarks || '暂无备注' }}</view>
  34. </view>
  35. <view v-if="roomList.length === 0" class="empty-room">暂无包房</view>
  36. </view>
  37. </scroll-view>
  38. </view>
  39. </template>
  40. <script>
  41. import DishOrderService from '@/api/psi/DishOrderService'
  42. export default {
  43. data() {
  44. return {
  45. searchForm: {
  46. roomName: '',
  47. roomNo: '',
  48. status: '0'
  49. },
  50. roomList: [],
  51. roomLoading: false,
  52. dishOrderService: null
  53. }
  54. },
  55. onLoad() {
  56. uni.setNavigationBarTitle({ title: '点菜' })
  57. this.dishOrderService = new DishOrderService()
  58. this.refreshRoomList()
  59. },
  60. onShow() {
  61. if (!this.dishOrderService) {
  62. this.dishOrderService = new DishOrderService()
  63. }
  64. this.refreshRoomList()
  65. },
  66. methods: {
  67. refreshRoomList() {
  68. this.roomLoading = true
  69. this.dishOrderService.roomList({ ...this.searchForm }).then((data) => {
  70. this.roomList = Array.isArray(data) ? data : []
  71. }).finally(() => {
  72. this.roomLoading = false
  73. })
  74. },
  75. resetSearch() {
  76. this.searchForm.roomName = ''
  77. this.searchForm.roomNo = ''
  78. this.refreshRoomList()
  79. },
  80. enterOrder(room) {
  81. if (room.status === '1') {
  82. uni.showToast({ title: '该包房已停用', icon: 'none' })
  83. return
  84. }
  85. uni.navigateTo({
  86. url: `/pages/psiManagement/dishManage/DishOrderDetail?roomId=${room.id}`
  87. })
  88. }
  89. }
  90. }
  91. </script>
  92. <style scoped>
  93. .dish-order-page {
  94. height: calc(100vh - var(--window-top, 0px));
  95. box-sizing: border-box;
  96. display: flex;
  97. flex-direction: column;
  98. overflow: hidden;
  99. padding: 24rpx;
  100. background: #f5f6fa;
  101. }
  102. .query-bar {
  103. flex-shrink: 0;
  104. display: grid;
  105. grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 140rpx 140rpx;
  106. gap: 16rpx;
  107. margin-bottom: 22rpx;
  108. padding: 18rpx;
  109. border-radius: 12rpx;
  110. background: #fff;
  111. }
  112. .query-input {
  113. height: 72rpx;
  114. box-sizing: border-box;
  115. padding: 0 22rpx;
  116. border: 1rpx solid #dcdfe6;
  117. border-radius: 8rpx;
  118. font-size: 28rpx;
  119. color: #303133;
  120. background: #fff;
  121. }
  122. .query-btn {
  123. height: 72rpx;
  124. margin: 0;
  125. padding: 0;
  126. border-radius: 8rpx;
  127. font-size: 28rpx;
  128. line-height: 72rpx;
  129. color: #606266;
  130. background: #f7f8fa;
  131. }
  132. .query-btn.primary {
  133. color: #fff;
  134. background: #2979ff;
  135. }
  136. .room-scroll {
  137. flex: 1;
  138. height: 0;
  139. min-height: 0;
  140. }
  141. .room-grid {
  142. display: grid;
  143. grid-template-columns: repeat(3, minmax(0, 1fr));
  144. gap: 22rpx;
  145. padding-bottom: 4rpx;
  146. }
  147. .room-card {
  148. min-height: 260rpx;
  149. box-sizing: border-box;
  150. padding: 24rpx;
  151. border: 3rpx solid #e5e7eb;
  152. border-radius: 10rpx;
  153. background: #fff;
  154. }
  155. .room-card.disabled {
  156. background: #f7f8fa;
  157. }
  158. .room-card-top {
  159. display: flex;
  160. justify-content: space-between;
  161. gap: 18rpx;
  162. }
  163. .room-title-wrap {
  164. min-width: 0;
  165. flex: 1;
  166. }
  167. .room-name {
  168. font-size: 34rpx;
  169. font-weight: 700;
  170. color: #1f2937;
  171. line-height: 46rpx;
  172. overflow: hidden;
  173. white-space: nowrap;
  174. text-overflow: ellipsis;
  175. }
  176. .room-no {
  177. margin-top: 8rpx;
  178. font-size: 24rpx;
  179. color: #909399;
  180. line-height: 34rpx;
  181. }
  182. .room-status {
  183. height: 44rpx;
  184. padding: 0 18rpx;
  185. border-radius: 999rpx;
  186. font-size: 24rpx;
  187. line-height: 44rpx;
  188. white-space: nowrap;
  189. }
  190. .room-status.free {
  191. color: #19be6b;
  192. background: #e8f7ef;
  193. }
  194. .room-status.busy {
  195. color: #2979ff;
  196. background: #ecf5ff;
  197. }
  198. .room-meta {
  199. display: grid;
  200. grid-template-columns: repeat(2, minmax(0, 1fr));
  201. gap: 12rpx;
  202. margin-top: 28rpx;
  203. }
  204. .room-meta>view {
  205. padding: 16rpx;
  206. border-radius: 8rpx;
  207. /* background: #f7f9fb; */
  208. }
  209. .room-meta text {
  210. display: block;
  211. font-size: 24rpx;
  212. color: #909399;
  213. line-height: 32rpx;
  214. }
  215. .room-meta strong {
  216. display: block;
  217. margin-top: 6rpx;
  218. font-size: 30rpx;
  219. color: #303133;
  220. line-height: 40rpx;
  221. }
  222. .room-remarks {
  223. margin-top: 22rpx;
  224. font-size: 26rpx;
  225. color: #606266;
  226. line-height: 38rpx;
  227. overflow: hidden;
  228. display: -webkit-box;
  229. -webkit-line-clamp: 2;
  230. -webkit-box-orient: vertical;
  231. }
  232. .state-box,
  233. .empty-room {
  234. flex: 1;
  235. min-height: 360rpx;
  236. display: flex;
  237. align-items: center;
  238. justify-content: center;
  239. border-radius: 12rpx;
  240. background: #fff;
  241. color: #909399;
  242. }
  243. </style>