Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

cardloss-confirm.vue 8.9KB

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