yangteng 1 anno fa
parent
commit
6435cb32c1

+ 1
- 0
subpackage/after-sale/ETC-log-off/upload-card.vue Vedi File

@@ -221,6 +221,7 @@
return new Promise(async (resolve, reject) => {
const res = await request(CardSignCancellation, options);
const data = stringToJson(res.bizContent);
console.log("注销申请此接口可能有问题",data)
resolve(data);
}).catch((error) => {
reject(error);

+ 0
- 438
subpackage/after-sale/activation-once-again/activation-once-again.vue Vedi File

@@ -119,443 +119,6 @@
</template>

<script lang="ts" setup>
// #ifdef MP-ALIPAY
import viewfinder from "@/components/viewfinder.vue"
import {
reactive,
ref
} from "vue";
import {
formatTime,
expireDate,
expireDate2,
getFormatDate,
msg,
navTo,
strReplace,
uploadFile
} from "@/utils/utils";
import {
onLoad, onShow
} from '@dcloudio/uni-app'
import {
request
} from "@/utils/network/request.js";
import {
stringToJson
} from "@/utils/network/encryption.js";
import activeSuccess from "./components/popup-device-active-success";
import * as IFCODE from "@/utils/network/api.js";
import {
channelId
} from "@/utils/network/difference";
const cmd = require("../../../static/etcUtil/cmdConfig.js");
const tools = require("../../../static/etcUtil/tools.js");
const bluetoothUtil = require("../../../static/etcUtil/index.js");
import {
getCodeName
} from "@/datas/queryKey.js";
import { agentId } from "@/utils/network/difference";


const state = reactive({
phoneType: 0, // 1 身份证正面 2 身份证反面 3行驶证正面 4行驶证反面
choiceIndex: 1, // 1 身份证正面 2 身份证反面
isTakePhotoModeShow: false, //选择拍照方式是否出来
changeColor: false,
showImg: true,
images: '',
showPopup: false,
form: {
vehPosImgUrl: "",
vehNegImgUrl: "",
vehicleIdNum: ""
},
activationNum: "",//激活次数
})

//订单
const orderInfos = reactive({
orderId: "",
ownerName: "",
ownerIdtype: "",
ownerIdnum: "",
vehiclePlate: "",
vehiclePlateColorStr: "",
vehiclePlateColor: "",
vehicleType: "",
cardId: "",
cardStatus: "",
obuId: "",
obuStatus: "",
outlineL: 0,
outlineW: 0,
outlineH: 0,
type: 0,
axleCount: 0,
approvedCount: 0,
vehicleVin: "",
vehicleEngineNum: "",
});
//OBU
const obu = reactive({
obuId: "",
startTime: "",
endTime: "",
version: "",
approvedCount: "",
axleCount: "",
axleDistance: "",
engineNum: "",
type: "",
userType: "",
contractNo: "",
vehiclePlate: "",
vehiclePlateColor: "",
vin: "",
wheelCount: "",
isJH: ""
});

onLoad((option) => {
console.log('======重新激活开始======', option);
//请求订单详情
queryOrderDetail(option.id);

});

onShow((option) => {
uni.$on('bluetoothLink', res => {
console.log(res);
if (res.status) {
// getCardRenewal()
getObuId()
}
//移除监听
console.log('======移除监听======', res)

// uni.$off('bluetoothLink')
})

})

const cancel = () => {
state.showPopup = false;
uni.navigateBack({
delta: 2
})
};

const toPage = () => {
if (!state.form.vehPosImgUrl) {
msg("请上传行驶证主页")
return;
}
if (!state.form.vehNegImgUrl) {
msg("请上传行驶证副页")
return;
}
console.log("state.form.vehicleIdNum", state.form.vehicleIdNum, orderInfos.vehiclePlate)
if (state.form.vehicleIdNum == orderInfos.vehiclePlate) {
activationRecordQuery().then((val) => {
console.log("激活次数", val)
if (val.limit) {
navTo("/pages/bluetooth/bluetooth?routeType=5");
} else {
msg("一年内到达激活次数上限5次")
}
});
} else {
msg("请上传正确行驶证")
}

};

//获取订单详情
const queryOrderDetail = (id : string) => {
const options = {
type: 2,
data: {
id: id,
},
method: "POST",
showLoading: true,
};
request(IFCODE.orderDetail, options).then((res) => {
let orderInfo = JSON.parse(res.bizContent);
console.log(orderInfo);
orderInfos.orderId = orderInfo.orderId;
orderInfos.ownerName = orderInfo.ownerName;
orderInfos.ownerIdtype = orderInfo.ownerIdtype;
orderInfos.ownerIdnum = orderInfo.ownerIdnum;
orderInfos.vehiclePlate = orderInfo.vehiclePlate;
orderInfos.vehiclePlateColorStr = orderInfo.vehiclePlateColorStr;
orderInfos.vehiclePlateColor = orderInfo.vehiclePlateColor;
orderInfos.vehicleType = orderInfo.vehicleType;
orderInfos.cardId = orderInfo.cardId;
orderInfos.cardStatus = orderInfo.cardStatus;
orderInfos.obuId = orderInfo.obuId;
orderInfos.obuStatus = orderInfo.obuStatus;
let arr = orderInfo.vehicleDimensions.split("X");
orderInfos.outlineL = parseInt(arr[0]); //外廓 长
orderInfos.outlineW = parseInt(arr[1]); //外廓 宽
orderInfos.outlineH = parseInt(arr[2].substring(0, arr[2].length - 2)); //外廓 高

orderInfos.type = orderInfo.type;
orderInfos.axleCount = orderInfo.vehicleAxleCount;
orderInfos.approvedCount = orderInfo.vehicleApprovedCount;
orderInfos.vehicleVin = orderInfo.vehicleVin;
orderInfos.vehicleEngineNum = orderInfo.vehicleEngineNum;
activationRecordQuery().then((val) => {
console.log("jihuo", val)
state.activationNum = val.num
});

});
};

/**
* 获取OBU号 读OBU
*/
const getObuId = () => {
console.log('======获取OBU号======')
let cmdArray = [cmd.HOME_DIRECTORY, cmd.OBU_SYSTEM_FILE, cmd.RANDOM_NUMBER];
tools.showLoadingAlert("正在执行指令");
bluetoothUtil.transCmd(cmdArray, "20", function (res) {
tools.hideLoadingAlert();
var status = res[1].substring(res[1].length - 4, res[1].length);
console.log('获取OBU号执行结果' + status)
//第一次获取随机数
if (status == "9000") {
obu.obuId = res[1].substring(20, 36);
obu.vin = res[1].substring(18, 20);
obu.version = res[1].substring(18, 19) >= 4 ? "4x" : "2x";
getInstallApply()
// cmdRandNum = res[2].substring(0, res[2].length - 4);
}
});
};

/**
* BDS-安装申请 请求
*/
const getInstallApply = () => {
console.log('======安装申请======')
tools.showLoadingAlert("加载中");
let options = {
type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
data: {
obuId: obu.obuId,
vehicleId: orderInfos.vehiclePlate + "_" + orderInfos.vehiclePlateColor,
orderId: orderInfos.orderId,
agentId: agentId,
channelId: channelId,
channelType: "1",
staffId: "opId",
terminalId: "999999999",
}, //请求参数
method: "POST", //提交方式(默认POST)
showLoading: true, //是否显示加载中(默认显示)
};
//调用方式
request(IFCODE.installApply, options)
.then(() => {
tools.hideLoadingAlert();
//再次获取随机数
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") {
let cmdRandNum = res[1].substring(0, res[1].length - 4);
getObuActivation(cmdRandNum);
} else {
tools.alertF("RANDOM_NUMBER指令长度不符" + res[1]);
}
})
})
};

