"use strict";(self["webpackChunk"]=self["webpackChunk"]||[]).push([[909],{8909:function(e,t,a){a.r(t),a.d(t,{default:function(){return m}});var i=function(){var e=this,t=e._self._c;return t("div",{staticClass:"container"},[t("div",{staticClass:"action-bar"},[t("el-button",{attrs:{type:"primary",size:"mini",loading:e.loading},on:{click:e.onSave}},[e._v("保存")]),t("div",{staticClass:"fileWrap"},[t("el-button",{attrs:{type:"warning",size:"mini",loading:e.loading}},[e._v(" "+e._s(e.loading?"识别中":"上传")+" ")]),t("input",{ref:"inputRef",attrs:{type:"file",accept:".pdf,.jpg,.jpeg,.png",disabled:e.loading},on:{change:e.upload}})],1),t("el-tooltip",{attrs:{content:"查看发票样板,用于参考所需字段位置",placement:"top"}},[t("el-button",{attrs:{type:"success",size:"mini"},on:{click:e.showTemplate}},[e._v("查看样板")])],1),t("el-button",{attrs:{size:"mini",disabled:e.loading},on:{click:e.back}},[e._v("返回")])],1),e._m(0),e.showRecognitionStatus?t("div",{class:["recognition-status",e.recognitionStatusType]},[t("i",{class:e.recognitionStatusIcon}),e._v(" "+e._s(e.recognitionStatusMessage)+" ")]):e._e(),t("el-dialog",{attrs:{title:"发票样板",visible:e.templateDialogVisible,width:"80%","before-close":e.handleCloseTemplateDialog},on:{"update:visible":function(t){e.templateDialogVisible=t}}},[t("div",{staticClass:"template-container"},[t("img",{staticStyle:{width:"100%"},attrs:{src:a(6874),alt:"发票图片"}})]),t("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[t("el-button",{on:{click:function(t){e.templateDialogVisible=!1}}},[e._v("关闭")])],1)]),t("div",{staticClass:"tableWrap"},[t("table",[t("thead",[t("tr",[t("td",{attrs:{colspan:"6"}},[e._v(e._s(e.invoiceData.title||""))])])]),t("tbody",[t("tr",[t("td",{attrs:{colspan:"6",align:"left"}},[t("div",{staticClass:"td-item"},[e._v(e._s(`缴款码:${e.invoiceData.paymentCode||""}`))]),t("div",{staticClass:"td-item"},[t("span",[e._v(" "+e._s(`执收单位编码:${e.invoiceData.receivingCode||""}`))]),t("span",[e._v(" "+e._s(`票据代码:${e.invoiceData.invoiceCode||""}`))]),t("span",[e._v(" "+e._s(`校验码:${e.invoiceData.checkCode||""}`))])]),t("div",{staticClass:"td-item"},[t("span",[e._v(" "+e._s(`执收单位名称:${e.invoiceData.receivingName||""}`))]),t("span",[e._v(" "+e._s(`票据号码:${e.invoiceData.invoiceNumber||""}`))]),t("span",[e._v(" "+e._s(`填制日期:${e.invoiceData.billingDate||""}`))])])])]),t("tr",[t("td",{attrs:{rowspan:"3"}},[e._v("付款人")]),t("td",[e._v("全称")]),t("td",[e._v(e._s(e.invoiceData.payerName||""))]),t("td",{attrs:{rowspan:"3"}},[e._v("收款人")]),t("td",[e._v("全称")]),t("td",[e._v(e._s(e.invoiceData.payeeName||""))])]),t("tr",[t("td",[e._v("账号")]),t("td",[e._v(e._s(e.invoiceData.payerNumber||""))]),t("td",[e._v("账号")]),t("td",[e._v(e._s(e.invoiceData.payeeNumber||""))])]),t("tr",[t("td",[e._v("开户银行")]),t("td",[e._v(e._s(e.invoiceData.payerBank||""))]),t("td",[e._v("开户银行")]),t("td",[e._v(e._s(e.invoiceData.payeeBank||""))])]),t("tr",[t("td",{attrs:{colspan:"4"}},[t("div",{staticClass:"td-item",staticStyle:{"justify-content":"left"}},[t("span",{staticStyle:{"margin-right":"50px"}},[e._v(" "+e._s(`币种:${e.invoiceData.currencyCode||"人民币"}`))]),t("span",[e._v(" "+e._s(`金额(大写):${e.invoiceData.amountTaxCN||""}`))])])]),t("td",{attrs:{colspan:"2"}},[e._v(e._s(`(小写):${e.invoiceData.amountTax||""}`))])]),e._m(1),e._l(e.invoiceData.invoiceLists,(function(a){return t("tr",{key:a.commodityNo},[t("td",[e._v(e._s(a.commodityNo||""))]),t("td",[e._v(e._s(a.commodityName||""))]),t("td",[e._v(e._s(a.unit||"元"))]),t("td",[e._v(e._s(a.quantity||""))]),t("td",[e._v(e._s(a.standard||""))]),t("td",[e._v(e._s(a.amount||""))])])})),e._m(2),e._m(3),t("tr",[t("td",{attrs:{colspan:"3"}},[t("div",{staticClass:"td-item"},[t("span",[e._v(" "+e._s("执收单位盖章:"))]),t("span",[e._v(" "+e._s(`经办人盖章:${e.invoiceData.sealMark||""}`))])])]),t("td",{staticStyle:{"text-align":"left"},attrs:{colspan:"3"}},[e._v(e._s(`备注:${e.invoiceData.remarks||""}`))])])],2)])])],1)},n=[function(){var e=this,t=e._self._c;return t("div",{staticClass:"file-type-hint"},[e._v(" 支持的文件格式:"),t("span",{staticClass:"supported-types"},[e._v("PDF、JPG、PNG")]),e._v(",请确保上传清晰的发票图片以获得最佳识别效果 ")])},function(){var e=this,t=e._self._c;return t("tr",[t("td",[e._v("项目编码")]),t("td",[e._v("收入项目名称")]),t("td",[e._v("单位")]),t("td",[e._v("数量")]),t("td",[e._v("收缴标准")]),t("td",[e._v("金额")])])},function(){var e=this,t=e._self._c;return t("tr",[t("td"),t("td"),t("td"),t("td"),t("td"),t("td")])},function(){var e=this,t=e._self._c;return t("tr",[t("td"),t("td"),t("td"),t("td"),t("td"),t("td")])}],o=a(5139);const s={key:"Es1TRT94hJsvSttv9GLhy4",secret:"19d6be2e3e164f98a1b7d1321a73189c"};const r=e=>{let t,a,i,n=new Array("零","壹","贰","叁","肆","伍","陆","柒","捌","玖"),o=new Array("","拾","佰","仟"),s=new Array("","万","亿","兆"),r=new Array("角","分","毫","厘"),c="整",d="元",l=1e15,p="";if(""==e)return"";if(e=parseFloat(e),e>=l)return"";if(0==e)return p=n[0]+d+c,p;if(e=e.toString(),-1==e.indexOf(".")?(t=e,a=""):(i=e.split("."),t=i[0],a=i[1].substr(0,4)),parseInt(t,10)>0){let e=0,a=t.length;for(let i=0;i0&&(p+=n[0]),e=0,p+=n[parseInt(r)]+o[l]),0==l&&e<4&&(p+=s[d])}p+=d}if(""!=a){let e=a.length;for(let t=0;t{const{data:t}=e;t&&t.length>0&&t[0]?.invoice?(this.invoiceData=t[0].invoice,this.$message.success("发票识别成功"),this.recognitionStatus="success",this.recognitionMessage="发票识别成功,请核对识别结果"):(this.$message.warning("发票识别结果不完整,请确保上传清晰的发票图片"),this.invoiceData={},this.recognitionStatus="warning",this.recognitionMessage="发票识别结果不完整,请确保上传清晰的发票图片或尝试其他格式")})).catch((e=>{console.log("🚀 ~ getNetocr ~ err:",e),this.$message.error("发票识别失败,请重试"),this.invoiceData={},this.recognitionStatus="error",this.recognitionMessage="发票识别失败,请检查网络连接或重新上传"}))},baiduNormal(e){const t={pdf_file:e,verify_parameter:!1,probability:!1,location:!1};(0,o.getBaiduNormal)(t).then((e=>{console.log("🚀 ~ main ~ res:",e)})).catch((e=>{console.log("🚀 ~ main ~ err:",e)}))},obsFile(e){const t=localStorage.getItem("domainId")||"default";(0,c.Q)({file:e},{onSuccess:e=>{this.filePath=e},context:this,domainId:t})},upload(e){const t=e.target.files[0];if(!t)return;const a=["application/pdf","image/jpeg","image/jpg","image/png"];if(!a.includes(t.type))return this.$message.error("只支持PDF、JPG和PNG格式的文件"),void(this.$refs.inputRef.value="");this.loading=!0,this.$message.info("文件上传中,请稍候..."),this.obsFile(t),this.netocr(t).finally((()=>{this.loading=!1,this.$refs.inputRef.value=""}))},showTemplate(){this.templateDialogVisible=!0},handleCloseTemplateDialog(e){e()},downloadTemplateFile(){const e=document.createElement("a");e.href="/templates/invoice_template.html",e.download="发票样板.html",e.onerror=()=>{this.$message.error("样板文件下载失败,请联系管理员")},document.body.appendChild(e),e.click(),document.body.removeChild(e),this.$message.success("样板文件下载中,请查看您的下载文件夹")},validateInvoiceData(){const e={invoiceCode:"票据代码",checkCode:"校验码",receivingCode:"执收单位编码",receivingName:"执收单位名称",invoiceNumber:"票据号码",billingDate:"填制日期",payerName:"付款人全称",amountTax:"金额"};for(const[t,a]of Object.entries(e))if(!this.invoiceData[t])return this.$message.error(`未能识别${a},请确保上传文件清晰完整`),!1;return this.invoiceData.invoiceLists&&0!==this.invoiceData.invoiceLists.length?!(!this.invoiceData.paymentCode||this.invoiceData.paymentCode.length<20)||(this.$message.error("缴款码长度不足20位,请确保识别无误"),!1):(this.$message.error("未能识别收入项目信息,请确保上传文件清晰完整"),!1)},onSave(){if(!this.filePath)return this.$message.error("请先上传文件");if(!this.validateInvoiceData())return;const{paymentCode:e,receivingCode:t,invoiceCode:a,checkCode:i,receivingName:n,invoiceNumber:s,billingDate:c,payerName:d,payerBank:l,payerNumber:p,payeeName:u,payeeNumber:m,payeeBank:v,amountTaxCN:h,amountTax:g,invoiceLists:_,sealMark:f,remarks:y}=this.invoiceData,b={payment_code:e,collection_unit_code:t,bill_code:a,verification_code:i,collection_unit_name:n,bill_number:s,fill_date:c,payer_name:d,payer_bank:l,payer_account:p,payee_name:u,payee_account:m,payee_bank:v,amount_words:h||r(g),amount_figures:this.formateAmout(g),project_code:_[0]?.commodityNo,project_name:_[0]?.commodityName,number:this.formateAmout(_[0]?.quantity),fee_standards:this.formateAmout(_[0]?.standard),sum_price:this.formateAmout(_[0]?.amount),collection_unit:"",operator_name:f,remark:y,file:this.filePath};(0,o.Uw)(b).then((e=>{1==e.code?(this.$message.success(e.msg),setTimeout((()=>{window.open("about:blank","_self").close()}),3e3)):this.$message.error(e.msg)})).catch((e=>{console.log("🚀 ~ savePayment ~ err:",e)}))},formateAmout(e){return e.replace(/,/g,"")},back(){window.open("about:blank","_self").close()}}},l=d,p=a(1656),u=(0,p.A)(l,i,n,!1,null,"3b07d5f4",null),m=u.exports},5139:function(e,t,a){a.d(t,{Ht:function(){return f},tb:function(){return g},T$:function(){return p},TJ:function(){return l},Em:function(){return u},$A:function(){return y},e:function(){return b},nl:function(){return _},Uw:function(){return m},K9:function(){return h},mv:function(){return v}});var i=a(417),n=a(4927);const o=i.A.create({baseURL:window.location.origin,timeout:5e4,headers:{"Content-Type":"application/json"}});o.interceptors.request.use((e=>{if(!e.url.includes("/api/v2/recogInvoive.do")){const t=localStorage.getItem("accessToken");t&&(e.headers.accessToken=t)}return e}),(e=>Promise.reject(e))),o.interceptors.response.use((e=>{let t=e.data;return e.headers["x-subject-token"]&&(t={...e.data,"x-subject-token":e.headers["x-subject-token"]}),t.code&&0!==t.code?401!==t.code?t:void(window.location.href="/"):t}),(e=>(-1!=e.message.indexOf("timeout")?n.Message.error("网络超时"):"Network Error"==e.message?n.Message.error("网络连接错误"):e.response.data?n.Message.error(e.response.data.message||e.response.statusText):n.Message.error("接口路径找不到"),Promise.reject(e))));var s=o;const r="OAnbVZhEuY5UNB9WbDeqstbj",c="1mMtAGw9ZgoblmNpTrk0SQFikFHFVsbh",d=()=>{let e={method:"POST",url:`/bdapi/oauth/2.0/token?client_id=${r}&client_secret=${c}&grant_type=client_credentials`,headers:{"Content-Type":"application/x-www-form-urlencoded"}};return new Promise(((t,a)=>{s(e).then((e=>{t(e.access_token)})).catch((e=>{a(e)}))}))},l=async(e={})=>s({url:"/bdapi/rpc/2.0/brain/solution/faceprint/result/simple?access_token="+await d(),method:"post",headers:{"Content-Type":"application/json",Accept:"application/json"},data:e}),p=async(e={})=>s({url:"/bdapi/rest/2.0/ocr/v1/idcard?access_token="+await d(),method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},data:e}),u=async(e={})=>s({url:"https://netocr.com/api/v2/recogInvoive.do",method:"post",headers:{"Content-Type":"multipart/form-data"},data:e}),m=async(e={})=>s({url:"/obpm/magic-api/tax/payment",method:"post",data:e}),v=async(e={})=>s({url:"/v5api/v3/shared/common/resources",method:"post",data:e}),h=async(e={})=>s({url:"/v5api/v3/shared/common/resources/base64",method:"post",data:e}),g=async(e={},t)=>s({url:"/v5api/v3/wechat/cgi-bin/confirm-check-status",method:"post",data:e,headers:t});function _(e,t){return s(`${t}/identify/api/baidu/match-face`,{method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded"},data:{bizFaceMode:"UNIAPP",vtp:70,appointChannel:"UNIAPP",...e}})}function f(e){const t=new FormData;return t.append("xfile",e),(0,i.A)({method:"post",url:"https://identify.qiye.baibaodun.com.cn:14433/identify/api/common/upload-file",headers:{"Content-Type":"application/x-www-form-urlencoded"},data:t})}const y=async()=>s({url:"/hwapi/v3/auth/tokens",method:"post",headers:{"Content-Type":"application/json",Accept:"application/json"},data:{auth:{identity:{methods:["password"],password:{user:{name:"bcxin_yw",password:"Bcxin#202103#5186",domain:{name:"bcxin_yw"}}}},scope:{project:{name:"cn-north-4"}}}}}),b=async(e,t)=>s({url:"/hwfaceapi/v2/967cb11fa5304894816463bde95c8a78/face-detect",method:"post",headers:{...t},data:e})},1818:function(e,t,a){a.d(t,{Q:function(){return n}});var i=a(5139);function n(e,t){const a=e.file,{onSuccess:n,context:o,domainId:s="default"}=t;let r=a.name.replace(/\+/g,""),c=new File([a],r,{type:a.type});(0,i.Ht)(c).then((e=>{console.log("上传成功:",e.data.data),e.data&&"function"===typeof n&&n.call(o,e.data.data)})).catch((e=>{console.error("文件上传失败:",e),o.$message({type:"error",message:"上传失败"})}))}},6874:function(e,t,a){e.exports=a.p+"img/invoice.efb69c8d.png"}}]); //# sourceMappingURL=909.cbd332f1.js.map