Explorar el Código

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

master
wq hace 11 meses
padre
commit
8e3ee336a6
Se han modificado 2 ficheros con 104 adiciones y 19 borrados
  1. 1
    0
      static/etcUtil/index.js
  2. 103
    19
      subpackage/after-sale/activation/activate.vue

+ 1
- 0
static/etcUtil/index.js Ver fichero

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

+ 103
- 19
subpackage/after-sale/activation/activate.vue Ver fichero

@@ -24,7 +24,8 @@
</view>
</view>
<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 aria-disabled="true" @click="back" v-else>
@@ -92,9 +93,11 @@
isSuccess: false, //是否激活成功
showPopup: false,
transfer: 0, //0 是原来的激活 1 是过户激活
showBtn:true,
disabled:true
showBtn: true,
disabled: true
})
let snums = 0

onLoad((option) => {
//读取传入 存储的数据orderInfo
let orderData = getItem("orderInfo");
@@ -177,8 +180,9 @@

//开始激活 按钮事件
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) {
// 获取cardId
getCardId()
@@ -209,8 +213,7 @@
getObuApply();
} else if (obuId && obuStatus == '9') { //OBU发行
getObuApply();
} else if (cardId && obuId && (obuStatus == '1' || obuStatus == '11' || obuStatus ==
'0')) {
} else if (cardId && obuId && (obuStatus == '1' || obuStatus == '11' || obuStatus == '0')) {
getInstallApply(); //激活
} else {
getCardId()
@@ -231,6 +234,7 @@
method: "POST",
showLoading: true,
};
state.disabled = false
request(IFCODE.orderDetail, options).then((res) => {
orderInfo = JSON.parse(res.bizContent);
console.log("orderInfo", orderInfo);
@@ -245,7 +249,7 @@
fileDataStrings.orderId = orderInfo.orderId;
let vehicleId = orderInfo.vehiclePlate + "_" + orderInfo.vehiclePlateColor
searchVehicleInfoQuery(vehicleId).then((orderInfo) => {
console.log("orderInfo1111",orderInfo)
console.log("orderInfo1111", orderInfo)
fileDataStrings.approvedCount = parseInt(orderInfo.approvedCount); //核载人数
fileDataStrings.vehicleVin = orderInfo.vin;
fileDataStrings.vehicleEngineNum = orderInfo.engineNum;
@@ -270,10 +274,14 @@
.vehiclePlateColor);
console.log("fileDataStrings", fileDataStrings);
})
getObuId();


cancelOrderRequest(orderInfo.orderId)
}
});


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

//获取fileData
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);
})
};

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

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


/**
* 获取卡号 读卡
*/
@@ -347,6 +372,17 @@
if (str == "9000" || str3 == "9000") {
if (res[2].length > 86 || res[3] >= 12) {
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.endTime = res[2].substring(48, 56);
card.version = res[2].substring(18, 19) >= 4 ? "4x" : "2x";
@@ -371,12 +407,32 @@
console.error("CMD_READBINARY指令长度不符" + res[2])
tools.hideLoadingAlert();
}
} else {
showModals('获取卡信息错误!')
}
console.error("CMD_READBINARY指令长度不符" + res[2])
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开卡模块
// *------------------------------------*
@@ -412,6 +468,8 @@
bluetoothUtil.transCmd(result.command.split(","), "10", function(res) {
tools.hideLoadingAlert();
getCommandBack(result.command, result.cosRecordId, res.toString());
}, () => {
showModals('写卡指令信息错误!')
});
})
};
@@ -448,7 +506,9 @@
tools.hideLoadingAlert();
let response = res.toString();
getCommandBack(result.command, cosRecordId, response);
});
}, () => {
showModals('写卡指令返回错误!')
})
} else {
getWriteCard();
}
@@ -516,6 +576,8 @@
const getObuApply = () => {
console.log('======OBU发行申请======')
tools.showLoadingAlert("加载中");

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


};

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

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

.button {
width: 100%;
height: 80rpx;
@@ -1141,7 +1223,8 @@
outline: none;
border: #4cd95f;
}
.hui {

.hui {
width: 100%;
height: 80rpx;
line-height: 80rpx;
@@ -1153,6 +1236,7 @@
outline: none;
border: #4cd95f;
}

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

Cargando…
Cancelar
Guardar