diff --git a/src/main.js b/src/main.js index 7a085bda..910a616e 100644 --- a/src/main.js +++ b/src/main.js @@ -19,7 +19,7 @@ import global from '@/utils/global'; import { getDicts ,getConfigKey } from "@/utils/data"; import { houseGetDicts } from '@/utils/data'; -import { selectDictLabel , selectDictScheme , onClickLeft , getNowFormatDate , format } from "@/utils/utils"; +import { selectDictLabel , selectDictScheme , onClickLeft , getNowFormatDate , format , isBankCard } from "@/utils/utils"; import vueEsign from 'vue-esign' Vue.use(vueEsign) @@ -33,6 +33,7 @@ Vue.prototype.onClickLeft = onClickLeft Vue.prototype.getNowFormatDate = getNowFormatDate Vue.prototype.format = format Vue.prototype.global = global +Vue.prototype.isBankCard = isBankCard // Vant 引用 import Vant from 'vant'; diff --git a/src/utils/utils.js b/src/utils/utils.js index 76837ee2..f4cb3c4e 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -86,3 +86,75 @@ export function format(time, format) { } }) } + +/** + * @author Rui.Zhang + * @description 判断是否为银行卡号 + * @param {String} str_cardNo 待校验的数据 + * @returns {Boolean}, true:是银行卡号 + **/ +export function isBankCard (str_cardNo) { + str_cardNo = str_cardNo || String(this); + if ("" == str_cardNo.trim() || undefined == str_cardNo) { + return false; + } + var lastNum = str_cardNo.substr(str_cardNo.length - 1, 1);//取出最后一位(与luhm进行比较) + + var first15Num = str_cardNo.substr(0, str_cardNo.length - 1);//前15或18位 + var newArr=new Array(); + for(var i=first15Num.length-1;i>-1;i--){ //前15或18位倒序存进数组 + newArr.push(first15Num.substr(i,1)); + } + var arrJiShu=new Array(); //奇数位*2的积 <9 + var arrJiShu2=new Array(); //奇数位*2的积 >9 + + var arrOuShu=new Array(); //偶数位数组 + for(var j=0;j9 的分割之后的数组个位数 + var jishu_child2=new Array();//奇数位*2 >9 的分割之后的数组十位数 + for(var h=0;h9 的分割之后的数组个位数之和 + var sumJiShuChild2=0; //奇数位*2 >9 的分割之后的数组十位数之和 + var sumTotal=0; + for(var m=0;m +
+ +
+

基础信息

@@ -138,6 +142,7 @@ accountTypeOptions:[], payeeTypeOptions:[], bankDepositOptions:[], + value:'' }; }, created() { @@ -169,6 +174,26 @@ }); }, + changeInform(val){ + console.log(val) + var that = this; + var str = val; + var numArr = str.match(/\d+/g) + var nameArr = str.match(/[\u4e00-\u9fa5]/g).join("") + console.log(numArr) + console.log(nameArr) + if (numArr) { + numArr.map(rr=>{ + if (rr.length>16) { + const carId = this.isBankCard(rr); + if (carId) { + that.form.payee = nameArr; + that.form.payeeAccount = rr + } + } + }) + } + }, getError(e){ this.$notify({ type: 'danger', message: e.errors[0].message }); },