 
<wxs src='/utils/numberFormat.wxs' module="numberFormat"></wxs>
<wxs src='/utils/wxmlUtil.wxs' module="wxmlUtil"></wxs>
<loading wx:if="{{loading}}"></loading>
<van-dialog id="van-dialog" />

<van-sticky offset-top="{{ 0 }}">
  <van-nav-bar title="开单"  border="{{false}}"  left-text="" left-arrow="{{false}}" bind:click-left="onClickLeft" />
<view style="display: flex;">
<view style="width: 85%;">
   <!-- 查询条件 --> 
   <dk-dropdown-menu model:value="{{searchForm}}" menuList="{{searchContent}}"  bind:search="searchData" searchTextPlaceholder="{{wxmlUtil.setSearchPlaceholder($t,['skuName','skuCode','onlyCode'])}}">
      </dk-dropdown-menu>
</view>

  <view bind:tap="toAddOtherWarehousing" class="scan-class" style="width: 15%;display: flex;align-items: center;">
    <image class="scan-image" fit="fill" src="{{imageUrl+'/goods_add_icon.png'}}"></image>
  </view>
</view>


<view style="display: flex;margin-left: 24rpx;margin-right: 24rpx;margin-top: 10rpx;">
  <view bind:tap="selectedProduct" data-active="{{0}}" class="{{ active == 0 ?'selected-product selected-product-color-01' : 'selected-product selected-product-color-02'}}">
    商品列表
  </view>

  <view bind:tap="selectedProduct" data-active="{{1}}" class="{{ active == 0 ? 'selected-product selected-product-color-02' : 'selected-product selected-product-color-01'}}" style="position: relative;">
    <view>已选商品</view>
      <view wx:if="{{choosedGoodsList.length > 0}}" style="position: absolute;top:16rpx;right: 40rpx;">
        <view class="icon">{{choosedGoodsList.length}}</view>
      </view>
  </view>
</view>
</van-sticky>


