|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478 |
- <template>
- <view class="selectCar-box">
- <view class="details">
- <view class="title"> 基础信息 </view>
- <view class="details-item">
- <view> 订单编号: </view>
- <text>{{ orderInfos.orderId }}</text>
- </view>
- <view class="details-item">
- <view> 用户名称: </view>
- <text>{{ orderInfos.customerName }}</text>
- </view>
- <view class="details-item">
- <view> 用户证件类型: </view>
- <text>{{ getCodeName('CERTIFICATE_TYPE',orderInfos.ownerIdtype) }}</text>
- </view>
- <view class="details-item">
- <view> 用户证件号: </view>
- <text>{{ orderInfos.ownerIdnum }}</text>
- </view>
- <view class="details-item">
- <view> 订单车牌号: </view>
- <text style="color: #00b38b">{{ orderInfos.vehiclePlate }}</text>
- </view>
- <view class="details-item">
- <view> 车牌颜色: </view>
- <text style="color: #00b38b">{{
- orderInfos.vehiclePlateColorStr
- }}</text>
- </view>
- <view class="details-item">
- <view> 收费车型: </view>
- <text>{{ orderInfos.vehicleType }}</text>
- </view>
- </view>
- <view class="title"> 卡信息 </view>
- <view class="card">
- <view class="card-left">
- <image :src="`${$imgUrl}card2.png`" mode=""></image>
- <view class="card-center">
- <view class="card-center-head"> {{orderInfos.cardId}} </view>
- <view class="tips">
- <!-- <text>储蓄卡</text> -->
- <text>卡状态</text>
- <text class="tips-card">{{getCodeName('CARD_STATE_TYPE',orderInfos.cardStatus)}}</text>
- </view>
- <view class="choose-item"> 有效期:{{orderInfos.cardExpireTime}}</view>
- </view>
- </view>
- </view>
- <button class="submit" @click="toPage" v-if="!state.flag" :disabled="state.disabled">卡PIN码解锁</button>
- <button class="submit" @click="toBack" v-else>返回服务中心</button>
-
- <view class="mask" v-show="state.showPopup">
- <view class="main">
- <view class="top">
- <image class="icon-close" :src="`${$imgUrl}common/icon-close.png`" @click="cancel"></image>
- </view>
- <block v-if="state.status">
- <image class="icon-success" :src="`${$imgUrl}common/success.png`"></image>
- <view class="title">PIN解码成功!</view>
- </block>
- <block v-else>
- <image class="icon-success" :src="`${$imgUrl}common/error.png`"></image>
- <view class="title">PIN解码失败!</view>
- </block>
- </view>
- </view>
- </view>
- </template>
-
- <script setup>
- import {
- reactive
- } from "vue";
- import {
- navTo,
- getFormatDate,
- desensitization
- } from "@/utils/utils";
- import {
- onLoad,
- onUnload,
- onShow
- } from "@dcloudio/uni-app";
- import {
- request
- } from "@/utils/network/request.js";
- import {
- orderDetail,
- pinCodeUnlock
- } from "@/utils/network/api.js";
-
- import {
- getCredentialType
- } from "@/subpackage/after-sale/js/credentialType.js";
- import {
- getEtcCardStatus
- } from "@/subpackage/after-sale/js/etcCardStatus.js";
- import {
- getObuStatus
- } from "@/subpackage/after-sale/js/obuStatus.js";
- import {
- getCodeName
- } from "@/datas/queryKey.js";
-
- import {
- stringToJson
- } from "@/utils/network/encryption";
- const tools = require("../../../static/etcUtil/tools.js");
- const bluetoothUtil = require("../../../static/etcUtil/index.js");
- const state = reactive({
- showPopup: false,
- flag: false,
- disabled: false,
- status: true, //解密成功状态 true 成功| false 失败
- })
- const orderInfos = reactive({
- orderId: "",
- customerName: "",
- ownerIdtype: "",
- ownerIdnum: "",
- vehiclePlate: "",
- vehiclePlateColorStr: "",
- vehiclePlateColor: "",
- vehicleType: "",
- cardId: "",
- cardStatus: "",
- obuId: "",
- obuStatus: "",
- cardEnableTime: "",
- obuEnableTime: "",
- cardExpireTime: ""
- });
- let ordId = '';
-
- onLoad((option) => {
- //请求订单详情
- queryOrderDetail(option.id);
- ordId = option.id;
- if (option.state) {
- tools.showLoadingAlert("正在执行指令");
- state.disabled = true;
- getPinCodeUnlock()
- }
- });
-
- onUnload(() => {
- //移除监听
- uni.$off('bluetoothLink')
- })
- //获取订单详情
- const queryOrderDetail = (id) => {
- const options = {
- type: 2,
- data: {
- id: id,
- },
- method: "POST",
- showLoading: true,
- };
- request(orderDetail, options).then((res) => {
- let orderInfo = JSON.parse(res.bizContent);
- console.log("orderInfo", orderInfo);
- orderInfos.orderId = orderInfo.orderId;
- orderInfos.customerName = orderInfo.customerName;
- orderInfos.ownerIdtype = orderInfo.ownerIdtype;
- orderInfos.ownerIdnum = desensitization(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;
- orderInfos.cardEnableTime = orderInfo.cardEnableTime.substring(0, 10);
- orderInfos.cardExpireTime = orderInfo.cardExpireTime;
- orderInfos.obuEnableTime = orderInfo.obuEnableTime.substring(0, 10);
- });
- };
- //PIN解锁 请求
- const getPinCodeUnlock = (command = null, cosResponse = null, pinType = null) => {
- const options = {
- type: 2,
- data: {
- cardId: orderInfos.cardId,
- pinType: "2",
- },
- method: "POST",
- showLoading: true,
- };
- request(pinCodeUnlock, options).then((res) => {
- tools.hideLoadingAlert();
- //第一次调用
- let result = stringToJson(res.bizContent);
- let cmdArray = result.command ? result.command.split(",") : "";
- if (cmdArray.length > 0) {
- tools.showLoadingAlert("正在执行指令");
- bluetoothUtil.transCmd(cmdArray, "10", function(res) {
- let cosResponse = res.join(",");
- if (cosResponse == "6985") {
- tools.showModalAlert("此卡未锁定", function successFunc() {});
- } else if (cosResponse == "9303") {
- tools.showModalAlert("此卡pin已永久锁定!请联系客服进行换卡处理!", function successFunc() {});
- } else {
- console.log("卡执行指令结果", res)
- let cosResponse = ""
- for (let i = 0; i < res.length; i++) {
- if (i < res.length - 1) {
- cosResponse += res[i] + ","
- } else {
- cosResponse += res[i]
- }
- }
- getCommandBack(result.command, cosResponse, result.pinType);
- }
- })
- }
- })
- };
-
- const getCommandBack = (command = null, cosResponse = null, pinType = null) => {
- const options = {
- type: 2,
- data: {
- cardId: orderInfos.cardId,
- command: command,
- cosResponse: cosResponse,
- pinType: "2",
- },
- method: "POST",
- showLoading: true,
- };
- request(pinCodeUnlock, options).then((res) => {
- tools.hideLoadingAlert();
- let result = stringToJson(res.bizContent);
- console.log("result===", result)
- if (result.cardUnblockStatus == "1") {
- tools.showModalAlert("解锁成功", function successFunc() {});
- } else if (result.cardUnblockStatus == "2") {
- tools.showModalAlert("解锁失败", function successFunc() {});
- } else if (result.cardUnblockStatus == "3") {
- let cmdArray = result.command ? result.command.split(",") : "";
- if (cmdArray.length > 0) {
- tools.showLoadingAlert("正在执行指令");
- bluetoothUtil.transCmd(cmdArray, "10", function(res) {
- tools.hideLoadingAlert();
- let cosResponse = res.join(",");
- if (cosResponse == "6985") {
- tools.alertF("此卡未锁定");
- } else if (cosResponse == "9303") {
- tools.alertF("此卡pin已永久锁定!请联系客服进行换卡处理!");
- } else {
- console.log("res=====", res)
- getCommandBack(result.command, cosResponse, result.pinType);
- }
- })
- }
- }
-
-
- })
- };
-
-
-
- //去连接蓝牙
- const toPage = () => {
- navTo("/pages/bluetooth/bluetooth?routeType=3&id=" + ordId); //去连接蓝牙
- };
-
- //返回列表
- const toBack = () => {
- uni.navigateBack({
- delta: 2
- })
- }
-
- //关闭弹窗
- const cancel = () => {
- state.flag = true;
- state.showPopup = false;
- }
- </script>
-
- <style>
- page {
- width: 100%;
- height: 100%;
- background-color: #fff;
- }
- </style>
- <style lang="scss" scoped>
- .mask {
- background: rgba(0, 0, 0, .35);
- position: fixed;
- left: 0;
- top: 0;
- bottom: 0;
- right: 0;
- }
-
- .main {
- width: 560rpx;
- padding: 25rpx 20rpx 55rpx;
- text-align: center;
- background: #fff;
- position: absolute;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%);
- border-radius: 20rpx;
-
- .top {
- text-align: right;
-
- .icon-close {
- width: 48rpx;
- height: 48rpx;
- }
- }
-
- .icon-success {
- width: 500rpx;
- height: 320rpx;
- margin-top: 22rpx;
- }
-
- .title {
- color: #333333;
- font-size: 40rpx;
- font-weight: 600;
- text-align: center;
- margin-top: 55rpx;
- }
- }
-
- .selectCar-box {
- padding: 30rpx;
-
- .title {
- font-size: 30rpx;
- font-family: Microsoft YaHei UI;
- font-weight: 400;
- color: #333333;
- margin-bottom: 30rpx;
- }
-
- .details {
- .title {
- font-size: 30rpx;
- font-family: Microsoft YaHei UI;
- font-weight: 400;
- color: #333333;
- margin-bottom: 30rpx;
- }
-
- .details-item {
- display: flex;
- font-size: 26rpx;
- font-family: Noto Sans S Chinese;
- font-weight: 400;
- color: #999999;
- margin-bottom: 30rpx;
-
- text {
- font-size: 26rpx;
- font-family: Noto Sans S Chinese;
- font-weight: 400;
- color: #333333;
- }
- }
- }
-
- .card {
- height: 150rpx;
- background: #ffffff;
- box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
- border-radius: 20rpx;
- padding: 30rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 60rpx;
-
- .card-left {
- display: flex;
- align-items: center;
-
- image {
- width: 100rpx;
- height: 90rpx;
- }
-
- .card-center {
- margin-left: 30rpx;
-
- .card-center-head {
- font-size: 32rpx;
- font-family: Noto Sans S Chinese;
- font-weight: 400;
- color: #333333;
- }
-
- .tips {
- font-size: 26rpx;
- font-family: Noto Sans S Chinese;
- font-weight: 400;
- color: #666666;
-
- .tips-card {
- width: 70rpx;
- height: 40rpx;
- background: #d3f2ef;
- border-radius: 6rpx;
- font-size: 20rpx;
- font-family: Noto Sans S Chinese;
- font-weight: 400;
- color: #0a8f8a;
- padding: 5rpx 10rpx;
- margin-left: 20rpx;
- }
- }
- }
- }
-
- .choose-item {
- margin-right: 20rpx;
- height: 50rpx;
- border-radius: 50%;
- display: flex;
- justify-content: flex-start;
- align-items: center;
- font-size: 25rpx;
- align-self: end;
-
- .active {
- width: 38rpx;
- height: 38rpx;
- background: #00b38b;
- border-radius: 50%;
- }
- }
- }
-
- .remark {
- font-size: 26rpx;
- font-family: Microsoft YaHei UI;
- font-weight: 400;
- color: #666666;
- text-indent: 30rpx;
- margin-bottom: 30rpx;
- }
-
- .submit {
- margin-top: 100rpx;
- width: 670rpx;
- height: 80rpx;
- background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
- border-radius: 40rpx;
- font-size: 32rpx;
- font-family: Noto Sans S Chinese;
- font-weight: 400;
- color: #ffffff;
- line-height: 80rpx;
- }
-
- .submit::after {
- border: 0;
- }
-
- .submit[disabled] {
- background: #f0f0f0;
- color: #333;
- }
- }
- </style>
|