<script setup>
import { reactive, ref, computed } from "vue";

const props = defineProps({
  show: {
    type: Boolean,
    default: false,
  },
});

const emit = defineEmits(["update:show", "reload"]);

const showDialog = computed({
  get: () => props.show,
  set: (value) => {
    emit("update:show", value);
  },
});

const dialogFormVisible = ref(false);
const formLabelWidth = "140px";

const form = reactive({
  name: "",
  region: "",
  date1: "",
  date2: "",
  delivery: false,
  type: [],
  resource: "",
  desc: "",
});
</script>

<template>
  <el-dialog v-model="showDialog" title="發放優惠劵">
    <el-form :model="form">
      <el-form-item label="發放模式" :label-width="formLabelWidth">
        <el-radio-group v-model="radio1" class="ml-4">
          <el-radio label="1" size="large">相同序號</el-radio>
          <el-radio label="2" size="large">不同序號</el-radio>
        </el-radio-group>
      </el-form-item>

      <el-form-item label="發放數量" :label-width="formLabelWidth">
        <el-input v-model="form.name" autocomplete="off" />
      </el-form-item>
    </el-form>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="showDialog = false">取消</el-button>
        <el-button type="primary" @click="showDialog = false">
          確定
        </el-button>
      </span>
    </template>
  </el-dialog>
</template>

<style lang="less" scoped>
.el-button--text {
  margin-right: 15px;
}
.el-input {
  width: 300px;
}
.dialog-footer button:first-child {
  margin-right: 10px;
}
</style>
