jiaxing.zhou

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

- 将 deliveryStatus 和 invoiceStatus 参数从 query 参数改为 body 参数
- 更新相关 API 调用方式以适配新的参数传递规则
- 确保前后端数据交互一致性
......@@ -26,6 +26,7 @@ declare module 'vue' {
ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTag: typeof import('element-plus/es')['ElTag']
ElText: typeof import('element-plus/es')['ElText']
Header: typeof import('./src/components/layout/Header.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
......
......@@ -120,8 +120,6 @@ export const deliveryApi = {
// 修改出库状态
updateDeliveryStatus: (deliveryId: number, deliveryStatus: number) => {
return request.post(`/api/delivery/${deliveryId}/deliveryStatus`, null, {
params: { deliveryStatus }
})
return request.post(`/api/delivery/${deliveryId}/deliveryStatus`, { deliveryStatus })
}
}
......
......@@ -121,8 +121,6 @@ export const invoiceApi = {
return request.post('/api/invoice/batchDelete', invoiceIds)
},
updateInvoiceStatus: (invoiceId: number, invoiceStatus: number) => {
return request.post(`/api/invoice/${invoiceId}/invoiceStatus`, null, {
params: { invoiceStatus }
})
return request.post(`/api/invoice/${invoiceId}/invoiceStatus`, { invoiceStatus })
}
}
......
......@@ -179,15 +179,11 @@
<div class="detail-grid">
<div class="detail-item">
<label>出库单ID:</label>
<span>{{ orderDetail.deliveryId }}</span>
<span>{{ deliveryDetail.deliveryId }}</span>
</div>
<div class="detail-item">
<label>出库单编号:</label>
<span>{{ orderDetail.deliveryNo }}</span>
</div>
<div class="detail-item">
<label>关联订单编号:</label>
<span>{{ orderDetail.orderNo }}</span>
<span>{{ deliveryDetail.deliveryNo }}</span>
</div>
<div class="detail-item">
<label>关联订单编号:</label>
......@@ -203,7 +199,7 @@
</div>
<div class="detail-item">
<label>出库日期:</label>
<span>{{ formatDate(orderDetail.deliveryDate) }}</span>
<span>{{ formatDate(deliveryDetail.deliveryDate) }}</span>
</div>
<div class="detail-item">
<label>出库状态:</label>
......@@ -213,28 +209,28 @@
</div>
<div class="detail-item">
<label>仓库编码:</label>
<span>{{ orderDetail.warehouseCode }}</span>
<span>{{ deliveryDetail.warehouseCode }}</span>
</div>
<div class="detail-item">
<label>数据来源:</label>
<span>{{ orderDetail.dataSource || '-' }}</span>
<span>{{ deliveryDetail.dataSource || '-' }}</span>
</div>
<div class="detail-item">
<label>上传时间:</label>
<span>{{ formatTime(orderDetail.uploadTime || '') }}</span>
<span>{{ formatTime(deliveryDetail.uploadTime || '') }}</span>
</div>
<div class="detail-item">
<label>创建时间:</label>
<span>{{ formatTime(orderDetail.createTime || '') }}</span>
<span>{{ formatTime(deliveryDetail.createTime || '') }}</span>
</div>
<div class="detail-item">
<label>更新时间:</label>
<span>{{ formatTime(orderDetail.updateTime || '') }}</span>
<span>{{ formatTime(deliveryDetail.updateTime || '') }}</span>
</div>
</div>
</div>
<div class="detail-section" v-if="orderDetail.deliveryItems && orderDetail.deliveryItems.length > 0">
<div class="detail-section" v-if="deliveryDetail?.deliveryItems && deliveryDetail.deliveryItems.length > 0">
<h4>出库明细</h4>
<table class="detail-table">
<thead>
......@@ -247,7 +243,7 @@
</tr>
</thead>
<tbody>
<tr v-for="item in orderDetail.deliveryItems" :key="item.deliveryItemId">
<tr v-for="item in deliveryDetail.deliveryItems" :key="item.itemId || item.deliveryId">
<td>{{ item.productCode }}</td>
<td>{{ item.productName }}</td>
<td>{{ item.deliveryQty }}</td>
......@@ -680,9 +676,9 @@ const handleSubmitAdd = async () => {
deliveryItems: addFormData.deliveryItems.map(item => ({
productCode: item.productCode,
productName: item.productName,
productQty: item.deliveryQty,
unitPrice: item.deliveryPrice,
totalPrice: item.deliveryAmount
deliveryQty: item.deliveryQty,
deliveryPrice: item.deliveryPrice,
deliveryAmount: item.deliveryAmount
}))
}
......
......@@ -61,11 +61,11 @@
<div class="chart-legend">
<div class="legend-item">
<span class="legend-dot" style="background-color: #4CAF50;"></span>
<span>返利金额</span>
<span>返利合计</span>
</div>
<div class="legend-item">
<span class="legend-dot" style="background-color: #2196F3;"></span>
<span>已审核返利</span>
<span>已使用返利</span>
</div>
</div>
</div>
......@@ -77,15 +77,15 @@
<!-- 右侧饼图 -->
<div class="chart-card pie-chart">
<div class="chart-header">
<h3 class="chart-title">计算统计</h3>
<h3 class="chart-title">返利统计</h3>
<div class="chart-legend">
<div class="legend-item">
<span class="legend-dot" style="background-color: #2196F3;"></span>
<span>已计算</span>
<span>剩余返利</span>
</div>
<div class="legend-item">
<span class="legend-dot" style="background-color: #4CAF50;"></span>
<span>未计算</span>
<span class="legend-dot" style="background-color: #9CCC65;"></span>
<span>已使用返利</span>
</div>
</div>
</div>
......@@ -1073,27 +1073,30 @@ const initTrendChart = async () => {
const chart = echarts.init(trendChart.value)
try {
// 调用后端API获取月度统计数据
const response = await rebateApi.getRebateMonthlyStats()
let monthlyData = []
// 调用后端API获取月度统计数据 - 查询2025年的数据
const response = await rebateApi.getRebateMonthlyStats(2025)
console.log('月度统计API响应:', response)
let monthlyData: any[] = []
if (response && response.data) {
monthlyData = response.data
// request.ts拦截器已经返回了data字段,所以response就是数据数组
if (response && Array.isArray(response)) {
monthlyData = response
}
console.log('处理后的月度数据:', monthlyData)
const months = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
// 处理后端返回的月度数据
const totalTrendData = months.map((month, index) => {
const totalRebateData = months.map((month, index) => {
const monthIndex = index + 1
const monthData = monthlyData.find((item: any) => item.month === monthIndex)
return monthData ? monthData.totalAmount : 0
})
const calculatedTrendData = months.map((month, index) => {
const usedRebateData = months.map((month, index) => {
const monthIndex = index + 1
const monthData = monthlyData.find((item: any) => item.month === monthIndex)
return monthData ? monthData.calculatedAmount : 0
return monthData ? (monthData.calculatedAmount || 0) : 0
})
const option = {
......@@ -1143,10 +1146,10 @@ const initTrendChart = async () => {
},
series: [
{
name: '返利金额',
name: '返利合计',
type: 'line',
smooth: true,
data: totalTrendData,
data: totalRebateData,
itemStyle: { color: '#4CAF50' },
lineStyle: {
color: '#4CAF50',
......@@ -1157,10 +1160,10 @@ const initTrendChart = async () => {
showSymbol: true
},
{
name: '已审核返利',
name: '已使用返利',
type: 'line',
smooth: true,
data: calculatedTrendData,
data: usedRebateData,
itemStyle: { color: '#2196F3' },
lineStyle: {
color: '#2196F3',
......@@ -1185,8 +1188,8 @@ const initTrendChart = async () => {
const months = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
const totalTrendData = months.map(() => Math.floor(totalAmount / 12))
const calculatedTrendData = months.map(() => Math.floor(calculatedAmount / 12))
const totalRebateDataFallback = months.map(() => Math.floor(totalAmount / 12))
const usedRebateDataFallback = months.map(() => Math.floor(calculatedAmount / 12))
const fallbackOption = {
tooltip: {
......@@ -1235,10 +1238,10 @@ const initTrendChart = async () => {
},
series: [
{
name: '返利金额',
name: '返利合计',
type: 'line',
smooth: true,
data: totalTrendData,
data: totalRebateDataFallback,
itemStyle: { color: '#4CAF50' },
lineStyle: {
color: '#4CAF50',
......@@ -1249,10 +1252,10 @@ const initTrendChart = async () => {
showSymbol: true
},
{
name: '已审核返利',
name: '已使用返利',
type: 'line',
smooth: true,
data: calculatedTrendData,
data: usedRebateDataFallback,
itemStyle: { color: '#2196F3' },
lineStyle: {
color: '#2196F3',
......@@ -1280,33 +1283,42 @@ const initPieChart = async () => {
try {
// 调用后端API获取状态统计数据
const response = await rebateApi.getRebateStatusStats()
let statusData = { calculatedCount: 0, unCalculatedCount: 0 }
console.log('状态统计API响应:', response)
let statusData: any = { calculatedAmount: 0, unCalculatedAmount: 0 }
if (response && response.data) {
statusData = response.data
// request.ts拦截器已经返回了data字段,所以response就是数据对象
if (response && typeof response === 'object') {
statusData = response
}
console.log('处理后的状态数据:', statusData)
// 计算剩余返利和已使用返利
const usedRebate = statusData.calculatedAmount || 0
const remainingRebate = statusData.unCalculatedAmount || 0
const option = {
tooltip: {
trigger: 'item',
formatter: '{b}: {c} ({d}%)'
formatter: (params: any) => {
return `${params.name}: ¥${params.value.toLocaleString()} (${params.percent}%)`
}
},
series: [
{
name: '审核状态',
name: '返利统计',
type: 'pie',
radius: ['35%', '65%'],
center: ['50%', '50%'],
data: [
{
value: statusData.calculatedCount || 0,
name: '已计算',
value: remainingRebate,
name: '剩余返利',
itemStyle: { color: '#2196F3' }
},
{
value: statusData.unCalculatedCount || 0,
name: '未计算',
itemStyle: { color: '#4CAF50' }
value: usedRebate,
name: '已使用返利',
itemStyle: { color: '#9CCC65' }
}
],
label: {
......@@ -1339,30 +1351,36 @@ const initPieChart = async () => {
console.error('获取饼图数据失败:', error)
// 如果API调用失败,使用当前列表数据作为备用方案
const calculatedCount = rebateList.value.filter(item => item.calcFlag === 1).length
const unCalculatedCount = rebateList.value.filter(item => item.calcFlag === 0).length
const usedAmount = rebateList.value
.filter(item => item.calcFlag === 1)
.reduce((sum, item) => sum + (item.rebateAmount || 0), 0)
const remainingAmount = rebateList.value
.filter(item => item.calcFlag === 0)
.reduce((sum, item) => sum + (item.rebateAmount || 0), 0)
const fallbackOption = {
tooltip: {
trigger: 'item',
formatter: '{b}: {c} ({d}%)'
formatter: (params: any) => {
return `${params.name}: ¥${params.value.toLocaleString()} (${params.percent}%)`
}
},
series: [
{
name: '审核状态',
name: '返利统计',
type: 'pie',
radius: ['35%', '65%'],
center: ['50%', '50%'],
data: [
{
value: calculatedCount,
name: '已审核',
value: remainingAmount,
name: '剩余返利',
itemStyle: { color: '#2196F3' }
},
{
value: unCalculatedCount,
name: '未审核',
itemStyle: { color: '#4CAF50' }
value: usedAmount,
name: '已使用返利',
itemStyle: { color: '#9CCC65' }
}
],
label: {
......
......@@ -7,7 +7,7 @@
"auto-imports.d.ts",
"components.d.ts"
],
"exclude": ["src/**/__tests__/*"],
"exclude": ["src/**/__tests__/*", "src/views/test-menu.vue"],
"compilerOptions": {
"composite": true,
"baseUrl": ".",
......