<view class="main-good-class" style="height:100%;background-color:#FFFFFF;">
  <!-- 商品编码的列表 -->
  <scroll-view scroll-y='{{true}}' bindscrolltolower='scrollToLower' class="goods-class" style="height:calc({{windowHeight+'px'}} - 295rpx);overflow: scroll;" lower-threshold='100'  wx:if="{{active == 0}}" >
      <view wx:for="{{tableData}}" wx:key="index" catch:tap="openAddItemInfo" data-item="{{item}}" class="main-class" style="width: 75%;margin-left: 166rpx;">
        <view class="main-foot" style="border-radius:15rpx;">
          <view>
            <view class="table-content-row">
              <view style="display:flex;width:100%;">
                <view data-item="{{item}}" style="display:flex;font-size: 15px;">
                  <dk-text style="font-size:30rpx;" fontWeight="nomal" value="{{item.skuModel}}"></dk-text>
                </view>
              </view>
            </view>

            <!-- 商品名称 -->
            <view class="table-row">
              <view class="table-content-row">
                <view style="display: flex;">
                  <view class="table-content-row-font">
                    <dk-text fontSize="14px" color="#95A8CB" fontWeight="nomal" value="商品名称" copyValue="{{item.skuName}}"></dk-text>
                  </view>
                  <view class="table-content-class">
                    {{item.skuName?item.skuName:''}}
                  </view>
                </view>
              </view>
            </view>

            <!-- 库区 -->
            <view class="table-content-row">
              <view style="display: flex;">
                <view class="table-content-row-font">
                  <dk-text layoutFlag="{{true}}" fontSize="14px" color="#95A8CB" fontWeight="nomal" value="库区" copyValue="{{item.whName}}"></dk-text>
                </view>
                <view class="table-content-class">
                  {{item.whName?item.whName:''}}
                </view>
              </view>
            </view>

            <!-- 库区色号 -->
            <view class="table-content-row">
              <view style="display: flex; justify-content:space-between;">


                <view style="display: flex;">
                  <view class="table-content-row-font">
                    <dk-text layoutFlag="{{true}}" fontSize="14px" color="#95A8CB" fontWeight="nomal" value="色号" copyValue="{{item.nonStdCode}}"></dk-text>
                  </view>
                  <view class="table-content-class">
                    {{item.nonStdCode?item.nonStdCode:''}}
                  </view>
                </view>

                <!-- 加号 -->
                <view class="van-icon-class">
                  <van-icon size="25px" name="add" style="color:#1B365D" />
                </view>
              </view>
            </view>
            <!-- 分割线 -->
            <dk-divider marginTop="20rpx" marginBottom="0rpx"></dk-divider>
            <!-- 下半部分 -->
            <view class="table-content-row">
              <view style="display: flex;justify-content:space-between">
                <view style="display: flex;">
                  <view class="table-content-row-font">
                    <dk-text layoutFlag="{{true}}" fontSize="14px" color="#95A8CB" fontWeight="nomal" value="库存量"></dk-text>
                  </view>
                  <view style="font-size: 13px;color: #CAA977;">
                    {{item.invQty}}
                  </view>
                </view>

                <view style="display: flex;">
                  <view class="table-content-row-font">
                    <dk-text layoutFlag="{{true}}" fontSize="14px" color="#95A8CB" fontWeight="nomal" value="可售量"></dk-text>
                  </view>
                  <view style="font-size: 13px;color: #CAA977;">
                    {{item.usableQty }}
                  </view>
                </view>
              </view>
            </view>
          </view>
        </view>
      </view>
      <view style="height:200rpx"></view>
    </scroll-view>
  <!--已选列表-->
  <view wx:if="{{active == 1}}" class="goods-selected-class">
    <view class="goods-class" style="height:calc({{windowHeight+'px'}} - 295rpx);overflow: scroll;"></view>
    <van-cell-group custom-class="width-80">
  
      <view class="goods-cell-class" wx:for="{{choosedGoodsList}}" wx:key="index" data-index="{{index}}" border="{{ false }}">
        <van-swipe-cell right-width="{{ 65 }}" data-index="{{index}}" async-close bind:close="delChoosedGoodsItem">
          <view class="goods-item-class">
          <view>
            <van-image radius="15rpx" custom-class="goods-item-image" fit="fill" src="{{item.imagesUrl}}" />
          </view>
          <view style="margin-left: 26rpx;width: 100%;">
            <!-- 标题 -->
            <view>
              <!-- <dk-text fontSize="24rpx" value="{{item.skuCode}}"></dk-text> -->
              <dk-title   title="{{item.skuModel}}"></dk-title>
            </view>
            <!-- 描述 -->
            <view style="display: flex; ">
              <dk-text fontSize="24rpx" value="{{item.skuName}}"></dk-text>
            </view>
            <view style="display: flex;align-items: flex-end;">
              <!-- 标准价/标价-->
              <view style="width: 85%;">
                <view style="color: #002340A6;font-size:22rpx;font-weight: 500;margin-top: 18rpx;"></view>
                <dk-cell height="46rpx" spaceWidth="1rpx" left="0" fontSize="14" contentColor="#FF7B1A" fontWeight="700" title="" content="{{item.sumPrice?item.sumPrice:0}}"></dk-cell>
              </view>
              <!-- 加号 -->
            
            </view>

            <view style="display:flex;align-items: center;">
      
                <van-stepper value="{{item.itemQty}}" data-index="{{index}}" min="0" integer="{{true}}" max="999999999" bind:change="changeAllreadyChooseQuantity" />
              </view>
          </view>
        </view>
          <view slot="right">删除</view>
        </van-swipe-cell>
      </view>
    </van-cell-group>


    <view style="height:300rpx;"></view>
  </view>
</view>



<van-sidebar activeKey="{{sideKey}}" bindchange="changeSidebar" custom-class="{{active == 0 ? 'left-class' : 'right-class'}}">
  <view wx:if="{{active != 1}}" style="height:calc({{windowHeight+'px'}} - {{active == 1 ? '270rpx' :'370rpx' }});overflow: scroll;">
    <van-sidebar-item class="sidebar" wx:key="index" custom-class="{{sideKey - 1 == index? 'sidebar-item-before': (sideKey + 1 == index?'sidebar-item-next':'sidebar-item')}}" title="{{item.brandName}}" data-id="{{item.brandId}}" wx:for="{{typeList}}" />
  </view>
</van-sidebar>



<dk-popup type="sale"   subCol="calculationFormula" descCol="skuName" titleCol="skuModel"  priceCol="{{ 'sumPrice'}}" iconCol="imagesUrl"  value="{{dataItem}}" show="{{showPop}}" routeObjName="{{routeObjName}}" contentObj="{{popContent}}" bind:commit="editItems" bind:openPackageBox="openPackageBox"bind:changeStep="changeStep" bind:blurNumberField="blurNumberField" >
</dk-popup>

<!-- 箱片 -->
<dk-popup   type="basic"  title="修改包装数量"    titleCol="skuModel"  iconCol="imagesUrl"   value="{{dataItem}}" show="{{showPopBox}}" routeObjName="{{routeObjName}}"   contentObj="{{popContentBox}}" bind:changeStep="changeStep" bind:commit="editItemsBox" stepperDecimal ="decimalPlaces" ></dk-popup>

<dk-save-button  countName="商品数量" countEnd="" cssType="sale" model:value="{{btnFormData}}" btnAutoWidthFlag="{{false}}" btnRightFlag="{{true}}" buttonList="{{buttonList}}" contentList="{{contentList}}" bind:open="submit"></dk-save-button>