<wxs src='../../../utils/wxmlUtil.wxs' module="wxmlUtil"></wxs>
<view class="{{!transparentStyle ? 'dk-card-outer-class' : ''}}">
  <!-- 单据信息 -->
  <view class="{{!transparentStyle ? 'dk-card-class' : ''}}" wx:for="{{cardList}}" wx:for-item="card" data-item="{{card}}"> 
    <view wx:for="{{contentObj[card]}}" wx:for-item="item" data-item="{{item}}" wx:key="index">
      <!--文本框-->
      <van-field wx:if="{{item.type=='str' && !item.hide}}" required="{{item.required?true:false }}" data-key="{{item.code}}" data-item="{{item}}" data-index="{{index}}" data-card="{{card}}" value="{{ form[item.code]}}" input-align="left" label="{{item.title?item.title:$t[item.code]}}" placeholder="{{wxmlUtil.setPlaceholder($t,item.title?item.title:item.code)}}" autosize border="{{ false }}" clearable readonly="{{!!item.readonly}}" input-class="dk-cell-value-class" maxlength="{{item.maxlength?item.maxlength:50}}" right-icon="{{item.rightIcon}}" bind:change="changeField" bind:blur="blurField" bind:clear="clearField" catchtap="openStr" errorMessage="{{item.errMsg}}">
        <van-icon wx:if="{{item.tip}}" slot="label-icon" name="question-o" data-item="{{item}}" catchtap="showTip" />
      </van-field>
      <!--单选下拉-->
      <van-field wx:if="{{item.type=='drop' && !item.hide}}" required="{{item.required?true:false }}" data-name="{{item.name}}" data-key="{{item.code}}" data-item="{{item}}" data-index="{{index}}" data-card="{{card}}" value="{{ form[item.name]}}" input-align="left" label="{{item.title?item.title:$t[item.code]}}" placeholder="{{wxmlUtil.setPlaceholder($t,item.title?item.title:item.code)}}" is-link catchtap="open" autosize border="{{ false }}" readonly="{{true}}" input-class="dk-cell-value-class" data-type='{{item.dropType}}' errorMessage="{{item.errMsg}}">
        <van-icon wx:if="{{!readonly &&  form[item.code]&& (item.clear || item.clear == undefined)}}" slot="icon" name="clear" color="#c8c9cc;" data-name="{{item.name}}" data-key="{{item.code}}"  data-item="{{item}}" catchtap="clearChoose"></van-icon>
      </van-field>
      <!--多选下拉-->
      <van-field wx:if="{{item.type=='mutidrop' && !item.hide}}" required="{{item.required?true:false }}" data-name="{{item.name}}" data-key="{{item.code}}" data-item="{{item}}" data-index="{{index}}" data-card="{{card}}" value="{{ form[item.name + 's']}}" input-align="left" label="{{item.title?item.title:$t[item.code]}}" placeholder="{{wxmlUtil.setPlaceholder($t,item.title?item.title:item.code)}}" is-link catchtap="open" autosize border="{{ false }}" readonly="{{true}}" input-class="dk-cell-value-class" data-type='{{item.dropType}}' errorMessage="{{item.errMsg}}">
        <van-icon wx:if="{{!readonly &&  form[item.code]&& (item.clear || item.clear == undefined)}}" slot="icon" name="clear" color="#c8c9cc;" data-name="{{item.name}}" data-key="{{item.code}}"  data-item="{{item}}"catchtap="clearChoose"></van-icon>
      </van-field>
      <!--选单-->
      <van-field wx:if="{{item.type=='choose' && !item.hide}}" required="{{item.required?true:false }}" data-name="{{item.name}}" data-key="{{item.code}}" data-item="{{item}}" data-index="{{index}}" data-card="{{card}}" value="{{ form[item.name]}}" input-align="left" label="{{item.title?item.title:$t[item.code]}}" placeholder="{{item.placeholder ? item.placeholder : wxmlUtil.setPlaceholder($t, item.title?item.title:item.code)}}" is-link catchtap="open" autosize border="{{ false }}" readonly="{{true}}" input-class="dk-cell-value-class" data-type='{{item.dropType}}' errorMessage="{{item.errMsg}}">
        <van-icon wx:if="{{!readonly &&  form[item.code]&& (item.clear || item.clear == undefined)}}" slot="icon" name="clear" color="#c8c9cc;" data-name="{{item.name}}" data-key="{{item.code}}"  data-item="{{item}}"catchtap="clearChoose"></van-icon>
      </van-field>

      <van-field wx:if="{{item.type=='chooseAndStr' && !item.hide}}" required="{{item.required?true:false }}" data-name="{{item.name}}" data-key="{{item.code}}" data-item="{{item}}" data-index="{{index}}" data-card="{{card}}" value="{{ form[item.name]}}" input-align="left" label="{{item.title?item.title:$t[item.code]}}" placeholder="{{item.placeholder ? item.placeholder : wxmlUtil.setPlaceholder($t, item.title?item.title:item.code)}}"  bind:click-icon="open" autosize border="{{ false }}" readonly="{{false}}" bind:change="changeField"  input-class="dk-cell-value-class" data-type='{{item.dropType}}' errorMessage="{{item.errMsg}}">
        <van-icon name="arrow" slot="icon"  catchtap="open" data-key="{{item.code}}" data-item="{{item}}" data-index="{{index}}" data-card="{{card}}"  />
      </van-field>
      
      <!--选择框-->
      <van-field wx:if="{{item.type=='checkbox' && !item.hide}}" input-width="200rpx" input-class="dk-cell-value-class" label-class="nomal-label" input-align="left" label="{{item.title?item.title:$t[item.code]}}" autosize border="{{ false }}" readonly="{{true}}" errorMessage="{{item.errMsg}}">
        <view slot="end" style="text-align: right;padding-left: 10rpx;" data-item="{{item}}" data-index="{{index}}" data-value="{{form[item.code]}}" data-key="{{item.code}}" catchtap="onChange">
          <van-checkbox shape="round" value="{{form[item.code]}}" />
        </view>
      </van-field>
      <!--开关-->
      <van-field wx:if="{{item.type=='switch'}}" input-width="200rpx" input-class="dk-cell-value-class" label-class="nomal-label" input-align="right" label="{{item.title?item.title:$t[item.code]}}" autosize border="{{ false }}" readonly="{{true}}" errorMessage="{{item.errMsg}}">
        <van-icon wx:if="{{item.tip}}" slot="label-icon" name="question-o" data-item="{{item}}" catchtap="showTip" />
        <view slot="inputbefor" style="width:100%;text-align: left;padding-top: 5rpx;">
          <van-switch size="20px" checked="{{ form[item.code]}}" bind:change="onChange" active-color="#3E69F6" data-item="{{item}}" data-index="{{index}}" data-card="{{card}}" data-value="{{form[item.code]}}" data-key="{{item.code}}"disabled="{{item.disabled}}" />
        </view>
      </van-field> 
      <view wx:if="{{item.type=='text'}}" style="font-size:11px;margin-left:16px;color:red;margin-top: 4px;"> 
        {{item.text}}
    </view>
      <!-- 是否 -->
      <van-field wx:if="{{item.type=='checkedBox'}}" input-width="200rpx" input-class="dk-cell-value-class" label-class="nomal-label" input-align="right" label="{{item.title?item.title:$t[item.code]}}" autosize border="{{ false }}" readonly="{{true}}" errorMessage="{{item.errMsg}}">
        <view slot="inputbefor" style="text-align: left;padding-top: 5rpx;display: flex;">
          <van-checkbox value="{{ form[item.code]}}" data-item="{{item}}" data-index="{{index}}" data-key="{{item.code}}" data-card="{{card}}" data-value="{{form[item.code]}}" bind:change="onChangeCheckedBoxYes">
            <view>
              是
            </view>
          </van-checkbox>
          <van-checkbox value="{{ !form[item.code]}}" data-item="{{item}}" data-index="{{index}}" data-card="{{card}}" data-value="{{form[item.code]}}" data-key="{{item.code}}" bind:change="onChangeCheckedBoxNo" style="margin-left: 40rpx;">
            <view>
              否
            </view>
          </van-checkbox>
        </view>
      </van-field>

      <!--日期-->
      <van-field wx:if="{{item.type=='date'}}" required="{{item.required?true:false }}" is-link value="{{ form[item.code]}}" label="{{item.title?item.title:$t[item.code]}}" placeholder="{{wxmlUtil.setPlaceholder($t,item.title?item.title:item.code)}}" data-item="{{item}}" data-key="{{item.code}}" data-index="{{index}}" data-card="{{card.name}}" errorMessage="{{item.errMsg}}" clearable border="{{ false }}" readonly="{{true}}" input-class="dk-cell-value-class" catchtap="openDatePop">
        <van-icon wx:if="{{!readonly &&  form[item.code]}}" slot="icon" name="clear" color="#c8c9cc;" data-key="{{item.code}}" catchtap="clearDate"></van-icon>
      </van-field>
      <!-- 日期范围 -->
      <van-field wx:if="{{item.type=='dateDay'}}" required="{{item.required?true:false }}" is-link value="{{ form[item.code]}}" label="{{item.title?item.title:$t[item.code]}}" placeholder="{{wxmlUtil.setPlaceholder($t,item.title?item.title:item.code)}}" data-item="{{item}}" data-key="{{item.code}}" data-index="{{index}}" data-card="{{card.name}}" errorMessage="{{item.errMsg}}" clearable border="{{ false }}" readonly="{{true}}" input-class="dk-cell-value-class" catchtap="openDatePopDay">
        <van-icon wx:if="{{!readonly &&  form[item.code]}}" slot="icon" name="clear" color="#c8c9cc;" data-key="{{item.code}}" catchtap="clearDate"></van-icon>
      </van-field>
      <!--时间-->
      <van-field wx:if="{{item.type=='dateTime'}}" required="{{item.required?true:false }}" is-link value="{{ form[item.code]}}" label="{{item.title?item.title:$t[item.code]}}" placeholder="{{wxmlUtil.setPlaceholder($t,item.title?item.title:item.code)}}" data-item="{{item}}" data-key="{{item.code}}" data-index="{{index}}" data-card="{{card.name}}" errorMessage="{{item.errMsg}}" border="{{ false }}" clearable readonly="{{true}}" input-class="dk-cell-value-class" catchtap="openDatePopTime">
        <van-icon wx:if="{{!readonly &&  form[item.code]}}" slot="icon" name="clear" color="#c8c9cc;" data-key="{{item.code}}" catchtap="clearDate"></van-icon>
      </van-field>
      <!--tab标签-->
      <van-field wx:if="{{item.type=='tabs' && !item.hide}}" input-width="200rpx" input-class="dk-cell-value-class" label-class="nomal-label" input-align="left" label="{{item.title?item.title:$t[item.code]}}" autosize border="{{ false }}" readonly="{{true}}" errorMessage="{{item.errMsg}}">
        <view slot="inputbefor" style="text-align: left;padding-left: 10rpx;" data-item="{{item}}" data-index="{{index}}" data-card="{{card}}" data-value="{{form[item.code]}}" data-key="{{item.code}}" catchtap="changeTabs">
          <dk-tabs-custom model:value="{{form[item.code]}}" bind:change="changeTabs" data-key="{{item.code}}" list="{{item.tagList}}" />
        </view>
      </van-field>

      <!--客户地址-->
      <van-field wx:if="{{item.type=='address' && !item.hide}}" input-width="200rpx" input-class="dk-cell-value-class" required="{{item.required?true:false }}" input-align="left" data-key="address" type="textarea" value="{{ wxmlUtil.addressToIndexOf(form.address.address) }}" label="{{item.title?item.title:$t[item.code]}}" placeholder="{{wxmlUtil.setPlaceholder($t,item.title?item.title:item.code)}}" autosize border="{{ false }}" data-type='address' catchtap="onClickWxchartAddress" readonly="{{true}}" data-item="{{item}}" data-index="{{index}}" data-card="{{card}}" errorMessage="{{item.errMsg}}">
        <view style="display: flex;" slot="right-icon">
          <van-icon wx:if="{{!readonly &&  form.address.address}}" slot="right-icon" name="clear" color="#c8c9cc;" data-key="{{item.code}}" catchtap="clearAddress"></van-icon>
          <van-icon custom-style="padding-left:10rpx" name="location"></van-icon>
        </view>
      </van-field>
      <!--联系电话-->
      <dk-number-phone-input wx:if="{{item.type=='phone' && !item.hide}}" data-key="{{item.code}}" data-item="{{item}}" data-index="{{index}}" data-card="{{card}}" required="{{item.required?true:false }}" clearable rightIcon="phone" model:value="{{ form[item.code]}}" bind:changeField="changePhone" bind:clear="clearField" bind:changeFieldblur="changePhoneblur" errorMessage="{{item.errMsg}}" id="{{item.code}}" label="{{item.title?item.title:$t[item.code]}}" placeholder="{{wxmlUtil.setPlaceholder($t,item.code)}}"></dk-number-phone-input>
      <!--数字类-->
      <dk-number-input wx:if="{{item.type=='number' && !item.hide}}" sign="{{(item.sign || item.sign == '')?item.sign:'¥'}}" digits="{{(item.digits || item.digits == 0)?item.digits:2}}" fontSize="14" left="30rpx" data-key="{{item.code}}" data-item="{{item}}" data-index="{{index}}" data-card="{{card}}" center="left" placeholder="{{wxmlUtil.setPlaceholder($t,item.title?item.title:item.code)}}" errorMessage="{{item.errMsg}}" titleValue="{{item.title?item.title:$t[item.code]}}" negative="{{item.negative}}" max="{{item.max}}" maxFlag="{{item.maxFlag}}" min="{{item.min}}" inputColor="#FF7B1A" titleFontWeight="normal" titleColor="#95A8CB" readonly="{{!!item.readonly}}" required="{{item.required}}" tip="{{item.tip}}" inputValue="{{form[item.code]}}" bind:triggerBindValue="changeNumberField"></dk-number-input>

      <!--备注-->
      <van-field wx:if="{{item.type=='textarea' && !item.hide}}" rows="{{item.rows}}" show-word-limit="{{item.showWordLimit}}" type="textarea" required="{{item.required?true:false }}" data-key="{{item.code}}" data-item="{{item}}" data-index="{{index}}" data-card="{{card}}" value="{{ form[item.code]}}" input-align="left" label="{{item.title?item.title:$t[item.code]}}" placeholder="{{wxmlUtil.setPlaceholder($t,item.title?item.title:item.code)}}" autosize border="{{ false }}" readonly="{{!!item.readonly}}" input-class="dk-cell-value-class {{item.rows ?  'input-rows-class' : ''}}" maxlength="{{item.maxlength?item.maxlength:500}}" right-icon="{{item.rightIcon}}" bind:change="changeField" bind:blur="blurField" errorMessage="{{item.errMsg}}">
        <van-icon wx:if="{{item.tip}}" slot="label-icon" name="question-o" data-item="{{item}}" catchtap="showTip" />
      </van-field>
      <!--附件-->
      <view style="display:flex;width:100%;margin: 1vw; padding-top: 20rpx;" wx:if="{{item.type=='uploader'}}">
        <view style="width: 168rpx; flex:1;color: #95A8CB;font-size: 14px;padding-left: 20rpx;">{{item.name?item.name:'附件'}}</view>
        <view style="width: calc(100% - 168rpx);text-align: left;">
          <van-uploader max-count="{{uploaderMAX}}" disabled="{{!!item.readonly}}" accept="image" style="margin-left: 4%;border-radius: 15rpx;" preview-size="160rpx;" file-list="{{ form['annexPaths'] }}" bind:delete="deleteImg" bind:after-read="afterRead" multiple="true" imageFit="aspectFit" max-size="{{maxSize}}" bind:oversize="overSize" />
          <view style="margin-left: 27rpx;color: #C8C9CC;font-size: 12px;">
            图片最多上传{{uploaderMAX}}张
          </view>
        </view>
      </view>
    </view>  
  </view> 
</view>
<!--单选-->
<dk-single-dropdown-item show="{{show}}" typeName='{{dropType}}' bind:commit='chooseData' bind:muticlose='muticlose'></dk-single-dropdown-item>

<!--多选-->
<dk-muti-dropdown-item show="{{mutishow}}" typeName='{{dropType}}' bind:commit='chooseData' bind:muticlose='muticlose'></dk-muti-dropdown-item>

<!--日期-->
<van-popup show="{{ showDate }}" custom-style="border-radius:30rpx 30rpx 0 0;" position="bottom" bind:close="cancelDatePop">
  <van-datetime-picker type="dateTime" value="{{ currentDate }}" bind:confirm="chooseDate" bind:cancel="cancelDatePop" loading="{true}" />
</van-popup>


<!--日期-->
<van-popup show="{{ showDateTime }}" custom-style="border-radius:30rpx 30rpx 0 0;" position="bottom" bind:close="cancelDatePopTime">
  <van-datetime-picker type="datetime" value="{{ currentDate }}" bind:confirm="chooseDateTime" bind:cancel="cancelDatePopTime" loading="{true}" />
</van-popup>

<dk-dropdown-date-day show="{{showDateDay}}" bind:dateCommit="pickDateCommit"></dk-dropdown-date-day>