<!-- 前台导入wxmlUtil.wxs -->
<wxs src='../../../../utils/wxmlUtil.wxs' module="wxmlUtil"></wxs>
<wxs src='../../../../utils/numberFormat.wxs' module="numberFormat"></wxs>
<van-dialog id="van-dialog" />
<loading wx:if="{{loading}}" loadingName="加载中" backgroundColor="#f2f2f2;" opacity="0.8"></loading>


<!-- 客户信息组件 -->
<view class="return-style-blue">
  <view style="flex-direction: column;justify-content: center;align-items: flex-start;background: linear-gradient(90.12deg, #718AC6 0.84%, #4A5E98 99.43%);border-radius: 15rpx 15rpx 0rpx 0rpx;">
    <view style="padding-right: 32rpx;padding-bottom: 15rpx;">
      <!-- 供应商 -->
      <view style="display: flex;padding-right: 32rpx;">
        <view style="padding-left: 32rpx;padding-top: 19rpx;width: 39rpx;">
          <view catchtap="toCustomer" style="width: 39rpx;height: 39rpx;background-color: #95A8CB;border-radius:50%;">
            <view style="width: 39rpx; height: 39rpx;text-align: center;">
              <van-image round width="28rpx" height="28rpx" src="/static/image/purchase-order-icon.png" />
            </view>
          </view>
        </view>
        <view style="padding-left: 14rpx;padding-top: 19rpx;font-size: 26rpx;line-height: 36rpx;color: #FFFFFF;">
          {{item.customerName}}
        </view>
        <view style="padding-left: 14rpx;padding-top: 19rpx;font-size: 26rpx;line-height: 36rpx;color: #FFFFFF;">
          {{item.customerPhone}}
        </view>
      </view>

      <!-- 地址 -->
      <view style="display: flex;padding-right: 32rpx;">
        <view style="padding-left: 32rpx;padding-top: 15rpx;font-size: 26rpx;line-height: 36rpx;color: #FFFFFF;">
          {{ wxmlUtil.addressToIndexOf(item.addressFull)}}
        </view>
      </view>
    </view>
  </view>
</view>

<view class="return-style">
  <view style="display: flex;  margin-bottom: 3vw;">  
    <view style="width:50%;color:#1B365D;text-align: center;font-size:4vw; border-right: 1rpx ;" bindtap="toChooseGoods">
      <view style="font-weight:bold;font-size:15px; margin-bottom: -11px;">
        <dk-cell left="0rpx" center="center" fontSize="13" contentFontSize="13" contentColor="#CAA977" spaceWidth="0" contentFontWeight="bold" content="{{item.sumRejectAmount}}"></dk-cell>
      </view>
      <view style="font-size:13px;">退货金额</view>
    </view>
    <view style="width:50%;color:#1B365D;text-align: center;font-size:4vw; " bindtap="scanQRCode">
      <view style="margin-bottom: -11px;">
        <dk-cell amount="{{false}}" left="0rpx" center="center" fontSize="13" contentFontSize="13" contentColor="#1B365D" spaceWidth="0" contentFontWeight="bold" content="{{item.sumRejectQuantity}}件"></dk-cell>
      </view>
      <view style="font-size:13px;">退货数量</view>
    </view>
  </view>
  <van-cell title="退款类别" border="{{ false }}" title-class="van-title-cell" value-class="van-value-cell" value="{{ item.rejectReasonType }}"></van-cell>
  <van-cell title="退货原因" border="{{ false }}" title-class="van-title-cell" value-class="van-value-cell" value="{{ item.rejectReason }}"></van-cell>
  <van-cell title="退款账号" border="{{ false }}" title-class="van-title-cell" value-class="van-value-cell" value="{{ item.refundAccount }}"></van-cell>
</view>




