relateTwoStep.vue 3.21 KB
<template>
  <div class="relate-two-step">
    <div class="box">
      <div class="container">
        <div class="title">数据校验结果</div>
        <div class="content">
          <div class="row">
            <div class="m-b-16">
              <div class="m-b-2" v-for="(item, index) in checkedList.trade" :key="index">
                <span class="label">交易参考号:</span>
                {{item.tradeNo}}
              </div>
            </div>

            <div class="m-b-16">
              <div class="m-b-2" v-for="(item, index) in checkedList.order" :key="index">
                <span class="label">主订单号:</span>
                {{item.orderCode}}
              </div>
            </div>

            <div class="success-txt">校验通过,请点击“完成”进行关联!</div>

          </div>
        </div>
      </div>
    </div>
    <div class="flex">
      <div class="footer">
        <el-button @click="handlePreStep" :loading="isConfirm">上一步</el-button>
        <el-button type="primary" @click="handleConfirm" :loading="isConfirm">完成</el-button>
      </div>
    </div>
  </div>
</template>
<script>
import orderManage from "@api/orderManage"
export default {
  name: "relateTwoStep",
  props: {
    checkedList: {
      type: Object,
      default: () => {
        return {
          trade: [],
          order: []
        }
      }
    }
  },
  data() {
    return {
      isConfirm: false
    }
  },
  mounted() {
  },
  watch: {},
  methods: {
    handlePreStep() {
      if (this.isConfirm) {
        return true
      }
      this.$emit('handlePreStep')
    },
    handleConfirm() {
      if (this.isConfirm) {
        return true
      }
      const params = {
        tradeNos: this.checkedList.trade.map(item => item.tradeNo),
        orderCodes: this.checkedList.order.map(item => item.orderCode),
      }
      this.isConfirm = true
      orderManage.batchWaitOrderApi(params).then(res => {
        console.log(res)
        if (res) {
          this.$message.success("关联成功")
          this.$router.push({
            name: "orderSupplement"
          })
        }
      }).finally(() => {
        this.isConfirm = false
      })
    },
  }
}
</script>
<style lang="scss" scoped>
.relate-two-step {
  .flex {
    display: flex;
    justify-content: center;
  }
  .m-b-16 {
    margin-bottom: 16px;
  }
  .m-b-2 {
    margin-bottom: 2px;
  }
  .box {
    display: flex;
    justify-content: center;
    .container {
      width: 416px;
      height: 544px;
      border-radius: 2px;
      opacity: 1;
      border: 1px solid #e5e5e5;
    }
    .title {
      box-sizing: border-box;
      width: 100%;
      height: 40px;
      line-height: 40px;
      color: #333333;
      font-size: 16px;
      text-align: center;
      border-bottom: 1px solid #e5e5e5;
      background: #f8faff;
    }
    .content {
      box-sizing: border-box;
      height: 456px;
      overflow: scroll;
      padding: 16px;
    }
    .row {
      color: #333333;
      font-size: 14px;
      .label {
        color: #666666;
      }
    }
  }
  .success-txt {
    color: #2cca74;
    font-size: 14px;
  }
  .footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
  }
}
</style>