From 3fe3e7de2d9cdf5dfa1b2a756809d0dd689a661f Mon Sep 17 00:00:00 2001 From: "97694732@qq.com" Date: Wed, 17 Jun 2026 17:09:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E6=B3=A2=E6=AC=A1=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E5=90=8E=E8=B0=83=E7=94=A8=E7=BB=91=E5=AE=9A=E6=B3=A2=E6=AC=A1?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3bind-wave?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/upload/upload.vue | 50 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/pages/upload/upload.vue b/pages/upload/upload.vue index c3fbc0d..b0b0e35 100644 --- a/pages/upload/upload.vue +++ b/pages/upload/upload.vue @@ -2372,11 +2372,61 @@ export default { }) }) console.log('【波次】返回值:', waveRes.statusCode, waveRes.data) + + // 波次创建成功后调用绑定波次接口 + if (waveRes.statusCode === 200 && waveRes.data) { + var waveResp = waveRes.data + if (typeof waveResp === 'string') { + try { waveResp = JSON.parse(waveResp) } catch (e) { waveResp = {} } + } + var waveId = waveResp.data && waveResp.data.wave_id + if (waveId) { + await this.callBindWaveApi(timestamp, waveId) + } + } } catch (e) { console.warn('【波次】请求失败:', e) } }, + // 绑定波次(波次创建成功后调用) + async callBindWaveApi(timestamp, waveId) { + 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), + operator: operatorName, + operator_id: String(operatorId), + remark: 'app', + timestamp: timestamp, + sign_method: 'md5' + } + var sign = calculateSign(params) + params.sign = sign + + try { + const res = await new Promise(function (resolve, reject) { + uni.request({ + url: 'https://psi.api.buzhiyushu.cn/api/receiving/bind-wave', + method: 'POST', + header: { + 'Content-Type': 'application/x-www-form-urlencoded', + 'Authorization': 'Bearer ' + token + }, + data: params, + success: function (r) { resolve(r) }, + fail: function (e) { reject(e) } + }) + }) + console.log('【绑定波次】返回值:', res.statusCode, res.data) + } catch (e) { + console.warn('【绑定波次】请求失败:', e) + } + }, + // 查看小车列表,返回第一个小车的 {car_id, car_code},无小车时弹窗提示返回 null async callCarListApi(timestamp) { const token = uni.getStorageSync('token') || ''