陶杰
2024-08-22 973662aeae3e7c788c14671d17c5962395141770
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
<template>
  <el-bus-crud v-bind="tableConfig" />
</template>
 
<script>
export default {
  data() {
    return {
      tableConfig: {
        url: 'flower/api/customer/partner/page',
        hasNew: false,
        hasEdit: false,
        hasDelete: false,
        beforeOpen: (data, isNew) => {
          if (!isNew) {
            data.area = this.getDistrict(data)
          }
        },
        columns: [
          { label: '商户名称', prop: 'name' },
          { label: '商户昵称', prop: 'nickName' },
          {
            label: '地址',
            formatter: (row) => this.getDistrict(row),
          },
          { label: '联系方式', prop: 'tel' },
        ],
        searchForm: [
          {
            type: 'row',
            items: [
              { label: '商户名称', id: 'name', type: 'input' },
              {
                label: '所属地区:',
                id: 'area',
                component: 'el-bus-select-area',
                commonFormat: true,
                commonFormatProps: ['province', 'city', 'region'],
                customClass: 'in-bus-form',
              },
            ],
          },
        ],
        form: [
          { label: '商户名称:', id: 'name', type: 'input' },
          { label: '商户昵称:', id: 'nickName', type: 'input' },
          { label: '地址:', id: 'area', type: 'input' },
          { label: '联系方式:', id: 'tel', type: 'input' },
        ],
      },
    }
  },
  head() {
    return {
      title: '商户列表',
    }
  },
  methods: {
    getDistrict(row) {
      return `${row.province || ''}${row.city || ''}${row.region || ''}${
        row.address || ''
      }`
    },
  },
}
</script>