小牛集卡web 客户端
chenwei
2021-06-08 e41faf1640e2e71febf4ba347a301e0c043b6ce9
src/views/agomiddle/InquiryCenter.vue
@@ -15,7 +15,7 @@
          </div>
          <div>
            <img src="../../../public/img/index/gouxuan2.svg" alt="" />
            <span>{{allOrder.OrderType==1?'我要装':'我要卸'}}</span>
            <span>{{ allOrder.OrderType == 1 ? "我要装" : "我要卸" }}</span>
          </div>
        </div>
      </div>
@@ -43,10 +43,10 @@
            <span class="type">类型</span>
            <span class="info">箱子信息</span>
            <span class="number">数量(车)</span>
              <span  style="width:33px;">箱量</span>
            <span style="width: 33px">箱量</span>
            <!-- <span class="number">箱量</span> -->
            <span style="width:50px;">价格</span>
            <span style="width:195px;"></span>
            <span style="width: 50px">价格</span>
            <span style="width: 195px"></span>
          </div>
          <box-type :orderall="allOrder" @pinche="acceptPin"></box-type>
@@ -67,7 +67,9 @@
            >
          </div>
          <div>
            <span>合计:¥{{ allOrder.TotalAmount }}</span>
            <span>额外:¥{{extraMoney}}</span>
              <span>+运输:¥{{carriage}}=</span>
            <span>合计:¥{{ totalMoney }}</span>
            <button @click="placeOrder">
              <i class="iconfont icon-gouxuan"></i> 下 单
            </button>
@@ -76,7 +78,7 @@
      </div>
    </div>
    <el-dialog title="新增箱子" :visible.sync="addBoxDialog" width="30%">
    <el-dialog title="新增箱子" :visible.sync="addBoxDialog" width="300px">
      <add-box></add-box>
    </el-dialog>
    <!-- 下单的弹窗 -->
@@ -90,7 +92,7 @@
      <div class="order">
        <div class="title">
          <span>支付订单</span>
          <span>合计¥{{allOrder.TotalAmount}}</span>
          <span>合计¥{{ allOrder.TotalAmount }}</span>
        </div>
        <div class="my">
          <i class="el-icon-s-custom"></i>
