<!--pages/salesOrderMan/edit.wxml-->
<view class="container" style="padding-bottom:100px;">
  <view class="height20"></view>
  <view>
    <form bindsubmit="formSubmit">
      <input name="id" value='{{info.id}}' hidden='true' />
      <view class="part">
        <!-- 客户 -->
        <van-field label="客户" required input-align="right" bindtap="hideKeybord">
          <view slot="input" style="width: 100%;">
            <input name="customerId" value='{{customerArray[customerIndex].id}}' hidden='true' />
            <picker bindchange="bindPickerChange" value="{{customerIndex}}" range="{{customerArray}}" range-key="name" data-pickername='customer'>
              <view wx:if="{{customerArray[customerIndex].name}}"> {{customerArray[customerIndex].name}}</view>
              <view wx:else class="selectPlaceholder">{{defaultText}}</view>
            </picker>
          </view>
          <view slot="right-icon">
            <van-icon name="arrow" />
          </view>
        </van-field>

        <!-- 销售订单 -->
        <van-field label="销售订单" required input-align="right" wx:if="{{saleOrderArray.length>0}}">
          <view slot="input" style="width: 100%;">
            <picker bindchange="bindPickerChange" value="{{saleOrderIndex}}" range="{{saleOrderArray}}" range-key="name" data-pickername='saleOrder'>
              <view wx:if="{{saleOrderArray[saleOrderIndex].name}}"> {{saleOrderArray[saleOrderIndex].name}}</view>
              <view wx:else class="selectPlaceholder">{{ defaultText }}</view>
            </picker>
          </view>
          <view slot="right-icon">
            <van-icon name="arrow" />
          </view>
        </van-field>
        <van-field required wx:else label="销售订单" name="" value="" readonly input-align="right" placeholder="请先选择客户" placeholder-style="color:red;" />

        <van-field label="送货地址" required name="shipAddress" readonly value="{{ saleOrderArray[saleOrderIndex].shipAddress }}" placeholder="选择销售订单自动填入" input-align="right">
        </van-field>

        <van-field label="订单类型" name="orderType" value="{{ saleOrderType }}" required input-align="right" class="radioHeight fieldAutoHeight">
          <view slot="input" class="radioHeightBx">
            <radio-group class="radio-group" bindchange="dangerStatusChange" data-radioType="orderType">
              <label class="radio" style="margin-right:20rpx;" wx:for="{{ orderTypeArray }}" wx:key="index">
                <radio value="{{ item.dictValue }}" checked="{{ orderTypeArray[index].dictValue == saleOrderType }}" disabled color="#1989fa" />{{ item.dictLabel }}
              </label>
            </radio-group>
          </view>
        </van-field>

        <van-field label="订单重量" type="digit" required name="orderWeight" value="{{ saleOrderWeight }}" placeholder="选择销售订单自动填入" input-align="right">
          <view slot="right-icon">
            <text>吨</text>
          </view>
        </van-field>
        <!-- <van-field label="销售订单信息" required value="{{saleOrderIndex||saleOrderIndex==0?saleOrderArray[saleOrderIndex].saleOrderName+'-'+saleOrderArray[saleOrderIndex].saleOrderNumber+'-'+saleOrderArray[saleOrderIndex].goodsName+'-'+saleOrderArray[saleOrderIndex].orderWeight+'-'+saleOrderArray[saleOrderIndex].orderType:''}}" placeholder="选择销售订单自动填入" input-align="right" readonly></van-field> -->

        <input name="saleOrderInfo" value='{{saleOrderArray[saleOrderIndex].id}}' hidden='true' />
        <!-- <van-field label="订单名称" required name="orderName" value="{{saleOrderArray[saleOrderIndex].saleOrderName}}" placeholder="选择销售订单自动填入" input-align="right" readonly></van-field> -->
        <van-field label="订单编号" required name="orderNumber" value="{{saleOrderArray[saleOrderIndex].saleOrderNumber}}" placeholder="选择销售订单自动填入" input-align="right" readonly></van-field>

        <!-- 提货时间 -->
        <van-field label="提货时间" required input-align="right" wx:if="{{confTimeArray.length>0}}" type="textarea" autosize border="{{ false }}">
          <view slot="input" style="width: 100%;">
            <input name="deliveryTimeId" value='{{confTimeArray[confTimeIndex].id}}' hidden='true' />
            <picker bindchange="bindPickerChange" value="{{confTimeIndex}}" range="{{confTimeArray}}" range-key="timeRange" data-pickername='confTime'>
              <view wx:if="{{confTimeArray[confTimeIndex].timeRange}}"> {{confTimeArray[confTimeIndex].timeRange}}</view>
              <view wx:else class="selectPlaceholder">{{ defaultText }}</view>
            </picker>
          </view>
          <view slot="right-icon">
            <van-icon name="arrow" />
          </view>
        </van-field>
        <van-field required wx:else label="提货时间" name="deliveryTimeId" value="" readonly input-align="right" placeholder="请先选择销售订单" placeholder-style="color:red;" />

        <!-- 供应商 -->
        <van-field label="供应商" required input-align="right" bindtap="hideKeybord">
          <view slot="input" style="width: 100%;">
            <input name="supplierId" value='{{supplierArray[supplierIndex].id}}' hidden='true' />
            <picker bindchange="bindPickerChange" value="{{supplierIndex}}" range="{{supplierArray}}" range-key="supplierName" data-pickername='supplier'>
              <view wx:if="{{supplierArray[supplierIndex].supplierName}}"> {{supplierArray[supplierIndex].supplierName}}</view>
              <view wx:else class="selectPlaceholder">{{defaultText}}</view>
            </picker>
          </view>
          <view slot="right-icon">
            <van-icon name="arrow" />
          </view>
        </van-field>

        <van-field label="运费单价" type="digit" required name="freightPrice" value="{{ freightPrice }}" placeholder="选择输入运费单价" input-align="right" bind:change="freightPriceChange" border="{{ false }}">
          <view slot="right-icon">
            <text>元</text>
          </view>
        </van-field>

      </view>

      <view class="fixedBtn submitBtn">
        <van-button loading="{{isSubmitting}}" round block disabled="{{isSubmitting}}" loading-text="{{isSubmitting?'提交中...':''}}" type="info" form-type="submit">确定
        </van-button>
      </view>

    </form>
  </view>
</view>

<wxs module="filters" src="../../utils/filter.wxs"></wxs>