<template>
  <div id="form-1">
    <van-row>
      <van-col span="24" class="main">
        <van-col :span="24" class="one">
          <van-form @submit="onSubmit" @reset="onReset">
            <van-field
              v-model="form.describe"
              name="describe"
              label="需求描述(用途)"
              placeholder="需求描述(用途)"
              type="textarea"
              autosize
              :rules="[{ required: true, message: '请填写需求描述(用途)' }]"
            />
            <van-field name="urgent" label="紧急程度" :rules="[{ required: true, message: '请选择紧急程度' }]">
              <template #input>
                <van-radio-group v-model="form.urgent" direction="horizontal">
                  <van-radio name="特急">特急</van-radio>
                  <van-radio name="一般">一般</van-radio>
                  <van-radio name="长期">长期</van-radio>
                </van-radio-group>
              </template>
            </van-field>
            <van-field v-model="form.contact" name="contact" label="联系人" placeholder="联系人" :rules="[{ required: true, message: '请填写联系人' }]" />
            <van-field v-model="form.phone" name="phone" label="联系电话" placeholder="联系电话" :rules="[{ required: true, message: '请填写联系电话' }]" />
            <van-field v-model="form.email" name="email" label="电子邮箱" placeholder="电子邮箱" :rules="[{ required: true, message: '请填写电子邮箱' }]" />
            <van-field
              v-model="form.requirement"
              name="requirement"
              label="合作条件及要求"
              placeholder="合作条件及要求"
              type="textarea"
              autosize
              :rules="[{ required: true, message: '请填写合作条件及要求' }]"
            />
            <div class="btn">
              <van-button type="danger" size="small" native-type="reset">重置信息</van-button>
              <van-button type="info" size="small" native-type="submit">提交信息</van-button>
            </div>
          </van-form>
        </van-col>
      </van-col>
    </van-row>
  </div>
</template>

<script>
import { mapState, createNamespacedHelpers } from 'vuex';
export default {
  name: 'form-1',
  props: {
    form: { type: Object },
  },
  components: {},
  data: function () {
    return {};
  },
  created() {},
  methods: {
    onSubmit(values) {
      this.$emit('onSubmit', values);
      console.log();
    },
    onReset() {
      console.log('1');
    },
  },
  computed: {
    ...mapState(['user']),
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
  watch: {
    test: {
      deep: true,
      immediate: true,
      handler(val) {},
    },
  },
};
</script>

<style lang="less" scoped>
.main {
  .one {
    .btn {
      text-align: center;
      margin: 10px 0;
      .van-button {
        margin: 0 10px;
      }
    }
  }
}
</style>
