<template>
  <div class="create-sales-contract">
    <change-create-sales-contract-content ref="changeCreateSalesContract" />
    <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 { salesContractChangeDoadd } from '@/api/myTrade/salesContractManagement/salesContractManagement'
export default {
  name: 'SalesContractManagementChangecreateSalesContract',
  components: {
    ChangeCreateSalesContractContent: () => import('./components/ChangeCreateSalesContractContent')
  },
  data() {
    return {
      loading: false
    }
  },
  methods: {
    onSubmit() {
      this.$refs.changeCreateSalesContract.getParams().then((data) => {
        const params = {
          ...data,
          Loading: true
        }
        salesContractChangeDoadd(params).then(() => {
          this.$message.success('提交成功')
          this.$router.push({
            name: 'MyTrade',
            query: {
              type: 'SalesContractManagement'
            }
          })
        })
      })
    }
  }
}
</script>

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

}
</style>
