hotel.js 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. import { request } from '@/utils'
  2. // ==================== 二维码管理 ====================
  3. /** 分页查询二维码 */
  4. export function getQrCodePage(params) {
  5. return request.get('/hotel/qrcode/page', { params })
  6. }
  7. /** 查询二维码详情 */
  8. export function getQrCodeDetail(id) {
  9. return request.get(`/hotel/qrcode/${id}`)
  10. }
  11. /** 批量生成二维码 */
  12. export function batchGenerateQrCode(data) {
  13. return request.post('/hotel/qrcode/batch-generate', data)
  14. }
  15. /** 绑定房间 */
  16. export function bindQrCode(id, data) {
  17. return request.post(`/hotel/qrcode/${id}/bind`, data)
  18. }
  19. /** 重新绑定房间 */
  20. export function rebindQrCode(id, data) {
  21. return request.post(`/hotel/qrcode/${id}/rebind`, data)
  22. }
  23. /** 解绑房间 */
  24. export function unbindQrCode(id) {
  25. return request.post(`/hotel/qrcode/${id}/unbind`)
  26. }
  27. /** 更新二维码状态 */
  28. export function updateQrCodeStatus(id, status) {
  29. return request.put(`/hotel/qrcode/${id}/status`, null, { params: { status } })
  30. }
  31. /** 查询绑定日志 */
  32. export function getQrCodeBindLogs(id) {
  33. return request.get(`/hotel/qrcode/${id}/bind-logs`)
  34. }
  35. /** 批量删除二维码 */
  36. export function batchRemoveQrCode(ids) {
  37. return request.post('/hotel/qrcode/batch-remove', ids)
  38. }
  39. /** 批量下载二维码ZIP(返回blob) */
  40. export function batchDownloadQrCode(ids) {
  41. return request.post('/hotel/qrcode/batch-download', ids, { responseType: 'blob' })
  42. }
  43. // ==================== 房间管理 ====================
  44. /** 分页查询房间 */
  45. export function getRoomPage(params) {
  46. return request.get('/hotel/room/page', { params })
  47. }
  48. /** 查询全部房间(下拉用) */
  49. export function getRoomListAll() {
  50. return request.get('/hotel/room/list-all')
  51. }
  52. /** 查询房间详情 */
  53. export function getRoomDetail(id) {
  54. return request.get(`/hotel/room/${id}`)
  55. }
  56. /** 新增房间 */
  57. export function createRoom(data) {
  58. return request.post('/hotel/room', data)
  59. }
  60. /** 修改房间 */
  61. export function updateRoom(data) {
  62. return request.put('/hotel/room', data)
  63. }
  64. /** 删除房间 */
  65. export function deleteRoom(id) {
  66. return request.post(`/hotel/room/remove/${id}`)
  67. }
  68. // ==================== 房型管理 ====================
  69. /** 查询房型列表 */
  70. export function getRoomTypeList() {
  71. return request.get('/hotel/room-type/list')
  72. }
  73. /** 查询房型详情 */
  74. export function getRoomTypeDetail(id) {
  75. return request.get(`/hotel/room-type/${id}`)
  76. }
  77. /** 新增房型 */
  78. export function createRoomType(data) {
  79. return request.post('/hotel/room-type', data)
  80. }
  81. /** 修改房型 */
  82. export function updateRoomType(data) {
  83. return request.put('/hotel/room-type', data)
  84. }
  85. /** 删除房型 */
  86. export function deleteRoomType(id) {
  87. return request.post(`/hotel/room-type/remove/${id}`)
  88. }
  89. // ==================== 菜品分类管理 ====================
  90. /** 查询全部分类(带菜品数量) */
  91. export function getDishCategoryList() {
  92. return request.get('/hotel/dish-category/list')
  93. }
  94. /** 查询启用分类(下拉用) */
  95. export function getDishCategoryEnabled() {
  96. return request.get('/hotel/dish-category/enabled')
  97. }
  98. /** 查询分类详情 */
  99. export function getDishCategoryDetail(id) {
  100. return request.get(`/hotel/dish-category/${id}`)
  101. }
  102. /** 新增分类 */
  103. export function createDishCategory(data) {
  104. return request.post('/hotel/dish-category', data)
  105. }
  106. /** 修改分类 */
  107. export function updateDishCategory(data) {
  108. return request.put('/hotel/dish-category', data)
  109. }
  110. /** 删除分类 */
  111. export function deleteDishCategory(id) {
  112. return request.post(`/hotel/dish-category/remove/${id}`)
  113. }
  114. /** 切换分类状态 */
  115. export function toggleDishCategoryStatus(id) {
  116. return request.post(`/hotel/dish-category/${id}/toggle-status`)
  117. }
  118. // ==================== 菜品管理 ====================
  119. /** 分页查询菜品 */
  120. export function getDishPage(params) {
  121. return request.get('/hotel/dish/page', { params })
  122. }
  123. /** 查询菜品详情 */
  124. export function getDishDetail(id) {
  125. return request.get(`/hotel/dish/${id}`)
  126. }
  127. /** 新增菜品 */
  128. export function createDish(data) {
  129. return request.post('/hotel/dish', data)
  130. }
  131. /** 修改菜品 */
  132. export function updateDish(data) {
  133. return request.put('/hotel/dish', data)
  134. }
  135. /** 删除菜品 */
  136. export function deleteDish(id) {
  137. return request.post(`/hotel/dish/remove/${id}`)
  138. }
  139. /** 更新菜品状态 */
  140. export function updateDishStatus(id, status) {
  141. return request.put(`/hotel/dish/${id}/status`, null, { params: { status } })
  142. }
  143. /** 标记售罄 */
  144. export function markDishSoldOut(id) {
  145. return request.post(`/hotel/dish/${id}/sold-out`)
  146. }
  147. /** 恢复上架 */
  148. export function restoreDish(id) {
  149. return request.post(`/hotel/dish/${id}/restore`)
  150. }
  151. /** 批量操作菜品 */
  152. export function batchOperateDish(data) {
  153. return request.post('/hotel/dish/batch', data)
  154. }
  155. /** 销量排行 */
  156. export function getDishSalesRanking(limit = 10) {
  157. return request.get('/hotel/dish/ranking', { params: { limit } })
  158. }
  159. // ==================== 菜品规格管理 ====================
  160. /** 分页查询规格组 */
  161. export function getDishSpecPage(params) {
  162. return request.get('/hotel/dish-spec/page', { params })
  163. }
  164. /** 根据菜品ID查询规格组(含选项) */
  165. export function getDishSpecByDishId(dishId) {
  166. return request.get(`/hotel/dish-spec/by-dish/${dishId}`)
  167. }
  168. /** 查询规格组详情 */
  169. export function getDishSpecDetail(id) {
  170. return request.get(`/hotel/dish-spec/${id}`)
  171. }
  172. /** 新增规格组 */
  173. export function createDishSpec(data) {
  174. return request.post('/hotel/dish-spec', data)
  175. }
  176. /** 修改规格组 */
  177. export function updateDishSpec(data) {
  178. return request.put('/hotel/dish-spec', data)
  179. }
  180. /** 删除规格组(级联删除选项) */
  181. export function deleteDishSpec(id) {
  182. return request.post(`/hotel/dish-spec/remove/${id}`)
  183. }
  184. /** 根据规格组ID查询选项列表 */
  185. export function getDishSpecOptionList(groupId) {
  186. return request.get(`/hotel/dish-spec/option/list/${groupId}`)
  187. }
  188. /** 查询规格选项详情 */
  189. export function getDishSpecOptionDetail(id) {
  190. return request.get(`/hotel/dish-spec/option/${id}`)
  191. }
  192. /** 新增规格选项 */
  193. export function createDishSpecOption(data) {
  194. return request.post('/hotel/dish-spec/option', data)
  195. }
  196. /** 修改规格选项 */
  197. export function updateDishSpecOption(data) {
  198. return request.put('/hotel/dish-spec/option', data)
  199. }
  200. /** 删除规格选项 */
  201. export function deleteDishSpecOption(id) {
  202. return request.post(`/hotel/dish-spec/option/remove/${id}`)
  203. }
  204. // ==================== 营业时段管理 ====================
  205. /** 分页查询营业时段 */
  206. export function getBusinessHoursPage(params) {
  207. return request.get('/hotel/business-hours/page', { params })
  208. }
  209. /** 查询全部营业时段(含禁用) */
  210. export function getBusinessHoursAll() {
  211. return request.get('/hotel/business-hours/all')
  212. }
  213. /** 查询启用的营业时段(顾客端用) */
  214. export function getBusinessHoursEnabled() {
  215. return request.get('/hotel/business-hours/enabled')
  216. }
  217. /** 检查当前营业状态(顾客端用) */
  218. export function checkCurrentBusinessHours() {
  219. return request.get('/hotel/business-hours/check-current')
  220. }
  221. /** 查询营业时段详情 */
  222. export function getBusinessHoursDetail(id) {
  223. return request.get(`/hotel/business-hours/${id}`)
  224. }
  225. /** 新增营业时段 */
  226. export function createBusinessHours(data) {
  227. return request.post('/hotel/business-hours', data)
  228. }
  229. /** 修改营业时段 */
  230. export function updateBusinessHours(data) {
  231. return request.put('/hotel/business-hours', data)
  232. }
  233. /** 切换营业时段状态 */
  234. export function toggleBusinessHours(id) {
  235. return request.post(`/hotel/business-hours/${id}/toggle`)
  236. }
  237. /** 删除营业时段 */
  238. export function deleteBusinessHours(id) {
  239. return request.post(`/hotel/business-hours/remove/${id}`)
  240. }