819527061@qq.com
2024-06-11 56ef0500de7867dc11f723fb59dc3cbbf7e63d10
pages/driver-page/driver-index/driver-index.vue
@@ -175,6 +175,28 @@
                  @confirm="cancelAppointConfirm"
                  @cancel="cancelAppointCancel"></u-modal>
            </view>
            <!-- 场内接单弹窗 -->
            <view class="">
               <u-modal :show="insideConnectShow"
                  title="接单选择"
                  showCancelButton
                  cancel-text="正常接单"
                  confirm-text="场内接单"
                  content="场内接单无需称皮,是否确认接单"
                  @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>
@@ -244,6 +266,13 @@
                           <!-- <view class="order-type">{{ item.orderType }}</view> -->
                        </view>
                     </view>
                     <view class="fourth-line"
                        v-if="item.status<3">
                        <view class="button-img"
                           @click.stop="cancelAppoint(item)">
                           请求退单
                        </view>
                     </view>
                  </view>
               </view>
               <view class="white-block"></view>
@@ -295,18 +324,25 @@
               list3: []
            },
            // 接单模态框
            isOutFlag:false,
            qiangDanShow: false,
            qiangDanTitle: '接单提示',
            qiangdanItem:{}, //抢单对象
            qiangDanContent: '',
            qiangDanOrderPlanId: null,
            fleetId: '',
            xsUserId: '',
            customerId: '',
            isFirstLogin: true, //是否是第一次登录
            phone: "",
            isFirstTime: false, //是否是登录进入首页,还是别的页面返回 false是登录 true是别的页面
            cancelAppointShow: false, //确认退单弹窗控制
            cancelAppointId: ''
            cancelAppointId: '',
            insideConnectShow: false,
            orderPlanId: '',
            fleetId: '',
            latitude:'',
            longitude:'',
            customerId: '',
            xsUserId: '',
            filedId: '',
         };
      },
      onShow() {
@@ -336,16 +372,27 @@
         },
         // 接单按钮
         qiangDanBtn(value) {
            if (value.tmcCount == '0') {
               this.qiangDan(value.orderPlanId, value.fleetId, value.customerId === null ? '0' : value.customerId,
                  value.xsUserId === null ? '0' : value.xsUserId);
            this.qiangdanItem = value;
            //是否可以场内接单,1 可以2不可以
            if (value.isInsideConnect === 1) {
               this.insideConnectShow = true
               this.orderPlanId = value.orderPlanId
               this.fleetId = value.fleetId
               this.customerId = !value.customerId ? '0' : value.customerId
               this.xsUserId = !value.xsUserId ? '0' : value.xsUserId
               this.filedId = value.filedId
            } else {
               this.qiangDanOrderPlanId = value.orderPlanId;
               this.fleetId = value.fleetId;
               this.customerId = value.customerId === null ? '0' : value.customerId;
               this.xsUserId = value.xsUserId === null ? '0' : value.xsUserId;
               this.qiangDanShow = true;
               this.qiangDanContent = `已接${value.tmcCount}单,确定接单?`;
               if (value.tmcCount == '0') {
                  this.qiangDan(value.orderPlanId, value.fleetId, !value.customerId ? '0' : value.customerId,
                     !value.xsUserId ? '0' : value.xsUserId);
               } else {
                  this.qiangDanOrderPlanId = value.orderPlanId;
                  this.fleetId = value.fleetId;
                  this.customerId = !value.customerId ? '0' : value.customerId;
                  this.xsUserId = !value.xsUserId ? '0' : value.xsUserId;
                  this.qiangDanShow = true;
                  this.qiangDanContent = `已接${value.tmcCount}单,确定接单?`;
               }
            }
         },
         // 接单模态框
@@ -362,27 +409,72 @@
            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({
               title: '加载中'
            })
            this.$reqPost('insideConnect', {
               orderPlanId,
               fleetId,
               customerId,
               xsUserId,
               filedId
            }, 'params').then(res => {
               uni.hideLoading()
               if (res.code == 0) {
                  this.$u.toast('场内接单成功');
               } else {
                  this.$u.toast(res.msg ? res.msg : '场内接单失败');
               }
            })
         },
         list3CardIconClick(value) {
            uni.navigateTo({
@@ -397,6 +489,10 @@
         },
         // 请求退单
         cancelAppoint(item) {
            if (item.status >= 3) {
               this.$u.toast('当前状态不可退单')
               return
            }
            this.cancelAppointShow = true
            this.cancelAppointId = item.id
         },
@@ -425,6 +521,15 @@
         cancelAppointCancel() {
            this.cancelAppointShow = false
         },
         insideConnectCancel() {
            this.insideConnectShow = false
            this.qiangDan(this.orderPlanId, this.fleetId, this.customerId, this.xsUserId)
         },
         // 场内接单
         insideConnectConfirm() {
            this.insideConnectShow = false
            this.insideConnectHandle(this.orderPlanId, this.fleetId, this.customerId, this.xsUserId, this.filedId)
         },
         // 去预约
         toAppointmentClick(value) {
            // 由于自主配送单 是外购单 但是不需要填写原发为1不需要填写原发
@@ -444,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
         }
      }
   };
@@ -970,6 +1082,12 @@
         }
         .Reserved {
            .fourth-line {
               justify-content: flex-end;
               letter-spacing: vww(2);
               left: 223rpx !important;
            }
            .white-block {
               width: 100%;
               height: vww(50);