jiaxing.zhou

fix(api): 统一修改出库和发票状态更新接口参数格式

- 将 deliveryStatus 和 invoiceStatus 参数从 query 参数改为 body 参数
- 更新相关 API 调用方式以适配新的参数传递规则
- 确保前后端数据交互一致性
...@@ -26,6 +26,7 @@ declare module 'vue' { ...@@ -26,6 +26,7 @@ declare module 'vue' {
26 ElTable: typeof import('element-plus/es')['ElTable'] 26 ElTable: typeof import('element-plus/es')['ElTable']
27 ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] 27 ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
28 ElTag: typeof import('element-plus/es')['ElTag'] 28 ElTag: typeof import('element-plus/es')['ElTag']
29 + ElText: typeof import('element-plus/es')['ElText']
29 Header: typeof import('./src/components/layout/Header.vue')['default'] 30 Header: typeof import('./src/components/layout/Header.vue')['default']
30 RouterLink: typeof import('vue-router')['RouterLink'] 31 RouterLink: typeof import('vue-router')['RouterLink']
31 RouterView: typeof import('vue-router')['RouterView'] 32 RouterView: typeof import('vue-router')['RouterView']
......
...@@ -120,8 +120,6 @@ export const deliveryApi = { ...@@ -120,8 +120,6 @@ export const deliveryApi = {
120 120
121 // 修改出库状态 121 // 修改出库状态
122 updateDeliveryStatus: (deliveryId: number, deliveryStatus: number) => { 122 updateDeliveryStatus: (deliveryId: number, deliveryStatus: number) => {
123 - return request.post(`/api/delivery/${deliveryId}/deliveryStatus`, null, { 123 + return request.post(`/api/delivery/${deliveryId}/deliveryStatus`, { deliveryStatus })
124 - params: { deliveryStatus }
125 - })
126 } 124 }
127 } 125 }
......
...@@ -121,8 +121,6 @@ export const invoiceApi = { ...@@ -121,8 +121,6 @@ export const invoiceApi = {
121 return request.post('/api/invoice/batchDelete', invoiceIds) 121 return request.post('/api/invoice/batchDelete', invoiceIds)
122 }, 122 },
123 updateInvoiceStatus: (invoiceId: number, invoiceStatus: number) => { 123 updateInvoiceStatus: (invoiceId: number, invoiceStatus: number) => {
124 - return request.post(`/api/invoice/${invoiceId}/invoiceStatus`, null, { 124 + return request.post(`/api/invoice/${invoiceId}/invoiceStatus`, { invoiceStatus })
125 - params: { invoiceStatus }
126 - })
127 } 125 }
128 } 126 }
......
...@@ -179,15 +179,11 @@ ...@@ -179,15 +179,11 @@
179 <div class="detail-grid"> 179 <div class="detail-grid">
180 <div class="detail-item"> 180 <div class="detail-item">
181 <label>出库单ID:</label> 181 <label>出库单ID:</label>
182 - <span>{{ orderDetail.deliveryId }}</span> 182 + <span>{{ deliveryDetail.deliveryId }}</span>
183 </div> 183 </div>
184 <div class="detail-item"> 184 <div class="detail-item">
185 <label>出库单编号:</label> 185 <label>出库单编号:</label>
186 - <span>{{ orderDetail.deliveryNo }}</span> 186 + <span>{{ deliveryDetail.deliveryNo }}</span>
187 - </div>
188 - <div class="detail-item">
189 - <label>关联订单编号:</label>
190 - <span>{{ orderDetail.orderNo }}</span>
191 </div> 187 </div>
192 <div class="detail-item"> 188 <div class="detail-item">
193 <label>关联订单编号:</label> 189 <label>关联订单编号:</label>
...@@ -203,7 +199,7 @@ ...@@ -203,7 +199,7 @@
203 </div> 199 </div>
204 <div class="detail-item"> 200 <div class="detail-item">
205 <label>出库日期:</label> 201 <label>出库日期:</label>
206 - <span>{{ formatDate(orderDetail.deliveryDate) }}</span> 202 + <span>{{ formatDate(deliveryDetail.deliveryDate) }}</span>
207 </div> 203 </div>
208 <div class="detail-item"> 204 <div class="detail-item">
209 <label>出库状态:</label> 205 <label>出库状态:</label>
...@@ -213,28 +209,28 @@ ...@@ -213,28 +209,28 @@
213 </div> 209 </div>
214 <div class="detail-item"> 210 <div class="detail-item">
215 <label>仓库编码:</label> 211 <label>仓库编码:</label>
216 - <span>{{ orderDetail.warehouseCode }}</span> 212 + <span>{{ deliveryDetail.warehouseCode }}</span>
217 </div> 213 </div>
218 <div class="detail-item"> 214 <div class="detail-item">
219 <label>数据来源:</label> 215 <label>数据来源:</label>
220 - <span>{{ orderDetail.dataSource || '-' }}</span> 216 + <span>{{ deliveryDetail.dataSource || '-' }}</span>
221 </div> 217 </div>
222 <div class="detail-item"> 218 <div class="detail-item">
223 <label>上传时间:</label> 219 <label>上传时间:</label>
224 - <span>{{ formatTime(orderDetail.uploadTime || '') }}</span> 220 + <span>{{ formatTime(deliveryDetail.uploadTime || '') }}</span>
225 </div> 221 </div>
226 <div class="detail-item"> 222 <div class="detail-item">
227 <label>创建时间:</label> 223 <label>创建时间:</label>
228 - <span>{{ formatTime(orderDetail.createTime || '') }}</span> 224 + <span>{{ formatTime(deliveryDetail.createTime || '') }}</span>
229 </div> 225 </div>
230 <div class="detail-item"> 226 <div class="detail-item">
231 <label>更新时间:</label> 227 <label>更新时间:</label>
232 - <span>{{ formatTime(orderDetail.updateTime || '') }}</span> 228 + <span>{{ formatTime(deliveryDetail.updateTime || '') }}</span>
233 </div> 229 </div>
234 </div> 230 </div>
235 </div> 231 </div>
236 232
237 - <div class="detail-section" v-if="orderDetail.deliveryItems && orderDetail.deliveryItems.length > 0"> 233 + <div class="detail-section" v-if="deliveryDetail?.deliveryItems && deliveryDetail.deliveryItems.length > 0">
238 <h4>出库明细</h4> 234 <h4>出库明细</h4>
239 <table class="detail-table"> 235 <table class="detail-table">
240 <thead> 236 <thead>
...@@ -247,7 +243,7 @@ ...@@ -247,7 +243,7 @@
247 </tr> 243 </tr>
248 </thead> 244 </thead>
249 <tbody> 245 <tbody>
250 - <tr v-for="item in orderDetail.deliveryItems" :key="item.deliveryItemId"> 246 + <tr v-for="item in deliveryDetail.deliveryItems" :key="item.itemId || item.deliveryId">
251 <td>{{ item.productCode }}</td> 247 <td>{{ item.productCode }}</td>
252 <td>{{ item.productName }}</td> 248 <td>{{ item.productName }}</td>
253 <td>{{ item.deliveryQty }}</td> 249 <td>{{ item.deliveryQty }}</td>
...@@ -680,9 +676,9 @@ const handleSubmitAdd = async () => { ...@@ -680,9 +676,9 @@ const handleSubmitAdd = async () => {
680 deliveryItems: addFormData.deliveryItems.map(item => ({ 676 deliveryItems: addFormData.deliveryItems.map(item => ({
681 productCode: item.productCode, 677 productCode: item.productCode,
682 productName: item.productName, 678 productName: item.productName,
683 - productQty: item.deliveryQty, 679 + deliveryQty: item.deliveryQty,
684 - unitPrice: item.deliveryPrice, 680 + deliveryPrice: item.deliveryPrice,
685 - totalPrice: item.deliveryAmount 681 + deliveryAmount: item.deliveryAmount
686 })) 682 }))
687 } 683 }
688 684
......
...@@ -61,11 +61,11 @@ ...@@ -61,11 +61,11 @@
61 <div class="chart-legend"> 61 <div class="chart-legend">
62 <div class="legend-item"> 62 <div class="legend-item">
63 <span class="legend-dot" style="background-color: #4CAF50;"></span> 63 <span class="legend-dot" style="background-color: #4CAF50;"></span>
64 - <span>返利金额</span> 64 + <span>返利合计</span>
65 </div> 65 </div>
66 <div class="legend-item"> 66 <div class="legend-item">
67 <span class="legend-dot" style="background-color: #2196F3;"></span> 67 <span class="legend-dot" style="background-color: #2196F3;"></span>
68 - <span>已审核返利</span> 68 + <span>已使用返利</span>
69 </div> 69 </div>
70 </div> 70 </div>
71 </div> 71 </div>
...@@ -77,15 +77,15 @@ ...@@ -77,15 +77,15 @@
77 <!-- 右侧饼图 --> 77 <!-- 右侧饼图 -->
78 <div class="chart-card pie-chart"> 78 <div class="chart-card pie-chart">
79 <div class="chart-header"> 79 <div class="chart-header">
80 - <h3 class="chart-title">计算统计</h3> 80 + <h3 class="chart-title">返利统计</h3>
81 <div class="chart-legend"> 81 <div class="chart-legend">
82 <div class="legend-item"> 82 <div class="legend-item">
83 <span class="legend-dot" style="background-color: #2196F3;"></span> 83 <span class="legend-dot" style="background-color: #2196F3;"></span>
84 - <span>已计算</span> 84 + <span>剩余返利</span>
85 </div> 85 </div>
86 <div class="legend-item"> 86 <div class="legend-item">
87 - <span class="legend-dot" style="background-color: #4CAF50;"></span> 87 + <span class="legend-dot" style="background-color: #9CCC65;"></span>
88 - <span>未计算</span> 88 + <span>已使用返利</span>
89 </div> 89 </div>
90 </div> 90 </div>
91 </div> 91 </div>
...@@ -1073,27 +1073,30 @@ const initTrendChart = async () => { ...@@ -1073,27 +1073,30 @@ const initTrendChart = async () => {
1073 const chart = echarts.init(trendChart.value) 1073 const chart = echarts.init(trendChart.value)
1074 1074
1075 try { 1075 try {
1076 - // 调用后端API获取月度统计数据 1076 + // 调用后端API获取月度统计数据 - 查询2025年的数据
1077 - const response = await rebateApi.getRebateMonthlyStats() 1077 + const response = await rebateApi.getRebateMonthlyStats(2025)
1078 - let monthlyData = [] 1078 + console.log('月度统计API响应:', response)
1079 + let monthlyData: any[] = []
1079 1080
1080 - if (response && response.data) { 1081 + // request.ts拦截器已经返回了data字段,所以response就是数据数组
1081 - monthlyData = response.data 1082 + if (response && Array.isArray(response)) {
1083 + monthlyData = response
1082 } 1084 }
1085 + console.log('处理后的月度数据:', monthlyData)
1083 1086
1084 const months = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'] 1087 const months = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
1085 1088
1086 // 处理后端返回的月度数据 1089 // 处理后端返回的月度数据
1087 - const totalTrendData = months.map((month, index) => { 1090 + const totalRebateData = months.map((month, index) => {
1088 const monthIndex = index + 1 1091 const monthIndex = index + 1
1089 const monthData = monthlyData.find((item: any) => item.month === monthIndex) 1092 const monthData = monthlyData.find((item: any) => item.month === monthIndex)
1090 return monthData ? monthData.totalAmount : 0 1093 return monthData ? monthData.totalAmount : 0
1091 }) 1094 })
1092 1095
1093 - const calculatedTrendData = months.map((month, index) => { 1096 + const usedRebateData = months.map((month, index) => {
1094 const monthIndex = index + 1 1097 const monthIndex = index + 1
1095 const monthData = monthlyData.find((item: any) => item.month === monthIndex) 1098 const monthData = monthlyData.find((item: any) => item.month === monthIndex)
1096 - return monthData ? monthData.calculatedAmount : 0 1099 + return monthData ? (monthData.calculatedAmount || 0) : 0
1097 }) 1100 })
1098 1101
1099 const option = { 1102 const option = {
...@@ -1143,10 +1146,10 @@ const initTrendChart = async () => { ...@@ -1143,10 +1146,10 @@ const initTrendChart = async () => {
1143 }, 1146 },
1144 series: [ 1147 series: [
1145 { 1148 {
1146 - name: '返利金额', 1149 + name: '返利合计',
1147 type: 'line', 1150 type: 'line',
1148 smooth: true, 1151 smooth: true,
1149 - data: totalTrendData, 1152 + data: totalRebateData,
1150 itemStyle: { color: '#4CAF50' }, 1153 itemStyle: { color: '#4CAF50' },
1151 lineStyle: { 1154 lineStyle: {
1152 color: '#4CAF50', 1155 color: '#4CAF50',
...@@ -1157,10 +1160,10 @@ const initTrendChart = async () => { ...@@ -1157,10 +1160,10 @@ const initTrendChart = async () => {
1157 showSymbol: true 1160 showSymbol: true
1158 }, 1161 },
1159 { 1162 {
1160 - name: '已审核返利', 1163 + name: '已使用返利',
1161 type: 'line', 1164 type: 'line',
1162 smooth: true, 1165 smooth: true,
1163 - data: calculatedTrendData, 1166 + data: usedRebateData,
1164 itemStyle: { color: '#2196F3' }, 1167 itemStyle: { color: '#2196F3' },
1165 lineStyle: { 1168 lineStyle: {
1166 color: '#2196F3', 1169 color: '#2196F3',
...@@ -1185,8 +1188,8 @@ const initTrendChart = async () => { ...@@ -1185,8 +1188,8 @@ const initTrendChart = async () => {
1185 1188
1186 const months = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'] 1189 const months = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
1187 1190
1188 - const totalTrendData = months.map(() => Math.floor(totalAmount / 12)) 1191 + const totalRebateDataFallback = months.map(() => Math.floor(totalAmount / 12))
1189 - const calculatedTrendData = months.map(() => Math.floor(calculatedAmount / 12)) 1192 + const usedRebateDataFallback = months.map(() => Math.floor(calculatedAmount / 12))
1190 1193
1191 const fallbackOption = { 1194 const fallbackOption = {
1192 tooltip: { 1195 tooltip: {
...@@ -1235,10 +1238,10 @@ const initTrendChart = async () => { ...@@ -1235,10 +1238,10 @@ const initTrendChart = async () => {
1235 }, 1238 },
1236 series: [ 1239 series: [
1237 { 1240 {
1238 - name: '返利金额', 1241 + name: '返利合计',
1239 type: 'line', 1242 type: 'line',
1240 smooth: true, 1243 smooth: true,
1241 - data: totalTrendData, 1244 + data: totalRebateDataFallback,
1242 itemStyle: { color: '#4CAF50' }, 1245 itemStyle: { color: '#4CAF50' },
1243 lineStyle: { 1246 lineStyle: {
1244 color: '#4CAF50', 1247 color: '#4CAF50',
...@@ -1249,10 +1252,10 @@ const initTrendChart = async () => { ...@@ -1249,10 +1252,10 @@ const initTrendChart = async () => {
1249 showSymbol: true 1252 showSymbol: true
1250 }, 1253 },
1251 { 1254 {
1252 - name: '已审核返利', 1255 + name: '已使用返利',
1253 type: 'line', 1256 type: 'line',
1254 smooth: true, 1257 smooth: true,
1255 - data: calculatedTrendData, 1258 + data: usedRebateDataFallback,
1256 itemStyle: { color: '#2196F3' }, 1259 itemStyle: { color: '#2196F3' },
1257 lineStyle: { 1260 lineStyle: {
1258 color: '#2196F3', 1261 color: '#2196F3',
...@@ -1280,33 +1283,42 @@ const initPieChart = async () => { ...@@ -1280,33 +1283,42 @@ const initPieChart = async () => {
1280 try { 1283 try {
1281 // 调用后端API获取状态统计数据 1284 // 调用后端API获取状态统计数据
1282 const response = await rebateApi.getRebateStatusStats() 1285 const response = await rebateApi.getRebateStatusStats()
1283 - let statusData = { calculatedCount: 0, unCalculatedCount: 0 } 1286 + console.log('状态统计API响应:', response)
1287 + let statusData: any = { calculatedAmount: 0, unCalculatedAmount: 0 }
1284 1288
1285 - if (response && response.data) { 1289 + // request.ts拦截器已经返回了data字段,所以response就是数据对象
1286 - statusData = response.data 1290 + if (response && typeof response === 'object') {
1291 + statusData = response
1287 } 1292 }
1293 + console.log('处理后的状态数据:', statusData)
1294 +
1295 + // 计算剩余返利和已使用返利
1296 + const usedRebate = statusData.calculatedAmount || 0
1297 + const remainingRebate = statusData.unCalculatedAmount || 0
1288 1298
1289 const option = { 1299 const option = {
1290 tooltip: { 1300 tooltip: {
1291 trigger: 'item', 1301 trigger: 'item',
1292 - formatter: '{b}: {c} ({d}%)' 1302 + formatter: (params: any) => {
1303 + return `${params.name}: ¥${params.value.toLocaleString()} (${params.percent}%)`
1304 + }
1293 }, 1305 },
1294 series: [ 1306 series: [
1295 { 1307 {
1296 - name: '审核状态', 1308 + name: '返利统计',
1297 type: 'pie', 1309 type: 'pie',
1298 radius: ['35%', '65%'], 1310 radius: ['35%', '65%'],
1299 center: ['50%', '50%'], 1311 center: ['50%', '50%'],
1300 data: [ 1312 data: [
1301 { 1313 {
1302 - value: statusData.calculatedCount || 0, 1314 + value: remainingRebate,
1303 - name: '已计算', 1315 + name: '剩余返利',
1304 itemStyle: { color: '#2196F3' } 1316 itemStyle: { color: '#2196F3' }
1305 }, 1317 },
1306 { 1318 {
1307 - value: statusData.unCalculatedCount || 0, 1319 + value: usedRebate,
1308 - name: '未计算', 1320 + name: '已使用返利',
1309 - itemStyle: { color: '#4CAF50' } 1321 + itemStyle: { color: '#9CCC65' }
1310 } 1322 }
1311 ], 1323 ],
1312 label: { 1324 label: {
...@@ -1339,30 +1351,36 @@ const initPieChart = async () => { ...@@ -1339,30 +1351,36 @@ const initPieChart = async () => {
1339 console.error('获取饼图数据失败:', error) 1351 console.error('获取饼图数据失败:', error)
1340 1352
1341 // 如果API调用失败,使用当前列表数据作为备用方案 1353 // 如果API调用失败,使用当前列表数据作为备用方案
1342 - const calculatedCount = rebateList.value.filter(item => item.calcFlag === 1).length 1354 + const usedAmount = rebateList.value
1343 - const unCalculatedCount = rebateList.value.filter(item => item.calcFlag === 0).length 1355 + .filter(item => item.calcFlag === 1)
1356 + .reduce((sum, item) => sum + (item.rebateAmount || 0), 0)
1357 + const remainingAmount = rebateList.value
1358 + .filter(item => item.calcFlag === 0)
1359 + .reduce((sum, item) => sum + (item.rebateAmount || 0), 0)
1344 1360
1345 const fallbackOption = { 1361 const fallbackOption = {
1346 tooltip: { 1362 tooltip: {
1347 trigger: 'item', 1363 trigger: 'item',
1348 - formatter: '{b}: {c} ({d}%)' 1364 + formatter: (params: any) => {
1365 + return `${params.name}: ¥${params.value.toLocaleString()} (${params.percent}%)`
1366 + }
1349 }, 1367 },
1350 series: [ 1368 series: [
1351 { 1369 {
1352 - name: '审核状态', 1370 + name: '返利统计',
1353 type: 'pie', 1371 type: 'pie',
1354 radius: ['35%', '65%'], 1372 radius: ['35%', '65%'],
1355 center: ['50%', '50%'], 1373 center: ['50%', '50%'],
1356 data: [ 1374 data: [
1357 { 1375 {
1358 - value: calculatedCount, 1376 + value: remainingAmount,
1359 - name: '已审核', 1377 + name: '剩余返利',
1360 itemStyle: { color: '#2196F3' } 1378 itemStyle: { color: '#2196F3' }
1361 }, 1379 },
1362 { 1380 {
1363 - value: unCalculatedCount, 1381 + value: usedAmount,
1364 - name: '未审核', 1382 + name: '已使用返利',
1365 - itemStyle: { color: '#4CAF50' } 1383 + itemStyle: { color: '#9CCC65' }
1366 } 1384 }
1367 ], 1385 ],
1368 label: { 1386 label: {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
7 "auto-imports.d.ts", 7 "auto-imports.d.ts",
8 "components.d.ts" 8 "components.d.ts"
9 ], 9 ],
10 - "exclude": ["src/**/__tests__/*"], 10 + "exclude": ["src/**/__tests__/*", "src/views/test-menu.vue"],
11 "compilerOptions": { 11 "compilerOptions": {
12 "composite": true, 12 "composite": true,
13 "baseUrl": ".", 13 "baseUrl": ".",
......