doum
7 天以前 074bcb8394fab66ce531c219e1e7de7c142ff2d5
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<template>
  <GlobalWindow title="关联设备" :visible.sync="visible" width="920px" :show-confirm="false">
    <div class="merchant-info">
      <div class="merchant-info__item">
        <span class="merchant-info__label">客户类型</span>
        <span class="merchant-info__value">{{ customerTypeText }}</span>
      </div>
      <div class="merchant-info__item">
        <span class="merchant-info__label">客户名称</span>
        <span class="merchant-info__value">{{ customer.name || '-' }}</span>
      </div>
      <div class="merchant-info__item">
        <span class="merchant-info__label">联系人</span>
        <span class="merchant-info__value">{{ customer.memberName || '-' }}</span>
      </div>
      <div class="merchant-info__item">
        <span class="merchant-info__label">联系方式</span>
        <span class="merchant-info__value">{{ customer.memberPhone || '-' }}</span>
      </div>
    </div>
    <el-tabs v-model="activeTab" class="device-tabs">
      <el-tab-pane label="关联电表" name="electrical">
        <YwCustomerElectricalTab :customer-id="customer.id" :active="activeTab === 'electrical'" @success="$emit('success')"/>
      </el-tab-pane>
      <el-tab-pane label="关联空调" name="conditioner">
        <YwCustomerConditionerTab :customer-id="customer.id" :active="activeTab === 'conditioner'" @success="$emit('success')"/>
      </el-tab-pane>
    </el-tabs>
  </GlobalWindow>
</template>
 
<script>
import GlobalWindow from '@/components/common/GlobalWindow'
import YwCustomerElectricalTab from './YwCustomerElectricalTab'
import YwCustomerConditionerTab from './YwCustomerConditionerTab'
 
export default {
  name: 'YwCustomerDeviceWindow',
  components: { GlobalWindow, YwCustomerElectricalTab, YwCustomerConditionerTab },
  data () {
    return {
      visible: false,
      activeTab: 'electrical',
      customer: {}
    }
  },
  computed: {
    customerTypeText () {
      const t = this.customer.type
      return t === 0 || t === '0' ? '个人' : '企业'
    }
  },
  methods: {
    open (row, tab) {
      this.customer = {
        id: row.id,
        type: row.type,
        name: row.name,
        memberName: row.memberName,
        memberPhone: row.memberPhone
      }
      this.activeTab = tab || 'electrical'
      this.visible = true
    }
  }
}
</script>
 
<style scoped>
.merchant-info {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px; 
  margin-bottom: 16px;
  padding: 30px 16px 30px 16px;
  background: #f5f7fa; 
  border-radius: 4px;
}
.merchant-info__item {
  min-width: 180px;
  line-height: 22px;
}
.merchant-info__label {
  color: #909399;
  margin-right: 8px;
}
.merchant-info__label::after {
  content: ':';
}
.merchant-info__value {
  color: #303133;
  font-weight: 500;
}
.device-tabs {
  margin-top: 4px;
}
</style>