|
|
@@ -376,6 +376,7 @@ router.post('/import/logistics', authMiddleware, upload.single('file'), async (r
|
|
|
const orderNo = row['订单号'] || row['order_no'];
|
|
|
let company = row['物流公司'] || row['company'];
|
|
|
const trackingNo = row['物流单号'] || row['tracking_no'];
|
|
|
+ const remark = row['备注'] || row['remark'];
|
|
|
|
|
|
// 验证物流公司
|
|
|
if (!company) {
|
|
|
@@ -438,11 +439,11 @@ router.post('/import/logistics', authMiddleware, upload.single('file'), async (r
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- // 更新订单状态为已发货
|
|
|
+ // 更新订单状态为已发货,同时更新备注
|
|
|
await pool.query(
|
|
|
- `UPDATE gift_order SET status = 3, update_time = now(), update_by = $1
|
|
|
- WHERE id = $2 AND del_flag = '0'`,
|
|
|
- ['import', orderId]
|
|
|
+ `UPDATE gift_order SET status = 3, remark = COALESCE($1, remark), update_time = now(), update_by = $2
|
|
|
+ WHERE id = $3 AND del_flag = '0'`,
|
|
|
+ [remark, 'import', orderId]
|
|
|
);
|
|
|
|
|
|
// 插入或更新物流信息
|
|
|
@@ -482,6 +483,7 @@ router.get('/import/template', authMiddleware, async (req, res) => {
|
|
|
{ header: '订单号', key: '订单号', width: 20 },
|
|
|
{ header: '物流公司', key: '物流公司', width: 18 },
|
|
|
{ header: '物流单号', key: '物流单号', width: 25 },
|
|
|
+ { header: '备注', key: '备注', width: 30 },
|
|
|
];
|
|
|
|
|
|
// 创建隐藏sheet存放物流公司列表
|
|
|
@@ -503,7 +505,7 @@ router.get('/import/template', authMiddleware, async (req, res) => {
|
|
|
sheet.dataValidations.add('B2:B1000', dataValidation);
|
|
|
|
|
|
// 添加示例数据
|
|
|
- sheet.addRow({ '订单号': 'LP202607210007', '物流公司': '圆通快递', '物流单号': 'YT7631984758887' });
|
|
|
+ sheet.addRow({ '订单号': 'LP202607210007', '物流公司': '圆通快递', '物流单号': 'YT7631984758887', '备注': '示例备注' });
|
|
|
sheet.addRow({ '订单号': 'LP202607210008', '物流公司': '顺丰速运', '物流单号': 'YT7631984758888' });
|
|
|
|
|
|
res.setHeader('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|