booking.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <view class="app">
  3. <view class="app-body">
  4. <!--关键词搜索-->
  5. <view class="sreach fx-r fx-bc fx-ac">
  6. <image class="icon" src="/static/img/tb-seach.png"></image>
  7. <input type="text" v-model="keyword" placeholder="请输入用户昵称/用户ID" placeholder-style="color: #B3B3B3;" />
  8. <view class="fx-g1"></view>
  9. <view class="search-btn" @tap="tapSerach">搜索</view>
  10. </view>
  11. </view>
  12. <scroll-view scroll-y class="scroll" :style="'height: calc(100vh - ' + hFoot + 'px - 60px);'"
  13. @scrolltolower="loadMoreData">
  14. <view class="sc-body">
  15. <view class="item" v-for="item in listAr">
  16. <view class="info fx-r">
  17. <view class="nickname">{{ item.nickname }}</view>
  18. <view class="mobile">{{ item.mobile }}</view>
  19. </view>
  20. <view class="info fx-r">
  21. <view class="id">数量: <text
  22. style="color: red;font-weight: bold;margin-right: 2px;">{{ item.count }}</text> 单</view>
  23. </view>
  24. <view class="info fx-r">
  25. <view class="id">ID号:{{ item.uid }}</view>
  26. <view class="fx-g1"></view>
  27. <view class="changci">场次:{{ item.action_name }}</view>
  28. </view>
  29. <view class="infos fx-r">
  30. <view class="time">预约时间:<text>{{ item.create_time }}</text></view>
  31. </view>
  32. </view>
  33. <view v-if="listAr.length > 0">
  34. <view class="loading fx-r fx-ac fx-bc" v-if="page.isFrite && !page.isFoot">
  35. <image src="/static/img/xloading.png"></image>
  36. <text>正在载入更多...</text>
  37. </view>
  38. <view class="loading complete" :hidden="!page.isFoot">已加载全部</view>
  39. </view>
  40. <view v-if="listAr.length == 0 && isFirst">
  41. <uv-empty mode="data" icon="/static/img/no-empty.png"></uv-empty>
  42. </view>
  43. </view>
  44. </scroll-view>
  45. </view>
  46. </template>
  47. <script>
  48. import {
  49. mapState,
  50. mapMutations
  51. } from 'vuex';
  52. export default {
  53. computed: mapState(['user']),
  54. data() {
  55. return {
  56. isFirst: false,
  57. listAr: [],
  58. keyword: "",
  59. id: 0,
  60. hFoot: 0,
  61. page: {
  62. isFirst: false,
  63. isLoad: false,
  64. isFoot: false,
  65. page: 1
  66. },
  67. }
  68. },
  69. onLoad(options) {
  70. this.id = options.id || 0;
  71. this.initView();
  72. // #ifdef H5
  73. this.hFoot = 60;
  74. // #endif
  75. },
  76. methods: {
  77. ...mapMutations(['checkUserLogin']),
  78. /**
  79. * 加载基础配置
  80. */
  81. initView: function() {
  82. this.getData(true);
  83. },
  84. /**
  85. * 获取数据
  86. */
  87. getData: function(isPull = false) {
  88. if (this.page.isLoad) return;
  89. this.page.isLoad = true;
  90. if (isPull) {
  91. this.page.page = 1;
  92. this.page.isLoad = false;
  93. this.page.isFoot = false;
  94. }
  95. uni.showLoading({
  96. title: '获取数据中..'
  97. });
  98. var post = {};
  99. post.page = this.page.page;
  100. this
  101. .request
  102. .post("gzBooking", {
  103. keyword: this.keyword,
  104. page: this.page.page,
  105. id: this.id
  106. })
  107. .then(res => {
  108. uni.hideLoading();
  109. this.page.isFirst = true;
  110. this.page.isLoad = false;
  111. this.isFirst = true;
  112. if (isPull) {
  113. this.listAr = res.data.list;
  114. } else {
  115. this.listAr = this.listAr.concat(res.data.list);
  116. }
  117. //是否到底
  118. if (res.data.list.length != res.data.pageSize) {
  119. this.page.isFoot = true;
  120. }
  121. })
  122. .catch((res) => {
  123. console.log(res);
  124. uni.hideLoading();
  125. uni.showModal({
  126. title: '系统提示',
  127. content: '加载失败,返回在尝试',
  128. showCancel: false
  129. });
  130. });
  131. },
  132. tapSerach: function() {
  133. this.getData(true);
  134. },
  135. loadMoreData: function() {
  136. if (this.page.isFoot || this.page.isLoad) {
  137. return;
  138. }
  139. this.page.page++;
  140. this.getData();
  141. },
  142. },
  143. }
  144. </script>
  145. <style lang="scss">
  146. .app-body {
  147. padding: 0px 20rpx;
  148. }
  149. .sreach {
  150. background: #fff;
  151. margin: 20rpx 0;
  152. border-radius: 32rpx;
  153. padding: 16rpx 32rpx;
  154. .icon {
  155. width: 46rpx;
  156. height: 46rpx;
  157. }
  158. input {
  159. width: calc(100% - 46rpx - 16rpx - 50px);
  160. font-size: 16px;
  161. }
  162. .search-btn {
  163. font-size: 14px;
  164. color: #FF4C4C;
  165. }
  166. }
  167. .sc-body {
  168. padding: 20rpx;
  169. .item {
  170. background: #FFFFFF;
  171. border-radius: 16rpx;
  172. padding: 26rpx 44rpx;
  173. margin-bottom: 10px;
  174. .info {
  175. margin-bottom: 10rpx;
  176. .nickname {
  177. font-weight: bold;
  178. font-size: 32rpx;
  179. color: #303133;
  180. }
  181. .mobile {
  182. font-weight: 500;
  183. font-size: 30rpx;
  184. color: #999999;
  185. margin-left: 10px;
  186. }
  187. .id {
  188. font-weight: 500;
  189. font-size: 26rpx;
  190. color: #666666;
  191. }
  192. .changci {
  193. font-weight: 500;
  194. font-size: 26rpx;
  195. color: #666666;
  196. text {
  197. color: #333333;
  198. }
  199. }
  200. }
  201. .infos {
  202. margin-top: 10px;
  203. border-top: 1px solid #f1f1f1;
  204. padding-top: 6px;
  205. .time {
  206. font-size: 14px;
  207. color: #666;
  208. }
  209. }
  210. }
  211. }
  212. </style>