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.

old-user.vue 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. <template>
  2. <view class="box">
  3. <view class="title">公务车车牌号</view>
  4. <carNumerInput @numberInputResult="numberInputResult">
  5. </carNumerInput>
  6. </view>
  7. <view class="plate-color" @click="chooseColor">
  8. <view class="tit">车牌颜色</view>
  9. <view class="value">{{state.vehiclePlateColorStr}}</view>
  10. <view class="icon">
  11. <image :src="`${$imgUrl}common/arror-right.png`"></image>
  12. </view>
  13. </view>
  14. <view class="btn">
  15. <submit-button title="确定" @submit="submit"></submit-button>
  16. </view>
  17. <!-- <image src="http://222.85.144.89:19002/default-bucket/image/applyCard/brank/gongshang-bg.png"></image> -->
  18. <u-popup v-model="state.showPopup" mode="bottom">
  19. <view v-if="state.showPopup">
  20. <popup-numberplate-color :numberplateCor="state.curNumberplateColor" :numberplate="state.numberplate"
  21. @numberplateResult="numberplateResult">
  22. </popup-numberplate-color>
  23. </view>
  24. </u-popup>
  25. </template>
  26. <script setup lang="ts">
  27. import {
  28. reactive
  29. } from "vue";
  30. import {
  31. onLoad
  32. } from "@dcloudio/uni-app";
  33. import {
  34. msg,
  35. navTo
  36. } from '@/utils/utils';
  37. import {
  38. request
  39. } from "@/utils/network/request.js";
  40. import {
  41. gongWuChefindFormatVehicleInfo,
  42. gongWuCheDanWeiJinDu
  43. } from "@/utils/network/api.js";
  44. import {
  45. stringToJson
  46. } from "@/utils/network/encryption";
  47. import popupNumberplateColor from "./components/popup-choose-numberplate-color";
  48. import carNumerInput from "@/components/car-number-input/car-number-input";
  49. const tools = require("../static/etcUtil/tools.js");
  50. onLoad((option) => {
  51. console.log(option);
  52. })
  53. const state = reactive({
  54. //显示车牌颜色选择popup
  55. showPopup: false,
  56. //当前选择的车牌颜色
  57. curNumberplateColor: {
  58. id: -1
  59. },
  60. vehiclePlateColor: 0,
  61. vehiclePlateColorStr: "请选择车牌颜色",
  62. numberplate: "",
  63. })
  64. //车牌颜色选择回调结果
  65. const numberplateResult = (colorItem: any) => {
  66. console.log(colorItem);
  67. state.vehiclePlateColor = colorItem.id;
  68. state.vehiclePlateColorStr = colorItem.title;
  69. state.showPopup = false;
  70. }
  71. const numberInputResult = (e:string) => {
  72. state.numberplate = e;
  73. }
  74. const chooseColor = () => {
  75. state.showPopup = true
  76. }
  77. //提交换货申请
  78. const submit = () => {
  79. if (state.numberplate.trim().length < 7) {
  80. msg('请输入正确车牌号');
  81. return
  82. }
  83. if (isVehicleNumber(state.numberplate.trim())) {
  84. msg('请输入车牌号格式不正确');
  85. }
  86. const options = {
  87. type: 2,
  88. data: {
  89. vehPlateNo: state.numberplate,
  90. vehPlateNoColor: state.vehiclePlateColor,
  91. },
  92. method: "POST",
  93. showLoading: true,
  94. };
  95. request(gongWuChefindFormatVehicleInfo, options).then((res: any) => {
  96. const result = stringToJson(res.bizContent)
  97. console.log(result);
  98. getGongWuCheDanWeiJinDu(result.fvehClass, result.fvehPlateColor, result.fvehPlateNo, result.deptName);
  99. })
  100. }
  101. const getGongWuCheDanWeiJinDu = (vehicleType: number, vehiclePlateColor: number, vehiclePlate: string, deptName:
  102. string) => {
  103. const options = {
  104. type: 2,
  105. data: {
  106. vehicleId: vehiclePlate + "_" + vehiclePlateColor,
  107. vehicleType: vehicleType,
  108. },
  109. method: "POST",
  110. showLoading: true,
  111. };
  112. request(gongWuCheDanWeiJinDu, options).then((res: any) => {
  113. const result = stringToJson(res.bizContent)
  114. console.log(result);
  115. if (result) {
  116. //成功调到查询界面
  117. tools.showModalAlert("历史用户信息检测成功,请您前往特制卡申请进行单位查询", function(res) {
  118. if (res.confirm) { //确定
  119. // tools.toUrl(route.scompnayQuery + '?deptShortName=' + deptShortName)
  120. navTo("/issueActivation/query-company-list?deptShortName=" + deptName)
  121. return;
  122. }
  123. });
  124. } else {
  125. tools.showModalAlert("未检测到历史用户信息,是否前往特制卡申请进行新增单位", function(res) {
  126. if (res.confirm) { //确定
  127. // tools.toUrl(route.scompnayQuery)
  128. navTo("/issueActivation/query-company-list")
  129. return;
  130. }
  131. }, null, "", true);
  132. }
  133. })
  134. }
  135. //车牌号验证方法
  136. function isVehicleNumber(vehicleNumber: string) {
  137. var xreg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/;
  138. var creg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/;
  139. if (vehicleNumber.length == 7) {
  140. return creg.test(vehicleNumber);
  141. } else if (vehicleNumber.length == 8) {
  142. return xreg.test(vehicleNumber);
  143. } else {
  144. return false;
  145. }
  146. }
  147. </script>
  148. <style>
  149. page {
  150. background-color: #EEF7F7;
  151. }
  152. </style>
  153. <style lang="scss" scoped>
  154. .title {
  155. font-size: 32rpx;
  156. font-weight: bold;
  157. padding-bottom: 20rpx;
  158. padding-left: 20rpx;
  159. }
  160. .plate-color {
  161. display: flex;
  162. align-items: center;
  163. margin: 30rpx 30rpx 60rpx 30rpx;
  164. padding: 20rpx 0;
  165. border-bottom: 1px solid #ddd;
  166. }
  167. .plate-color .tit {
  168. font-size: 32rpx;
  169. padding-right: 20rpx;
  170. color: #666;
  171. }
  172. .plate-color .value {
  173. flex: 1;
  174. font-size: 32rpx;
  175. }
  176. .plate-color image {
  177. width: 36rpx;
  178. height: 36rpx;
  179. }
  180. .box {
  181. margin: 30rpx 0rpx;
  182. padding: 0 30rpx;
  183. }
  184. .btn {
  185. padding: 0 30rpx;
  186. }
  187. </style>