ZN
7 天以前 dd630fede0cc46500fe898c75464e3e04ce82b0f
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
172
173
174
175
176
177
178
179
180
181
<template>
  <view class="after-sales-handling">
    <PageHeader title="售后处理" @back="goBack" />
 
    <!-- 搜索和筛选区域 -->
    <view class="search-section">
      <view class="search-bar">
        <view class="search-input">
          <up-input class="search-text" placeholder="请输入工单编号搜索" v-model="searchForm.afterSalesServiceNo" @change="handleQuery" clearable />
        </view>
        <view class="filter-button" @click="handleQuery">
          <up-icon name="search" size="24" color="#999"></up-icon>
        </view>
      </view>
    </view>
 
    <!-- 售后处理列表 -->
    <view class="ledger-list" v-if="tableData.length > 0">
      <view v-for="(item, index) in tableData" :key="index" class="ledger-item" @click="openHandleForm('view', item)">
        <view class="item-header">
          <view class="item-left">
            <view class="document-icon">
              <up-icon name="file-text" size="16" color="#ffffff"></up-icon>
            </view>
            <text class="item-id">{{ item.afterSalesServiceNo }}</text>
          </view>
          <view class="item-tag">
            <up-tag :text="getStatusLabel(item.status)" :type="getStatusType(item.status)" size="mini"></up-tag>
          </view>
        </view>
        <up-divider></up-divider>
        <view class="item-details">
          <view class="detail-row">
            <text class="detail-label">销售单号</text>
            <text class="detail-value">{{ item.salesContractNo }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">客户名称</text>
            <text class="detail-value">{{ item.customerName }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">反馈日期</text>
            <text class="detail-value">{{ item.feedbackDate }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">售后类型</text>
            <text class="detail-value">{{ getDictLabel(post_sale_waiting_list, item.serviceType) }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">紧急程度</text>
            <text class="detail-value">{{ getDictLabel(degree_of_urgency, item.urgency) }}</text>
          </view>
          <view class="detail-row">
            <text class="detail-label">问题描述</text>
            <text class="detail-value">{{ item.proDesc || item.disRes }}</text>
          </view>
          <view class="detail-row" v-if="item.status === 2">
            <text class="detail-label">处理结果</text>
            <text class="detail-value highlight">{{ item.disRes }}</text>
          </view>
        </view>
        <up-divider></up-divider>
        <view class="detail-buttons">
          <up-button size="small" type="primary" v-if="item.status === 1" @click.stop="openHandleForm('approve', item)">处理</up-button>
          <up-button size="small" type="primary" plain @click.stop="openHandleForm('view', item)">查看</up-button>
          <up-button size="small" type="info" plain @click.stop="openFiles(item)">附件</up-button>
        </view>
      </view>
    </view>
    <view v-else class="no-data">
      <text>暂无售后处理数据</text>
    </view>
  </view>
</template>
 
<script setup>
import { ref, reactive, computed } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import { afterSalesServiceListPage } from '@/api/customerService/index';
import PageHeader from '@/components/PageHeader.vue';
import { useDict } from '@/utils/dict';
 
const { post_sale_waiting_list, degree_of_urgency } = useDict('post_sale_waiting_list', 'degree_of_urgency');
 
const searchForm = reactive({
  afterSalesServiceNo: '',
  status: '',
});
 
const tableData = ref([]);
const loading = ref(false);
const page = reactive({
  current: 1,
  size: 20,
  total: 0,
});
 
const goBack = () => {
  uni.navigateBack();
};
 
const handleQuery = () => {
  page.current = 1;
  getList();
};
 
const getList = () => {
  loading.value = true;
  uni.showLoading({ title: '加载中...' });
  
  afterSalesServiceListPage({ ...searchForm, ...page })
    .then((res) => {
      const records = res?.data?.records ?? res?.records ?? [];
      const total = res?.data?.total ?? res?.total ?? 0;
      tableData.value = Array.isArray(records) ? records : [];
      page.total = Number.isFinite(Number(total)) ? Number(total) : 0;
    })
    .finally(() => {
      loading.value = false;
      uni.hideLoading();
    });
};
 
const getStatusLabel = (status) => {
  if (status === 1) return '待处理';
  if (status === 2) return '已处理';
  return '未知';
};
 
const getStatusType = (status) => {
  if (status === 1) return 'error';
  if (status === 2) return 'success';
  return 'info';
};
 
const getDictLabel = (dict, value) => {
  if (!dict || !dict.value) return value;
  const item = dict.value.find(i => i.value == value);
  return item ? item.label : value;
};
 
const openHandleForm = (type, row) => {
  uni.setStorageSync('afterSalesHandleType', type);
  uni.setStorageSync('afterSalesHandleData', JSON.stringify(row));
  uni.navigateTo({
    url: '/pages/customerService/afterSalesHandling/handle'
  });
};
 
const openFiles = (row) => {
  uni.setStorageSync('afterSalesFileData', JSON.stringify(row));
  uni.setStorageSync('afterSalesServiceFileId', row?.id);
  uni.navigateTo({
    url: '/pages/customerService/afterSalesHandling/fileList'
  });
};
 
onShow(() => {
  getList();
});
</script>
 
<style scoped lang="scss">
@import "@/styles/sales-common.scss";
 
.after-sales-handling {
  min-height: 100vh;
  background: #f8f9fa;
}
 
.detail-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px 0;
}
 
.ledger-item {
  padding: 0 16px;
}
</style>