merchantCheckDetail.vue 9 KB
<template>
  <d2-Container>
    <div class="merchant-checkdetail">
      <div class="title">
        <el-tabs v-model="activeName" @tab-click="handleClick">
          <el-tab-pane label="商户关系" name="third"></el-tab-pane>
          <el-tab-pane label="分账规则" name="first"></el-tab-pane>
          <el-tab-pane label="对账规则" name="second"></el-tab-pane>
        </el-tabs>
      </div>
      <!-- <div class="type">
        <div class="btn" :class="{act:activeType==1}" @click="handleType(1)">全部分类</div>
        <div class="btn" :class="{act:activeType==2}" @click="handleType(2)">特殊品类</div>
      </div> -->

      <!-- 商户关系 -->
      <template v-if="activeName == 'third'">
        <merchantRelationships :form-item="checkDetailItem" />
      </template>

      <!-- 分账 -->
      <template v-if="activeName == 'first'">
        <ledgerAccount :items="checkDetailItem" />
      </template>

      <!-- 对账 -->
      <template v-if="activeName == 'second'">
        <reconciliation v-if="checkRecordList" :form-item="checkRecordList"
                        :items="checkRecordList.goodsTypeGroupReconciliationRules || []" />
      </template>

      <div class="btns">
        <el-button @click="handleConfirm" size="small" type="primary">
          返回
        </el-button>
        <!-- <el-button size="small"
                   @click="handleReset"> 返回 </el-button> -->
      </div>
    </div>
  </d2-Container>
</template>

<script>
import ledgerAccount from './components/ledgerAccount.vue'
import reconciliation from './components/reconciliation.vue'
import merchantRelationships from './components/merchantRelationships.vue'
import {
  getDistributeRuleApi,
  getEffectRuleApi,
  getMerchantRelationDetailApi
} from "@api/merchant"
export default {
  name: "MerchantCheckDetail",
  props: {},
  data() {
    return {
      activeName: "third",
      merchantRow: {},
      // 分账数据
      checkDetailItem: {},
      // 对账数据
      checkRecordList: {}
    }
  },
  created() {
    this.getRowItem()
  },
  mounted() {
    // 分账
    // this.getDistributeRule()
    // 商户关系
    this.getMerchantRelationDetail()
  },
  methods: {
    async init() {
      if (this.activeName == "first") {
        // 分账
        this.getDistributeRule()
      } else if (this.activeName == "second") {
        // 对账
        this.getEffectRule()
      } else {
        // 商户关系
        this.getMerchantRelationDetail()
      }
    },
    // 分账
    async getDistributeRule() {
      const params = {
        merchantId: this.merchantRow.merchantId,
        sceneType: this.merchantRow.scene,
        expenseCategroyRulsBuildType: 2
      }
      const res = await getDistributeRuleApi(params)
      console.log('res: ', res)
      this.checkDetailItem = res
    },
    // 对账
    async getEffectRule() {
      const params = {
        merchantId: this.merchantRow.merchantId,
        sceneType: this.merchantRow.scene
      }
      const res = await getEffectRuleApi(params)
      console.log(res)
      this.checkRecordList = res
      // this.checkRecordList = res?.goodsTypeGroupReconciliationRules
      // console.log('res: ', res)
    },
    // 商户关系
    async getMerchantRelationDetail() {
      const params = {
        merchantId: this.merchantRow.merchantId,
        scene: this.merchantRow.scene
      }
      const res = await getMerchantRelationDetailApi(params)
      this.checkDetailItem = res
    },
    getRowItem() {
      const params = this.$route.query?.params
      if (params) {
        this.merchantRow = JSON.parse(params)
        // console.log("is.merchantRow", this.merchantRow)
      }
    },
    handleClick(tab) {
      // console.log(tab.name)
      this.activeName = tab.name
      this.init()
    },

    // handleType(num) {
    //   this.activeType = num
    // },
    // 保存
    handleConfirm() {
      this.$router.go(-1)
    },
    // 取消
    handleReset() {
      this.$router.go(-1)
    }
  },
  components: {
    ledgerAccount,
    reconciliation,
    merchantRelationships
  },
  computed: {}
}
</script>
<style lang="scss">
$color: #2a58ad;

