<template>
  <div id="search-1">
    <el-row>
      <el-col :span="24" class="main">
        <el-form :model="form" ref="form" label-width="130px">
          <!-- <el-col :span="6">
            <el-form-item label="店铺名称" prop="type">
              <el-select
                v-model="form.shop"
                filterable
                remote
                reserve-keyword
                placeholder="请输入商铺名称"
                :remote-method="querySearch"
                :loading="loading"
                @change="handleSelect"
              >
                <el-option v-for="item in shopList" :key="item.id" :label="item.name" :value="item.id"> </el-option>
              </el-select>
            </el-form-item>
          </el-col> -->
          <el-col :span="6">
            <el-form-item label="套装名称" prop="name">
              <el-input v-model="form.name" placeholder="请输入优惠券名称" size="small"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="24" class="btn">
            <el-button type="primary" icon="el-icon-search" size="mini" @click="onSubmit('form')">搜索</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="toReset('form')">重置</el-button>
          </el-col>
        </el-form>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { mapState, createNamespacedHelpers } from 'vuex';
export default {
  name: 'search-1',
  props: {
    form: { type: Object },
    statusList: { type: Array },
    shopList: { type: Array },
    discount_typeList: { type: Array },
  },
  components: {},
  data: function () {
    return {
      loading: false,
    };
  },
  created() {},
  methods: {
    querySearch(value) {
      this.loading = true;
      this.$emit('querySearch', value);
      this.loading = false;
    },
    handleSelect(value) {
      this.$set(this.form, `shop`, value);
    },
    onSubmit() {
      this.$emit('onSubmit');
    },
    toReset(formName) {
      this.$refs[formName].resetFields();
      this.$emit('toReset');
    },
  },
  computed: {},
  metaInfo() {
    return { title: this.$route.meta.title };
  },
  watch: {
    test: {
      deep: true,
      immediate: true,
      handler(val) {},
    },
  },
};
</script>

<style lang="less" scoped>
.main {
  .btn {
    text-align: right;
  }
  /deep/.el-form-item {
    float: left;
    width: 100%;
    margin: 0 0 10px 0;
  }
}
</style>
