1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908
| <template> <view v-if="innerVisible"> <u-popup :show="show" v-if="show" overlay round="10" closeOnClickOverlay :safeAreaInsetBottom="false" @close="closePopup" mode="center"> <view class="check-container"> <view class="check-box"> <image class="icon" v-if="check.show_error" src="/static/pages_tools/gps-error.svg"> </image> <image class="icon" v-else src="/static/pages_tools/gps-success.svg"> </image> <view class="info" v-if="check.type_name" :class="check.show_error ? 'error' : ''">{{ check.type_name }} </view> <view class="address">{{ check_placeName }}</view> </view>
<view class="time">{{ currentTime }}</view> <view class="btn submit-btn flex justify-center items-center" @tap.stop="submit"> <text>{{ check.show_error ? '确认' : '' }}打卡</text> </view> <view class="btn cancel flex justify-center items-center" @tap.stop="cancel"><text>取消</text></view> </view> </u-popup>
<pp-outdoor v-if="showOutdoor" :latAndLon="latAndLon" :visible.sync="showOutdoor" @outdoorCheck="outdoorCheck" @close="closeOutdoor"></pp-outdoor>
<pp-success :visible.sync="showSuccess" :data="success" @closeSuccess="closeSuccess" />
<conflict v-if="showConflict" :visible.sync="showConflict" :data="conflict" from="打卡" @cancel="closeConflict" @submit="cancelSubmit" />
<u-modal :show="showManage" width="500rpx" @confirm="addGroup('add')" @cancel="cancelAddGroup" ref="noManageModal" confirmText="前往设置" :showCancelButton="true"> <view class="slot-content"> <text class="info">请先设置考勤规则</text> </view> </u-modal>
<u-modal :show.sync="showGroup" width="500rpx" @confirm="addGroup()" @cancel="cancelAddGroup" ref="noGroupModal" confirmText="确定" cancelText="取消" confirmColor="#4C8AFC" showCancelButton="true" :safeAreaInsetBottom="false" :asyncClose="true"> <view class="slot-content"> 是否将自己加入考勤组? </view> </u-modal> </view> </template> <script> import { checkAuditTime, isDuringDate } from '@/utils/index'; import outdoor from './outdoor-popup'; import successPopup from './success-popup'; import conflict from '../approve-conflict-modal'; import Big from 'big.js'; import dayjs from 'dayjs'; import isBetween from 'dayjs/plugin/isBetween'; dayjs.extend(isBetween); import attendanceApi from '@/api/attendance'; const app = getApp(); export default { props: { visible: { type: Boolean, default: false, }, latAndLon: { type: Object, default: () => ({}), }, placeName: { type: String, default: '', }, }, components: { 'pp-outdoor': outdoor, 'pp-success': successPopup, conflict, }, computed: { innerVisible: { get() { return this.visible; }, set(v) { this.$emit('update:visible', v); }, }, }, data() { return { intervalTimer: null, showOutdoor: false, attendance: { placeList: [], //打卡地址 timeList: [], //上下班时间 },
success: {}, showSuccess: false, showGroup: false, // 考勤组弹窗
show: false, // 打卡弹窗 check: {}, // 打卡信息 check_placeName: '', // 打卡地址 currentTime: dayjs().format('HH:mm:ss'),
history: [], // 当天当前用户的全部考勤记录 workRules: '', // 当天当前用户的考勤规则 isAdmin: Vue.prototype.$storage ._getStorage('userinfo') .userAuthorizationList.filter( (a) => a.userAuthority == '100101' || a.userAuthority == '100108', ).length > 0, // 管理员权限、考勤权限 showManage: false, // 没有考勤组
showConflict: false, // 请假有冲突 conflict: {}, // 冲突信息
inside_arr: [], // 考勤时间内 during_arr: [], // 休息时间 outside_work: {}, // 考勤时间外,上班 outside_off: {}, // 考勤时间外,下班 }; }, mounted() { let _this = this; setInterval(() => { _this.currentTime = dayjs().format('HH:mm:ss'); }, 1000); }, watch: { show(val) { if (val) { this.handleCheckType(); this.intervalTimer = setInterval(this.handleCheckType, 1000); app.globalData.scrollLock = true; } }, showOutdoor(val) { app.globalData.scrollLock = val; }, showManage(val) { app.globalData.scrollLock = val; }, showGroup(val) { app.globalData.scrollLock = val; }, showSuccess(val) { app.globalData.scrollLock = val; }, }, created() { this.getUserCheckList(); this.getUserAttendanceGroupDetails(); }, methods: { //查询用户当天的打卡记录 getUserCheckList() { let params = { userId: app.globalData.userId, employeeNo: app.globalData.employeeNo, enterpriseId: app.globalData.enterpriseId, date: dayjs(new Date()).format('YYYY-MM-DD'), // 今天 }; attendanceApi .getOneDayAttendanceByUserId(params) .then((res) => { if (res && res.data && res.data.clockRecord) { this.history = res.data.clockRecord; // 当日打卡历史 } }) .catch((errors) => { uni.$u.toast(errors.msg || '获取打卡出了问题,请稍后再试'); }) .finally(() => { uni.hideLoading(); }); }, // 获取当前用户考勤组详情 getUserAttendanceGroupDetails() { let params = { userId: app.globalData.userId, employeeNo: app.globalData.employeeNo, enterpriseId: app.globalData.enterpriseId, hideLoadingTitle: true, // 隐藏请求动画 }; attendanceApi .getUserAttendanceGroupDetails(params) .then((res) => { if (res.data) { this.attendance = res.data; // 考勤组信息 this.workRules = this.handleCheckRules(); // 当天的考勤规则 // 判断当天是否有考勤规则 if (this.workRules) { this.calType(this.workRules.shift.shiftTimeList); this.formatAttance(); } else { // 没有考勤规则,属于非工作日 // 有打卡记录,属于下班,否则上班 this.check_placeName = this.placeName; this.history.length ? this.handleCheckStatus('offduty') : this.handleCheckStatus(0); this.show = true; } } else { // 是管理员 if (this.isAdmin) { this.getGroupList(); } else { // this.$showToast('您尚未加入考勤组,无需打卡'); // this.$emit('handleBottomBtnShow'); // 普通员工 - 没有考勤组 - 隐藏底部长按按钮 uni.showModal({ content: '您尚未加入考勤组,无需打卡', showCancel: false, confirmText: '我知道了', success: (res) => { if (res.confirm) { this.innerVisible = false; } }, }); } } }) .catch((errors) => { uni.$u.toast(errors.msg || '获取用户考勤组详情出了问题,请稍后再试'); }) .finally(() => { uni.hideLoading(); }); },
// 获取考勤组列表 getGroupList() { let params = { enterpriseId: app.globalData.enterpriseId, hideLoadingTitle: true, // 隐藏请求动画 }; attendanceApi .getAttendanceGroup(params) .then((res) => { // 展示新增考勤组弹窗 if (res.data && res.data.records && res.data.records.length) { this.showGroup = true; // 提示加入考勤组 } else { this.showManage = true; // 提示设置考勤规则 } }) .catch((err) => { this.$showToast('获取考勤组失败'); }); },
// 当前星期几,拿到设定的对应打卡规则 handleCheckRules() { let res = ''; let timeArr = this.attendance.timeList; let currentWeek = dayjs().day(); currentWeek == 0 ? (currentWeek = 7) : ''; // 强制转换周日由0变7 if (timeArr && timeArr.length) { timeArr.map((t) => { if (t.clockWeek.includes(currentWeek)) { res = t; // 当天的考勤规则 } }); } return res; },
// 判断是否在打卡范围内 formatAttance() { let placeArr = this.attendance.placeList; placeArr.map((p) => { p.latitude = p.dimension; // 计算当前位置经纬度 和所在考勤组的地址经纬度 直线距离 <=设置的距离 let num = this.getMapDistance( p.latitude, p.longitude, this.latAndLon.latitude, this.latAndLon.longitude, ); p.distance = new Big(num).times(1000).toString(); // 距离,单位米 p.atPlace = p.distance <= p.range; // 是否在打卡范围 }); // 取最近的打卡地址 let data = placeArr.filter((item) => item.atPlace); if (data && data.length) { this.check_placeName = data[0].placeName; // 获取打卡地址名 // 正常打卡,计算上下班 // todo setTimeout(() => { this.show = true; }, 600); } else { this.showOutdoor = true; // 外勤打卡 } },
//拿到打卡时间,判断打卡类型 // 把一天分为多个打卡时间段 // 判断是否处在这个时间段里 handleCheckType() { if (this.workRules) { let time = this.workRules.shift.shiftTimeList; let arr = []; time.map((t) => { arr.push({ startTime: t.workTime, endtTime: t.knockOffTime, }); }); // 只有一条考勤规则 if (time.length == 1) { let unselect = this.unselectTime(arr); let before = checkAuditTime( unselect[0].startTime, unselect[0].endtTime, ); let during = checkAuditTime(arr[0].startTime, arr[0].endtTime); let after = checkAuditTime(unselect[1].endtTime, '24:00'); // 正常上班 if (before) { this.handleCheckStatus(0); } // 正常下班 if (after) { this.handleCheckStatus('offduty'); } // 考勤时间内 if (during) { // 有打卡记录,属于早退,否则迟到 if (this.history.length) { this.handleCheckStatus(4); } else { this.handleCheckStatus(1); } } } // 多条考勤规则 if (time.length > 1) { let inside_arr = this.inside_arr; // 考勤时间内 let during_arr = this.during_arr; // 休息时间 let outside_work = this.outside_work; // 考勤时间外,上班 let outside_off = this.outside_off; // 考勤时间外,下班 // 开始判断考勤时间段 if ( this.checkAuditSeocnd(outside_work.workTime, outside_work.knockOffTime) ) { this.handleCheckStatus(0); // 正常上班 return; } if (this.checkAuditSeocnd(outside_off.workTime, outside_off.knockOffTime)) { this.handleCheckStatus('offduty'); // 正常下班 return; } // 在正常的考勤时间段内 for (var i = 0; i < inside_arr.length; i++) { let s = inside_arr[i]; if (this.checkAuditSeocnd(s.workTime, s.knockOffTime)) { if (this.history.length) { this.handleCheckStatus(4); // 早退 } else { this.handleCheckStatus(1); // 迟到 } return; } } // 在午休范围内 for (var j = 0; j < during_arr.length; j++) { let d = during_arr[j]; let lastest = ''; // 最新打卡记录的打卡时间 let lastest_type = ''; // 最新打卡记录的打卡类型 if (this.history && this.history.length) { lastest = this.history[this.history.length - 1].createTime; lastest_type = this.history[this.history.length - 1].type; } if (this.checkAuditSeocnd(d.workTime, d.knockOffTime)) { let today = dayjs(new Date()).format('YYYY/MM/DD'); let w = today + ' ' + d.workTime; let k = today + ' ' + d.knockOffTime; if (lastest) { // 今天打过卡 console.log( '在午休范围内,最新打卡记录:' + lastest, '午休时间:' + w + '至' + k, ); let history = dayjs(lastest).format('YYYY/MM/DD HH:mm:ss'); // 最新一条打卡记录 if (isDuringDate(w, k, history)) { // 在午休时间段内,则本次展示上班 this.handleCheckStatus(0); // 上班 } else if (lastest_type == 4) { // 不在午休时间段内,最新的打卡记录是早退,则本次展示上班 this.handleCheckStatus(0); // 上班 } else { // 不在午休时间段内,则本次展示下班 this.handleCheckStatus('offduty'); // 下班 } return; } else { // 今天没有打过卡 this.handleCheckStatus('offduty'); // 下班 return; } } } this.handleCheckStatus(''); } } },
// 当前时间处于什么打卡类型 calType(format_time) { let lastest = ''; // 最新的一条打卡时间 if (this.history && this.history.length) { lastest = this.history[this.history.length - 1].createTime; } let today = dayjs(new Date()).format('YYYY/MM/DD'); // 当天 let inside_arr = []; // 考勤时间内 let during_arr = []; // 休息时间 let outside_work = {}; // 考勤时间外,上班 let outside_off = {}; // 考勤时间外,下班
// 考勤时间段数组排序 format_time.map((d) => { d.sort_workTime = today + ' ' + d.workTime; d.sort_knockOffTime = today + ' ' + d.knockOffTime; // 解决iOS无法识别 yyyy-mm-dd格式的时间转换为时间戳在苹果手机上为NaN d.new_date_workTime = new Date( d.sort_workTime.replace(/-/g, '/'), ).getTime(); d.new_date_knockOffTime = new Date( d.sort_knockOffTime.replace(/-/g, '/'), ).getTime(); }); format_time.sort((a, b) => { return ( new Date(a.sort_workTime).getTime() - new Date(b.sort_workTime).getTime() ); }); format_time.map((t, index) => { inside_arr.push({ workTime: t.workTime + ':01', knockOffTime: dayjs(t.new_date_knockOffTime - 60000).format('HH:mm') + ':59', // - 1分钟 }); if (format_time[index + 1] && format_time[index + 1].sort_workTime) { during_arr.push({ workTime: t.knockOffTime + ':00', knockOffTime: format_time[index + 1].workTime + ':00', }); } // 考勤时间前 if (index == 0) { outside_work = { workTime: '00:00:00', knockOffTime: t.workTime + ':00', }; } // 考勤时间后 if (index == format_time.length - 1) { outside_off = { workTime: t.knockOffTime + ':00', knockOffTime: '23:59:59', }; } }); this.inside_arr = inside_arr; // 考勤时间内 this.during_arr = during_arr; // 休息时间 this.outside_work = outside_work; // 考勤时间外,上班 this.outside_off = outside_off; // 考勤时间外,下班 console.log('考勤时间段数组:', format_time); console.log('考勤时间外,上班:', outside_work); console.log('考勤时间外,下班:', outside_off); console.log('考勤时间内:', inside_arr); console.log('休息时间:', during_arr); },
// 打卡弹窗 //0 正常打卡 1 迟到打卡 2外勤打卡 3缺卡打卡 4 早退打卡 5没加入打卡 6请假 7 出差 8加班 10 旷工 // 5表示为加入 比如今天加入如考勤 昨天的记录就是5 handleCheckStatus(type) { console.log('打卡类型:', type); let type_name = ''; let show_error = false; switch (type) { case 0: type_name = '上班·打卡正常'; break; case 'offduty': type_name = '下班·打卡正常'; break; case 1: type_name = '上班·你迟到了'; show_error = true; break; case 4: type_name = '下班·你早退了'; show_error = true; break; default: type_name = ''; break; } this.check = { placeName: this.check_placeName ? this.check_placeName : this.placeName, // 非外勤打卡,展示的打卡地址取考勤组保存的地址 latitude: this.latAndLon.latitude, longitude: this.latAndLon.longitude, dimension: this.latAndLon.latitude, type, // 1迟到4早退 type_name, show_error, }; },
// 确认打卡 submit() { this.show = false; let params = { enterpriseId: app.globalData.enterpriseId, userId: app.globalData.userId, employeeNo: app.globalData.employeeNo, ...this.check, }; delete params.type; console.log(params, '打卡postdata'); attendanceApi .saveAttendanceData(params) .then((res) => { if (res.extra && res.extra.extraCode) { // 销毁定时器 clearInterval(this.intervalTimer); app.globalData.scrollLock = false; // 打卡有冲突 this.conflict = { ...res.data, extraCode: res.extra.extraCode, }; this.showConflict = true; } else { // 如果今天没有打过卡 if (!this.history || !this.history.length) { this.getClockType() } this.success = res.data; this.showSuccess = true; } }) .catch((errors) => { uni.$u.toast(errors.msg || '打卡出错,请稍后再试'); }) .finally(() => { uni.hideLoading(); }); },
// 储存用户行动轨迹 getClockType() { let ln = this.$storage._getStorage('latAndLon') let params = { enterpriseId: app.globalData.enterpriseId, userId: app.globalData.userId, employeeNo: app.globalData.employeeNo, longitude: ln.longitude, dimension: ln.latitude, placeName: this.$storage._getStorage('placeName'), hideLoadingTitle: true // 隐藏请求动画 }; attendanceApi.attendanceGetClockType(params).then((res) => { }) },
// 外勤打卡成功后,展示打卡成功弹窗 outdoorCheck(params) { this.showOutdoor = false; console.log(params, '外勤打卡postdata'); attendanceApi.saveAttendanceData(params).then((res) => { if (res.extra && res.extra.extraCode) { // 销毁定时器 clearInterval(this.intervalTimer); app.globalData.scrollLock = false; // 打卡有冲突 this.conflict = { ...res.data, extraCode: res.extra.extraCode, }; this.showConflict = true; } else { // 如果今天没有打过卡 if (!this.history || !this.history.length) { this.getClockType() } this.success = res.data; this.showSuccess = true; } }); },
// 关闭打卡成功的弹窗 closeSuccess() { this.$emit('after'); // 打卡成功后的回调 this.showSuccess = false; this.innerVisible = false; }, // 加入考勤组 addGroup(query) { let url = '/pages_tools/manage/index'; if (query) { url = url + '?from=' + query; } uni.redirectTo({ url, }); },
// 取消打卡 cancel() { this.show = false; this.innerVisible = false; }, // 取消跳转新增考勤组 cancelAddGroup() { this.showManage = false; this.showGroup = false; this.innerVisible = false; },
closeOutdoor() { this.showOutdoor = false; this.innerVisible = false; },
closePopup() { this.innerVisible = false; app.globalData.scrollLock = false; },
// 有冲突,取消打卡 closeConflict() { this.showConflict = false; this.innerVisible = false; },
// 确认作废有冲突的记录 cancelSubmit() { this.showConflict = false; this.submit(); // 继续打卡 },
//经纬度转换成三角函数中度分表形式 Rad(d) { return (d * Math.PI) / 180.0; },
// 计算两点之间的距离 getMapDistance(lat1, lng1, lat2, lng2) { var radLat1 = this.Rad(lat1); var radLat2 = this.Rad(lat2); var a = radLat1 - radLat2; var b = this.Rad(lng1) - this.Rad(lng2); var s = 2 * Math.asin( Math.sqrt( Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2), ), ); s = s * 6378.137; // EARTH_RADIUS; s = Math.round(s * 10000) / 10000; // 输出为公里 return s; },
//入参 格式 unselectTime=[{ startTime:"1:00", endtTime:'3:00'}] //返回数据 [{ startTime:"00:00", endtTime:'1:00'},{ startTime:"3:00", endtTime:'00:00'}] //转化成分钟 toMinites(time) { let mins = null; let times = time.split(':'); mins = parseInt(times[0]) * 60 + parseInt(times[1]); return mins; },
toHHmmFormat(minutes) { let h = null; let m = null; if (minutes) { h = ('0' + parseInt(minutes / 60)).slice(-2); m = ('0' + (minutes % 60)).slice(-2); } return [h, m].join(':'); }, formateTime(selectedTime) { let newSelectTime = [...selectedTime]; selectedTime.forEach((item, index) => { if ( this.toMinites(item.startTime) > this.toMinites(item.endtTime) && this.toMinites(item.endtTime) != 0 ) { newSelectTime.splice(index, 1); newSelectTime.push({ startTime: item.startTime, endtTime: '00:00', }); newSelectTime.push({ startTime: '00:00', endtTime: item.endtTime, }); } }); console.log(newSelectTime, 'newSelectTime'); return newSelectTime; }, unselectTime(selectedTime) { let arr = [...selectedTime]; let newSelectTime = this.formateTime(arr); let timeArr = []; let unselectTime = []; if (newSelectTime && newSelectTime.length) { for (let i = 0; i < newSelectTime.length; i++) { if ( this.toMinites(newSelectTime[i].startTime) == this.toMinites(newSelectTime[i].endtTime) ) { return unselectTime; } timeArr.push([ this.toMinites(newSelectTime[i].startTime), this.toMinites(newSelectTime[i].endtTime), ]); } }
timeArr.sort((a, b) => { return a[0] - b[0]; }); if (timeArr.length) { if (timeArr[0][0] !== 0) { unselectTime.unshift({ startTime: '00:00', endtTime: this.toHHmmFormat(timeArr[0][0]), }); } for (let i = 0; i < timeArr.length; i++) { if (i + 1 > timeArr.length - 1) { continue; } if (timeArr[i][1] == timeArr[i + 1][0]) { continue; } unselectTime.push({ startTime: this.formateTime(timeArr[i][1]), endtTime: this.toHHmmFormat(timeArr[i + 1][0]), }); } if (timeArr[timeArr.length - 1][1] !== 0) { unselectTime.push({ endtTime: this.toHHmmFormat(timeArr[timeArr.length - 1][1]), startTime: '00:00', }); } if ( unselectTime.length && unselectTime[0].startTime == '00:00' && unselectTime[unselectTime.length - 1].endtTime == '00:00' ) { let startTime = unselectTime[unselectTime.length - 1].startTime; let endtTime = unselectTime[0].endtTime; unselectTime.splice(0, 1); unselectTime.splice(unselectTime.length - 1, 1); unselectTime.push({ startTime, endtTime, }); } } return unselectTime; },
/** * [checkAuditSeocnd 比较当前时间是否在指定时间段内,精确到毫秒] * @author dongsir * @DateTime 2022-11-23 * @version 1.0 * @param date [beginDateStr] [开始时间] HH:mm:ss * @param date [endDateStr] [结束时间] HH:mm:ss * @return Boolean */ checkAuditSeocnd(beginTime, endTime) { let today = dayjs(new Date()).format('YYYY/MM/DD'); beginTime = today + ' ' + beginTime; endTime = today + ' ' + endTime; // default milliseconds if (dayjs().isBetween(beginTime, endTime)) { return true; } else { return false; } }, }, beforeDestroy() { // 销毁定时器 clearInterval(this.intervalTimer); app.globalData.scrollLock = false; }, }; </script> <style lang="scss" scoped> .check-container { text-align: center;
.check-box { border-bottom: 1px solid rgba(187, 187, 187, 0.6); margin: 0 3rem; padding: 1.13rem 2rem;
.icon { width: 3.5rem; height: 3.5rem; }
.info { padding: 0.44rem 0; font-size: 1.25rem; font-weight: bold; color: #262626;
&.error { color: #e74b47; } }
.address { width: 320rpx; font-size: 0.75rem; color: #999999; } }
.time { padding: 1.3rem 0; font-size: 1.06rem; font-weight: bold; color: #262626; }
.btn { height: 4rem; background: #4c8afc; font-size: 1.06rem; font-weight: bold; color: #ffffff;
&.submit-btn { letter-spacing: 3px; }
&.cancel { background: #fff; color: #999; border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; } } } </style>
|