|
|
|
|
|
|
|
|
<view> 3.xxxxxxxx </view> |
|
|
<view> 3.xxxxxxxx </view> |
|
|
<view> 4.xxxxxxxx </view> |
|
|
<view> 4.xxxxxxxx </view> |
|
|
</view> --> |
|
|
</view> --> |
|
|
<button class="submit" @click="toPage" v-if="!state.flag" >卡签续期</button> |
|
|
|
|
|
|
|
|
<button class="submit" @click="toPage" v-if="!state.flag">卡签续期</button> |
|
|
<button class="submit" @click="toBack" v-else="state.flag">返回服务中心</button> |
|
|
<button class="submit" @click="toBack" v-else="state.flag">返回服务中心</button> |
|
|
<view class="mask" v-show="state.showPopup"> |
|
|
<view class="mask" v-show="state.showPopup"> |
|
|
<view class="main"> |
|
|
<view class="main"> |
|
|
|
|
|
|
|
|
modifyObuVehicleInfo, |
|
|
modifyObuVehicleInfo, |
|
|
obuActivation |
|
|
obuActivation |
|
|
} from "@/utils/network/api.js"; |
|
|
} from "@/utils/network/api.js"; |
|
|
const cmd = require("../../../static/etcUtil/cmdConfig.js"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const cmd = require("../../../static/etcUtil/cmdConfig.js"); |
|
|
|
|
|
import { |
|
|
|
|
|
IntegerToHexString, |
|
|
|
|
|
AsciToHexString, |
|
|
|
|
|
} from "@/utils/util/fileData.js"; |
|
|
|
|
|
|
|
|
import { |
|
|
import { |
|
|
stringToJson |
|
|
stringToJson |
|
|
|
|
|
|
|
|
const bluetoothUtil = require("../../../static/etcUtil/index.js"); |
|
|
const bluetoothUtil = require("../../../static/etcUtil/index.js"); |
|
|
const state = reactive({ |
|
|
const state = reactive({ |
|
|
showPopup: false, |
|
|
showPopup: false, |
|
|
flag: false |
|
|
|
|
|
|
|
|
flag: false, |
|
|
|
|
|
|
|
|
}) |
|
|
}) |
|
|
|
|
|
const fileDataStrings = reactive({ |
|
|
|
|
|
approvedCount: 0, //核载人数 |
|
|
|
|
|
cardId: "", //卡号 |
|
|
|
|
|
obuId: "", //obu号 |
|
|
|
|
|
obuId: "", //obu号 |
|
|
|
|
|
packageNum: "", //套餐编号 |
|
|
|
|
|
axleCount: 0, //轴数 |
|
|
|
|
|
axleDistance: "", //轴距 |
|
|
|
|
|
engineNum: "", //发动机 |
|
|
|
|
|
vehicleVin: "", |
|
|
|
|
|
vehicleEngineNum: "", |
|
|
|
|
|
cardStatus: "", |
|
|
|
|
|
obuStatus: "", |
|
|
|
|
|
type: 0, //类型 |
|
|
|
|
|
userType: 0, //用户类型 |
|
|
|
|
|
vehiclePlate: "", //车牌 |
|
|
|
|
|
vehiclePlateColor: 0, //车牌颜色 |
|
|
|
|
|
vehicleDimensions: "", |
|
|
|
|
|
outlineL: 0, //外廓 长 |
|
|
|
|
|
outlineW: 0, //外廓 宽 |
|
|
|
|
|
outlineH: 0, //外廓 高 |
|
|
|
|
|
wheelCount: "", //车轮数 |
|
|
|
|
|
vehicleIdNo: "", //车牌号 |
|
|
|
|
|
vehiclePlateColorStr: "", |
|
|
|
|
|
customerTel: "", |
|
|
|
|
|
customerId: "", |
|
|
|
|
|
orderId: "" |
|
|
|
|
|
}); |
|
|
let cmdRandNum = ''; |
|
|
let cmdRandNum = ''; |
|
|
const orderInfos = reactive({ |
|
|
const orderInfos = reactive({ |
|
|
orderId: "", |
|
|
orderId: "", |
|
|
|
|
|
|
|
|
obuStatus: "", |
|
|
obuStatus: "", |
|
|
cardEnableTime: "", |
|
|
cardEnableTime: "", |
|
|
obuEnableTime: "", |
|
|
obuEnableTime: "", |
|
|
cardExpireTime:"", |
|
|
|
|
|
obuExpireTime:"" |
|
|
|
|
|
|
|
|
cardExpireTime: "", |
|
|
|
|
|
obuExpireTime: "" |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
onLoad((option) => { |
|
|
onLoad((option) => { |
|
|
//请求订单详情 |
|
|
//请求订单详情 |
|
|
queryOrderDetail(option.id); |
|
|
queryOrderDetail(option.id); |
|
|
|
|
|
getOrderDetails(option.orderId) |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
onShow((option) => { |
|
|
onShow((option) => { |
|
|
|
|
|
|
|
|
}; |
|
|
}; |
|
|
request(orderDetail, options).then((res) => { |
|
|
request(orderDetail, options).then((res) => { |
|
|
let orderInfo = JSON.parse(res.bizContent); |
|
|
let orderInfo = JSON.parse(res.bizContent); |
|
|
console.log("orderInfo",orderInfo); |
|
|
|
|
|
|
|
|
console.log("orderInfo", orderInfo); |
|
|
orderInfos.orderId = orderInfo.orderId; |
|
|
orderInfos.orderId = orderInfo.orderId; |
|
|
orderInfos.ownerName = orderInfo.ownerName; |
|
|
orderInfos.ownerName = orderInfo.ownerName; |
|
|
orderInfos.ownerIdtype = orderInfo.ownerIdtype; |
|
|
orderInfos.ownerIdtype = orderInfo.ownerIdtype; |
|
|
|
|
|
|
|
|
orderInfos.obuEnableTime = orderInfo.obuEnableTime.substring(0, 10); |
|
|
orderInfos.obuEnableTime = orderInfo.obuEnableTime.substring(0, 10); |
|
|
orderInfos.cardExpireTime = orderInfo.cardExpireTime; |
|
|
orderInfos.cardExpireTime = orderInfo.cardExpireTime; |
|
|
orderInfos.obuExpireTime = orderInfo.obuExpireTime; |
|
|
orderInfos.obuExpireTime = orderInfo.obuExpireTime; |
|
|
console.log("orderInfos.cardExpiretime",orderInfos.cardExpiretime,orderInfo.cardExpiretime) |
|
|
|
|
|
|
|
|
console.log("orderInfos.cardExpiretime", orderInfos.cardExpiretime, orderInfo.cardExpiretime) |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//签续期 请求 |
|
|
//签续期 请求 |
|
|
const getObuRenewal = () => { |
|
|
const getObuRenewal = () => { |
|
|
console.log("899执行之前",); |
|
|
|
|
|
let cmdArray1 = [cmd.HOME_DIRECTORY, cmd.OBU_DF01, cmd.OBU_EF01, cmd.RANDOM_NUMBER]; |
|
|
|
|
|
tools.showLoadingAlert("正在执行指令"); |
|
|
|
|
|
bluetoothUtil.transCmd(cmdArray1, "20", function(res) { |
|
|
|
|
|
tools.hideLoadingAlert(); |
|
|
|
|
|
var str = res[3].substring(res[3].length - 4, res[3].length); |
|
|
|
|
|
if (str == "9000") { |
|
|
|
|
|
cmdRandNum = res[3].substring(0, res[3].length - 4); |
|
|
|
|
|
const options = { |
|
|
|
|
|
type: 2, |
|
|
|
|
|
data: { |
|
|
|
|
|
obuId: orderInfos.obuId, |
|
|
|
|
|
random:cmdRandNum |
|
|
|
|
|
}, |
|
|
|
|
|
method: "POST", |
|
|
|
|
|
showLoading: true, |
|
|
|
|
|
}; |
|
|
|
|
|
request(obuRenewal, options).then((res) => { |
|
|
|
|
|
let datas = stringToJson(res.bizContent); |
|
|
|
|
|
// let cmdArray = result.command.split(","); |
|
|
|
|
|
console.log("899",datas,datas.data.APDU); |
|
|
|
|
|
if (datas.data.APDU) { |
|
|
|
|
|
tools.showLoadingAlert("正在执行指令"); |
|
|
|
|
|
bluetoothUtil.transCmd([datas.data.APDU], "20", function(res) { |
|
|
|
|
|
tools.hideLoadingAlert(); |
|
|
|
|
|
console.log("res=====",res,res[0]) |
|
|
|
|
|
// var str = res[3].substring(res[3].length - 4, res[3].length); |
|
|
|
|
|
// if (res[0] == "9000") { |
|
|
|
|
|
// cmdRandNum = res[3].substring(0, res[3].length - 4); |
|
|
|
|
|
// getFileData((demos) => { |
|
|
|
|
|
// modifyVehicle(demos); |
|
|
|
|
|
// }) |
|
|
|
|
|
// } else { |
|
|
|
|
|
// tools.alertF("RANDOM_NUMBER指令长度不符" + res[1]); |
|
|
|
|
|
// } |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
console.log("899执行之前", ); |
|
|
|
|
|
let cmdArray1 = [cmd.HOME_DIRECTORY, cmd.OBU_SYSTEM_FILE, cmd.RANDOM_NUMBER]; |
|
|
|
|
|
tools.showLoadingAlert("正在执行指令"); |
|
|
|
|
|
bluetoothUtil.transCmd(cmdArray1, "20", function(res) { |
|
|
|
|
|
tools.hideLoadingAlert(); |
|
|
|
|
|
console.log("=========3", res[2]) |
|
|
|
|
|
var str = res[2].substring(res[2].length - 4, res[2].length); |
|
|
|
|
|
console.log("=========2") |
|
|
|
|
|
if (str == "9000") { |
|
|
|
|
|
console.log("=========1") |
|
|
|
|
|
cmdRandNum = res[2].substring(0, res[2].length - 4); |
|
|
|
|
|
const options = { |
|
|
|
|
|
type: 2, |
|
|
|
|
|
data: { |
|
|
|
|
|
obuId: orderInfos.obuId, |
|
|
|
|
|
random: cmdRandNum |
|
|
|
|
|
}, |
|
|
|
|
|
method: "POST", |
|
|
|
|
|
showLoading: true, |
|
|
|
|
|
}; |
|
|
|
|
|
request(obuRenewal, options).then((res) => { |
|
|
|
|
|
let datas = stringToJson(res.bizContent); |
|
|
|
|
|
// let cmdArray = result.command.split(","); |
|
|
|
|
|
console.log("899", datas, datas.data.APDU); |
|
|
|
|
|
if (datas.data.APDU) { |
|
|
|
|
|
tools.showLoadingAlert("正在执行指令"); |
|
|
|
|
|
bluetoothUtil.transCmd([datas.data.APDU], "20", function(res) { |
|
|
|
|
|
tools.hideLoadingAlert(); |
|
|
|
|
|
console.log("res=====", res, res[0]) |
|
|
|
|
|
let cmdArr = [cmd.HOME_DIRECTORY, cmd.OBU_DF01, cmd.OBU_EF01, cmd |
|
|
|
|
|
.RANDOM_NUMBER |
|
|
|
|
|
]; |
|
|
|
|
|
bluetoothUtil.transCmd(cmdArr, "20", function(res) { |
|
|
|
|
|
console.log("chelaing======", res) |
|
|
|
|
|
var str = res[3].substring(res[3].length - 4, res[3] |
|
|
|
|
|
.length); |
|
|
|
|
|
if (str == "9000") { |
|
|
|
|
|
cmdRandNum = res[3].substring(0, res[3].length - |
|
|
|
|
|
4); |
|
|
|
|
|
console.log("0000000000000000000000000") |
|
|
|
|
|
getFileData((demos) => { |
|
|
|
|
|
modifyVehicle(demos); |
|
|
}) |
|
|
}) |
|
|
} else { |
|
|
|
|
|
tools.alertF("RANDOM_NUMBER指令长度不符" + res[1]); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
tools.alertF("RANDOM_NUMBER指令长度不符" + res[1]); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
|
|
|
} else { |
|
|
|
|
|
tools.alertF("RANDOM_NUMBER指令长度不符" + res[1]); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}; |
|
|
|
|
|
//获取fileData |
|
|
|
|
|
const getFileData = (fun) => { |
|
|
|
|
|
//调用方式 |
|
|
|
|
|
request('6ed853e432fb4811a3c0d7d27034bd39', { |
|
|
|
|
|
type: 2, //type: 2,JSON格式提交数据(默认表单形式提交) |
|
|
|
|
|
data: { |
|
|
|
|
|
fileData: fileDataStrings.vehiclePlate, |
|
|
|
|
|
nLen: 24 |
|
|
|
|
|
}, //请求参数 |
|
|
|
|
|
method: "POST", //提交方式(默认POST) |
|
|
|
|
|
showLoading: true, //是否显示加载中(默认显示) |
|
|
|
|
|
}).then((les) => { |
|
|
|
|
|
let result = stringToJson(les.bizContent); |
|
|
|
|
|
console.log(les, '=========123') |
|
|
|
|
|
let res1 = result.gbkFileData; //车牌号 |
|
|
|
|
|
let res2 = IntegerToHexString(fileDataStrings.vehiclePlateColor, 4); //车牌颜色 |
|
|
|
|
|
|
|
|
|
|
|
let res3 = IntegerToHexString(1, 2); //类型 |
|
|
|
|
|
|
|
|
|
|
|
let res4 = IntegerToHexString(1, 2); //用户类型 |
|
|
|
|
|
let res5 = IntegerToHexString(fileDataStrings.outlineL, 4); //车辆尺寸 长 |
|
|
|
|
|
let res6 = IntegerToHexString(fileDataStrings.outlineW, 2); //车辆尺寸 宽 |
|
|
|
|
|
let res7 = IntegerToHexString(fileDataStrings.outlineH, 2); //车辆尺寸 高 |
|
|
|
|
|
let res8 = IntegerToHexString(4, 2); //获取轮数 |
|
|
|
|
|
let res9 = IntegerToHexString(4, 2); //轴数 |
|
|
|
|
|
|
|
|
|
|
|
let res10 = IntegerToHexString(null, 4); //轴距32 |
|
|
|
|
|
let res11 = IntegerToHexString(fileDataStrings.approvedCount, 6); //核载人数 |
|
|
|
|
|
|
|
|
|
|
|
let res12 = AsciToHexString(fileDataStrings.vehicleVin, 32); //车编号 |
|
|
|
|
|
|
|
|
|
|
|
// let res12 = JSON.parse(res.bizContent).gbkFileData; //车编号 |
|
|
|
|
|
let res13 = AsciToHexString(fileDataStrings.vehicleEngineNum, 32); //发动机 |
|
|
|
|
|
|
|
|
|
|
|
fun(res1 + res2 + res3 + res4 + res5 + res6 + res7 + res8 + res9 + res10 + res11 + res12 + res13); |
|
|
|
|
|
}) |
|
|
}; |
|
|
}; |
|
|
/** |
|
|
/** |
|
|
* 修改车辆信息 请求 |
|
|
* 修改车辆信息 请求 |
|
|
|
|
|
|
|
|
type: 2, //type: 2,JSON格式提交数据(默认表单形式提交) |
|
|
type: 2, //type: 2,JSON格式提交数据(默认表单形式提交) |
|
|
data: { |
|
|
data: { |
|
|
Status: "0", |
|
|
Status: "0", |
|
|
random: cmdRandNum, |
|
|
|
|
|
|
|
|
random: cmdRandNum, |
|
|
obuSerailNo: orderInfos.obuId, |
|
|
obuSerailNo: orderInfos.obuId, |
|
|
fileData: ites, |
|
|
fileData: ites, |
|
|
orderId: orderInfos.orderId, |
|
|
orderId: orderInfos.orderId, |
|
|
|
|
|
|
|
|
.then((res) => { |
|
|
.then((res) => { |
|
|
tools.hideLoadingAlert(); |
|
|
tools.hideLoadingAlert(); |
|
|
const datas = stringToJson(res.bizContent); |
|
|
const datas = stringToJson(res.bizContent); |
|
|
console.log("modifyObuVehicleInfo",modifyObuVehicleInfo,datas) |
|
|
|
|
|
|
|
|
console.log("modifyObuVehicleInfo", modifyObuVehicleInfo, datas) |
|
|
tools.showLoadingAlert("正在执行指令"); |
|
|
tools.showLoadingAlert("正在执行指令"); |
|
|
if (datas.data.APDU) { |
|
|
if (datas.data.APDU) { |
|
|
bluetoothUtil.transCmd([datas.data.APDU], "20", function(res) { |
|
|
bluetoothUtil.transCmd([datas.data.APDU], "20", function(res) { |
|
|
console.log('执行指令结果', res) |
|
|
console.log('执行指令结果', res) |
|
|
tools.hideLoadingAlert(); |
|
|
tools.hideLoadingAlert(); |
|
|
if (res[0] == "9000") { |
|
|
if (res[0] == "9000") { |
|
|
getObuActivation(); |
|
|
|
|
|
|
|
|
//再次获取随机数 |
|
|
|
|
|
let cmdArr = [cmd.HOME_DIRECTORY, cmd.RANDOM_NUMBER]; |
|
|
|
|
|
bluetoothUtil.transCmd(cmdArr, '20', function(res) { |
|
|
|
|
|
var str = res[1].substring(res[1].length - 4, res[1].length); |
|
|
|
|
|
if (str == "9000") { |
|
|
|
|
|
cmdRandNum = res[1].substring(0, res[1].length - 4); |
|
|
|
|
|
getObuActivation(); |
|
|
|
|
|
} else { |
|
|
|
|
|
tools.alertF("RANDOM_NUMBER指令长度不符" + res[1]); |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
console.log(stringToJson(res.bizContent)); |
|
|
console.log(stringToJson(res.bizContent)); |
|
|
const datas = stringToJson(res.bizContent); |
|
|
const datas = stringToJson(res.bizContent); |
|
|
tools.showLoadingAlert("执行指令"); |
|
|
tools.showLoadingAlert("执行指令"); |
|
|
|
|
|
console.log("在线激活 请求==========================", datas, datas.data.APDU); |
|
|
bluetoothUtil.transCmd([datas.data.APDU], "20", function(res) { |
|
|
bluetoothUtil.transCmd([datas.data.APDU], "20", function(res) { |
|
|
tools.hideLoadingAlert(); |
|
|
tools.hideLoadingAlert(); |
|
|
console.log(res); |
|
|
|
|
|
|
|
|
console.log("在线激活 请求", res); |
|
|
if (res[0] == "9000") { |
|
|
if (res[0] == "9000") { |
|
|
state.showPopup = true; |
|
|
state.showPopup = true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
console.log(err); |
|
|
console.log(err); |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
|
|
|
//获取订单详情 |
|
|
|
|
|
const getOrderDetails = (id) => { |
|
|
|
|
|
console.log('======获取订单信息======') |
|
|
|
|
|
const options = { |
|
|
|
|
|
type: 2, |
|
|
|
|
|
data: { |
|
|
|
|
|
id: id, |
|
|
|
|
|
}, |
|
|
|
|
|
method: "POST", |
|
|
|
|
|
showLoading: true, |
|
|
|
|
|
}; |
|
|
|
|
|
request(IFCODE.orderDetail, options).then((res) => { |
|
|
|
|
|
orderInfo = JSON.parse(res.bizContent); |
|
|
|
|
|
console.log("orderInfo", orderInfo); |
|
|
|
|
|
console.log("orderInfores", res); |
|
|
|
|
|
if (orderInfo) { |
|
|
|
|
|
fileDataStrings.userType = orderInfo.userType; //用户类型 |
|
|
|
|
|
fileDataStrings.approvedCount = parseInt(orderInfo.vehicleApprovedCount); //核载人数 |
|
|
|
|
|
fileDataStrings.cardId = orderInfo.cardId; |
|
|
|
|
|
fileDataStrings.packageNum = orderInfo.packageNum; |
|
|
|
|
|
fileDataStrings.obuId = orderInfo.obuId; |
|
|
|
|
|
fileDataStrings.vehicleVin = orderInfo.vehicleVin; |
|
|
|
|
|
fileDataStrings.vehicleEngineNum = orderInfo.vehicleEngineNum; |
|
|
|
|
|
fileDataStrings.axleCount = parseInt(orderInfo.vehicleAxleCount); //轴数 |
|
|
|
|
|
fileDataStrings.engineNum = orderInfo.vehicleVin; //发动机 |
|
|
|
|
|
fileDataStrings.type = parseInt(orderInfo.vehicleType); //类型 |
|
|
|
|
|
fileDataStrings.vehiclePlate = orderInfo.vehiclePlate; //车牌 |
|
|
|
|
|
fileDataStrings.vehiclePlateColor = orderInfo.vehiclePlateColor; //车牌颜色 |
|
|
|
|
|
fileDataStrings.vehicleDimensions = orderInfo.vehicleDimensions; |
|
|
|
|
|
let arr = orderInfo.vehicleDimensions.split("X"); |
|
|
|
|
|
fileDataStrings.outlineL = parseInt(arr[0]); //外廓 长 |
|
|
|
|
|
fileDataStrings.outlineW = parseInt(arr[1]); //外廓 宽 |
|
|
|
|
|
fileDataStrings.outlineH = parseInt(arr[2].substring(0, arr[2].length - 2)); //外廓 高 |
|
|
|
|
|
fileDataStrings.vehicleIdNo = orderInfo.vehicleEngineNum; //车编号 |
|
|
|
|
|
fileDataStrings.vehiclePlateColorStr = orderInfo.vehiclePlateColorStr; |
|
|
|
|
|
fileDataStrings.customerTel = orderInfo.customerTel; |
|
|
|
|
|
fileDataStrings.customerId = orderInfo.customerId; |
|
|
|
|
|
fileDataStrings.orderId = orderInfo.orderId; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
</script> |
|
|
</script> |
|
|
|
|
|
|
|
|
<style> |
|
|
<style> |