付延余
2023-03-24 eb9ae89c3e9f66fe5d0f39092a41e5c09bd86fc6
pages/driver-page/driver-index/bill-of-lading-details/punchTheClock/punchTheClock.vue
@@ -5,7 +5,7 @@
      <view class="punchTheClock_container">
         <view class="punchTheClock_btn" @click="arrive">
            <view>
               <p>签到/打卡</p>
               <p>{{ coalStatus == 2 ? '已签到' : '签到/打卡' }}</p>
               <p>{{ nowTime }}</p>
            </view>
         </view>
@@ -21,13 +21,15 @@
import { todayDate } from '@/utils/util.js';
export default {
   onLoad(params) {
      if (params.orderPlanId) {
      if (params.orderPlanId && params.coalStatus) {
         this.punchTheClockObj.id = params.orderPlanId;
         this.coalStatus = params.coalStatus;
      }
   },
   data() {
      return {
         nowTime: '',
         coalStatus: 0,
         punchTheClockObj: {
            latitude: null,
            longitude: null,
@@ -36,7 +38,12 @@
      };
   },
   onShow() {
      this.todayDate();
      this.getSetting(); //获取授权
      this.getFuzzyLocation(); //获取位置
      this.todayDate(); //当前时间
   },
   methods: {
      getSetting() {
      // 获取权限信息
      wx.getSetting({
         success(res) {
@@ -44,15 +51,11 @@
               wx.authorize({
                  scope: 'scope.userFuzzyLocation',
                  success(res) {
                     console.log(res);
                     if (res.errMsg == 'authorize:ok') {
                        // 获取位置信息
                        this.getFuzzyLocation();
                     }
                        uni.showToast({
                           title: '授权成功!'
                        });
                  }
               });
            } else {
               this.getFuzzyLocation();
            }
         },
         fail() {
@@ -60,14 +63,14 @@
         }
      });
   },
   methods: {
      getFuzzyLocation() {
         let that = this;
         wx.getFuzzyLocation({
            type: 'wgs84',
            success(res) {
               console.log(res, '获取位置');
               this.punchTheClockObj.latitude = res.latitude;
               this.punchTheClockObj.longitude = res.longitude;
               console.log(res, '获取位置', that);
               that.punchTheClockObj.latitude = res.latitude;
               that.punchTheClockObj.longitude = res.longitude;
            }
         });
      },
@@ -120,6 +123,9 @@
         display: flex;
         justify-content: center;
         align-items: center;
         p{
            text-align: center;
         }
      }
      .punchTheClock_text {
         display: flex;