index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <view class="box">
  3. <view v-for="(item,index) in list" :key="index" class="box-list" @click="goDetail(item)">
  4. <image v-if="item.status == 1" class="box-list-icon" src="../../images/yiyuyue.png"></image>
  5. <image v-if="item.status == 2" class="box-list-icon" src="../../images/yishiyong.png"></image>
  6. <view class="box-list-left">
  7. <view class="box-list-org">{{item.orgName}}</view>
  8. <view class="box-list-serve">{{item.title}}</view>
  9. <view class="box-list-date">{{item.day}} {{item.start}}-{{item.end}}</view>
  10. </view>
  11. <view class="box-list-right">
  12. <view v-if="item.status == 0" class="box-btn">待审核</view>
  13. <view v-if="item.status == 1" class="box-btn box-btn-use">已预约</view>
  14. <view v-if="item.status == 2" class="box-btn">已使用</view>
  15. <view v-if="item.status == 3" class="box-btn">已过期</view>
  16. <view v-if="item.status == 4" class="box-btn">已拒绝</view>
  17. </view>
  18. </view>
  19. <!-- <view class="box-list">
  20. <image class="box-list-icon" src="../../images/yishiyong.png"></image>
  21. <view class="box-list-left">
  22. <view class="box-list-org">中国银行</view>
  23. <view class="box-list-serve">行政楼501人事部</view>
  24. <view class="box-list-date">2021-1-26 15:00-16:00</view>
  25. </view>
  26. <view class="box-list-right">
  27. <view class="box-btn">已使用</view>
  28. </view>
  29. </view> -->
  30. <view v-if="list.length == 0" class="no-data">
  31. <image src="../../images/no_data.png" mode=""></image>
  32. <view class="no-data-text">
  33. 空空如也~
  34. </view>
  35. </view>
  36. <image src="../../images/yuyuebtn.png" class="yuyue-btn" @click="goAdd"></image>
  37. </view>
  38. </template>
  39. <script>
  40. var app = getApp();
  41. export default {
  42. data() {
  43. return {
  44. list: [],
  45. page: 1,
  46. size: 10,
  47. flag: 0
  48. }
  49. },
  50. onLoad() {
  51. app.checkLogin();
  52. },
  53. onShow() {
  54. var that = this;
  55. app.ajaxReadyCallback = res => { //各个接口统一回调方法
  56. var apiname = res.data.apiname;
  57. console.log(res);
  58. if(apiname == 'order'){
  59. that.list = res.data.data;
  60. if (that.list.length < that.size) {
  61. that.flag = 1;
  62. } else {
  63. that.page++;
  64. }
  65. }
  66. }
  67. this.flag = 0;
  68. this.page = 1;
  69. this.getOrder();
  70. },
  71. onPullDownRefresh() {
  72. this.flag = 0;
  73. this.page = 1;
  74. this.getOrder();
  75. },
  76. onReachBottom() { //上拉加载
  77. this.getOrder();
  78. },
  79. methods: {
  80. goAdd(){
  81. uni.navigateTo({
  82. url: '/pages/index/add'
  83. });
  84. },
  85. goDetail(obj){
  86. var that = this;
  87. uni.navigateTo({
  88. url: '/pages/index/detail',
  89. success: function(res) {
  90. // 通过eventChannel向被打开页面传送数据
  91. res.eventChannel.emit('acceptDataFromOpenerPage', obj);
  92. }
  93. })
  94. },
  95. getOrder(){
  96. if(this.flag == 1){
  97. return;
  98. }
  99. app.ajax({
  100. url: app.globalData.serverUrl + 'visitorOrder/list',
  101. type: 'POST',
  102. apiname: 'order',
  103. data: {
  104. page: this.page,
  105. size: this.size
  106. }
  107. });
  108. },
  109. }
  110. }
  111. </script>
  112. <style lang="scss" scoped>
  113. page{
  114. // background-color: #FFFFFF;
  115. }
  116. .box{
  117. padding: 20rpx;
  118. }
  119. .box-list{
  120. width: 670rpx;
  121. height: 120rpx;
  122. background-color: #FFFFFF;
  123. border-radius: 8rpx;
  124. position: relative;
  125. padding: 20rpx;
  126. margin-bottom: 10rpx;
  127. }
  128. .box-list-icon{
  129. position: absolute;
  130. z-index: 10;
  131. left: 0;
  132. top: 0;
  133. display: inline-block;
  134. width: 28rpx;
  135. height: 28rpx;
  136. }
  137. .box-list-left{
  138. display: inline-block;
  139. width: 520rpx;
  140. height: 120rpx;
  141. float: left;
  142. }
  143. .box-list-right{
  144. display: inline-block;
  145. width: 132rpx;
  146. height: 120rpx;
  147. line-height: 120rpx;
  148. float: right;
  149. }
  150. .box-btn{
  151. display: inline-block;
  152. width: 132rpx;
  153. height: 48rpx;
  154. line-height: 48rpx;
  155. text-align: center;
  156. border-radius: 24rpx;
  157. vertical-align: middle;
  158. background-color: #DFDFDF;
  159. border: 1rpx solid #949494;
  160. color: #949494;
  161. font-size: 28rpx;
  162. }
  163. .box-btn.box-btn-use{
  164. color: #FFB145;
  165. background-color: #FFE5C0;
  166. border: 1rpx solid #FFB145;
  167. }
  168. .box-list-org{
  169. color: #333333;
  170. font-size: 32rpx;
  171. font-weight: 500;
  172. }
  173. .box-list-serve,.box-list-date{
  174. color: #949494;
  175. font-size: 28rpx;
  176. font-weight: 500;
  177. }
  178. .yuyue-btn{
  179. width: 171rpx;
  180. height: 171rpx;
  181. display: inline-block;
  182. position: fixed;
  183. z-index: 1000;
  184. right: 32rpx;
  185. bottom: 167rpx;
  186. border-radius: 50%;
  187. }
  188. </style>