record.vue 4.9 KB

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