<!--pages/readingHistory/index.wxml-->
<navigator title="历史抄表记录" canBack="{{true}}" />
<view class="wrapper">
    <meterInfo meterInfo="{{meterInfo}}" />
    <view class="historyTitle">
        <view class="text">
            抄表记录历史
        </view>
        <van-button type="info" size="small" icon="plus" bind:tap="handleCreate"> 新增记录 </van-button>
    </view>
    <view>
        <view wx:if="{{list.length}}">
            <view class="tableWrapper">
                <view class="table">
                    <view class="thead">
                        <view class="th" style="width: 40%; text-align: center;"> 抄表时间 </view>
                        <view class="th" style="width: 35%; text-align: center;"> 抄表读数 </view>
                        <view class="th" style="width: 25%; text-align: center;"> 操作 </view>
                    </view>
                    <view class="tbody">
                        <view wx:for="{{list}}" wx:for-index="itemIndex" wx:key="item">
                            <view class="tr" style="display: flex; align-items: center; ">
                                <view class="th" style="width: 40%; text-align: center; font-size: 30rpx;">
                                    {{ item.readAt }}
                                </view>
                                <view class="th" style="width: 35%; text-align: center; font-size: 30rpx;">
                                    {{ item.overall }}
                                </view>
    
                                <view class="th" style="width: 25%; text-align: center; justify-content: center; display: flex; align-items: center;">
                                    <van-icon name="edit" size="40rpx" bind:tap="handleUpdate"  data-data="{{item}}" color="#15755e" />
                                    <van-icon name="delete" size="40rpx" bind:tap="handleDelete" data-data="{{item}}" color="#15755e" custom-style="margin-left: 20rpx" />
                                </view>
                            </view>
                        </view>
                    </view>
                </view>
            </view>

            <pagination currentIndex="{{page}}" totalPage="{{totalPage}}" bind:pagingChange="onChangePage" />

        </view>
        <empty bind:refresh="refresh" wx:else />

    </view>
</view>

<editModal 
    wx:if="{{visible}}"
    title="{{title}}" 
    visible="{{visible}}" 
    timeProps="{{time}}" 
    timeStamp="{{readAtTimestamp}}"
    numberProps="{{number}}" 
    idProps="{{id}}" 
    park="{{park}}"
    meter="{{meter}}" 
    bind:ok="onEditFinish"   
    startTime="{{startTime}}"
/>