<!--pages/workBenchNew/components/createMeter/index.wxml-->
<navigator canBack="{{true}}" title="新装电表" />

<view class="wrapper">
    <searchSelectWrapper 
    label="当前时间" 
    placeholder="请选择园区"
    useSlot
    type=""
    hideBorder="{{true}}"
>
    <view> {{time}} </view>
</searchSelectWrapper>
<searchSelectWrapper 
    label="选择园区" 
    placeholder="请选择园区"
    text="{{parkName}}"
    bind:search="onParkFocus"
    required="{{true}}"
/>

<searchSelectWrapper 
    label="选择电表" 
    placeholder="请选择电表"
    text="{{meterName}}"
    bind:search="onMeterFocus"
    required="{{true}}"
    wx:if="{{selfManagement === 0}}"
/>
<searchSelectWrapper 
    label="SN" 
    placeholder="请输入sn"
    text="{{sn}}"
    type="input"
    bind:changeText="changeSn"
    required="{{true}}"
    wx:if="{{selfManagement === 1}}"
/>
<searchSelectWrapper 
    label="选择建筑" 
    placeholder="请选择建筑"
    text="{{buildingName}}"
    bind:search="onBuildingFocus"
    required="{{true}}"

/>
<searchSelectWrapper 
    label="电表箱" 
    placeholder="请选择电表箱"
    text="{{meterBoxName}}"
    bind:search="onMeterBoxFocus"
    required="{{true}}"
/>
<searchSelectWrapper 
    label="电表类型" 
    placeholder="请选择电表类型"
    text="{{meterTypeName}}"
    bind:search="onMeterTypeFocus"
    required="{{true}}"
/>
<searchSelectWrapper 
    label="倍率" 
    placeholder="请输入倍率"
    type="input"
    text="ratio"
    bind:changeText="changeRatio"
/>
<searchSelectWrapper 
    label="电表地址" 
    placeholder="请输入电表地址"
    text="area"
    type="input"
    required="{{true}}"
    bind:changeText="changeAddress"
/>
<searchSelectWrapper 
    label="所辖面积" 
    placeholder="请输入所辖面积"
    text="area"
    type="input"
    bind:changeText="changeArea"
/>
<searchSelectWrapper 
    label="绑定卡" 
    placeholder="请选择卡绑定（选填）"
    text="{{cardName}}"
    bind:search="onBindCard"
/>
<searchSelectWrapper 
    label="互感器A" 
    placeholder="请选择互感器绑定"
    text="{{collectionAName}}"
    bind:search="onBindCollectionA"
/>
<searchSelectWrapper 
    label="互感器B" 
    placeholder="请选择互感器绑定"
    text="{{collectionBName}}"
    bind:search="onBindCollectionB"
/>
<searchSelectWrapper 
    label="互感器C" 
    placeholder="请选择互感器绑定"
    text="{{collectionCName}}"
    bind:search="onBindCollectionC"
/>
<searchSelectWrapper 
        label="商户"
        placeholder="请选择商户"
        text="{{ tenementName }}"
        bind:search="onTenementFocus"
    />
<searchSelectWrapper 
    label="总" 
    placeholder="请输入总"
    type="input"
    bind:changeText="changeOverall"
/>
<searchSelectWrapper 
    label="尖" 
    placeholder="请输入尖"
    type="input"
    bind:changeText="changeSharp"
/>
<searchSelectWrapper 
    label="峰" 
    placeholder="请输入峰"
    type="input"
    bind:changeText="changePeak"
/>
<searchSelectWrapper 
    label="平" 
    placeholder="请输入平"
    type="input"
    bind:changeText="changeFlat"
/>
<searchSelectWrapper 
    label="谷" 
    placeholder="请输入谷"
    type="input"
    bind:changeText="changeValley"
/>
<searchSelectWrapper 
    label="图片" 
    useSlot="{{true}}"
    type=""
    hideBorder="{{true}}"
>
    <view style="display: flex; align-items: center;">
        <view>
            <van-button type="info" size="small" bind:click="uploadImage" custom-style="margin-right: 20rpx;"> 上传 </van-button>
            <view style="margin-top: 20rpx" wx:if="{{!!url}}">
                <van-button type="danger" size="small" bind:click="clearImage" custom-style="margin-right: 20rpx;"> 清除 </van-button>
            </view>
        </view>
        <van-image wx:if="{{!!url}}" width="100" height="100" src="{{url}}" custom-style="margin-left: 20rpx;" />
    </view>

</searchSelectWrapper>
<view class="operate">
    <view class="submit"> <van-button type="info" block bind:click="handleSubmit"> 提交 </van-button> </view>
    <view class="cancel"> <van-button block bind:tap="goback"> 返回 </van-button> </view>
</view>


</view>



<search-select 
    show="{{show}}" 
    title="{{title}}" 
    type="{{type}}" 
    park="{{park}}"
    bindconfirm="onConfirm"
    bindcancel="onCancel"
    wx:if="{{show}}"
/>

<van-popup 
    show="{{ imageShow }}" 
    bind:close="onClose"
    z-index="99999"
>
    <van-image 
        width="100vw"
        height="99.1vh"
        fit="contain"
        src="{{url}}" 
        bind:click="onClose"
    />
</van-popup>