選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

upgrade-confirm.vue 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  1. <template>
  2. <view class="selectCar-box">
  3. <view class="details">
  4. <view class="title"> 基础信息 </view>
  5. <view class="details-item">
  6. <view> 订单编号: </view>
  7. <text>{{ state.params.orderNo }}</text>
  8. </view>
  9. <view class="details-item">
  10. <view> 用户名称: </view>
  11. <text>{{ state.params.customerName }}</text>
  12. </view>
  13. <view class="details-item">
  14. <view> 用户证件类型: </view>
  15. <text>{{ getCodeName('CERTIFICATE_TYPE',state.params.customerIdTypeCode) }}</text>
  16. </view>
  17. <view class="details-item">
  18. <view> 用户证件号: </view>
  19. <text>{{ state.params.customerIdNum }}</text>
  20. </view>
  21. <view class="details-item">
  22. <view> 订单车牌号: </view>
  23. <text style="color: #00b38b">{{ state.params.vehiclePlate }}</text>
  24. </view>
  25. <view class="details-item">
  26. <view> 车牌颜色: </view>
  27. <text style="color: #00b38b">{{getVehiclePlateColor(state.params.vehiclePlateColor)}}</text>
  28. </view>
  29. <view class="details-item">
  30. <view> 收费车型: </view>
  31. <text>{{ state.params.vehicleType }}</text>
  32. </view>
  33. </view>
  34. <view class="title"> 卡信息 </view>
  35. <view class="card">
  36. <view class="card-left">
  37. <image :src="`${$imgUrl}card2.png`" mode=""></image>
  38. <view class="card-center">
  39. <view class="card-center-head"> {{state.params.cardId}} </view>
  40. <view class="tips">
  41. <text>储蓄卡</text>
  42. <text class="tips-card">{{getCodeName('CARD_STATE_TYPE',state.params.cardStatusCode)}}</text>
  43. </view>
  44. <view class="choose-item"> 有效期:{{state.params.cardExpireTime }}</view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="title"> OBU设备信息 </view>
  49. <view class="card">
  50. <view class="card-left">
  51. <image :src="`${$imgUrl}card1.png`" mode=""></image>
  52. <view class="card-center">
  53. <view class="card-center-head"> {{state.params.obuId}} </view>
  54. <view class="tips">
  55. <text class="tips-card">{{getCodeName('OBU_STATE_TYPE',state.params.obuStatusCode)}}</text>
  56. </view>
  57. <view class="choose-item"> 有效期:{{state.params.obuExpireTime }} </view>
  58. </view>
  59. </view>
  60. </view>
  61. <button class="submit" @click="toPage" v-if="!state.flag" :disabled="state.disabled">设备升级</button>
  62. <button class="submit" @click="toBack" v-else>返回服务中心</button>
  63. <view class="mask" v-show="state.showPopup">
  64. <view class="main">
  65. <view class="top">
  66. <image class="icon-close" :src="`${$imgUrl}common/icon-close.png`" @click="cancel"></image>
  67. </view>
  68. <image class="icon-success" :src="`${$imgUrl}bluetooth/card-success.png`"></image>
  69. <view class="title">设备升级成功!</view>
  70. </view>
  71. </view>
  72. </view>
  73. </template>
  74. <script setup>
  75. import {
  76. reactive
  77. } from "vue";
  78. import {
  79. navTo,
  80. getFormatDate,
  81. desensitization
  82. } from "@/utils/utils";
  83. import {
  84. onLoad,
  85. onUnload,
  86. onShow
  87. } from "@dcloudio/uni-app";
  88. import {
  89. request,requestNew
  90. } from "@/utils/network/request.js";
  91. import {deviceUpgradeApply,deviceUpgradeOrderConfirm,commGetDetail,deviceUpgradeConfirm} from "@/utils/network/api.js";
  92. import {
  93. getVehiclePlateColor
  94. } from "@/datas/vehiclePlateColor";
  95. import {
  96. searchVehicleInfoQuery
  97. } from "@/subpackage/after-sale/js/publicRequest";
  98. import {
  99. getCodeName
  100. } from "@/datas/queryKey.js";
  101. import {
  102. IntegerToHexString,
  103. AsciToHexString,
  104. } from "@/utils/util/fileData.js";
  105. import {
  106. stringToJson
  107. } from "@/utils/network/encryption";
  108. import {
  109. getItem
  110. } from "@/utils/storage.ts"
  111. const tools = require("../../../static/etcUtil/tools.js");
  112. const bluetoothUtil = require("../../../static/etcUtil/index.js");
  113. const cmd = require("../../../static/etcUtil/cmdConfig.js");
  114. const state = reactive({
  115. showPopup: false,
  116. flag: false,
  117. disabled: false,
  118. orderId: "",
  119. vehicleId:"",
  120. params:{} //上一个页面传递过来得参数
  121. })
  122. let orderInfo = {};
  123. let cmdRandNum = '';
  124. onLoad((option) => {
  125. state.params = JSON.parse(decodeURIComponent(option.params))
  126. console.log("state.params", state.params)
  127. });
  128. onShow((option) => {
  129. uni.$on('bluetoothLink', res => {
  130. console.log(res);
  131. if (res.status) {
  132. tools.showLoadingAlert("正在执行指令");
  133. state.disabled = true;
  134. deviceUpgradeApplyRequest()
  135. }
  136. })
  137. })
  138. //指令申请
  139. function deviceUpgradeApplyRequest(){
  140. tools.showLoadingAlert("升级中");
  141. const options = {
  142. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  143. showLoading: true,
  144. data: {
  145. orderId: state.params.id,
  146. cardId: state.params.cardId,
  147. obuId: state.params.obuId,
  148. }, //请求参数
  149. method: "POST", //提交方式(默认POST)
  150. };
  151. console.log("options2222", options)
  152. requestNew(deviceUpgradeApply, options)
  153. .then((res) => {
  154. let result = res;
  155. console.log("指令申请", res);
  156. tools.hideLoadingAlert();
  157. let cmdArray = result.cardCmd ? result.cardCmd.split(",") : "";
  158. if (cmdArray.length > 0) {
  159. tools.showLoadingAlert("正在执行指令");
  160. bluetoothUtil.transCmd(cmdArray, result.cmdType.includes('CARD')?"10":'20', function(res) {
  161. tools.hideLoadingAlert();
  162. let status = res[cmdArray.length - 1].substring(res[cmdArray.length - 1].length -
  163. 4, res[cmdArray.length - 1].length);
  164. if (status == "9000") {
  165. deviceUpgradeOrderConfirmRequest(result.cardCmd, result.cosRecordId, res.toString(),result.cmdType);
  166. }
  167. })
  168. }
  169. })
  170. .catch((err) => {
  171. console.log(err);
  172. tools.hideLoadingAlert();
  173. });
  174. }
  175. //设备升级指令回传
  176. function deviceUpgradeOrderConfirmRequest(cmd, cosRecordId, response,cmdType){
  177. tools.showLoadingAlert("加载中");
  178. const options = {
  179. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  180. showLoading: true,
  181. data: {
  182. cardId: state.params.cardId,
  183. obuId: state.params.obuId,
  184. cmd: cmd,
  185. cmdResult: response,
  186. cosRecordId: cosRecordId,
  187. cmdType: cmdType,
  188. vehicleId: state.params.vehicleId,
  189. }, //请求参数
  190. method: "POST", //提交方式(默认POST)
  191. };
  192. console.log("options2222", options)
  193. requestNew(deviceUpgradeOrderConfirm, options)
  194. .then((res) => {
  195. console.log("设备升级指令回传", res);
  196. tools.hideLoadingAlert();
  197. let result = res;
  198. if (result.hasNext) {
  199. tools.showLoadingAlert("执行指令中");
  200. bluetoothUtil.transCmd(result.cmd.split(","), result.cmdType.includes('CARD')?"10":'20', function(res) {
  201. tools.hideLoadingAlert();
  202. let response = res.toString();
  203. deviceUpgradeOrderConfirmRequest(result.cmd, cosRecordId, response,result.cmdType);
  204. });
  205. } else {
  206. bluetoothUtil.transCmd(result.cmd.split(","), result.cmdType.includes('CARD')?"10":'20', function(res) {
  207. tools.hideLoadingAlert();
  208. let response = res.toString();
  209. deviceUpgradeConfirmRequest(result.cmd,cosRecordId,response,result.cmdType);
  210. });
  211. }
  212. })
  213. .catch((err) => {
  214. console.log(err);
  215. tools.hideLoadingAlert();
  216. });
  217. }
  218. //设备升级确认
  219. function deviceUpgradeConfirmRequest(cmd,cosRecordId,cmdResult,cmdType){
  220. const options = {
  221. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  222. showLoading: true,
  223. data: {
  224. cmd,
  225. cosRecordId,
  226. cmdResult,
  227. cmdType,
  228. orderId:state.params.id
  229. }, //请求参数
  230. method: "POST", //提交方式(默认POST)
  231. };
  232. console.log("options2222", options)
  233. requestNew(deviceUpgradeConfirm, options)
  234. .then((res) => {
  235. console.log("设备升级确认", res);
  236. tools.hideLoadingAlert();
  237. state.showPopup = true;
  238. })
  239. .catch((err) => {
  240. console.log(err);
  241. tools.hideLoadingAlert();
  242. });
  243. }
  244. onUnload(() => {
  245. //移除监听
  246. uni.$off('bluetoothLink')
  247. })
  248. //去连接蓝牙
  249. const toPage = () => {
  250. // getDeviceUpgrade()
  251. navTo("/pages/bluetooth/bluetooth?routeType=5"); //去连接蓝牙
  252. };
  253. //返回列表
  254. const toBack = () => {
  255. uni.navigateBack({
  256. delta: 2
  257. })
  258. }
  259. //关闭弹窗
  260. const cancel = () => {
  261. state.flag = true;
  262. state.showPopup = false;
  263. uni.navigateTo({
  264. url: `/subpackage/after-sale/deviceInfo/deviceInfo`
  265. })
  266. }
  267. </script>
  268. <style>
  269. page {
  270. width: 100%;
  271. height: 100%;
  272. background-color: #fff;
  273. }
  274. </style>
  275. <style lang="scss" scoped>
  276. .mask {
  277. background: rgba(0, 0, 0, .35);
  278. position: fixed;
  279. left: 0;
  280. top: 0;
  281. bottom: 0;
  282. right: 0;
  283. }
  284. .main {
  285. width: 560rpx;
  286. padding: 25rpx 20rpx 55rpx;
  287. text-align: center;
  288. background: #fff;
  289. position: absolute;
  290. left: 50%;
  291. top: 50%;
  292. transform: translate(-50%, -50%);
  293. border-radius: 20rpx;
  294. .top {
  295. text-align: right;
  296. .icon-close {
  297. width: 48rpx;
  298. height: 48rpx;
  299. }
  300. }
  301. .icon-success {
  302. width: 500rpx;
  303. height: 320rpx;
  304. margin-top: 22rpx;
  305. }
  306. .title {
  307. color: #333333;
  308. font-size: 40rpx;
  309. font-weight: 600;
  310. text-align: center;
  311. margin-top: 55rpx;
  312. }
  313. }
  314. .selectCar-box {
  315. // width: 100%;
  316. // height: 100%;
  317. padding: 30rpx;
  318. .title {
  319. font-size: 30rpx;
  320. font-family: Microsoft YaHei UI;
  321. font-weight: 400;
  322. color: #333333;
  323. margin-bottom: 30rpx;
  324. }
  325. .details {
  326. .title {
  327. font-size: 30rpx;
  328. font-family: Microsoft YaHei UI;
  329. font-weight: 400;
  330. color: #333333;
  331. margin-bottom: 30rpx;
  332. }
  333. .details-item {
  334. display: flex;
  335. font-size: 26rpx;
  336. font-family: Noto Sans S Chinese;
  337. font-weight: 400;
  338. color: #999999;
  339. margin-bottom: 30rpx;
  340. text {
  341. font-size: 26rpx;
  342. font-family: Noto Sans S Chinese;
  343. font-weight: 400;
  344. color: #333333;
  345. }
  346. }
  347. }
  348. .card {
  349. height: 150rpx;
  350. background: #ffffff;
  351. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  352. border-radius: 20rpx;
  353. padding: 30rpx;
  354. display: flex;
  355. justify-content: space-between;
  356. align-items: center;
  357. margin-bottom: 60rpx;
  358. .card-left {
  359. display: flex;
  360. align-items: center;
  361. image {
  362. width: 100rpx;
  363. height: 90rpx;
  364. }
  365. .card-center {
  366. margin-left: 30rpx;
  367. .card-center-head {
  368. font-size: 32rpx;
  369. font-family: Noto Sans S Chinese;
  370. font-weight: 400;
  371. color: #333333;
  372. }
  373. .tips {
  374. font-size: 26rpx;
  375. font-family: Noto Sans S Chinese;
  376. font-weight: 400;
  377. color: #666666;
  378. .tips-card {
  379. width: 70rpx;
  380. height: 40rpx;
  381. background: #d3f2ef;
  382. border-radius: 6rpx;
  383. font-size: 20rpx;
  384. font-family: Noto Sans S Chinese;
  385. font-weight: 400;
  386. color: #0a8f8a;
  387. padding: 5rpx 10rpx;
  388. margin-left: 20rpx;
  389. }
  390. }
  391. }
  392. }
  393. .choose-item {
  394. margin-right: 20rpx;
  395. height: 50rpx;
  396. border-radius: 50%;
  397. display: flex;
  398. justify-content: flex-start;
  399. align-items: center;
  400. font-size: 25rpx;
  401. align-self: end;
  402. .active {
  403. width: 38rpx;
  404. height: 38rpx;
  405. background: #00b38b;
  406. border-radius: 50%;
  407. }
  408. }
  409. }
  410. .remark {
  411. font-size: 26rpx;
  412. font-family: Microsoft YaHei UI;
  413. font-weight: 400;
  414. color: #666666;
  415. text-indent: 30rpx;
  416. margin-bottom: 30rpx;
  417. }
  418. .submit {
  419. margin-top: 100rpx;
  420. width: 670rpx;
  421. height: 80rpx;
  422. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  423. border-radius: 40rpx;
  424. font-size: 32rpx;
  425. font-family: Noto Sans S Chinese;
  426. font-weight: 400;
  427. color: #ffffff;
  428. line-height: 80rpx;
  429. }
  430. .submit::after {
  431. border: 0;
  432. }
  433. .submit[disabled] {
  434. background: #f0f0f0;
  435. color: #333;
  436. }
  437. }
  438. </style>