commission-tier-help-preview.vue 7.02 KB
<template>
  <div class="tier-help-preview">
    <div class="tier-help-preview__toolbar">
      <span class="tier-help-preview__label">页面效果预览</span>
      <el-button type="text" size="small" :disabled="!enabled" @click="dialogVisible = true">
        查看弹窗内容
      </el-button>
    </div>

    <div class="phone-mock">
      <div class="phone-mock__status">个人中心 · 健康师</div>
      <div class="phone-mock__body">
        <div class="mock-card">
          <div class="mock-card__header">
            <div class="mock-card__title">
              <span class="mock-card__line"></span>
              <span>提成缺口</span>
              <i v-if="enabled" class="el-icon-question mock-card__icon"></i>
            </div>
            <span class="mock-card__action">查看战队 ></span>
          </div>
          <div class="mock-card__hint">距下一档还差 ¥12,235.30,达成后提成由 3% 升至 4%</div>
          <div class="mock-card__grid">
            <div class="mock-card__item">
              <span class="mock-card__item-label">队开单业绩</span>
              <span class="mock-card__item-value">¥23,764.70</span>
            </div>
            <div class="mock-card__item">
              <span class="mock-card__item-label">当前档</span>
              <span class="mock-card__item-value">3%</span>
            </div>
          </div>
        </div>
        <div v-if="!enabled" class="phone-mock__off-tip">关闭后:问号不显示,员工无法查看档位说明弹窗</div>
      </div>
    </div>

    <el-dialog
      title="提成档位说明(弹窗预览)"
      :visible.sync="dialogVisible"
      width="520px"
      append-to-body
      custom-class="tier-help-preview-dialog"
    >
      <div class="tier-dialog">
        <p class="tier-dialog__sub">按战队开单业绩合计对照(与算薪一致)</p>
        <div
          v-for="section in sections"
          :key="section.key"
          class="tier-section"
          :class="{ active: section.key === previewKey }"
        >
          <div class="tier-section__head">
            <span class="tier-section__title">{{ section.title }}</span>
            <el-tag v-if="section.key === previewKey" size="mini" type="success">当前适用(示例:单人)</el-tag>
          </div>
          <p class="tier-section__desc">{{ section.desc }}</p>
          <el-table :data="section.rows" size="mini" border class="tier-section__table">
            <el-table-column :label="section.leftHeader" prop="threshold" min-width="220" />
            <el-table-column label="提成比例" prop="rate" width="100" align="right" />
          </el-table>
        </div>
      </div>
      <span slot="footer">
        <el-button type="primary" size="small" @click="dialogVisible = false">我知道了</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
const SECTIONS = [
  {
    key: 'three',
    title: '3人及以上战队',
    desc: '按战队开单合计直接对照,不按日均折算。',
    leftHeader: '战队开单业绩',
    rows: [
      { threshold: '≥ 15万元', rate: '7%' },
      { threshold: '≥ 12万元', rate: '6%' },
      { threshold: '≥ 9万元', rate: '5%' },
      { threshold: '≥ 6万元', rate: '4%' },
      { threshold: '≥ 3万元', rate: '3%' },
      { threshold: '< 3万元', rate: '0%' }
    ]
  },
  {
    key: 'two',
    title: '2人战队',
    desc: '按战队开单合计直接对照,不按日均折算。',
    leftHeader: '战队开单业绩',
    rows: [
      { threshold: '≥ 8万元', rate: '6%' },
      { threshold: '≥ 6万元', rate: '5%' },
      { threshold: '≥ 4万元', rate: '4%' },
      { threshold: '≥ 2万元', rate: '3%' },
      { threshold: '< 2万元', rate: '0%' }
    ]
  },
  {
    key: 'one',
    title: '单人(或被剔除出战队)',
    desc: '按个人开单业绩对照;实际门槛 = 标准月门槛 ÷ 当月天数 × 在店天数。',
    leftHeader: '标准月门槛',
    rows: [
      { threshold: '≥ 6万元(按在店天数折算)', rate: '6%' },
      { threshold: '≥ 4万元(按在店天数折算)', rate: '5%' },
      { threshold: '≥ 2万元(按在店天数折算)', rate: '4%' },
      { threshold: '≥ 1万元(按在店天数折算)', rate: '3%' },
      { threshold: '< 1万元(按在店天数折算)', rate: '0%' }
    ]
  }
]

export default {
  name: 'CommissionTierHelpPreview',
  props: {
    enabled: {
      type: Boolean,
      default: true
    }
  },
  data() {
    return {
      dialogVisible: false,
      sections: SECTIONS,
      previewKey: 'one'
    }
  }
}
</script>

<style lang="scss" scoped>
.tier-help-preview {
  margin-top: 16px;
}

.tier-help-preview__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.tier-help-preview__label {
  font-size: 13px;
  color: #606266;
  font-weight: 600;
}

.phone-mock {
  width: 320px;
  border: 1px solid #e4e7ed;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(180deg, #e8f5e9 0%, #f5f7fa 120px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.phone-mock__status {
  padding: 10px 16px 6px;
  font-size: 12px;
  color: #558b2f;
  text-align: center;
}

.phone-mock__body {
  padding: 0 14px 16px;
}

.mock-card {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 14px;
  padding: 14px;
  border: 1px solid rgba(67, 160, 71, 0.12);
}

.mock-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.mock-card__title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  color: #1b5e20;
}

.mock-card__line {
  width: 4px;
  height: 14px;
  border-radius: 2px;
  background: #43a047;
}

.mock-card__icon {
  color: #43a047;
  font-size: 16px;
}

.mock-card__action {
  font-size: 12px;
  color: #43a047;
}

.mock-card__hint {
  font-size: 12px;
  color: #667085;
  line-height: 1.5;
  margin-bottom: 12px;
}

.mock-card__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mock-card__item {
  background: #f8faf8;
  border-radius: 10px;
  padding: 10px;
}

.mock-card__item-label {
  display: block;
  font-size: 11px;
  color: #909399;
  margin-bottom: 4px;
}

.mock-card__item-value {
  font-size: 13px;
  font-weight: 700;
  color: #2e7d32;
}

.phone-mock__off-tip {
  margin-top: 10px;
  font-size: 12px;
  color: #f56c6c;
  text-align: center;
}

.tier-dialog__sub {
  margin: 0 0 12px;
  font-size: 13px;
  color: #909399;
}

.tier-section {
  background: #f8faf8;
  border: 1px solid #e8f0e9;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.tier-section.active {
  background: #f1f8e9;
  border-color: rgba(67, 160, 71, 0.45);
}

.tier-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.tier-section__title {
  font-size: 14px;
  font-weight: 700;
  color: #303133;
}

.tier-section__desc {
  margin: 0 0 10px;
  font-size: 12px;
  color: #909399;
  line-height: 1.5;
}

.tier-section__table {
  width: 100%;
}
</style>