diff --git a/Reject.js b/Reject.js index 469476a..7ad07fe 100644 --- a/Reject.js +++ b/Reject.js @@ -1811,7 +1811,7 @@ app.get('/api/suppliers', async (req, res) => { // 查询供应商列表,按创建时间倒序排序,确保最新创建的在前面 const [suppliers] = await connection.query( - `SELECT userId, phoneNumber, province, city, district, detailedaddress, company, collaborationid, cooperation, businesslicenseurl, proofurl, brandurl, partnerstatus, reasonforfailure, reject_reason, terminate_reason, audit_time, created_at, liaison + `SELECT userId, phoneNumber, province, city, district, detailedaddress, company, collaborationid, cooperation, businesslicenseurl, proofurl, brandurl, partnerstatus, reasonforfailure, reject_reason, terminate_reason, audit_time, created_at, liaison, seller_followup FROM users${whereClause} ORDER BY created_at DESC LIMIT ? OFFSET ?`, params @@ -1832,6 +1832,35 @@ app.get('/api/suppliers', async (req, res) => { } }); +// 供应商跟进信息API - /api/suppliers/:id/followup +console.log('正在注册供应商跟进信息API路由: /api/suppliers/:id/followup'); +app.post('/api/suppliers/:id/followup', async (req, res) => { + console.log('收到供应商跟进信息更新请求:', req.params.id); + try { + const connection = await pool.getConnection(); + const supplierId = req.params.id; + const { content } = req.body; + + if (!content) { + connection.release(); + return sendResponse(res, false, null, '跟进信息不能为空'); + } + + // 更新供应商跟进信息 + await connection.query( + 'UPDATE users SET seller_followup = ? WHERE userId = ?', + [content, supplierId] + ); + + connection.release(); + sendResponse(res, true, null, '跟进信息保存成功'); + } catch (error) { + console.error('更新供应商跟进信息失败:', error.message); + console.error('错误详情:', error); + sendResponse(res, false, null, '更新供应商跟进信息失败'); + } +}); + // 管理员统计 - 获取货源创建统计数据 app.get('/api/admin/stats/supplies', async (req, res) => { try { diff --git a/SupplierReview.html b/SupplierReview.html index 57d4d95..78e76fb 100644 --- a/SupplierReview.html +++ b/SupplierReview.html @@ -1038,6 +1038,23 @@ + + +