.merchant-checkdetail {
  // height: 100%;
  padding-left: 20px;
  padding-right: 16px;
  padding-bottom: 20px;

  // overflow-y: auto;
  .title {}

  .type {
    margin-top: 6px;
    display: flex;

    .btn {
      width: 96px;
      height: 40px;
      background: #f8f8f8;
      border-radius: 4px 4px 0 0;
      line-height: 40px;
      text-align: center;
      cursor: pointer;
    }

    .act {
      font-weight: 500;
      color: $color;
      background: #fff;
    }
  }

  .content {
    background: #ffffff;

    .part1 {
      .tit {
        display: flex;
        align-items: center;
        height: 48px;
        background: #ffffff;
        font-weight: 500;
        font-size: 18px;
        color: #333333;
        box-sizing: border-box;
        border-bottom: 1px solid #ebebeb;

        .line {
          margin-left: 16px;
          margin-right: 8px;
          width: 4px;
          height: 16px;
          background: $color;
          border-radius: 2px;
        }
      }

      .cont {
        display: flex;
        flex-flow: column;

        &.cont-table {
          display: block;
        }

        &.cont-table1 {
          padding: 16px 20px 20px;
        }

        display: flex;
        flex-wrap: wrap;
        flex-flow: column;
        padding: 16px 20px 32px;

        .mt16 {
          margin-top: 16px;
        }

        .msg {
          padding-bottom: 12px;
          flex: 1 0 auto;
          // width: 50%;
          display: flex;
          align-items: flex-start;
          line-height: 24px;

          .msg-title {
            width: 138px;
            // height: 20px;
            font-size: 14px;
            color: #666666;
            text-align: right;
          }

          .msg-val {
            // height: 20px;
            font-size: 14px;
            color: #1d1d1d;
            text-align: left;
          }
        }

        .msg-name-val {
          margin-left: 138px;
          font-size: 14px;
        }

        .compute {
          margin-bottom: 10px;
          display: flex;
          font-size: 14px;
          color: #666666;

          .manner {}

          .online {
            &+.online {
              margin-left: 44px;
            }

            color: $color;
          }
        }

        .white-table {
          margin-bottom: 16px;
          display: flex;
          flex-wrap: wrap;
          font-size: 14px;
          color: #666666;
          border-top: 1px solid #e5e5e5;
          border-left: 1px solid #e5e5e5;

          .type1 {
            // &:first-child {
            //   border-top: 1px solid #E5E5E5;
            //   border-left: 1px solid #E5E5E5;
            // }
            display: flex;
            width: 33.33%;
            height: 38px;
            line-height: 38px;
            border-bottom: 1px solid #e5e5e5;
            border-right: 1px solid #e5e5e5;
            box-sizing: border-box;

            .type-name {
              text-align: right;
              width: 90px;
              flex-shrink: 0;
            }

            .type-val {
              // flex: 1;
              // display: flex;
              // color: #1d1d1d;
              flex-shrink: 0;
              color: #1d1d1d;
              display: inline-block !important;
              width: calc(100% - 90px);
              white-space: nowrap;
              overflow: hidden;
              text-overflow: ellipsis;
            }

            .type-color {
              color: $color;
            }

            .date {
              margin-right: 10px;
              color: #1d1d1d;
            }
          }

          .type2 {
            width: 66.66%;
            .type-val{
              display: inline-block !important;
              width: calc(100% - 90px);
              white-space: nowrap;
              overflow: hidden;
              text-overflow: ellipsis;
            }
          }
        }

        .title-table {
          font-size: 14px;
          color: #333333;
          border: 1px solid #e8e8ea;

          .head {
            display: flex;
            height: 40px;
            line-height: 40px;
            text-align: center;
            background: #f2f4f7;

            .cost {
              &+.cost {
                border-left: 1px solid #e8e8ea;
              }

              flex: 1;
            }
          }

          .detail {
            display: flex;
            min-height: 40px;
            color: #666666;
            border-top: 1px solid #e8e8ea;

            .detail-i {
              display: flex;
              justify-content: center;
              align-items: center;

              &+.detail-i {
                border-left: 1px solid #e8e8ea;
              }

              flex: 1;
            }

          }
        }
      }
    }

    // .part2 {
    // }
    // .part3 {
    // }
    // .part4 {
    // }
    // .part5 {
    // }
  }

  .btns {
    margin-top: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
  }
}
</style>