index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <template>
  2. <view class="container">
  3. <!-- <view class="page-top flex-row flex-y-center">
  4. <view class="type-btn flex-grow-0 flex-center" @click="onTopBtnTap(3)">
  5. 餐桌类型 <view class="d3"></view>
  6. </view>
  7. <uni-search-bar :radius="100" placeholder="搜索" @confirm="search" class="flex-grow-1"></uni-search-bar>
  8. </view>
  9. -->
  10. <view class="list">
  11. <view class="item" v-for="(item,index) in list" :key="index">
  12. <view class="top flex flex-y-center box-pack-between">
  13. <view class="name">{{item.code}}</view>
  14. <view class="flex-y-center">
  15. <view class="del" @click="del(item.id)">呼叫入座</view>
  16. <view class="del" style="background: #007AFF;" @click="onTypeChange(item.id)">跳过</view>
  17. <!-- <switch :checked="item.state==1?true:false" @change="onTypeChange" :data-index="index"
  18. color="#247EFF" class="type-btn" /> -->
  19. </view>
  20. </view>
  21. <view class="content flex flex-y-center" hover-class="nav-hover">
  22. <view class="cell flex flex-y-center">
  23. <view class="title">位置类型:</view>
  24. <view class="desc">{{item.type_name}}</view>
  25. </view>
  26. <view class="cell flex flex-y-center">
  27. <view class="title">取号数量:</view>
  28. <view class="desc">{{item.count}}</view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="no-more">没有更多内容了~</view>
  33. </view>
  34. <!-- <view class="footer-bar">
  35. <view class="content flex flex-center">
  36. <navigator url="/saomaDiancan/editPrinter/editPrinter" class="btn">+新增设备</navigator>
  37. </view>
  38. </view> -->
  39. </view>
  40. </template>
  41. <script>
  42. export default {
  43. data() {
  44. return {
  45. admin_id: "",
  46. list: [],
  47. page: 1,
  48. is_bottom: false
  49. }
  50. },
  51. onLoad(options) {
  52. this.admin_id = uni.getStorageSync("admin_id");
  53. },
  54. onShow() {
  55. this.getData(1)
  56. },
  57. onReachBottom() {
  58. if (!this.is_bottom) {
  59. this.getData(this.page + 1)
  60. }
  61. },
  62. methods: {
  63. del(id) {
  64. uni.showModal({
  65. title: '提示',
  66. content: '确定要入座?',
  67. showCancel: true,
  68. cancelText: '取消',
  69. confirmText: '确定',
  70. success: res => {
  71. if (res.confirm) {
  72. this.request({
  73. url: 'Smdcshop/editLineStatus',
  74. data: {
  75. id: id,
  76. status: 1,
  77. },
  78. }).then(res => {
  79. console.log(res, "res")
  80. if (res.code === 200 || res.code === "200") {
  81. uni.showToast({
  82. title: "入座成功",
  83. icon: "none",
  84. })
  85. setTimeout(() => {
  86. this.getData(1)
  87. }, 2000)
  88. }
  89. }).catch((res) => {
  90. uni.showToast({
  91. title: res.message,
  92. icon: "none",
  93. })
  94. });
  95. }
  96. },
  97. fail: () => {},
  98. complete: () => {}
  99. });
  100. },
  101. onTypeChange(id) {
  102. uni.showModal({
  103. title: '提示',
  104. content: '确定要跳过?',
  105. showCancel: true,
  106. cancelText: '取消',
  107. confirmText: '确定',
  108. success: res => {
  109. if (res.confirm) {
  110. this.request({
  111. url: 'Smdcshop/editLineStatus',
  112. data: {
  113. id: id,
  114. status: 0
  115. },
  116. }).then(res => {
  117. console.log(res, "res")
  118. if (res.code === 200 || res.code === "200") {
  119. uni.showToast({
  120. title: "已跳过",
  121. icon: "none",
  122. })
  123. setTimeout(() => {
  124. this.getData(1)
  125. }, 2000)
  126. }
  127. }).catch((res) => {
  128. uni.showToast({
  129. title: res.message,
  130. icon: "none",
  131. })
  132. });
  133. }
  134. },
  135. fail: () => {},
  136. complete: () => {}
  137. });
  138. },
  139. getData(page) {
  140. if (page == 1) {
  141. this.list = []
  142. this.page = 1
  143. this.is_bottom = false
  144. }
  145. this.request({
  146. url: 'Smdcshop/getline_list',
  147. data: {
  148. page,
  149. limit: 10,
  150. admin_id: this.admin_id
  151. }
  152. }).then(res => {
  153. if (res.code == 200 && res.data.length) {
  154. this.list = this.list.concat(res.data)
  155. this.page = page
  156. } else {
  157. this.is_bottom = true
  158. }
  159. })
  160. }
  161. }
  162. }
  163. </script>
  164. <style lang="scss">
  165. @import url("../static/css/common.css");
  166. .page-top {
  167. background: #fff;
  168. position: sticky;
  169. top: 0;
  170. z-index: 99;
  171. padding: 10rpx 0;
  172. box-shadow: 0 5rpx 10rpx #f0f0f0;
  173. .type-btn{
  174. font-size: 24rpx;
  175. padding-left: 24rpx;
  176. }
  177. .d3 {
  178. width: 0;
  179. height: 0;
  180. border-width: 12rpx;
  181. border-style: solid;
  182. border-color: #000 transparent transparent transparent;
  183. margin-top: 14rpx;
  184. margin-left: 10rpx;
  185. }
  186. }
  187. .del {
  188. height: 44rpx;
  189. line-height: 44rpx;
  190. padding: 0 15rpx;
  191. font-size: 24rpx;
  192. background-color: #FF5722;
  193. margin-right: 25rpx;
  194. color: #fff;
  195. border-radius: 6rpx;
  196. }
  197. page {
  198. background-color: #F4F5F7;
  199. }
  200. .list {
  201. padding: 30rpx 25rpx;
  202. }
  203. .list .item {
  204. border-radius: 8rpx;
  205. overflow: hidden;
  206. padding-left: 30rpx;
  207. border-left: 8rpx solid #247EFF;
  208. background-color: #fff;
  209. margin-bottom: 30rpx;
  210. }
  211. .list .item .top {
  212. height: 80rpx;
  213. border-bottom: 1rpx solid #f5f5f5;
  214. }
  215. .list .item .top .name {
  216. font-size: 30rpx;
  217. line-height: 80rpx;
  218. font-weight: bold;
  219. }
  220. .list .item .top .type-btn {
  221. zoom: 0.7;
  222. margin-right: 25rpx;
  223. }
  224. .list .item .content {
  225. padding: 20rpx 0 24rpx;
  226. }
  227. .list .item .content .cell {
  228. flex: none;
  229. width: 50%;
  230. box-sizing: border-box;
  231. padding-right: 30rpx;
  232. font-size: 26rpx;
  233. line-height: 37rpx;
  234. color: #666;
  235. }
  236. .list .item .content .cell .title {
  237. color: #99A0AD;
  238. }
  239. </style>