<template>
    <view>
        <view class="record-content">
            <view v-if="list.length>0">
                <view class="bg-white border-bottom-1 pos-rel"  v-for="(i, index) in list" @click="payClick(i,index)">

                    <view class="recordCon uni-list-cell-pd">
                        <text class="color-black">{{i.invoiceBigType=='100'?'停车':i.invoiceBigType=='200'?'充值':'会员卡'}}</text>
                        <!--发票状态，1 待开票，3已开票 2 已邮寄 4已下载（这是开票接口的过渡状态，给用户展示已开票）-->
                        <text v-if="i.invoiceState==1">待开票</text>
                        <text v-else-if="i.invoiceState==2">已邮寄 </text>
                        <text v-else-if="i.invoiceState==3">已开票</text>
                        <text v-else>已下载</text>
                    </view>
                    <view class="recordCon uni-list-cell-pd">
                        <!--<text>{{$common.formatDate(new Date(i.custInvoiceHisDetailDTOList[0].orderDate * 1000),'yyyy-MM-dd hh:mm')}}</text>-->
                        <text>{{$common.formatDate(i.custInvoiceHisDetailDTOList[0].orderDate)}}</text>
                        <text>￥{{(i.invoiceTotalFee/100).toFixed(2)}}</text>

                    </view>
                    <view class="uni-icon pos-abs icon-arrowright uni-icon-arrowright">
                    </view>
                </view>
            </view>

            <!--<view style="padding: 30px;text-align: center" v-else>暂无记录！</view>-->

            <view class="novipcard_Mid" style="padding-top: 20px;" v-else>
                <image class="novipcard" :src="noIcon" mode="aspectFit"></image>
                <view class="novipcard_txt">
                    暂无记录
                </view>

            </view>


        </view>
    </view>
</template>

<script>
export default {
  data() {
    return {
      list:[],
      noIcon:require('static/vipcard/novipcard.png'),
    }
  },
  onShow(){
    this.queryCustInvoiceHistoryList()
  },
  methods: {
    queryCustInvoiceHistoryList() {

      var queryCustInvoiceHistoryList = this.$common.queryCustInvoiceHistoryList;
      var jsondata = {};
      uni.request({
        url: queryCustInvoiceHistoryList,
        data: JSON.stringify(this.$common.requestSign(jsondata)),
        dataType: "json",
        method: "POST",
        success: (res) => {
          if (res.data.code == 0) {
            this.list = res.data.data
            console.log(this.list)
          }
        }
      })
    },
    payClick(i,index) {
      console.log(index)
      uni.navigateTo({
        url: '../invoiceForm/invoiceForm?custEmail='+i.custEmail+'&invoiceId='+i.invoiceId+'&index='+index+'&len='+i.custInvoiceHisDetailDTOList.length
      });
    },
  }
}
</script>

<style lang="scss">
    .icon-arrowright {
        color: #bbb;
        font-size: 20px;
        right: 2upx;
        top: 60upx;
    }
</style>
