<template>
  <template v-if="type == 'ladder'">
    <!-- 标题 -->
    <div class="ladder-title-list">
      <div class="ladder-title-item">价格区间：</div>
      <div class="ladder-title-item">服务商底价：</div>
      <div class="ladder-title-item">子代理默认费率：</div>
      <div class="ladder-title-item">子商户默认费率：</div>
    </div>
    <!-- 输入框 -->
    <div v-for="(v, i) in vdata.ladderArray" :key="i" class="ladder-input-list">
      <div class="ladder-input-item">
        <a-input>
          <template #addonAfter> ~</template>
        </a-input>
        <a-input>
          <template #addonAfter> %</template>
        </a-input>
      </div>
      <div class="ladder-input-item">
        <a-input>
          <template #addonAfter> %</template>
        </a-input>
      </div>
      <div class="ladder-input-item">
        <a-input>
          <template #addonAfter> %</template>
        </a-input>
      </div>
      <div class="ladder-input-item">
        <a-input>
          <template #addonAfter> %</template>
        </a-input>
      </div>
      <div class="ladder-del">
        <a-button danger type="text" @click="vdata.ladderArray.splice(i, 1)">删除</a-button>
      </div>
    </div>
    <!-- 新增阶梯费率 -->
    <div class="add-ladder">
      <div class="add-ladder-item">
        <a-button block type="dashed" @click="vdata.ladderArray.push({})">
          <plus-outlined />
          新增阶梯费率
        </a-button>
      </div>
    </div>
  </template>
  <template v-if="type == 'highConfig'">
    <div class="ladder-title-list">
      <div class="ladder-title-item">服务商保底/封顶费用：</div>
      <div class="ladder-title-item">子代理默认保底/封顶费用：</div>
      <div class="ladder-title-item">子商户默认保底/封顶费用：</div>
    </div>
    <div class="ladder-input-list">
      <div class="ladder-input-item ladder-high">
        <a-input>
          <template #addonBefore> 保底费用：</template>
          <template #addonAfter> 元</template>
        </a-input>
        <a-input>
          <template #addonBefore> 封顶费用：</template>
          <template #addonAfter> 元</template>
        </a-input>
      </div>
      <div class="ladder-input-item ladder-high">
        <a-input>
          <template #addonBefore> 保底费用：</template>
          <template #addonAfter> 元</template>
        </a-input>
        <a-input>
          <template #addonBefore> 封顶费用：</template>
          <template #addonAfter> 元</template>
        </a-input>
      </div>
      <div class="ladder-input-item ladder-high">
        <a-input>
          <template #addonBefore> 保底费用：</template>
          <template #addonAfter> 元</template>
        </a-input>
        <a-input>
          <template #addonBefore> 封顶费用：</template>
          <template #addonAfter> 元</template>
        </a-input>
      </div>
    </div>
  </template>
  <template v-if="type=='UnionPay'">
    <div class="ladder-title-list">
      <div class="ladder-title-item">类型：</div>
      <div class="ladder-title-item">服务商保底/封顶费用：</div>
      <div class="ladder-title-item">子代理默认保底/封顶费用：</div>
      <div class="ladder-title-item">子商户默认保底/封顶费用：</div>
    </div>
    <div class="ladder-input-list">
      <div class="ladder-input-item ladder-high">借记卡（储蓄卡）：</div>
      <div class="ladder-input-item ladder-high">
        <a-input>
          <template #addonBefore> 保底费用：</template>
          <template #addonAfter> 元</template>
        </a-input>
        <a-input>
          <template #addonBefore> 封顶费用：</template>
          <template #addonAfter> 元</template>
        </a-input>
      </div>
      <div class="ladder-input-item ladder-high">
        <a-input>
          <template #addonBefore> 保底费用：</template>
          <template #addonAfter> 元</template>
        </a-input>
        <a-input>
          <template #addonBefore> 封顶费用：</template>
          <template #addonAfter> 元</template>
        </a-input>
      </div>
      <div class="ladder-input-item ladder-high">
        <a-input>
          <template #addonBefore> 保底费用：</template>
          <template #addonAfter> 元</template>
        </a-input>
        <a-input>
          <template #addonBefore> 封顶费用：</template>
          <template #addonAfter> 元</template>
        </a-input>
      </div>
    </div>
    <div class="ladder-input-list">
      <div class="ladder-input-item ladder-high">贷记卡（信用卡）：</div>
      <div class="ladder-input-item ladder-high">
        <a-input>
          <template #addonBefore> 保底费用：</template>
          <template #addonAfter> 元</template>
        </a-input>
        <a-input>
          <template #addonBefore> 封顶费用：</template>
          <template #addonAfter> 元</template>
        </a-input>
      </div>
      <div class="ladder-input-item ladder-high">
        <a-input>
          <template #addonBefore> 保底费用：</template>
          <template #addonAfter> 元</template>
        </a-input>
        <a-input>
          <template #addonBefore> 封顶费用：</template>
          <template #addonAfter> 元</template>
        </a-input>
      </div>
      <div class="ladder-input-item ladder-high">
        <a-input>
          <template #addonBefore> 保底费用：</template>
          <template #addonAfter> 元</template>
        </a-input>
        <a-input>
          <template #addonBefore> 封顶费用：</template>
          <template #addonAfter> 元</template>
        </a-input>
      </div>
    </div>
  </template>
</template>

<script lang="ts" setup>
import {defineProps, reactive} from 'vue'

const props: any = defineProps({
  type: {type: String, default: 'ladder'}, //类型 默认阶梯
})
const vdata: any = reactive({
  ladderArray: [{}],
})
</script>

<style lang="less" scoped>
.ladder-title-list {
  display: flex;
  margin-bottom: 20px;

  .ladder-title-item {
    width: 300px;
  }

  .ladder-title-item:nth-child(n + 2) {
    margin-left: 70px;
    font-size: 14px;
  }
}

.ladder-input-list {
  display: flex;
  //align-items: center;
  margin-bottom: 20px;

  .ladder-input-item {
    width: 300px;
  }

  .ladder-input-item:nth-child(1) {
    display: flex;
  }

  .ladder-input-item:nth-child(n + 2) {
    margin-left: 70px;
  }

  .ladder-del {
    margin-left: 40px;
  }
}

.add-ladder {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 30px;

  .add-ladder-item {
    width: 300px;
  }
}

.ladder-high {
  flex-direction: column;

  .ant-input-group-wrapper:nth-child(1) {
    margin-bottom: 20px;
  }
}
</style>
