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
<template>
  <el-bus-crud v-bind="tableConfig" />
</template>
 
<script>
export default {
  data() {
    return {
      tableConfig: {
        url: 'flower/api/flower/markup/pl/list',
        hasPagination: false,
        columns: [
          { label: '序号', type: 'index' },
          { label: '价格区间(元)', formatter: this.formatRange },
          { label: '加价(元)', prop: 'fee' },
        ],
        beforeOpen: (row, isNew) => {
          if (!isNew) {
            row.lowerPriceStr = this.formatRange(row)
          }
        },
        form: [
          {
            label: '价格区间:',
            id: 'lowerPrice',
            component: 'el-bus-number-range',
            el: {
              unit: '元',
            },
            commonFormat: true,
            commonFormatProps: ['lowerPrice', 'upperPrice'],
            commonRules: true,
            commonRulesLevel: 1,
            str: true,
          },
          {
            label: '加价:',
            id: 'fee',
            type: 'input-number',
            el: {
              precision: 2,
              min: 0,
            },
            unit: '元',
            rules: { required: true, message: '请输入加价', trigger: 'blur' },
          },
        ],
      },
    }
  },
  head() {
    return {
      title: '区间加价',
    }
  },
  methods: {
    formatRange(row) {
      let str = ''
      if (!this.$elBusUtil.isTrueEmpty(row.lowerPrice)) {
        str += `${row.lowerPrice}元<`
      }
      str += '底价'
      if (!this.$elBusUtil.isTrueEmpty(row.upperPrice)) {
        str += `≤${row.upperPrice}元`
      }
      return str
    },
  },
}
</script>
 
<style lang="scss" scoped></style>