<template>
  <!-- 修改港口装卸费 -->
  <div id="contractDetails">
    <page-title>编辑</page-title>
    <div class="main">
      <span class="text">港口装卸费</span>
      <span class="a"></span>
    </div>
    <div class="contractTitle">
      <div class="form-box">
        <div class="form-one">
          <dil-form :formId="223" 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/bms/getFeeToUpdate/" + this.$route.params.feeId)
        .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 mapVal = {
        feeId: this.$route.params.feeId,
        materialId: this.form1.materialId,
        feeForeignShipName: this.form1.feeForeignShipName,
        feeMaterialTonnage: this.form1.feeMaterialTonnage,
        priceId: this.form1.priceId,
        feeValue: this.form1.feeValue,
      };
      console.log(mapVal);
      this.axios
        .post(
          "/api/v1/bms/updatePortHandlingFee",
          mapVal
        )
        .then((res) => {
          if (res.data.code == 200) {
            this.$message({
              type: "success",
              message: "修改成功!",
            });
            // this.$refs.table.refreshData();
            this.$router.go(-1);
          } else {
            this.$message.error("修改失败！");
          }
          this.$refs['table'].resetField();
        });
    },
  },
};
</script>
<style lang="scss" scoped>
// @import "@/styles/appoint/contract/ContractInsert.scss";
</style>
