fix:bind-wave使用release返回的wave_no
This commit is contained in:
parent
bdb2b52798
commit
45f473a924
@ -2382,10 +2382,12 @@ export default {
|
|||||||
var waveId = waveResp.data && waveResp.data.wave_id
|
var waveId = waveResp.data && waveResp.data.wave_id
|
||||||
var orderId = waveResp.data && waveResp.data.order_id
|
var orderId = waveResp.data && waveResp.data.order_id
|
||||||
if (waveId && orderId) {
|
if (waveId && orderId) {
|
||||||
// 1. 提交波次
|
// 1. 提交波次,获取 wave_no
|
||||||
await this.callWaveReleaseApi(timestamp, waveId, orderId, carInfo, productId, stock, price)
|
var releaseWaveNo = await this.callWaveReleaseApi(timestamp, waveId, orderId, carInfo, productId, stock, price)
|
||||||
// 2. 绑定波次
|
// 2. 绑定波次(使用 release 返回的 wave_no)
|
||||||
await this.callBindWaveApi(timestamp, waveId)
|
if (releaseWaveNo) {
|
||||||
|
await this.callBindWaveApi(timestamp, releaseWaveNo)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -2393,7 +2395,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 提交波次(波次创建成功后调用)
|
// 提交波次(波次创建成功后调用),返回 wave_no
|
||||||
async callWaveReleaseApi(timestamp, waveId, orderId, carInfo, productId, stock, price) {
|
async callWaveReleaseApi(timestamp, waveId, orderId, carInfo, productId, stock, price) {
|
||||||
const token = uni.getStorageSync('token') || ''
|
const token = uni.getStorageSync('token') || ''
|
||||||
const params = {
|
const params = {
|
||||||
@ -2427,20 +2429,32 @@ export default {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
console.log('【提交波次】返回值:', res.statusCode, res.data)
|
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) {
|
} catch (e) {
|
||||||
console.warn('【提交波次】请求失败:', e)
|
console.warn('【提交波次】请求失败:', e)
|
||||||
|
return ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 绑定波次(波次创建成功后调用)
|
// 绑定波次(提交波次成功后调用)
|
||||||
async callBindWaveApi(timestamp, waveId) {
|
async callBindWaveApi(timestamp, waveNo) {
|
||||||
const token = uni.getStorageSync('token') || ''
|
const token = uni.getStorageSync('token') || ''
|
||||||
var operatorName = uni.getStorageSync('nickName') || ''
|
var operatorName = uni.getStorageSync('nickName') || ''
|
||||||
var operatorId = uni.getStorageSync('aboutId') || ''
|
var operatorId = uni.getStorageSync('aboutId') || ''
|
||||||
const params = {
|
const params = {
|
||||||
app_key: 'psi',
|
app_key: 'psi',
|
||||||
client_id: 'psi',
|
client_id: 'psi',
|
||||||
wave_no: String(waveId),
|
wave_no: String(waveNo),
|
||||||
operator: operatorName,
|
operator: operatorName,
|
||||||
operator_id: String(operatorId),
|
operator_id: String(operatorId),
|
||||||
remark: 'app',
|
remark: 'app',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user