<template>
  <div>
    <el-form ref="form" v-loading="addLoading" :model="form" style="width: 100%;padding: 5px" :rules="rules">
      <el-row>
        <el-col style="padding-bottom: 10px">
          <span class="card_title">基本信息</span>
          <el-card shadow="always" style="padding: 15px 5px 5px 15px">
            <el-row>
              <el-col :span="3" class="col-txt"><span>小区-分期</span></el-col>
              <el-col :span="9" class="col-input">
                <el-form-item prop="roomUse">
                  <el-select v-model="form.roomUse" filterable placeholder="请选择">
                    <el-option
                      v-for="item in dc_data.HOUSE_USAGE"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="3" class="col-txt"><span>选房日</span></el-col>
              <el-col :span="9" class="col-input">
                <el-form-item prop="">
                  <el-date-picker
                    v-model="form.roomSelectionDate"
                    type="date"
                    placeholder="年月日"
                    value-format="yyyy-MM-dd"
                  />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="3" class="col-txt"><span>批次号</span></el-col>
              <el-col :span="9" class="col-input">
                <el-form-item prop="companyId">
                  <el-input v-model="form.batchNumber" />
                </el-form-item>
              </el-col>
              <el-col :span="3" class="col-txt"><span>选房号</span></el-col>
              <el-col :span="9" class="col-input">
                <el-form-item prop="companyId">
                  <el-input v-model="form.roomSelectionNumber" />
                </el-form-item>
              </el-col>
            </el-row>

          </el-card>
        </el-col>
      </el-row>
    </el-form>
    <div style="text-align: right">
      <el-button @click="cancel">取 消</el-button>
      <el-button type="primary" @click="confirmSubmit()">提 交</el-button>
    </div>

  </div>
</template>

<script>
import Base from '@/views/base/base'
import BaseData from '@/views/base/baseData'

export default {
    name: 'AddCustomer',
    components: { },
    mixins: [Base, BaseData],
    data() {
        return {
            dc_key: [],
            form: {},
            rules: {

            },
            addLoading: false
        }
    },
    mounted() {
    },
    methods: {
        initData(data) {
            this.initDict(this.dc_key).then(res => {

            })
        },

        confirmSubmit: function() {
            const _this = this
            this.$refs.form.validate(valid => {
                if (valid) {
                    const soaUrl = 'billAdd'
                    const extraData = {}
                    const postData = Object.assign({}, _this.form, extraData)
                    // this.opRecord(postData, soaUrl)
                    this.baseRequest(soaUrl, postData).then(res => {
                        if (res.data.code == '200') {
                            _this.$message({
                                message: '新增成功',
                                type: 'success'
                            })
                            _this.cancel()
                        }
                    }).catch(err => {
                        _this.$message({
                            message: err,
                            type: 'warning'
                        })
                    })
                } else {
                    console.log('error submit!!')
                    return false
                }
            })
        },
        cancel() {
            this.$emit('cancel')
        },
        baseRequest(opUrl, postData) {
            return this.$channel.globeRequest('BillManagementController', opUrl, postData, 'project')
        }

    }
}
</script>

<style scoped>

</style>
