// 新增铁路运费汇总表
<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="button-box" 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";

export default {
  components: { PageTitle },
  data() {
    return {
      form: {},
    };
  },
  methods: {
    // 新增
    makeSure() {
      let BmsTrainFreight = {
        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
      };
      console.log(BmsTrainFreight)     
      this.axios
        .post(
          "/api/v1/bms/addTrainSettlement",
          BmsTrainFreight
        )
        .then((res) => {
            console.log(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" scoped>
.form-box{
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 5px;
  margin-bottom: 20px;
}
.button-box{
  display: flex;
  text-align: center;
  align-items: center;
  justify-content: center;
  margin-top: 0.3125rem;
  margin-bottom: 1.25rem;
}
</style>
