Quellcode durchsuchen

'2024年6月29日12:48:36'

master
wq vor 11 Monaten
Ursprung
Commit
8e3ee336a6
2 geänderte Dateien mit 104 neuen und 19 gelöschten Zeilen
  1. 1
    0
      static/etcUtil/index.js
  2. 103
    19
      subpackage/after-sale/activation/activate.vue

+ 1
- 0
static/etcUtil/index.js Datei anzeigen

break; break;
case "WQ": case "WQ":
wqApi.transCmd(cmdArr, type, function(res) { wqApi.transCmd(cmdArr, type, function(res) {
console.log('握奇执行结果:===========', res)
if (res.code == 0) { if (res.code == 0) {
func(res.data); func(res.data);
} else { } else {

+ 103
- 19
subpackage/after-sale/activation/activate.vue Datei anzeigen

</view> </view>
</view> </view>
<view class="up_btn" v-if="state.showBtn"> <view class="up_btn" v-if="state.showBtn">
<button aria-disabled="true" @click="btn" v-if="!state.isSuccess" :disabled="!state.disabled" :class="state.disabled?'button':'hui'">
<button aria-disabled="true" @click="btn" v-if="!state.isSuccess" :disabled="!state.disabled"
:class="state.disabled?'button':'hui'">
点击开始激活 点击开始激活
</button> </button>
<button aria-disabled="true" @click="back" v-else> <button aria-disabled="true" @click="back" v-else>
isSuccess: false, //是否激活成功 isSuccess: false, //是否激活成功
showPopup: false, showPopup: false,
transfer: 0, //0 是原来的激活 1 是过户激活 transfer: 0, //0 是原来的激活 1 是过户激活
showBtn:true,
disabled:true
showBtn: true,
disabled: true
}) })
let snums = 0

onLoad((option) => { onLoad((option) => {
//读取传入 存储的数据orderInfo //读取传入 存储的数据orderInfo
let orderData = getItem("orderInfo"); let orderData = getItem("orderInfo");


//开始激活 按钮事件 //开始激活 按钮事件
const btn = () => { const btn = () => {
state.disabled=false
console.log('orderInfo参数', orderInfo,state.disabled)
state.disabled = false
console.log('orderInfo参数', orderInfo, state.disabled)
//0 是原来的激活 1 是过户激活
if (state.transfer) { if (state.transfer) {
// 获取cardId // 获取cardId
getCardId() getCardId()
getObuApply(); getObuApply();
} else if (obuId && obuStatus == '9') { //OBU发行 } else if (obuId && obuStatus == '9') { //OBU发行
getObuApply(); getObuApply();
} else if (cardId && obuId && (obuStatus == '1' || obuStatus == '11' || obuStatus ==
'0')) {
} else if (cardId && obuId && (obuStatus == '1' || obuStatus == '11' || obuStatus == '0')) {
getInstallApply(); //激活 getInstallApply(); //激活
} else { } else {
getCardId() getCardId()
method: "POST", method: "POST",
showLoading: true, showLoading: true,
}; };
state.disabled = false
request(IFCODE.orderDetail, options).then((res) => { request(IFCODE.orderDetail, options).then((res) => {
orderInfo = JSON.parse(res.bizContent); orderInfo = JSON.parse(res.bizContent);
console.log("orderInfo", orderInfo); console.log("orderInfo", orderInfo);
fileDataStrings.orderId = orderInfo.orderId; fileDataStrings.orderId = orderInfo.orderId;
let vehicleId = orderInfo.vehiclePlate + "_" + orderInfo.vehiclePlateColor let vehicleId = orderInfo.vehiclePlate + "_" + orderInfo.vehiclePlateColor
searchVehicleInfoQuery(vehicleId).then((orderInfo) => { searchVehicleInfoQuery(vehicleId).then((orderInfo) => {
console.log("orderInfo1111",orderInfo)
console.log("orderInfo1111", orderInfo)
fileDataStrings.approvedCount = parseInt(orderInfo.approvedCount); //核载人数 fileDataStrings.approvedCount = parseInt(orderInfo.approvedCount); //核载人数
fileDataStrings.vehicleVin = orderInfo.vin; fileDataStrings.vehicleVin = orderInfo.vin;
fileDataStrings.vehicleEngineNum = orderInfo.engineNum; fileDataStrings.vehicleEngineNum = orderInfo.engineNum;
.vehiclePlateColor); .vehiclePlateColor);
console.log("fileDataStrings", fileDataStrings); console.log("fileDataStrings", fileDataStrings);
}) })
getObuId();


cancelOrderRequest(orderInfo.orderId) cancelOrderRequest(orderInfo.orderId)
} }
}); });


getObuId();
}; };
//更换设备 去注销前订单的 卡签 //更换设备 去注销前订单的 卡签
const cancelOrderRequest = (orderId) => { const cancelOrderRequest = (orderId) => {
console.log('获取OBU号执行结果' + status, res) console.log('获取OBU号执行结果' + status, res)
//第一次获取随机数 //第一次获取随机数
if (status == "9000") { if (status == "9000") {
state.disabled = true
obu.obuId = res[1].substring(20, 36); obu.obuId = res[1].substring(20, 36);
console.log("obu.obuId===========", obu.obuId, res[1].substring(20, 36))
console.log(containsEnglishCharacters(card.obuId), '获取OBU号执行结果=========' + obu.obuId)
obu.vin = res[1].substring(18, 20); obu.vin = res[1].substring(18, 20);
obu.version = res[1].substring(18, 19) >= 4 ? "4x" : "2x"; obu.version = res[1].substring(18, 19) >= 4 ? "4x" : "2x";
cmdRandNum = res[2].substring(0, res[2].length - 4); cmdRandNum = res[2].substring(0, res[2].length - 4);
state.showBtn=true
state.showBtn = true
} else {
showModals('获取设备信息错误!')
} }
}, () => {
showModals('获取设备信息错误')
}); });
}; };


