<template>
  <el-dialog
    title="发货信息"
    append-to-body
    :visible.sync="dialogVisible"
    :before-close="handleClose"
    width="1100px"
    destroy-on-close
    v-if="dialogShow"
    @close="close"
  >
    <el-form ref="form" :model="formMst" :rules="rules" size="mini" label-width="130px">
      <el-row>
        <el-col :span="8">
          <el-form-item label="收货单位:">
            <el-input v-model="formMst.consignee" size="mini" style="width: 210px" />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="收货人:">
            <el-input v-model="formMst.receiver" size="mini" style="width: 210px" />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="收货地址:">
            <el-input v-model="formMst.receiptaddress" size="mini" style="width: 210px" />
          </el-form-item>
        </el-col>
      </el-row>

      <el-row>
        <el-col :span="8">
          <el-form-item label="收货人联系电话:">
            <el-input v-model="formMst.receiptphone" size="mini" style="width: 210px" />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="物流公司:">
            <el-input v-model="formMst.logisticscompany" size="mini" style="width: 210px" />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="司机:">
            <el-input v-model="formMst.drivername" size="mini" style="width: 210px" />
          </el-form-item>
        </el-col>
      </el-row>

      <el-row>
        <el-col :span="8">
          <el-form-item label="车牌号:">
            <el-input v-model="formMst.carno" size="mini" style="width: 210px" />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="司机联系电话:">
            <el-input v-model="formMst.driverphone" size="mini" style="width: 210px" />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="合同号:">
            <el-input v-model="formMst.contractno" size="mini" style="width: 210px" />
          </el-form-item>
        </el-col>
      </el-row>

      <el-row>
        <el-col :span="8">
          <el-form-item label="送货单位:">
            <el-input v-model="formMst.deliveryunit" size="mini" style="width: 210px" />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="送货方地址:">
            <el-input v-model="formMst.deliveryaddress" size="mini" style="width: 210px" />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="送货方联系人:">
            <el-input v-model="formMst.deliveryname" size="mini" style="width: 210px" />
          </el-form-item>
        </el-col>
      </el-row>

      <el-row>
        <el-col :span="8">
          <el-form-item label="送货联系电话:">
            <el-input v-model="formMst.deliveryphone" size="mini" style="width: 210px" />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="物流公司编码:">
            <el-input v-model="formMst.trans_code" size="mini" style="width: 210px" />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="预估运费:">
            <el-input v-model="formMst.estimated_freight" size="mini" style="width: 210px" />
          </el-form-item>
        </el-col>
      </el-row>

      <el-row :gutter="20">
        <el-col :span="20" style="border: 1px solid white">
          <span />
        </el-col>
        <el-col :span="4">
          <span>
            <el-button icon="el-icon-check" size="mini" type="primary" @click="moneySubmit">保存</el-button>
            <el-button icon="el-icon-close" size="mini" type="info" @click="close">关闭</el-button>
          </span>
        </el-col>
      </el-row>
    </el-form>

  </el-dialog>
</template>

<script>

import CRUD, { crud } from '@crud/crud'
import checkoutbill from '@/views/wms/st/outbill/checkoutbill'
export default {
  name: 'SunShowDialog',
  mixins: [crud()],
  props: {
    dialogShow: {
      type: Boolean,
      default: false
    },
    openParam: {
      type: Object
    }
  },
  watch: {
    dialogShow: {
      handler(newValue, oldValue) {
        this.dialogVisible = newValue
        this.formMst = this.openParam
      }
    }
  },
  data() {
    return {
      formMst: {},
      dialogVisible: false
    }
  },
  methods: {
    handleClose(done) {
      this.$confirm('确认关闭？')
        .then(_ => {
          done()
        })
        .catch(_ => {
        })
    },
    close() {
      this.$refs['form'].resetFields()
      this.$emit('update:dialogShow', false)
      this.crud.resetQuery(true)
    },
    moneySubmit() {
      checkoutbill.moneySubmit(this.formMst).then(res => {
        this.crud.notify('保存成功！', CRUD.NOTIFICATION_TYPE.INFO)
        this.crud.toQuery()
        this.close()
      })
    }
  }
}
</script>

<style scoped>

</style>
