Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

detail.vue 5.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <template>
  2. <view class="top-hint">
  3. <view class="txt">
  4. <image :src="`${$imgUrl}common/icon-tips.png`" mode="aspectFill" class="imgs"></image>
  5. <view>
  6. <text>温馨提示:</text>
  7. <view class="grey-txt">1. ETC挂失业务用于车辆丢失,为确保车主ETC权益,需对ETC设备进行挂失。</view>
  8. <view class="grey-txt">2. 挂失/解挂操作需要4个小时才生效。</view>
  9. </view>
  10. </view>
  11. </view>
  12. <vehicleDetail style="margin-top: -20rpx;" ref="vehicleDetailRef" :vehicleId="state.vehicleId" @getVehicleDetail="getVehicleDetail"></vehicleDetail>
  13. <view class="main-block">
  14. <u-form :model="state.formData" ref="myForm" label-position="left">
  15. <view class="from">
  16. <u-form-item prop="phone">
  17. <view class="from_item" style="background-color: #f7f7f7">
  18. <text><text style="color: red"></text>手机号:</text>
  19. <u-input v-model="state.vehicleInfo.customerTel" :disabled="true" class="input" />
  20. </view>
  21. </u-form-item>
  22. <u-form-item prop="code">
  23. <view class="from_item">
  24. <text><text style="color: red"></text>验证码:</text>
  25. <u-input v-model="state.formData.code" placeholder="请输入验证码" class="input" type="number" />
  26. <view class="hint2">
  27. <view class="green">{{ codeDuration === 0 ? "" : codeDuration }}</view>
  28. <view class="grey" @click="getCode">{{ codeDuration === 0 ? "发送验证码" : "秒后可重发" }}</view>
  29. </view>
  30. </view>
  31. </u-form-item>
  32. </view>
  33. </u-form>
  34. </view>
  35. <view class="action" v-if="state.flag">
  36. <button type="default" class="ui-btn" @click="submit">
  37. {{ state.lossOrUndo ? '卡签挂失' : '解除挂失' }}
  38. </button>
  39. </view>
  40. <view class="bottom-empty-box"></view>
  41. </template>
  42. <script lang="ts" setup>
  43. import { reactive, ref } from "vue";
  44. import { onLoad, onShow } from "@dcloudio/uni-app";
  45. import { confirm, msg } from "@/utils/utils";
  46. import { sendMessage, cardLossUndo } from '@/utils/network/api.js'
  47. import { requestNew } from "@/utils/network/request.js";
  48. import vehicleDetail from '@/components/vehicle-detail/vehicle-detail.vue'
  49. const state = reactive({
  50. vehicleId: '',
  51. orderInfo: {
  52. },
  53. vehicleInfo: {
  54. customerName: '',
  55. customerIdType: '',
  56. customerIdNum: '',
  57. vehicleId: '',
  58. type: '',
  59. cardId: '',
  60. cardType: '',
  61. cardStatus: '',
  62. cardExpireTime: '',
  63. obuId: '',
  64. obuStatus: '',
  65. obuExpireTime: '',
  66. customerTel: ''
  67. },
  68. renewalStatus: '0',
  69. formData: {
  70. code: '',
  71. },
  72. lossOrUndo: true, // true: 挂失 false: 解挂
  73. flag: false // 是否可以操作挂失与解挂
  74. });
  75. const codeDuration = ref(0);
  76. const vehicleDetailRef = ref(null)
  77. let interval = null;
  78. onLoad(({vehicleId}) => {
  79. if (vehicleId) {
  80. state.vehicleId = decodeURIComponent(vehicleId)
  81. }
  82. });
  83. onShow(() => {
  84. });
  85. const submit = () => {
  86. if (!state.formData.code) {
  87. msg(`请填写验证码`);
  88. return false
  89. }
  90. confirm(`是否确认${state.lossOrUndo ? "卡签挂失" : "解除挂失"}?`, () => {
  91. let params = {
  92. businessType: state.lossOrUndo ? 3 : 6,
  93. cardId: state.vehicleInfo.cardId,
  94. code: state.formData.code,
  95. customerTel: state.vehicleInfo.customerTel,
  96. vehicleId: state.vehicleInfo.vehicleId,
  97. obuId: state.vehicleInfo.obuId
  98. }
  99. let options = {
  100. type: 2,
  101. data: params,
  102. method: "POST",
  103. showLoading: true,
  104. };
  105. requestNew(cardLossUndo, options).then(() => {
  106. msg(`${state.lossOrUndo ? "卡签挂失" : "解除挂失"}成功!`);
  107. vehicleDetailRef.value.updateInfo()
  108. })
  109. })
  110. }
  111. // 获取车辆详情
  112. const getVehicleDetail = (res) => {
  113. state.vehicleInfo = res
  114. if (state.vehicleInfo.cardStatus === 'KGS' || state.vehicleInfo.obuStatus === 'BQGS') {
  115. state.flag = true
  116. state.lossOrUndo = false
  117. } else if (state.vehicleInfo.cardStatus == 'ZC' && state.vehicleInfo.obuStatus == 'ZC') {
  118. state.flag = true
  119. state.lossOrUndo = true
  120. } else {
  121. state.flag = false
  122. }
  123. }
  124. const getCode = () => {
  125. if (codeDuration.value !== 0) {
  126. return;
  127. }
  128. const options = {
  129. type: 2,
  130. data: {
  131. mobile: state.vehicleInfo.customerTel,
  132. businessType: 5
  133. },
  134. method: "POST",
  135. showLoading: true,
  136. };
  137. requestNew(sendMessage, options)
  138. .then(() => {
  139. codeInterval();
  140. msg("验证码发送成功!");
  141. })
  142. .catch((err) => {
  143. console.log(err);
  144. });
  145. }
  146. /* 验证码倒计时 */
  147. const codeInterval = () => {
  148. codeDuration.value = 60;
  149. interval = setInterval(() => {
  150. codeDuration.value--;
  151. if (codeDuration.value === 0) {
  152. if (interval) {
  153. clearInterval(interval);
  154. interval = null;
  155. }
  156. }
  157. }, 1000);
  158. };
  159. </script>
  160. <style lang="scss" scoped>
  161. .main-block {
  162. background-color: white;
  163. margin: 20rpx 30rpx 0 30rpx;
  164. border-radius: 12px;
  165. border: 1px solid #FFFFFF;
  166. padding: 20rpx;
  167. overflow: hidden;
  168. .title {
  169. font-weight: bold;
  170. font-size: 30rpx;
  171. color: #01243A;
  172. margin-bottom: 12rpx;
  173. }
  174. }
  175. .renwal-type{
  176. justify-content: space-around;
  177. }
  178. .action {
  179. position: absolute;
  180. left: 0;
  181. height: 270rpx;
  182. background-color: #fff;
  183. border-radius: 30rpx 30rpx 0 0;
  184. width: 100vw;
  185. display: flex;
  186. align-items: center;
  187. justify-content: space-evenly;
  188. flex-direction: column;
  189. margin-top: 20rpx;
  190. }
  191. .from {
  192. ::v-deep .u-form-item {
  193. padding: 0;
  194. line-height: normal;
  195. .u-form-item__message {
  196. margin-bottom: 12rpx;
  197. }
  198. }
  199. .from_item {
  200. display: flex;
  201. flex-wrap: nowrap;
  202. justify-content: space-between;
  203. align-items: center;
  204. height: 80rpx;
  205. border-bottom: 1rpx solid #dcdcdc;
  206. padding: 0 24rpx;
  207. .btn {
  208. font-size: 24rpx;
  209. font-family: Microsoft YaHei;
  210. font-weight: 400;
  211. color: #ffffff;
  212. background: #00b38b;
  213. border-radius: 10rpx;
  214. padding: 10rpx 15rpx;
  215. }
  216. ::v-deep .input {
  217. text-align: left;
  218. flex: 1;
  219. background: transparent;
  220. input {
  221. text-align: left;
  222. }
  223. }
  224. .hint2{
  225. width: 180rpx;
  226. display: flex;
  227. align-items: center;
  228. }
  229. }
  230. }
  231. </style>