feat:波次成功后调用绑定波次接口bind-wave

This commit is contained in:
97694732@qq.com 2026-06-17 17:09:38 +08:00
parent f7d8a7d805
commit 3fe3e7de2d

View File

@ -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') || ''