record.vue 5.2 KB

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