<template>
  <div class="dialog">
      <div class="dialog-content">
          <van-image src="@/assets/tip.png" width="70px" height="70px"></van-image>
          <div class="title">是否确定删除该存证？</div>
          <div class="desc">已删除的存证，在“<span style="color:#3F79FE;">回收站</span>”里</div>
          <van-button 
            block
            color="#3F79FE" 
            style="margin-top:25px;" 
            type="primary" @click="handleAction('confirm');
            ">确定删除</van-button>
          <span class="close" @click="handleAction('cancel')">×</span>
      </div>
  </div>
</template>

<script lang="ts">
import { Component, Prop, Vue, Emit } from 'vue-property-decorator';
import { Icon, Image, Button } from 'vant';
@Component({
  name: 'Dialog',
  components: {
    [Icon.name]: Icon,
    [Image.name]: Image,
    [Button.name]: Button,
  },
})
export default class Dialog extends Vue {
    @Prop( {
    })private callback!: any;
    @Prop( {
    })private close!: any;
    private handleAction(action: string) {
      this.$emit(action);
      this.onClose(action);
    }
    private onClose(action: string) {
      this.close();
      if (this.callback) {
          this.callback(action);
      }
    }
}
</script>
<style scoped lang="scss">
  .dialog{
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.6);
    &-content{
      position: relative;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      width: 70%;
      padding: 19px 31px;
      border-radius: 6px;
      background: #FFFFFF;
      .title{
        font-size:18px;
        font-weight:400;
        color:rgba(53,53,53,1);
      }
      .desc{
        font-size:12px;
        font-weight:400;
        color:rgba(182,181,186,1);
      }
      .close{
        position: absolute;
        right: 20px;
        top: 10px;
        display: inline-block;
        width: 14px;
        height: 14px;
        font-size: 30px;
        color: #999999;
      }
    }
  }
</style>
