merchantRelationships.vue 10.4 KB
<template>
  <div class="merchantRelationships" v-if="formItem">
    <div class="title">流量方信息</div>
    <div class="content">
      <table class="detail_table">
        <tr>
          <td class="lb">流量方信息</td>
          <td class="cb">
            <text-popover :refName="'merchantName'" :content="formItem.merchantName || '-'" />
          </td>
          <td class="lb">业务类型</td>
          <td class="cb">
            <text-popover :refName="'scene'" :content="filterItem(formItem.scene	, 'sceneCodeList')" />
          </td>
        </tr>
        <tr>
          <td class="lb">一级流量方</td>
          <td class="cb">
            <text-popover :refName="'firstFlowMerchantName'" :content="formItem.firstFlowMerchantName || '-'" />
          </td>
          <td class="lb">流量通道方</td>
          <td class="cb">
            <text-popover :refName="'flowChannelMerchantName'" :content="formItem.flowChannelMerchantName || '-'" />
          </td>
        </tr>
        <tr>
          <td class="lb">合作模式</td>
          <td class="cb">
            <text-popover :refName="'cooperationModel'" :content="filterItem(formItem.cooperationModel, 'cooperationModeList')" />
          </td>
          <td class="lb">收款方式</td>
          <td class="cb">
            <text-popover :refName="'paymentMethodList'" :content="filterItem(formItem.paymentMethod	, 'paymentMethodList')" />
          </td>
        </tr>
        <tr>
          <td class="lb">流量方合同规定发票税率</td>
          <td class="cb">
            <text-popover :refName="'contractStipulateRate'" :content="filterItem(formItem.contractStipulateRate, 'invoiceTaxRateList')" />
          </td>
          <td class="lb">流量方实际发票税率</td>
          <td class="cb">
            <text-popover :refName="'contractActualRate'" :content="filterItem(formItem.contractActualRate, 'invoiceTaxRateList')" />
          </td>
        </tr>
        <tr>
          <td class="lb">合同归属</td>
          <td class="cb">
            <text-popover :refName="'contractOwnerMerchantName'" :content="formItem.contractOwnerMerchantName || '-'" />
          </td>
          <td class="lb">合同编码</td>
          <td class="cb">
            <text-popover :refName="'contractCode'" :content="formItem.contractCode || '-'" />
          </td>
        </tr>
        <tr>
          <td class="lb">园区店信息</td>
          <td class="cb">
            <text-popover :refName="'yqMerchantName'" :content="formItem.yqMerchantName || '-'" />
          </td>
          <td class="lb"></td>
          <td class="cb"></td>
        </tr>
      </table>
    </div>
    <div class="title">服务商信息</div>
    <div class="content">
      <table class="detail_table">
        <tr>
          <td class="lb">一级服务商</td>
          <td class="cb">
            <text-popover :refName="'firstServiceMerchantName'" :content="$$(formItem.firstServiceMerchant, 'serviceMerchantName') ? formItem.firstServiceMerchant.serviceMerchantName : '-'" />
          </td>
          <td class="lb">二级服务商</td>
          <td class="cb">
            <text-popover :refName="'secondServiceMerchantName'" :content="$$(formItem.secondServiceMerchant, 'serviceMerchantName') ? formItem.secondServiceMerchant.serviceMerchantName : '-'" />
          </td>
        </tr>
      </table>
      <div v-if="$$(formItem.marketServiceList, 'length')">
        <div class="sub-title">三级服务商(营销)</div>
          <el-table :data="formItem.marketServiceList" class="sub-table" border>
            <el-table-column label="序号" width="60px" align="center">
              <template slot-scope="scope">
                {{ scope.$index + 1 }}
              </template>
            </el-table-column>
            <el-table-column v-for="(item, index) in filterTableColumns" :key="index" :label="item['label']" align="center">
              <template slot-scope="scope" >
                <span v-if="item.name == 'subBusiness'" v-html="filterItem(scope.row[item['name']], item.filterList )"></span>
                <template v-else>
                  <text-popover :refName="item.name + 'marketTable'" :content="filterItem(scope.row[item['name']], item.filterList)" />
                </template>
              </template>
            </el-table-column>
          </el-table>
        </div>
      <div v-if="$$(formItem.installServiceList, 'length')">
        <div class="sub-title">三级服务商(安装)</div>
        <el-table :data="formItem.installServiceList" class="sub-table" border>
          <el-table-column label="序号" width="60px" align="center">
            <template slot-scope="scope">
              {{ scope.$index + 1 }}
            </template>
          </el-table-column>
          <el-table-column v-for="(item, index) in filterTableColumns" :key="index" :label="item['label']" align="center">
            <template slot-scope="scope" v-if="!item.isHide">
              <span v-if="item.name == 'subBusiness'" v-html="filterItem(scope.row[item['name']], item.filterList )"></span>
              <template v-else>
                <text-popover :refName="item.name + 'installTable'" :content="filterItem(scope.row[item['name']], item.filterList)" />
              </template>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </div>
    <div class="title">其他信息</div>
    <div class="content">
      <table class="detail_table">
        <tr>
          <td class="lb">收入所属公司</td>
          <td class="cb">
            <text-popover :refName="'incomeOwnerMerchantAccount'" :content="formItem.incomeOwnerMerchantAccount || formItem.incomeOwnerMerchantName || '-'" />
          </td>
          <td class="lb">是否为一般纳税人</td>
          <td class="cb">
            <text-popover :refName="'generalTaxpayer'" :content="formItem.generalTaxpayer == '0' ? '否' : formItem.generalTaxpayer == '1' ? '是' : '-'" />
          </td>
        </tr>
      </table>
    </div>
  </div>
