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 8.8KB

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