@@ -346,7 +346,7 @@ function transCmd(cmdArr, type, func, callBack = null) { | |||
*/ | |||
function alertF(msg) { | |||
// 隐藏加载框 | |||
tools.hideLoadingAlert(); | |||
// tools.hideLoadingAlert(); | |||
// 提示对话框 | |||
tools.showModalAlert(msg); | |||
} |
@@ -246,9 +246,9 @@ function showLoadingAlert(title = '加载中...', mask = true, successFunc = nul | |||
completeFun(res); | |||
} | |||
//添加安全锁,防止Loading不会关闭 | |||
setTimeout(() => { | |||
hideLoadingAlert() | |||
}, 5000) | |||
// setTimeout(() => { | |||
// hideLoadingAlert() | |||
// }, 5000) | |||
} | |||
}); | |||
} |
@@ -28,8 +28,7 @@ | |||
</view> | |||
</view> | |||
<view class="up_btn" v-if="state.showBtn"> | |||
<button aria-disabled="true" @click="btn" v-if="!state.isSuccess" | |||
:class="state.disabled?'button':'hui'"> | |||
<button aria-disabled="true" @click="btn" v-if="!state.isSuccess" :class="state.disabled?'button':'hui'"> | |||
点击开始激活 | |||
</button> | |||
<button aria-disabled="true" @click="back" v-else> | |||
@@ -177,105 +176,91 @@ | |||
customerTel: "", | |||
customerId: "", | |||
orderId: "", | |||
vehicleClassStr:"" | |||
vehicleClassStr: "" | |||
}); | |||
function cmdResult() { | |||
uni.showToast({ | |||
title: '正在激活,请等待', | |||
mask: true, | |||
duration:10000, | |||
icon:"loading" | |||
}); | |||
const options = { | |||
type: 2, //type: 2,JSON格式提交数据(默认表单形式提交) | |||
data: { | |||
orderId: orderInfo.orderId, | |||
issueType: state.transfer?2:1 //1正常激活 2 过户激活 | |||
}, //请求参数 | |||
method: "POST", //提交方式(默认POST) | |||
}; | |||
console.log("options==",options) | |||
//BDS-二发指令申请 | |||
request('4b001421f5354c248a7759971881b52f', options) | |||
.then((res) => { | |||
console.log("在线激活 请求"); | |||
console.log(stringToJson(res.bizContent)); | |||
const datas = stringToJson(res.bizContent).data; | |||
console.log("datas===",datas) | |||
bluetoothUtil.transCmd(datas.cmd.split(','), datas.cmdType=='CARD'?'10':'20', function(res) { | |||
console.log("res申请",res) | |||
implementCmd(datas.transOrderId,datas.cmd,res.toString(),datas.stepNo) | |||
const options = { | |||
type: 2, //type: 2,JSON格式提交数据(默认表单形式提交) | |||
showLoading: false, | |||
data: { | |||
orderId: orderInfo.orderId, | |||
issueType: state.transfer ? 2 : 1 //1正常激活 2 过户激活 | |||
}, //请求参数 | |||
method: "POST", //提交方式(默认POST) | |||
}; | |||
console.log("options==", options) | |||
tools.showLoadingAlert('正在激活,请等待') | |||
//BDS-二发指令申请 | |||
request('4b001421f5354c248a7759971881b52f', options) | |||
.then((res) => { | |||
console.log("在线激活 请求"); | |||
console.log(stringToJson(res.bizContent)); | |||
const datas = stringToJson(res.bizContent).data; | |||
bluetoothUtil.transCmd(datas.cmd.split(','), datas.cmdType == 'CARD' ? '10' : '20', function(res) { | |||
implementCmd(datas.transOrderId, datas.cmd, res.toString(), datas.stepNo) | |||
}, () => { | |||
showModals('在线激活异常') | |||
tools.hideLoadingAlert(); | |||
}); | |||
}) | |||
.catch((err) => { | |||
console.log(err); | |||
tools.hideLoadingAlert(); | |||
}); | |||
} | |||
function implementCmd(transOrderId, cmd, cmdResult, stepNo) { | |||
const options = { | |||
type: 2, //type: 2,JSON格式提交数据(默认表单形式提交) | |||
showLoading: false, | |||
data: { | |||
transOrderId, //步骤号 | |||
cmd, | |||
cmdResult, | |||
stepNo | |||
}, //请求参数 | |||
method: "POST", //提交方式(默认POST) | |||
}; | |||
console.log("options2222", options) | |||
//BDS-二发指令回传 | |||
request('88d98f2db7df4f06b22d58b507db7854', options) | |||
.then((res) => { | |||
console.log(stringToJson(res.bizContent)); | |||
const datas = stringToJson(res.bizContent).data; | |||
console.log("在线激活 请求", datas); | |||
if (datas.stepNo == 100) { | |||
state.disabled = true | |||
tools.hideLoadingAlert(); | |||
msg("激活成功", { | |||
'icon': 'success', | |||
'duration': 3000 | |||
}) | |||
setTimeout(() => { | |||
uni.navigateTo({ | |||
url: "/subpackage/after-sale/deviceInfo/deviceInfo", | |||
}); | |||
}, 3000) | |||
} else { | |||
console.log("datas.stepNo", datas.stepNo) | |||
bluetoothUtil.transCmd(datas.cmd.split(','), datas.cmdType == 'CARD' ? '10' : '20', function(res) { | |||
implementCmd(transOrderId, datas.cmd, res.toString(), datas.stepNo) | |||
}, () => { | |||
showModals('在线激活异常') | |||
// tools.hideLoadingAlert(); | |||
uni.hideToast() | |||
}); | |||
}) | |||
.catch((err) => { | |||
console.log(err); | |||
// tools.hideLoadingAlert(); | |||
uni.hideToast() | |||
console.log("Yin") | |||
}); | |||
} | |||
function implementCmd(transOrderId, cmd, cmdResult, stepNo) { | |||
uni.showToast({ | |||
title: '正在激活,请等待', | |||
mask: true, | |||
duration:5000, | |||
icon:"loading" | |||
} | |||
}) | |||
.catch((err) => { | |||
console.log(err); | |||
tools.hideLoadingAlert(); | |||
}); | |||
const options = { | |||
type: 2, //type: 2,JSON格式提交数据(默认表单形式提交) | |||
data: { | |||
transOrderId, //步骤号 | |||
cmd, | |||
cmdResult, | |||
stepNo | |||
}, //请求参数 | |||
method: "POST", //提交方式(默认POST) | |||
}; | |||
console.log("options2222",options) | |||
//BDS-二发指令回传 | |||
request('88d98f2db7df4f06b22d58b507db7854', options) | |||
.then((res) => { | |||
console.log(stringToJson(res.bizContent)); | |||
const datas = stringToJson(res.bizContent).data; | |||
console.log("在线激活 请求",datas); | |||
if (datas.stepNo == 100) { | |||
state.disabled = true | |||
// tools.hideLoadingAlert(); | |||
uni.hideToast() | |||
msg("激活成功",{'icon':'success','duration':3000}) | |||
setTimeout(() => { | |||
uni.navigateTo({ | |||
url: "/subpackage/after-sale/deviceInfo/deviceInfo", | |||
}); | |||
}, 3000) | |||
} else { | |||
console.log("datas.stepNo",datas.stepNo) | |||
bluetoothUtil.transCmd(datas.cmd.split(','), datas.cmdType=='CARD'?'10':'20', function(res) { | |||
implementCmd(transOrderId,datas.cmd,res.toString(),datas.stepNo) | |||
}, () => { | |||
showModals('在线激活异常') | |||
// tools.hideLoadingAlert(); | |||
uni.hideToast() | |||
}); | |||
} | |||
}) | |||
.catch((err) => { | |||
console.log(err); | |||
// tools.hideLoadingAlert(); | |||
uni.hideToast() | |||
}); | |||
} | |||
} | |||
//开始激活 按钮事件 | |||
const btn = () => { | |||
state.disabled = false | |||
console.log('orderInfo参数', orderInfo, state.disabled) | |||
cmdResult() | |||
}; | |||
@@ -289,7 +274,7 @@ | |||
id: id, | |||
}, | |||
method: "POST", | |||
showLoading: true, | |||
showLoading: false, | |||
}; | |||
state.disabled = false | |||
request(IFCODE.orderDetail, options).then((res) => { | |||
@@ -324,7 +309,8 @@ | |||
orderId: orderId, | |||
}, | |||
method: "POST", | |||
showLoading: true, | |||
showLoading: false | |||
// showLoading: true, | |||
}; | |||
request(IFCODE.cancelOrderApi, options).then((res) => { | |||
@@ -337,9 +323,9 @@ | |||
const getObuId = () => { | |||
console.log('======获取OBU号======') | |||
let cmdArray = [cmd.HOME_DIRECTORY, cmd.OBU_SYSTEM_FILE, cmd.RANDOM_NUMBER]; | |||
tools.showLoadingAlert("正在执行指令"); | |||
// tools.showLoadingAlert("正在执行指令"); | |||
bluetoothUtil.transCmd(cmdArray, "20", function(res) { | |||
tools.hideLoadingAlert(); | |||
// tools.hideLoadingAlert(); | |||
var status = res[1].substring(res[1].length - 4, res[1].length); | |||
console.log('获取OBU号执行结果' + status, res) | |||
@@ -973,7 +959,10 @@ | |||
// #ifdef MP-WEIXIN | |||
msg("激活成功",{'icon':'success','duration':2000}) | |||
msg("激活成功", { | |||
'icon': 'success', | |||
'duration': 2000 | |||
}) | |||
setTimeout(() => { | |||
uni.navigateTo({ | |||
url: "/subpackage/after-sale/deviceInfo/deviceInfo", |
@@ -31,12 +31,9 @@ | |||
</view> | |||
</view> | |||
<view class="btns"> | |||
<view class="btn btn-primary as-gravity-center" @click="gotoConfirmReceipt(item)" | |||
v-if="item.orderStep==9 && item.orderStatus=='0'">确认收货</view> | |||
<view class="btn btn-primary as-gravity-center" @click="gotoActiveOrder(item)" | |||
v-if="item.orderStep==10 && item.orderStatus=='0'">去激活</view> | |||
<view class="btn btn-primary as-gravity-center" @click="gotoOnceActivate(item)" | |||
v-if="item.orderStep==11 && item.orderStatus=='1'">OBU重新激活</view> | |||
<view class="btn btn-primary as-gravity-center" @click="gotoConfirmReceipt(item)" v-if="item.orderStep==9 && item.orderStatus=='0'">确认收货</view> | |||
<view class="btn btn-primary as-gravity-center" @click="gotoActiveOrder(item)" v-if="item.orderStep==10 && item.orderStatus=='0'">去激活</view> | |||
<view class="btn btn-primary as-gravity-center" @click="gotoOnceActivate(item)" v-if="item.orderStep==11 && item.orderStatus=='1'">OBU重新激活</view> | |||
</view> | |||
</view> | |||
@@ -50,26 +47,26 @@ | |||
import { request } from "@/utils/network/request.js"; | |||
import { stringToJson } from "@/utils/network/encryption"; | |||
import { onLoad, onUnload, onReachBottom, onPullDownRefresh } from "@dcloudio/uni-app"; | |||
import { getItem, StorageKeys,setItem } from "@/utils/storage"; | |||
import { hasLogin, msg, getOrderStatusName, getOrderTypeName, navTo } from "@/utils/utils"; | |||
import { noActivationOrder,ndActivateVerification,silentLoginApi} from "@/utils/network/api"; | |||
import { getItem, StorageKeys } from "@/utils/storage"; | |||
import { hasLogin, msg, getOrderStatusName, getOrderTypeName,navTo} from "@/utils/utils"; | |||
import { noActivationOrder } from "@/utils/network/api"; | |||
import { PageData } from "@/datas/enum"; | |||
import useOrderSkip from "@/composables/order/useOrderSkip"; | |||
//跳转 | |||
const { gotoActiveOrder, gotoConfirmReceipt } = useOrderSkip(); | |||
const gotoOnceActivate = (item) => { | |||
// #ifdef MP-WEIXIN | |||
navTo( | |||
`/subpackage/after-sale/activation-once-again/activation-once-again?id=${item.id}` | |||
); | |||
// #endif | |||
// #ifdef MP-ALIPAY | |||
navTo( | |||
`/subpackage/after-sale/activation-once-again/activation-once-again-ali?id=${item.id}` | |||
); | |||
// #endif | |||
} | |||
const { gotoActiveOrder,gotoConfirmReceipt } = useOrderSkip(); | |||
const gotoOnceActivate=(item)=>{ | |||
// #ifdef MP-WEIXIN | |||
navTo( | |||
`/subpackage/after-sale/activation-once-again/activation-once-again?id=${item.id}` | |||
); | |||
// #endif | |||
// #ifdef MP-ALIPAY | |||
navTo( | |||
`/subpackage/after-sale/activation-once-again/activation-once-again-ali?id=${item.id}` | |||
); | |||
// #endif | |||
} | |||
const config = { | |||
emptyHint: { | |||
hint: '~ 暂无待激活订单 ~', | |||
@@ -91,9 +88,6 @@ | |||
status: 'more', | |||
reload: false, | |||
ordersList: [], | |||
vehicleId:"", | |||
tel:"", | |||
qdOrderNo:"" | |||
}) | |||
/* 刷新列表 */ | |||
@@ -166,85 +160,27 @@ | |||
} | |||
} | |||
onLoad((option) => { | |||
// 诺德数据过来 验证+无感登录 | |||
if(option.qdOrderNo){ | |||
params.qdOrderNo=option.qdOrderNo | |||
params.tel=option.tel | |||
params.vehicleId=option.vehicleId | |||
ndActivateVerificationQuery().then((data) => { | |||
console.log("验证") | |||
silentLogin(data).then(() => { | |||
//监听订单刷新信息 | |||
uni.$on('refreshOrder', (data) => { | |||
refreshList(); | |||
}); | |||
console.log("guoliale") | |||
refreshList(); | |||
}) | |||
}) | |||
}else{ | |||
//监听订单刷新信息 | |||
uni.$on('refreshOrder', (data) => { | |||
refreshList(); | |||
onLoad(() => { | |||
if (!hasLogin()) { | |||
uni.showModal({ | |||
title: '提示', | |||
content: '您还未登录小程序,请先登录小程序', | |||
showCancel: false, | |||
success: function (res) { | |||
if (res.confirm) { | |||
navTo(`/login/login?back=1`) | |||
} | |||
} | |||
}); | |||
console.log("guoliale") | |||
refreshList(); | |||
} | |||
}); | |||
// 诺德激活验证接口 | |||
const ndActivateVerificationQuery = () => { | |||
const options = { | |||
type: 2, | |||
data: { | |||
"code": "1", //诺德 | |||
"qdOrderNo": params.qdOrderNo, //渠道订单号 | |||
"tel": params.tel, | |||
"vehicleId": params.vehicleId, | |||
}, | |||
method: "POST", | |||
showLoading: true, | |||
}; | |||
return new Promise(async (resolve, reject) => { | |||
const res = await request(ndActivateVerification, options); | |||
const data = stringToJson(res.bizContent); | |||
console.log("data==", data) | |||
resolve(data); | |||
}).catch((error) => { | |||
reject(error); | |||
//监听订单刷新信息 | |||
uni.$on('refreshOrder', (data) => { | |||
refreshList(); | |||
}); | |||
console.log("guoliale") | |||
refreshList(); | |||
}); | |||
} | |||
const silentLogin = (data) => { | |||
if (data.userType == "1") { | |||
var datas = { | |||
userType: data.userType, | |||
account: data.mobile, | |||
loginSource: getItem("loginSource"), | |||
}; | |||
} else { | |||
var datas = { | |||
userType: data.userType, | |||
account: data.userIdNum, | |||
loginSource: getItem("loginSource"), | |||
}; | |||
} | |||
const options = { | |||
type: 2, | |||
data: datas, | |||
method: "POST", | |||
showLoading: true, | |||
}; | |||
return new Promise(async (resolve, reject) => { | |||
const res = await request(silentLoginApi, options); | |||
const data = stringToJson(res.bizContent); | |||
setItem("openId", data.openId); | |||
setItem("token", data.accessToken); | |||
resolve(data); | |||
}).catch((error) => { | |||
reject(error); | |||
}); | |||
} | |||
onUnload(() => { | |||
uni.$off('refreshOrder'); | |||
}); | |||
@@ -388,4 +324,4 @@ const ndActivateVerificationQuery = () => { | |||
border: 1px solid #dcdcdc; | |||
color: #333; | |||
} | |||
</style> | |||
</style> |
@@ -54,6 +54,8 @@ function updateGetToken() { | |||
}); | |||
} | |||
//请求 | |||
export function request(code, options = {}, start = false) { | |||
//公参 | |||
@@ -68,7 +70,6 @@ export function request(code, options = {}, start = false) { | |||
accessToken: getItem(StorageKeys.Token), | |||
openId: getItem(StorageKeys.OpenId), | |||
opId: getItem(StorageKeys.OpenId), | |||
} | |||
// options.url = envs[process.env.NODE_ENV].baseUrl + '/api/interfaceMidGroundIn' | |||
@@ -239,8 +240,10 @@ export function request(code, options = {}, start = false) { | |||
} | |||
}); | |||
} else { | |||
tools.hideLoadingAlert(); | |||
uni.hideToast() | |||
if (options.showLoading) { | |||
tools.hideLoadingAlert(); | |||
uni.hideToast() | |||
} | |||
console.log("请求失败返回参数", code, res) | |||
uni.showModal({ | |||
title: '提示', |