gaoluyang
2026-04-27 36c8ae70cae3de90e642b080553abe70d3345c74
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<template>
  <view class="customer-detail-page">
    <PageHeader title="客户详情" @back="goBack" />
 
    <view class="detail-content">
      <view class="section">
        <view class="section-title">客户信息</view>
        <view class="info-list">
          <view class="info-item">
            <text class="info-label">客户名称</text>
            <text class="info-value">{{ detailData.customerName || "-" }}</text>
          </view>
          <view class="info-item">
            <text class="info-label">客户分类</text>
            <text class="info-value">{{ detailData.customerType || "-" }}</text>
          </view>
          <view class="info-item">
            <text class="info-label">公司地址</text>
            <text class="info-value">{{ detailData.companyAddress || "-" }}</text>
          </view>
          <view class="info-item">
            <text class="info-label">公司电话</text>
            <text class="info-value">{{ detailData.companyPhone || "-" }}</text>
          </view>
        </view>
      </view>
 
      <view class="section">
        <view class="section-title">联系信息</view>
        <view class="info-list">
          <view class="info-item">
            <text class="info-label">联系人</text>
            <text class="info-value">{{ detailData.contactPerson || "-" }}</text>
          </view>
          <view class="info-item">
            <text class="info-label">联系电话</text>
            <text class="info-value">{{ detailData.contactPhone || "-" }}</text>
          </view>
          <view class="info-item">
            <text class="info-label">联系人岗位</text>
            <text class="info-value">{{ detailData.contactPosition || "-" }}</text>
          </view>
        </view>
      </view>
 
      <view class="section">
        <view class="section-title">维护信息</view>
        <view class="info-list">
          <view class="info-item">
            <text class="info-label">维护人</text>
            <text class="info-value">{{ detailData.maintainer || "-" }}</text>
          </view>
          <view class="info-item">
            <text class="info-label">维护时间</text>
            <text class="info-value">{{ detailData.maintenanceTime || "-" }}</text>
          </view>
        </view>
      </view>
    </view>
 
    <FooterButtons
      cancelText="返回"
      confirmText="编辑"
      @cancel="goBack"
      @confirm="goEdit"
    />
  </view>
</template>
 
<script setup>
  import { ref } from "vue";
  import { onLoad, onShow } from "@dcloudio/uni-app";
  import FooterButtons from "@/components/FooterButtons.vue";
  import { getCustomer } from "@/api/basicData/customerFile";
 
  const customerId = ref("");
  const detailData = ref({});
 
  const goBack = () => {
    uni.navigateBack();
  };
 
  const goEdit = () => {
    if (!customerId.value) return;
    uni.navigateTo({ url: `/pages/basicData/customerFile/edit?id=${customerId.value}` });
  };
 
  const getDetail = () => {
    if (!customerId.value) return;
    uni.showLoading({ title: "加载中...", mask: true });
    getCustomer(customerId.value)
      .then(res => {
        detailData.value = res.data || {};
      })
      .catch(() => {
        uni.showToast({ title: "获取详情失败", icon: "error" });
      })
      .finally(() => {
        uni.hideLoading();
      });
  };
 
  onLoad(options => {
    if (options?.id) {
      customerId.value = options.id;
      getDetail();
    }
  });
 
  onShow(() => {
    if (customerId.value) {
      getDetail();
    }
  });
</script>
 
<style scoped lang="scss">
  .customer-detail-page {
    min-height: 100vh;
    background-color: #f5f5f5;
    padding-bottom: 90px;
  }
 
  .detail-content {
    padding: 16px;
  }
 
  .section {
    background: #ffffff;
    border-radius: 12px;
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  }
 
  .section-title {
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    color: #303133;
    border-bottom: 1px solid #f0f0f0;
  }
 
  .info-list {
    padding: 8px 0;
  }
 
  .info-item {
    display: flex;
    padding: 12px 16px;
    border-bottom: 1px solid #f8f8f8;
  }
 
  .info-item:last-child {
    border-bottom: none;
  }
 
  .info-label {
    width: 120px;
    font-size: 14px;
    color: #606266;
  }
 
  .info-value {
    flex: 1;
    font-size: 14px;
    color: #303133;
    text-align: right;
    word-break: break-all;
  }
</style>