recordDriver.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. <template>
  2. <view class="container">
  3. <!-- 筛选区域 -->
  4. <Search :typeList="typeList" :timeList="busList" @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. getBusList()
  62. getData()
  63. } else {
  64. uni.redirectTo({
  65. url: '/pages/404/404?message=请在微信客户端打开链接'
  66. })
  67. }
  68. })
  69. onPullDownRefresh(() => {
  70. getBusList()
  71. getData()
  72. setTimeout(function() {
  73. uni.stopPullDownRefresh()
  74. }, 500)
  75. })
  76. // 预约状态 全部:0 预约进行中:1 已截止:2 已分配:3 候补中:4
  77. const result_state = ref(0)
  78. // 预约状态数组
  79. const typeList = ref([
  80. {
  81. text: '全部',
  82. value: 0
  83. },
  84. {
  85. text: '预约进行中',
  86. value: 1
  87. },
  88. {
  89. text: '已截止',
  90. value: 2
  91. },
  92. {
  93. text: '已分配',
  94. value: 3
  95. },
  96. {
  97. text: '候补中',
  98. value: 4
  99. }
  100. ])
  101. // 当前选择车牌号 默认为全部
  102. const busNumber = ref('全部')
  103. // 车牌列表数据
  104. const busList = ref([
  105. {
  106. text: '全部',
  107. value: 0
  108. }
  109. ])
  110. // 预约记录数据
  111. const listData = ref([])
  112. // 获取预约记录数据
  113. const getData = async () => {
  114. const res = await myRequest({
  115. url: '/appcarCaptainManage.action',
  116. data: {
  117. result_state: result_state.value,
  118. car_number: busNumber.value
  119. }
  120. })
  121. // console.log(res.data)
  122. if (res.data.length) {
  123. res.data.forEach(item => {
  124. item.percent = Math.ceil((parseInt(item.user_num) / parseInt(item.contain)) * 100)
  125. })
  126. }
  127. listData.value = res.data
  128. }
  129. // 获取车牌号数组请求
  130. const getBusList = async () => {
  131. const res = await myRequest({
  132. url: '/appqueryCarInfos.action'
  133. })
  134. // console.log(res)
  135. if (res.data.length) {
  136. let temList = [
  137. {
  138. text: '全部',
  139. value: 0
  140. }
  141. ]
  142. res.data.forEach((item, index) => {
  143. temList.push({
  144. text: item.car_number,
  145. value: index + 1
  146. })
  147. })
  148. busList.value = temList
  149. }
  150. }
  151. // 点击每一条记录回调
  152. const handleLookDetail = item => {
  153. const info = JSON.stringify(item)
  154. uni.navigateTo({
  155. url: `/pages/detailDriver/detailDriver?info=${info}`
  156. })
  157. }
  158. // 条件筛选框选择回调
  159. const getConveyData = Obj => {
  160. // console.log(Obj)
  161. result_state.value = Obj.typeIndex
  162. busNumber.value = busList.value[Obj.timeIndex].text
  163. getData()
  164. }
  165. </script>
  166. <style lang="scss" scoped>
  167. .container {
  168. background-color: #f2f2f2;
  169. .list {
  170. margin-bottom: 20rpx;
  171. padding-bottom: 24rpx;
  172. background-color: #fff;
  173. .list-title {
  174. display: flex;
  175. justify-content: space-between;
  176. align-items: center;
  177. padding: 0 30rpx;
  178. margin-bottom: 20rpx;
  179. height: 94rpx;
  180. font-size: 32rpx;
  181. font-weight: bold;
  182. border-bottom: 1rpx solid #e6e6e6;
  183. .title-icon {
  184. margin-top: -20rpx;
  185. width: 15rpx;
  186. height: 25rpx;
  187. img {
  188. width: 100%;
  189. height: 100%;
  190. }
  191. }
  192. }
  193. .list-item {
  194. display: flex;
  195. align-items: center;
  196. padding: 0 30rpx;
  197. margin-bottom: 14rpx;
  198. color: #999999;
  199. font-size: 28rpx;
  200. span {
  201. color: #333333;
  202. }
  203. .list-item-type {
  204. color: #3d51e8;
  205. }
  206. .list-item-progress {
  207. margin-right: 36rpx;
  208. width: 437rpx;
  209. height: 22rpx;
  210. :deep(.uni-progress-bar),
  211. :deep(.uni-progress-inner-bar) {
  212. border-radius: 85rpx;
  213. }
  214. }
  215. }
  216. }
  217. .list-nodata {
  218. margin-top: -20rpx;
  219. padding-top: 100rpx;
  220. background-color: #fff;
  221. text-align: center;
  222. color: #999999;
  223. img {
  224. width: 600rpx;
  225. }
  226. }
  227. }
  228. </style>