<!-- 前台导入wxmlUtil.wxs -->
<wxs src='/utils/wxmlUtil.wxs' module="wxmlUtil"></wxs>
<wxs src='/utils/numberFormat.wxs' module="numberFormat"></wxs>
<!-- 设置金额和价格的小数位数 -->

<loading wx:if="{{loading}}" loadingName="加载中" backgroundColor="#f2f2f2;" opacity="0.8"></loading>

<van-sticky scroll-top="0">
  <!-- 查询条件 -->
  <dk-dropdown-menu model:value="{{searchForm}}" menuList="{{searchContent}}" pullMenuList="{{pullMenuList}}" bind:search="searchData" searchTextPlaceholder="{{wxmlUtil.setSearchPlaceholder($t,['cusName','cusPhone','adddressFull','remarks'])}}">
  </dk-dropdown-menu>
</van-sticky>

<!-- 暂无数据 -->
<van-empty wx:if="{{tableData.length<=0}}" description="{{$t['nodata']}}"  />

<view wx:for="{{tableData}}" data-item="{{item}}" wx:key="index" class="main-class">
  <!-- 上半部分 -->
  <view class="main-foot" style="border-radius: 15rpx;background-size: 100% 172rpx;">
    <view class="table-content" data-item="{{item}}">
      <view class="table-content-row" style="padding-left: 20rpx;padding-right: 20rpx;">
        <view style="display: flex;width: 100%;">
          <!-- 复选框 -->
          <view>
            <van-checkbox value="{{ item.checked }}" data-index="{{index}}" bind:change="onListChange"></van-checkbox>
          </view>
          <view style="margin-left: 20rpx;width: 39rpx;height: 39rpx;background-color: #95A8CB;border-radius:50%;margin-top: 5rpx;">
            <view style="width: 39rpx; height: 39rpx;text-align: center;">
              <van-image round width="20rpx" height="24rpx" src="/static/image/Vector.png" />
            </view>
          </view>

          <view data-item="{{item}}" style="display:flex;padding-left: 14rpx;font-size: 30rpx;justify-content: center;align-items: center;">
            <dk-text bind:tap="toCustomer" data-item="{{item}}" textDecoration="underline" fontSize="26rpx" value="{{item.cusName}}"></dk-text>
          </view>
          <view data-item="{{item}}" style="display:flex;padding-left: 30rpx;font-size: 30rpx;justify-content: center;align-items: center;">
            <dk-text bind:tap="toCustomer" data-item="{{item}}" textDecoration="underline" fontSize="26rpx" value="{{item.cusPhone}}"></dk-text>
          </view>
        </view>

        <view style="font-size: 26rpx;color:#1B365D;font-weight: bold;padding-top: 10rpx;">{{item.addressFull}}</view>
        <view style="display: flex;padding-top: 10rpx;">
          <view style="font-size: 24rpx;width: 55%;color:#1B365D;">{{item.orderNo}}</view>
          <view style="width: 45%;font-size: 24rpx;color:#95A8CB;display: flex;justify-content: center;align-items: center;text-align: center;">
            <view>{{$t['expectedDelivery']}}：{{item.deliveryDate ? wxmlUtil.format(item.deliveryDate) : ''}}</view>
            <view style="padding-left: 10rpx;display: flex;justify-content: center;align-items: center;">
              <van-icon name="arrow" size="24rpx" />
            </view>
          </view>
        </view>
      </view>

      <!-- 商品信息 -->
      <view style="background: #FFFFFF;">
        <view wx:if="{{(!item.collapseFlag) || item.orderItemResponseList.length <3}}">
          <view style=" padding: 10px 32rpx 10px 32rpx;color: #1B365D;font-size: 30rpx;">{{$t['goodsDetail']}}</view>
          <van-cell wx:if="{{item.orderItemResponseList.length==0}}" border="{{ false }}" style="border-radius: 15rpx;">
            <van-empty description="{{$t['nodata']}}" />
          </van-cell>
          <view wx:for="{{item.orderItemResponseList }}" data-item="{{item_}}" wx:for-item="item_" wx:for-index="index_" wx:key="index" border="{{ true }}">
            <view style="display: flex;">
              <!-- 复选框 -->
              <view style="width: 15%;display: flex;justify-content: center;align-items: center;text-align: center;">
                <van-checkbox value="{{ item_.checked }}" data-index="{{index}}" data-index_="{{index_}}" bind:change="onListItemChange"></van-checkbox>
              </view>
              <!-- 商品信息 -->
              <view style="width: 90%;">
                <van-card data-item="{{item_}}" data-index="{{index_}}">
                  <view slot="thumb">
                    <van-image radius="5px" width="80" height="80" src="{{item_.imagesUrl }}" />
                  </view>
                  <view slot="title" style="display: flex;">
                    <!-- 标题 -->
                    <view style="display: flex;">
                      <dk-title  title="{{item_.skuModel}}"></dk-title>
                    </view>
                  </view>
                  <!-- 描述 -->
                  <view slot="desc">
                    <view style="display:flex;width: 100%;">
                      <dk-text fontWeight="nomal" value="{{item_.skuName}}"></dk-text>
                    </view>
                    
                  </view>
                  <view slot="price">
                    <view style="display: flex;width: 100%;flex-direction: row; ">
                      <view style="width: 100%;">
                        <dk-cell contentFontSize="16" height="45rpx" fontWeight="bold" left="0rpx" contentColor="#FF7B1A" title="" content="{{item_.itemAmt ? item_.itemAmt : 0}}"></dk-cell>
                      </view>
                      <view style="width: 100%;text-align: right;font-size:24rpx;color: #95A8CB;line-height: 34rpx;">x {{item_.itemQty }} </view>
                    </view>
                  </view>
                  <!-- 底部明细 -->
                  <view slot="footer">
       
                    <view style="display: flex;width: 100%;align-items: center;height: 60rpx;" data-index="{{index_}}" catchtap="openRemark">
                      <view style="width: 100%;text-align: left;font-size: 24rpx;color: #95A8CB;">
                        备注：<span style="line-height:56rpx;">{{item_.remarks ? item_.remarks : ''}}</span>
                      </view>
                    </view>
                    <view wx:if="{{item.orderItemResponseList.length > 1}}" class="hr"></view>
                  </view>
                </van-card>
              </view>
            </view>
          </view>
        </view>
      </view>

      <view catchtap="collapseFlagChange" data-index="{{index}}" wx:if="{{item.orderItemResponseList.length >= 3}}" style="padding: 30rpx 32rpx 30rpx 32rpx;border-radius: 16rpx;color:#95A8CB;text-align: center;font-size: 26rpx;display: flex;justify-content: center;">
        <view>{{item.collapseFlag ? '展开查看更多' : '收起查看更多'}}</view>
        <view style="padding-left: 10rpx;">
          <van-icon name="{{item.collapseFlag ? 'arrow-down':'arrow-up'}}" size="24rpx" />
        </view>
      </view>

      <view wx:else style="padding: 0rpx 32rpx 10rpx 32rpx;border-radius: 16rpx;"></view>
    </view>


  </view>

</view>

<van-divider wx:if="{{noMore}}" contentPosition="center" borderColor="#DCDCDC">{{$t['noMore']}}~</van-divider>
<view style="height: 200rpx;"></view>
 
  <!-- 新建按钮 -->
<dk-save-button model:value="{{btnFormData}}" btnAutoWidthFlag="{{false}}" btnRightFlag="{{true}}" buttonList="{{buttonList}}" contentList="{{contentList}}"   bind:change = "onListAllChange" bind:open="open"></dk-save-button>


 

 