<!--pages/electricQuery/index.wxml-->
<navigator title="用电查询" canBack="{{true}}" />
<view class="wrapper">
  <view class="queryWrapper">
    <view class="label">
      选择电表
    </view>
    <view class="select" bind:tap="clickMeter">
      <view class="selectContent">
        {{ meterAddress === "" ? '-' : meterAddress  }}
      </view>
      <van-icon name="arrow-down" />
    </view>
  </view>

  <view class="query">
    <view class="typeQuery">
      <van-row>
        <van-col span="8">
          <view class="typeQueryText" style="color: {{queryType === 0 ? '#0958d9' : '#000'}}" bind:tap="changeQueryType" data-type="{{0}}"> 电量查询 </view>
        </van-col>
        <van-col span="8">
          <view class="typeQueryText" style="color: {{queryType === 1 ? '#0958d9' : '#000'}}" bind:tap="changeQueryType" data-type="{{1}}"> 抄表记录 </view>
        </van-col>
        <van-col span="8">
          <view class="typeQueryText" style="color: {{queryType === 2 ? '#0958d9' : '#000'}}" bind:tap="changeQueryType" data-type="{{2}}"> 账务余额 </view>
        </van-col>
      </van-row>
    </view>
    <view class="timeQuery" wx:if="{{queryType === 0}}">
      <van-row>
        <van-col span="8">
          <view class="timeQueryText" style="color: {{timeType === 0 ? '#0958d9' : '#000'}}" bind:tap="changeTimeType" data-type="{{0}}"> 日耗量 </view>
        </van-col>
        <van-col span="8">
          <view class="timeQueryText" style="color: {{timeType === 1 ? '#0958d9' : '#000'}}" bind:tap="changeTimeType" data-type="{{1}}"> 月耗量 </view>
        </van-col>
        <van-col span="8">
          <view class="timeQueryText" style="color: {{timeType === 2 ? '#0958d9' : '#000'}}" bind:tap="changeTimeType" data-type="{{2}}"> 年耗量 </view>
        </van-col>
      </van-row>
    </view>
  </view>
  <view wx:if="{{queryType === 0}}">
    <view class="tooltip">
      不包括线损电量，显示为电表实际消耗电量。仅供参考，实际能耗电量以电费账单为主。如有疑问，请联系客服。
    </view>
    <view class="timeChooseWrapper">
      <view> 选择时间 </view>
      <view class="time" bind:tap="clickTime">
        <view class="timeText" wx:if="{{timeType === 0}}"> {{yearMonthDay}} </view>
        <view class="timeText" wx:elif="{{timeType === 1}}"> {{yearMonth}} </view>
        <view class="timeText" wx:else> {{year}} </view>
        <van-icon name="arrow-down" />
      </view>
      <!-- <van-button type="info" size="small" bind:click="export"> 导出 </van-button> -->
    </view>
  </view>
  <view wx:elif="{{queryType === 1}}">
    <!-- <view class="tooltip">
      显示为最新的一条抄表记录。电表更新数据有延迟，仅供参考，实际以电表上显示为准。
    </view> -->
  </view>
  <view wx:elif="{{queryType === 2}}">
    <view class="tooltip">
      账务余额更新时间为：每次预存电费后，每次账单发布后，剩余的实际金额。电表余额与账务余额相差较大的用户，每半年统一处理一次。
    </view>
  </view>
  
</view>
  <view wx:if="{{queryType === 0}}">
    <view style="margin: 30rpx;">
      <!-- <view wx:if="{{list.length}}">
        <table header="{{header}}" list="{{list}}"  />
        <pagination 
          currentIndex="{{page}}" 
          totalPage="{{totalPage}}" 
          bind:pagingChange="onChangePage"  
          wx:if="{{timeType === 0}}"
        />
      </view>
      <empty bind:refresh="init" wx:else /> -->
      
      <listTable 
        list="{{list}}" 
        header="{{header}}" 
        totalPage="{{totalPage}}" 
        wx:if="{{parkInfo.category !== 1}}"
      />
      <listTable 
        list="{{list}}" 
        header="{{valleyHeader}}" 
        totalPage="{{totalPage}}" 
        wx:if="{{parkInfo.category === 1}}"
      />
    </view>
    <view class="sum">
      合计：表计数量：{{meterNumber}}，耗电量：{{electricNumber}}
    </view>
  </view>
  <view wx:if="{{queryType === 1}}">
    <reading meter="{{meterId}}" parkInfo="{{parkInfo}}" />
  </view>
  <view wx:if="{{queryType === 2}}">
    <view style="margin: 30rpx;">
      <view wx:if="{{accountingList.length}}">      
        <accountingCard  wx:for="{{accountingList}}" data="{{item}}"  />
      </view>
      <empty bind:refresh="getAccountingBalanceList" wx:else />
    </view>
   
  </view>
  <echarts 
    style="width:200rpx;height:180rpx;" 
    id="echarts" 
    class='mychart-bar' 
    canvas-id="mychart-bar" 
    ec="{{ ec }}"    
    forceUseOldCanvas="{{false}}"
    wx:if="{{list.length && queryType === 0}}"
  >
  </echarts>
<custom-picker 
  title="{{title}}" 
  show="{{show}}" 
  valueKey="name" 
  columns="{{columns}}" 
  bind:ok="onOk" 
  bind:cancel="onCancel" 
  type="{{type}}" 
/>
<timePicker 
  type="{{timePickerType}}" 
  year="{{year}}" 
  month="{{yearMonthStamp}}" 
  day="{{yearMonthDayStamp}}" 
  show="{{visible}}" 
  bind:cancel="onTimeCancel" 
  bind:close="onTimeClose" 
  bind:confirm="onTimeConfirm" 
/>

