Преглед на файлове

车队长界面--修改发车时间时和扫码时间段进行联动

xiaoxin преди 3 години
родител
ревизия
eb0b2d008c

+ 20 - 1
pages/detail/detail.vue

@@ -137,7 +137,7 @@ import { myRequest } from '@/util/api.js'
 
 import { isWeixin } from '@/util/isWeixin.js'
 
-import { time_to_sec } from '@/util/formatTime.js'
+import { time_to_sec, time_change } from '@/util/formatTime.js'
 
 onLoad(options => {
 	if (isWeixin()) {
@@ -157,6 +157,8 @@ onLoad(options => {
 			getEndList()
 			// 获取车牌号列表
 			getBusList()
+			// 获取发车时间提前推迟多少分钟可以扫码数据
+			getTimeConfig()
 			// 处理车牌号数据
 			form.value.selectValue = info.value.car_number
 
@@ -201,6 +203,11 @@ const endList = ref([])
 // 人员列表数组
 const listData = ref([])
 
+// 发车时间提前多少分钟可以扫码
+const time_early = ref(null)
+// 发车时间推迟多少分钟可以扫码
+const time_late = ref(null)
+
 // 获取路线数组请求
 const getPathList = async () => {
 	const res = await myRequest({
@@ -403,6 +410,16 @@ const getBusContain = async () => {
 	info.value.contain = res.data
 }
 
+// 获取发车时间提前推迟多少分钟可以扫码数据
+const getTimeConfig = async () => {
+	const res = await myRequest({
+		url: '/cnqueryHb.action'
+	})
+	// console.log(res)
+	time_early.value = res.sm_end
+	time_late.value = res.sm_start
+}
+
 // 下拉框选择时的回调
 const changeMultiple = e => {
 	// console.log(e);
@@ -412,6 +429,8 @@ const changeMultiple = e => {
 const bindPickerChange = (e, type) => {
 	if (type == 1) {
 		info.value.ci_time = e.detail.value
+		info.value.sm_start = time_change(info.value.ci_time, time_early.value * -1)
+		info.value.sm_end = time_change(info.value.ci_time, time_late.value)
 	} else if (type == 2) {
 		info.value.route = pathList.value[e.detail.value].route
 		getEndList()

Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
unpackage/dist/build/h5/assets/detail-08f67212.css


Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
unpackage/dist/build/h5/assets/index-a310a07f.js


Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
unpackage/dist/build/h5/assets/isWeixin.b617f143.js


Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
unpackage/dist/build/h5/assets/pages-404-404.6a06ab8b.js


Файловите разлики са ограничени, защото са твърде много
+ 1 - 0
unpackage/dist/build/h5/assets/pages-detail-detail.32ef1271.js


Файловите разлики са ограничени, защото са твърде много
+ 0 - 1
unpackage/dist/build/h5/assets/pages-detail-detail.eb952d3b.js


Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
unpackage/dist/build/h5/assets/pages-home-home.00dc6ba9.js


Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
unpackage/dist/build/h5/assets/pages-index-index.0cef2462.js


Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
unpackage/dist/build/h5/assets/pages-my-my.4e3eae8e.js


Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
unpackage/dist/build/h5/assets/pages-record-record.eb18d989.js


Файловите разлики са ограничени, защото са твърде много
+ 1 - 1
unpackage/dist/build/h5/assets/search.30c21309.js


+ 1 - 1
unpackage/dist/build/h5/assets/uni-app.es.9a125e9b.js

@@ -1 +1 @@
-import{a6 as a,a7 as s,a8 as o,a9 as r,aa as n,ab as t,ac as c,ad as e}from"./index-a310a07f.js";function i(a,s){return c(a)?s:a}const b=o=>(r,n=s())=>{!e&&a(o,r,n)},d=b(o),f=b(r),m=b(n),p=b(t);export{d as a,p as b,m as c,f as o,i as r};
+import{a6 as a,a7 as s,a8 as o,a9 as r,aa as n,ab as t,ac as c,ad as e}from"./index-4fa572a1.js";function i(a,s){return c(a)?s:a}const b=o=>(r,n=s())=>{!e&&a(o,r,n)},d=b(o),f=b(r),m=b(n),p=b(t);export{d as a,p as b,m as c,f as o,i as r};

+ 1 - 1
unpackage/dist/build/h5/index.html

@@ -14,7 +14,7 @@
     <title>校车预约</title>
     <!--preload-links-->
     <!--app-context-->
-    <script type="module" crossorigin src="/carstop/dist5/assets/index-a310a07f.js"></script>
+    <script type="module" crossorigin src="/carstop/dist5/assets/index-4fa572a1.js"></script>
     <link rel="stylesheet" href="/carstop/dist5/assets/index-88c6c4d6.css">
   </head>
   <body>

+ 23 - 0
util/formatTime.js

@@ -1,3 +1,4 @@
+// 比较时间的大小 (HH:MM格式)
 export const time_to_sec = (time) => {
 	if (time) {
 		let s = ''
@@ -5,5 +6,27 @@ export const time_to_sec = (time) => {
 		let min = time.split(':')[1]
 		s = Number(hour * 3600) + Number(min * 60)
 		return s
+	} else {
+		return 0
+	}
+}
+
+// 当前时间加上或者减去传入的时间(value参数单位为分钟)
+export const time_change = (time, value) => {
+	if (time && value) {
+		if (typeof(value) !== 'number') {
+			return 0
+		}
+		let s = ''
+		let hour = time.split(':')[0]
+		let min = time.split(':')[1]
+		s = Number(hour * 3600) + Number(min * 60) + Number(value * 60)
+
+		let time_h = Math.floor(s / 3600).toString()
+		let time_m = (s % 3600 / 60).toString().padStart(2, 0)
+
+		return time_h + ':' + time_m
+	} else {
+		return 0
 	}
 }