//获取fileData //获取fileData
const getFileData = (fun) => { const getFileData = (fun) => {
searchVehicleInfoQuery(orderInfo.vehiclePlate + "_" + orderInfo.vehiclePlateColor,cmdRandNum).then((orderInfo) => {
console.log("orderInfo==",orderInfo,orderInfo.fileData)
searchVehicleInfoQuery(orderInfo.vehiclePlate + "_" + orderInfo.vehiclePlateColor, cmdRandNum).then((
orderInfo) => {
console.log("orderInfo==", orderInfo, orderInfo.fileData)
fun(orderInfo.fileData); fun(orderInfo.fileData);
}) })
}; };


function containsEnglishCharacters(str) {
// // 使用正则表达式匹配英文字母
// const regex = /[a-zA-Z]/;
// return regex.test(str);

// 使用正则表达式匹配纯数字
const regex = /^\d+$/;
return regex.test(str);
}


/** /**
* 获取卡号 读卡 * 获取卡号 读卡
*/ */
if (str == "9000" || str3 == "9000") { if (str == "9000" || str3 == "9000") {
if (res[2].length > 86 || res[3] >= 12) { if (res[2].length > 86 || res[3] >= 12) {
card.cardId = res[2].substring(20, 40); //卡号 card.cardId = res[2].substring(20, 40); //卡号

if (!containsEnglishCharacters(card.cardId)) {
if (snums > 2) {
showModals('获取卡信息错误')
return
}
snums++
getCardId()
return
}

card.startTime = res[2].substring(40, 48); //启用 card.startTime = res[2].substring(40, 48); //启用
card.endTime = res[2].substring(48, 56); card.endTime = res[2].substring(48, 56);
card.version = res[2].substring(18, 19) >= 4 ? "4x" : "2x"; card.version = res[2].substring(18, 19) >= 4 ? "4x" : "2x";
console.error("CMD_READBINARY指令长度不符" + res[2]) console.error("CMD_READBINARY指令长度不符" + res[2])
tools.hideLoadingAlert(); tools.hideLoadingAlert();
} }
} else {
showModals('获取卡信息错误!')
} }
console.error("CMD_READBINARY指令长度不符" + res[2]) console.error("CMD_READBINARY指令长度不符" + res[2])
tools.hideLoadingAlert(); tools.hideLoadingAlert();
}, () => {
showModals('获取卡信息错误')
}); });
}; };


function showModals(msg) {
uni.showModal({
title: '提示',
content: msg,
showCancel: false,
success: function(res) {
if (res.confirm) {
uni.navigateBack()
console.log('用户点击确定1');
} else if (res.cancel) {
console.log('用户点击取消1');
}
}
});
}