@@ -193,7 +195,6 @@
export default {
  data() {
    return {
      value3: "",
      checked: false,
      num: 1,
      orderDialog: false,
@@ -218,12 +219,55 @@
      },
      CusSurplusAmount: 0,
      myCoupon: [],
      orderRemark:"",
      endtime:"",
      isShowShun:false,
      routerPrice:0,
      pid:"",
      orderRemark: "",
      endtime: "",
      isShowShun: false,
      routerPrice: 0,
      pid: "",
    };
  },
  computed:{
      //计算运输费用
      carriage(){
        var count=0;
        if(this.allOrder.tempOrderForms!=undefined){
              for(var i =0;i<this.allOrder.tempOrderForms.length;i++){
          count+=(this.allOrder.tempOrderForms[i].tempOrder.BaseMoney)*(this.allOrder.tempOrderForms[i].tempOrder.ContainerNub);
        }
        }
         return count;
        },
        // 计算额外费用
        extraMoney(){
          var count=0;
        if(this.allOrder.tempOrderForms!=undefined){
              for(var i =0;i<this.allOrder.tempOrderForms.length;i++){
                if(this.allOrder.tempOrderForms[i].tempOrder.IsUrgent){
                    count+=(this.allOrder.tempOrderForms[i].tempOrder.UrgentMoney)*(this.allOrder.tempOrderForms[i].tempOrder.ContainerNub);
                }
        }
        }
         return count;
        },
        // 合计费用
        totalMoney(){
              var count=0;
              var count1=0;
        if(this.allOrder.tempOrderForms!=undefined){
              for(var i =0;i<this.allOrder.tempOrderForms.length;i++){
          count+=(this.allOrder.tempOrderForms[i].tempOrder.BaseMoney)*(this.allOrder.tempOrderForms[i].tempOrder.ContainerNub);
        }
        }
        if(this.allOrder.tempOrderForms!=undefined){
              for(var i =0;i<this.allOrder.tempOrderForms.length;i++){
                if(this.allOrder.tempOrderForms[i].tempOrder.IsUrgent){
                    count1+=(this.allOrder.tempOrderForms[i].tempOrder.UrgentMoney)*(this.allOrder.tempOrderForms[i].tempOrder.ContainerNub);
                }
        }
        }
        return count+count1;
        },
  },
  components: {
    BoxType,
@@ -236,73 +280,128 @@
    orderSure() {
      console.log(this.allOrder);
      this.portOrderSave.CityId = "5dc90c98-475e-4529-bb3a-c3010a82b0e1";
      this.portOrderSave.OrderType = 1;
      this.portOrderSave.PickPlace = this.allOrder.tempOrderForms[0].tempOrder.PickPlace;
      this.portOrderSave.ReturnPlace = this.allOrder.tempOrderForms[0].tempOrder.ReturnPlace;
      this.portOrderSave.CaPositionLongitude = this.allOrder.OrderAddressLongitude;
      this.portOrderSave.CaPositionLatitude = this.allOrder.OrderAddressLatitude;
      this.portOrderSave.OrderType = this.allOrder.OrderType;
      this.portOrderSave.PickPlace =
        this.allOrder.tempOrderForms[0].tempOrder.PickPlace;
      this.portOrderSave.ReturnPlace =
        this.allOrder.tempOrderForms[0].tempOrder.ReturnPlace;
      this.portOrderSave.CaPositionLongitude =
        this.allOrder.OrderAddressLongitude;
      this.portOrderSave.CaPositionLatitude =
        this.allOrder.OrderAddressLatitude;
      this.portOrderSave.CaAdress = this.allOrder.OrderAddress;
      //订单联系人和联系带电话备注之类的进行双向绑定了 ,可以直接输入值
      this.portOrderSave.OrderPayType = 0;
      this.portOrderSave.OrderUseCoupon = 0;
      this.portOrderSave.Goods = this.allOrder.TransportGoods;
      // 保存箱子详情
      for (var i = 0; i < this.allOrder.tempOrderForms.length; i++) {
        if(this.allOrder.tempOrderForms[i].tempOrder.TempOrderContainer.length>0){
          for(var j = 0;j<this.allOrder.tempOrderForms[i].tempOrder.TempOrderContainer.length;j++){
                this.portOrderSave.OrderDetailed.push({
          CtnerId: this.allOrder.tempOrderForms[i].tempOrder.TempOrderID,
          CtnerNub: this.allOrder.tempOrderForms[i].tempOrder.ContainerNub,
          SelfBox: this.allOrder.tempOrderForms[i].tempOrder.SelfBox?1:0,
        //有几条数据
          OdtaskIsUrgent: this.allOrder.tempOrderForms[i].tempOrder.IsUrgent?1:0,
        if (
          this.allOrder.tempOrderForms[i].tempOrder.TempOrderContainer.length >
          0
        ) {
          // 详情修改成对象后
          Defaultset: 0,
          var arr = [];
          for (
            var j = 0;
            j <
            this.allOrder.tempOrderForms[i].tempOrder.TempOrderContainer.length;
            j++
          ) {
            arr.push({
              BolCode:
                this.allOrder.tempOrderForms[i].tempOrder.TempOrderContainer[j]
                  .BolCode,
              TradeCode:
                this.allOrder.tempOrderForms[i].tempOrder.TempOrderContainer[j]
                  .TradeCode,
          BolCode: this.allOrder.tempOrderForms[i].tempOrder.TempOrderContainer[j].BolCode,
          TradeCode: this.allOrder.tempOrderForms[i].tempOrder.TempOrderContainer[j].TradeCode,
          ArriveTime: this.allOrder.tempOrderForms[i].tempOrder.ArriveTime,
          ShipAgent:this.allOrder.tempOrderForms[i].tempOrder.TempOrderContainer[j].ShipAgent,
          ContainerOwner: this.allOrder.tempOrderForms[i].tempOrder.TempOrderContainer[j].ContainerOwner,
          ContainerNo: this.allOrder.tempOrderForms[i].tempOrder.TempOrderContainer[j].ContainerNo,
          BoxSeal:this.allOrder.tempOrderForms[i].tempOrder.TempOrderContainer[j].BoxSeal,
           IsCarPooling: this.allOrder.tempOrderForms[i].tempOrder.IsCarPooling?1:0,
              ShipAgent:
                this.allOrder.tempOrderForms[i].tempOrder.TempOrderContainer[j]
                  .ShipAgent,
              ContainerOwner:
                this.allOrder.tempOrderForms[i].tempOrder.TempOrderContainer[j]
                  .ContainerOwner,
              ContainerNo:
                this.allOrder.tempOrderForms[i].tempOrder.TempOrderContainer[j]
                  .ContainerNo,
            Weight: this.allOrder.tempOrderForms[i].tempOrder.Weight,
             EndTime: this.endtime,
               OrderRemark: this.orderRemark
        });
        }
        }else{
            this.portOrderSave.OrderDetailed.push({
                CtnerId: this.allOrder.tempOrderForms[i].tempOrder.TempOrderID,
          CtnerNub: this.allOrder.tempOrderForms[i].tempOrder.ContainerNub,
          SelfBox: this.allOrder.tempOrderForms[i].tempOrder.SelfBox?1:0,
          OdtaskIsUrgent: this.allOrder.tempOrderForms[i].tempOrder.IsUrgent?1:0,
              BoxSeal:
                this.allOrder.tempOrderForms[i].tempOrder.TempOrderContainer[j]
                  .BoxSeal,
              Weight:
                this.allOrder.tempOrderForms[i].tempOrder.TempOrderContainer[j]
                  .Weight,
            });
          Defaultset: 0,
           IsCarPooling: this.allOrder.tempOrderForms[i].tempOrder.IsCarPooling?1:0,
            //箱子信息
            Weight: this.allOrder.tempOrderForms[i].tempOrder.Weight,
             EndTime: this.endtime,
               OrderRemark: this.orderRemark
            })
            //         this.portOrderSave.OrderDetailed.orderDetaileCnters.push({
            //   BolCode: this.allOrder.tempOrderForms[i].tempOrder.TempOrderContainer[j].BolCode,
            //   TradeCode: this.allOrder.tempOrderForms[i].tempOrder.TempOrderContainer[j].TradeCode,
            //   ShipAgent:this.allOrder.tempOrderForms[i].tempOrder.TempOrderContainer[j].ShipAgent,
            //   ContainerOwner: this.allOrder.tempOrderForms[i].tempOrder.TempOrderContainer[j].ContainerOwner,
            //   ContainerNo: this.allOrder.tempOrderForms[i].tempOrder.TempOrderContainer[j].ContainerNo,
            //   BoxSeal:this.allOrder.tempOrderForms[i].tempOrder.TempOrderContainer[j].BoxSeal,
            //     Weight: this.allOrder.tempOrderForms[i].tempOrder.Weight
            // });
          }
          this.portOrderSave.OrderDetailed.push({
            CtnerId: this.allOrder.tempOrderForms[i].tempOrder.Container.CntrId,
            TempOrderId: this.allOrder.tempOrderForms[i].tempOrder.TempOrderID,
            CtnerNub: this.allOrder.tempOrderForms[i].tempOrder.ContainerNub,
            SelfBox: this.allOrder.tempOrderForms[i].tempOrder.SelfBox ? 1 : 0,
            OdtaskIsUrgent: this.allOrder.tempOrderForms[i].tempOrder.IsUrgent
              ? 1
              : 0,
            Defaultset: 0,
            ArriveTime: this.allOrder.tempOrderForms[i].tempOrder.ArriveTime,
            orderDetaileCnters: arr,
          });
        } else {
          console.log("应该不会存在把");
          //   this.portOrderSave.OrderDetailed.push({
          //       CtnerId: this.allOrder.tempOrderForms[i].tempOrder.TempOrderID,
          // CtnerNub: this.allOrder.tempOrderForms[i].tempOrder.ContainerNub,
          // SelfBox: this.allOrder.tempOrderForms[i].tempOrder.SelfBox?1:0,
          // OdtaskIsUrgent: this.allOrder.tempOrderForms[i].tempOrder.IsUrgent?1:0,
          // Defaultset: 0,
          //  IsCarPooling: this.allOrder.tempOrderForms[i].tempOrder.IsCarPooling?1:0,
          //   Weight: this.allOrder.tempOrderForms[i].tempOrder.Weight,
          //    EndTime: this.endtime,
          //      OrderRemark: this.orderRemark
          //   })
          //  this.portOrderSave.OrderDetailed=[];
        }
      }
      console.log(this.portOrderSave);
      this.getPortOrderSave(this.portOrderSave);
      this.orderDialog = false;
    },
    //提交订单
      async getPortOrderSave(model) {
    async getPortOrderSave(model) {
      await this.$axios
        .post("/api/Order/PortOrderSave",this.$qs.stringify(model))
        .post("/api/Order/PortOrderSave", this.$qs.stringify(model))
        .then((res) => {
          console.log(this.portOrderSave);
         console.log(res);
          if(res.data){
            this.$message({
              message:"下单成功",
              type:"success"
            });
            this.$router.push("/order");
          }
          console.log(res);
        })
        .catch((err) => {
          console.log(err);
@@ -328,7 +427,7 @@
          };
          for (var i = 0; i < model.tempOrderForms.length; i++) {
            model.tempOrderForms[i].orderData = Object.assign({}, orderinQiry);
            if(  model.tempOrderForms[i].tempOrder.IsCarPooling==1){
            if (model.tempOrderForms[i].tempOrder.IsCarPooling == 1) {
              this.isShowShun = true;
            }
          }
@@ -343,42 +442,57 @@
      console.log(value);
    },
    //接收拼车的信息
    acceptPin(e){
      if(e==""){
        this.pid="";
    acceptPin(e) {
      if (e == "") {
        this.pid = "";
        this.isShowShun = false;
      }else{
      } else {
        this.pid = e;
         this.isShowShun = true;
        this.isShowShun = true;
      }
    },
    placeOrder() {
      console.log(this.allOrder);
      this.getPayCaptal();
      this.getMyCoupon();
      if(this.pid!=""){
            this.getRoutePrice({
        PickPlace:this.allOrder.tempOrderForms[0].tempOrder.PickPlace,
        AddressLongitude:this.allOrder.OrderAddressLongitude,
        AddressLatitude:this.allOrder.OrderAddressLatitude,
        ReturnPlace:this.allOrder.tempOrderForms[0].tempOrder.ReturnPlace,
        CtnerId:this.pid,
        TransType:1,
      })
      // 下单前要判断信息是否完善,价格是否为0
      for(var i =0;i<this.allOrder.tempOrderForms.length;i++){
        if(this.allOrder.tempOrderForms[i].tempOrder.BaseMoney==0){
           this.$message.error("请先询价");
           return;
        }
        if(this.allOrder.tempOrderForms[i].tempOrder.TempOrderContainer.length==0){
           this.$message.error("请完善箱子信息");
           return;
        }
      }
      // console.log(totalMoney);
      console.log(this.totalMoney);
      //是否有顺风达
      // if(this.pid!=""){
      //       this.getRoutePrice({
      //   PickPlace:this.allOrder.tempOrderForms[0].tempOrder.PickPlace,
      //   AddressLongitude:this.allOrder.OrderAddressLongitude,
      //   AddressLatitude:this.allOrder.OrderAddressLatitude,
      //   ReturnPlace:this.allOrder.tempOrderForms[0].tempOrder.ReturnPlace,
      //   CtnerId:this.pid,
      //   TransType:1,
      // })
      // }
      // this.getTempOrder();
      this.orderDialog = true;
    },
    //获取运输价格
    async getRoutePrice(model) {
      await this.$axios
        .post("/api/Order/GetTransPortationRoutePrice",this.$qs.stringify(model))
        .post(
          "/api/Order/GetTransPortationRoutePrice",
          this.$qs.stringify(model)
        )
        .then((res) => {
            this.routerPrice = res.data;
          this.routerPrice = res.data;
        })
        .catch((err) => {
          console.log(err);