recordDriver.vue 5.6 KB

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