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

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