/**
* VFJ-OBU在线激活 请求
*/
const getObuActivation = (cmdRandNum : string) => {
console.log('======VFJ-OBU在线激活======')
tools.showLoadingAlert("加载中");
let options = {
type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
data: {
random: cmdRandNum,
obuSerailNo: obu.obuId,
orderId: orderInfos.orderId,
}, //请求参数
method: "POST", //提交方式(默认POST)
showLoading: true, //是否显示加载中(默认显示)
};
//调用方式
request(IFCODE.obuActivation, options)
.then((res) => {
tools.hideLoadingAlert();
console.log("在线激活 请求");
console.log(stringToJson(res.bizContent));
const datas = stringToJson(res.bizContent);
tools.showLoadingAlert("执行指令");
bluetoothUtil.transCmd([datas.data.APDU], "20", function (res) {
tools.hideLoadingAlert();
console.log(res);
if (res[0] == "9000") {
console.log("在线激活执行指令88888 请求", res);
getObuInstall(0, ""); //status 0 - 安装成功 || 1 - 安装失败
}
});
})
.catch((err) => {
console.log(err);
});
};

/**
* BDS-安装确认 请求
*/
const getObuInstall = (status : number, reason : string) => {
console.log('======OBU安装确认======')
tools.showLoadingAlert("加载中");
let options = {
type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
data: {
installStatus: status,
failReason: reason,
installType: "1",
installChannelId: channelId,
obuId: obu.obuId,
orderId: orderInfos.orderId
}, //请求参数
method: "POST", //提交方式(默认POST)
showLoading: true, //是否显示加载中(默认显示)
};
//调用方式
request(IFCODE.obuInstall, options)
.then(() => {
tools.hideLoadingAlert();
state.showPopup = true;
submitVehicleQuery()
});

};
const xiangce = (val) => {
console.log("val", val)
if (state.choiceIndex == 3) {
var imageType = 1;
} else {
var imageType = 2;
}
state.changeColor = true;
uni.chooseImage({
count: 1, //只能选取一张照片
sizeType: ["original", "compressed"], //可以指定是原图还是压缩图,默认二者都有
sourceType: ["album"], //从相册选择
success: function (res) {
console.log("tempFilePaths[0].startsWith('file://')", res.tempFilePaths[0], res.tempFilePaths[0].startsWith('file://'))
if (state.choiceIndex == 3 || state.choiceIndex == 4) {
state.showImg = false
state.images = res.tempFilePaths[0]
state.phoneType = state.choiceIndex
state.isTakePhotoModeShow = false
return
}
},
})
}
const takePhoto = (val) => {
console.log("拍照", val)
state.phoneType = val;
state.showImg = true;
}
const confirmReturn = (val) => {
if (state.choiceIndex == 3) {
var imageType = 1;
} else {
var imageType = 2;
}
state.changeColor = true;
state.phoneType = 0
state.isTakePhotoModeShow = false
uploadFile(val.tempImagePath, imageType, IFCODE.etcCarOcrCard).then((data) => {
// uploadFile(val.tempImagePath, state.choiceIndex, ocrAllQuery).then((data) => {
console.log('输出内容=====================', state.choiceIndex)
if (state.choiceIndex === "3") {
if (data.plate_a.length > 8) {
state.form.vehicleIdNum = data.plate_a.substring(0, 8);
} else {
state.form.vehicleIdNum = data.plate_a;
}
state.form.vehPosImgUrl = data.imageUrl;

} else {
state.form.vehNegImgUrl = data.imageUrl;
console.log('=====================', state.form.vehNegImgUrl, state)
}
state.isTakePhotoModeShow = false
})
console.log("图片地址val", val.tempImagePath)
}
const takePhotoMode = (index) => {
console.log("index", index)
state.isTakePhotoModeShow = true
state.choiceIndex = index
}
const cancle = () => {
state.isTakePhotoModeShow = false
}
const camera = () => {
state.phoneType = 0
}
// 查询重新激活记录
const activationRecordQuery = () => {
const options = {
type: 2,
data: {
cardId: orderInfos.cardId,
obuId: orderInfos.obuId,
},
method: "POST",
showLoading: true,
};

return new Promise(async (resolve, reject) => {
const res = await request(IFCODE.activationRecordApi, options);
const data = stringToJson(res.bizContent);
resolve(data);
}).catch((error) => {
reject(error);
});
}
// 提交车辆信息
const submitVehicleQuery = () => {
const options = {
type: 2,
data: {
cardId: orderInfos.cardId,
obuId: orderInfos.obuId,
vehPosImgUrl: state.form.vehPosImgUrl,
vehNegImgUrl: state.form.vehNegImgUrl,
vehiclePlate: orderInfos.vehiclePlate
},
method: "POST",
};
console.log("提交车辆信息成功", options)
request(IFCODE.submitVehicleApi, options).then(() => {
console.log("提交车辆信息成功")
});
}
const goActivationRecord = () => {
uni.navigateTo({
url: `/subpackage/after-sale/activation-once-again/activation-once-again-record?obuId=${orderInfos.obuId}&&cardId=${orderInfos.cardId}`
})
}

// #endif

// #ifdef MP-WEIXIN
import viewfinder from "@/components/viewfinder.vue"
import {
reactive,
@@ -988,7 +551,6 @@
url: `/subpackage/after-sale/activation-once-again/activation-once-again-record?obuId=${orderInfos.obuId}&&cardId=${orderInfos.cardId}`
})
}
// #endif
</script>

<style>

Loading…
Annulla
Salva