record.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <view class="container">
  3. <!-- 筛选区域 -->
  4. <Search :typeList="typeList" :timeList="timeList" @handLeConveyData="getConveyData" />
  5. <!-- 列表区域 -->
  6. <view class="list" v-for="(item,index) in listData" :key="index" @click="handleLookDetail(item)">
  7. <view class="list-title">
  8. <view class="title-number">
  9. 车牌:{{item.car_number!=0?item.car_number:'无'}}
  10. </view>
  11. <view class="title-icon">
  12. <img src="../../static/right.png">
  13. </view>
  14. </view>
  15. <view class="list-item">
  16. 状态:
  17. <span :class="item.state_str=='预约进行中'||item.state_str=='候补中'?'list-item-type':''">{{item.state_str}}
  18. </span>
  19. </view>
  20. <view class="list-item">
  21. 发车日期:<span>{{item.yy_date}}</span>
  22. </view>
  23. <view class="list-item" v-if="item.state_str=='预约进行中'||item.state_str=='已截止'">
  24. 发车时间:<span>{{item.ci_time}}</span>
  25. </view>
  26. <view class="list-item">
  27. 线路:<span>{{item.route}}</span>
  28. </view>
  29. <view class="list-item">
  30. 终点:<span>{{item.route_end}}</span>
  31. </view>
  32. <view class="list-item">
  33. 人数:
  34. <view class="list-item-progress" v-if="item.state_str=='预约进行中'||item.state_str=='已截止'">
  35. <progress activeColor="#3C50E8" stroke-width="9" :percent="item.percent?item.percent:0" />
  36. </view>
  37. <span v-if="item.state_str=='预约进行中'||item.state_str=='已截止'">{{item.user_num+'/'+item.contain}}</span>
  38. <span v-else>{{item.contain}}</span>
  39. </view>
  40. </view>
  41. <!-- 无数据时展示的区域 -->
  42. <view class="list-nodata" v-if="listData.length ==0">
  43. <img src="../../static/no-bus.png">
  44. <view>
  45. 暂无数据
  46. </view>
  47. </view>
  48. </view>
  49. </template>
  50. <script setup>
  51. import {
  52. ref
  53. } from "vue"
  54. import {
  55. onLoad,
  56. onPullDownRefresh
  57. } from "@dcloudio/uni-app"
  58. import {
  59. myRequest
  60. } from "../../util/api.js"
  61. import {
  62. isWeixin
  63. } from "../../util/isWeixin.js"
  64. import Search from '../../components/search'
  65. onLoad(() => {
  66. if (isWeixin()) {
  67. getData()
  68. } else {
  69. uni.redirectTo({
  70. url: "/pages/404/404?message=请在微信客户端打开链接"
  71. })
  72. }
  73. })
  74. onPullDownRefresh(() => {
  75. getData()
  76. setTimeout(function() {
  77. uni.stopPullDownRefresh()
  78. }, 500)
  79. })
  80. // 预约状态数组
  81. const typeList = ref(['全部', '预约进行中', '已截止', '已分配', '候补中'])
  82. // 时间状态数组
  83. const timeList = ref(['全部', '今天', '明天'])
  84. // 时间状态 全部:1 今天:2 明天:3
  85. const date_state = ref(1)
  86. // 预约状态 全部:0 预约进行中:1 已截止:2 已分配:3 候补中:4
  87. const result_state = ref(0)
  88. // 预约记录数据
  89. const listData = ref([])
  90. // 获取预约记录数据
  91. const getData = async () => {
  92. const res = await myRequest({
  93. url: '/appcarCaptainManage.action',
  94. data: {
  95. date_state: date_state.value,
  96. result_state: result_state.value,
  97. }
  98. })
  99. // console.log(res.data);
  100. if (res.data.length) {
  101. res.data.forEach((item) => {
  102. item.percent = Math.ceil(parseInt(item.user_num) / parseInt(item.contain))
  103. })
  104. }
  105. listData.value = res.data
  106. }
  107. // 点击每一条记录回调
  108. const handleLookDetail = (item) => {
  109. const info = JSON.stringify(item)
  110. uni.navigateTo({
  111. url: `/pages/detail/detail?info=${info}`
  112. })
  113. }
  114. // 条件筛选框选择回调
  115. const getConveyData = (Obj) => {
  116. date_state.value = Obj.timeIndex - 0 + 1
  117. result_state.value = Obj.typeIndex
  118. getData()
  119. }
  120. </script>
  121. <style lang="scss" scoped>
  122. .container {
  123. background-color: #F2F2F2;
  124. .list {
  125. margin-bottom: 20rpx;
  126. padding-bottom: 24rpx;
  127. background-color: #fff;
  128. .list-title {
  129. display: flex;
  130. justify-content: space-between;
  131. align-items: center;
  132. padding: 0 30rpx;
  133. margin-bottom: 20rpx;
  134. height: 94rpx;
  135. font-size: 32rpx;
  136. font-weight: bold;
  137. border-bottom: 1rpx solid #E6E6E6;
  138. .title-icon {
  139. margin-top: -20rpx;
  140. width: 15rpx;
  141. height: 25rpx;
  142. img {
  143. width: 100%;
  144. height: 100%;
  145. }
  146. }
  147. }
  148. .list-item {
  149. display: flex;
  150. align-items: center;
  151. padding: 0 30rpx;
  152. margin-bottom: 14rpx;
  153. color: #999999;
  154. font-size: 28rpx;
  155. span {
  156. color: #333333;
  157. }
  158. .list-item-type {
  159. color: #00BAAD;
  160. }
  161. .list-item-progress {
  162. margin-right: 36rpx;
  163. width: 437rpx;
  164. height: 22rpx;
  165. :deep(.uni-progress-bar),
  166. :deep(.uni-progress-inner-bar) {
  167. border-radius: 85rpx;
  168. }
  169. }
  170. }
  171. }
  172. .list-nodata {
  173. margin-top: -20rpx;
  174. padding-top: 100rpx;
  175. background-color: #fff;
  176. text-align: center;
  177. color: #999999;
  178. img {
  179. width: 600rpx;
  180. }
  181. }
  182. }
  183. </style>