Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

upgrade-confirm.vue 11KB

2 лет назад
10 месяцев назад
2 лет назад
10 месяцев назад
2 лет назад
1 неделю назад
2 лет назад
10 месяцев назад
2 лет назад
10 месяцев назад
2 лет назад
10 месяцев назад
2 лет назад
10 месяцев назад
2 лет назад
10 месяцев назад
2 лет назад
10 месяцев назад
2 лет назад
10 месяцев назад
2 лет назад
10 месяцев назад
2 лет назад
10 месяцев назад
2 лет назад
10 месяцев назад
2 лет назад
1 год назад
2 лет назад
2 лет назад
1 год назад
2 лет назад
10 месяцев назад
2 лет назад
10 месяцев назад
1 год назад
2 лет назад
1 год назад
2 лет назад
10 месяцев назад
2 лет назад
1 год назад
2 лет назад
10 месяцев назад
1 год назад
1 год назад
2 лет назад
10 месяцев назад
2 лет назад
10 месяцев назад
2 лет назад
10 месяцев назад
10 месяцев назад
10 месяцев назад
10 месяцев назад
10 месяцев назад
10 месяцев назад
10 месяцев назад
10 месяцев назад
10 месяцев назад
10 месяцев назад
10 месяцев назад
10 месяцев назад
10 месяцев назад
10 месяцев назад
10 месяцев назад
10 месяцев назад
10 месяцев назад
10 месяцев назад
10 месяцев назад
10 месяцев назад
10 месяцев назад
10 месяцев назад
10 месяцев назад
10 месяцев назад
10 месяцев назад
10 месяцев назад
10 месяцев назад
10 месяцев назад
10 месяцев назад
2 лет назад
10 месяцев назад
2 лет назад
10 месяцев назад
2 лет назад
1 год назад
2 лет назад
1 год назад
2 лет назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  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('ID_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. } from "@/utils/util/fileData.js";
  104. import {
  105. stringToJson
  106. } from "@/utils/network/encryption";
  107. import {
  108. getItem
  109. } from "@/utils/storage.ts"
  110. const tools = require("../../../static/etcUtil/tools.js");
  111. const bluetoothUtil = require("../../../static/etcUtil/index.js");
  112. const cmd = require("../../../static/etcUtil/cmdConfig.js");
  113. const state = reactive({
  114. showPopup: false,
  115. flag: false,
  116. disabled: false,
  117. orderId: "",
  118. vehicleId:"",
  119. params:{} //上一个页面传递过来得参数
  120. })
  121. let orderInfo = {};
  122. let cmdRandNum = '';
  123. onLoad((option) => {
  124. state.params = JSON.parse(decodeURIComponent(option.params))
  125. console.log("state.params", state.params)
  126. });
  127. onShow((option) => {
  128. uni.$on('bluetoothLink', res => {
  129. console.log(res);
  130. if (res.status) {
  131. tools.showLoadingAlert("正在执行指令");
  132. state.disabled = true;
  133. deviceUpgradeApplyRequest()
  134. }
  135. })
  136. })
  137. //指令申请
  138. function deviceUpgradeApplyRequest(){
  139. tools.showLoadingAlert("升级中");
  140. const options = {
  141. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  142. showLoading: true,
  143. data: {
  144. orderId: state.params.id,
  145. cardId: state.params.cardId,
  146. obuId: state.params.obuId,
  147. }, //请求参数
  148. method: "POST", //提交方式(默认POST)
  149. };
  150. console.log("options2222", options)
  151. requestNew(deviceUpgradeApply, options)
  152. .then((res) => {
  153. let result = res;
  154. console.log("指令申请", res);
  155. tools.hideLoadingAlert();
  156. let cmdArray = result.cardCmd ? result.cardCmd.split(",") : "";
  157. if (cmdArray.length > 0) {
  158. tools.showLoadingAlert("正在执行指令");
  159. bluetoothUtil.transCmd(cmdArray, result.cmdType.includes('CARD')?"10":'20', function(res) {
  160. tools.hideLoadingAlert();
  161. let status = res[cmdArray.length - 1].substring(res[cmdArray.length - 1].length -
  162. 4, res[cmdArray.length - 1].length);
  163. if (status == "9000") {
  164. deviceUpgradeOrderConfirmRequest(result.cardCmd, result.cosRecordId, res.toString(),result.cmdType);
  165. }
  166. })
  167. }
  168. })
  169. .catch((err) => {
  170. console.log(err);
  171. tools.hideLoadingAlert();
  172. });
  173. }
  174. //设备升级指令回传
  175. function deviceUpgradeOrderConfirmRequest(cmd, cosRecordId, response,cmdType){
  176. tools.showLoadingAlert("加载中");
  177. const options = {
  178. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  179. showLoading: true,
  180. data: {
  181. cardId: state.params.cardId,
  182. obuId: state.params.obuId,
  183. cmd: cmd,
  184. cmdResult: response,
  185. cosRecordId: cosRecordId,
  186. cmdType: cmdType,
  187. vehicleId: state.params.vehicleId,
  188. }, //请求参数
  189. method: "POST", //提交方式(默认POST)
  190. };
  191. console.log("options2222", options)
  192. requestNew(deviceUpgradeOrderConfirm, options)
  193. .then((res) => {
  194. console.log("设备升级指令回传", res);
  195. tools.hideLoadingAlert();
  196. let result = res;
  197. if (result.hasNext) {
  198. tools.showLoadingAlert("执行指令中");
  199. bluetoothUtil.transCmd(result.cmd.split(","), result.cmdType.includes('CARD')?"10":'20', function(res) {
  200. tools.hideLoadingAlert();
  201. let response = res.toString();
  202. deviceUpgradeOrderConfirmRequest(result.cmd, cosRecordId, response,result.cmdType);
  203. });
  204. } else {
  205. bluetoothUtil.transCmd(result.cmd.split(","), result.cmdType.includes('CARD')?"10":'20', function(res) {
  206. tools.hideLoadingAlert();
  207. let response = res.toString();
  208. deviceUpgradeConfirmRequest(result.cmd,cosRecordId,response,result.cmdType);
  209. });
  210. }
  211. })
  212. .catch((err) => {
  213. console.log(err);
  214. tools.hideLoadingAlert();
  215. });
  216. }
  217. //设备升级确认
  218. function deviceUpgradeConfirmRequest(cmd,cosRecordId,cmdResult,cmdType){
  219. const options = {
  220. type: 2, //type: 2,JSON格式提交数据(默认表单形式提交)
  221. showLoading: true,
  222. data: {
  223. cmd,
  224. cosRecordId,
  225. cmdResult,
  226. cmdType,
  227. orderId:state.params.id
  228. }, //请求参数
  229. method: "POST", //提交方式(默认POST)
  230. };
  231. console.log("options2222", options)
  232. requestNew(deviceUpgradeConfirm, options)
  233. .then((res) => {
  234. console.log("设备升级确认", res);
  235. tools.hideLoadingAlert();
  236. state.showPopup = true;
  237. })
  238. .catch((err) => {
  239. console.log(err);
  240. tools.hideLoadingAlert();
  241. });
  242. }
  243. onUnload(() => {
  244. //移除监听
  245. uni.$off('bluetoothLink')
  246. })
  247. //去连接蓝牙
  248. const toPage = () => {
  249. // getDeviceUpgrade()
  250. navTo("/pages/bluetooth/bluetooth?routeType=5"); //去连接蓝牙
  251. };
  252. //返回列表
  253. const toBack = () => {
  254. uni.navigateBack({
  255. delta: 2
  256. })
  257. }
  258. //关闭弹窗
  259. const cancel = () => {
  260. state.flag = true;
  261. state.showPopup = false;
  262. uni.navigateTo({
  263. url: `/subpackage/after-sale/deviceInfo/deviceInfo`
  264. })
  265. }
  266. </script>
  267. <style>
  268. page {
  269. width: 100%;
  270. height: 100%;
  271. background-color: #fff;
  272. }
  273. </style>
  274. <style lang="scss" scoped>
  275. .mask {
  276. background: rgba(0, 0, 0, .35);
  277. position: fixed;
  278. left: 0;
  279. top: 0;
  280. bottom: 0;
  281. right: 0;
  282. }
  283. .main {
  284. width: 560rpx;
  285. padding: 25rpx 20rpx 55rpx;
  286. text-align: center;
  287. background: #fff;
  288. position: absolute;
  289. left: 50%;
  290. top: 50%;
  291. transform: translate(-50%, -50%);
  292. border-radius: 20rpx;
  293. .top {
  294. text-align: right;
  295. .icon-close {
  296. width: 48rpx;
  297. height: 48rpx;
  298. }
  299. }
  300. .icon-success {
  301. width: 500rpx;
  302. height: 320rpx;
  303. margin-top: 22rpx;
  304. }
  305. .title {
  306. color: #333333;
  307. font-size: 40rpx;
  308. font-weight: 600;
  309. text-align: center;
  310. margin-top: 55rpx;
  311. }
  312. }
  313. .selectCar-box {
  314. // width: 100%;
  315. // height: 100%;
  316. padding: 30rpx;
  317. .title {
  318. font-size: 30rpx;
  319. font-family: Microsoft YaHei UI;
  320. font-weight: 400;
  321. color: #333333;
  322. margin-bottom: 30rpx;
  323. }
  324. .details {
  325. .title {
  326. font-size: 30rpx;
  327. font-family: Microsoft YaHei UI;
  328. font-weight: 400;
  329. color: #333333;
  330. margin-bottom: 30rpx;
  331. }
  332. .details-item {
  333. display: flex;
  334. font-size: 26rpx;
  335. font-family: Noto Sans S Chinese;
  336. font-weight: 400;
  337. color: #999999;
  338. margin-bottom: 30rpx;
  339. text {
  340. font-size: 26rpx;
  341. font-family: Noto Sans S Chinese;
  342. font-weight: 400;
  343. color: #333333;
  344. }
  345. }
  346. }
  347. .card {
  348. height: 150rpx;
  349. background: #ffffff;
  350. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  351. border-radius: 20rpx;
  352. padding: 30rpx;
  353. display: flex;
  354. justify-content: space-between;
  355. align-items: center;
  356. margin-bottom: 60rpx;
  357. .card-left {
  358. display: flex;
  359. align-items: center;
  360. image {
  361. width: 100rpx;
  362. height: 90rpx;
  363. }
  364. .card-center {
  365. margin-left: 30rpx;
  366. .card-center-head {
  367. font-size: 32rpx;
  368. font-family: Noto Sans S Chinese;
  369. font-weight: 400;
  370. color: #333333;
  371. }
  372. .tips {
  373. font-size: 26rpx;
  374. font-family: Noto Sans S Chinese;
  375. font-weight: 400;
  376. color: #666666;
  377. .tips-card {
  378. width: 70rpx;
  379. height: 40rpx;
  380. background: #d3f2ef;
  381. border-radius: 6rpx;
  382. font-size: 20rpx;
  383. font-family: Noto Sans S Chinese;
  384. font-weight: 400;
  385. color: #0a8f8a;
  386. padding: 5rpx 10rpx;
  387. margin-left: 20rpx;
  388. }
  389. }
  390. }
  391. }
  392. .choose-item {
  393. margin-right: 20rpx;
  394. height: 50rpx;
  395. border-radius: 50%;
  396. display: flex;
  397. justify-content: flex-start;
  398. align-items: center;
  399. font-size: 25rpx;
  400. align-self: end;
  401. .active {
  402. width: 38rpx;
  403. height: 38rpx;
  404. background: #00b38b;
  405. border-radius: 50%;
  406. }
  407. }
  408. }
  409. .remark {
  410. font-size: 26rpx;
  411. font-family: Microsoft YaHei UI;
  412. font-weight: 400;
  413. color: #666666;
  414. text-indent: 30rpx;
  415. margin-bottom: 30rpx;
  416. }
  417. .submit {
  418. margin-top: 100rpx;
  419. width: 670rpx;
  420. height: 80rpx;
  421. background: linear-gradient(-90deg, #43a1e0 0%, #13e7c1 100%);
  422. border-radius: 40rpx;
  423. font-size: 32rpx;
  424. font-family: Noto Sans S Chinese;
  425. font-weight: 400;
  426. color: #ffffff;
  427. line-height: 80rpx;
  428. }
  429. .submit::after {
  430. border: 0;
  431. }
  432. .submit[disabled] {
  433. background: #f0f0f0;
  434. color: #333;
  435. }
  436. }
  437. </style>