jiaxing.zhou

Merge branch 'master' into dev

# Conflicts:
#	frontend/src/api/delivery.ts
#	frontend/src/api/invoice.ts
#	frontend/src/views/delivery/index.vue
#	frontend/src/views/invoice/index.vue
...@@ -40,7 +40,7 @@ public class DeliveryAddReq { ...@@ -40,7 +40,7 @@ public class DeliveryAddReq {
40 @NotNull(message = "出库日期不能为空") 40 @NotNull(message = "出库日期不能为空")
41 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") 41 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
42 @Schema(description = "出库日期", required = true) 42 @Schema(description = "出库日期", required = true)
43 - private LocalDateTime deliveryDate; 43 + private String deliveryDate;
44 44
45 @Schema(description = "出库状态(0-未出库/1-已出库)") 45 @Schema(description = "出库状态(0-未出库/1-已出库)")
46 private Integer deliveryStatus; 46 private Integer deliveryStatus;
......
...@@ -44,15 +44,9 @@ public class DeliveryMain { ...@@ -44,15 +44,9 @@ public class DeliveryMain {
44 @Schema(description = "出库状态(0-未出库/1-已出库)") 44 @Schema(description = "出库状态(0-未出库/1-已出库)")
45 private Integer deliveryStatus; 45 private Integer deliveryStatus;
46 46
47 - @Schema(description = "出库总金额")
48 - private BigDecimal totalAmount;
49 -
50 @Schema(description = "仓库编码") 47 @Schema(description = "仓库编码")
51 private String warehouseCode; 48 private String warehouseCode;
52 49
53 - @Schema(description = "仓库名称")
54 - private String warehouseName;
55 -
56 @Schema(description = "数据来源") 50 @Schema(description = "数据来源")
57 private String dataSource; 51 private String dataSource;
58 52
......
...@@ -111,6 +111,9 @@ public class DeliveryMainServiceImpl extends ServiceImpl<DeliveryMainMapper, Del ...@@ -111,6 +111,9 @@ public class DeliveryMainServiceImpl extends ServiceImpl<DeliveryMainMapper, Del
111 BeanUtils.copyProperties(addReq, deliveryMain); 111 BeanUtils.copyProperties(addReq, deliveryMain);
112 deliveryMain.setCreateTime(LocalDateTime.now()); 112 deliveryMain.setCreateTime(LocalDateTime.now());
113 deliveryMain.setUpdateTime(LocalDateTime.now()); 113 deliveryMain.setUpdateTime(LocalDateTime.now());
114 + if(StringUtils.hasText(addReq.getDeliveryDate())) {
115 + deliveryMain.setDeliveryDate(parseDateTime(addReq.getDeliveryDate()));
116 + }
114 deliveryMain.setDelFlag("0"); 117 deliveryMain.setDelFlag("0");
115 int insert = baseMapper.insert(deliveryMain); 118 int insert = baseMapper.insert(deliveryMain);
116 if (insert > 0) { 119 if (insert > 0) {
......
...@@ -35,12 +35,15 @@ VALUES ...@@ -35,12 +35,15 @@ VALUES
35 INSERT INTO t_sys_menu (menu_id, parent_id, menu_name, menu_type, path, icon, sort, status, perms, create_by, create_time, update_by, update_time, del_flag) 35 INSERT INTO t_sys_menu (menu_id, parent_id, menu_name, menu_type, path, icon, sort, status, perms, create_by, create_time, update_by, update_time, del_flag)
36 VALUES 36 VALUES
37 (301, 3, '出库查询', '2', '', '', 1, '1', 'delivery:list', 'admin', NOW(), 'admin', NOW(), '0'), 37 (301, 3, '出库查询', '2', '', '', 1, '1', 'delivery:list', 'admin', NOW(), 'admin', NOW(), '0'),
38 -(302, 3, '出库详情', '2', '', '', 2, '1', 'delivery:query', 'admin', NOW(), 'admin', NOW(), '0'), 38 +(302, 3, '出库新增', '2', '', '', 2, '1', 'delivery:add', 'admin', NOW(), 'admin', NOW(), '0'),
39 -(303, 3, '出库导出', '2', '', '', 3, '1', 'delivery:export', 'admin', NOW(), 'admin', NOW(), '0'), 39 +(303, 3, '出库修改', '2', '', '', 3, '1', 'delivery:edit', 'admin', NOW(), 'admin', NOW(), '0'),
40 -(304, 3, '出库统计', '2', '', '', 4, '1', 'delivery:statistics', 'admin', NOW(), 'admin', NOW(), '0'), 40 +(304, 3, '出库删除', '2', '', '', 4, '1', 'delivery:delete', 'admin', NOW(), 'admin', NOW(), '0'),
41 -(305, 3, '出库打印', '2', '', '', 5, '1', 'delivery:print', 'admin', NOW(), 'admin', NOW(), '0'), 41 +(305, 3, '出库详情', '2', '', '', 5, '1', 'delivery:detail', 'admin', NOW(), 'admin', NOW(), '0'),
42 -(306, 3, '出库确认', '2', '', '', 6, '1', 'delivery:confirm', 'admin', NOW(), 'admin', NOW(), '0'), 42 +(306, 3, '出库导出', '2', '', '', 6, '1', 'delivery:export', 'admin', NOW(), 'admin', NOW(), '0'),
43 -(307, 3, '出库撤销', '2', '', '', 7, '1', 'delivery:cancel', 'admin', NOW(), 'admin', NOW(), '0'); 43 +(307, 3, '出库统计', '2', '', '', 7, '1', 'delivery:statistics', 'admin', NOW(), 'admin', NOW(), '0'),
44 +(308, 3, '出库打印', '2', '', '', 8, '1', 'delivery:print', 'admin', NOW(), 'admin', NOW(), '0'),
45 +(309, 3, '出库确认', '2', '', '', 9, '1', 'delivery:confirm', 'admin', NOW(), 'admin', NOW(), '0'),
46 +(310, 3, '出库撤销', '2', '', '', 10, '1', 'delivery:cancel', 'admin', NOW(), 'admin', NOW(), '0');
44 47
45 -- ========================================= 48 -- =========================================
46 -- 3. 插入发票管理相关按钮权限 49 -- 3. 插入发票管理相关按钮权限
...@@ -78,7 +81,7 @@ AND del_flag = '0'; ...@@ -78,7 +81,7 @@ AND del_flag = '0';
78 INSERT INTO t_sys_role_menu (role_id, menu_id, create_by, create_time, update_by, update_time, del_flag) 81 INSERT INTO t_sys_role_menu (role_id, menu_id, create_by, create_time, update_by, update_time, del_flag)
79 SELECT @admin_role_id, menu_id, 'admin', NOW(), 'admin', NOW(), '0' 82 SELECT @admin_role_id, menu_id, 'admin', NOW(), 'admin', NOW(), '0'
80 FROM t_sys_menu 83 FROM t_sys_menu
81 -WHERE menu_id IN (301, 302, 303, 304, 305, 306, 307) 84 +WHERE menu_id IN (301, 302, 303, 304, 305, 306, 307, 308, 309, 310)
82 AND del_flag = '0'; 85 AND del_flag = '0';
83 86
84 -- 为ADMIN角色分配发票管理按钮权限 87 -- 为ADMIN角色分配发票管理按钮权限
...@@ -102,11 +105,11 @@ FROM t_sys_menu ...@@ -102,11 +105,11 @@ FROM t_sys_menu
102 WHERE menu_id IN (201, 202, 203, 205, 206, 207, 208, 209, 210) 105 WHERE menu_id IN (201, 202, 203, 205, 206, 207, 208, 209, 210)
103 AND del_flag = '0'; 106 AND del_flag = '0';
104 107
105 --- 为OPERATOR角色分配出库查询按钮权限 108 +-- 为OPERATOR角色分配出库查询按钮权限(除删除外)
106 INSERT INTO t_sys_role_menu (role_id, menu_id, create_by, create_time, update_by, update_time, del_flag) 109 INSERT INTO t_sys_role_menu (role_id, menu_id, create_by, create_time, update_by, update_time, del_flag)
107 SELECT @operator_role_id, menu_id, 'admin', NOW(), 'admin', NOW(), '0' 110 SELECT @operator_role_id, menu_id, 'admin', NOW(), 'admin', NOW(), '0'
108 FROM t_sys_menu 111 FROM t_sys_menu
109 -WHERE menu_id IN (301, 302, 303, 304, 305, 306, 307) 112 +WHERE menu_id IN (301, 302, 303, 305, 306, 307, 308, 309, 310)
110 AND del_flag = '0'; 113 AND del_flag = '0';
111 114
112 -- 为OPERATOR角色分配发票管理按钮权限(除删除外) 115 -- 为OPERATOR角色分配发票管理按钮权限(除删除外)
...@@ -130,11 +133,11 @@ FROM t_sys_menu ...@@ -130,11 +133,11 @@ FROM t_sys_menu
130 WHERE menu_id IN (201, 205, 206) 133 WHERE menu_id IN (201, 205, 206)
131 AND del_flag = '0'; 134 AND del_flag = '0';
132 135
133 --- 为DEALER_MANAGER角色分配出库查询按钮权限 136 +-- 为DEALER_MANAGER角色分配出库查询按钮权限(只读权限)
134 INSERT INTO t_sys_role_menu (role_id, menu_id, create_by, create_time, update_by, update_time, del_flag) 137 INSERT INTO t_sys_role_menu (role_id, menu_id, create_by, create_time, update_by, update_time, del_flag)
135 SELECT @dealer_manager_role_id, menu_id, 'admin', NOW(), 'admin', NOW(), '0' 138 SELECT @dealer_manager_role_id, menu_id, 'admin', NOW(), 'admin', NOW(), '0'
136 FROM t_sys_menu 139 FROM t_sys_menu
137 -WHERE menu_id IN (301, 302, 303, 304, 305) 140 +WHERE menu_id IN (301, 305, 306, 307, 308)
138 AND del_flag = '0'; 141 AND del_flag = '0';
139 142
140 -- 为DEALER_MANAGER角色分配发票管理按钮权限(只读权限) 143 -- 为DEALER_MANAGER角色分配发票管理按钮权限(只读权限)
......
1 +-- Apple经销商ERP系统 - 修复出库新增权限
2 +-- 创建时间: 2025-01-27
3 +-- 版本: v1.0
4 +
5 +-- 设置数据库和字符集
6 +SET NAMES utf8mb4;
7 +SET FOREIGN_KEY_CHECKS = 0;
8 +
9 +-- 使用数据库
10 +USE apple_erp;
11 +
12 +-- =========================================
13 +-- 1. 添加缺失的出库新增权限
14 +-- =========================================
15 +
16 +-- 检查是否已存在出库新增权限
17 +SET @delivery_add_exists = (SELECT COUNT(*) FROM t_sys_menu WHERE perms = 'delivery:add' AND del_flag = '0');
18 +
19 +-- 如果不存在,则添加出库新增权限
20 +INSERT INTO t_sys_menu (menu_id, parent_id, menu_name, menu_type, path, icon, sort, status, perms, create_by, create_time, update_by, update_time, del_flag)
21 +SELECT 302, 3, '出库新增', '2', '', '', 2, '1', 'delivery:add', 'admin', NOW(), 'admin', NOW(), '0'
22 +WHERE @delivery_add_exists = 0;
23 +
24 +-- =========================================
25 +-- 2. 为所有角色分配出库新增权限
26 +-- =========================================
27 +
28 +-- 获取ADMIN角色ID
29 +SET @admin_role_id = (SELECT role_id FROM t_sys_role WHERE role_code = 'ADMIN' AND del_flag = '0' LIMIT 1);
30 +
31 +-- 为ADMIN角色分配出库新增权限
32 +INSERT IGNORE INTO t_sys_role_menu (role_id, menu_id, create_by, create_time, update_by, update_time, del_flag)
33 +SELECT @admin_role_id, menu_id, 'admin', NOW(), 'admin', NOW(), '0'
34 +FROM t_sys_menu
35 +WHERE perms = 'delivery:add' AND del_flag = '0';
36 +
37 +-- 获取OPERATOR角色ID
38 +SET @operator_role_id = (SELECT role_id FROM t_sys_role WHERE role_code = 'OPERATOR' AND del_flag = '0' LIMIT 1);
39 +
40 +-- 为OPERATOR角色分配出库新增权限
41 +INSERT IGNORE INTO t_sys_role_menu (role_id, menu_id, create_by, create_time, update_by, update_time, del_flag)
42 +SELECT @operator_role_id, menu_id, 'admin', NOW(), 'admin', NOW(), '0'
43 +FROM t_sys_menu
44 +WHERE perms = 'delivery:add' AND del_flag = '0';
45 +
46 +-- 获取DEALER_MANAGER角色ID
47 +SET @dealer_manager_role_id = (SELECT role_id FROM t_sys_role WHERE role_code = 'DEALER_MANAGER' AND del_flag = '0' LIMIT 1);
48 +
49 +-- 为DEALER_MANAGER角色分配出库新增权限
50 +INSERT IGNORE INTO t_sys_role_menu (role_id, menu_id, create_by, create_time, update_by, update_time, del_flag)
51 +SELECT @dealer_manager_role_id, menu_id, 'admin', NOW(), 'admin', NOW(), '0'
52 +FROM t_sys_menu
53 +WHERE perms = 'delivery:add' AND del_flag = '0';
54 +
55 +-- 重置外键检查
56 +SET FOREIGN_KEY_CHECKS = 1;
57 +
58 +-- 输出完成信息
59 +SELECT '出库新增权限修复完成!' AS message;
...@@ -3,13 +3,15 @@ import { request } from '../utils/request' ...@@ -3,13 +3,15 @@ import { request } from '../utils/request'
3 // 出库相关类型定义 3 // 出库相关类型定义
4 export interface DeliveryInfo { 4 export interface DeliveryInfo {
5 deliveryId: number 5 deliveryId: number
6 - orderId: number 6 + deliveryNo: string
7 - orderNo: string
8 dealerCode: string 7 dealerCode: string
9 dealerName: string 8 dealerName: string
9 + orderNo: string
10 deliveryDate: string 10 deliveryDate: string
11 - totalAmount: number
12 deliveryStatus: number 11 deliveryStatus: number
12 + warehouseCode: string
13 + dataSource: string
14 + uploadTime?: string
13 createBy?: string 15 createBy?: string
14 createTime?: string 16 createTime?: string
15 updateBy?: string 17 updateBy?: string
...@@ -22,42 +24,73 @@ export interface DeliveryItemInfo { ...@@ -22,42 +24,73 @@ export interface DeliveryItemInfo {
22 deliveryId?: number 24 deliveryId?: number
23 productCode: string 25 productCode: string
24 productName: string 26 productName: string
25 - productQty: number 27 + deliveryQty: number
26 - unitPrice: number 28 + deliveryPrice: number
27 - totalPrice: number 29 + deliveryAmount: number
28 - createBy?: string
29 - createTime?: string
30 } 30 }
31 31
32 export interface DeliveryQueryReq { 32 export interface DeliveryQueryReq {
33 - pageNum?: number 33 + deliveryNo?: string
34 - pageSize?: number
35 - orderNo?: string
36 dealerCode?: string 34 dealerCode?: string
37 dealerName?: string 35 dealerName?: string
36 + deliveryStatus?: number
37 + warehouseCode?: string
38 + dataSource?: string
38 deliveryStartDate?: string 39 deliveryStartDate?: string
39 deliveryEndDate?: string 40 deliveryEndDate?: string
40 - deliveryStatus?: number 41 + minAmount?: number
42 + maxAmount?: number
43 + pageNum?: number
44 + pageSize?: number
41 } 45 }
42 46
43 export interface DeliveryAddReq { 47 export interface DeliveryAddReq {
44 - orderId: number 48 + deliveryNo: string
49 + dealerCode: string
50 + dealerName: string
51 + orderNo: string
45 deliveryDate: string 52 deliveryDate: string
46 - deliveryItems: Omit<DeliveryItemInfo, 'itemId' | 'deliveryId' | 'createBy' | 'createTime'>[] 53 + deliveryStatus?: number
54 + warehouseCode: string
55 + dataSource?: string
56 + deliveryItems: DeliveryItemAddReq[]
57 +}
58 +
59 +export interface DeliveryItemAddReq {
60 + productCode: string
61 + productName: string
62 + deliveryQty: number
63 + deliveryPrice: number
64 + deliveryAmount: number
47 } 65 }
48 66
49 export interface DeliveryUpdateReq { 67 export interface DeliveryUpdateReq {
50 deliveryId: number 68 deliveryId: number
51 - deliveryDate?: string 69 + deliveryNo: string
70 + dealerCode: string
71 + dealerName: string
72 + orderNo: string
73 + deliveryDate: string
52 deliveryStatus?: number 74 deliveryStatus?: number
53 - deliveryItems?: Omit<DeliveryItemInfo, 'itemId' | 'deliveryId' | 'createBy' | 'createTime'>[] 75 + warehouseCode: string
76 + dataSource?: string
77 + deliveryItems: DeliveryItemUpdateReq[]
78 +}
79 +
80 +export interface DeliveryItemUpdateReq {
81 + itemId?: number
82 + productCode: string
83 + productName: string
84 + deliveryQty: number
85 + deliveryPrice: number
86 + deliveryAmount: number
54 } 87 }
55 88
56 // 出库API接口 89 // 出库API接口
57 export const deliveryApi = { 90 export const deliveryApi = {
58 // 分页查询出库列表 91 // 分页查询出库列表
59 getDeliveryList: (params: DeliveryQueryReq) => { 92 getDeliveryList: (params: DeliveryQueryReq) => {
60 - return request.get('/api/delivery/list', { params }) 93 + return request.get('/api/delivery/list', params)
61 }, 94 },
62 95
63 // 获取出库详情 96 // 获取出库详情
...@@ -67,10 +100,10 @@ export const deliveryApi = { ...@@ -67,10 +100,10 @@ export const deliveryApi = {
67 100
68 // 新增出库 101 // 新增出库
69 addDelivery: (data: DeliveryAddReq) => { 102 addDelivery: (data: DeliveryAddReq) => {
70 - return request.post('/api/delivery/add', data) 103 + return request.post('/api/delivery', data)
71 }, 104 },
72 105
73 - // 更新出库 106 + // 修改出库
74 updateDelivery: (data: DeliveryUpdateReq) => { 107 updateDelivery: (data: DeliveryUpdateReq) => {
75 return request.post('/api/delivery/update', data) 108 return request.post('/api/delivery/update', data)
76 }, 109 },
...@@ -81,14 +114,14 @@ export const deliveryApi = { ...@@ -81,14 +114,14 @@ export const deliveryApi = {
81 }, 114 },
82 115
83 // 批量删除出库 116 // 批量删除出库
84 - batchDeleteDelivery: (deliveryIds: number[]) => { 117 + batchDeleteDeliveries: (deliveryIds: number[]) => {
85 return request.post('/api/delivery/batchDelete', deliveryIds) 118 return request.post('/api/delivery/batchDelete', deliveryIds)
86 }, 119 },
87 120
88 - // 导出出库数据 121 + // 修改出库状态
89 - exportDelivery: (params: DeliveryQueryReq) => { 122 + updateDeliveryStatus: (deliveryId: number, deliveryStatus: number) => {
90 - return request.get('/api/delivery/export', { params, responseType: 'blob' }) 123 + return request.post(`/api/delivery/${deliveryId}/deliveryStatus`, null, {
124 + params: { deliveryStatus }
125 + })
91 } 126 }
92 } 127 }
93 -
94 -export default deliveryApi
......
1 import { request } from '../utils/request' 1 import { request } from '../utils/request'
2 2
3 -// 发票相关类型定义
4 export interface InvoiceInfo { 3 export interface InvoiceInfo {
5 invoiceId: number 4 invoiceId: number
6 - orderId: number 5 + invoiceNo: string
7 orderNo: string 6 orderNo: string
7 + deliveryNo: string
8 dealerCode: string 8 dealerCode: string
9 dealerName: string 9 dealerName: string
10 - invoiceDate: string
11 totalAmount: number 10 totalAmount: number
11 + invoiceDate: string
12 invoiceStatus: number 12 invoiceStatus: number
13 - invoiceNo?: string 13 + taxRate: number
14 + dataSource: string
15 + uploadTime?: string
14 createBy?: string 16 createBy?: string
15 createTime?: string 17 createTime?: string
16 updateBy?: string 18 updateBy?: string
...@@ -19,79 +21,108 @@ export interface InvoiceInfo { ...@@ -19,79 +21,108 @@ export interface InvoiceInfo {
19 } 21 }
20 22
21 export interface InvoiceItemInfo { 23 export interface InvoiceItemInfo {
22 - itemId?: number 24 + itemId: number
23 - invoiceId?: number 25 + invoiceId: number
26 + invoiceNo: string
24 productCode: string 27 productCode: string
25 productName: string 28 productName: string
26 productQty: number 29 productQty: number
27 unitPrice: number 30 unitPrice: number
28 - totalPrice: number 31 + itemAmount: number
32 + taxRate: number
33 + taxAmount: number
29 createBy?: string 34 createBy?: string
30 createTime?: string 35 createTime?: string
36 + updateBy?: string
37 + updateTime?: string
31 } 38 }
32 39
33 export interface InvoiceQueryReq { 40 export interface InvoiceQueryReq {
34 - pageNum?: number 41 + invoiceNo?: string
35 - pageSize?: number
36 orderNo?: string 42 orderNo?: string
43 + deliveryNo?: string
37 dealerCode?: string 44 dealerCode?: string
38 dealerName?: string 45 dealerName?: string
46 + invoiceStatus?: number
47 + dataSource?: string
39 invoiceStartDate?: string 48 invoiceStartDate?: string
40 invoiceEndDate?: string 49 invoiceEndDate?: string
41 - invoiceStatus?: number 50 + pageNum: number
51 + pageSize: number
42 } 52 }
43 53
44 export interface InvoiceAddReq { 54 export interface InvoiceAddReq {
45 - orderId: number 55 + invoiceNo: string
56 + orderNo: string
57 + deliveryNo: string
58 + dealerCode: string
59 + dealerName: string
60 + totalAmount: number
46 invoiceDate: string 61 invoiceDate: string
47 - invoiceNo?: string 62 + invoiceStatus?: number
48 - invoiceItems: Omit<InvoiceItemInfo, 'itemId' | 'invoiceId' | 'createBy' | 'createTime'>[] 63 + taxRate: number
64 + dataSource?: string
65 + invoiceItems: InvoiceItemAddReq[]
49 } 66 }
50 67
51 export interface InvoiceUpdateReq { 68 export interface InvoiceUpdateReq {
52 invoiceId: number 69 invoiceId: number
53 - invoiceDate?: string 70 + invoiceNo: string
71 + orderNo: string
72 + deliveryNo: string
73 + dealerCode: string
74 + dealerName: string
75 + totalAmount: number
76 + invoiceDate: string
54 invoiceStatus?: number 77 invoiceStatus?: number
55 - invoiceNo?: string 78 + taxRate: number
56 - invoiceItems?: Omit<InvoiceItemInfo, 'itemId' | 'invoiceId' | 'createBy' | 'createTime'>[] 79 + dataSource?: string
80 + invoiceItems: InvoiceItemUpdateReq[]
81 +}
82 +
83 +export interface InvoiceItemAddReq {
84 + productCode: string
85 + productName: string
86 + productQty: number
87 + unitPrice: number
88 + itemAmount: number
89 + taxRate: number
90 + taxAmount: number
91 +}
92 +
93 +export interface InvoiceItemUpdateReq {
94 + itemId?: number
95 + productCode: string
96 + productName: string
97 + productQty: number
98 + unitPrice: number
99 + itemAmount: number
100 + taxRate: number
101 + taxAmount: number
57 } 102 }
58 103
59 -// 发票API接口
60 export const invoiceApi = { 104 export const invoiceApi = {
61 - // 分页查询发票列表
62 getInvoiceList: (params: InvoiceQueryReq) => { 105 getInvoiceList: (params: InvoiceQueryReq) => {
63 - return request.get('/api/invoice/list', { params }) 106 + return request.get('/api/invoice/list', params)
64 }, 107 },
65 -
66 - // 获取发票详情
67 getInvoiceDetail: (invoiceId: number) => { 108 getInvoiceDetail: (invoiceId: number) => {
68 return request.get(`/api/invoice/${invoiceId}`) 109 return request.get(`/api/invoice/${invoiceId}`)
69 }, 110 },
70 -
71 - // 新增发票
72 addInvoice: (data: InvoiceAddReq) => { 111 addInvoice: (data: InvoiceAddReq) => {
73 - return request.post('/api/invoice/add', data) 112 + return request.post('/api/invoice', data)
74 }, 113 },
75 -
76 - // 更新发票
77 updateInvoice: (data: InvoiceUpdateReq) => { 114 updateInvoice: (data: InvoiceUpdateReq) => {
78 return request.post('/api/invoice/update', data) 115 return request.post('/api/invoice/update', data)
79 }, 116 },
80 -
81 - // 删除发票
82 deleteInvoice: (invoiceId: number) => { 117 deleteInvoice: (invoiceId: number) => {
83 return request.delete(`/api/invoice/${invoiceId}`) 118 return request.delete(`/api/invoice/${invoiceId}`)
84 }, 119 },
85 - 120 + batchDeleteInvoices: (invoiceIds: number[]) => {
86 - // 批量删除发票
87 - batchDeleteInvoice: (invoiceIds: number[]) => {
88 return request.post('/api/invoice/batchDelete', invoiceIds) 121 return request.post('/api/invoice/batchDelete', invoiceIds)
89 }, 122 },
90 - 123 + updateInvoiceStatus: (invoiceId: number, invoiceStatus: number) => {
91 - // 导出发票数据 124 + return request.post(`/api/invoice/${invoiceId}/invoiceStatus`, null, {
92 - exportInvoice: (params: InvoiceQueryReq) => { 125 + params: { invoiceStatus }
93 - return request.get('/api/invoice/export', { params, responseType: 'blob' }) 126 + })
94 } 127 }
95 } 128 }
96 -
97 -export default invoiceApi
......
...@@ -103,7 +103,7 @@ export interface OrderItemUpdateReq { ...@@ -103,7 +103,7 @@ export interface OrderItemUpdateReq {
103 export const orderApi = { 103 export const orderApi = {
104 // 分页查询订单列表 104 // 分页查询订单列表
105 getOrderList: (params: OrderQueryReq) => { 105 getOrderList: (params: OrderQueryReq) => {
106 - return request.get('/order/list', { params }) 106 + return request.get('/order/list', params)
107 }, 107 },
108 108
109 // 获取订单详情 109 // 获取订单详情
......
...@@ -86,25 +86,25 @@ ...@@ -86,25 +86,25 @@
86 <table class="data-table"> 86 <table class="data-table">
87 <thead> 87 <thead>
88 <tr> 88 <tr>
89 - <th>出库ID</th> 89 + <th>出库ID</th>
90 - <th class="sortable">出库单号 ↕️</th> 90 + <th class="sortable">出库单号 ↕️</th>
91 <th>经销商编码</th> 91 <th>经销商编码</th>
92 <th>经销商名称</th> 92 <th>经销商名称</th>
93 <th>出库日期</th> 93 <th>出库日期</th>
94 - <th>出库金额</th> 94 + <th>关联订单编号</th>
95 <th>出库状态</th> 95 <th>出库状态</th>
96 <th>创建时间</th> 96 <th>创建时间</th>
97 <th>操作</th> 97 <th>操作</th>
98 </tr> 98 </tr>
99 </thead> 99 </thead>
100 <tbody> 100 <tbody>
101 - <tr v-for="delivery in deliveryList" :key="delivery.deliveryId"> 101 + <tr v-for="order in orderList" :key="order.deliveryId">
102 - <td>{{ delivery.deliveryId }}</td> 102 + <td>{{ order.deliveryId }}</td>
103 - <td>{{ delivery.deliveryNo }}</td> 103 + <td>{{ order.deliveryNo }}</td>
104 - <td>{{ delivery.dealerCode }}</td> 104 + <td>{{ order.dealerCode }}</td>
105 - <td>{{ delivery.dealerName }}</td> 105 + <td>{{ order.dealerName }}</td>
106 - <td>{{ formatDate(delivery.deliveryDate) }}</td> 106 + <td>{{ formatDate(order.deliveryDate) }}</td>
107 - <td>{{ formatCurrency(delivery.totalAmount) }}</td> 107 + <td>{{ order.orderNo }}</td>
108 <td> 108 <td>
109 <span :class="getDeliveryStatusClass(delivery.deliveryStatus)"> 109 <span :class="getDeliveryStatusClass(delivery.deliveryStatus)">
110 {{ getDeliveryStatusText(delivery.deliveryStatus) }} 110 {{ getDeliveryStatusText(delivery.deliveryStatus) }}
...@@ -113,6 +113,7 @@ ...@@ -113,6 +113,7 @@
113 <td>{{ formatTime(delivery.createTime || '') }}</td> 113 <td>{{ formatTime(delivery.createTime || '') }}</td>
114 <td class="action-col"> 114 <td class="action-col">
115 <button @click="handleView(delivery)" class="view-btn">👁️ 查看</button> 115 <button @click="handleView(delivery)" class="view-btn">👁️ 查看</button>
116 + <button @click="handleDelete(order)" class="delete-btn">🗑️ 删除</button>
116 </td> 117 </td>
117 </tr> 118 </tr>
118 </tbody> 119 </tbody>
...@@ -298,6 +299,7 @@ ...@@ -298,6 +299,7 @@
298 v-model="addFormData.deliveryDate" 299 v-model="addFormData.deliveryDate"
299 class="form-input" 300 class="form-input"
300 type="datetime-local" 301 type="datetime-local"
302 + step="1"
301 required 303 required
302 /> 304 />
303 </div> 305 </div>
...@@ -409,7 +411,7 @@ ...@@ -409,7 +411,7 @@
409 411
410 <script setup lang="ts"> 412 <script setup lang="ts">
411 import { ref, reactive, computed, onMounted } from 'vue' 413 import { ref, reactive, computed, onMounted } from 'vue'
412 -import { deliveryApi, type DeliveryInfo, type DeliveryQueryReq } from '../../api/delivery' 414 +import { deliveryApi, type DeliveryAddReq, type DeliveryInfo, type DeliveryQueryReq } from '../../api/delivery'
413 415
414 // 响应式数据 416 // 响应式数据
415 const loading = ref(false) 417 const loading = ref(false)
...@@ -433,12 +435,14 @@ const addFormData = reactive({ ...@@ -433,12 +435,14 @@ const addFormData = reactive({
433 435
434 // 搜索参数 436 // 搜索参数
435 const searchParams = reactive({ 437 const searchParams = reactive({
436 - orderNo: '', 438 + deliveryNo: '',
437 dealerCode: '', 439 dealerCode: '',
438 dealerName: '', 440 dealerName: '',
439 deliveryStatus: undefined, 441 deliveryStatus: undefined,
440 - startDate: '', 442 + warehouseCode: '',
441 - endDate: '', 443 + dataSource: '',
444 + deliveryStartDate: '',
445 + deliveryEndDate: '',
442 pageNum: 1, 446 pageNum: 1,
443 pageSize: 10 447 pageSize: 10
444 }) 448 })
...@@ -551,9 +555,9 @@ const handleReset = () => { ...@@ -551,9 +555,9 @@ const handleReset = () => {
551 fetchDeliveries() 555 fetchDeliveries()
552 } 556 }
553 557
554 -const handleView = async (delivery: DeliveryInfo) => { 558 +const handleView = async (order: DeliveryInfo) => {
555 try { 559 try {
556 - const response = await deliveryApi.getDeliveryDetail(delivery.deliveryId) as any 560 + const response = await deliveryApi.getDeliveryDetail(order.deliveryId) as any
557 console.log('出库查询详情API响应:', response) 561 console.log('出库查询详情API响应:', response)
558 562
559 // 由于request.ts的响应拦截器已经处理了code=200的情况,直接返回data 563 // 由于request.ts的响应拦截器已经处理了code=200的情况,直接返回data
...@@ -569,6 +573,19 @@ const handleView = async (delivery: DeliveryInfo) => { ...@@ -569,6 +573,19 @@ const handleView = async (delivery: DeliveryInfo) => {
569 } 573 }
570 } 574 }
571 575
576 +const handleDelete = async (order: DeliveryInfo) => {
577 + if (confirm(`确定要删除出库单"${order.deliveryNo}"吗?`)) {
578 + try {
579 + await deliveryApi.deleteDelivery(order.deliveryId)
580 + showMessage('删除出库单成功', 'success')
581 + fetchOrders() // 刷新列表
582 + } catch (error) {
583 + console.error('删除出库单失败:', error)
584 + showMessage('删除出库单失败, 请重试', 'error')
585 + }
586 + }
587 +}
588 +
572 589
573 const handleExport = () => { 590 const handleExport = () => {
574 showMessage('导出功能开发中...', 'warning') 591 showMessage('导出功能开发中...', 'warning')
...@@ -618,11 +635,36 @@ const calculateDeliveryItemTotal = (index: number) => { ...@@ -618,11 +635,36 @@ const calculateDeliveryItemTotal = (index: number) => {
618 635
619 const handleSubmitAdd = async () => { 636 const handleSubmitAdd = async () => {
620 try { 637 try {
621 - // 这里应该调用新增出库的API 638 + // 处理日期时间格式,将datetime-local格式转换为后端需要的格式
622 - // await deliveryApi.addDelivery(addFormData) 639 + let formattedDeliveryDate = addFormData.deliveryDate
623 - showMessage('新增出库功能开发中...', 'warning') 640 + if (formattedDeliveryDate && formattedDeliveryDate.includes('T')) {
641 + // 将 YYYY-MM-DDTHH:MM:SS 格式转换为 YYYY-MM-DD HH:MM:SS 格式
642 + formattedDeliveryDate = formattedDeliveryDate.replace('T', ' ')
643 + }
644 +
645 + // 构造新增出库的请求数据
646 + const deliveryData: DeliveryAddReq = {
647 + deliveryNo: addFormData.deliveryNo,
648 + dealerCode: addFormData.dealerCode,
649 + dealerName: addFormData.dealerName,
650 + orderNo: addFormData.orderNo,
651 + deliveryDate: formattedDeliveryDate,
652 + deliveryStatus: 1, // 默认已出库
653 + warehouseCode: addFormData.warehouseCode,
654 + dataSource: addFormData.dataSource || '系统录入',
655 + deliveryItems: addFormData.deliveryItems.map(item => ({
656 + productCode: item.productCode,
657 + productName: item.productName,
658 + deliveryQty: item.deliveryQty,
659 + deliveryPrice: item.deliveryPrice,
660 + deliveryAmount: item.deliveryAmount
661 + }))
662 + }
663 +
664 + await deliveryApi.addDelivery(deliveryData)
665 + showMessage('新增出库成功', 'success')
624 closeAddDialog() 666 closeAddDialog()
625 - // fetchOrders() // 刷新列表 667 + fetchOrders() // 刷新列表
626 } catch (error) { 668 } catch (error) {
627 console.error('新增出库失败:', error) 669 console.error('新增出库失败:', error)
628 showMessage('新增出库失败, 请重试', 'error') 670 showMessage('新增出库失败, 请重试', 'error')
...@@ -891,6 +933,11 @@ onMounted(() => { ...@@ -891,6 +933,11 @@ onMounted(() => {
891 color: white; 933 color: white;
892 } 934 }
893 935
936 +.delete-btn {
937 + background: #dc3545;
938 + color: white;
939 +}
940 +
894 .status-btn { 941 .status-btn {
895 background: #28a745; 942 background: #28a745;
896 color: white; 943 color: white;
......
...@@ -4,6 +4,14 @@ ...@@ -4,6 +4,14 @@
4 <div class="search-section"> 4 <div class="search-section">
5 <div class="search-row"> 5 <div class="search-row">
6 <div class="search-item"> 6 <div class="search-item">
7 + <label>发票编号:</label>
8 + <input
9 + v-model="searchParams.invoiceNo"
10 + class="search-input"
11 + placeholder="请输入发票编号"
12 + />
13 + </div>
14 + <div class="search-item">
7 <label>订单编号:</label> 15 <label>订单编号:</label>
8 <input 16 <input
9 v-model="searchParams.orderNo" 17 v-model="searchParams.orderNo"
...@@ -38,17 +46,17 @@ ...@@ -38,17 +46,17 @@
38 </div> 46 </div>
39 <div class="search-row"> 47 <div class="search-row">
40 <div class="search-item"> 48 <div class="search-item">
41 - <label>开始日期:</label> 49 + <label>开票开始日期:</label>
42 <input 50 <input
43 - v-model="searchParams.startDate" 51 + v-model="searchParams.invoiceStartDate"
44 class="search-input" 52 class="search-input"
45 type="date" 53 type="date"
46 /> 54 />
47 </div> 55 </div>
48 <div class="search-item"> 56 <div class="search-item">
49 - <label>结束日期:</label> 57 + <label>开票结束日期:</label>
50 <input 58 <input
51 - v-model="searchParams.endDate" 59 + v-model="searchParams.invoiceEndDate"
52 class="search-input" 60 class="search-input"
53 type="date" 61 type="date"
54 /> 62 />
...@@ -65,8 +73,6 @@ ...@@ -65,8 +73,6 @@
65 <div class="action-buttons"> 73 <div class="action-buttons">
66 <button @click="handleAdd" class="action-btn primary">✨ 新增发票</button> 74 <button @click="handleAdd" class="action-btn primary">✨ 新增发票</button>
67 <button @click="handleExport" class="action-btn secondary">📋 导出</button> 75 <button @click="handleExport" class="action-btn secondary">📋 导出</button>
68 - <button @click="handlePrint" class="action-btn secondary">🖨️ 打印</button>
69 - <button @click="handleStatistics" class="action-btn secondary">📊 统计</button>
70 </div> 76 </div>
71 </div> 77 </div>
72 78
...@@ -88,40 +94,36 @@ ...@@ -88,40 +94,36 @@
88 <table class="data-table"> 94 <table class="data-table">
89 <thead> 95 <thead>
90 <tr> 96 <tr>
91 - <th>订单ID</th> 97 + <th>发票ID</th>
92 - <th class="sortable">订单编号 ↕️</th> 98 + <th class="sortable">发票编号 ↕️</th>
93 <th>经销商编码</th> 99 <th>经销商编码</th>
94 <th>经销商名称</th> 100 <th>经销商名称</th>
95 - <th>订单日期</th> 101 + <th>开票日期</th>
96 - <th>订单金额</th> 102 + <th>发票金额</th>
97 <th>开票状态</th> 103 <th>开票状态</th>
98 <th>开票时间</th> 104 <th>开票时间</th>
99 - <th>发票号码</th> 105 + <th>关联订单编号</th>
100 <th>操作</th> 106 <th>操作</th>
101 </tr> 107 </tr>
102 </thead> 108 </thead>
103 <tbody> 109 <tbody>
104 - <tr v-for="order in orderList" :key="order.orderId"> 110 + <tr v-for="order in orderList" :key="order.invoiceId">
105 - <td>{{ order.orderId }}</td> 111 + <td>{{ order.invoiceId }}</td>
106 - <td>{{ order.orderNo }}</td> 112 + <td>{{ order.invoiceNo }}</td>
107 <td>{{ order.dealerCode }}</td> 113 <td>{{ order.dealerCode }}</td>
108 <td>{{ order.dealerName }}</td> 114 <td>{{ order.dealerName }}</td>
109 - <td>{{ formatDate(order.orderDate) }}</td> 115 + <td>{{ formatDate(order.invoiceDate) }}</td>
110 <td>{{ formatCurrency(order.totalAmount) }}</td> 116 <td>{{ formatCurrency(order.totalAmount) }}</td>
111 <td> 117 <td>
112 <span :class="getInvoiceStatusClass(order.invoiceStatus)"> 118 <span :class="getInvoiceStatusClass(order.invoiceStatus)">
113 {{ getInvoiceStatusText(order.invoiceStatus) }} 119 {{ getInvoiceStatusText(order.invoiceStatus) }}
114 </span> 120 </span>
115 </td> 121 </td>
116 - <td>{{ formatTime('') }}</td> 122 + <td>{{ formatTime(order.uploadTime || '') }}</td>
117 - <td>{{ '-' }}</td> 123 + <td>{{ order.orderNo }}</td>
118 <td class="action-col"> 124 <td class="action-col">
119 <button @click="handleView(order)" class="view-btn">👁️ 查看</button> 125 <button @click="handleView(order)" class="view-btn">👁️ 查看</button>
120 <button @click="handleEdit(order)" class="edit-btn">✏️ 编辑</button> 126 <button @click="handleEdit(order)" class="edit-btn">✏️ 编辑</button>
121 - <button @click="handleInvoiceStatus(order)" class="status-btn">
122 - {{ order.invoiceStatus === 0 ? '开票' : '撤销开票' }}
123 - </button>
124 - <button @click="handlePrintInvoice(order)" class="print-btn">🖨️ 打印</button>
125 </td> 127 </td>
126 </tr> 128 </tr>
127 </tbody> 129 </tbody>
...@@ -275,24 +277,47 @@ ...@@ -275,24 +277,47 @@
275 </div> 277 </div>
276 <div class="dialog-body"> 278 <div class="dialog-body">
277 <div v-if="invoiceDetail" class="detail-content"> 279 <div v-if="invoiceDetail" class="detail-content">
280 + <!-- 发票基本信息 -->
278 <div class="detail-section"> 281 <div class="detail-section">
279 <h4>发票基本信息</h4> 282 <h4>发票基本信息</h4>
280 <div class="detail-grid"> 283 <div class="detail-grid">
281 <div class="detail-item"> 284 <div class="detail-item">
282 - <label>订单编号:</label> 285 + <label>发票ID:</label>
283 - <span>{{ invoiceDetail.orderNo }}</span> 286 + <span>{{ invoiceDetail.invoiceId }}</span>
284 </div> 287 </div>
285 <div class="detail-item"> 288 <div class="detail-item">
286 - <label>发票号码:</label> 289 + <label>发票编号:</label>
287 <span>{{ invoiceDetail.invoiceNo }}</span> 290 <span>{{ invoiceDetail.invoiceNo }}</span>
288 </div> 291 </div>
289 <div class="detail-item"> 292 <div class="detail-item">
293 + <label>关联订单编号:</label>
294 + <span>{{ invoiceDetail.orderNo }}</span>
295 + </div>
296 + <div class="detail-item">
297 + <label>关联出库单编号:</label>
298 + <span>{{ invoiceDetail.deliveryNo || '-' }}</span>
299 + </div>
300 + <div class="detail-item">
301 + <label>经销商编码:</label>
302 + <span>{{ invoiceDetail.dealerCode }}</span>
303 + </div>
304 + <div class="detail-item">
305 + <label>经销商名称:</label>
306 + <span>{{ invoiceDetail.dealerName }}</span>
307 + </div>
308 + <div class="detail-item">
290 <label>开票日期:</label> 309 <label>开票日期:</label>
291 <span>{{ formatDate(invoiceDetail.invoiceDate) }}</span> 310 <span>{{ formatDate(invoiceDetail.invoiceDate) }}</span>
292 </div> 311 </div>
293 <div class="detail-item"> 312 <div class="detail-item">
294 - <label>开票金额:</label> 313 + <label>开票状态:</label>
295 - <span>{{ formatCurrency(invoiceDetail.invoiceAmount) }}</span> 314 + <span :class="getInvoiceStatusClass(invoiceDetail.invoiceStatus)">
315 + {{ getInvoiceStatusText(invoiceDetail.invoiceStatus) }}
316 + </span>
317 + </div>
318 + <div class="detail-item">
319 + <label>发票总金额:</label>
320 + <span class="amount-text">{{ formatCurrency(invoiceDetail.totalAmount) }}</span>
296 </div> 321 </div>
297 <div class="detail-item"> 322 <div class="detail-item">
298 <label>税率:</label> 323 <label>税率:</label>
...@@ -300,19 +325,71 @@ ...@@ -300,19 +325,71 @@
300 </div> 325 </div>
301 <div class="detail-item"> 326 <div class="detail-item">
302 <label>税额:</label> 327 <label>税额:</label>
303 - <span>{{ formatCurrency(invoiceDetail.taxAmount) }}</span> 328 + <span class="amount-text">{{ formatCurrency((invoiceDetail.totalAmount || 0) * (invoiceDetail.taxRate || 0)) }}</span>
304 </div> 329 </div>
305 <div class="detail-item"> 330 <div class="detail-item">
306 - <label>开票状态:</label> 331 + <label>数据来源:</label>
307 - <span :class="getInvoiceStatusClass(invoiceDetail.invoiceStatus)"> 332 + <span>{{ invoiceDetail.dataSource || '-' }}</span>
308 - {{ getInvoiceStatusText(invoiceDetail.invoiceStatus) }}
309 - </span>
310 </div> 333 </div>
311 <div class="detail-item"> 334 <div class="detail-item">
312 - <label>备注:</label> 335 + <label>上传时间:</label>
313 - <span>{{ invoiceDetail.remark || '-' }}</span> 336 + <span>{{ formatTime(invoiceDetail.uploadTime || '') }}</span>
337 + </div>
338 + <div class="detail-item">
339 + <label>创建时间:</label>
340 + <span>{{ formatTime(invoiceDetail.createTime || '') }}</span>
341 + </div>
342 + <div class="detail-item">
343 + <label>更新时间:</label>
344 + <span>{{ formatTime(invoiceDetail.updateTime || '') }}</span>
345 + </div>
346 + </div>
347 + </div>
348 +
349 + <!-- 发票明细信息 -->
350 + <div v-if="invoiceDetail.invoiceItems && invoiceDetail.invoiceItems.length > 0" class="detail-section">
351 + <h4>发票明细信息</h4>
352 + <div class="detail-table-container">
353 + <table class="detail-table">
354 + <thead>
355 + <tr>
356 + <th>产品编码</th>
357 + <th>产品名称</th>
358 + <th>数量</th>
359 + <th>单价</th>
360 + <th>金额</th>
361 + <th>税率</th>
362 + <th>税额</th>
363 + </tr>
364 + </thead>
365 + <tbody>
366 + <tr v-for="item in invoiceDetail.invoiceItems" :key="item.itemId">
367 + <td>{{ item.productCode }}</td>
368 + <td>{{ item.productName }}</td>
369 + <td>{{ item.productQty }}</td>
370 + <td>{{ formatCurrency(item.unitPrice) }}</td>
371 + <td class="amount-text">{{ formatCurrency(item.itemAmount) }}</td>
372 + <td>{{ item.taxRate ? (item.taxRate * 100).toFixed(2) + '%' : '-' }}</td>
373 + <td class="amount-text">{{ formatCurrency(item.taxAmount || 0) }}</td>
374 + </tr>
375 + </tbody>
376 + <tfoot>
377 + <tr class="total-row">
378 + <td colspan="4" class="total-label">合计:</td>
379 + <td class="amount-text total-amount">{{ formatCurrency(invoiceDetail.totalAmount) }}</td>
380 + <td>-</td>
381 + <td class="amount-text total-amount">{{ formatCurrency((invoiceDetail.totalAmount || 0) * (invoiceDetail.taxRate || 0)) }}</td>
382 + </tr>
383 + </tfoot>
384 + </table>
314 </div> 385 </div>
315 </div> 386 </div>
387 +
388 + <!-- 操作按钮 -->
389 + <div class="detail-actions">
390 + <button @click="handleEdit(invoiceDetail)" class="edit-btn">✏️ 编辑</button>
391 + <button @click="handlePrintInvoice(invoiceDetail)" class="print-btn">🖨️ 打印</button>
392 + <button @click="closeDetailDialog" class="close-btn">关闭</button>
316 </div> 393 </div>
317 </div> 394 </div>
318 </div> 395 </div>
...@@ -327,20 +404,23 @@ import { invoiceApi, type InvoiceInfo, type InvoiceQueryReq } from '../../api/in ...@@ -327,20 +404,23 @@ import { invoiceApi, type InvoiceInfo, type InvoiceQueryReq } from '../../api/in
327 404
328 // 响应式数据 405 // 响应式数据
329 const loading = ref(false) 406 const loading = ref(false)
330 -const invoiceList = ref<InvoiceInfo[]>([]) 407 +const orderList = ref<InvoiceInfo[]>([])
331 const showDialog = ref(false) 408 const showDialog = ref(false)
332 const showDetailDialog = ref(false) 409 const showDetailDialog = ref(false)
333 const isEdit = ref(false) 410 const isEdit = ref(false)
334 -const invoiceDetail = ref<any>(null) 411 +const invoiceDetail = ref<InvoiceInfo | null>(null)
335 412
336 // 搜索参数 413 // 搜索参数
337 const searchParams = reactive({ 414 const searchParams = reactive({
415 + invoiceNo: '',
338 orderNo: '', 416 orderNo: '',
417 + deliveryNo: '',
339 dealerCode: '', 418 dealerCode: '',
340 dealerName: '', 419 dealerName: '',
341 invoiceStatus: undefined, 420 invoiceStatus: undefined,
342 - startDate: '', 421 + dataSource: '',
343 - endDate: '', 422 + invoiceStartDate: '',
423 + invoiceEndDate: '',
344 pageNum: 1, 424 pageNum: 1,
345 pageSize: 10 425 pageSize: 10
346 }) 426 })
...@@ -453,12 +533,15 @@ const handleSearch = () => { ...@@ -453,12 +533,15 @@ const handleSearch = () => {
453 533
454 const handleReset = () => { 534 const handleReset = () => {
455 Object.assign(searchParams, { 535 Object.assign(searchParams, {
536 + invoiceNo: '',
456 orderNo: '', 537 orderNo: '',
538 + deliveryNo: '',
457 dealerCode: '', 539 dealerCode: '',
458 dealerName: '', 540 dealerName: '',
459 invoiceStatus: undefined, 541 invoiceStatus: undefined,
460 - startDate: '', 542 + dataSource: '',
461 - endDate: '' 543 + invoiceStartDate: '',
544 + invoiceEndDate: ''
462 }) 545 })
463 pagination.pageNum = 1 546 pagination.pageNum = 1
464 fetchOrders() 547 fetchOrders()
...@@ -478,12 +561,12 @@ const handleAdd = () => { ...@@ -478,12 +561,12 @@ const handleAdd = () => {
478 showDialog.value = true 561 showDialog.value = true
479 } 562 }
480 563
481 -const handleEdit = (order: OrderInfo) => { 564 +const handleEdit = (order: InvoiceInfo) => {
482 isEdit.value = true 565 isEdit.value = true
483 Object.assign(formData, { 566 Object.assign(formData, {
484 orderNo: order.orderNo, 567 orderNo: order.orderNo,
485 - invoiceNo: (order as any).invoiceNo || '', 568 + invoiceNo: order.invoiceNo,
486 - invoiceDate: (order as any).invoiceTime || '', 569 + invoiceDate: order.invoiceDate,
487 invoiceAmount: order.totalAmount, 570 invoiceAmount: order.totalAmount,
488 taxRate: 0, 571 taxRate: 0,
489 taxAmount: 0, 572 taxAmount: 0,
...@@ -492,13 +575,13 @@ const handleEdit = (order: OrderInfo) => { ...@@ -492,13 +575,13 @@ const handleEdit = (order: OrderInfo) => {
492 showDialog.value = true 575 showDialog.value = true
493 } 576 }
494 577
495 -const handleView = async (order: OrderInfo) => { 578 +const handleView = async (order: InvoiceInfo) => {
496 try { 579 try {
497 - const response = await invoiceApi.getInvoiceDetail(invoice.invoiceId) as any 580 + const response = await invoiceApi.getInvoiceDetail(order.invoiceId) as any
498 console.log('发票管理详情API响应:', response) 581 console.log('发票管理详情API响应:', response)
499 582
500 // 由于request.ts的响应拦截器已经处理了code=200的情况,直接返回data 583 // 由于request.ts的响应拦截器已经处理了code=200的情况,直接返回data
501 - if (response && response.orderId) { 584 + if (response && response.invoiceId) {
502 invoiceDetail.value = response 585 invoiceDetail.value = response
503 showDetailDialog.value = true 586 showDetailDialog.value = true
504 } else { 587 } else {
...@@ -510,36 +593,16 @@ const handleView = async (order: OrderInfo) => { ...@@ -510,36 +593,16 @@ const handleView = async (order: OrderInfo) => {
510 } 593 }
511 } 594 }
512 595
513 -const handleInvoiceStatus = async (order: OrderInfo) => {
514 - const newStatus = order.invoiceStatus === 0 ? 1 : 0
515 - const action = newStatus === 1 ? '开票' : '撤销开票'
516 - if (confirm(`确定要${action}订单"${order.orderNo}"吗?`)) {
517 - try {
518 - await orderApi.updateInvoiceStatus(order.orderId, newStatus)
519 - showMessage(`${action}成功`, 'success')
520 - fetchOrders()
521 - } catch (error) {
522 - console.error(`${action}失败:`, error)
523 - showMessage(`${action}失败, 请重试`, 'error')
524 - }
525 - }
526 -}
527 596
528 const handleExport = () => { 597 const handleExport = () => {
529 showMessage('导出功能开发中...', 'warning') 598 showMessage('导出功能开发中...', 'warning')
530 } 599 }
531 600
532 -const handlePrint = () => { 601 +const handlePrintInvoice = (invoice: InvoiceInfo) => {
533 showMessage('打印功能开发中...', 'warning') 602 showMessage('打印功能开发中...', 'warning')
534 } 603 }
535 604
536 -const handleStatistics = () => {
537 - showMessage('统计功能开发中...', 'warning')
538 -}
539 605
540 -const handlePrintInvoice = (order: OrderInfo) => {
541 - showMessage(`打印发票 ${order.orderNo} 功能开发中...`, 'warning')
542 -}
543 606
544 const handleSubmit = async () => { 607 const handleSubmit = async () => {
545 try { 608 try {
...@@ -973,7 +1036,8 @@ onMounted(() => { ...@@ -973,7 +1036,8 @@ onMounted(() => {
973 } 1036 }
974 1037
975 .dialog-content.large-dialog { 1038 .dialog-content.large-dialog {
976 - max-width: 1000px; 1039 + max-width: 1200px;
1040 + width: 95%;
977 } 1041 }
978 1042
979 .dialog-header { 1043 .dialog-header {
...@@ -1105,4 +1169,145 @@ onMounted(() => { ...@@ -1105,4 +1169,145 @@ onMounted(() => {
1105 color: #333; 1169 color: #333;
1106 font-size: 16px; 1170 font-size: 16px;
1107 } 1171 }
1172 +
1173 +/* 发票详情样式 */
1174 +.detail-content {
1175 + padding: 20px;
1176 +}
1177 +
1178 +.detail-section {
1179 + margin-bottom: 30px;
1180 +}
1181 +
1182 +.detail-section h4 {
1183 + margin: 0 0 15px 0;
1184 + padding: 10px 0;
1185 + border-bottom: 2px solid #007bff;
1186 + color: #007bff;
1187 + font-size: 16px;
1188 + font-weight: 600;
1189 +}
1190 +
1191 +.detail-grid {
1192 + display: grid;
1193 + grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
1194 + gap: 15px;
1195 +}
1196 +
1197 +.detail-item {
1198 + display: flex;
1199 + align-items: center;
1200 + padding: 8px 0;
1201 + border-bottom: 1px solid #f0f0f0;
1202 +}
1203 +
1204 +.detail-item label {
1205 + font-weight: 600;
1206 + color: #333;
1207 + min-width: 120px;
1208 + margin-right: 10px;
1209 +}
1210 +
1211 +.detail-item span {
1212 + color: #666;
1213 + flex: 1;
1214 +}
1215 +
1216 +.amount-text {
1217 + color: #e74c3c;
1218 + font-weight: 600;
1219 +}
1220 +
1221 +.detail-table-container {
1222 + margin-top: 15px;
1223 + overflow-x: auto;
1224 +}
1225 +
1226 +.detail-table {
1227 + width: 100%;
1228 + border-collapse: collapse;
1229 + font-size: 14px;
1230 +}
1231 +
1232 +.detail-table th,
1233 +.detail-table td {
1234 + padding: 10px 8px;
1235 + text-align: left;
1236 + border: 1px solid #ddd;
1237 +}
1238 +
1239 +.detail-table th {
1240 + background: #f8f9fa;
1241 + font-weight: 600;
1242 + color: #333;
1243 +}
1244 +
1245 +.detail-table tbody tr:nth-child(even) {
1246 + background: #f8f9fa;
1247 +}
1248 +
1249 +.detail-table tbody tr:hover {
1250 + background: #e9ecef;
1251 +}
1252 +
1253 +.total-row {
1254 + background: #e9ecef !important;
1255 + font-weight: 600;
1256 +}
1257 +
1258 +.total-label {
1259 + text-align: right;
1260 + font-weight: 600;
1261 +}
1262 +
1263 +.total-amount {
1264 + color: #e74c3c;
1265 + font-weight: 700;
1266 + font-size: 15px;
1267 +}
1268 +
1269 +.detail-actions {
1270 + margin-top: 20px;
1271 + padding-top: 20px;
1272 + border-top: 1px solid #eee;
1273 + display: flex;
1274 + gap: 10px;
1275 + justify-content: flex-end;
1276 +}
1277 +
1278 +.detail-actions button {
1279 + padding: 8px 16px;
1280 + border: none;
1281 + border-radius: 4px;
1282 + cursor: pointer;
1283 + font-size: 14px;
1284 + transition: all 0.2s;
1285 +}
1286 +
1287 +.detail-actions .edit-btn {
1288 + background: #28a745;
1289 + color: white;
1290 +}
1291 +
1292 +.detail-actions .edit-btn:hover {
1293 + background: #218838;
1294 +}
1295 +
1296 +.detail-actions .print-btn {
1297 + background: #17a2b8;
1298 + color: white;
1299 +}
1300 +
1301 +.detail-actions .print-btn:hover {
1302 + background: #138496;
1303 +}
1304 +
1305 +.detail-actions .close-btn {
1306 + background: #6c757d;
1307 + color: white;
1308 +}
1309 +
1310 +.detail-actions .close-btn:hover {
1311 + background: #5a6268;
1312 +}
1108 </style> 1313 </style>
......
...@@ -467,6 +467,8 @@ const searchParams = reactive<OrderQueryReq>({ ...@@ -467,6 +467,8 @@ const searchParams = reactive<OrderQueryReq>({
467 invoiceStatus: undefined, 467 invoiceStatus: undefined,
468 rebateCalcFlag: undefined, 468 rebateCalcFlag: undefined,
469 verifyStatus: undefined, 469 verifyStatus: undefined,
470 + minAmount: undefined,
471 + maxAmount: undefined,
470 pageNum: 1, 472 pageNum: 1,
471 pageSize: 10 473 pageSize: 10
472 }) 474 })
...@@ -593,7 +595,20 @@ const showMessage = (message: string, type: 'success' | 'error' | 'warning' = 's ...@@ -593,7 +595,20 @@ const showMessage = (message: string, type: 'success' | 'error' | 'warning' = 's
593 const fetchOrders = async () => { 595 const fetchOrders = async () => {
594 try { 596 try {
595 loading.value = true 597 loading.value = true
596 - const params = { ...searchParams, pageNum: pagination.pageNum, pageSize: pagination.pageSize } 598 + // 构造查询参数对象
599 + const params: OrderQueryReq = {
600 + orderNo: searchParams.orderNo || undefined,
601 + dealerCode: searchParams.dealerCode || undefined,
602 + dealerName: searchParams.dealerName || undefined,
603 + deliveryStatus: searchParams.deliveryStatus,
604 + invoiceStatus: searchParams.invoiceStatus,
605 + rebateCalcFlag: searchParams.rebateCalcFlag,
606 + verifyStatus: searchParams.verifyStatus,
607 + minAmount: searchParams.minAmount,
608 + maxAmount: searchParams.maxAmount,
609 + pageNum: pagination.pageNum,
610 + pageSize: pagination.pageSize
611 + }
597 const response = await orderApi.getOrderList(params) as any 612 const response = await orderApi.getOrderList(params) as any
598 console.log('API响应:', response) // 添加调试日志 613 console.log('API响应:', response) // 添加调试日志
599 614
...@@ -632,7 +647,9 @@ const handleReset = () => { ...@@ -632,7 +647,9 @@ const handleReset = () => {
632 deliveryStatus: undefined, 647 deliveryStatus: undefined,
633 invoiceStatus: undefined, 648 invoiceStatus: undefined,
634 rebateCalcFlag: undefined, 649 rebateCalcFlag: undefined,
635 - verifyStatus: undefined 650 + verifyStatus: undefined,
651 + minAmount: undefined,
652 + maxAmount: undefined
636 }) 653 })
637 pagination.pageNum = 1 654 pagination.pageNum = 1
638 fetchOrders() 655 fetchOrders()
......