record.vue 4.9 KB

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