<script setup>
import { ref, watch, onMounted, computed } from 'vue'
import { normal, zengzhi } from './invoice'
import edit from './edit'

</script>
<template>
  <div class="i-lay">
    <template v-if="isShow">
      <p v-if="!data.type">{{$t('manage.myOrders.dontneed')}}</p>
      <template v-else>
        <p v-for="(item,i) in invoiceData" :key="i">{{item['name']+'：'+(data[item['key']]||'--')}}</p>
      </template>
    </template>
    <!-- <edit v-else :data='data' :orderId='orderId' :invoiceId="invoiceId"/> -->
  </div>
</template>

<script>
import { mapState } from 'vuex'
import { normal, zengzhi } from './invoice'
import edit from './edit'
export default {
  props: ['data', 'orderId', 'invoiceId'],
  components: {
    edit
  },
  mounted () {
    // this.$bus.$on('isOrderInvoice', data => {
    //   this.isShow = data
    // })
  },
  computed: {
    ...mapState({
      token: state => state.user.token,
      language: state => state.language.current
    }),
    invoiceData () {
      if (!this.data) {
        return ''
      }
      return this.data.type === 2 ? normal : zengzhi
    },
    isShow () {
      return this.$parent.showInvoice
    }
  },
  data () {
    return {
    }
  }
}
</script>

<style lang="scss" scoped>
.i-lay{
  p{
    color: #a0a0a0;
    margin: 10px 0;

  }
}
</style>
