index.vue 10.7 KB
<template>
  <view class="order-detail-container" v-if="dataGram != null || dataGram != undefined">
    <view class="order-detail-container-box">
      <!-- 订单信息 -->
      <view class="order-detail-container-box-card">
        <view class="order-detail-container-header-card-title">
          <view class="order-detail-container-header-card-uicon"></view>
          订单信息
        </view>
        <view class="order-detail-container-header-item"
          @click.stop="handlerJumpOtherApp(dataGram.garLatitude, dataGram.garLongitude, dataGram.garCoordinate)">
          <text class="order-detail-container-header-title">订单地点:</text>
          <view class="order-detail-container-header-content" style="text-decoration: underline">
            <text selectable='true'>{{ dataGram.garOrderAddress + dataGram.garOrderAddressDetails }}</text>
          </view>
        </view>
        <view class="order-detail-container-header-item">
          <text class="order-detail-container-header-title">现场图片:</text>
          <view class="order-detail-container-header-content">
            <u-upload width="180" height="130" :fileList="currentImages" name="3" multiple :maxCount="10"
              :previewFullImage="true" :isReadOnly="true"></u-upload>
          </view>
        </view>
        <view class="order-detail-container-header-item">
          <text class="order-detail-container-header-title">负责单位:</text>
          <view class="order-detail-container-header-content">
            {{ dataGram.garOrderCompanyName }}
          </view>
        </view>
        <view class="order-detail-container-header-item">
          <text class="order-detail-container-header-title">垃圾类型:</text>
          <view class="order-detail-container-header-content">
            {{ dataGram.garOrderTrashType }}
          </view>
        </view>
        <view class="order-detail-container-header-item">
          <text class="order-detail-container-header-title">订单号:</text>
          <view class="order-detail-container-header-content">
            <text selectable="true">{{ orderId }}</text>
          </view>
        </view>
      </view>
      <!-- 收运进度 -->
      <view class="order-detail-container-box-card">
        <view class="order-detail-container-header-card-title">
          <view class="order-detail-container-header-card-uicon"></view>
          收运清单
        </view>
        <view v-if="dataGram.transportDetails" style="width: 100%;">
          <view v-for="(item, index) in dataGram.transportDetails" style="width: 100%; box-sizing: border-box;">
            <view class="transport-process-item" style="display: flex;width: 100%; margin: 20rpx 0 ;">
              <view style="width: 150rpx;">
                <up-image :show-loading="true" :src="item.fillImage" width="80rpx" height="80rpx"></up-image>
              </view>
              <view style="display: flex;align-items: center;width: 70%;justify-content: center;">
                <view style="display: flex;justify-content: center;align-items: center;font-size: 25rpx;">
                  <view style="margin-right: 4rpx;">
                    载重:
                  </view>
                  <view>{{ item.garCarryingWeight }}t</view>
                </view>
              </view>
              <view style="display: flex;align-items: center;width: 50%;justify-content: center; font-size: 25rpx;">
                <view style=" transform: rotateY(180deg);">
                  <up-icon name="car-fill" size="40" color="#19a97c"></up-icon>
                </view>
                <view style="display: flex;justify-content: center;align-items: center;font-size: 25rpx;">
                  <view>{{ (index + 1) + '/' + dataGram.garRealCarCount }}</view>
                </view>
              </view>
              <view style="display: flex;align-items: center;width: 160%; margin-left: 15rpx;overflow: hidden;">
                <view style="display: flex;justify-content: center;align-items: center;font-size: 25rpx;">
                  <view style="margin-right: 4rpx;">
                    车牌:
                  </view>
                  <view>{{ item.garHandlerCarCode }}</view>
                </view>
              </view>
              <view style="display: flex; align-items: center;width: 150rpx; justify-content: flex-end;"
                @click="goTransportDetail(item)">
                <text style="font-size: 30rpx;white-space: nowrap;margin-right: 15rpx;color: #19a97c;">详情</text>
                <up-icon name="arrow-right" size="30" color="#19a97c"></up-icon>
              </view>
            </view>
          </view>
          <view style="display: flex;align-items: center;width: 100%;justify-content: center;">
            <view style="display: flex;justify-content: center;align-items: center;font-size: 25rpx;">
              <view style="margin-right: 4rpx;">
                载重共计:
              </view>
              <view>{{ transportWeightCount }}t</view>
            </view>
          </view>
        </view>
        <view v-else class="empty-image"
          style="width: 100%; display: flex; justify-content: center; align-items: center;">
          <image class="image-style" style="width: 200rpx; height: 200rpx;" :src="emptyBase64Image"></image>
        </view>
      </view>
      <view class="space-box">{{ spaceStr }}</view>
    </view>
    <!-- 占位符 -->
    <view class="order-detail-bottom">
      <view class="order-detail-bottom-box">
        <view class=" order-detail-bottom-left">
        </view>
      </view>
    </view>
  </view>
</template>

