ruleInfoDialog.vue 9.93 KB
<!-- 选择分账规则弹窗 -->
<template>
  <d2-dialog title="查看财务规则操作记录"
             :is-visible="ruleInfoVisible"
             class="ruleInfoDialog"
             width="65%"
             :no-cancel="true"
             @confirmDialog="handleAddConfirm"
             @closeDialog="handleClose">
    <el-form class="rule-form"
             label-width="110px"
             :inline="true">
      <el-form-item class="d2-drawer-item"
                    label="订单所属商户:">
        <span>{{ recordInfo.merchantName }}</span>
      </el-form-item>
      <el-form-item class="d2-drawer-item"
                    label="主订单编号:">
        <!-- <span>{{ recordInfo.inputtedOrderCode }}</span> -->
        <span>{{ recordInfo.orderCode }}</span>
      </el-form-item>
      <el-form-item class="d2-drawer-item"
                    label="订单金额:">
        <!-- <span>{{ recordInfo.totalFee ? '¥' + recordInfo.totalFee / 100 : '' }}</span> -->
        <span>{{ recordInfo.totalPrice ? '¥' + recordInfo.totalPrice : '' }}</span>
      </el-form-item>
      <el-form-item class="d2-drawer-item"
                    label="支付时间:">
        <!-- <span>{{ recordInfo.accountDate }}</span> -->
        <span>{{ recordInfo.paySuccessDate }}</span>
      </el-form-item>
    </el-form>
    <div class="fontD">已应用分账规则:</div>
    <div>
      <div class="merchant-checkrecord">
        <div class="account-detail"
             ref="accountDetail">
          <div v-if="settleDistributeRuleEffect">
            <p class="sub-title"
               :class="{ 'sub-border': !settleDistributeRuleEffect.show }">
              <span class="label">
                <span>{{ settleDistributeRuleEffect.formatEffectStartDate }}</span>
                <span v-if="settleDistributeRuleEffect.formatEffectStartDate"> - </span>
                <span :class="{ labelColor: !settleDistributeRuleEffect.formatEffectEndDate }">{{
                  settleDistributeRuleEffect.formatEffectStartDate
                    ? settleDistributeRuleEffect.formatEffectEndDate
                      ? settleDistributeRuleEffect.formatEffectEndDate
                      : "生效中"
                    : "待生效"
                }}</span>
              </span>
              <span class="updatedInfo">
                操作人: {{ settleDistributeRuleEffect.updatedBy }} 操作时间:
                {{ settleDistributeRuleEffect.formatUpdatedDate }}
              </span>
            </p>
          </div>

          <div v-else
               class="nothingtips">
            <img style="height: 109px; width: 109px"
                 src="../systemConfig/merchant/images/empty.png" />
            <p class="title">暂无分账规则</p>
            <p class="tips">快去设置看看~</p>
          </div>
        </div>
      </div>
    </div>
    <div class="fontD">已应用对账规则:</div>
    <div>
      <div class="merchant-checkrecord">
        <div class="account-detail"
             ref="accountDetail">
          <div v-if="reconciliationRuleEffect">
            <p class="sub-title"
               :class="{ 'sub-border': !reconciliationRuleEffect.show }">
              <span class="label">
                <span>{{ reconciliationRuleEffect.formatEffectStartDate }}</span>
                <span v-if="reconciliationRuleEffect.formatEffectStartDate"> - </span>
                <span :class="{ labelColor: !reconciliationRuleEffect.formatEffectEndDate }">{{
                  reconciliationRuleEffect.formatEffectStartDate
                    ? reconciliationRuleEffect.formatEffectEndDate
                      ? reconciliationRuleEffect.formatEffectEndDate
                      : "生效中"
                    : "待生效"
                }}</span>
              </span>
              <span class="updatedInfo">
                操作人: {{ reconciliationRuleEffect.updatedBy }} 操作时间:
                {{ reconciliationRuleEffect.formatUpdatedDate }}
              </span>
            </p>
          </div>

          <div v-else
               class="nothingtips">
            <img style="height: 109px; width: 109px"
                 src="../systemConfig/merchant/images/empty.png" />
            <p class="title">暂无对账规则</p>
            <p class="tips">快去设置看看~</p>
          </div>
        </div>
      </div>
    </div>
    <el-form class="rule-form"
             style="marginTop:35px"
             label-width="110px"
             :inline="true">
      <el-form-item class="d2-drawer-item"
                    label="分账操作人:">
        <span>{{ $$(settleDistributeRuleEffect, 'divisionOperBy') }}</span>
      </el-form-item>
      <el-form-item class="d2-drawer-item"
                    label="分账操作时间:">
        <span>{{ $$(settleDistributeRuleEffect, 'divisionOperDate') }}</span>
      </el-form-item>
    </el-form>
  </d2-dialog>
</template>

