<template>
    <view>
        <view v-if="'' == invoice_info.is_company" class="no_content">
            <image class="img" src="/static/images/ui/none.png" />
            <view class="warn">您目前还没有添加任何发票抬头信息</view>
        </view>
        <view class="_container" v-else>
            <view class="nav" :data-current_item="invoice_info" @tap="_edit">
                {{ invoice_info.invoice_title }}
                <image src="/static/images/ui/right1.png" />
            </view>
        </view>
        <button class="_button" @tap="_new">新建发票信息</button>
    </view>
</template>

<script>
// pages/user/invoice/invoice_edit/invoice_edit.js
import { http } from '../../../../utils/util';
export default {
    data() {
        return {
            show: false,

            invoice_info: {
                is_company: ''
            }
        };
    }
    /**
     * 生命周期函数--监听页面加载
     */,
    onLoad: function (options) {
        http('/api/v1/invoice-title', 'post').then((res) => {
            this.setData({
                invoice_info: res
            });
        });
    },
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {},
    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {},
    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {},
    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {},
    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {},
    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {},
    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {},
    methods: {
        _edit: function (e) {
            uni.navigateTo({
                url: '/pages/user/invoice/invoice_edit/invoice_edit_content?current_item=' + JSON.stringify(e.currentTarget.dataset.current_item)
            });
        },

        _new() {
            uni.navigateTo({
                url: '/pages/user/invoice/invoice_edit/invoice_edit_newMake'
            });
        }
    }
};
</script>
<style>
.no_content_warning {
    position: fixed;
    top: 30%;
    width: 100%;
    text-align: center;
    color: #999;
}
._container {
    margin: 20rpx 0;
}
._container .nav {
    background: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30rpx;
    font-size: 28rpx;
}
._container .nav image {
    width: 26rpx;
    height: 26rpx;
    margin-right: 12rpx;
}
._button {
    position: fixed;
    bottom: 100rpx;
    width: 312rpx;
    background: linear-gradient(90deg, #ff4284 0%, #ff1d42 100%);
    border-radius: 44rpx;
    color: #fff;
    font-size: 28rpx;
    left: 50%;
    transform: translate(-50%, 0);
}
</style>
