<script setup lang="ts">
import Panel from '../common/Panel.vue';
import {defineEmits, defineModel, defineProps} from 'vue'
import {ElMessageBox} from "element-plus";

const {status} = defineProps(['status'])
const emit = defineEmits(['save', 'deleteItem', 'openCheckOut', "openSettlement", "print", "refund"]);
const save = () => {
  emit('save');
};
const deleteItem = () => {
  emit('deleteItem');
};
const totalAmount = defineModel<any>()
const openCheckOut = () => {
  emit('openCheckOut');
};
const openSettlement = () => {
  emit('openSettlement')
}
const refund = () => {
  ElMessageBox.confirm(
      '退款后不能撤销，确定要继续退款吗?',
      'Warning',
      {
        confirmButtonText: '继续退款',
        cancelButtonText: '取消',
        type: 'warning',
      }
  )
      .then(() => {
        emit('refund')
      })

}
const print = () => {
  emit('print')
}
</script>

<template>
  <Panel :showTools="false" :showHeader="false">
    <div class="footer">
      <div>总金额：<span class="text icon">￥</span><span class="text">{{ totalAmount || '0' }}</span></div>
      <div class="btn-group">
        <span class="default-btn" @click="openCheckOut" v-if="status ==0">追溯码</span>
        <span class="default-btn" @click="openSettlement" style="margin-left: 24px" v-if="status ==0">收费</span>
        <span class="default-btn" @click="print" v-if="status ==1">打印</span>
        <span class="default-btn" @click="refund" style="margin-left: 24px" v-if="status ==1">退费</span>
      </div>
    </div>
  </Panel>
</template>
<style scoped lang="scss">
.footer {
  height: 86px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 400;
  font-size: 22px;
  color: #333333;
  font-style: normal;
  padding: 0 24px 0 24px;

  .icon {
    font-size: 16px;
  }

  .text {
    color: #FF282E
  }
}

.btn-group {
  span {
    display: inline-block;
    width: 119px;
  }
}
</style>