<!--pages/writeReading/components/readingInfo/index.wxml-->

<view class="wrapper">
    <view class="bodyTitle">
        <view class="text">
            <!-- 电表数据记录器 -->
        </view>
        <view class="time" bind:tap="jumpToHistory">
            <!-- 2025年9月5日 -->
            历史记录
        </view>
    </view>
    <view class="contentWrapper">
        <view class="currentMeter">
            <view class="text">
                当前电表
            </view>
            <view class="address">
                {{meterInfo.address}}
            </view>
        </view>
        <view class="change">
            <van-button wx:if="{{showLeft}}" type="info" size="small" bind:click="handlePrev"> 
                <van-icon name="arrow-left" /> 
                上一块
            </van-button>
            <view wx:else></view>
            <van-button wx:if="{{showRight}}" type="info" size="small" bind:click="handleNext">
                下一块 
                <van-icon name="arrow" /> 
            </van-button>
            <view wx:else></view>
        </view>
        <van-divider />
        <view class="readingNumber">
            <view class="lastNumber">
                <view class="title">
                    上次表字
                </view>
                <view class="number">
                    {{meterInfo.overall}}
                </view>
            </view>
            <view class="lastTime">
                {{meterInfo.readAt}}
            </view>
        </view>
        <view class="nextReadingNumber">
            <view class="currentNumber">
                <view class="title">
                    本次表字
                </view>
          
                <view class="number">
                    <van-field
                        value="{{currentNumber}}"
                        placeholder="请输入本次读数"
                        bind:change="onChange"
                        border="{{false}}"
                        custom-style="border: 1rpx solid #ccc; padding: 2px 14rpx; font-size: 32rpx; border-radius: 10rpx;"
                    />
                </view>
            </view>
            <!-- <view class="photo">
                <photo />
            </view> -->
        </view>
        <view class="calc">
            <view class="title">
                表字差
            </view>
            <view class="rightNumber" wx:if="{{currentNumber - meterInfo.overall >= 0}}">
                {{(currentNumber || 0) - meterInfo.overall}}
            </view>
            <view class="wrongNumber" wx:else>
                {{(currentNumber || 0) - meterInfo.overall}}
            </view>
        </view>
        <view class="operate">
            <view style="flex: 1;">
                <van-button size="small"  type="info" block bind:click="handleCreateReading"> 确定录入 </van-button>
            </view>
            <view style="flex: 1; margin-left: 20rpx;">
                <van-button size="small" block bind:click="handleClear"> 清除记录 </van-button>
            </view>     
        </view>
    </view>
   
</view>
<view style="height: 10rpx;"></view>