<script>
import dayjs from "dayjs"
import { Util, deepClone } from '@/common/util'
import { getDivisionRecordByOrderCode } from '@api/order'
export default {
  name: "RuleInfoDialog",
  props: {
    ruleInfoVisible: {
      type: Boolean,
      default: false
    },
    recordInfo: {
      type: Object,
      default: () => { }
    }
  },
  components: {

  },
  computed: {},
  data() {
    return {
      ruleInfo: null,
      reconciliationRuleEffect: null,
      settleDistributeRuleEffect: null
    }
  },
  created() {

  },
  mounted() {
    console.log(this.recordInfo)

    // this.recordInfo.accountDate = this.recordInfo.accountDate ? Util.dateFormate(this.recordInfo.accountDate, 'YYYY-MM-DD HH:mm:ss') : ''
    // this.recordInfo.wioUpdatedDate = this.recordInfo.wioUpdatedDate ? Util.dateFormate(this.recordInfo.wioUpdatedDate, 'YYYY-MM-DD HH:mm:ss') : ''
    this.getRuleInfo()
  },
  methods: {

    // 获取分账记录
    getRuleInfo() {
      getDivisionRecordByOrderCode({ orderCode: this.recordInfo.orderCode }).then(res => {
        this.settleDistributeRuleEffect = res.settleDistributeRuleEffect
        this.reconciliationRuleEffect = res.reconciliationRuleEffect
        const format = "YYYY/MM/DD HH:mm"
        if (this.settleDistributeRuleEffect) {
          this.settleDistributeRuleEffect.formatEffectEndDate = this.settleDistributeRuleEffect.effectEndDate
            ? dayjs(this.settleDistributeRuleEffect.effectEndDate).format(format)
            : ""
          this.settleDistributeRuleEffect.formatEffectStartDate = this.settleDistributeRuleEffect.effectStartDate
            ? dayjs(this.settleDistributeRuleEffect.effectStartDate).format(format)
            : ""
          this.settleDistributeRuleEffect.formatUpdatedDate = dayjs(this.settleDistributeRuleEffect.updatedDate).format(format)
          this.settleDistributeRuleEffect.divisionOperDate = this.settleDistributeRuleEffect.divisionOperDate ? Util.dateFormate(this.settleDistributeRuleEffect.divisionOperDate, 'YYYY-MM-DD HH:mm:ss') : ''
          this.settleDistributeRuleEffect.show = false
        }
        if (this.reconciliationRuleEffect) {
          this.reconciliationRuleEffect.formatEffectEndDate = this.reconciliationRuleEffect.effectEndDate
            ? dayjs(this.reconciliationRuleEffect.effectEndDate).format(format)
            : ""
          this.reconciliationRuleEffect.formatEffectStartDate = this.reconciliationRuleEffect.effectStartDate
            ? dayjs(this.reconciliationRuleEffect.effectStartDate).format(format)
            : ""
          this.reconciliationRuleEffect.formatUpdatedDate = dayjs(this.reconciliationRuleEffect.updatedDate).format(format)
          this.reconciliationRuleEffect.divisionOperDate = this.reconciliationRuleEffect.divisionOperDate ? Util.dateFormate(this.reconciliationRuleEffect.divisionOperDate, 'YYYY-MM-DD HH:mm:ss') : ''
          this.reconciliationRuleEffect.show = false
        }
      })
    },

    handleAddConfirm() {
      this.$emit('dialogClose')
    },

    handleClose() {
      this.$emit('dialogClose')
    }

  }
}
</script>
<style lang="scss" scoped>
$color: #2a58ad;

.merchant-checkrecord {
  padding-left: 20px;
  padding-right: 16px;
  padding-bottom: 20px;

  .account-detail {
    // height: 400px;
    // height: calc(100vh - 200px);
    padding-right: 15px;
    overflow-y: scroll;
    overflow-x: hidden;
  }

  .sub-title {
    font-weight: 700;
    color: #333333;
    padding: 17px 0;
    margin: 0;
    display: flex;
    // justify-content: space-between;
    font-size: 14px;
    // &::before {
    //   top: 50%;
    //   transform: translateY(-50%);
    // }

    .label {
      padding-left: 8px;
      width: 37%;
    }

    .labelColor {
      color: #0947c6;
    }

    .updatedInfo {
      width: 40%;
      text-align: left;
    }

    .collapse {
      padding-right: 20px;
      color: #0947c6;
      cursor: pointer;

      .arrow {
        transition: all 1s;
      }

      .move {
        transform: rotate(-180deg);
      }
    }
  }

  .sub-border {
    animation: border-delay 1s forwards;
  }

  @keyframes border-delay {
    0% {
      /* opacity: 0; */
      /* right: -100%; */
    }

    100% {
      border-bottom: 1px solid #d8d8d8;
    }
  }

  .nothingtips {
    // align-items: center;
    text-align: center;
    font-size: 16px;
    padding-top: 40px;

    .title {
      font-size: 20px;
      color: #666;
      margin: 16px 0;
    }

    .tips {
      font-size: 12px;
      color: #999;
    }
  }

  .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;
    }
  }
}

.rule-form {
  padding: 0 20px 20px;
  margin-bottom: 20px;
  background: #ffffff;
  margin: 0 0 0 10px;
}

.rule-form .d2-drawer-item {
  font-family: PingFangSC-Regular;
  font-size: 14px;
  color: #333333;
  font-weight: 400;
  width: 25%;
  margin: 0 0 0 0;
}

.fontD {
  margin: 10px 20px 15px;
}
</style>