<template>
  <el-dialog title="退菜" width="410px" :visible.sync="show" @close="reset">
    <div>
      <div><span>退菜原因</span> <span class="color-red">*</span></div>
    </div>

    <div class="u-flex u-flex-wrap tags">
      <div
        class="tag"
        v-for="(tag, index) in tags"
        @click="changeSel(tag)"
        :key="index"
        :class="{ active: tag.checked }"
      >
        {{ tag.label }}
      </div>
    </div>
    <div class="u-m-t-20">
      <el-input
        v-model="note"
        size="medium"
        placeholder="请输入自定义备注"
      ></el-input>
    </div>
    <div class="u-m-t-20">
      <el-checkbox v-model="isPrint" 
        >打印退菜单</el-checkbox
      >
    </div>
    <div slot="footer">
      <el-button size="medium" @click="close"> 取消 </el-button>
      <el-button size="medium" type="primary" @click="confirm">确定</el-button>
    </div>
  </el-dialog>
</template>
  <script>
export default {
  data() {
    return {
        isPrint:false,
      tagSel: -1,
      show: false,
      tags: [{label:"不想要了",checked:false} ,{label:"食材不足",checked:false} ,{label:"等待时间过长",checked:false}],
      note: "",
    };
  },

  methods: {
    changeSel(item) {
      item.checked = !item.checked ;
    },
    reset() {
      this.note = "";
    },
    delTag(index) {
      this.tags.splice(index, 1);
    },
    addNote(tag) {
      if (this.note.length <= 0) {
        return (this.note = tag);
      }
      this.note = tag + "," + this.note;
    },
    open(note) {
      this.show = true;
    },
    close() {
      this.show = false;
    },
    confirm() {
      this.$emit("confirm", this.note);
      this.close();
    },
  },
  mounted() {},
};
</script>
  
  <style lang="scss" scoped>
::v-deep .el-dialog__body {
  margin-bottom: 14px;
  margin-top: 14px;
}
::v-deep .el-tag {
  margin-top: 10px;
  margin-right: 10px;
  margin-bottom: 5px;
  cursor: pointer;
  font-size: 15px;
  line-height: 35px;
  height: 35px;
}
.tags {
  .tag {
    margin: 10px 10px 0 0;
    border: 1px solid #dcdfe6;
    border-radius: 4px;
    padding: 10px 13px;
    font-size: 14px;
    color: #000;
    cursor: pointer;
    &.active {
      color: #1890ff;
      background: #e8f4ff;
      border-color: #a3d3ff;
    }
  }
}
</style>