import{az as U,d as M,a6 as O,r as d,b as P,W as Y,s as W,aq as $,c as p,e as _,k as j,i as s,h as l,u as t,du as k,f as V,A as b,g as v,m,E as D}from"./index.0308b213.js";const G=()=>U.get("addon/cashRegister.web.cash_register_setting/getConfig"),H=x=>U.post("addon/cashRegister.web.cash_register_setting/setConfig",x),J=v("h3",{style:{padding:"0 0 20px 0"}},"\u5FAE\u4FE1\u652F\u4ED8\u914D\u7F6E",-1),Q=m("\u70B9\u51FB\u4E0A\u4F20"),X={key:0,slot:"tip",class:"el-upload__tip tip"},Z=m("\u70B9\u51FB\u4E0A\u4F20"),ee={key:0,slot:"tip",class:"el-upload__tip tip"},ue=m("\u70B9\u51FB\u4E0A\u4F20"),ae={key:0,slot:"tip",class:"el-upload__tip tip"},le=m("\u63D0\u4EA4"),oe=M({setup(x){O(),d([]),d(1);let u=P({appid:"",mch_id:"",apikey:"",serial_no:""});const F=d(!1),f=d(1),E=d(""),h=d(""),y=d(""),R=d([]),I=d([]),S=d([]),n=d(),C=d(window.location.protocol+"//"+window.location.host+"/adminapi/upload/image"),{token:z}=Y(),g=W(()=>({token:z,version:$})),L=(e,i,c)=>{var a;if(c.every(o=>o.status=="success"),(e==null?void 0:e.code)===1&&((a=e==null?void 0:e.data)==null?void 0:a.url)){console.log(e);let o=e.data.url;E.value=o}},N=(e,i,c)=>{var a;if(c.every(o=>o.status=="success"),(e==null?void 0:e.code)===1&&((a=e==null?void 0:e.data)==null?void 0:a.url)){console.log(e);let o=e.data.url;h.value=o}},T=(e,i,c)=>{var a;if(c.every(o=>o.status=="success"),(e==null?void 0:e.code)===1&&((a=e==null?void 0:e.data)==null?void 0:a.url)){console.log(e);let o=e.data.url;y.value=o}},A=(e,i,c)=>{var a;D.error(`${i.name}\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25`),(a=n.value)==null||a.abort(i),emits("onChange"),emits("onError")},B=()=>{D.error("\u8D85\u51FA\u4E0A\u4F20\u4E0A\u9650\uFF0C\u8BF7\u91CD\u65B0\u4E0A\u4F20")},q=()=>{console.log(E.value,h.value,y.value),u.cert_path=E.value,u.key_path=h.value,u.rootca_path=y.value,H(u).then(e=>{D.success("\u8BBE\u7F6E\u6210\u529F"),w()})},w=()=>{G().then(e=>{console.log(e),e&&e.data&&(u.appid=e.data.appid,u.mch_id=e.data.mch_id,u.apikey=e.data.apikey,u.serial_no=e.data.serial_no,u.cert_path=e.data.cert_path,u.key_path=e.data.key_path,u.rootca_path=e.data.rootca_path)})};return w(),(e,i)=>{const c=p("el-input"),a=p("el-form-item"),o=p("el-button"),K=p("el-card");return _(),j(K,{shadow:"always",style:{"margin-top":"20px"}},{default:s(()=>[J,l(a,{label:"AppId"},{default:s(()=>[l(c,{modelValue:t(u).appid,"onUpdate:modelValue":i[0]||(i[0]=r=>t(u).appid=r)},null,8,["modelValue"])]),_:1}),l(a,{label:"\u5FAE\u4FE1\u652F\u4ED8\u5546\u6237\u53F7(Mch_Id)"},{default:s(()=>[l(c,{modelValue:t(u).mch_id,"onUpdate:modelValue":i[1]||(i[1]=r=>t(u).mch_id=r)},null,8,["modelValue"])]),_:1}),l(a,{label:"\u5FAE\u4FE1\u652F\u4ED8\u5BC6\u94A5(APIKEY)"},{default:s(()=>[l(c,{modelValue:t(u).apikey,"onUpdate:modelValue":i[2]||(i[2]=r=>t(u).apikey=r)},null,8,["modelValue"])]),_:1}),l(a,{label:"\u8BC1\u4E66\u5E8F\u5217\u53F7"},{default:s(()=>[l(c,{modelValue:t(u).serial_no,"onUpdate:modelValue":i[3]||(i[3]=r=>t(u).serial_no=r)},null,8,["modelValue"])]),_:1}),l(a,{label:"CERT\u8BC1\u4E66\u6587\u4EF6"},{default:s(()=>[l(t(k),{ref_key:"tnUploadImageRef",ref:n,action:C.value,multiple:F.value,limit:f.value,headers:t(g),"file-list":R.value,"on-success":L,"on-exceed":B,"on-error":A},{default:s(()=>[l(o,{size:"small",type:"primary"},{default:s(()=>[Q]),_:1}),t(u).cert_path?(_(),V("div",X,"\u5DF2\u7ECF\u4E0A\u4F20\uFF0C\u82E5\u8981\u4FEE\u6539\uFF0C\u8BF7\u91CD\u65B0\u4E0A\u4F20")):b("",!0)]),_:1},8,["action","multiple","limit","headers","file-list"])]),_:1}),l(a,{label:"KEY\u8BC1\u4E66\u5BC6\u94A5\u6587\u4EF6"},{default:s(()=>[l(t(k),{ref_key:"tnUploadImageRef",ref:n,action:C.value,multiple:F.value,limit:f.value,headers:t(g),"file-list":I.value,"on-success":N,"on-exceed":B,"on-error":A},{default:s(()=>[l(o,{size:"small",type:"primary"},{default:s(()=>[Z]),_:1}),t(u).key_path?(_(),V("div",ee,"\u5DF2\u7ECF\u4E0A\u4F20\uFF0C\u82E5\u8981\u4FEE\u6539\uFF0C\u8BF7\u91CD\u65B0\u4E0A\u4F20")):b("",!0)]),_:1},8,["action","multiple","limit","headers","file-list"])]),_:1}),l(a,{label:"ROOT\u8BC1\u4E66\u5BC6\u94A5\u6587\u4EF6"},{default:s(()=>[l(t(k),{ref_key:"tnUploadImageRef",ref:n,action:C.value,multiple:F.value,limit:f.value,headers:t(g),"file-list":S.value,"on-success":T,"on-exceed":B,"on-error":A},{default:s(()=>[l(o,{size:"small",type:"primary"},{default:s(()=>[ue]),_:1}),t(u).rootca_path?(_(),V("div",ae,"\u5DF2\u7ECF\u4E0A\u4F20\uFF0C\u82E5\u8981\u4FEE\u6539\uFF0C\u8BF7\u91CD\u65B0\u4E0A\u4F20")):b("",!0)]),_:1},8,["action","multiple","limit","headers","file-list"])]),_:1}),l(a,{label:"",class:"continer-item"},{default:s(()=>[l(o,{type:"primary",onClick:q},{default:s(()=>[le]),_:1})]),_:1})]),_:1})}}});export{oe as default};
