<template>
  <div class="Search">
    <el-form :inline="true" :model="formInline" class="demo-form-inline">
      <el-form-item label="酒名/用户昵称">
        <el-input v-model="formInline.key" placeholder="请输入酒名/用户昵称" clearable />
      </el-form-item>
      <!-- <el-form-item label="手机号">
        <el-input v-model="formInline.phone" placeholder="请输入手机号" clearable />
      </el-form-item> -->
      <el-form-item label="状态">
        <el-select v-model="formInline.status" placeholder="请选择状态" clearable>
          <el-option label="全部" value="" />
          <el-option label="已取完" value="0" />
          <el-option label="储存中" value="1" />
          <el-option label="已过期" value="2" />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="Search" @click="onSubmit">搜索</el-button>
        <el-button icon="Refresh" @click="reset">重置</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script setup>
import eventBus from '@/utils/eventBus'
const formInline = reactive({
  key: '',
  phone: '',
  status: '',
})
const onSubmit = () => {
  eventBus.emit('search', formInline)
}
const reset = () => {
  for (let key in formInline) {
    formInline[key] = ''
  }
  eventBus.emit('search', formInline)
}
</script>

<style scoped lang="scss">
.Search {
  padding: 20px;
  background-color: #fff;
  border: 1px solid #e4e7ed;
  border-radius: 4px;
}

.demo-form-inline .el-input {
  --el-input-width: 220px;
}

.demo-form-inline .el-select {
  --el-select-width: 220px;
}
</style>
