<template>
  <div class="create-sales-contract">
    <change-sales-contract-add-content ref="changeSalesContractAddContent" />
    <div class="submit-btn">
      <el-button @click="() => { $router.push({ name: 'MyTrade', query: {type: 'SalesContractManagement'} })}">关闭</el-button>
      <el-button type="primary" @click="onSubmit">提交</el-button>
    </div>
  </div>
</template>

<script>
import { salesContractChangeDoEnter } from '@/api/myTrade/salesContractManagement/salesContractManagement'
export default {
  name: 'SalesContractManagementChangeSalesContractAdd',
  components: {
    ChangeSalesContractAddContent: () => import('./components/ChangeSalesContractAddContent.vue')
  },
  data() {
    return {
      loading: false
    }
  },
  methods: {
    onSubmit(type) {
      this.$refs.changeSalesContractAddContent.getParams().then((data) => {
        const params = {
          ...data,
          Loading: true
        }
        salesContractChangeDoEnter(params).then(() => {
          this.$message.success('变更销售合同录入成功')
          this.$router.push({
            name: 'MyTrade',
            query: {
              type: 'SalesContractManagement'
            }
          })
        })
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.create-sales-contract {

}
</style>
