<template>
  <div class="midPopUp" @click="handleClose" v-if="showStatus">
    <div class="container" @click.stop>
      <div class="headerTittle">{{ title }}</div>
      <ScanCodeInput v-model="inputValueC" @keyup.enter="handleSubmit" />
      <div class="bottomBtn">
        <el-button class="leftBtn" @click="handleClose">关闭</el-button>
        <el-button class="rightBtn" @click="handleSubmit" type="primary"
          >确定</el-button
        >
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import ScanCodeInput from "@/components/ScanCodeInput/index.vue";
const props = defineProps({
  title: {
    type: String,
  },
  showStatus: {
    type: Boolean,
    default: false,
  },
  inputValue: {
    type: String,
  },
});
const boxInfoData = ref({});
provide("boxInfoData", boxInfoData);
const emits = defineEmits(["submit", "update:showStatus", "update:inputValue"]);
const handleClose = () => {
  emits("update:inputValue", "");
  emits("update:showStatus", false);
};

const inputValueC = computed({
  get() {
    return props.inputValue;
  },
  set(val) {
    emits("update:inputValue", val);
  },
});
const handleSubmit = () => {
  emits("submit");
  emits("update:inputValue", "");
};
</script>

<style lang="scss" scoped>
.midPopUp {
  z-index: 4;
}

.container {
  background-color: #f1f3f5;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 300px;
  padding: 20px 40px;
}

.infoBox {
  width: 100%;
  height: 80px;
  background-color: white;
  border-radius: 16px;
  margin-bottom: $p10;
}

.bottomBtn {
  width: 100%;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: $p10 10% 0 10%;

  .leftBtn {
    height: 55px;
    width: 45%;
    border-radius: 16px;
    font-size: $f20;
    color: black;
    background-color: #00000015;
    border: 0px;
  }

  .rightBtn {
    height: 55px;
    width: 45%;
    border-radius: 16px;
    font-size: $f20;
    color: white;
  }
}
</style>
