<wxs src='../../../utils/wxmlUtil.wxs' module="wxmlUtil"></wxs>
<!-- 弹窗 编辑/新建-->
<van-popup show="{{show}}" position="bottom" bind:close="onClosePopup" custom-class="dk-popup">
  <!--标题-->
  <view class="special-topic" wx:if="{{type=='sale'}}">
    <!-- 图片 -->
    <view class="special-topic-content" style="position: fixed;">
      <van-image radius="15rpx" custom-class="goods-pop-image" fit="fill" src="{{ form[iconCol] }}"></van-image>
    </view>
    <view class="special-topic-title" style="margin-left: 175rpx;">
      <!-- 标签 标题-->
      <dk-title titleTag="{{form[titleTagCol]}}" title="{{form[titleCol]}}"></dk-title>
      <view style="padding-top: 10rpx;">
        <dk-text fontWeight="normal" value="{{form[descCol]}}"></dk-text>
      </view>
      <view style="display: flex;padding-top: 5rpx;">
        <view class="price-pop-class" style="display: flex;">
          <!-- <dk-cell height="46rpx" spaceWidth="1rpx" left="0" fontSize="14" contentColor="#FF7B1A" fontWeight="bold" title="{{priceTitle}}" tail="{{form[priceTailCol]}}" content="{{form[priceCol]}}" tailLine="{{true}}" ></dk-cell> -->
          <dk-cell wx:if="{{form[priceTailCol] != form[priceCol]}}" height="46rpx" left="0" fontSize="12" contentColor="#FF7B1A" fontWeight="bold" title="{{priceTitle}}" contentLine="{{true}}" content="{{form[priceTailCol]}}" ></dk-cell>
          <dk-cell height="46rpx" style="margin-left: 20rpx;" left="0" fontSize="14" contentColor="#FF7B1A" fontWeight="bold" title="{{priceTitle}}" content="{{form[priceCol]}}"  ></dk-cell>
        </view>
      </view>
      <view wx:if="{{form[subCol]}}" style="padding-right: 30rpx;float: right;">
        <dk-text fontWeight="normal" value="{{ '计算公式：' + form[subCol]}}"></dk-text>
      </view>
    </view>
  </view>
  <view class="special-basic-topic" wx:if="{{type=='basic'}}">
    <view class="special-basic-topic-title">{{title}}</view>
    <view class="special-basic-topic-checkbox" wx:if="{{defaultFlagCol}}">
      <van-checkbox disabled="{{readonly || form[flgDefaultDisabled]}}" value="{{ form[defaultFlagCol] }}" bind:change="changeDefault" label-class="special-basic-topic-checkbox-label">{{defaultFlagTitle}}</van-checkbox>
    </view>
  </view>
  <view class="pop-content-class">

    <!-- 商品   库存量相关自定义 -->
    <view wx:for="{{popupTopObj}}" wx:for-item="item" data-item="{{item}}" wx:key="index">
      <view style="display: flex;padding:30rpx;color:#95A8CB;font-size: 14px;">
        <view style="width: 50%;">{{item.leftTitle}}：{{form[item.leftCode]}}</view>
        <view style="width: 50%;text-align: right;">{{item.rightTitle}}：{{form[item.rightCode]}}</view>
      </view>
    </view>

    <view wx:for="{{popupTopObjUnit}}" wx:for-item="item" data-item="{{item}}" wx:key="index">
      <view style="display: flex;padding-left:30rpx;padding-right:30rpx;padding-bottom:30rpx;color:#95A8CB;font-size: 14px;{{popupTopObj.length > 0 ? '' :'padding-top:30rpx;'}}">
        <view style="width: 50%;">{{item.leftTitle}}：{{form[item.leftCode]}}</view>
        <view style="width: 50%;text-align: right;">{{item.rightTitle}}：{{form[item.rightCode]}}</view>
      </view>
    </view>
    <!--内容-->
    <view wx:for="{{contentObj}}" wx:for-item="item" data-item="{{item}}" wx:key="index">
      <!--文本框-->
      <van-field wx:if="{{item.type=='str'}}" required="{{item.required?true:false }}" data-key="{{item.code}}" data-item="{{item}}" data-index="{{index}}" value="{{ form[item.code]}}" auto-focus="{{true}}" 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="{{!!readonly || !!item.readonly}}" input-class="dk-cell-value-class" maxlength="{{item.maxlength?item.maxlength:50}}" right-icon="{{item.rightIcon}}" bind:change="changeField" 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'}}" required="{{item.required?true:false }}" data-name="{{item.name}}" data-key="{{item.code}}" data-item="{{item}}" data-index="{{index}}" 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="{{item.tip}}" slot="label-icon" name="question-o" data-item="{{item}}" catchtap="showTip" />
      </van-field>
      <!--选单-->
      <van-field wx:if="{{item.type=='choose'}}" required="{{item.required?true:false }}" data-name="{{item.name}}" data-key="{{item.code}}" data-item="{{item}}" data-index="{{index}}" data-card="{{card.name}}" value="{{ form[item.name]}}" input-align="left" data-readonly = "{{item.readonly}}" 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="{{!item.readonly && form[item.name] && (item.clear || item.clear == undefined)}}" slot="icon" name="clear" color="#c8c9cc;" data-item="{{item}}" data-name="{{item.name}}" data-key="{{item.code}}" catchtap="clearChoose"></van-icon>
        <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=='checkbox'}}" 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="end" style="text-align: right;padding-left: 10rpx;" data-item="{{item}}" data-index="{{index}}" data-value="{{form[item.code]}}" data-key="{{item.code}}" catchtap="changeCheckBox">
          <van-checkbox shape="round" value="{{form[item.code]}}" disabled="{{!!readonly || !!item.readonly}}" />
        </view>
      </van-field>
      <!--数量step-->  
      <van-cell wx:if="{{item.type=='step'}}" border="{{ false }}" title-class="cell_title"  title="{{item.title?item.title:'数量'}}" required="{{item.required?true:false }}">
        <van-stepper wx:if="{{item.code == 'box'}}"input-width="50px" value="{{form[item.code]}}" integer="{{true}}"  data-index="{{index}}" data-item="{{item}}" data-key="{{item.code}}" min="{{form[item.code + '_min']?form[item.code + '_min']:( item.min?item.min:-9999999999)}}" max="{{form[item.code + '_max']?form[item.code + '_max']:( item.max?item.max:999999999)}}" bind:change="changeStep" disabled="{{!!readonly}}" />
        <van-stepper wx:else value="{{form[item.code]}}" input-width="50px" integer="{{ form[stepperDecimal]==0}}"decimal-length="{{ form[stepperDecimal] }}" data-index="{{index}}" data-item="{{item}}" data-key="{{item.code}}" min="{{form[item.code + '_min']?form[item.code + '_min']:( item.min?item.min:-99999999999)}}" max="{{form[item.code + '_max']?form[item.code + '_max']:( item.max?item.max:999999999)}}" bind:change="changeStep" disabled="{{!!readonly}}"/>
      </van-cell>
      <!--显示负数step-->  
      <van-cell wx:if="{{item.type=='negativeStep'}}" border="{{ false }}" title-class="cell_title"  title="{{item.title?item.title:'数量'}}" required="{{item.required?true:false }}" custom-class="step-class">
        <dk-stepper value="{{form[item.code]}}" input-width="60px" integer="{{ form[stepperDecimal]==0}}"decimal-length="{{ form[stepperDecimal] }}" data-index="{{index}}" data-item="{{item}}" data-key="{{item.code}}" min="{{form[item.code + '_min']?form[item.code + '_min']:( item.min?item.min:-99999999999)}}" max="{{form[item.code + '_max']?form[item.code + '_max']:( item.max?item.max:999999999)}}" bind:change="changeStep" readonly="{{!!readonly}}" />
      </van-cell>
      <!--数字类--> 
      <dk-number-input wx:if="{{item.type=='number'}}" 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}}" max="{{(item.max || item.max == '')?item.max:10000000}}" min="{{(item.min || item.min == '')?item.min:-10000000}}"  data-index="{{index}}" center="{{'right'}}" readonly="{{!!readonly || !!item.readonly}}" 
      placeholder="{{wxmlUtil.setPlaceholder($t,item.title?item.title:item.code)}}" errorMessage="{{item.errMsg}}" contentRight="{{true}}" titleValue="{{item.title?item.title:$t[item.code]}}" inputColor="{{item.inputColor?item.inputColor:'#FF7B1A'}}" titleFontWeight="normal" required="{{item.required?true:false }}" requiredLeft="15rpx" titleColor="{{item.readonly?'#95A8CB':'#272829'}}" inputValue="{{form[item.code]}}" titleWidth = "174px" bind:triggerBindValue="changeNumberField" bind:triggerBindBlur="blurNumberField"percentSignFlag="{{item.percentSignFlag}}" negative="{{item.negative}}"  bind:triggerOpen="openDkNumberInput" ></dk-number-input>
 
      <!--备注-->
      <van-field wx:if="{{item.type=='textarea'}}" type="textarea" required="{{item.required?true:false }}" data-key="{{item.code}}" data-item="{{item}}" data-index="{{index}}" 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="{{!!readonly || !!item.readonly}}" input-class="dk-cell-value-class" maxlength="{{item.maxlength?item.maxlength:500}}" right-icon="{{item.rightIcon}}" bind:change="changeField" errorMessage="{{item.errMsg}}">
      </van-field>
 
      <!--箱片-->
      <van-field   wx:if="{{item.type=='packageBox' && !!form['flgSubUnit'] }}"  required="{{item.required?true:false }}" data-key="{{item.code}}" data-item="{{item}}" data-index="{{index}}" value="{{ form[item.code]}}" auto-focus="{{true}}" 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="{{true}}"  catchtap="openPackageBox" input-class="dk-cell-value-class" maxlength="{{item.maxlength?item.maxlength:50}}" right-icon="{{item.rightIcon}}"   errorMessage="{{item.errMsg}}">
        <van-icon wx:if="{{item.tip}}" slot="label-icon" name="question-o" data-item="{{item}}" catchtap="showTip" />
      </van-field>

     
    </view>
  </view>

  <view style="height: 30rpx;background-color: #FFFFFF;"></view>

  <view wx:if="{{!readonly}}" style="text-align: center;background-color: #FFFFFF">
    <van-button round size="large" color="#3E69F6" custom-style="height:88rpx;width:640rpx;margin-bottom:40rpx;border-radius:15rpx" type="info" size="small" disabled="{{loading}}" loading="{{loading}}" bindtap="commit">确定</van-button>
  </view>
</van-popup>

<!--弹出-->
<dk-single-dropdown-item show="{{showDrop}}" typeName='{{dropType}}' bind:commit='chooseData' bind:muticlose='muticlose'></dk-single-dropdown-item>