Queue.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <div class="queue">
  3. <van-nav-bar
  4. title="当前队列"
  5. right-text="打样"
  6. @click-left="toAdmin"
  7. @click-right="toOpen"
  8. left-text="添加预定"
  9. left-arrow
  10. />
  11. <van-cell-group>
  12. <van-cell v-for="(item, i) in queueList" :key="i">
  13. <template #title>
  14. {{ [i + 1 + ".", item.orderTime + " ", item.userName].join(" ") }}
  15. </template>
  16. <template #default>
  17. <van-button
  18. v-if="i === 0"
  19. type="default"
  20. size="small"
  21. @click="skipUser"
  22. >
  23. 跳过
  24. </van-button>
  25. <van-button v-if="i === 0" type="info" size="small" @click="nextItem">
  26. 完成
  27. </van-button>
  28. <van-button
  29. type="warning"
  30. size="small"
  31. @click="() => removequeue(item.id, i)"
  32. >删除</van-button
  33. >
  34. </template>
  35. </van-cell>
  36. </van-cell-group>
  37. <van-popup v-model="open" position="right" class="open">
  38. <van-radio-group v-model="radio">
  39. <van-row>
  40. <van-col span="8">周一</van-col>
  41. <van-col span="8">
  42. <van-stepper v-model="sH" />
  43. <van-stepper v-model="sM" />
  44. </van-col>
  45. <van-col span="8">
  46. <van-radio name="1">单选框 2</van-radio>
  47. </van-col>
  48. </van-row>
  49. <van-row>
  50. <van-col span="8">周二</van-col>
  51. <van-col span="8">span: 8</van-col>
  52. <van-col span="8">
  53. <van-radio name="2">单选框 2</van-radio>
  54. </van-col>
  55. </van-row>
  56. <van-row>
  57. <van-col span="8">周三</van-col>
  58. <van-col span="8">span: 8</van-col>
  59. <van-col span="8">
  60. <van-radio name="3">单选框 2</van-radio>
  61. </van-col>
  62. </van-row>
  63. <van-row>
  64. <van-col span="8">周四</van-col>
  65. <van-col span="8">span: 8</van-col>
  66. <van-col span="8">
  67. <van-radio name="4">单选框 2</van-radio>
  68. </van-col>
  69. </van-row>
  70. <van-row>
  71. <van-col span="8">周五</van-col>
  72. <van-col span="8">span: 8</van-col>
  73. <van-col span="8">
  74. <van-radio name="5">单选框 2</van-radio>
  75. </van-col>
  76. </van-row>
  77. <van-row>
  78. <van-col span="8">周六</van-col>
  79. <van-col span="8">span: 8</van-col>
  80. <van-col span="8">
  81. <van-radio name="6">单选框 2</van-radio>
  82. </van-col>
  83. </van-row>
  84. <van-row>
  85. <van-col span="8">周日</van-col>
  86. <van-col span="8">span: 8</van-col>
  87. <van-col span="8">
  88. <van-radio name="7">单选框 2</van-radio>
  89. </van-col>
  90. </van-row>
  91. </van-radio-group>
  92. </van-popup>
  93. </div>
  94. </template>
  95. <script>
  96. // @ is an alias to /src
  97. import {
  98. Cell as vanCell,
  99. CellGroup as vanCellGroup,
  100. Button as vanButton,
  101. NavBar as vanNavBar,
  102. Popup as vanPopup,
  103. Col as vanCol,
  104. Row as vanRow,
  105. Radio as vanRadio,
  106. RadioGroup as vanRadioGroup,
  107. Stepper as vanStepper,
  108. Dialog,
  109. } from "vant";
  110. import "vant/lib/cell/style/index";
  111. import "vant/lib/cell-group/style/index";
  112. import "vant/lib/dialog/style/index";
  113. import "vant/lib/button/style/index";
  114. import "vant/lib/popup/style/index";
  115. import "vant/lib/col/style/index";
  116. import "vant/lib/row/style/index";
  117. import "vant/lib/radio/style/index";
  118. import "vant/lib/stepper/style/index";
  119. import "vant/lib/radio-group/style/index";
  120. import "vant/lib/nav-bar/style/index";
  121. import { orderList, skip, nextone, cancel } from "../api/index";
  122. export default {
  123. name: "Queue",
  124. data() {
  125. return {
  126. queueList: [],
  127. sH: 0,
  128. sM: 0,
  129. eH: 0,
  130. eM: 0,
  131. open: false,
  132. radio: "",
  133. };
  134. },
  135. mounted() {
  136. this.reloadOrder();
  137. },
  138. computed: {},
  139. methods: {
  140. toOpen() {
  141. this.open = true;
  142. },
  143. reloadOrder() {
  144. orderList().then(res => {
  145. this.queueList = res || [];
  146. });
  147. },
  148. toAdmin() {
  149. this.$router.push({ name: "Apply", params: { a: 0 } });
  150. },
  151. skipUser() {
  152. Dialog.confirm({
  153. message: "是否跳过该用户?",
  154. confirmButtonColor: "#2a7ef4",
  155. }).then(() => {
  156. skip().then(() => {
  157. this.reloadOrder();
  158. });
  159. });
  160. },
  161. nextItem() {
  162. Dialog.confirm({
  163. message: "该服务是否已完成?",
  164. confirmButtonColor: "#2a7ef4",
  165. }).then(() => {
  166. nextone().then(() => {
  167. this.reloadOrder();
  168. });
  169. });
  170. },
  171. removequeue(id, i) {
  172. console.log(id);
  173. Dialog.confirm({
  174. message: "确定要删除该预约?",
  175. confirmButtonColor: "#2a7ef4",
  176. }).then(() => {
  177. // on confirm
  178. cancel({
  179. id,
  180. }).then(() => {
  181. let queueList = JSON.parse(JSON.stringify(this.queueList));
  182. queueList.splice(i, 1);
  183. this.queueList = queueList;
  184. });
  185. });
  186. },
  187. },
  188. beforeUnmount: function () {},
  189. components: {
  190. vanCell,
  191. vanCellGroup,
  192. vanButton,
  193. vanNavBar,
  194. vanPopup,
  195. vanCol,
  196. vanRow,
  197. vanRadio,
  198. vanRadioGroup,
  199. vanStepper
  200. },
  201. };
  202. </script>
  203. <style>
  204. .queue {
  205. width: 990px;
  206. height: 100%;
  207. margin: 0 auto;
  208. background-color: #fff;
  209. }
  210. .queue .open {
  211. height: 100%;
  212. min-width: 500px;
  213. padding: 1em;
  214. box-sizing: border-box;
  215. }
  216. .queue .van-col {
  217. height: 2em;
  218. line-height: 2em;
  219. }
  220. </style>