<wxs src='../../../utils/numberFormat.wxs' module="numberFormat"></wxs>

<loading wx:if="{{loading}}" loadingName="加载中" backgroundColor="#f2f2f2;" opacity="0.8"></loading>
<van-sticky scroll-top="0">
  <van-search model:value="{{ searchText }}" bind:search="doSearch" placeholder="请输入员工编码/员工名称" />
</van-sticky>

<van-empty wx:if="{{tableData.length<=0}}" description="暂无数据" />

<view wx:for="{{tableData}}" data-item="{{item}}" wx:key="StaffID" class="main-class">
  <view class="main-foot" style="border-radius: 15rpx;">
    <view class="table">

      <view style="display:flex;" >
        <view style="width: 10%;" data-value="{{item.checked}}" bind:tap="onChangeFlag" data-index="{{index}}">
          <view style="margin-top:45rpx;position: relative;">
            <van-checkbox value="{{item.checked}}" data-index="{{index}}" checked-color="#1989FA" />
          </view>
        </view>

        <view style="width: 90%;">
          <view style="width: 100%;padding-bottom: 5rpx;" class="table-row">
            <view style="width: 50%; font-size: 13px;line-height: 18px; text-align: left;">
              名称：{{item.staffName}}
            </view>
            <view style="width: 50%; font-size: 13px;line-height: 18px;text-align: left;">
              编码：{{item.staffCode}}
            </view>
          </view>


          <view style="width: 100%;padding-bottom: 5rpx;" class="table-row">
            <view style="width: 50%;font-size: 27rpx;  text-align: left;">
              主业务员：
              <van-switch size="30rpx" custom-class='switch' data-index="{{index}}" checked="{{ item.isMain }}" catchtap="onChangeSwitch" />
            </view>
            <view style="width: 50%;font-size: 27rpx;  text-align: left;">
              <view style="display: flex; ">
                <text style="padding-bottom: 15rpx;">提成比率：</text>
                <view wx:if="{{item.checked}}">
                  <input style=" width: 120rpx; display: inline-block;vertical-align: middle;" type="digit" bindinput="inputChange" data-key="commission" bindblur="inputBlurChange" data-id="{{item.staffId}}" data-index="{{index}}" value="{{item.commission}}" placeholder="" />
                </view>
                <view wx:else>
                  {{item.commission}}
                </view>
              </view>
            </view>
          </view>
        </view>
      </view>
    </view>

  </view>
</view>



<van-divider wx:if="{{nomore}}" contentPosition="center" borderColor="#DCDCDC">到底了~</van-divider>
<view style="height:200rpx;width:100%"></view>

<view class="bottom-class-1" >
  <view style="position:fixed;bottom:0;z-index: 10;text-align: center;width: 100%; margin-bottom: 42rpx;">
  <van-button color="#1B365D;" type="info" custom-style="width: 640rpx;height: 88rpx;" block round bindtap="btnOK">确定</van-button>
</view>
</view>
