Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

cardloss-confirm.vue 8.9KB

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