cloudroam
2025-03-28 cef2bb0eeeb91a22860cf5d23c7348af1ba921dc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<template>
  <el-bus-crud v-bind="tableConfig" />
</template>
 
<script>
export default {
  data() {
    return {
      tableConfig: {
        url: 'flower/api/fee/config/list',
        hasPagination: false,
        columns: [
          { label: '序号', type: 'index' },
          { label: '销量区间', formatter: this.formatRange },
          { label: '服务费比例(%)', prop: 'feeRate' },
        ],
        beforeOpen: (row, isNew) => {
          if (!isNew) {
            row.lowerNumStr = this.formatRange(row)
          }
        },
        form: [
          {
            label: '销量区间:',
            id: 'lowerNum',
            component: 'el-bus-number-range',
            el: {
              unit: '扎',
              min: 0,
              precision: 0,
            },
            commonFormat: true,
            commonFormatProps: ['lowerNum', 'upperNum'],
            commonRules: true,
            commonRulesLevel: 1,
            str: true,
          },
          {
            label: '服务费比例:',
            id: 'feeRate',
            type: 'input-number',
            el: {
              precision: 1,
              min: 0,
            },
            unit: '%',
            rules: {
              required: true,
              message: '请输入服务费比例',
              trigger: 'blur',
            },
          },
        ],
      },
    }
  },
  head() {
    return {
      title: '服务费管理',
    }
  },
  methods: {
    formatRange(row) {
      let str = ''
      if (!this.$elBusUtil.isTrueEmpty(row.lowerNum)) {
        str += `${row.lowerNum}扎<`
      }
      str += '销量'
      if (!this.$elBusUtil.isTrueEmpty(row.upperNum)) {
        str += `≤${row.upperNum}扎`
      }
      return str
    },
  },
}
</script>