123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- <template>
- <view class="box">
- <view class="title">公务车车牌号</view>
- <carNumerInput @numberInputResult="numberInputResult">
- </carNumerInput>
- </view>
- <!-- <view class="plate-color" @click="chooseColor">
- <view class="tit">车牌颜色</view>
- <view class="value">{{state.vehiclePlateColorStr}}</view>
- <view class="icon">
- <image :src="`${$imgUrl}common/arror-right.png`"></image>
- </view>
- </view> -->
- <!-- 车牌颜色 -->
- <view class="plate-color">
- <view class="title">选择车牌颜色</view>
- <numberplateColor :numberplate="state.numberplate?state.numberplate:state.vehiclePlateNumber" :numberplateCor="{ id: 0 }"
- @numberplateResult="checkNumberplateColor">
- </numberplateColor>
- </view>
- <view class="btn">
- <submit-button title="确定" @submit="submit"></submit-button>
- </view>
- <!-- <image src="http://222.85.144.89:19002/default-bucket/image/applyCard/brank/gongshang-bg.png"></image> -->
- <u-popup v-model="state.showPopup" mode="bottom">
- <view v-if="state.showPopup">
- <popup-numberplate-color :numberplateCor="state.curNumberplateColor" :numberplate="state.numberplate"
- @numberplateResult="numberplateResult">
- </popup-numberplate-color>
- </view>
- </u-popup>
- </template>
-
- <script setup lang="ts">
- import {
- reactive
- } from "vue";
- import {
- onLoad
- } from "@dcloudio/uni-app";
- import {
- msg,
- navTo
- } from '@/utils/utils';
- import {
- request
- } from "@/utils/network/request.js";
- import {
- gongWuChefindFormatVehicleInfo,
- gongWuCheDanWeiJinDu
- } from "@/utils/network/api.js";
- import {
- stringToJson
- } from "@/utils/network/encryption";
- import popupNumberplateColor from "./components/popup-choose-numberplate-color";
- import numberplateColor from "./components/layout-numberplate-color";
- import carNumerInput from "@/components/car-number-input/car-number-input";
- const tools = require("../../../static/etcUtil/tools.js");
-
- onLoad((option) => {
- console.log(option);
- })
-
- const state = reactive({
- //显示车牌颜色选择popup
- showPopup: false,
- //当前选择的车牌颜色
- curNumberplateColor: {
- id: -1
- },
- vehiclePlateColor: 0,
- vehiclePlateColorStr: "请选择车牌颜色",
- numberplate: "",
- vehiclePlateNumber: "贵A12345",
-
- })
-
- /* 选择车牌颜色 */
- const checkNumberplateColor = (item : any) => {
- state.vehiclePlateColor = item.id;
- // state.vehiclePlateColorStr = colorItem.title;
- };
-
- //车牌颜色选择回调结果
- const numberplateResult = (colorItem : any) => {
- console.log(colorItem);
- state.vehiclePlateColor = colorItem.id;
- state.vehiclePlateColorStr = colorItem.title;
- state.showPopup = false;
- }
-
- const numberInputResult = (e : string) => {
- state.numberplate = e;
- }
-
- const chooseColor = () => {
- state.showPopup = true
- }
-
- //提交换货申请
- const submit = () => {
- if (state.numberplate.trim().length < 7) {
- msg('请输入正确车牌号');
- return
- }
- if (isVehicleNumber(state.numberplate.trim())) {
- msg('请输入车牌号格式不正确');
- }
- const options = {
- type: 2,
- data: {
- vehPlateNo: state.numberplate,
- vehPlateNoColor: state.vehiclePlateColor,
- },
- method: "POST",
- showLoading: true,
- };
- request(gongWuChefindFormatVehicleInfo, options).then((res : any) => {
-
-
- const result = stringToJson(res.bizContent)
- console.log(result);
-
- getGongWuCheDanWeiJinDu(result.fvehClass, result.fvehPlateColor, result.fvehPlateNo, result.deptName);
-
-
- })
- }
-
- const getGongWuCheDanWeiJinDu = (vehicleType : number, vehiclePlateColor : number, vehiclePlate : string, deptName :
- string) => {
-
- const options = {
- type: 2,
- data: {
- vehicleId: vehiclePlate + "_" + vehiclePlateColor,
- vehicleType: vehicleType,
- },
- method: "POST",
- showLoading: true,
- };
- request(gongWuCheDanWeiJinDu, options).then((res : any) => {
-
-
- const result = stringToJson(res.bizContent)
- console.log(result);
-
- if (result) {
- //成功调到查询界面
- tools.showModalAlert("历史用户信息检测成功,请您前往特制卡申请进行单位查询", function (res) {
- if (res.confirm) { //确定
- // tools.toUrl(route.scompnayQuery + '?deptShortName=' + deptShortName)
- navTo("/subpackage/issueActivation/query-company-list?deptShortName=" + deptName)
- return;
- }
- });
-
- } else {
- tools.showModalAlert("未检测到历史用户信息,是否前往特制卡申请进行新增单位", function (res) {
- if (res.confirm) { //确定
- // tools.toUrl(route.scompnayQuery)
- navTo("/subpackage/issueActivation/query-company-list")
- return;
- }
- }, null, "", true);
- }
- })
-
- }
-
- //车牌号验证方法
- function isVehicleNumber(vehicleNumber : string) {
-
- var xreg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/;
-
- var creg = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/;
-
- if (vehicleNumber.length == 7) {
-
- return creg.test(vehicleNumber);
-
- } else if (vehicleNumber.length == 8) {
-
- return xreg.test(vehicleNumber);
-
- } else {
-
- return false;
-
- }
-
- }
- </script>
- <style>
- page {
- background-color: #EEF7F7;
- }
- </style>
-
- <style lang="scss" scoped>
- .title {
- font-size: 32rpx;
- font-weight: bold;
- padding-bottom: 20rpx;
- padding-left: 20rpx;
- }
-
- .plate-color {
- display: flex;
- // align-items: center;
- flex-direction: column;
- margin: 30rpx 30rpx 60rpx 30rpx;
- padding: 20rpx 0;
- // border-bottom: 1px solid #ddd;
- }
-
- .plate-color .tit {
- font-size: 32rpx;
- padding-right: 20rpx;
- color: #666;
- }
-
- .plate-color .value {
- flex: 1;
- font-size: 32rpx;
- }
-
- .plate-color image {
- width: 36rpx;
- height: 36rpx;
- }
-
- .box {
- margin: 30rpx 0rpx;
- padding: 0 30rpx;
- }
-
- .btn {
- padding: 0 30rpx;
- }
- </style>
|