MealCombo.vue 3.12 KB
<template>
  <div class="meal-components gl-form-page">
    <div class="title">套餐信息</div>
    <template>
      <div class="detail_pannel">
        <div class="wrap flex_sc">
          <div v-for="(item, index) in editDetail" :key="index">
            <div class="line_widget flex_sc">
              <div class="label">
                <span class="text">{{ item.label }}</span>
                <span class="text">:</span>
              </div>
              <div class="value">{{ item.isPrice ? (priceFilter(item.value) || '-') : item.value || '-' }}</div>
            </div>
          </div>
        </div>
      </div>
    </template>
  </div>
</template>

<script>
export default {
  name: 'MealCombo',
  props: {
    editForm: Object,
  },
  data() {
    return {
      editDetail: []
    }
  },
  mounted() {
    this.handlerDetail()
  },
  methods: {
    handlerDetail() {
      this.editDetail = [
        {
          label: '套餐名称',
          value: this.editForm.packageName
        },
        {
          label: '售价(元)',
          value: this.editForm.sellPrice,
          isPrice: true
        },
        {
          label: '最低售价(元)',
          value: this.editForm.minSellPrice,
          isPrice: true
        },
        {
          label: '产品、升级成本(元)',
          value: this.editForm.upgradeProductCost,
          isPrice: true
        },
        {
          label: '回收成本(元)',
          value: this.editForm.recoveryCost,
          isPrice: true
        },
        {
          label: '虚拟对账成本(元)',
          value: this.editForm.virtualAccountCost,
          isPrice: true
        },
        {
          label: '嘀加成本(元)',
          value: this.editForm.djCost,
          isPrice: true
        },
        {
          label: '第三方成本(元)',
          value: this.editForm.thirdPartyCost,
          isPrice: true
        }
      ]
    },
    // 处理金额补零
    priceFilter(num) {
      var pow = Math.pow(10, 2)
      if (this.filterEmpty(num)) return '-'
      return (Math.round(num * pow) / pow).toFixed(2)
    },
    filterEmpty(data) {
      return (data ?? '') === ''
    }
  }
}
</script>
<style lang="scss" scoped>
.meal-components {
  background: white;
  .title {
    padding: 0 20px;
    font-size: 16px;
    font-weight: bold;
    height: 58px;
    line-height: 58px;
    border-bottom: 1px solid #d8d8d8;
    margin: 0 0;
    color: #333;
  }
  .edit-form-container {
    padding: 32px 0 12px;
  }
  /deep/ .el-form-item {
    display: flex;
    .el-textarea {
      textarea {
        font-family: auto;
      }
    }
  }
}
.detail_pannel {
  padding: 20px;
  .wrap {
    flex-wrap: wrap;
  }
  .line_widget {
    margin-bottom: 20px;
    .label {
      width: 154px;
      text-align: right;
      .required {
        color: #eb4e4e;
        font-size: 6px;
        margin-right: 4px;
      }
      .text {
        font-size: 14px;
        font-weight: 400;
        color: #666666;
        line-height: 20px;
      }
    }
    .value {
      width: 348px;
      font-size: 14px;
      font-weight: 400;
      color: #333333;
      line-height: 20px;
    }
  }
}
</style>