<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" />
<!-- 客户信息 -->
<view style="margin: 42rpx 34rpx 0rpx 34rpx;border-radius: 15rpx;box-shadow:2px 2px 5px #e5e5e6;">
  <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;">
    <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="20rpx" height="24rpx" src="/static/image/Vector.png" />
          </view>
        </view>
      </view>
      <!-- 客户名称 供应商名称  -->
      <view style="padding-left: 14rpx;padding-top: 19rpx;font-size: 13px;line-height: 36rpx;color: #FFFFFF;">
        {{form.objInfo.cusName?form.objInfo.cusName:form.objInfo.supName}}
      </view>
      <!-- 客户电话 供应商电话  -->
      <view style="padding-left: 22rpx;padding-top: 19rpx;font-size: 13px;line-height: 36rpx;color: #FFFFFF;">
        {{form.objInfo.cusPhone?form.objInfo.cusPhone:form.objInfo.contactPhone}}
      </view>
    </view>
    <!-- 地址  -->
    <view style="display: flex;padding-right: 32rpx;padding-bottom: 15rpx;">
      <view style="padding-left: 32rpx;padding-top: 15rpx;font-size: 13px;line-height: 36rpx;color: #FFFFFF;">
        {{wxmlUtil.addressToIndexOf(form.objInfo.addressFull?form.objInfo.addressFull:form.objInfo.returnAddress)}}
      </view>
    </view>


  </view>
</view>


<!-- 收款方式 -->
<view style="margin: 24rpx 34rpx 26rpx 34rpx;">
  <scroll-view scroll-y="true" style="height:860rpx;" bindscrolltolower="paging" scroll-top="{{topNum}}">
    <view wx:for="{{tableData}}" style="width: 100%;">
      <view class="choose-item {{(item.checked == true && item.macReceiptCode) ? 'choose-item-select' : 'choose-item-unchecked'}}">
        <!-- <view class="thick-line" wx:if="{{item.checked}}"></view> -->
        <view style="width:40rpx;place-self: center;padding-left: 34rpx;">

          <view style="position: relative;">
            <van-checkbox value="{{item.checked}}" data-index="{{index}}" data-item="{{item}}"  bind:change="catchtapCheck" checked-color="#1989FA" />
          </view>
        </view>

        <view class="choose-item-two" style="{{(item.checked == true && item.macReceiptCode) ? ( item.checked && settlementTypeListLength > 1 ?'padding-top:43rpx;' :'padding-top:70rpx;') : 'display: flex;  align-items: center;'}}">
          <view class="type-name">
            {{item.macName ? item.macName : ''}}
          </view>
          <view style="margin-left:27rpx ">
            <dk-tag border="1rpx solid #606EB2" height="35rpx" color="transparent" textColor="#606EB2" radius="5rpx" roundFlag="{{true}}" size="large" value="{{item.macTypeName ? item.macTypeName : ''}}"></dk-tag>
          </view>
      
          <view wx:if="{{item.checked && settlementTypeListLength > 1 }}" style="text-align:left;">
            <dk-number-input signSize="11px" center="left" fontSize="15" inputColor="#CAA977;" fontWeight="500" negative="{{negative}}" min="{{min}}" data-key="priceSale" inputValue="{{item.sumAmount ? item.sumAmount : 0}}" data-value="{{item.sumAmount}}" data-index="{{index}}" bind:triggerBindValue="sumAmountBindValue" bind:triggerBindBlur="sumAmountBlurValue"></dk-number-input>
          </view>
        </view>
        <view class="image-code" wx:if="{{item.checked && item.macReceiptCode }}" style="margin-top: 32rpx;margin-right: 40rpx;margin-bottom: 26rpx;border: 1rpx solid #000000;border-radius: 15rpx;">
          <image wx:if="{{item.macReceiptCode}}" style="height:166rpx;width:166rpx;border-radius: 15rpx;" src="{{item.macReceiptCode}}" bindtap="previewImg" data-imgUrl="{{item.macReceiptCode}}" />
        </view>
      </view>
    </view>
    <view style="height: 90rpx;"></view>
  </scroll-view>
</view>

<!-- 确认收款 -->
<view style="position:fixed;bottom:0;width:100%;z-index: 10; ">
  <!-- 请输入收款金额 -->
  <view style="z-index: 11;background-color:white;margin-bottom:90rpx;margin-left: 55rpx;margin-right: 55rpx;border-radius: 15rpx;height:256rpx;">

    <view style="height: 38rpx;"></view>
    <view style="text-align:center;font-size: 15px;line-height: 20px;color: #1B365D;">
      <dk-text fontSize="15px" value="需收款"></dk-text>
    </view>
    <view style="padding-top: 10rpx; text-align:center;">

      <dk-number-input readonly="{{settlementTypeListLength > 1}}" negative="{{negative}}" min="{{min}}" signSize="15px" fontSize="27" color fontWeight="600" data-key="priceSale" inputValue="{{form.sumAmount}}" data-value="{{form.sumAmount}}" bind:triggerBindValue="changeSalesPriceField" ></dk-number-input>
    </view>

    <view style="z-index: 12;margin-top:40rpx;box-shadow: 0px 4rpx 16rpx rgba(190, 144, 73, 0.5);border-radius: 15rpx;">

      <van-button round size="large" disabled="{{loadingButtonFlag}}" loading="{{loadingButtonFlag}}" color="#3E69F6" custom-style="width:100%;" bind:click="save" type="info">确认收款
      </van-button>
    </view>
  </view>

</view>