// *------------------------------------* // *------------------------------------*
// OBU开卡模块 // OBU开卡模块
// *------------------------------------* // *------------------------------------*
bluetoothUtil.transCmd(result.command.split(","), "10", function(res) { bluetoothUtil.transCmd(result.command.split(","), "10", function(res) {
tools.hideLoadingAlert(); tools.hideLoadingAlert();
getCommandBack(result.command, result.cosRecordId, res.toString()); getCommandBack(result.command, result.cosRecordId, res.toString());
}, () => {
showModals('写卡指令信息错误!')
}); });
}) })
}; };
tools.hideLoadingAlert(); tools.hideLoadingAlert();
let response = res.toString(); let response = res.toString();
getCommandBack(result.command, cosRecordId, response); getCommandBack(result.command, cosRecordId, response);
});
}, () => {
showModals('写卡指令返回错误!')
})
} else { } else {
getWriteCard(); getWriteCard();
} }
const getObuApply = () => { const getObuApply = () => {
console.log('======OBU发行申请======') console.log('======OBU发行申请======')
tools.showLoadingAlert("加载中"); tools.showLoadingAlert("加载中");

console.log('获取OBU号执行结果=========' + obu.obuId)
let options = { let options = {
type: 2, //type: 2,JSON格式提交数据(默认表单形式提交) type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
data: { data: {
tools.hideLoadingAlert(); tools.hideLoadingAlert();
modifyFileInfo() modifyFileInfo()
}) })


}; };


/** /**
} else { } else {
tools.alertF("RANDOM_NUMBER指令长度不符" + res[1]); tools.alertF("RANDOM_NUMBER指令长度不符" + res[1]);
} }
}, () => {
showModals('修改系统信息错误')
}) })

} }
}, () => {
showModals('修改系统信息错误!')
}); });
} }
}) })
type: 2, //type: 2,JSON格式提交数据(默认表单形式提交) type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
data: { data: {
Status: "0", Status: "0",
random: cmdRandNum,
obuSerailNo: obu.obuId,
random: cmdRandNum,
obuSerailNo: obu.obuId,
fileData: ites, fileData: ites,
orderId: fileDataStrings.orderId, orderId: fileDataStrings.orderId,
}, //请求参数 }, //请求参数
transferSureRequest(); transferSureRequest();
} }
} }
}, () => {
showModals('修改车辆信息错误')
}); });
} }
}) })
} else { } else {
tools.alertF("RANDOM_NUMBER指令长度不符" + res[1]); tools.alertF("RANDOM_NUMBER指令长度不符" + res[1]);
} }
}, () => {
showModals('安装申请异常')
}) })
}) })
}; };
console.log("在线激活执行指令88888 请求", res); console.log("在线激活执行指令88888 请求", res);
getObuInstall(0, ""); //status 0 - 安装成功 || 1 - 安装失败 getObuInstall(0, ""); //status 0 - 安装成功 || 1 - 安装失败
} }
}, () => {
showModals('在线激活异常')
}); });
}) })
.catch((err) => { .catch((err) => {
tools.hideLoadingAlert(); tools.hideLoadingAlert();
let response = res.toString(); let response = res.toString();
getCommandBackEnd(result.command, result.cosRecordId, response); getCommandBackEnd(result.command, result.cosRecordId, response);
}, () => {
showModals('卡签绑定异常!')
}); });
}) })
.catch((err) => { .catch((err) => {
tools.hideLoadingAlert(); tools.hideLoadingAlert();
let response = res.toString(); let response = res.toString();
getCommandBackEnd(result.command, cosRecordId, response); getCommandBackEnd(result.command, cosRecordId, response);
}, () => {
showModals('卡签绑定返回异常!')
}); });
} else { } else {
state.disabled=true
state.disabled = true
// #ifdef MP-ALIPAY // #ifdef MP-ALIPAY
uni.closeBluetoothAdapter({ uni.closeBluetoothAdapter({
success(res) { success(res) {
if (status == "9000") { if (status == "9000") {
getCommandBackUp(result.command, result.cosRecordId, res.toString()); getCommandBackUp(result.command, result.cosRecordId, res.toString());
} }
}, () => {
showModals('设备升级异常!')
}) })
} }
}) })
tools.hideLoadingAlert(); tools.hideLoadingAlert();
let response = res.toString(); let response = res.toString();
getCommandBackUp(result.command, cosRecordId, response); getCommandBackUp(result.command, cosRecordId, response);
}, () => {
showModals('写卡异常!')
}); });
} else { } else {
obuWriteAgainRequest(); obuWriteAgainRequest();
outline: none; outline: none;
border: #4cd95f; border: #4cd95f;
} }

.button { .button {
width: 100%; width: 100%;
height: 80rpx; height: 80rpx;
outline: none; outline: none;
border: #4cd95f; border: #4cd95f;
} }
.hui {

.hui {
width: 100%; width: 100%;
height: 80rpx; height: 80rpx;
line-height: 80rpx; line-height: 80rpx;
outline: none; outline: none;
border: #4cd95f; border: #4cd95f;
} }

.up_btn button[disabled] { .up_btn button[disabled] {
background-color: rgba(0, 191, 112, 0.5); background-color: rgba(0, 191, 112, 0.5);
color: white; color: white;

Laden…
Abbrechen
Speichern