| 1 |
- import{d as e,r as a,c as l,u as n,K as u,o as r,m as i,q as d,z as o,A as t,b as s,e as c,w as v,f as m,i as g,h as y,t as p,s as f,k as b,_ as C}from"./index-BtPgKBbM.js";import{_ as w}from"./cwg-input.DcdAPu1u.js";import{a as h,u as A}from"./cwg-page-wrapper.DMQ18-Ki.js";import{V as N,P as k,C as T,p as q}from"./card-websdkLink.9w6PinRO.js";import{u as _}from"./ucard.CSCoO8DZ.js";import{u as F}from"./user.CQhtmm0-.js";import{u as U}from"./use-user-store.DrPiNKOs.js";import"./cwg-date-picker.vue_vue_type_script_setup_true_lang.FHA7Rdch.js";import"./crypt.DiE9FGlk.js";import"./request.CF7O_zBD.js";import"./config.L5Ru1Rfu.js";const M=C(e({__name:"apply",setup(e){const C=a(null),M=U(),P=l((()=>M.userInfo)),{t:x}=n(),K=A(),I=a(),j=a(0);a(!1);const S=a(""),$=a("");u((e=>{S.value=(null==e?void 0:e.type)||"",$.value=(null==e?void 0:e.cardTypeId)||""}));const L=a([]),R=a([]),B=a([]),E=l((()=>{var e;return 1==(null==(e=Q.value)?void 0:e.authStatus)})),D=a([{text:x("card.Form.v1"),value:"M"},{text:x("card.Form.v2"),value:"F"}]),z=a([]);a([{text:x("card.Form.v3"),value:"EUROPEAN_ID"},{text:x("card.Form.v4"),value:"PASSPORT"}]);const O={mailingAreaCode:[N.required(x("card.vaildate.v1"))],mailingMobile:[N.required(x("card.vaildate.v2")),N.pattern(k.mobile,x("card.vaildate.v44"))],mailingCountry:[N.required(x("card.vaildate.v6"),"change")],mailingTown:[N.required(x("card.vaildate.v7"),"change")],login:[N.required(x("vaildate.select.empty")+x("card.New.n10"),"change")],address:[N.required(x("card.vaildate.v27")),N.custom((e=>{const a=String(e??"").trim();return a.length<2||a.length>40?x("card.New.n1"):!!k.address.test(a)||x("card.New.n1")}))],addressCn:[N.required(x("card.vaildate.v27")),N.pattern(k.addressCn,x("card.vaildate.v27"))],mailingPostCode:[N.required(x("card.vaildate.v8")),N.pattern(k.postcode,x("card.New.n2"))]},Q=a({gender:void 0,mailingMobile:void 0,mailingAreaCode:void 0,mailingCountry:void 0,mailingTown:void 0,addressCn:void 0,address:void 0,mailingPostCode:void 0,login:void 0,email:void 0,lastName:void 0,firstName:void 0,birthday:void 0}),W=a({});async function G(){var e,a,l;try{const a=["mailingMobile","mailingAreaCode","mailingCountry","mailingTown","addressCn","address","mailingPostCode","login"];await(null==(e=I.value)?void 0:e.validate(a))}catch(u){return void(Array.isArray(u)&&u.length>0?f({title:u[0].message,icon:"none"}):f({title:x("card.New.errer"),icon:"none"}))}const n=await _.ucardApply({...W.value,cardTypeId:$.value});200===n.code?(f({title:x("card.Msg.m1"),icon:"success"}),C.value&&C.value.getWebsdkLink((null==(a=n.data)?void 0:a.cardId)||(null==(l=W.value)?void 0:l.cId)||$.value),K.push({path:"/pages/card/index"})):f({title:n.msg||x("common.error"),icon:"none"})}async function J(e){if(W.value={...W.value,[e.key]:e.value},"login"===e.key)if(-1==e.value)W.value.discountType=2;else{const a=z.value.find((a=>a.login==e.value));W.value.discountType=1,W.value.platform=null==a?void 0:a.platform}if("addressCn"===e.key){(e=>/[\u4E00-\u9FA5]/.test(e))(e.value)?(W.value.address=await V(e.value),Q.value.address=await V(e.value)):(W.value.address=e.value,Q.value.address=e.value)}"mailingCountry"===e.key&&(W.value.mailingCountry=e.value,await X(e.value),W.value.mailingTown="",Q.value.mailingTown="")}function V(e){return e.replace(/[\u4E00-\u9FA5]+/g,(e=>` ${q(e,{toneType:"none",type:"capitalize"})} `))}async function H(){const e=await F.accountDropdown();if(200===e.code){const a=function(e){return e.flatMap((e=>e.rechargeCurrencyInfoList&&0!==e.rechargeCurrencyInfoList.length?e.rechargeCurrencyInfoList.map((a=>({...e,...a}))):[{...e,currency:null,rechargeFeeRate:null,rechargeFixedFee:null,rechargeMaxQuota:null,rechargeMinQuota:null}]))}(e.data).map((e=>{var a,l;return e.discountType=1,e.text=`${e.login} - ${function(e){if("1"==e)return x("AccountType.ClassicAccount");if("2"==e)return x("AccountType.SeniorAccount");if("5"==e)return x("AccountType.SpeedAccount");if("6"==e)return x("AccountType.SpeedAccount");if("7"==e)return x("AccountType.StandardAccount");if("8"==e)return x("AccountType.CentAccount");if("3"==e)return x("AccountType.AgencyAccount");return""}(e.type)} - ${x("kyc.AvailableBalance")}${l=e.currency,"GBP"==l?": £":"USD"==l?": $":"EUR"==l?": €":"USC"==l?": ¢":": $"}${e.balance}`,e.value=e.login,e.disabled=null==(a=e.closeFunctions)?void 0:a.includes("1"),0==e.balance&&(e.disabled=!0),e}));a.push({discountType:2,text:x("kyc.AvailableBalance1")+j.value,login:-1,value:-1,disabled:0==j.value}),z.value=a}}async function X(e){try{const a=await _.ucardCountryCity({code:e});if(200===a.code||0===a.code){const e=a.data.map((e=>({text:e.enName,value:e.code})));R.value=e}}catch(a){console.error("获取城市列表失败:",a),R.value=[]}}return a({}),a(!1),r((async()=>{console.log(P.value,1988);const e=P.value;Q.value={lastName:e.lastName,firstName:e.firstName,email:e.email,birthday:e.birthday,gender:e.gender},W.value={lastName:e.lastName,firstName:e.firstName,email:e.email,birthday:e.birthday,gender:e.gender},await async function(){try{const e=await _.ucardCountryCity({});200!==e.code&&0!==e.code||(L.value=e.data.map((e=>({text:e.enName,value:e.code}))),B.value=e.data.map((e=>({text:`${e.enName} ${e.areaCode}`,value:e.areaCode}))).filter((e=>null!==e.value&&"-"!==e.value)))}catch(e){console.error("获取国家列表失败:",e),L.value=[]}}(),e.mailingCountry&&(await X(e.mailingCountry),Q.value.mailingCountry=e.mailingCountry,Q.value.mailingTown=e.mailingTown,W.value.mailingCountry=e.mailingCountry,W.value.mailingTown=e.mailingTown),Q.value.mailingAreaCode=e.mailingAreaCode,Q.value.mailingMobile=e.mailingMobile,Q.value.addressCn=e.addressCn,Q.value.address=e.address,Q.value.mailingPostCode=e.mailingPostCode,W.value.mailingAreaCode=e.mailingAreaCode,W.value.mailingMobile=e.mailingMobile,W.value.addressCn=e.addressCn,W.value.address=e.address,W.value.mailingPostCode=e.mailingPostCode,await async function(){const{cId:e}=W.value;if(!e)return;const a=await _.reductionNum({cId:e});200===a.code&&(j.value=a.data)}(),await H(),e.login&&(Q.value.login=e.login,W.value.login=e.login)})),(e,a)=>{const l=i(d("cwg-input"),w),n=i(d("u-button"),o),u=b,r=i(d("u-form"),t),f=i(d("cwg-page-wrapper"),h);return s(),c(f,null,{default:v((()=>[m(u,{class:"page page-shadow"},{default:v((()=>[m(r,{ref_key:"formRef",ref:I,rules:O,model:W.value,class:"kyc-form"},{default:v((()=>[m(l,{value:Q.value.lastName,"onUpdate:value":a[0]||(a[0]=e=>Q.value.lastName=e),fkey:"lastName",required:!0,label:g(x)("card.Form.f4"),rulesKey:"lastName",readonly:!0,disabled:!0,onChange:J},null,8,["value","label"]),m(l,{value:Q.value.firstName,"onUpdate:value":a[1]||(a[1]=e=>Q.value.firstName=e),fkey:"firstName",required:!0,label:g(x)("card.Form.f5"),rulesKey:"firstName",readonly:!0,disabled:!0,onChange:J},null,8,["value","label"]),m(l,{value:Q.value.email,"onUpdate:value":a[2]||(a[2]=e=>Q.value.email=e),fkey:"email",label:g(x)("card.Form.f3"),required:!0,rulesKey:"email",readonly:!0,disabled:!0,onChange:J},null,8,["value","label"]),m(l,{value:Q.value.birthday,"onUpdate:value":a[3]||(a[3]=e=>Q.value.birthday=e),required:!0,type:"date",fkey:"birthday",label:g(x)("card.Form.f6"),rulesKey:"birthday",readonly:!0,disabled:!0,onChange:J},null,8,["value","label"]),m(l,{value:Q.value.gender,"onUpdate:value":a[4]||(a[4]=e=>Q.value.gender=e),fkey:"gender",type:"select",required:!0,columns:D.value,label:g(x)("card.Form.f8"),rulesKey:"gender",readonly:!0,disabled:!0,onChange:J},null,8,["value","columns","label"]),m(l,{value:Q.value.mailingAreaCode,"onUpdate:value":a[5]||(a[5]=e=>Q.value.mailingAreaCode=e),fkey:"mailingAreaCode",type:"select",required:!0,columns:B.value,label:g(x)("card.Form.f1"),rulesKey:"mailingAreaCode",onChange:J},null,8,["value","columns","label"]),m(l,{value:Q.value.mailingMobile,"onUpdate:value":a[6]||(a[6]=e=>Q.value.mailingMobile=e),fkey:"mailingMobile",required:!0,label:g(x)("card.Form.f2"),rulesKey:"mailingMobile",readonly:E.value,disabled:E.value,onChange:J},null,8,["value","label","readonly","disabled"]),m(l,{value:Q.value.mailingCountry,"onUpdate:value":a[7]||(a[7]=e=>Q.value.mailingCountry=e),fkey:"mailingCountry",type:"select",required:!0,columns:L.value,label:g(x)("card.New1.d8"),rulesKey:"mailingCountry",onChange:J},null,8,["value","columns","label"]),m(l,{value:Q.value.mailingTown,"onUpdate:value":a[8]||(a[8]=e=>Q.value.mailingTown=e),fkey:"mailingTown",type:"select",required:!0,columns:R.value,label:g(x)("card.New1.d9"),rulesKey:"mailingTown",onChange:J},null,8,["value","columns","label"]),m(l,{value:Q.value.addressCn,"onUpdate:value":a[9]||(a[9]=e=>Q.value.addressCn=e),fkey:"addressCn",required:!0,label:g(x)("card.New1.d10"),rulesKey:"addressCn",readonly:E.value,disabled:E.value,onChange:J},null,8,["value","label","readonly","disabled"]),m(l,{value:Q.value.address,"onUpdate:value":a[10]||(a[10]=e=>Q.value.address=e),fkey:"address",required:!0,label:g(x)("card.New1.d11"),rulesKey:"address",readonly:E.value,disabled:E.value,onChange:J},null,8,["value","label","readonly","disabled"]),m(l,{value:Q.value.mailingPostCode,"onUpdate:value":a[11]||(a[11]=e=>Q.value.mailingPostCode=e),fkey:"mailingPostCode",required:!0,label:g(x)("card.New1.d12"),rulesKey:"mailingPostCode",readonly:E.value,disabled:E.value,onChange:J},null,8,["value","label","readonly","disabled"]),m(l,{value:Q.value.login,"onUpdate:value":a[12]||(a[12]=e=>Q.value.login=e),fkey:"login",type:"select",required:!0,columns:z.value,label:g(x)("card.New.n10"),rulesKey:"login",onChange:J},null,8,["value","columns","label"]),m(u,{class:"fixed-btn"},{default:v((()=>[m(u,{class:"cwg-button"},{default:v((()=>[m(n,{type:"primary",block:"",onClick:G},{default:v((()=>[y(p(g(x)("card.Btn.Submit")),1)])),_:1})])),_:1})])),_:1})])),_:1},8,["model"]),m(T,{ref_key:"cardWebsdkLinkRef",ref:C},null,512)])),_:1})])),_:1})}}}),[["__scopeId","data-v-37fbb3a2"]]);export{M as default};
|