获取快递公司信息
const mailDiscern = (mailNo) => {
return new Promise((resolve, reject) => {
uni.request({
url: 'https://eolink.o.apispace.com/wlgj1/paidtobuy_api/mail_discern',
method: 'POST',
header: {"X-APISpace-Token": '你的token', "Content-Type": 'application/json'},
dataType: 'json',
data: {mailNo: mailNo}
}).then(response => {
let [error, res] = response
if (error) {
toast('后端接口连接异常')
reject('后端接口连接异常')
return
}
const code = res.statusCode
if (code !== 200) {
uni.hideLoading()
toast('获取快递公司失败, 请手动输入!')
reject('获取快递公司失败, 请手动输入!')
return
}
resolve(res.data)
}).catch(error => {
let {
message
} = error
if (message === 'Network Error') {
message = '后端接口连接异常'
} else if (message.includes('timeout')) {
message = '系统接口请求超时'
} else if (message.includes('Request failed with status code')) {
message = '系统接口' + message.substr(message.length - 3) + '异常'
}
toast(message)
reject(error)
})
})
}
获取物流信息
const traceSearch = (logistics) => {
return new Promise((resolve, reject) => {
uni.request({
url: 'https://eolink.o.apispace.com/wlgj1/paidtobuy_api/trace_search',
method: 'POST',
header: {"X-APISpace-Token": '你的token', "Content-Type": 'application/json'},
dataType: 'json',
data: {...logistics, orderType: 'desc'}
}).then(response => {
let [error, res] = response
if (error) {
toast('后端接口连接异常')
reject('后端接口连接异常')
return
}
const code = res.statusCode
if (code !== 200) {
uni.hideLoading()
toast('获取快递公司失败, 请手动输入!')
reject('获取快递公司失败, 请手动输入!')
return
}
resolve(res.data)
}).catch(error => {
let {
message
} = error
if (message === 'Network Error') {
message = '后端接口连接异常'
} else if (message.includes('timeout')) {
message = '系统接口请求超时'
} else if (message.includes('Request failed with status code')) {
message = '系统接口' + message.substr(message.length - 3) + '异常'
}
toast(message)
reject(error)
})
})
}
物流状态字典
logisticsStatus: {
WAIT_ACCEPT: {
text: '待揽收',
subStatus: {
RECEIVE: '接单中',
WAIT_ACCEPT: '待揽收'
}
},
ACCEPT: {
text: '已揽收',
subStatus: {
ACCEPT: '已揽收'
}
},
TRANSPORT: {
text: '运输中',
subStatus: {
TRANSPORT: '运输中',
SEND_ON: '转单或修改地址转寄',
ARRIVE_CITY: '到达目的城市'
}
},
DELIVERING: {
text: '派件中',
subStatus: {
DELIVERING: '派件中',
STA_INBOUND: '已放入快递柜或驿站'
}
},
AGENT_SIGN: {
text: '已代签收',
subStatus: {
AGENT_SIGN: '已代签收'
}
},
SIGN: {
text: '已签收',
subStatus: {
SIGN: '已签收',
STA_SIGN: '从快递柜或者驿站取出',
RETURN_SIGN: '退回签收'
}
},
FAILED: {
text: '包裹异常',
subStatus: {
FAILED: '包裹异常',
REFUSE_SIGN: '拒收',
DELIVER_ABNORMAL: '派件异常',
RETENTION: '滞留件',
ISSUE: '问题件',
RETURN: '退回件',
DAMAGE: '破损',
CANCEL_ORDER: '揽件取消'
}
}
}