You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

cardloss-confirm.vue 9.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435
  1. <template>
  2. <view class="selectCar-box">
  3. <view class="details">
  4. <view class="title">
  5. 基础信息
  6. </view>
  7. <view class="details-item">
  8. <view>
  9. 订单编号:
  10. </view>
  11. <text>{{state.data.orderId}}</text>
  12. </view>
  13. <view class="details-item">
  14. <view>
  15. 用户名称:
  16. </view>
  17. <text>{{state.data.customerName}}</text>
  18. </view>
  19. <view class="details-item">
  20. <view>
  21. 用户证件类型:
  22. </view>
  23. <text>{{getCodeName('CERTIFICATE_TYPE',state.data.customerIdtype)}}</text>
  24. </view>
  25. <view class="details-item">
  26. <view>
  27. 用户证件号:
  28. </view>
  29. <text>{{state.data.customerIdnum}}</text>
  30. </view>
  31. <view class="details-item">
  32. <view>
  33. 订单车牌号:
  34. </view>
  35. <text style="color: #00B38B;;">{{state.data.vehiclePlate}}</text>
  36. </view>
  37. <view class="details-item">
  38. <view>
  39. 收费车型:
  40. </view>
  41. <text>{{state.data.vehicleType}}</text>
  42. </view>
  43. </view>
  44. <view class="title">
  45. 卡信息
  46. </view>
  47. <view class="card">
  48. <view class="card-left">
  49. <image :src="`${$imgUrl}card2.png`" mode=""></image>
  50. <view class="card-center">
  51. <view class="card-center-head">
  52. {{state.data.cardId}}
  53. </view>
  54. <view class="tips">
  55. <text>储蓄卡</text>
  56. <text class="tips-card">{{getCodeName('CARD_STATE_TYPE',state.data.cardStatus)}}</text>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="choose-item" @click="choose(1)">
  61. <view class="active" v-if="flag.includes(1)">
  62. </view>
  63. </view>
  64. </view>
  65. <view class="title">
  66. OBU设备信息
  67. </view>
  68. <view class="card">
  69. <view class="card-left">
  70. <image :src="`${$imgUrl}card1.png`" mode=""></image>
  71. <view class="card-center">
  72. <view class="card-center-head">
  73. {{state.data.obuId}}
  74. </view>
  75. <view class="tips">
  76. <!-- <text>储蓄卡</text> -->
  77. <text class="tips-card">{{getCodeName('OBU_STATE_TYPE',state.data.obuStatus)}}</text>
  78. </view>
  79. </view>
  80. </view>
  81. <view class="choose-item" @click="choose(2)">
  82. <view class="active" v-if="flag.includes(2)">
  83. </view>
  84. </view>
  85. </view>
  86. <button class="submit" @click="nextACtion">下一步</button>
  87. </view>
  88. </template>
  89. <script lang="ts" setup>
  90. import {
  91. getCodeName
  92. } from "@/datas/queryKey.js";
  93. import {
  94. reactive,
  95. ref
  96. } from "vue"
  97. import {
  98. navTo
  99. } from "@/utils/utils"
  100. import {
  101. onLoad,
  102. onUnload,
  103. onShow
  104. } from "@dcloudio/uni-app";
  105. import {
  106. request
  107. } from "@/utils/network/request.js";
  108. import {
  109. orderDetail,
  110. CardlossStatus
  111. } from "@/utils/network/api.js";
  112. import {
  113. msg
  114. } from "@/utils/utils";
  115. import {
  116. getCredentialType
  117. } from "@/datas/credentialType.js";
  118. import {
  119. getEtcCardStatus
  120. } from "@/datas/etcCardStatus.js";
  121. import {
  122. getObuStatus
  123. } from "@/datas/obuStatus.js";
  124. import {
  125. stringToJson
  126. } from "@/utils/network/encryption";
  127. const state = reactive({
  128. id: "",
  129. data: {
  130. cardStatus: undefined,
  131. obuStatus: undefined,
  132. },
  133. successTip: "" //成功提示
  134. });
  135. const flag = reactive([])
  136. const type = ref('')
  137. /*视图进入后操作*/
  138. onShow(() => {
  139. queryOrderDetail(state.id).then((val : any) => {
  140. state.data = val
  141. })
  142. })
  143. onLoad((option) => {
  144. state.id = option.id
  145. /*监听手机号验证后的回调*/
  146. uni.$on('queryCardlossStatus', function (type) {
  147. console.log("1111", type)
  148. queryCardlossStatusType(type.type).then((val : any) => {
  149. console.log("val", val)
  150. navTo(
  151. `/subpackage/after-sale/card-loss-reporting/card-result?successTip=${type.successTip}`
  152. )
  153. });
  154. })
  155. });
  156. onUnload(() => {
  157. /*移除监听*/
  158. uni.$off('queryCardlossStatus')
  159. });
  160. /*下一步*/
  161. const nextACtion = () => {
  162. console.log(flag.length)
  163. if (flag.length === 0) {
  164. uni.showToast({
  165. title: '请至少勾选一项',
  166. });
  167. } else if (flag.length === 1) {
  168. if (type.value === '1') {
  169. //卡正常
  170. if (state.data.cardStatus === 1) {
  171. showModelAction('卡挂失', '请确认是否执行卡挂失操作', 1)
  172. } else if (state.data.cardStatus === 6) {
  173. showModelAction('卡解挂', '请确认是否执行卡解挂操作', 4)
  174. } else {
  175. msg('当前的卡不支持设备挂失/解挂操作')
  176. }
  177. } else if (type.value === '2') {
  178. //obu正常
  179. if (state.data.obuStatus === 1) {
  180. showModelAction('设备挂失', '请确认是否执行设备挂失操作', 2)
  181. } else if (state.data.obuStatus === 6) {
  182. showModelAction('设备解挂', '请确认是否执行签解挂操作', 5)
  183. } else {
  184. msg('当前的卡不支持设备挂失/解挂操作')
  185. }
  186. }
  187. } else if (flag.length === 2) {
  188. console.log('两个一起')
  189. if ((state.data.cardStatus !== state.data.obuStatus)) {
  190. msg('当前的卡状态和obu状态不支持批量操作')
  191. return;
  192. }
  193. if (type.value === '3') {
  194. if (state.data.cardStatus && state.data.obuStatus === 1) {
  195. showModelAction('卡签挂失', '请确认是否执行卡签挂失操作', 3)
  196. } else {
  197. showModelAction('卡签解挂', '请确认是否执行卡签解挂操作', 6)
  198. }
  199. }
  200. }
  201. }
  202. const showModelAction = (title, content, type) => {
  203. uni.showModal({
  204. title: title,
  205. content: content,
  206. success: function (res) {
  207. if (res.confirm) {
  208. navTo(
  209. `/subpackage/after-sale/card-loss-reporting/cardloss?type=${type}&&mobile=${state.data.customerTel}&&successTip=${title}`
  210. )
  211. }
  212. }
  213. });
  214. }
  215. const choose = (data) => {
  216. if (!flag.includes(data)) {
  217. flag.push(data)
  218. console.log(flag);
  219. } else {
  220. flag.splice(flag.indexOf(data), 1)
  221. console.log(flag);
  222. }
  223. if (flag.length == 2) {
  224. type.value = '3'
  225. } else if (flag[0] == 1) {
  226. type.value = '1'
  227. } else {
  228. type.value = '2'
  229. }
  230. }
  231. const queryOrderDetail = (id) => {
  232. return new Promise(async (resolve, reject) => {
  233. const res = await request(orderDetail, {
  234. type: 2,
  235. data: {
  236. id: id
  237. },
  238. method: "POST",
  239. showLoading: true,
  240. });
  241. const data = stringToJson(res.bizContent);
  242. resolve(data);
  243. }).catch((error) => {
  244. reject(error);
  245. });
  246. }
  247. const queryCardlossStatusType = (val : any) => {
  248. var data = {
  249. cardId: state.data.cardId,
  250. obuId: state.data.obuId,
  251. operation: val,
  252. orderId: state.data.orderId
  253. };
  254. const options = {
  255. type: 2,
  256. data: data,
  257. method: "POST",
  258. showLoading: true,
  259. };
  260. return new Promise(async (resolve, reject) => {
  261. const res = await request(CardlossStatus, options);
  262. const data = stringToJson(res.bizContent);
  263. resolve(data);
  264. }).catch((error) => {
  265. reject(error);
  266. });
  267. }
  268. </script>
  269. <style>
  270. page {
  271. width: 100%;
  272. height: 100%;
  273. background-color: #fff;
  274. }
  275. </style>
  276. <style lang="scss" scoped>
  277. .selectCar-box {
  278. // width: 100%;
  279. // height: 100%;
  280. padding: 30rpx;
  281. .title {
  282. font-size: 30rpx;
  283. font-family: Microsoft YaHei UI;
  284. font-weight: 400;
  285. color: #333333;
  286. margin-bottom: 30rpx;
  287. }
  288. .details {
  289. .title {
  290. font-size: 30rpx;
  291. font-family: Microsoft YaHei UI;
  292. font-weight: 400;
  293. color: #333333;
  294. margin-bottom: 30rpx;
  295. }
  296. .details-item {
  297. display: flex;
  298. font-size: 26rpx;
  299. font-family: Noto Sans S Chinese;
  300. font-weight: 400;
  301. color: #999999;
  302. margin-bottom: 30rpx;
  303. text {
  304. font-size: 26rpx;
  305. font-family: Noto Sans S Chinese;
  306. font-weight: 400;
  307. color: #333333;
  308. }
  309. }
  310. }
  311. .card {
  312. height: 150rpx;
  313. background: #FFFFFF;
  314. box-shadow: 0rpx 4rpx 13rpx 3rpx rgba(223, 223, 223, 0.8);
  315. border-radius: 20rpx;
  316. padding: 30rpx;
  317. display: flex;
  318. justify-content: space-between;
  319. align-items: center;
  320. margin-bottom: 60rpx;
  321. .card-left {
  322. display: flex;
  323. align-items: center;
  324. image {
  325. width: 100rpx;
  326. height: 90rpx;
  327. }
  328. .card-center {
  329. margin-left: 30rpx;
  330. .card-center-head {
  331. font-size: 32rpx;
  332. font-family: Noto Sans S Chinese;
  333. font-weight: 400;
  334. color: #333333;
  335. }
  336. .tips {
  337. font-size: 26rpx;
  338. font-family: Noto Sans S Chinese;
  339. font-weight: 400;
  340. color: #666666;
  341. .tips-card {
  342. width: 70rpx;
  343. height: 40rpx;
  344. background: #D3F2EF;
  345. border-radius: 6rpx;
  346. font-size: 20rpx;
  347. font-family: Noto Sans S Chinese;
  348. font-weight: 400;
  349. color: #0A8F8A;
  350. padding: 5rpx 10rpx;
  351. margin-left: 20rpx;
  352. }
  353. }
  354. }
  355. }
  356. .choose-item {
  357. margin-right: 20rpx;
  358. width: 50rpx;
  359. height: 50rpx;
  360. border: 1rpx solid #00B38B;
  361. border-radius: 50%;
  362. display: flex;
  363. justify-content: center;
  364. align-items: center;
  365. .active {
  366. width: 38rpx;
  367. height: 38rpx;
  368. background: #00B38B;
  369. border-radius: 50%;
  370. }
  371. }
  372. }
  373. .remark {
  374. font-size: 26rpx;
  375. font-family: Microsoft YaHei UI;
  376. font-weight: 400;
  377. color: #666666;
  378. text-indent: 30rpx;
  379. margin-bottom: 30rpx;
  380. }
  381. .submit {
  382. margin-top: 100rpx;
  383. width: 670rpx;
  384. height: 80rpx;
  385. background: linear-gradient(-90deg, #43A1E0 0%, #13E7C1 100%);
  386. border-radius: 40rpx;
  387. font-size: 32rpx;
  388. font-family: Noto Sans S Chinese;
  389. font-weight: 400;
  390. color: #FFFFFF;
  391. line-height: 80rpx;
  392. }
  393. }
  394. </style>