<script setup>
import { queryOrderTransportDetail } from '@/apis/order.js';
import zStatic from '@/components/z-paging/js/z-paging-static';
import { onLoad, onShow } from '@dcloudio/uni-app';
import { ref } from 'vue';
const isOnloadIn = ref(false)
const dataGram = ref({
  transportDetails: []
});
const orderId = ref(null)
const currentImages = ref([])
const emptyBase64Image = ref(zStatic.base64Empty)
const spaceStr = ref("")
const transportWeightCount = ref();
const goTransportDetail = (val) => {
  uni.$u.route({
    url: `pages/order/handler-home/scan-detail/index`
    , params: {
      garAskId: val.garAskId
    }
  })
}

const handleOrderDetail = (orderId) => {
  queryOrderTransportDetail(orderId).then(res => {
    dataGram.value = res.data.data;
    dataGram.value.transportDetails.forEach(element => {
      element.fillImage = import.meta.env.VITE_BASE_URL + element.fillImage
    })
    currentImages.value = dataGram.value.currentImages.map(element => {
      return { url: import.meta.env.VITE_BASE_URL + element }
    });
    transportWeightCount.value = dataGram.value.transportDetails.reduce((pre, cur) => {
      console.log(pre, cur);
      return pre + cur.garCarryingWeight
    }, 0)
  })
}
const handlerJumpOtherApp = (latitude, longitude, garCoordinate) => {
  // 给出提示确定要跳转吗
  uni.showModal({
    title: '提示',
    content: '是否跳转到app定位进行导航?',
    success: function (res) {
      if (res.confirm) {
        uni.openLocation({
          latitude: latitude,
          longitude: longitude,
          success: function () {
            console.log('success');
          }
        });
      }
    }
  })
}


/**
 * 初始化信息
 */
onLoad((options) => {
  orderId.value = options.garOrderId
  handleOrderDetail(orderId.value)
})

onShow(() => {
  try {
    if (isOnloadIn.value) {
      handleOrderDetail(orderId.value)
    } else {
      isOnloadIn.value = true
    }
  } catch (error) {
    console.log(error);
  }
})
</script>

<style lang="scss" scoped>
$custom-marin-bottom: 20rpx;
$custom-page-padding: 20rpx;
$custom-border-radio: 20rpx;
$custom-bottom-height: 200rpx;

@mixin card {
  padding: $custom-page-padding;
  box-sizing: border-box;
  background-color: #ffffff;
  border-radius: $custom-border-radio;
  margin-bottom: $custom-marin-bottom;
}

.order-detail-container {
  height: 100%;
  width: 100%;
  background-color: $u-info-light;
  box-sizing: border-box;
  overflow-y: scroll;
  background: linear-gradient(to bottom, #19a97c, $u-info-light, $u-info-light, $u-info-light);


  .order-detail-container-box {
    height: 100%;
    width: 100%;
    padding: $custom-page-padding;
    box-sizing: border-box;

    .order-detail-top {
      @include card();

      .order-detail-top-box {
        .order-detail-top-box-step {
          u-steps {
            u-steps-item {}
          }
        }
      }
    }

    .order-detail-container-box-card {
      @include card();

      .order-detail-container-header-card-title {
        font-weight: bold;
        line-height: 80rpx;
        border-bottom: 3rpx solid $u-info-light;
        margin-bottom: $custom-marin-bottom;
        color: $u-primary;
        display: flex;
        align-items: center;

        .order-detail-container-header-card-uicon {
          background-color: $u-primary;
          margin-right: 10rpx;
          height: 35rpx;
          width: 15rpx;
        }
      }

      .order-detail-container-header-item {
        display: flex;
        margin-bottom: $custom-marin-bottom;

        // font-size: 30rpx;
        // font-weight: bold;
        // color: $u-main-color;
        .order-detail-container-header-title {
          color: $u-main-color;
          white-space: nowrap; //溢出不换行
          color: $u-info;
        }

        .order-detail-container-header-content {
          display: flex;
        }
      }
    }
  }


  .space-box {
    padding-bottom: $custom-bottom-height;
    margin-bottom: 40rpx;
  }


  .order-detail-bottom {
    position: absolute;
    width: 100%;
    // height: 100%;
    bottom: 0;
    left: 0;

    .movableAreaDetail {
      pointer-events: none;
      position: fixed;
      left: 0;
      top: 0;
      width: 100%;
      height: calc(100% - $custom-bottom-height);
      z-index: 999;

      .movableView {
        pointer-events: auto;
        min-height: 60rpx;
        min-width: 60rpx;

        .order-detail-call-box-container {
          min-height: 60rpx;
          min-width: 60rpx;
          display: flex;
          align-items: center;
          justify-content: center;
          background-color: #19a97c;
          border-radius: 100%;
        }
      }
    }

    .order-detail-bottom-box {
      height: $custom-bottom-height;
      padding: 50rpx;
      box-sizing: border-box;
      display: flex;
      justify-content: space-between;
      align-items: center;

      .order-detail-bottom-left {
        min-width: 200rpx;
      }

      .order-detail-bottom-right {
        min-width: 200rpx;
      }
    }
  }
}

.mask-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 999;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}
</style>