Browse Source

no message

xiaoxin 1 year ago
parent
commit
ec36d22260
4 changed files with 34 additions and 9 deletions
  1. 7 1
      package-lock.json
  2. 2 1
      package.json
  3. 8 6
      pages/home/home.vue
  4. 17 1
      pages/my/my.vue

+ 7 - 1
package-lock.json

@@ -8,13 +8,19 @@
             "name": "下拉多选,完全仿照微信原生效果,简单美观可扩展",
             "version": "v1.1",
             "dependencies": {
-                "crypto-js": "^4.2.0"
+                "crypto-js": "^4.2.0",
+                "lodash": "^4.17.21"
             }
         },
         "node_modules/crypto-js": {
             "version": "4.2.0",
             "resolved": "https://registry.npmmirror.com/crypto-js/-/crypto-js-4.2.0.tgz",
             "integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q=="
+        },
+        "node_modules/lodash": {
+            "version": "4.17.21",
+            "resolved": "https://registry.npmmirror.com/lodash/-/lodash-4.17.21.tgz",
+            "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
         }
     }
 }

+ 2 - 1
package.json

@@ -18,6 +18,7 @@
         ]
     },
     "dependencies": {
-        "crypto-js": "^4.2.0"
+        "crypto-js": "^4.2.0",
+        "lodash": "^4.17.21"
     }
 }

+ 8 - 6
pages/home/home.vue

@@ -72,7 +72,7 @@
 					<view class="btn-info-time">{{ currentPath == '靖安-南昌' ? mxh_end : hjh_end }}</view>
 				</view>
 
-				<view class="btn-button" @click="handleSub">{{ status ? '立即预约' : '候补预约' }}</view>
+				<view class="btn-button" @click="handleSubDebounce">{{ status ? '立即预约' : '候补预约' }}</view>
 			</view>
 		</view>
 
@@ -80,7 +80,7 @@
 		<view class="box-info">
 			<view class="info-title">温馨提示</view>
 			<view class="info-detail">
-				预约截止时间为发车前{{ yy_end }}分钟,如当月爽约{{ black_count }}次,账号会被锁定,锁定后联系车队长解锁。车队长联系方式:
+				预约截止时间为发车前{{ yy_end }}分钟,车队长联系方式:
 				<span @click="handlePhone(13576937506)">13576937506</span>
 				,技术支持联系方式:
 				<span @click="handlePhone(`0791 - 82293574`)">0791-82293574</span>
@@ -92,14 +92,11 @@
 
 <script setup>
 import { ref, computed, watch } from 'vue'
-
 import { onLoad, onPullDownRefresh, onShow } from '@dcloudio/uni-app'
-
 import { myRequest } from '@/util/api.js'
-
 import { isWeixin } from '@/util/isWeixin.js'
-
 import { filterIdentity } from '@/util/filterIdentity.js'
+import debounce from 'lodash/debounce'
 
 onLoad(() => {
 	if (isWeixin()) {
@@ -237,6 +234,11 @@ const getOrderConfig = async () => {
 }
 
 // 立即预约按钮回调
+const handleSubDebounce = debounce(() => {
+	handleSub()
+}, 200)
+
+// 立即预约按钮回调
 const handleSub = () => {
 	if (status.value) {
 		if (!currentPath.value) {

+ 17 - 1
pages/my/my.vue

@@ -55,7 +55,7 @@
 				<!-- <view class="list-button-change" v-if="item.state ===1" @click="handleChange">
 					更换车次
 				</view> -->
-				<view class="list-button-change" v-if="item.state === 1 && item.is_device == ''" @click="handleOnCar(item.id)">我已上车</view>
+				<view class="list-button-change" v-if="item.state === 1 && item.is_device == '' && item.isShow" @click="handleOnCar(item.id)">我已上车</view>
 				<view class="list-button-cancel" v-if="item.state === 1 || item.state === 3" @click="handleCancel(item.id)">取消预约</view>
 			</view>
 		</view>
@@ -208,6 +208,22 @@ const getMyData = async () => {
 	// console.log(result)
 
 	total.value = result.totalCount
+
+	// 处理数据
+	result.list.forEach((ele) => {
+		let strArr = ele.yy_date.split(' ')
+		// console.log(strArr)
+		let timeArr = ele.sm_time.split('-')
+		// console.log(timeArr)
+		let start = Date.parse(strArr[0] + ' ' + timeArr[0] + ':00')
+		let end = Date.parse(strArr[0] + ' ' + timeArr[1] + ':00')
+		let nowTime = Date.now()
+		if (start < nowTime && nowTime < end) {
+			ele.isShow = true
+		} else {
+			ele.isShow = false
+		}
+	})
 	listData.value = [...listData.value, ...result.list]
 }