mg-ocr-invoice 0.3.7 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +6 -4
- package/dist/index.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/InvoiceList/index.vue +7 -3
package/dist/index.es.js
CHANGED
|
@@ -6282,7 +6282,7 @@ const takePhoto = () => new Promise((n, r) => {
|
|
|
6282
6282
|
}, a.oncancel = () => {
|
|
6283
6283
|
document.body.removeChild(a);
|
|
6284
6284
|
}, a.click();
|
|
6285
|
-
}), _withScopeId$1 = (n) => (pushScopeId("data-v-
|
|
6285
|
+
}), _withScopeId$1 = (n) => (pushScopeId("data-v-ed4c4716"), n = n(), popScopeId(), n), _hoisted_1$2 = { class: "InvoiceList" }, _hoisted_2$2 = { class: "selectAll" }, _hoisted_3$2 = { class: "left" }, _hoisted_4$2 = { class: "right" }, _hoisted_5$1 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createElementVNode("span", null, "全选", -1)), _hoisted_6$1 = { class: "card" }, _hoisted_7$1 = ["onClick"], _hoisted_8$1 = { class: "li" }, _hoisted_9 = {
|
|
6286
6286
|
key: 0,
|
|
6287
6287
|
class: "item-card"
|
|
6288
6288
|
}, _hoisted_10 = ["onClick"], _hoisted_11 = { class: "storeName" }, _hoisted_12 = { class: "name" }, _hoisted_13 = { class: "left" }, _hoisted_14 = {
|
|
@@ -6339,9 +6339,11 @@ const takePhoto = () => new Promise((n, r) => {
|
|
|
6339
6339
|
ce.code === 200 && (v.value = ce.data.invoiceList.map((he) => {
|
|
6340
6340
|
let ve = v.value.find((be) => be.taskId === he.taskId) || {};
|
|
6341
6341
|
return {
|
|
6342
|
-
...
|
|
6342
|
+
...he,
|
|
6343
|
+
selected: ve.selected
|
|
6344
|
+
// ...Object.assign(data, item),
|
|
6343
6345
|
};
|
|
6344
|
-
}), b.value = ce.data.batchId, v.value.length <= 0 ? O.value = !1 : k(), F(v.value));
|
|
6346
|
+
}), console.log(v.value), b.value = ce.data.batchId, v.value.length <= 0 ? O.value = !1 : k(), F(v.value));
|
|
6345
6347
|
} catch (ce) {
|
|
6346
6348
|
console.log(ce), z(ce);
|
|
6347
6349
|
}
|
|
@@ -6659,7 +6661,7 @@ const takePhoto = () => new Promise((n, r) => {
|
|
|
6659
6661
|
}, 8, ["show"])
|
|
6660
6662
|
], 64));
|
|
6661
6663
|
}
|
|
6662
|
-
}),
|
|
6664
|
+
}), index_vue_vue_type_style_index_0_scoped_ed4c4716_lang = "", InvoiceList = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-ed4c4716"]]), _withScopeId = (n) => (pushScopeId("data-v-58773602"), n = n(), popScopeId(), n), _hoisted_1$1 = { class: "PaymentMode" }, _hoisted_2$1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "title" }, "选择识别方式", -1)), _hoisted_3$1 = { class: "list" }, _hoisted_4$1 = ["onClick"], _hoisted_5 = { class: "left-text" }, _hoisted_6 = { class: "icon-left" }, _hoisted_7 = { class: "text" }, _hoisted_8 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "right-icon" }, [
|
|
6663
6665
|
/* @__PURE__ */ createElementVNode("i", { class: "iconfont icon-xiangyou" })
|
|
6664
6666
|
], -1)), _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
6665
6667
|
__name: "index",
|
package/dist/index.umd.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* Released under the MIT license
|
|
17
17
|
*
|
|
18
18
|
* Date: 2023-02-28T14:09:41.732Z
|
|
19
|
-
*/var canvasToBlob={exports:{}};(function(n){typeof window>"u"||function(r){var o=r.HTMLCanvasElement&&r.HTMLCanvasElement.prototype,a=r.Blob&&function(){try{return!!new Blob}catch{return!1}}(),l=a&&r.Uint8Array&&function(){try{return new Blob([new Uint8Array(100)]).size===100}catch{return!1}}(),f=r.BlobBuilder||r.WebKitBlobBuilder||r.MozBlobBuilder||r.MSBlobBuilder,e=/^data:((.*?)(;charset=.*?)?)(;base64)?,/,p=(a||f)&&r.atob&&r.ArrayBuffer&&r.Uint8Array&&function(b){var _,w,E,C,L,O,S,k,$;if(_=b.match(e),!_)throw new Error("invalid data URI");for(w=_[2]?_[1]:"text/plain"+(_[3]||";charset=US-ASCII"),E=!!_[4],C=b.slice(_[0].length),E?L=atob(C):L=decodeURIComponent(C),O=new ArrayBuffer(L.length),S=new Uint8Array(O),k=0;k<L.length;k+=1)S[k]=L.charCodeAt(k);return a?new Blob([l?S:O],{type:w}):($=new f,$.append(O),$.getBlob(w))};r.HTMLCanvasElement&&!o.toBlob&&(o.mozGetAsFile?o.toBlob=function(b,_,w){var E=this;setTimeout(function(){w&&o.toDataURL&&p?b(p(E.toDataURL(_,w))):b(E.mozGetAsFile("blob",_))})}:o.toDataURL&&p&&(o.msToBlob?o.toBlob=function(b,_,w){var E=this;setTimeout(function(){(_&&_!=="image/png"||w)&&o.toDataURL&&p?b(p(E.toDataURL(_,w))):b(E.msToBlob(_))})}:o.toBlob=function(b,_,w){var E=this;setTimeout(function(){b(p(E.toDataURL(_,w)))})})),n.exports?n.exports=p:r.dataURLtoBlob=p}(window)})(canvasToBlob);const takePhoto=()=>new Promise((n,r)=>{var o=document.createElement("input");o.type="file",o.accept="image/*",o.capture="camera",o.style.display="none",document.body.appendChild(o);let a=new FormData;o.onchange=async function(l){var f=l.target.files[0];try{const e=await f,p=e.size,b=20*1024*1024;if(p>b)return showToast({message:"文件大小不能超过20MB",type:"text",teleport:"#iDOCRInvoice"}),r();a.append("invoiceFiles",e),document.body.removeChild(o),n(a)}catch(e){console.log(e),document.body.removeChild(o),r(e)}},o.oncancel=()=>{document.body.removeChild(o)},o.click()}),fileType=[".jpg ,.png ,.bpm ,.jpeg ,.pdf ,.ofd ,.ofdx ,.jpe",".JPG ,.PNG ,.BPM ,.JPEG ,.PDF ,.OFD ,.OFDX ,.JPE"],selectPhoto=async n=>new Promise((r,o)=>{var a=document.createElement("input");a.type="file",a.accept=fileType.join(","),a.multiple=n,a.style.display="none",document.body.appendChild(a);let l=new FormData;a.onchange=async function(f){var e=f.target.files;if(e.length>9){a.value="",showFailToast("一次最多选择9张图片!");return}for(let p=0;p<e.length;p++){const b=e[p];try{const _=b,w=_.size,E=20*1024*1024;if(w>E){showToast({message:"文件大小不能超过20MB",type:"text",teleport:"#iDOCRInvoice"}),o();break}l.append("invoiceFiles",_),r(l)}catch(_){console.log(_),o(_)}}document.body.removeChild(a)},a.oncancel=()=>{document.body.removeChild(a)},a.click()}),_withScopeId$1=n=>(vue.pushScopeId("data-v-552cea3a"),n=n(),vue.popScopeId(),n),_hoisted_1$2={class:"InvoiceList"},_hoisted_2$2={class:"selectAll"},_hoisted_3$2={class:"left"},_hoisted_4$2={class:"right"},_hoisted_5$1=_withScopeId$1(()=>vue.createElementVNode("span",null,"全选",-1)),_hoisted_6$1={class:"card"},_hoisted_7$1=["onClick"],_hoisted_8$1={class:"li"},_hoisted_9={key:0,class:"item-card"},_hoisted_10=["onClick"],_hoisted_11={class:"storeName"},_hoisted_12={class:"name"},_hoisted_13={class:"left"},_hoisted_14={key:0,class:"right"},_hoisted_15={class:"tags"},_hoisted_16={key:0,class:"manual"},_hoisted_17={key:1},_hoisted_18={class:"InvoiceInfo"},_hoisted_19={class:"leftinfo"},_hoisted_20={class:"item-info"},_hoisted_21=_withScopeId$1(()=>vue.createElementVNode("span",{class:"label"},"发票金额",-1)),_hoisted_22={class:"value price"},_hoisted_23={class:"item-info"},_hoisted_24=_withScopeId$1(()=>vue.createElementVNode("span",{class:"label"},"发票抬头",-1)),_hoisted_25={class:"value"},_hoisted_26={class:"item-info"},_hoisted_27=_withScopeId$1(()=>vue.createElementVNode("span",{class:"label"},"发票类型",-1)),_hoisted_28={class:"value"},_hoisted_29={class:"item-info"},_hoisted_30=_withScopeId$1(()=>vue.createElementVNode("span",{class:"label"},"发票时间",-1)),_hoisted_31={class:"value"},_hoisted_32={class:"rightCheckbox"},_hoisted_33=["onUpdate:modelValue"],_hoisted_34={key:1,style:{"background-color":"#fff",padding:"21px 0 15px 12px",position:"relative",width:"100%"}},_hoisted_35={key:2,class:"err-card"},_hoisted_36=["onClick"],_hoisted_37=["src"],_hoisted_38={class:"right-errText"},_hoisted_39=_withScopeId$1(()=>vue.createElementVNode("div",{class:"title"},[vue.createElementVNode("span",null,"识别失败")],-1)),_hoisted_40={class:"content"},_hoisted_41=_withScopeId$1(()=>vue.createElementVNode("div",{class:"recognitionResult"},[vue.createElementVNode("p",{class:"errContent"},"OCR识别失败"),vue.createElementVNode("p",null,"可以重新拍照识别,或手动添加信息导入")],-1)),_hoisted_42=["onUpdate:modelValue"],_hoisted_43={class:"btn-form"},_hoisted_44={class:"operate"},_hoisted_45=_withScopeId$1(()=>vue.createElementVNode("span",null,"移除",-1)),_hoisted_46=[_hoisted_45],_hoisted_47={class:"right-btn"},_hoisted_48={class:"boxPopup"},_hoisted_49=_withScopeId$1(()=>vue.createElementVNode("div",{class:"title"},[vue.createElementVNode("span",null,"添加发票")],-1)),_sfc_main$2=vue.defineComponent({__name:"index",props:{listId:{required:!1,type:String},multiple:{required:!0,type:Boolean},catchList:{},businessLicense:{required:!1,type:String},taxCode:{required:!1,type:String}},emits:["edit","ok"],setup(n,{emit:r}){const o=r,a=n,l=vue.ref(sessionStorage.getItem("token")),f=vue.ref(!1),e=vue.ref(!1),p=vue.ref([]);a.catchList&&(p.value=a.catchList);const b=vue.ref(""),_=vue.computed(()=>p.value.filter(F=>F.selected).map(F=>F.taskId)),w=async()=>new Promise(async(F,z)=>{const J={};if(J.batchId=a.listId,!!J.batchId)try{const ce=await __getUploadInvoiceList(J,l.value);ce.code===200&&(p.value=ce.data.invoiceList.map(ve=>{let pe=p.value.find(be=>be.taskId===ve.taskId)||{};return{...Object.assign(pe,ve)}}),b.value=ce.data.batchId,p.value.length<=0?O.value=!1:k(),F(p.value))}catch(ce){console.log(ce),z(ce)}}),E=F=>{if(console.log(F.invoiceStatus),F.invoiceStatus!=="unused")return showToast({type:"text",teleport:"#iDOCRInvoice",message:"发票已被使用!"});F.selected=!F.selected},C=F=>{o("edit",{taskId:F.taskId,batchId:b.value},F,p.value)},L=F=>F.invoiceStatus==="unused"?!!(F.manualModify||!F.invoiceExceptionInfo):!1,O=vue.ref(!1),S=F=>{O.value&&showToast({type:"text",message:"存在已使用或异常发票, 已自动过滤",teleport:"#iDOCRInvoice"}),p.value.forEach(z=>{z.selected=L(z)&&O.value})},k=()=>{const F=p.value.filter(z=>L(z)).every(z=>z.selected);O.value=F},$=()=>{if(_.value.length<=0){showToast({type:"text",message:"请先选择发票",teleport:"#iDOCRInvoice"});return}showConfirmDialog({title:"提醒",message:"请确认是否需要移除选中项,移除后不可恢复!",teleport:"#iDOCRInvoice"}).then(async()=>{var F=new URLSearchParams;F.append("batchId",b.value);const z=_.value.join(",");F.append("taskIds",z),(await __deleteInvoice(F,l.value)).code===200&&(showToast({type:"success",message:"移除成功",teleport:"#iDOCRInvoice"}),w())}).catch(()=>{})},I=()=>{e.value=!0},A=async F=>{let z;F===1?z=await selectPhoto(a.multiple):z=await takePhoto(),z.append("batchId",b.value),z.append("businessLicense",a.businessLicense||""),z.append("taxCode",a.taxCode||""),f.value=!0,e.value=!1;try{(await __uploadInvoice(z)).code===200&&(showToast({type:"success",message:"上传成功",teleport:"#iDOCRInvoice"}),ie())}catch(J){console.log(J),ie()}f.value=!1},G=vue.computed(()=>p.value.filter(z=>z.selected).every(z=>L(z))&&p.value.filter(z=>z.selected).length>0),U=vue.computed(()=>p.value.filter(F=>F.selected&&L(F)).length),D=vue.computed(()=>p.value.filter(F=>L(F)).length),B=F=>{showImagePreview([F])},H=()=>{if(_.value.length<=0){showToast({type:"text",message:"请先选择发票",teleport:"#iDOCRInvoice"});return}if(!G.value){showToast({type:"text",message:"发票无效或已被使用,请进行确认",teleport:"#iDOCRInvoice"});return}const F=p.value.filter(J=>J.selected).map(J=>{let ce=VerificationOfTruth(J);return{...J,...ce}});if(F.some(J=>J.invoiceCompanyType==="异常抬头")){showConfirmDialog({title:"提醒",message:"存在异常抬头发票,请确认是否继续提交?",teleport:"#iDOCRInvoice",cancelButtonText:"返回修改",confirmButtonText:"继续提交"}).then(()=>{o("ok",F,b.value)}).catch(()=>{});return}o("ok",F,b.value)};vue.ref(null);const ie=()=>{w().then(F=>{F.some(J=>J.taskStatus==="ocr_doing"||J.taskStatus==="ocr_success")&&setTimeout(ie,2e3)}).catch(F=>{setTimeout(ie,2e3)})};return vue.onMounted(()=>{ie()}),(F,z)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",_hoisted_1$2,[vue.createElementVNode("div",_hoisted_2$2,[vue.createElementVNode("div",_hoisted_3$2," 已选 "+vue.toDisplayString(U.value)+"/"+vue.toDisplayString(D.value),1),vue.createElementVNode("div",_hoisted_4$2,[_hoisted_5$1,vue.withDirectives(vue.createElementVNode("input",{type:"checkbox",onChange:vue.withModifiers(S,["self"]),"onUpdate:modelValue":z[0]||(z[0]=J=>O.value=J),onClick:z[1]||(z[1]=vue.withModifiers(()=>{},["stop"])),class:"checkbox"},null,544),[[vue.vModelCheckbox,O.value]])])]),vue.createElementVNode("div",_hoisted_6$1,[vue.createElementVNode("ul",null,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(p.value,(J,ce)=>(vue.openBlock(),vue.createElementBlock("li",{key:ce,onClick:ve=>E(J)},[vue.createElementVNode("div",_hoisted_8$1,[J.taskStatus==="finish"||J.taskStatus==="repeat"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_9,[vue.createElementVNode("div",{class:"details-btn",onClick:vue.withModifiers(ve=>C(J),["stop"])}," 详情 ",8,_hoisted_10),vue.createElementVNode("div",{class:vue.normalizeClass(["title",{company:J.invoiceCompanyType==="公司",err:J.invoiceCompanyType==="异常抬头"}])},vue.toDisplayString(J.invoiceCompanyType),3),vue.createElementVNode("div",_hoisted_11,[vue.createElementVNode("div",_hoisted_12,[vue.createElementVNode("div",_hoisted_13,vue.toDisplayString(J.sellerName),1),J.taskStatus==="repeat"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_14," 已收录 ")):vue.createCommentVNode("",!0)]),vue.createElementVNode("div",_hoisted_15,[J.manualModify?(vue.openBlock(),vue.createElementBlock("span",_hoisted_16," 手工录入 ")):J.invoiceExceptionInfo?(vue.openBlock(),vue.createElementBlock("div",_hoisted_17,[vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(setClass)(J.invoiceExceptionInfo))},vue.toDisplayString(vue.unref(const_invoiceExceptionInfo)[J.invoiceExceptionInfo]),3)])):(vue.openBlock(),vue.createElementBlock("span",{key:2,class:vue.normalizeClass(vue.unref(setClass)(J.realStatus))},vue.toDisplayString(vue.unref(const_realStatus)[J.realStatus]),3)),vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(setClass)(J.invoiceStatus))},vue.toDisplayString(vue.unref(const_invoiceStatus)[J.invoiceStatus]),3)]),vue.createElementVNode("div",_hoisted_18,[vue.createElementVNode("div",_hoisted_19,[vue.createElementVNode("div",_hoisted_20,[_hoisted_21,vue.createElementVNode("span",_hoisted_22,"¥"+vue.toDisplayString(J.priceTaxTotalFigure||J.noTaxAmountTotal),1)]),vue.createElementVNode("div",_hoisted_23,[_hoisted_24,vue.createElementVNode("span",_hoisted_25,vue.toDisplayString(J.payerName),1)]),vue.createElementVNode("div",_hoisted_26,[_hoisted_27,vue.createElementVNode("span",_hoisted_28,vue.toDisplayString(J.description),1)]),vue.createElementVNode("div",_hoisted_29,[_hoisted_30,vue.createElementVNode("span",_hoisted_31,vue.toDisplayString(J.invoiceDate),1)])]),vue.createElementVNode("div",_hoisted_32,[vue.withDirectives(vue.createElementVNode("input",{onClick:z[2]||(z[2]=vue.withModifiers(()=>{},["stop"])),type:"checkbox",class:"checkbox",onChange:k,"onUpdate:modelValue":ve=>J.selected=ve,"icon-size":"22px"},null,40,_hoisted_33),[[vue.vModelCheckbox,J.selected]])])])])])):J.taskStatus==="ocr_doing"||J.taskStatus==="ocr_success"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_34,[vue.createVNode(vue.unref(Loading),{class:"loading",color:"#0094ff"},{default:vue.withCtx(()=>[vue.createTextVNode("识别中...")]),_:1}),vue.createVNode(vue.unref(Skeleton),{loading:!0,title:"",row:6})])):(vue.openBlock(),vue.createElementBlock("div",_hoisted_35,[vue.createElementVNode("div",{class:"left-img",onClick:ve=>B(J.fileUrlKey)},[vue.createElementVNode("img",{src:J.fileUrlKey,alt:""},null,8,_hoisted_37)],8,_hoisted_36),vue.createElementVNode("div",_hoisted_38,[_hoisted_39,vue.createElementVNode("div",_hoisted_40,[_hoisted_41,vue.createElementVNode("div",null,[vue.withDirectives(vue.createElementVNode("input",{type:"checkbox",class:"checkbox",onClick:z[3]||(z[3]=vue.withModifiers(()=>{},["stop"])),"onUpdate:modelValue":ve=>J.selected=ve},null,8,_hoisted_42),[[vue.vModelCheckbox,J.selected]])])])])]))])],8,_hoisted_7$1))),128))])]),vue.createElementVNode("div",_hoisted_43,[vue.createElementVNode("div",_hoisted_44,[vue.createElementVNode("div",{class:"delete",onClick:$},_hoisted_46),vue.createElementVNode("div",_hoisted_47,[vue.createElementVNode("span",{class:"add",onClick:I},"继续添加发票"),vue.createElementVNode("span",{class:vue.normalizeClass(["ok",{disabledColor:!G.value}]),onClick:H},"确定选择",2)])])])]),vue.createVNode(vue.unref(Popup),{show:e.value,"onUpdate:show":z[6]||(z[6]=J=>e.value=J),teleport:"#iDOCRInvoice",position:"bottom",closeable:""},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_48,[_hoisted_49,vue.createElementVNode("div",{style:{"padding-bottom":"24px"},onClick:z[4]||(z[4]=J=>A(1))},"从相册中选择"),vue.createElementVNode("div",{onClick:z[5]||(z[5]=J=>A(2))},"拍照上传")])]),_:1},8,["show"]),vue.createVNode(vue.unref(Overlay),{style:{display:"flex","justify-content":"center","align-items":"center"},show:f.value},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(Loading),{class:"loading",color:"#0094ff"},{default:vue.withCtx(()=>[vue.createTextVNode("上传中...")]),_:1})]),_:1},8,["show"])],64))}}),index_vue_vue_type_style_index_0_scoped_552cea3a_lang="",InvoiceList=_export_sfc(_sfc_main$2,[["__scopeId","data-v-552cea3a"]]),_withScopeId=n=>(vue.pushScopeId("data-v-58773602"),n=n(),vue.popScopeId(),n),_hoisted_1$1={class:"PaymentMode"},_hoisted_2$1=_withScopeId(()=>vue.createElementVNode("div",{class:"title"},"选择识别方式",-1)),_hoisted_3$1={class:"list"},_hoisted_4$1=["onClick"],_hoisted_5={class:"left-text"},_hoisted_6={class:"icon-left"},_hoisted_7={class:"text"},_hoisted_8=_withScopeId(()=>vue.createElementVNode("div",{class:"right-icon"},[vue.createElementVNode("i",{class:"iconfont icon-xiangyou"})],-1)),_sfc_main$1=vue.defineComponent({__name:"index",props:["multiple","batchId","taxCode","businessLicense"],emits:["uploadSuccess"],setup(n,{emit:r}){const o=n,a=r,l=[{text:"拍照",leftIcon:"icon-xiangji"},{text:"相册",leftIcon:"icon-xiangce"}];document.title="请选择添加费用方式";const f=vue.ref(!1),e=async p=>{let b;p=="拍照"&&(b=await takePhoto()),p=="相册"&&(b=await selectPhoto(o.multiple)),o.batchId&&b.append("batchId",o.batchId),b.append("businessLicense",o.businessLicense||""),b.append("taxCode",o.taxCode||""),f.value=!0;try{const _=await __uploadInvoice(b);_.code===200&&(showToast({type:"success",message:"上传成功",teleport:"#iDOCRInvoice"}),a("uploadSuccess",_.data))}catch(_){console.log(_),showFailToast(_.msg)}f.value=!1};return(p,b)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",_hoisted_1$1,[_hoisted_2$1,vue.createElementVNode("div",_hoisted_3$1,[(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,vue.renderList(l,(_,w)=>vue.createElementVNode("div",{class:"method-item",onClick:E=>e(_.text),key:_.id||w},[vue.createElementVNode("div",_hoisted_5,[vue.createElementVNode("span",_hoisted_6,[vue.createElementVNode("i",{class:vue.normalizeClass(["iconfont",_.leftIcon])},null,2)]),vue.createElementVNode("span",_hoisted_7,vue.toDisplayString(_.text),1)]),_hoisted_8],8,_hoisted_4$1)),64))])]),vue.createVNode(vue.unref(Overlay),{style:{display:"flex","justify-content":"center","align-items":"center"},show:f.value},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(Loading),{class:"loading",color:"#0094ff"},{default:vue.withCtx(()=>[vue.createTextVNode("上传中...")]),_:1})]),_:1},8,["show"])],64))}}),index_vue_vue_type_style_index_0_scoped_58773602_lang="",PaymentMode=_export_sfc(_sfc_main$1,[["__scopeId","data-v-58773602"]]);function getUrlParams(n){const r={},o=n.split("?")[1];return o&&o.split("&").forEach(l=>{const[f,e]=l.split("=");r[f]=decodeURIComponent(e)}),r}var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var vconsole_min={exports:{}};/*!
|
|
19
|
+
*/var canvasToBlob={exports:{}};(function(n){typeof window>"u"||function(r){var o=r.HTMLCanvasElement&&r.HTMLCanvasElement.prototype,a=r.Blob&&function(){try{return!!new Blob}catch{return!1}}(),l=a&&r.Uint8Array&&function(){try{return new Blob([new Uint8Array(100)]).size===100}catch{return!1}}(),f=r.BlobBuilder||r.WebKitBlobBuilder||r.MozBlobBuilder||r.MSBlobBuilder,e=/^data:((.*?)(;charset=.*?)?)(;base64)?,/,p=(a||f)&&r.atob&&r.ArrayBuffer&&r.Uint8Array&&function(b){var _,w,E,C,L,O,S,k,$;if(_=b.match(e),!_)throw new Error("invalid data URI");for(w=_[2]?_[1]:"text/plain"+(_[3]||";charset=US-ASCII"),E=!!_[4],C=b.slice(_[0].length),E?L=atob(C):L=decodeURIComponent(C),O=new ArrayBuffer(L.length),S=new Uint8Array(O),k=0;k<L.length;k+=1)S[k]=L.charCodeAt(k);return a?new Blob([l?S:O],{type:w}):($=new f,$.append(O),$.getBlob(w))};r.HTMLCanvasElement&&!o.toBlob&&(o.mozGetAsFile?o.toBlob=function(b,_,w){var E=this;setTimeout(function(){w&&o.toDataURL&&p?b(p(E.toDataURL(_,w))):b(E.mozGetAsFile("blob",_))})}:o.toDataURL&&p&&(o.msToBlob?o.toBlob=function(b,_,w){var E=this;setTimeout(function(){(_&&_!=="image/png"||w)&&o.toDataURL&&p?b(p(E.toDataURL(_,w))):b(E.msToBlob(_))})}:o.toBlob=function(b,_,w){var E=this;setTimeout(function(){b(p(E.toDataURL(_,w)))})})),n.exports?n.exports=p:r.dataURLtoBlob=p}(window)})(canvasToBlob);const takePhoto=()=>new Promise((n,r)=>{var o=document.createElement("input");o.type="file",o.accept="image/*",o.capture="camera",o.style.display="none",document.body.appendChild(o);let a=new FormData;o.onchange=async function(l){var f=l.target.files[0];try{const e=await f,p=e.size,b=20*1024*1024;if(p>b)return showToast({message:"文件大小不能超过20MB",type:"text",teleport:"#iDOCRInvoice"}),r();a.append("invoiceFiles",e),document.body.removeChild(o),n(a)}catch(e){console.log(e),document.body.removeChild(o),r(e)}},o.oncancel=()=>{document.body.removeChild(o)},o.click()}),fileType=[".jpg ,.png ,.bpm ,.jpeg ,.pdf ,.ofd ,.ofdx ,.jpe",".JPG ,.PNG ,.BPM ,.JPEG ,.PDF ,.OFD ,.OFDX ,.JPE"],selectPhoto=async n=>new Promise((r,o)=>{var a=document.createElement("input");a.type="file",a.accept=fileType.join(","),a.multiple=n,a.style.display="none",document.body.appendChild(a);let l=new FormData;a.onchange=async function(f){var e=f.target.files;if(e.length>9){a.value="",showFailToast("一次最多选择9张图片!");return}for(let p=0;p<e.length;p++){const b=e[p];try{const _=b,w=_.size,E=20*1024*1024;if(w>E){showToast({message:"文件大小不能超过20MB",type:"text",teleport:"#iDOCRInvoice"}),o();break}l.append("invoiceFiles",_),r(l)}catch(_){console.log(_),o(_)}}document.body.removeChild(a)},a.oncancel=()=>{document.body.removeChild(a)},a.click()}),_withScopeId$1=n=>(vue.pushScopeId("data-v-ed4c4716"),n=n(),vue.popScopeId(),n),_hoisted_1$2={class:"InvoiceList"},_hoisted_2$2={class:"selectAll"},_hoisted_3$2={class:"left"},_hoisted_4$2={class:"right"},_hoisted_5$1=_withScopeId$1(()=>vue.createElementVNode("span",null,"全选",-1)),_hoisted_6$1={class:"card"},_hoisted_7$1=["onClick"],_hoisted_8$1={class:"li"},_hoisted_9={key:0,class:"item-card"},_hoisted_10=["onClick"],_hoisted_11={class:"storeName"},_hoisted_12={class:"name"},_hoisted_13={class:"left"},_hoisted_14={key:0,class:"right"},_hoisted_15={class:"tags"},_hoisted_16={key:0,class:"manual"},_hoisted_17={key:1},_hoisted_18={class:"InvoiceInfo"},_hoisted_19={class:"leftinfo"},_hoisted_20={class:"item-info"},_hoisted_21=_withScopeId$1(()=>vue.createElementVNode("span",{class:"label"},"发票金额",-1)),_hoisted_22={class:"value price"},_hoisted_23={class:"item-info"},_hoisted_24=_withScopeId$1(()=>vue.createElementVNode("span",{class:"label"},"发票抬头",-1)),_hoisted_25={class:"value"},_hoisted_26={class:"item-info"},_hoisted_27=_withScopeId$1(()=>vue.createElementVNode("span",{class:"label"},"发票类型",-1)),_hoisted_28={class:"value"},_hoisted_29={class:"item-info"},_hoisted_30=_withScopeId$1(()=>vue.createElementVNode("span",{class:"label"},"发票时间",-1)),_hoisted_31={class:"value"},_hoisted_32={class:"rightCheckbox"},_hoisted_33=["onUpdate:modelValue"],_hoisted_34={key:1,style:{"background-color":"#fff",padding:"21px 0 15px 12px",position:"relative",width:"100%"}},_hoisted_35={key:2,class:"err-card"},_hoisted_36=["onClick"],_hoisted_37=["src"],_hoisted_38={class:"right-errText"},_hoisted_39=_withScopeId$1(()=>vue.createElementVNode("div",{class:"title"},[vue.createElementVNode("span",null,"识别失败")],-1)),_hoisted_40={class:"content"},_hoisted_41=_withScopeId$1(()=>vue.createElementVNode("div",{class:"recognitionResult"},[vue.createElementVNode("p",{class:"errContent"},"OCR识别失败"),vue.createElementVNode("p",null,"可以重新拍照识别,或手动添加信息导入")],-1)),_hoisted_42=["onUpdate:modelValue"],_hoisted_43={class:"btn-form"},_hoisted_44={class:"operate"},_hoisted_45=_withScopeId$1(()=>vue.createElementVNode("span",null,"移除",-1)),_hoisted_46=[_hoisted_45],_hoisted_47={class:"right-btn"},_hoisted_48={class:"boxPopup"},_hoisted_49=_withScopeId$1(()=>vue.createElementVNode("div",{class:"title"},[vue.createElementVNode("span",null,"添加发票")],-1)),_sfc_main$2=vue.defineComponent({__name:"index",props:{listId:{required:!1,type:String},multiple:{required:!0,type:Boolean},catchList:{},businessLicense:{required:!1,type:String},taxCode:{required:!1,type:String}},emits:["edit","ok"],setup(n,{emit:r}){const o=r,a=n,l=vue.ref(sessionStorage.getItem("token")),f=vue.ref(!1),e=vue.ref(!1),p=vue.ref([]);a.catchList&&(p.value=a.catchList);const b=vue.ref(""),_=vue.computed(()=>p.value.filter(F=>F.selected).map(F=>F.taskId)),w=async()=>new Promise(async(F,z)=>{const J={};if(J.batchId=a.listId,!!J.batchId)try{const ce=await __getUploadInvoiceList(J,l.value);ce.code===200&&(p.value=ce.data.invoiceList.map(ve=>{let pe=p.value.find(be=>be.taskId===ve.taskId)||{};return{...ve,selected:pe.selected}}),console.log(p.value),b.value=ce.data.batchId,p.value.length<=0?O.value=!1:k(),F(p.value))}catch(ce){console.log(ce),z(ce)}}),E=F=>{if(console.log(F.invoiceStatus),F.invoiceStatus!=="unused")return showToast({type:"text",teleport:"#iDOCRInvoice",message:"发票已被使用!"});F.selected=!F.selected},C=F=>{o("edit",{taskId:F.taskId,batchId:b.value},F,p.value)},L=F=>F.invoiceStatus==="unused"?!!(F.manualModify||!F.invoiceExceptionInfo):!1,O=vue.ref(!1),S=F=>{O.value&&showToast({type:"text",message:"存在已使用或异常发票, 已自动过滤",teleport:"#iDOCRInvoice"}),p.value.forEach(z=>{z.selected=L(z)&&O.value})},k=()=>{const F=p.value.filter(z=>L(z)).every(z=>z.selected);O.value=F},$=()=>{if(_.value.length<=0){showToast({type:"text",message:"请先选择发票",teleport:"#iDOCRInvoice"});return}showConfirmDialog({title:"提醒",message:"请确认是否需要移除选中项,移除后不可恢复!",teleport:"#iDOCRInvoice"}).then(async()=>{var F=new URLSearchParams;F.append("batchId",b.value);const z=_.value.join(",");F.append("taskIds",z),(await __deleteInvoice(F,l.value)).code===200&&(showToast({type:"success",message:"移除成功",teleport:"#iDOCRInvoice"}),w())}).catch(()=>{})},I=()=>{e.value=!0},A=async F=>{let z;F===1?z=await selectPhoto(a.multiple):z=await takePhoto(),z.append("batchId",b.value),z.append("businessLicense",a.businessLicense||""),z.append("taxCode",a.taxCode||""),f.value=!0,e.value=!1;try{(await __uploadInvoice(z)).code===200&&(showToast({type:"success",message:"上传成功",teleport:"#iDOCRInvoice"}),ie())}catch(J){console.log(J),ie()}f.value=!1},G=vue.computed(()=>p.value.filter(z=>z.selected).every(z=>L(z))&&p.value.filter(z=>z.selected).length>0),U=vue.computed(()=>p.value.filter(F=>F.selected&&L(F)).length),D=vue.computed(()=>p.value.filter(F=>L(F)).length),B=F=>{showImagePreview([F])},H=()=>{if(_.value.length<=0){showToast({type:"text",message:"请先选择发票",teleport:"#iDOCRInvoice"});return}if(!G.value){showToast({type:"text",message:"发票无效或已被使用,请进行确认",teleport:"#iDOCRInvoice"});return}const F=p.value.filter(J=>J.selected).map(J=>{let ce=VerificationOfTruth(J);return{...J,...ce}});if(F.some(J=>J.invoiceCompanyType==="异常抬头")){showConfirmDialog({title:"提醒",message:"存在异常抬头发票,请确认是否继续提交?",teleport:"#iDOCRInvoice",cancelButtonText:"返回修改",confirmButtonText:"继续提交"}).then(()=>{o("ok",F,b.value)}).catch(()=>{});return}o("ok",F,b.value)};vue.ref(null);const ie=()=>{w().then(F=>{F.some(J=>J.taskStatus==="ocr_doing"||J.taskStatus==="ocr_success")&&setTimeout(ie,2e3)}).catch(F=>{setTimeout(ie,2e3)})};return vue.onMounted(()=>{ie()}),(F,z)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",_hoisted_1$2,[vue.createElementVNode("div",_hoisted_2$2,[vue.createElementVNode("div",_hoisted_3$2," 已选 "+vue.toDisplayString(U.value)+"/"+vue.toDisplayString(D.value),1),vue.createElementVNode("div",_hoisted_4$2,[_hoisted_5$1,vue.withDirectives(vue.createElementVNode("input",{type:"checkbox",onChange:vue.withModifiers(S,["self"]),"onUpdate:modelValue":z[0]||(z[0]=J=>O.value=J),onClick:z[1]||(z[1]=vue.withModifiers(()=>{},["stop"])),class:"checkbox"},null,544),[[vue.vModelCheckbox,O.value]])])]),vue.createElementVNode("div",_hoisted_6$1,[vue.createElementVNode("ul",null,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(p.value,(J,ce)=>(vue.openBlock(),vue.createElementBlock("li",{key:ce,onClick:ve=>E(J)},[vue.createElementVNode("div",_hoisted_8$1,[J.taskStatus==="finish"||J.taskStatus==="repeat"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_9,[vue.createElementVNode("div",{class:"details-btn",onClick:vue.withModifiers(ve=>C(J),["stop"])}," 详情 ",8,_hoisted_10),vue.createElementVNode("div",{class:vue.normalizeClass(["title",{company:J.invoiceCompanyType==="公司",err:J.invoiceCompanyType==="异常抬头"}])},vue.toDisplayString(J.invoiceCompanyType),3),vue.createElementVNode("div",_hoisted_11,[vue.createElementVNode("div",_hoisted_12,[vue.createElementVNode("div",_hoisted_13,vue.toDisplayString(J.sellerName),1),J.taskStatus==="repeat"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_14," 已收录 ")):vue.createCommentVNode("",!0)]),vue.createElementVNode("div",_hoisted_15,[J.manualModify?(vue.openBlock(),vue.createElementBlock("span",_hoisted_16," 手工录入 ")):J.invoiceExceptionInfo?(vue.openBlock(),vue.createElementBlock("div",_hoisted_17,[vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(setClass)(J.invoiceExceptionInfo))},vue.toDisplayString(vue.unref(const_invoiceExceptionInfo)[J.invoiceExceptionInfo]),3)])):(vue.openBlock(),vue.createElementBlock("span",{key:2,class:vue.normalizeClass(vue.unref(setClass)(J.realStatus))},vue.toDisplayString(vue.unref(const_realStatus)[J.realStatus]),3)),vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(setClass)(J.invoiceStatus))},vue.toDisplayString(vue.unref(const_invoiceStatus)[J.invoiceStatus]),3)]),vue.createElementVNode("div",_hoisted_18,[vue.createElementVNode("div",_hoisted_19,[vue.createElementVNode("div",_hoisted_20,[_hoisted_21,vue.createElementVNode("span",_hoisted_22,"¥"+vue.toDisplayString(J.priceTaxTotalFigure||J.noTaxAmountTotal),1)]),vue.createElementVNode("div",_hoisted_23,[_hoisted_24,vue.createElementVNode("span",_hoisted_25,vue.toDisplayString(J.payerName),1)]),vue.createElementVNode("div",_hoisted_26,[_hoisted_27,vue.createElementVNode("span",_hoisted_28,vue.toDisplayString(J.description),1)]),vue.createElementVNode("div",_hoisted_29,[_hoisted_30,vue.createElementVNode("span",_hoisted_31,vue.toDisplayString(J.invoiceDate),1)])]),vue.createElementVNode("div",_hoisted_32,[vue.withDirectives(vue.createElementVNode("input",{onClick:z[2]||(z[2]=vue.withModifiers(()=>{},["stop"])),type:"checkbox",class:"checkbox",onChange:k,"onUpdate:modelValue":ve=>J.selected=ve,"icon-size":"22px"},null,40,_hoisted_33),[[vue.vModelCheckbox,J.selected]])])])])])):J.taskStatus==="ocr_doing"||J.taskStatus==="ocr_success"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_34,[vue.createVNode(vue.unref(Loading),{class:"loading",color:"#0094ff"},{default:vue.withCtx(()=>[vue.createTextVNode("识别中...")]),_:1}),vue.createVNode(vue.unref(Skeleton),{loading:!0,title:"",row:6})])):(vue.openBlock(),vue.createElementBlock("div",_hoisted_35,[vue.createElementVNode("div",{class:"left-img",onClick:ve=>B(J.fileUrlKey)},[vue.createElementVNode("img",{src:J.fileUrlKey,alt:""},null,8,_hoisted_37)],8,_hoisted_36),vue.createElementVNode("div",_hoisted_38,[_hoisted_39,vue.createElementVNode("div",_hoisted_40,[_hoisted_41,vue.createElementVNode("div",null,[vue.withDirectives(vue.createElementVNode("input",{type:"checkbox",class:"checkbox",onClick:z[3]||(z[3]=vue.withModifiers(()=>{},["stop"])),"onUpdate:modelValue":ve=>J.selected=ve},null,8,_hoisted_42),[[vue.vModelCheckbox,J.selected]])])])])]))])],8,_hoisted_7$1))),128))])]),vue.createElementVNode("div",_hoisted_43,[vue.createElementVNode("div",_hoisted_44,[vue.createElementVNode("div",{class:"delete",onClick:$},_hoisted_46),vue.createElementVNode("div",_hoisted_47,[vue.createElementVNode("span",{class:"add",onClick:I},"继续添加发票"),vue.createElementVNode("span",{class:vue.normalizeClass(["ok",{disabledColor:!G.value}]),onClick:H},"确定选择",2)])])])]),vue.createVNode(vue.unref(Popup),{show:e.value,"onUpdate:show":z[6]||(z[6]=J=>e.value=J),teleport:"#iDOCRInvoice",position:"bottom",closeable:""},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_48,[_hoisted_49,vue.createElementVNode("div",{style:{"padding-bottom":"24px"},onClick:z[4]||(z[4]=J=>A(1))},"从相册中选择"),vue.createElementVNode("div",{onClick:z[5]||(z[5]=J=>A(2))},"拍照上传")])]),_:1},8,["show"]),vue.createVNode(vue.unref(Overlay),{style:{display:"flex","justify-content":"center","align-items":"center"},show:f.value},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(Loading),{class:"loading",color:"#0094ff"},{default:vue.withCtx(()=>[vue.createTextVNode("上传中...")]),_:1})]),_:1},8,["show"])],64))}}),index_vue_vue_type_style_index_0_scoped_ed4c4716_lang="",InvoiceList=_export_sfc(_sfc_main$2,[["__scopeId","data-v-ed4c4716"]]),_withScopeId=n=>(vue.pushScopeId("data-v-58773602"),n=n(),vue.popScopeId(),n),_hoisted_1$1={class:"PaymentMode"},_hoisted_2$1=_withScopeId(()=>vue.createElementVNode("div",{class:"title"},"选择识别方式",-1)),_hoisted_3$1={class:"list"},_hoisted_4$1=["onClick"],_hoisted_5={class:"left-text"},_hoisted_6={class:"icon-left"},_hoisted_7={class:"text"},_hoisted_8=_withScopeId(()=>vue.createElementVNode("div",{class:"right-icon"},[vue.createElementVNode("i",{class:"iconfont icon-xiangyou"})],-1)),_sfc_main$1=vue.defineComponent({__name:"index",props:["multiple","batchId","taxCode","businessLicense"],emits:["uploadSuccess"],setup(n,{emit:r}){const o=n,a=r,l=[{text:"拍照",leftIcon:"icon-xiangji"},{text:"相册",leftIcon:"icon-xiangce"}];document.title="请选择添加费用方式";const f=vue.ref(!1),e=async p=>{let b;p=="拍照"&&(b=await takePhoto()),p=="相册"&&(b=await selectPhoto(o.multiple)),o.batchId&&b.append("batchId",o.batchId),b.append("businessLicense",o.businessLicense||""),b.append("taxCode",o.taxCode||""),f.value=!0;try{const _=await __uploadInvoice(b);_.code===200&&(showToast({type:"success",message:"上传成功",teleport:"#iDOCRInvoice"}),a("uploadSuccess",_.data))}catch(_){console.log(_),showFailToast(_.msg)}f.value=!1};return(p,b)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",_hoisted_1$1,[_hoisted_2$1,vue.createElementVNode("div",_hoisted_3$1,[(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,vue.renderList(l,(_,w)=>vue.createElementVNode("div",{class:"method-item",onClick:E=>e(_.text),key:_.id||w},[vue.createElementVNode("div",_hoisted_5,[vue.createElementVNode("span",_hoisted_6,[vue.createElementVNode("i",{class:vue.normalizeClass(["iconfont",_.leftIcon])},null,2)]),vue.createElementVNode("span",_hoisted_7,vue.toDisplayString(_.text),1)]),_hoisted_8],8,_hoisted_4$1)),64))])]),vue.createVNode(vue.unref(Overlay),{style:{display:"flex","justify-content":"center","align-items":"center"},show:f.value},{default:vue.withCtx(()=>[vue.createVNode(vue.unref(Loading),{class:"loading",color:"#0094ff"},{default:vue.withCtx(()=>[vue.createTextVNode("上传中...")]),_:1})]),_:1},8,["show"])],64))}}),index_vue_vue_type_style_index_0_scoped_58773602_lang="",PaymentMode=_export_sfc(_sfc_main$1,[["__scopeId","data-v-58773602"]]);function getUrlParams(n){const r={},o=n.split("?")[1];return o&&o.split("&").forEach(l=>{const[f,e]=l.split("=");r[f]=decodeURIComponent(e)}),r}var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var vconsole_min={exports:{}};/*!
|
|
20
20
|
* vConsole v3.15.1 (https://github.com/Tencent/vConsole)
|
|
21
21
|
*
|
|
22
22
|
* Tencent is pleased to support the open source community by making vConsole available.
|