<!--pages/workBench/components/tenement/index.wxml-->
<view>
    <searchSelectWrapper 
        label="园区"
        placeholder="请选择园区"
        text="{{ parkName }}"
        bind:search="onParkFocus"
    />
    <searchSelectWrapper 
        label="商户"
        placeholder="请选择商户"
        text="{{ tenementName }}"
        bind:search="onTenementFocus"
    />
</view>
<view style="display: flex; align-items: center;margin: 20rpx">
    <view wx:if="{{tenement}}">
        <van-button 
            style="margin-right: 20rpx;"  
            type="info" 
            size="small" 
            bind:click="startBind"
        > 绑定电表 </van-button>
        <van-button 
            style="margin-right: 20rpx;" 
            type="info" 
            size="small" 
            bind:tap="startUpdateInfo"
        > 修改信息 </van-button>
    </view>
    <van-button type="info" size="small" bind:click="startKh" wx:if="{{!!park}}"> 开户 </van-button>
</view>
<van-empty wx:if="{{!tenement}}" description="选择园区和商户后查看" />
<view wx:else>
    <view class="customTable">
        <view class="customTableTile">
            <van-row>
                <van-col span="24">
                    <view class="tableTitleRow">
                        <view class="tbody">
                            <view class="tr">
                                <view style="width: 250rpx;text-align: center;"> {{tenementInfo.shortName}} </view>
                                <view> {{tenementInfo.fullName}} </view>
                            </view>
                            <view class="tr">
                                <view wx:if="{{tenementInfo.feeType === 0}}" class="th" style="width: 250rpx;text-align: center;"> 华昌宝能收费 </view>
                                <view wx:if="{{tenementInfo.feeType === 1}}" class="th" style="width: 250rpx;text-align: center;"> 物业代收1 </view>
                                <view wx:if="{{tenementInfo.feeType === 2}}" class="th" style="width: 250rpx;text-align: center;"> 物业代收2 </view>
                                <view wx:if="{{tenementInfo.feeType === 3}}" class="th" style="width: 250rpx;text-align: center;"> 物业代收线损 </view>
                                <view> {{tenementInfo.contact}} {{tenementInfo.phone}} </view>
                            </view>
                        </view>
                    </view>
                </van-col>
               

                        <!-- <van-row gutter="5">
                            <van-col span="8"> 
                                <view style="text-align: center;"> 华昌宝能收费 </view> </van-col>
                            <van-col span="8" wx:elif="{{tenementInfo.feeType === 1}}"> 
                                <view style="text-align: center;"> 物业代收1 </view> </van-col>
                            <van-col span="8" wx:elif="{{tenementInfo.feeType === 2}}"> 
                                <view style="text-align: center;"> 物业代收2 </view>  </van-col>
                            <van-col span="8" wx:else> <view style="text-align: center;"> 物业代收线损 </view> </van-col>
                            <van-col span="16">{{tenementInfo.contact}} {{tenementInfo.phone}} </van-col>
                        </van-row> -->
            
     
            </van-row>
        </view>
        <view class="customTableContent">
       
            <van-row>
                <van-radio-group value="{{ record }}" bind:change="onChangeSelectRecharge">
                    <block wx:for="{{meterList}}" wx:for-index="itemIndex" wx:key="item">
                        <view class="tbody">
                            <view class="tr tableRow">
                                <view class="th" style="width: 250rpx;padding-right: 16rpx;box-sizing: border-box;border-right: 1rpx solid #ccc;"> {{ item.address }} </view>
                                <view class="th" style="width: 250rpx;padding-right: 16rpx;box-sizing: border-box;border-right: 1rpx solid #ccc;"> {{ item.meterSn }} </view>
                                <view class="th" style="width: 200rpx">
                                    <view 
                                        class="primaryTextBtn" 
                                        bind:tap="unbind" 
                                        data-id="{{item.meterId}}" 
                                        data-address="{{item.address}}"
                                    >
                                        解绑
                                    </view>
                                </view>
                            </view>
                        </view>
                    </block>
                </van-radio-group>
            </van-row>
        </view>
    </view>
</view>
<search-select 
    show="{{show}}" 
    title="{{title}}" 
    type="{{type}}" 
    park="{{park}}"
    isBack="{{true}}"
    bindconfirm="onConfirm"
    bindcancel="onCancel"
/>
<kaihu 
    wx:if="{{kaihuVisible}}"
    park="{{park}}" 
    visible="{{kaihuVisible}}" 
    defaultValue="{{defaultValue}}" 
    bind:close="onKaihuClose"
    bind:ok="onKaihuConfirm"
    editType="{{editType}}"
    title="{{title}}"
/>

<bindMeter 
    visible="{{bindVisible}}" 
    park="{{park}}" 
    tenement="{{tenement}}"
    tenementName="{{tenementName}}"
    bind:ok="onBindOk"    
    bind:close="onBindClose"
/>

<unBindMeter 
    visible="{{unbindVisible}}"
    park="{{park}}" 
    tenement="{{tenement}}" 
    tenementName="{{tenementName}}"    
    meterId="{{meterId}}"
    meterAddress="{{meterAddress}}"
    bind:ok="onUnbindOk"
/>