<!-- 商品信息 -->
<view style="margin: 26rpx 34rpx 26rpx 34rpx;border-radius: 15rpx;box-shadow:2px 2px 5px #e5e5e6;">
  <view style="background: #FFFFFF;box-shadow: 0rpx 10rpx 20rpx rgba(225, 229, 238, 0.6);border-radius:15rpx;">
    <view style=" padding: 10px 32rpx 10px 32rpx;color: #1B365D;font-size: 32rpx;">商品明细</view>
    <van-cell wx:if="{{goodsList.length==0}}" border="{{ false }}" style="border-radius: 15rpx;">
      <van-empty description="暂无明细" />
    </van-cell>
    <view wx:for="{{goodsList}}" data-item="{{item}}" wx:for-item="item" wx:key="index" border="{{ true }}">
      <van-card wx:if="{{index < 2  || collapseFlag}}" data-item="{{item}}" data-index="{{index}}">
        <view slot="thumb">
          <van-image radius="5px" width="80" height="80" src="{{item.iconThumPath }}" />
        </view>
        <view slot="title" style="display: flex;">
          <!-- 标题 -->
          <view style="display: flex;">
            <dk-title titleTag="{{item.brandName}}" title="{{item.skuName}}"></dk-title>
          </view>

        </view>
        <!-- 描述 -->
        <view slot="desc">
          <view style="display:flex;width: 100%;">
            <dk-text fontWeight="nomal" value="{{item.desc}}"></dk-text>
          </view>
          <view wx:if="{{item.nonGlassListShow}}" style="padding-top: 15rpx; padding-bottom: 15rpx; width: 100%;">
            <dk-text fontWeight="nomal" value="{{item.nonGlassListShow}}"></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="#CAA977" title="" content="{{item.orderPriceSale ? item.orderPriceSale : 0}}"></dk-cell>
            </view>
            <view style="width: 100%;text-align: right;font-size:24rpx;color: #95A8CB;line-height: 34rpx;">x {{item.rejectQuantity }}{{item.flgNonStandardType == 1 ? (' * ' + item.nonStandardArea + 'm²'): ''}}</view>
          </view>
        </view>

        <!-- 底部明细 -->
        <view slot="footer">
          <view style="margin-top: 15rpx;" wx:if="{{item.goodsSkuList.length > 0  || item.combinedList.length > 0}}">
            <view style="width: 100%;display: flex;">
              <view style="font-size:12px;color: #95A8CB;width: 50%;text-align: left;">
                明细
              </view>
              <view style="font-size:12px;color: #95A8CB;width: 50%;text-align: right;" data-item="{{item}}" data-index="{{index}}" catchtap="onChangeOpenGoodsList">
                {{item.packageDetailsFlag ? '收起' :'展开'}}
                <van-icon name="{{item.packageDetailsFlag ? 'arrow-up' :'arrow-down' }}" />
              </view>
            </view>

            <!--子件-->
            <view class="goods-class" wx:if="{{item.packageDetailsFlag}}">
              <view wx:for="{{item.goodsSkuList}}" data-item="{{item2}}" wx:for-item="item2" wx:key="index2">
                <view class="goods-item-class" wx:if="{{item2.hasChild == 0}}">
                  <view>
                    <van-image radius="15rpx" custom-class="goods-item-image" fit="fill" src="{{item2.iconThumPath }}" />
                  </view>
                  <view class="goods-item-tag">
                    <view style="display: flex;">
                      <view class="{{(item2.replaceableSku && item2.replaceableSku.length > 0)?'goods-item-title-replace':''}}">
                        <dk-title titleTag="{{item2.titleTag}}" title="{{item2.skuModel ? item2.skuModel: item2.skuCode}}"></dk-title>
                      </view>

                    </view>
                    <view style="width: 100%;display: flex;">
                      <dk-text fontWeight="normal" value="{{item2.skuName}}"></dk-text>
                    </view>
                    <!--子级明细价格-->
                    <view style="display: flex;width: 100%;flex-direction: row;">
                      <view style="width: 90%;">
                        <dk-cell contentFontSize="12" height="45rpx" fontWeight="bold" left="0rpx" contentColor="#CAA977" title="" content="{{ item2.priceSale}}"></dk-cell>
                      </view>
                      <view style="width: 10%">
                        <dk-text fontWeight="nomal" color="#95A8CB" value="x {{item2.tItemQuantity }}"></dk-text>
                      </view>

                    </view>
                  </view>
                </view>
              </view>
            </view>
          </view>
          <view class="hr"></view>
 
          <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 style="width: 50%;">
                <dk-cell fontSize="14" contentColor="#CAA977" titleColor="#1B365D;" contentRight="right" fontWeight="bold" content="{{item.orderOutItemRejectAmount}}"></dk-cell>
            </view>

          </view>
          <view class="divide-class"></view>
        </view>
      </van-card>

    </view>


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




  </view>


  <view style="background: #FFFFFF;box-shadow: 0rpx 10rpx 20rpx rgba(225, 229, 238, 0.6);border-radius: 15rpx;">


    <view style="display:flex;;margin-right: 24rpx;">
      <view style="width: 50%;">
        <view style="padding-left: 30rpx;padding-top: 25rpx;">
          <text style="color: #95A8CB;font-size: 28rpx;">{{item.categoryQuantity ? item.categoryQuantity : 0}} 品类,共计 {{item.sumQuantity ? item.sumQuantity :0}} 件</text>

        </view>
      </view>

      <view style="width: 50%;">
        <dk-cell fontSize="14" contentColor="#CAA977" titleColor="#1B365D;" contentRight="right" fontWeight="bold" title="合计金额" content="{{item.tSumAmount}}"></dk-cell>
      </view>
    </view>


  </view>

</view>







<!-- 其他信息 -->
<view style="margin: 10px 32rpx 10px 32rpx;margin-top: 41rpx;border-radius: 15rpx;box-shadow:2px 2px 5px #e5e5e6;">
  <view style="background: #FFFFFF;box-shadow: 0rpx 10rpx 20rpx rgba(225, 229, 238, 0.6);border-radius:15rpx;">
    <view style=" padding: 10px 32rpx 10px 32rpx;color: #1B365D;font-size: 32rpx;">其他信息</view>


    <van-cell title="备注" border="{{ false }}" title-class="van-title-cell" value="{{ item.remarks }}"></van-cell>

    <view style="display:flex;width:100%;margin: 1vw;padding-top:20rpx;">
      <view style="width: 15%; flex:1;color: #95A8CB;font-size: 28rpx;padding-left: 27rpx;">附件</view>
      <view style="width: 85%;text-align: left;">
        <van-uploader max-count="5" accept="image" style="margin-left: 4%;border-radius: 15rpx;" disabled="{{true}}" deletable="{{false}}" preview-size="160rpx;" file-list="{{ fileList }}" multiple="false" imageFit="aspectFit" />
      </view>
    </view>

  </view>

</view>

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

<!--  关闭 -->
<dk-save-bottom loading="{{loading}}" flagTypeName="purchase-order" totallength="{{numberFormat.toThousandCents(tSumAmount)}}" item="{{item}}" bind:allClean="deal" bind:submit="submit"></dk-save-bottom>