From 45f473a924fb903f668774e460756df2981d21b4 Mon Sep 17 00:00:00 2001 From: "97694732@qq.com" Date: Wed, 17 Jun 2026 17:26:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:bind-wave=E4=BD=BF=E7=94=A8release=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E7=9A=84wave=5Fno?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/upload/upload.vue | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/pages/upload/upload.vue b/pages/upload/upload.vue index 28dbce2..191b164 100644 --- a/pages/upload/upload.vue +++ b/pages/upload/upload.vue @@ -2382,10 +2382,12 @@ export default { var waveId = waveResp.data && waveResp.data.wave_id var orderId = waveResp.data && waveResp.data.order_id if (waveId && orderId) { - // 1. 提交波次 - await this.callWaveReleaseApi(timestamp, waveId, orderId, carInfo, productId, stock, price) - // 2. 绑定波次 - await this.callBindWaveApi(timestamp, waveId) + // 1. 提交波次,获取 wave_no + var releaseWaveNo = await this.callWaveReleaseApi(timestamp, waveId, orderId, carInfo, productId, stock, price) + // 2. 绑定波次(使用 release 返回的 wave_no) + if (releaseWaveNo) { + await this.callBindWaveApi(timestamp, releaseWaveNo) + } } } } catch (e) { @@ -2393,7 +2395,7 @@ export default { } }, - // 提交波次(波次创建成功后调用) + // 提交波次(波次创建成功后调用),返回 wave_no async callWaveReleaseApi(timestamp, waveId, orderId, carInfo, productId, stock, price) { const token = uni.getStorageSync('token') || '' const params = { @@ -2427,20 +2429,32 @@ export default { }) }) console.log('【提交波次】返回值:', res.statusCode, res.data) + + if (res.statusCode === 200 && res.data) { + var releaseResp = res.data + if (typeof releaseResp === 'string') { + try { releaseResp = JSON.parse(releaseResp) } catch (e) { releaseResp = {} } + } + if (releaseResp.data && releaseResp.data.wave_no) { + return releaseResp.data.wave_no + } + } + return '' } catch (e) { console.warn('【提交波次】请求失败:', e) + return '' } }, - // 绑定波次(波次创建成功后调用) - async callBindWaveApi(timestamp, waveId) { + // 绑定波次(提交波次成功后调用) + async callBindWaveApi(timestamp, waveNo) { const token = uni.getStorageSync('token') || '' var operatorName = uni.getStorageSync('nickName') || '' var operatorId = uni.getStorageSync('aboutId') || '' const params = { app_key: 'psi', client_id: 'psi', - wave_no: String(waveId), + wave_no: String(waveNo), operator: operatorName, operator_id: String(operatorId), remark: 'app',