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.

old-user.vue 5.8KB

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