819527061@qq.com
2024-06-11 105c47bd671d2feb04922ee4f39f8a7dcc26bf49
pages/driver-page/driver-index/driver-index.vue
@@ -186,6 +186,17 @@
                  @confirm="insideConnectConfirm"
                  @cancel="insideConnectCancel"></u-modal>
            </view>
            <!-- 距离过大提示 -->
            <view class="">
               <u-modal :show="isOutFlag"
                  title="是否接单"
                  showCancelButton
                  cancel-text="仍然接单"
                  confirm-text="暂时不接"
                  content="当前距离过远是否接单?"
                  @confirm="isCancel"
                  @cancel="isOk"></u-modal>
            </view>
            <!-- 已预约提煤单 -->
            <view class="Reserved">
               <combined-title title="已预约提煤单"></combined-title>
@@ -313,8 +324,10 @@
               list3: []
            },
            // 接单模态框
            isOutFlag:false,
            qiangDanShow: false,
            qiangDanTitle: '接单提示',
            qiangdanItem:{}, //抢单对象
            qiangDanContent: '',
            qiangDanOrderPlanId: null,
            isFirstLogin: true, //是否是第一次登录
@@ -325,6 +338,8 @@
            insideConnectShow: false,
            orderPlanId: '',
            fleetId: '',
            latitude:'',
            longitude:'',
            customerId: '',
            xsUserId: '',
            filedId: '',
@@ -357,6 +372,7 @@
         },
         // 接单按钮
         qiangDanBtn(value) {
            this.qiangdanItem = value;
            //是否可以场内接单,1 可以2不可以
            if (value.isInsideConnect === 1) {
               this.insideConnectShow = true
@@ -393,27 +409,53 @@
            uni.showLoading({
               title: '加载中'
            })
            this.$reqPost('qiangDan', {
            let that = this;
            uni.getFuzzyLocation({
            type: 'wgs84', // 返回可以用于wx.openLocation的经纬度,默认为wgs84的gps坐标
            success: function(res) {
               that.latitude = res.latitude;
               that.longitude = res.longitude;
               // 可以在这里继续处理获取到的经纬度信息
               console.log(that.latitude,that.longitude,'132')
            },
            fail: function(err) {
               // 获取地理位置失败
               console.log(err,'获取地理位置失败');
            },
            complete :()=>{
               this.$reqPost('qiangDan', {
                  orderPlanId: id,
                  fleetId: fleetId,
                  customerId: customerId,
                  xsUserId: xsUserId
                  xsUserId: xsUserId,
                  latitude:this.latitude,
                  longitude:this.longitude
               }, 'params')
               .then(res => {
                  uni.hideLoading()
                  if (res.code == 0) {
                     this.$u.toast('接单成功');
                  } else {
                     this.$u.toast(res.msg ? res.msg : '接单失败');
                  }
               })
               .then(() => {
                  setTimeout(() => {
                     setTimeout(() => {
                     this.qiangDanList();
                  }, 1500);
                  } else if (res.code == 2){
                     //距离过远
                     this.isOutFlag = true;
                  } else {
                     this.$u.toast(res.msg ? res.msg : '接单失败');
                     setTimeout(() => {
                     this.qiangDanList();
                  }, 1500);
                  }
               })
               .then(() => {
               }).catch(e => {
                  uni.hideLoading()
               })
            }
            });
         },
         insideConnectHandle(orderPlanId, fleetId, customerId, xsUserId, filedId) {
            uni.showLoading({
@@ -507,6 +549,13 @@
            uni.navigateTo({
               url: '/pages/driver-page/driver-index/SelfDelivery/SelfDelivery'
            })
         },
         isOk(){
            this.isOutFlag = false
              this.qiangDanBtn(this.qiangdanItem);
         },
         isCancel(){
            this.isOutFlag = false
         }
      }
   };