booking.vue 4.8 KB

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