<template>
    <view>
        <MBLoading v-if="loading" />
        <uni-card
            v-for="item in invoiceList"
            :key="item.id"
            :title="item.invoicenum || '发票号'"
        >
            <view class="context">
               
                <view class="label">
                    <text>发票金额:</text>
                    <text>{{ formatPrice(item.invoicevalue) }}</text>
                </view>
                <view class="label">
                    <text>开票日期:</text>
                    <text>{{ item.adddate }}</text>
                </view>
                <view class="label">
                    <text>快递单号:</text>
                    <text>{{ item.waybillnumber }}</text>
                </view>
                <view class="label">
                    <text>发票类型:</text>
                    <text>{{ item.billtypestr }}</text>
                </view>
                <view class="label">
                    <text>开票类型:</text>
                    <text>{{ item.billtype2str }}</text>
                </view>
                <view class="label">
                    <text style="min-width: 60px;">发票链接:</text>
					<text
						class="linka" 
						v-if="item.invoicefile"
						@click="YuLanfile(item.invoicefile)"
					>
						{{ item.invoicefile.split('\\').pop() }}
					</text>
					<!-- <text class="linka">
						<a href="javascript:void(0)" 
						v-if="item.invoicefile" 
						@click="YuLanfile(item.invoicefile)">
						{{ item.invoicefile.split('\\').pop() }}
						</a>
					</text> -->
                </view>
                <view class="label">
                    <text>pdf链接:</text>
					<text
						class="linka" 
						v-if="item.pdf"
						@click="YuLanfile(item.pdf)"
					>
						{{ item.pdf.split('.').pop() }}
					</text>
                    <!-- <text>{{ item.pdf }}</text> -->
                </view>
				<view class="label">
				    <text>xml链接:</text>
					<text
						class="linka" 
						v-if="item.xml"
						@click="YuLanfile(item.xml)"
					>
						{{ item.xml.split('.').pop() }}
					</text>
				    <!-- <text>{{ item.xml }}</text> -->
				</view>
				<view class="label">
				    <text>ofd链接:</text>
					<text
						class="linka" 
						v-if="item.ofd"
						@click="YuLanfile(item.ofd)"
					>
						{{ item.ofd.split('.').pop() }}
					</text>
				    <!-- <text>{{ item.ofd }}</text> -->
				</view>
				<view class="label">
				    <text>状态:</text>
				    <text>{{ item.stateText }}</text>
				</view>
            </view>
        </uni-card>
        <view v-if="!invoiceList || invoiceList.length === 0" class="empty-data">
            <text>暂无发票信息</text>
        </view>
    </view>
</template>

<script setup>
import { defineProps } from 'vue'
import { formatPrice,YuLanfile } from "@/utils/utils.js";
import { formatDate } from "@/uni_modules/uni-dateformat/components/uni-dateformat/date-format";
import MBLoading from "@/components/MB/MBLoading.vue";

const props = defineProps({
    invoiceList: {
        type: Array,
        default: () => []
    },
    loading: {
        type: Boolean,
        default: false
    }
})
</script>

<style scoped>
	.linka{
		color: #409eff;
		text-decoration: underline;
	}
	a, a:focus, a:hover{
	    color: #409eff;
	    text-decoration: underline;
	}
.context {
    font-size: 14px;
}
.context .label {
    font-size: 14px;
}
.empty-data {
    text-align: center;
    padding: 30px;
    color: #999;
    font-size: 14px;
}
</style>