<template>
  <!-- 修改其他价格信息 -->
  <div id="contractDetails">
    <page-title>编辑</page-title>
    <div class="contractTitle">
      <div class="form-box">
        <div class="form-one">
          <dil-form :formId="221" v-model="form1"></dil-form>
        </div>
      </div>
    </div>
    <div class="button-box">
      <el-button type="primary" @click="onClickConfirm">确认</el-button>
      <el-button @click="onClickCancel">返回</el-button>
    </div>
  </div>
</template>

<script>
import PageTitle from "@/components/Page/Title";

export default {
  components: { PageTitle },
 data(){
     return {
      form1: {},
  }
 },
  mounted() {
    this.information();
  },
  methods: {
    information() {
      //编辑驳船作业
      this.axios
        .post("/api/v1/ams/selectLoadUnloadPriceToUpdate/" + this.$route.params.priceId)
        .then((res) => {
          res.data.data.forEach((e) => {
            this.form1 = e;
            // console.log(e);
            // console.log(this.form1);
            // console.log(this.$route.params.loadingId);
          });
        });
    },
    handleCheckedCitiesChange(value) {
      console.log(value);
    },
    // 返回
    onClickCancel() {
      this.$router.go(-1);
    },
    currentRadioChange(row) {
      this.aaaa = row;
    },
    // 确认
    onClickConfirm() {
      let amsContractOtherPrice = {
        priceId: this.$route.params.priceId,
        priceType: this.form1.priceType,
        priceValue: this.form1.priceValue
      };
      console.log(amsContractOtherPrice);
      this.axios
        .post(
          "/api/v1/ams/updateLoadUnloadPrice",
          amsContractOtherPrice
        )
        .then((res) => {
          console.log(res);
          console.log(this.form1);
          this.$router.go(-1);
        });
    },
  },
};
</script>
<style lang="scss" scoped>
    .form-box {
    display: flex;
    justify-content: center;
    align-items: center;
    .el-form-item {
      display: flex;
      .el-form-item__label {
        width: 170px !important;
      }
      .el-input {
        width: 210px !important;
      }
    }
  }
  .button-box {
    display: flex;
    align-items: center;
    justify-content: center;
  }
</style>
