queueList.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <template>
  2. <view class="customer-list">
  3. <view class="list-wrap">
  4. <u-sticky bgColor="#fff" class="main-sticky">
  5. <view class="search-wrap">
  6. <view class="input-wrap">
  7. <view @click="showPopup('popupTenant')" class="input">
  8. <u--input prefixIcon="account-fill" readonly placeholder="$t('queue.pleaseSelectTenant')"
  9. :prefixIconStyle="{fontSize:'46rpx',color:'#c8d8ef'}" border="none"
  10. v-model="form.tenantName" placeholderStyle="color:'#c8d8ef'" color="#666"
  11. :showAction='false'></u--input>
  12. </view>
  13. </view>
  14. </view>
  15. </u-sticky>
  16. <template v-if="queueList.length">
  17. <view class="business-card" v-for="(item, index) in queueList" :key="index">
  18. <view class="business-card-info">
  19. <view class="info-line">
  20. <text class="info"> {{item.vehicle}}</text>
  21. </view>
  22. <view class="businessStatus-info">
  23. <u--image width="100rpx" height="88rpx"
  24. :src="'/substaticpages/static/czzn-img/report-queueA.png'">
  25. </u--image>
  26. </view>
  27. <span class="status" v-show="item.queueStatus == '0'">{{$t('queue.queuing')}}</span>
  28. <span class="status" v-show="item.queueStatus == '1'">{{$t('queue.entrucking')}}</span>
  29. </view>
  30. <view class="business-card-roadinfo">
  31. <span><span class="roadinfo-label">{{ $t('queue.currentQueuePosition') }} : </span>{{item.number}}</span>
  32. <!-- <span><span class="roadinfo-label">{{ $t('queue.status') }} : </span>{{item.queueStatusName}}</span> -->
  33. <span><span class="roadinfo-label">{{ $t('queue.road') }} : </span>{{item.roadName}}</span>
  34. </view>
  35. <!-- 渲染固定项 -->
  36. </view>
  37. <view class="fixed-item">
  38. <view class="business-card">
  39. <view class="business-card-info">
  40. <view class="info-line">
  41. <text class="info"> {{current.vehicle}}</text>
  42. </view>
  43. <view class="businessStatus-info">
  44. <u--image width="100rpx" height="88rpx"
  45. :src="'/substaticpages/static/czzn-img/report-queueA.png'">
  46. </u--image>
  47. </view>
  48. </view>
  49. <view class="business-card-roadinfo">
  50. <span><span class="roadinfo-label">{{ $t('queue.currentQueuePosition') }} : </span> {{current.number}}</span>
  51. <span><span class="roadinfo-label">{{ $t('queue.status') }} : </span>{{current.queueStatusName}}</span>
  52. <span><span class="roadinfo-label">{{ $t('queue.road') }} : </span>{{current.roadName}}</span>
  53. </view>
  54. </view>
  55. </view>
  56. </template>
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. import {
  62. getTenantCacheList
  63. } from '../../../utils/util.js'
  64. import {
  65. getQueueListByVehicle
  66. } from '../../../api/driver'
  67. export default {
  68. data() {
  69. return {
  70. options: [{
  71. text: this.$t("base.button.delete"),
  72. name: "delete",
  73. style: {
  74. backgroundColor: '#f56c6c'
  75. }
  76. }, ],
  77. keyword: '',
  78. active: 0,
  79. value: '',
  80. queueList: [],
  81. topheight: 0,
  82. interval: null, // 定时器
  83. current: {},
  84. form: {
  85. tenantId: "",
  86. tenantName: ""
  87. }
  88. }
  89. },
  90. components: {},
  91. onLoad() {
  92. this.bindTenant()
  93. this.refreshPage()
  94. },
  95. onShow() {
  96. // 当页面显示时设置定时器
  97. this.interval = setInterval(() => {
  98. console.log('刷新数据');
  99. // 执行页面刷新的逻辑
  100. this.refreshPage();
  101. }, 30000); // 30秒
  102. },
  103. onUnload() {
  104. // 清除定时器,当页面卸载时
  105. if (this.interval) {
  106. clearInterval(this.interval);
  107. this.interval = null;
  108. }
  109. },
  110. onHide() {
  111. // 当页面隐藏时清除定时器
  112. if (this.interval) {
  113. clearInterval(this.interval);
  114. this.interval = null;
  115. }
  116. },
  117. methods: {
  118. //显示选择
  119. showPopup(refs) {
  120. this.$refs[refs].showPicker = true
  121. },
  122. //选择企业
  123. onTenantConfirm(value) {
  124. this.form.tenantId = ''
  125. this.form.tenantName = ''
  126. if (value.value) {
  127. this.form.tenantId = value.value
  128. this.form.tenantName = value.text
  129. }
  130. uni.setStorageSync("currentTenantId", value);
  131. this.bindOrderList()
  132. },
  133. onBindVehicle(item) {
  134. bindVehicle(item).then(res => {
  135. if (res.statusCode == 200) {
  136. this.onGetVheicleList();
  137. }
  138. })
  139. },
  140. refreshPage() {
  141. // 这里编写页面刷新的具体逻辑
  142. let data = uni.getStorageSync("currentVehicleInfo")
  143. let tenantOption = getTenantCacheList();
  144. data.tenantId = tenantOption[0].value
  145. getQueueListByVehicle(data).then(res => {
  146. if (res.statusCode == 200) {
  147. console.log('获取到的排队信息:', res.data.data);
  148. if (res.data.code == "0") {
  149. let data = res.data.data.data
  150. this.queueList = data.queueList
  151. this.current = data.current
  152. console.log('获取到的排队信息:', data);
  153. }
  154. }else{
  155. this.queueList = []
  156. this.current = []
  157. }
  158. })
  159. },
  160. //获取企业选项
  161. bindTenant() {
  162. let tenantOption = getTenantCacheList();
  163. this.form.tenantId = tenantOption[0].value
  164. this.form.tenantName = tenantOption[0].text
  165. },
  166. //适配状态栏高度
  167. getTopHeight() {
  168. console.log('123');
  169. let that = this;
  170. uni.getSystemInfo({
  171. success: function(e) {
  172. //48为自定义导航栏高度,一般为44
  173. let topPx = e.statusBarHeight + 44 // 顶部状态栏+沉浸式自定义顶部导航
  174. that.topheight = topPx // px转rpx,这里必须转化为rpx,不然适配失败
  175. },
  176. });
  177. },
  178. onGetVheicleList() {
  179. let data = {
  180. keyword: this.keyword || '',
  181. }
  182. getVehicleListByCondition(data).then(res => {
  183. if (res.statusCode == 200) {
  184. this.vehicleList = res.data.data
  185. if (this.vehicleList) {
  186. if (this.vehicleList.length == 1) {
  187. uni.setStorageSync("currentVehicleInfo", this.vehicleList[0]);
  188. } else {
  189. var vehicleInfo = this.vehicleList.filter(p => {
  190. return p.runFlag == 1
  191. });
  192. if (vehicleInfo) {
  193. uni.setStorageSync("currentVehicleInfo", vehicleInfo[0]);
  194. }
  195. }
  196. }
  197. }
  198. })
  199. },
  200. changeTab(item) {
  201. this.active = item.index
  202. },
  203. }
  204. }
  205. </script>
  206. <style>
  207. /* #ifndef H5 */
  208. page {
  209. /* height: 100%; */
  210. background-color: #f2f2f2;
  211. }
  212. /* #endif */
  213. .container {
  214. display: flex;
  215. flex-direction: column;
  216. height: 100%;
  217. }
  218. .list-container {
  219. flex: 1;
  220. /* 使列表占据剩余空间 */
  221. overflow-y: auto;
  222. /* 如果列表很长,需要滚动 */
  223. }
  224. .fixed-item {
  225. /* 固定在底部的样式 */
  226. width: 100%;
  227. position: fixed;
  228. bottom: 0;
  229. z-index: 10;
  230. background-color: #fff;
  231. /* 根据需要添加其他样式,比如背景色、边框等 */
  232. }
  233. </style>
  234. <style lang="scss" scoped>
  235. @import "../../../common/css/public.scss";
  236. .business-card {
  237. margin: 24rpx;
  238. .status{
  239. position: absolute;
  240. top: 0;
  241. right: 0;
  242. background: #3275F5;
  243. width: 200rpx;
  244. text-align: center;
  245. line-height: 42rpx;
  246. height: 42rpx;
  247. color: #FEFEFE;
  248. transform: rotate(45deg) translate3d(62rpx, -20rpx, 0);
  249. font-size: 24rpx;
  250. font-weight: normal;
  251. }
  252. }
  253. .list-wrap {
  254. padding-bottom: 228rpx;
  255. }
  256. .fixed-item .business-card {
  257. background-color: #e9f1ff;
  258. }
  259. .business-card-info {
  260. position: relative;
  261. border-bottom: 2rpx solid #e9f1ff;
  262. padding: 16rpx 16rpx 16rpx 32rpx !important;
  263. }
  264. .business-card-roadinfo {
  265. display: flex;
  266. justify-content: space-between;
  267. font-size: 24rpx;
  268. color: #222;
  269. padding: 24rpx 24rpx 24rpx 32rpx;
  270. .roadinfo-label {
  271. color: #aaaaaa;
  272. margin-right: 8rpx;
  273. }
  274. }
  275. .fixed-item .business-card-roadinfo {
  276. padding: 0 24rpx 24rpx 32rpx;
  277. }
  278. </style>