</template>
<script>
import { sceneCodeList, invoiceTaxRateList, cooperationModeList, paymentMethodList, partnerClassifyList, subBusinessList } from '@/common/constants.js'
import textPopover from './textPopover.vue'
export default {
  name: 'merchantRelationships',
  components: {
    textPopover
  },
  props: {
    formItem: {
      type: Object,
      default: () => { }
    }
  },
  data () {
    return {
      tableColumns: [{
        label: '服务商名称',
        name: 'serviceMerchantName'
      }, {
        label: '服务商分类',
        name: 'serviceProviderType',
        filter: true,
        filterList: 'partnerClassifyList'
      }, {
        label: '子业务',
        name: 'subBusiness',
        filter: true,
        filterList: 'subBusinessList',
        isHide: false
      }, {
        label: '合同规定发票税率',
        name: 'contractStipulateRate',
        filter: true,
        filterList: 'invoiceTaxRateList'
      }, {
        label: '实际发票税率',
        name: 'contractActualRate',
        filter: true,
        filterList: 'invoiceTaxRateList'
      }, {
        label: '合同归属',
        name: 'contractOwnerMerchantName'
      }, {
        label: '合同编码',
        name: 'contractCode'
      }],
      baseData: {
        sceneCodeList, // 场景编码
        invoiceTaxRateList, // 发票税率
        cooperationModeList, // 合作模式
        paymentMethodList, // 收款方式
        partnerClassifyList, // 服务商分类
        subBusinessList // 子业务
      }
    }
  },
  watch: {
    'formItem.scene': {
      handler(val) { // 监听业务类型 会员权益/升级 有子业务
        if (val == 0) {
          this.tableColumns.find(v => v.name == 'subBusiness').isHide = false
        } else {
          this.tableColumns.find(v => v.name == 'subBusiness').isHide = true
        }
      },
      deep: true,
      immediate: true
    }
  },
  computed: {
    filterTableColumns() {
      return this.tableColumns.filter(v => !v.isHide)
    },
    isOverflown() {
      return (name, it) => {
        console.log(this.$refs, name, it)
        const element = this.$refs?.[name + it]?.[0] // 获取组件的根元素
        return element.scrollWidth > element.offsetWidth // 检查是否溢出
      }
    }
  },
  methods: {
    filterItem(value, item) {
      if (item == 'subBusinessList') { // 子业务特殊处理
        let valueR = value?.split(',')?.sort((a, b) => a - b)
        const result = valueR?.map(confId => {
          const found = this.baseData[item]?.find(item => item.confId == confId)
          return found ? found.confValue : null
        })
        return result?.filter(confValue => confValue != null)?.join('&nbsp;&nbsp;&nbsp;') || '-'
      }
      return item ? (this.baseData[item]?.filter(v => v.confId == value)[0]?.['confValue'] || '-') : (value || '-')
    },
  }
}
</script>
<style lang="scss" scoped>
.merchantRelationships {
  background: #fff;
  padding-bottom: 30px;
  .title {
    height: 50px;
    line-height: 50px;
    padding: 0 20px;
    border-bottom: 1px solid #E5E5E5;
    font-size: 16px;
    font-weight: 600;
    color: #333333;
    margin-bottom: 20px;
  }
  .content{
    padding: 0 20px;
    font-size: 14px;
    color: #1d1d1d;
  }
  .detail_table {
    padding: 0 20px;
    width: 100%;
    background: #fff;
    border-collapse: collapse;
    tr {
      width: 100%;
      display: flex;
    }
    &:first-of-type {
      & > tr > td {
        border-top: 1px solid #cccccc;
      }
    }
    &:last-of-type {
      border-bottom: 1px solid #cccccc;
    }
    td {
      border: 1px solid #cccccc;
      border-bottom: none;
      border-right: none;
      // padding: 10px;
      padding: 6px;
      text-align: center;
      &.lb {
        width: 0;
        flex: 1;
      }
      &.cb {
        width: 0;
        flex: 2;
      }
    }
    td:last-child{
      border-right: 1px solid #cccccc;
    }
  }
  .sub-title{
    margin: 10px 0;
  }
}
::v-deep .sub-table{
  color: #1d1d1d;
  thead{
    color: #666 !important;
  }
}
::v-deep .sub-table .el-table__header-wrapper th{
  background: #fafafa !important;
}
// 修改el-table border颜色
::v-deep .el-table--border{
  border-color: #cccccc;
  tr{
    th {
      border-color: #cccccc;
    }
    td{
      border-color: #cccccc;
    }
  }
  
}
::v-deep .el-table::before{
  background-color: #cccccc;
}
::v-deep .el-table::after{
  background-color: #cccccc;
}
::v-deep .el-table__row .cell{
  padding: 0 10px;
}
</style>