<nav type="back" background-color="#46a9a4" title="{{pageType == 'add'?'添加房型':'编辑详情'}}" />
<view class="page-section form" style="color:#382E2E; ">
    <block wx:for="{{route['editFields']}}" wx:key="index" wx:for-item="field">
        <!-- <block wx:if="{{route.editTabs}} " wx:key="index" wx:for-item="tab">{{tab==field['editTab']}} -->
            <!-- <block wx:if="{{tab==field['editTab']}}"> -->
                <view class="form-item {{field.type == 'Number'?'col-12':''}}" wx:if="{{field.key != ( 'shop' || 'company' ||  'department')}}">
                    <view class="form-label" >
                        <text wx:if="{{field.required}}" class="red required">*</text>
                        <text class="form-label-text">{{field.name}}:</text>
                    </view>
                    <view class="form-field">
                        <block wx:if="{{field.type == 'String'}}">
                            <block wx:if="{{!field.view}}">
                                <input class="form-input" border="{{true}}"
                                value="{{ formData[field.key] }}"
                                placeholder="请输入{{field.name}}"  data-field="{{field.key}}" data-type="{{field.type}}"
                                bindinput="onChange"/>
                            </block>
                            <!-- <block wx:if="{{field.view == 'editor-tinymce'}}">
                                <diy-editor width="100%" height="600rpx" insertPicture="{{true}}" placeholder="编写文章..." data-field="{{field.key}}" bind:Content="getHtml" bind:insertImage="insertImage" id="editor{{field.key}}"/>
                            </block> -->
                        </block>
                        <block wx:if="{{field.type == 'Number'}}">
                            <block wx:if="{{!field.view}}">
                                <input class="form-input form-input-num" min="0" type="number" border="{{true}}"
                                value="{{ formData[field.key] }}" 
                                placeholder="请输入{{field.name}}" data-field="{{field.key}}" data-type="{{field.type}}"
                                bindinput="onChange"/>
                            </block>
                        </block>
                        <block wx:if="{{field.type == 'Boolean'}}">
                            <block wx:if="{{!field.view}}">
                                <van-switch checked="{{ formData[field.key] }}" data-field="{{field.key}}"  data-type="{{field.type}}" active-color="#07c160"  size="24px" bind:change="onChange" />
                            </block>
                        </block>
                        <block wx:if="{{field.type == 'Array'}}">
                            <block wx:if="{{!field.view}}">
                                <view class="tag-wrapper">
                                    <view class="tags">
                                        <block wx:for="{{formData[field.key]}}" wx:key="index" wx:for-item="tag">
                                            <van-tag plain size="large" closeable data-field="{{field.key}}" data-index="{{index}}" bind:close="tagClose"  class="tag" type="primary">{{tag}}</van-tag>
                                        </block>
                                    </view>
                                    <van-button plain type="primary" data-field="{{field.key}}" data-name="{{field.name}}"  bindtap="showTagEdit"  class="add-btn">添加{{field.name}}</van-button>
        
                                </view>
                            </block>
                            <block wx:if="{{field.view == 'edit-filemanager'}}">
                                <upload data-field="{{field.key}}" bind:onChangeFile="changeFile" fileList="{{ formData[field.key] }}" accept="image" maxCount="9" uploadURL="{{uploadURL}}" domain="{{domain}}" uptokenURL="{{uptokenURL}}"></upload>
                            </block>
                        </block>
                        <block wx:if="{{field.type == 'GeoPoint'}}">
                            <block wx:if="{{!field.view}}">
                                <van-button data-field="{{field.key}}" bind:tap="chooseGeoPoint" type="primary" size="small">选择{{field.name}}</van-button>
                                <view>
                                    <text class="text-small grey">{{formData['address']}}</text>
                                </view>
                            </block>
                        </block>
                    </view>
                </view>
            <!-- </block> -->
        <!-- </block> -->
    </block>
</view>
<!-- editFields -->
<view class="footer">
    <van-button class="btn" size="large" color="#46a9a4" bindtap="submit">提交</van-button>
</view>