<!--pages/workBench/components/account/index.wxml-->
<navigator title="C端账号" canBack="{{true}}" />
<view>
    <searchSelectWrapper 
        label="园区"
        placeholder="请选择园区"
        text="{{ parkName }}"
        bind:search="onParkFocus"
    />
    <searchSelectWrapper 
        label="商户"
        placeholder="请选择商户"
        text="{{ tenementName }}"
        bind:search="onTenementFocus"
    />
</view>
<van-empty wx:if="{{!tenement}}" description="选择园区和商户后查看" />
<view wx:else>
    <view class="operateBox">
        <van-button type="info" size="small" style="margin-right: 20rpx;" bind:click="handleAddSon"> 添加子账号 </van-button>
        <van-button type="info" size="small" style="margin-right: 20rpx;" bind:click="handleChangeMain"> 修改主账号 </van-button>
    </view>
    <view class="customTable">
        <view class="customTableTile">
            <van-row>
                <van-col span="24">
                    <view class="tableTitleRow">
                        <view class="tableTitleRow">
                            <view class="tbody">
                                <view class="tr">
                                    <view class="th" style="width: 200rpx;text-align: center;"> {{tenementInfo.shortName}} </view>
                                    <view> {{tenementInfo.fullName}} </view>
                                </view>
                            </view>
                        </view>
                    </view>
                </van-col>
                <van-col span="24">
                    <view class="tableTitleRow">
                        <view class="tbody">
                            <view class="tr">
                                <view 
                                    class="th" 
                                    style="width: 200rpx;text-align: center;"
                                    wx:if="{{tenementInfo.feeType === 0}}"
                                > 华昌宝能收费 </view>
                                <view 
                                    class="th" 
                                    style="width: 200rpx;text-align: center;"
                                    wx:if="{{tenementInfo.feeType === 1}}"
                                > 物业代收1 </view>
                                <view 
                                    class="th" 
                                    style="width: 200rpx;text-align: center;"
                                    wx:if="{{tenementInfo.feeType === 2}}"
                                > 物业代收2 </view>
                                <view 
                                    class="th" 
                                    style="width: 200rpx;text-align: center;"
                                    wx:if="{{tenementInfo.feeType === 3}}"
                                > 物业代收线损 </view>
                                <view style="margin-left: 26rpx;"> {{tenementInfo.contact}} {{tenementInfo.phone}} </view>
                            </view>
                        </view>
                        
                    </view>
                </van-col>
     
            </van-row>
        </view>
        <view class="customTableContent">
            <van-row wx:if="{{list.length}}">
                <van-radio-group value="{{ record }}" bind:change="onChangeSelectRecharge">
                    <block wx:for="{{list}}" wx:for-index="itemIndex" wx:key="item">
                        <view class="tbody">
                            <view class="tr tableRow">
                                <view class="th" style="width: 200rpx;border-right: 1rpx solid #ccc;"> {{ item.WechatUserName }} </view>
                                <view class="th" style="width: 250rpx;border-right: 1rpx solid #ccc;"> {{ item.WechatPhone }} </view>
                                <view class="th" style="display: flex;">
                                    <view style="margin-left: 16rpx;">
                                        <view wx:if="{{!item.Permissions}}" style="display: inline-block;">
                                            <view 
                                                class="primaryTextBtn" 
                                                bind:tap="handleDelete" 
                                                data-id="{{item.WechatUserID}}" 
                                                data-name="{{item.WechatUserName}}" 
                                            >
                                            <van-image width="40rpx" height="40rpx" src="/assets/images/stop.png" />
                                            </view>
                                            <view 
                                                class="primaryTextBtn" 
                                                bind:tap="setAdmin" 
                                                data-id="{{item.WechatUserID}}" 
                                                data-name="{{item.WechatUserName}}" 
                                                style="margin-left: 16rpx;"
                                            >
                                            <van-image width="40rpx" height="40rpx" src="/assets/images/tihuan.png" />
                                            </view>
                                        </view>
                   
                                        <van-tag type="primary" wx:else>管理员</van-tag>
                                    </view>
                                   
                                </view>
                            </view>
                        </view>
                        
                    </block>
                </van-radio-group>
            </van-row>
            <empty wx:else bind:refresh="initUserList" />
        </view>
    </view>
</view>
<search-select 
    show="{{show}}" 
    title="{{title}}" 
    type="{{type}}" 
    park="{{park}}"
    isBack="{{true}}"
    bindconfirm="onConfirm"
    bindcancel="onCancel"
/>
<edit-modal 
    visible="{{visible}}" 
    type="{{type}}" 
    title="{{title}}"  
    tenement="{{tenement}}"
    park="{{park}}"  
    parentPhone="{{phone}}"
    parentName="{{name}}"
    parentId="{{id}}"
    bind:ok="onEditConfirm"
    bind:cancel="handleCancel"
/>
<updatePhoneModal
    visible="{{updatePhoneVisible}}"  
    tenement="{{tenement}}"
    park="{{park}}"  
    parentPhone="{{parentPhone}}"
    bind:ok="onUpdatePhoneConfirm"
    bind:cancel="handleUpdatePhoneCancel"
/>