// 修改火车卸货
<template>
  <div id="endMaintenance">
    <page-title>修改铁路运费结算</page-title>
    <div class="main">
      <span class="text">修改</span>
      <span class="a"></span>
    </div>
    <div>
      <div class="form-box" style="margin-left: 5rem">
        <dil-form :formId="245" v-model="form"></dil-form>
        
      </div>
    </div>
    <div class="" style="margin-left:40rem">
      <el-button type="primary" @click="makeSure">确认修改</el-button>
      <el-button type="primary" @click="cancel">返回</el-button>
    </div>
  </div>
</template>

<script>
import PageTitle from "@/components/Page/Title";
import { sjTime } from "@/utils/sharedJsFile";
export default {
  components: { PageTitle },
  data() {
    return {
      form: {},
    };
  },
  mounted() {
    this.information();
  },
  methods: {
    information() {
      //查看运输合同详情
      this.$axios
        .post("/api/v1/bms/selectTrainSettlement/" + this.$route.params.settlementId)
        .then((res) => {
          res.data.data.forEach((e) => {             
            this.form = e;
          });
        });
    },
    // 修改
    makeSure() {
      let BmsTrainFreight = {
        settlementId: this.$route.params.settlementId,
        settlementDate: sjTime(this.form.settlementDate),
        settlementDayWagons: this.form.settlementDayWagons,
        settlementDayTonnage: this.form.settlementDayTonnage,
        settlementDayTransportCost: this.form.settlementDayTransportCost,
        settlementDayFloatCost: this.form.settlementDayFloatCost,
        settlementDayMargin: this.form.settlementDayMargin,
        settlementMonthWagons:this.form.settlementMonthWagons,
        settlementMonthTonnage:this.form.settlementMonthTonnage,
        settlementMonthTotalMonth:this.form.settlementMonthTotalMonth
      };     
      this.$axios
        .post(
          "/api/v1/bms/updateTrainSettlement",
          BmsTrainFreight
        )
        .then((res) => {
          if (res.data.code == 200) {
            this.$message({
              type: "success",
              message: "修改成功!",
            });            
            this.$router.go(-1);
          } else {
            this.$message.error("修改失败！");
          }
        });
    },
    // 返回
    cancel() {
      this.$router.go(-1);
    },
  },
};
</script>

<style lang="scss">
</style>
