移动系统liao
2025-02-17 557c2711a3e103ebc3d0492344eca9730d5e92b2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<template>
    <view>
        <u-toast ref="uToast" /><u-no-network></u-no-network>
        <u-navbar title="我的发票" safeAreaInsetTop fixed placeholder>
            <view class="coreshop-navbar-left-slot" slot="left">
                <u-icon name="arrow-left" size="19" @click="goNavigateBack"></u-icon>
                <u-line direction="column" :hairline="false" length="16" margin="0 8px"></u-line>
                <u-icon name="home" size="22" @click="goHome"></u-icon>
            </view>
            <view slot="right">
            </view>
        </u-navbar>
        <block v-if="listData.length > 0">
            <view class="invoiceBox" v-for="(item, index) in listData" :key="index">
                <view class="invoiceLeft">
                    <image src="/static/images/common/invoice.png" class="leftIco"></image>
                </view>
                <view class="invoiceRight">
                    <view class="invoiceAmount coreshop-flex coreshop-justify-between"><text class="coreshop-text-price coreshop-text-red">{{item.amount}}</text> <text :class="item.status == 1?'status_no':'status_yes'">{{item.statusName || ''}}</text></view>
                    <view class="invoiceTitle">发票抬头:{{item.title || ''}}</view>
                    <view class="invoiceTaxNumber" v-if="item.taxNumber">发票税号:{{item.taxNumber}}</view>
                    <view class="invoiceDescription">开票备注:{{item.remarks || ''}}</view>
 
                    <view class="invoiceTime  coreshop-flex coreshop-justify-between">{{item.createTime}} <text class="coreshop-text-grey">{{item.typeName || ''}}</text></view>
                </view>
            </view>
            <u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" margin-top="20" margin-bottom="20" />
        </block>
        <!-- 无数据时默认显示 -->
        <view class="coreshop-emptybox" v-else>
            <u-empty :icon="$globalConstVars.apiFilesUrl+'/static/images/empty/coupon.png'" icon-size="150" text="暂无发票明细" mode="list"></u-empty>
        </view>
    </view>
 
</template>
 
<script>
    export default {
        data() {
            return {
                id: 0,
                page: 1,
                limit: 10,
                listData: [],
                status: 'loadmore',
                iconType: 'flower',
                loadText: {
                    loadmore: '轻轻上拉',
                    loading: '努力加载中',
                    nomore: '实在没有了'
                }
            }
        },
        onLoad(e) {
            if (e.id) {
                this.id = e.id;
            }
            this.getData();
        },
        onReachBottom() {
            if (this.status === 'loadmore') {
                this.getData();
            }
        },
        methods: {
            //获取我的发票列表
            getData() {
                this.status = 'loading'
                let data = {
                    page: this.page,
                    limit: this.limit
                }
                if (this.id != 0) {
                    data.id = this.id;
                }
                this.$u.api.myInvoiceList(data).then(res => {
                    if (res.status) {
                        let newList = this.listData.concat(res.data);
                        this.listData = newList;
 
                        if (res.otherData.totalPages > this.listData.length) {
                            this.page++
                            this.status = 'loadmore'
                        } else {
                            this.status = 'noMore'
                        }
                    } else {
                        this.$u.toast(res.msg);
                    }
                });
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    @import "index.scss";
</style>