orderInfo = JSON.parse(res.bizContent); | orderInfo = JSON.parse(res.bizContent); | ||||
if (orderInfo) { | if (orderInfo) { | ||||
fileDataStrings.userType = orderInfo.userType; //用户类型 | fileDataStrings.userType = orderInfo.userType; //用户类型 | ||||
fileDataStrings.approvedCount = orderInfo.vehicleApprovedCount; //核载人数 | |||||
fileDataStrings.approvedCount = parseInt(orderInfo.vehicleApprovedCount); //核载人数 | |||||
fileDataStrings.cardId = orderInfo.cardId; | fileDataStrings.cardId = orderInfo.cardId; | ||||
fileDataStrings.packageNum = orderInfo.packageNum; | fileDataStrings.packageNum = orderInfo.packageNum; | ||||
fileDataStrings.obuId = orderInfo.obuId; | fileDataStrings.obuId = orderInfo.obuId; | ||||
fileDataStrings.vehicleVin = orderInfo.vehicleVin; | fileDataStrings.vehicleVin = orderInfo.vehicleVin; | ||||
fileDataStrings.vehicleEngineNum = orderInfo.vehicleEngineNum; | fileDataStrings.vehicleEngineNum = orderInfo.vehicleEngineNum; | ||||
fileDataStrings.axleCount = orderInfo.vehicleAxleCount; //轴数 | |||||
fileDataStrings.axleCount = parseInt(orderInfo.vehicleAxleCount); //轴数 | |||||
fileDataStrings.engineNum = orderInfo.vehicleVin; //发动机 | fileDataStrings.engineNum = orderInfo.vehicleVin; //发动机 | ||||
fileDataStrings.type = orderInfo.vehicleType; //类型 | |||||
fileDataStrings.type = parseInt(orderInfo.vehicleType); //类型 | |||||
fileDataStrings.vehiclePlate = orderInfo.vehiclePlate; //车牌 | fileDataStrings.vehiclePlate = orderInfo.vehiclePlate; //车牌 | ||||
fileDataStrings.vehiclePlateColor = orderInfo.vehiclePlateColor; //车牌颜色 | fileDataStrings.vehiclePlateColor = orderInfo.vehiclePlateColor; //车牌颜色 | ||||
fileDataStrings.vehicleDimensions = orderInfo.vehicleDimensions; | fileDataStrings.vehicleDimensions = orderInfo.vehicleDimensions; | ||||
let arr = orderInfo.vehicleDimensions.split("x"); | let arr = orderInfo.vehicleDimensions.split("x"); | ||||
fileDataStrings.outlineL = parseInt(arr[0]); //外廓 长 | fileDataStrings.outlineL = parseInt(arr[0]); //外廓 长 | ||||
fileDataStrings.outlineW = parseInt(arr[1]); //外廓 宽 | fileDataStrings.outlineW = parseInt(arr[1]); //外廓 宽 | ||||
fileDataStrings.outlineH = parseInt( | |||||
arr[2].substring(0, arr[2].length - 2) | |||||
); //外廓 高 | |||||
fileDataStrings.outlineH = parseInt(arr[2].substring(0, arr[2].length - 2)); //外廓 高 | |||||
fileDataStrings.vehicleIdNo = orderInfo.vehicleEngineNum; //车编号 | fileDataStrings.vehicleIdNo = orderInfo.vehicleEngineNum; //车编号 | ||||
fileDataStrings.vehiclePlateColorStr = orderInfo.vehiclePlateColorStr; | fileDataStrings.vehiclePlateColorStr = orderInfo.vehiclePlateColorStr; | ||||
fileDataStrings.customerTel = orderInfo.customerTel; | fileDataStrings.customerTel = orderInfo.customerTel; | ||||
//获取fileData 拼接字符串 | //获取fileData 拼接字符串 | ||||
let res1 = AsciToHexString(fileDataStrings.vehiclePlate, 24); //车牌号 | let res1 = AsciToHexString(fileDataStrings.vehiclePlate, 24); //车牌号 | ||||
let res2 = IntegerToHexString(fileDataStrings.vehiclePlateColor, 4); //车牌颜色 | let res2 = IntegerToHexString(fileDataStrings.vehiclePlateColor, 4); //车牌颜色 | ||||
let res3 = IntegerToHexString(1, 2); //类型 | |||||
let res3 = IntegerToHexString(fileDataStrings.type, 2); //类型 | |||||
let res4 = IntegerToHexString(1, 2); //用户类型 | let res4 = IntegerToHexString(1, 2); //用户类型 | ||||
let res5 = IntegerToHexString(123, 4); //车辆尺寸 长 | |||||
let res6 = IntegerToHexString(123, 2); //车辆尺寸 宽 | |||||
let res7 = IntegerToHexString(123, 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 res8 = IntegerToHexString(4, 2); //获取轮数 | ||||
let res9 = IntegerToHexString(4, 2); //轴数 | |||||
let res9 = IntegerToHexString(fileDataStrings.axleCount, 2); //轴数 | |||||
let res10 = IntegerToHexString(null, 4); //轴距 | let res10 = IntegerToHexString(null, 4); //轴距 | ||||
let res11 = IntegerToHexString(5, 6); //核载人数 | |||||
let res11 = IntegerToHexString(fileDataStrings.approvedCount, 6); //核载人数 | |||||
let res12 = AsciToHexString(fileDataStrings.vehicleVin, 32); //车编号 | let res12 = AsciToHexString(fileDataStrings.vehicleVin, 32); //车编号 | ||||
let res13 = AsciToHexString(fileDataStrings.vehicleEngineNum, 32); //发动机 | let res13 = AsciToHexString(fileDataStrings.vehicleEngineNum, 32); //发动机 | ||||
return res1 + res2 + res3 + res4 + res5 + res6 + res7 + res8 + res9 + res10 + res11 + res12 + res13; | return res1 + res2 + res3 + res4 + res5 + res6 + res7 + res8 + res9 + res10 + res11 + res12 + res13; |
<template> | <template> | ||||
<view class="selectCar-box"> | <view class="selectCar-box"> | ||||
<view class="item" v-for="(item,i) in list" :key="i"> | |||||
<view v-if="state.list.length>0" @click="choose(i,item)" class="item" v-for="(item,i) in state.list" :key="i"> | |||||
<view class="iten-left"> | <view class="iten-left"> | ||||
<image :src="`${$imgUrl}che.png`" mode=""></image> | <image :src="`${$imgUrl}che.png`" mode=""></image> | ||||
<text>{{item.name}}</text> | |||||
<text>{{item.vehiclePlate}}</text> | |||||
</view> | </view> | ||||
<view class="choose-item" @click="choose(i,item)"> | |||||
<view class="active" v-if="flag==i"> | |||||
<view class="choose-item"> | |||||
<view class="active" v-if="flag==i"> | |||||
</view> | </view> | ||||
</view> | </view> | ||||
</view> | |||||
<view v-else class="flex"> | |||||
暂无车辆订单信息 | |||||
</view> | </view> | ||||
</view> | </view> | ||||
</template> | </template> | ||||
<script lang="ts" setup> | <script lang="ts" setup> | ||||
import {reactive,ref} from"vue" | |||||
import {navTo} from "@/utils/utils" | |||||
const list=reactive([ | |||||
{name:"A12345"}, | |||||
{name:"B12345"}, | |||||
{name:"C12345"}, | |||||
]) | |||||
const flag=ref('0') | |||||
const choose=(i,item)=>{ | |||||
flag.value=i | |||||
console.log("选择得数据",item); | |||||
navTo('/after-sale/card-Renewal/renewal-confirm') | |||||
} | |||||
import { | |||||
reactive, | |||||
ref | |||||
} from "vue" | |||||
import { | |||||
navTo | |||||
} from "@/utils/utils" | |||||
import { | |||||
onLoad, | |||||
onShow | |||||
} from "@dcloudio/uni-app"; | |||||
import { | |||||
orderList | |||||
} from "@/utils/network/api.js"; | |||||
import { | |||||
request | |||||
} from "@/utils/network/request.js"; | |||||
import { | |||||
msg | |||||
} from "@/utils/utils"; | |||||
import { | |||||
getItem, | |||||
StorageKeys, | |||||
setItem | |||||
} from "@/utils/storage"; | |||||
import { | |||||
stringToJson | |||||
} from "@/utils/network/encryption"; | |||||
const state = reactive({ | |||||
list: [] | |||||
}); | |||||
onLoad(() => { | |||||
quanCheckActionTrue().then((item: any) => { | |||||
state.list = item.data | |||||
console.log(item) | |||||
}) | |||||
}); | |||||
const quanCheckActionTrue = () => { | |||||
var data = { | |||||
opId: getItem(StorageKeys.OpenId), | |||||
source: 'WECHAT', | |||||
tabIndex: '0', | |||||
orderStep: '11', | |||||
isValueCard: '2' | |||||
}; | |||||
const options = { | |||||
type: 2, | |||||
data: data, | |||||
method: "POST", | |||||
showLoading: true, | |||||
}; | |||||
return new Promise(async (resolve, reject) => { | |||||
const res = await request(orderList, options); | |||||
const data = stringToJson(res.bizContent); | |||||
resolve(data); | |||||
}).catch((error) => { | |||||
reject(error); | |||||
}); | |||||
} | |||||
const list = reactive([{ | |||||
name: "A12345" | |||||
}, | |||||
{ | |||||
name: "B12345" | |||||
}, | |||||
{ | |||||
name: "C12345" | |||||
}, | |||||
]) | |||||
const flag = ref('0') | |||||
const choose = (i, item) => { | |||||
console.log(item.cardId) | |||||
navTo(`/after-sale/card-Renewal/renewal-confirm?id=${item.id}`) | |||||
} | |||||
</script> | </script> | ||||
<style> | <style> | ||||
} | } | ||||
</style> | </style> | ||||
<style lang="scss" scoped> | <style lang="scss" scoped> | ||||
.flex { | |||||
display: flex; | |||||
justify-content: center; | |||||
} | |||||
.selectCar-box { | .selectCar-box { | ||||
// width: 100%; | // width: 100%; | ||||
height: 100%; | height: 100%; | ||||
box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8); | box-shadow: 0rpx 2rpx 6rpx 0rpx rgba(223, 223, 223, 0.8); | ||||
border-radius: 20rpx; | border-radius: 20rpx; | ||||
margin-bottom: 30rpx; | margin-bottom: 30rpx; | ||||
.iten-left { | .iten-left { | ||||
display: flex; | display: flex; | ||||
align-items: center; | align-items: center; | ||||
image { | image { | ||||
width: 150rpx; | width: 150rpx; | ||||
height: 90rpx; | height: 90rpx; | ||||
color: #333333; | color: #333333; | ||||
} | } | ||||
} | } | ||||
.choose-item{ | |||||
width: 44rpx; | |||||
height: 44rpx; | |||||
background: #FFFFFF; | |||||
border: 2rpx solid #00B38B; | |||||
border-radius: 50%; | |||||
margin-right: 20rpx; | |||||
display: flex; | |||||
justify-content: center; | |||||
align-items: center; | |||||
box-sizing: content-box; | |||||
.choose-item { | |||||
width: 44rpx; | |||||
height: 44rpx; | |||||
background: #FFFFFF; | |||||
border: 2rpx solid #00B38B; | |||||
border-radius: 50%; | |||||
margin-right: 20rpx; | |||||
display: flex; | |||||
justify-content: center; | |||||
align-items: center; | |||||
box-sizing: content-box; | |||||
} | } | ||||
.active{ | |||||
.active { | |||||
width: 34rpx; | width: 34rpx; | ||||
height: 34rpx; | height: 34rpx; | ||||
background: #00B38B; | background: #00B38B; |
outsideDimensions: "", | outsideDimensions: "", | ||||
}) | }) | ||||
onLoad((option) => { | onLoad((option) => { | ||||
// getOrderDetails("f04b28632a2b4dd5959752d0eb2cdb6e") | |||||
getCardId(getObuId()) | |||||
getCardId() | |||||
}) | }) | ||||
//获取订单详情 | |||||
const getOrderDetails = (id) => { | |||||
const options = { | |||||
type: 2, | |||||
data: { | |||||
"id": id | |||||
}, | |||||
method: 'POST', | |||||
showLoading: true, | |||||
} | |||||
request(orderDetail, options).then((res) => { | |||||
console.log(res.bizContent); | |||||
const result = stringToJson(res.bizContent); | |||||
card.cardNo = result.cardId; | |||||
card.userName = result.ownerName; | |||||
card.idNum = result.ownerIdnum; | |||||
card.v_userType = result.vehicleClass; | |||||
card.vehiclePlate = result.vehiclePlate, | |||||
card.vehiclePlateColor = result.vehiclePlateColor; | |||||
card.startTime = result.cardEnableTime; | |||||
card.endTime = ""; | |||||
obu.num = result.obuId; | |||||
obu.startTime = result.obuEnableTime; | |||||
obu.approvedCount = result.vehicleApprovedCount; | |||||
obu.axleCount = result.vehicleAxleCount; | |||||
obu.engineNum = result.vehicleEngineNum; | |||||
obu.vehiclePlate = result.vehiclePlate; | |||||
obu.vehiclePlateColor = result.vehiclePlateColor; | |||||
//测试 | |||||
// state.orderInfo.orderStep = OrderStatus.待激活; | |||||
}) | |||||
}; | |||||
/** | /** | ||||
* 获取卡号 | * 获取卡号 | ||||
*/ | */ | ||||
const getCardId = (func) => { | |||||
const getCardId = () => { | |||||
//执行0015文件 | //执行0015文件 | ||||
tools.showLoadingAlert("执行指令"); | tools.showLoadingAlert("执行指令"); | ||||
let cmdArr = [cmd.HOME_DIRECTORY, cmd.APPLICATION_DIRECTORY, cmd.CMD_READBINARY, cmd.CMD_GETBALANCE]; | let cmdArr = [cmd.HOME_DIRECTORY, cmd.APPLICATION_DIRECTORY, cmd.CMD_READBINARY, cmd.CMD_GETBALANCE]; | ||||
console.log(cmdArr); | console.log(cmdArr); | ||||
console.log(bluetoothUtil); | console.log(bluetoothUtil); | ||||
card.favourable = '未知' + "_" + _str; | card.favourable = '未知' + "_" + _str; | ||||
break; | break; | ||||
} | } | ||||
//回调读取OBU指令 | //回调读取OBU指令 | ||||
getObuId() | |||||
tools.hideLoadingAlert(); | tools.hideLoadingAlert(); | ||||
func(); | |||||
} else { | } else { | ||||
alertF("CMD_00B08E0000指令长度不符" + res[2]); | alertF("CMD_00B08E0000指令长度不符" + res[2]); | ||||
} | } | ||||
if (str2 == "9000") { | if (str2 == "9000") { | ||||
decryptObuVehicleInfo(obu.num, res[1].substring(0, res[1].length - 4), | decryptObuVehicleInfo(obu.num, res[1].substring(0, res[1].length - 4), | ||||
function(res) { | function(res) { | ||||
console.log(res); | |||||
obu.approvedCount = HexToInt(res.substring(48, 54)); | obu.approvedCount = HexToInt(res.substring(48, 54)); | ||||
obu.axleCount = HexToInt(res.substring(44, 48)); | obu.axleCount = HexToInt(res.substring(44, 48)); | ||||
obu.axleDistance = HexToInt(res.substring(44, 48)); | obu.axleDistance = HexToInt(res.substring(44, 48)); | ||||
obu.engineNum = HexToStrig(res.substring(86, 118)); | obu.engineNum = HexToStrig(res.substring(86, 118)); | ||||
obu.type = HexToInt(res.substring(28, 30)); | |||||
obu.userType = HexToInt(res.substring(30, 32)); | |||||
obu.type = getVehicleType(HexToInt(res.substring(28, 30))); | |||||
obu.userType = HexToInt(res.substring(30, 32))==1?"个人用户":"单位用户"; | |||||
obu.vehiclePlate = HexToStrig(res.substring(0, 24)); | obu.vehiclePlate = HexToStrig(res.substring(0, 24)); | ||||
//获取车牌颜色 | //获取车牌颜色 | ||||
obu.vehiclePlateColor = HexToInt(res.substring(24, 28)) | |||||
obu.vehiclePlateColor = getVehiclePlateColor(HexToInt(res.substring(24, 28))); | |||||
obu.vin = HexToStrig(res.substring(54, 86)); | obu.vin = HexToStrig(res.substring(54, 86)); | ||||
obu.wheelCount = HexToInt(res.substring(40, 42)); | obu.wheelCount = HexToInt(res.substring(40, 42)); | ||||
obu.outsideDimensions = HexToInt(res.substring(32, 36)) + "x" + | obu.outsideDimensions = HexToInt(res.substring(32, 36)) + "x" + | ||||
/** | /** | ||||
* 解密OBU车辆信息 | * 解密OBU车辆信息 | ||||
*/ | */ | ||||
const decryptObuVehicleInfo =(num, data, func) =>{ | |||||
const decryptObuVehicleInfo = (num, data, func) => { | |||||
const options = { | const options = { | ||||
type: 2, | type: 2, | ||||
data: { | data: { | ||||
obuSerailNo: num, | obuSerailNo: num, | ||||
fileData: data | |||||
fileData: data | |||||
}, | }, | ||||
method: "POST", | method: "POST", | ||||
showLoading: true, | showLoading: true, | ||||
}; | }; | ||||
request(obuDecrypt, options).then((res) => { | request(obuDecrypt, options).then((res) => { | ||||
func(stringToJson(res.bizContent)) | |||||
const data =stringToJson(res.bizContent) | |||||
const FileData =data.data.FileData | |||||
func(FileData) | |||||
}); | }); | ||||
}; | }; | ||||
//返回按钮 | |||||
const back = () => { | const back = () => { | ||||
uni.$emit("refreshOrder"); | uni.$emit("refreshOrder"); | ||||
uni.switchTab({ | uni.switchTab({ | ||||
url: "/pages/order/order" | url: "/pages/order/order" | ||||
}) | }) | ||||
} | } | ||||
//提示对话框 | |||||
const alertF = (msg) => { | const alertF = (msg) => { | ||||
//隐藏加载框 | //隐藏加载框 | ||||
padding: 30rpx 0; | padding: 30rpx 0; | ||||
font-size: 36rpx; | font-size: 36rpx; | ||||
text-align: center; | text-align: center; | ||||
color: #4cd95f; | |||||
color: #13E7C1; | |||||
} | } | ||||
.info-card .cell { | .info-card .cell { |
uni.login({ | uni.login({ | ||||
provider: "weixin", | provider: "weixin", | ||||
success: function(e) { | success: function(e) { | ||||
console.log(e); | |||||
uni.request({ | uni.request({ | ||||
url: `https://api.weixin.qq.com/sns/jscode2session?appid=${wechatAppID}&secret=${wechatSecret}&js_code=${e.code}&grant_type=authorization_code`, | url: `https://api.weixin.qq.com/sns/jscode2session?appid=${wechatAppID}&secret=${wechatSecret}&js_code=${e.code}&grant_type=authorization_code`, | ||||
success: (res: any) => { | success: (res: any) => { | ||||
setItem("QYorder", state) | setItem("QYorder", state) | ||||
console.log(res); | console.log(res); | ||||
}, | }, | ||||
fail:(err :any)=>{ | |||||
uni.showToast({ | |||||
title: "网络异常,请重试!"+err.errcode, | |||||
icon:"error", | |||||
duration: 500 | |||||
}) | |||||
return; | |||||
} | |||||
}); | }); | ||||
}, | }, | ||||
}); | }); | ||||
}; | }; | ||||
const savaHandle = () => { | const savaHandle = () => { | ||||
console.log("openid*******",state.openid); | |||||
//如果获取openId成功 | //如果获取openId成功 | ||||
if (state.openid != '') { | |||||
if (state.openid) { | |||||
var data = { | var data = { | ||||
orderId: state.orderId, | orderId: state.orderId, | ||||
subOpenId: state.openid, | subOpenId: state.openid, | ||||
//如果获取openId失败 | //如果获取openId失败 | ||||
uni.showToast({ | uni.showToast({ | ||||
title: "网络异常,请重试!", | title: "网络异常,请重试!", | ||||
duration: 500 | |||||
icon:"none", | |||||
duration: 1000 | |||||
}) | }) | ||||
return; | return; | ||||
} | } |
datas.setData("bluLinkStatus", true); | datas.setData("bluLinkStatus", true); | ||||
datas.setData("connectPrefixName", connectPrefixName.value); | datas.setData("connectPrefixName", connectPrefixName.value); | ||||
//routeType 1.激活(订单来) 2.圈存 (/pages/recharge/recharge来)3.信息重写 4.信息读取 | |||||
//routeType 1.激活(订单来) 2.圈存 (/pages/recharge/recharge来)3.信息重写 4.信息读取 5卡续期 | |||||
if (routeType.value == "1") { | if (routeType.value == "1") { | ||||
uni.navigateTo({ | uni.navigateTo({ | ||||
url: "/after-sale/activation/activate", | url: "/after-sale/activation/activate", | ||||
uni.navigateTo({ | uni.navigateTo({ | ||||
url: "/after-sale/deviceInfo/deviceInfo", | url: "/after-sale/deviceInfo/deviceInfo", | ||||
}); | }); | ||||
} | |||||
else if(routeType.value == "5"){ | |||||
uni.navigateTo({ | |||||
url: "/after-sale/card-Renewal/renewal-confirm", | |||||
}); | |||||
}else { | }else { | ||||
return; | return; | ||||
} | } |
export const appId = "52030131"; //应用appid 综合业务支撑平台使用 | export const appId = "52030131"; //应用appid 综合业务支撑平台使用 | ||||
export const loginTime = 86400; //登录有效时间(单位s) 1天 | export const loginTime = 86400; //登录有效时间(单位s) 1天 | ||||
export const wechatPayConfigId = "6a9a54bc01f6443faea7ffe132b19f6"; //支付配置编号 微信小程序支付 | export const wechatPayConfigId = "6a9a54bc01f6443faea7ffe132b19f6"; //支付配置编号 微信小程序支付 | ||||
export const wechatAppID = "wx214b4f8de36a0181"; //小程序APPid | |||||
export const wechatSecret = "125a44b60b00d7e8a3820cc4cbdbdae8"; //小程序AppSecret | |||||
export const wechatAppID = "wx008c60533388527a"; //小程序APPid | |||||
export const wechatSecret = "95197718b43b497f02732bd9f8011080"; //小程序AppSecret | |||||
/*统一 会员平台*/ | /*统一 会员平台*/ | ||||
export const sendCode = "2"; //统一会员平台发送验证码接口 | export const sendCode = "2"; //统一会员平台发送验证码接口 | ||||
export const cardCzPayResultCheck = "814"; //储值卡充值-获取已支付未圈存的充值单(充值检测) | export const cardCzPayResultCheck = "814"; //储值卡充值-获取已支付未圈存的充值单(充值检测) | ||||
export const cardCzXFCheck = "815"; //储值卡充值-圈存(消费) | export const cardCzXFCheck = "815"; //储值卡充值-圈存(消费) | ||||
export const quanXf = "71"; //圈存修复V (写指令) | export const quanXf = "71"; //圈存修复V (写指令) | ||||
export const quanConfirm = "72"; //圈存确认 | |||||
export const quanConfirm = "72"; //圈存确认 | |||||
//卡操作 | |||||
export const cardRenewal = "891" //ASS-卡续期 | |||||
export const cardStopOrStart ="892" //ASS-卡停/启用 |
// import { | |||||
// TextEncoder | |||||
// } from "text-decoding"; | |||||
import { | |||||
TextEncoder, | |||||
TextDecoder | |||||
} from "text-decoding"; | |||||
export function IntegerToHexString(num, nLen) { | export function IntegerToHexString(num, nLen) { |