校验银行卡规则

校验银行卡规则

bankCardInfo.js

var cardTypeMap = {
DC: “储蓄卡”,
CC: “信用卡”,
SCC: “准贷记卡”,
PC: “预付费卡”
};
var bankcardList = [{
bankName: “中国邮政储蓄银行”,
bankCode: “PSBC”,
patterns: [{
reg: /^(621096|621098|622150|622151|622181|622188|622199|955100|621095|620062|621285|621798|621799|621797|620529|621622|621599|621674|623218|623219)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(622812|622810|622811|628310|625919)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(622200|622202|622203|622208|621225|620058|621281|900000|621558|621559|621722|621723|620086|621226|621618|620516|621227|621288|621721|900010|623062|621670|621720|621379|621240|621724|621762|621414|621375|622926|622927|622928|622929|622930|622931|621733|621732|621372|621369|621763)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(9558)\d{15}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}, {
reg: /^(427010|427018|427019|427020|427029|427030|427039|438125|438126|451804|451810|451811|458071|489734|489735|489736|510529|427062|524091|427064|530970|530990|558360|524047|525498|622230|622231|622232|622233|622234|622235|622237|622239|622240|622245|622238|451804|451810|451811|458071|628288|628286|622206|526836|513685|543098|458441|622246|544210|548943|356879|356880|356881|356882|528856|625330|625331|625332|622236|524374|550213|625929|625927|625939|625987|625930|625114|622159|625021|625022|625932|622889|625900|625915|625916|622171|625931|625113|625928|625914|625986|625925|625921|625926|625942|622158|625917|625922|625934|625933|625920|625924|625017|625018|625019)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲, { reg: …/g,
cardType: “CC”
}, {
reg: /^(622210|622211|622212|622213|622214|622220|622223|622225|622229|622215|622224)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 31: …ype: "SCC" }̲, { reg: …/g,
cardType: “PC”
}, {
reg: /^(620114|620187|620046)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "PC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(95595|95596|95597|95598|95599)\d{14}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(403361|404117|404118|404119|404120|404121|463758|519412|519413|520082|520083|552599|558730|514027|622836|622837|628268|625996|625998|625997|622838|625336|625826|625827|544243|548478|628269)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲, { reg: …/g,
cardType: “SCC”
}]
}, {
bankName: “中国银行”,
bankCode: “BOC”,
patterns: [{
reg: /^(621660|621661|621662|621663|621665|621667|621668|621669|621666|456351|601382|621256|621212|621283|620061|621725|621330|621331|621332|621333|621297|621568|621569|621672|623208|621620|621756|621757|621758|621759|621785|621786|621787|621788|621789|621790|622273|622274|622771|622772|622770|621741|621041)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(625908|625910|625909|356833|356835|409665|409666|409668|409669|409670|409671|409672|512315|512316|512411|512412|514957|409667|438088|552742|553131|514958|622760|628388|518377|622788|628313|628312|622750|622751|625145|622479|622480|622789|625140|622346|622347)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲, { reg: …/g,
cardType: “SCC”
}, {
reg: /^(53591|49102|377677)\d{11}KaTeX parse error: Expected 'EOF', got '}' at position 31: …ype: "SCC" }̲, { reg: …/g,
cardType: “PC”
}, {
reg: /^(620040|620531|620513|921000|620038)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "PC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(421349|434061|434062|524094|526410|552245|621080|621082|621466|621488|621499|622966|622988|622382|621487|621083|621084|620107)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(553242)\d{12}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲, { reg: …/g,
cardType: “CC”
}, {
reg: /^(5453242|5491031|5544033)\d{11}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲, { reg: …/g,
cardType: “SCC”
}, {
reg: /^(53242|53243)\d{11}KaTeX parse error: Expected 'EOF', got '}' at position 31: …ype: "SCC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(620013)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(49104|53783)\d{11}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲, { reg: …/g,
cardType: “CC”
}, {
reg: /^(622254|622255|622256|622257|622284)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 31: …ype: "SCC" }̲, { reg: …/g,
cardType: “PC”
}]
}, {
bankName: “招商银行”,
bankCode: “CMB”,
patterns: [{
reg: /^(402658|410062|468203|512425|524011|622580|622588|622598|622609|95555|621286|621483|621485|621486|621299)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(690755)\d{12}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}, {
reg: /^(370285|370286|370287|370289)\d{9}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲, { reg: …/g,
cardType: “PC”
}]
}, {
bankName: “中国民生银行”,
bankCode: “CMBC”,
patterns: [{
reg: /^(622615|622616|622618|622622|622617|622619|415599|421393|421865|427570|427571|472067|472068|622620)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}, {
reg: /^(377155|377152|377153|377158)\d{9}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(90030)\d{11}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(620085|622660|622662|622663|622664|622665|622666|622667|622669|622670|622671|622672|622668|622661|622674|622673|620518|621489|621492)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}]
}, {
bankName: “中信银行”,
bankCode: “CITIC”,
patterns: [{
reg: /^(433670|433680|442729|442730|620082|622690|622691|622692|622696|622698|622998|622999|433671|968807|968808|968809|621771|621767|621768|621770|621772|621773|622453|622456)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(376968|376969|376966)\d{9}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲, { reg: …/g,
cardType: “CC”
}]
}, {
bankName: “华夏银行”,
bankCode: “HXBANK”,
patterns: [{
reg: /^(622630|622631|622632|622633|999999|621222|623020|623021|623022|623023)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}]
}, {
bankName: “深发/平安银行”,
bankCode: “SPABANK”,
patterns: [{
reg: /^(621626|623058)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(531659|622157|528020|622155|622156|526855|356869|356868|625360|625361|628296|435744|435745|483536|622525|622526|998801|998802)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲, { reg: …/g,
cardType: “PC”
}]
}, {
bankName: “兴业银行”,
bankCode: “CIB”,
patterns: [{
reg: /^(438589)\d{12}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(966666|622909|438588|622908)\d{12}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}, {
reg: /^(620010)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "PC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(438600)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}]
}, {
bankName: “浦东发展银行”,
bankCode: “SPDB”,
patterns: [{
reg: /^(622516|622517|622518|622521|622522|622523|984301|984303|621352|621793|621795|621796|621351|621390|621792|621791)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(356851|356852|404738|404739|456418|498451|515672|356850|517650|525998|622177|622277|628222|622500|628221|622176|622276|622228|625957|625958|625993|625831)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲, { reg: …/g,
cardType: “SCC”
}, {
reg: /^(620530)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "PC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(622568|6858001|6858009|621462)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(406365|406366|428911|436768|436769|436770|487013|491032|491033|491034|491035|491036|491037|491038|436771|518364|520152|520382|541709|541710|548844|552794|493427|622555|622556|622557|622558|622559|622560|528931|558894|625072|625071|628260|628259|625805|625806|625807|625808|625809|625810)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲, { reg: …/g,
cardType: “CC”
}]
}, {
bankName: “渤海银行”,
bankCode: “BOHAIB”,
patterns: [{
reg: /^(621268|622684|622884|621453)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲] }, { ba…/g,
cardType: “DC”
}]
}, {
bankName: “金华银行”,
bankCode: “JHBANK”,
patterns: [{
reg: /^(622449|940051)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}]
}, {
bankName: “温州银行”,
bankCode: “WZCB”,
patterns: [{
reg: /^(621977)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}]
}, {
bankName: “徽商银行”,
bankCode: “HSBANK”,
patterns: [{
reg: /^(622877|622879|621775|623203)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(628251|622651|625828)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(504923|622422|622447|940076)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}]
}, {
bankName: “南京银行”,
bankCode: “NJCB”,
patterns: [{
reg: /^(621777|622305|621259)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}]
}, {
bankName: “宁波银行”,
bankCode: “NBBANK”,
patterns: [{
reg: /^(621279|622281|622316|940022)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(625903|622778|628207|512431|520194|622282|622318)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(522001|622163|622853|628203|622851|622852)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(625526|625186|628336)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(622406|621442)\d{11}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(622360|622361|625034|625096|625098)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(622482|622483|622484)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(625076|625077|625074|625075|622371|625091)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(622372|622471|622472|622265|622266|625972|625973)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲, { reg: …/g,
cardType: “CC”
}]
}, {
bankName: “广东华兴银行”,
bankCode: “GHB”,
patterns: [{
reg: /^(621469|621625)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲] }, { ba…/g,
cardType: “DC”
}]
}, {
bankName: “广州农村商业银行股份有限公司”,
bankCode: “GZRCU”,
patterns: [{
reg: /^(909810|940035|621522|622439)\d{12}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(625288|625888)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(621439|623010)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}]
}, {
bankName: “广东省农村信用社联合社”,
bankCode: “GDRCC”,
patterns: [{
reg: /^(622302)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}]
}, {
bankName: “大新银行”,
bankCode: “DSB”,
patterns: [{
reg: /^(622297|621277)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(622293|622295|622296|622373|622451|622294|625940)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(622798|625010|622775|622785)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(622487|622490|622491|622492)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}]
}, {
bankName: “恒丰银行”,
bankCode: “EGBANK”,
patterns: [{
reg: /^(623078)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}]
}, {
bankName: “天津市商业银行”,
bankCode: “TCCB”,
patterns: [{
reg: /^(940015|622331)\d{12}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(622426|628205)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}]
}, {
bankName: “浙商银行”,
bankCode: “CZBANK”,
patterns: [{
reg: /^(621019|622309|621019)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}]
}, {
bankName: “南洋商业银行”,
bankCode: “NCB”,
patterns: [{
reg: /^(621213|621289|621290|621291|621292|621042|621743)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(625046|625044|625058|622349|622350)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲, { reg: …/g,
cardType: “PC”
}]
}, {
bankName: “厦门银行”,
bankCode: “XMBANK”,
patterns: [{
reg: /^(622393|940023)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(623019|621600)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(621267|623063)\d{12}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “PC”
}]
}, {
bankName: “吉林银行”,
bankCode: “JLBANK”,
patterns: [{
reg: /^(622865|623131)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(622178|622179|628358)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(622325|623105|623029)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(622455|940039)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(622466|628285)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(622993|623069|623070|623172|623173)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}]
}, {
bankName: “河北银行”,
bankCode: “BHB”,
patterns: [{
reg: /^(622498|622499|623000|940046)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}]
}, {
bankName: “乌鲁木齐市商业银行”,
bankCode: “URMQCCB”,
patterns: [{
reg: /^(621751|622143|940001|621754)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}]
}, {
bankName: “绍兴银行”,
bankCode: “SXCB”,
patterns: [{
reg: /^(622486)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(628291)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}]
}, {
bankName: “抚顺银行”,
bankCode: “FSCB”,
patterns: [{
reg: /^(622442)\d{11}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(622442|623099)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(940056)\d{11}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}]
}, {
bankName: “宁夏银行”,
bankCode: “NXBANK”,
patterns: [{
reg: /^(621529|622429|621417|623089|623200)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}]
}, {
bankName: “重庆银行”,
bankCode: “CQBANK”,
patterns: [{
reg: /^(9896)\d{12}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}]
}, {
bankName: “哈尔滨银行”,
bankCode: “HRBANK”,
patterns: [{
reg: /^(621577|622425)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(622425)\d{11}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(621242|621538|621496)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(621419|623170)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(621237|623003)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(622817|628287|625959)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲, { reg: …/g,
cardType: “CC”
}]
}, {
bankName: “台州银行”,
bankCode: “TZCB”,
patterns: [{
reg: /^(622427)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(623039)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}, {
reg: /^(625001)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 31: …ype: "SCC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(940071|622368|621446)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}, {
reg: /^(620519)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "PC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(622370)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(628319)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(622165)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}]
}, {
bankName: “龙江银行”,
bankCode: “DAQINGB”,
patterns: [{
reg: /^(621037|621097|621588|622977)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(622860)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}]
}, {
bankName: “上海农商银行”,
bankCode: “SHRCB”,
patterns: [{
reg: /^(622478|940013|621495)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “SCC”
}, {
reg: /^(622611|622722|628211|625989)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “SCC”
}, {
reg: /^(628275|622565|622287)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(628252)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(628227)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(621562)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}]
}, {
bankName: “龙江银行”,
bankCode: “DAQINGB”,
patterns: [{
reg: /^(621037|621097|621588|622977)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(622475|622860)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “SCC”
}, {
reg: /^(622270|628368|625090|622644|628333)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(622829|628301|622808|628308)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(628232|622802|622290)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(622829|628301)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(622815|622816|628226)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “CC”
}]
}, {
bankName: “江西省农村信用社联合社”,
bankCode: “JXNCX”,
patterns: [{
reg: /^(621592)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}]
}, {
bankName: “商丘市商业银行”,
bankCode: “SCBBANK”,
patterns: [{
reg: /^(621748)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}]
}, {
bankName: “华融湘江银行”,
bankCode: “HRXJB”,
patterns: [{
reg: /^(621366|621388)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}]
}, {
bankName: “衡水市商业银行”,
bankCode: “HSBK”,
patterns: [{
reg: /^(621239|623068)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲] }, { ba…/g,
cardType: “DC”
}]
}, {
bankName: “湖南省农村信用社联合社”,
bankCode: “HNRCC”,
patterns: [{
reg: /^(622169|621519|621539|623090)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲] }, { ba…/g,
cardType: “DC”
}]
}, {
bankName: “临汾市尧都区农村信用合作联社”,
bankCode: “LPRDNCXYS”,
patterns: [{
reg: /^(628382|625158)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(628217)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(628217)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(628397)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “CC”
}]
}, {
bankName: “云南省农村信用社”,
bankCode: “YNRCC”,
patterns: [{
reg: /^(622469|628307)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(622880|622881)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}]
}, {
bankName: “威海市商业银行”,
bankCode: “WHSYBANK”,
patterns: [{
reg: /^(623102)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}]
}, {
bankName: “湖州银行”,
bankCode: “HZBANK”,
patterns: [{
reg: /^(628306)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(628391)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(628233)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “CC”
}]
}, {
bankName: “南昌银行”,
bankCode: “NCB”,
patterns: [{
reg: /^(621269|622275)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(628305)\d{11}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(888)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}]
}, {
bankName: “锦州银行”,
bankCode: “BOJZ”,
patterns: [{
reg: /^(622990|940003)\d{11}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}]
}, {
bankName: “齐商银行”,
bankCode: “QSBANK”,
patterns: [{
reg: /^(622311|940057)\d{11}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}]
}, {
bankName: “珠海华润银行”,
bankCode: “RBOZ”,
patterns: [{
reg: /^(622363|940048)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}]
}, {
bankName: “葫芦岛市商业银行”,
bankCode: “HLDCCB”,
patterns: [{
reg: /^(622398|940054)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(622397)\d{11}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(622397|622286|628236|625800)\d{11}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}]
}, {
bankName: “辽阳银行”,
bankCode: “LYCB”,
patterns: [{
reg: /^(622399|940043)\d{11}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲] }, { ba…/g,
cardType: “DC”
}]
}, {
bankName: “焦作市商业银行”,
bankCode: “JZCBANK”,
patterns: [{
reg: /^(622338)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}]
}, {
bankName: “镇江市商业银行”,
bankCode: “ZJCCB”,
patterns: [{
reg: /^(622394|940025)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲] }, { ba…/g,
cardType: “DC”
}]
}, {
bankName: “大华银行”,
bankCode: “DYBANK”,
patterns: [{
reg: /^(621328)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲] }, { ba…/g,
cardType: “DC”
}]
}, {
bankName: “华侨银行”,
bankCode: “HQBANK”,
patterns: [{
reg: /^(621077)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(622410|621440)\d{11}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}, {
reg: /^(625026|625024|622376|622378|622377|625092)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}]
}, {
bankName: “烟台商业银行”,
bankCode: “YTCB”,
patterns: [{
reg: /^(622886)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(628379)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(625003|625011|625012|625020|625023|625025|625027|625031|621032|625039|625078|625079|625103|625106|625006|625112|625120|625123|625125|625127|625131|625032|625139|625178|625179|625220|625320|625111|625132|625244)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(621043|621742)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “CC”
}, {
reg: /^(620206|620207)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "PC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(625198|625196|625147)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲, { reg: …/g,
cardType: “PC”
}, {
reg: /^(620204|620205)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "PC" }̲] }, { ba…/g,
cardType: “DC”
}, {
reg: /^(622493)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲] }, { ba…/g,
cardType: “DC”
}]
}, {
bankName: “浙江泰隆商业银行”,
bankCode: “ZJTLCB”,
patterns: [{
reg: /^(622287)\d{10}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "CC" }̲, { reg: …/g,
cardType: “SCC”
}, {
reg: /^(621480)\d{13}KaTeX parse error: Expected 'EOF', got '}' at position 30: …Type: "DC" }̲, { reg: …/g,
cardType: “DC”
}]
}]

const resultInfo = (falg,msg,data)=>{
return {
‘falg’:falg,
‘msg’: msg,
‘data’:data
}
}
const getBankNameByBankCode = (bankcode)=> {
for (var i = 0, len = bankcardList.length; i < len; i++) {
var bankcard = bankcardList[i];
if (bankcode == bankcard.bankCode) {
return bankcard.bankName;
}
}
return undefined;
}
function getCardTypeName(cardType) {
if (cardTypeMap[cardType]) {
return cardTypeMap[cardType]
}
return undefined;
}
const getBankInfoFromAli = (cardNum,resultFunc)=>{

// console.log('--------调用阿里api----------')
uni.showLoading({})
let url = "https://ccdcapi.alipay.com/validateAndCacheCardInfo.json?_input_charset=utf-8&cardNo=" + cardNum + "&cardBinCheck=true"
uni.request({
    url: url,
    method: 'GET',
    // // data: params,
    // // header: _header,
    // responseType: 'arraybuffer',
    success(res) {
        if(res.statusCode == 200){
            
            if(res.data.validated){
                let result = {
                    'bankCode':res.data.bank,
                    'bankName':getBankNameByBankCode(res.data.bank),
                    'cardType':getCardTypeName(res.data.cardType)
                }
                
                 resultFunc(resultInfo(true,'验证成功',result))
            }else{
                 resultFunc(resultInfo(false,'请检查银行号是否正确!',res))
            }
            
        }else{
             resultFunc(resultInfo(false,'请检查银行号是否正确!',res))
        }
    },
    fail(error) {
       resultFunc(resultInfo(false,'请检查银行号是否正确!',error))
    },
    complete: info => {
        uni.hideLoading()
    }
})

}
const getBankCardInfo = (cardNum,resultFunc) => {

//1.根据本地正则获取银行卡信息是否存在
let result = {}
for (let bankcard of bankcardList) {
    // console.log(bankcard);
    for (let regPatterns of bankcard.patterns) {
        if(regPatterns.reg.test(cardNum)){
            return resultFunc(resultInfo(true,'',{
                'bankCode':bankcard.bankCode,
                'bankName':bankcard.bankName,
                'cardType':getCardTypeName(regPatterns.cardType)
            })) 
        }
    }
}

//2.如果没有进行 al 银行卡接口调用验证  返回信息
getBankInfoFromAli(cardNum, resultFunc)

}

const _getBankBin = (cardNum, resultFunc) =>{

let errMsg = '';
if (isNaN(cardNum)) {
  cardNum = parseInt(cardNum);
  if (isNaN(cardNum)) {
    errMsg = cardNum + ':银行卡号必须是数字';
     return resultFunc(resultInfo(false,errMsg))
  }
}
if (cardNum.toString().length < 15 || cardNum.toString().length > 19) {
  errMsg = cardNum + ':银行卡位数必须是15到19位';
  return resultFunc(resultInfo(false,errMsg))
}

// console.log('执行了。。。')

getBankCardInfo(cardNum, resultFunc);

}

const getBankBin = (cardNum) =>{
return new Promise((resolve, reject) => {
console.log(‘--------银行卡---------卡号:’+ cardNum);
_getBankBin(cardNum,result => {
result.falg ? resolve(result) : reject(result)
})

});

}

const bankCardInfo = {
getBankBin: getBankBin
}

export default bankCardInfo

使用

import BIN from “***/bankCardInfo.js”
methods: {
verifyBank() {
// console.log(this.cardNum, ‘银行卡号’)
// // 获取银行卡类型
BIN.getBankBin(‘卡号’).then(res => {
console.log(res,‘验证银行卡’)
}).catch(function(err) {
console.log(err)
})
}
}

转载自https://www.jianshu.com/p/1cbcf041de77

通过银行卡号查询银行类型和银行卡类型:https://github.com/navyxie/bankcardinfo

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值