mg-ocr-invoice 0.2.4-beta0.7 → 0.2.4-beta0.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 CHANGED
@@ -6320,7 +6320,7 @@ const takePhoto = () => new Promise((n, r) => {
6320
6320
  }, a.oncancel = () => {
6321
6321
  showToast("11"), document.body.removeChild(a);
6322
6322
  }, a.click();
6323
- }), _withScopeId$1 = (n) => (pushScopeId("data-v-08bf6d6b"), 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 = ["onChange"], _hoisted_7$1 = { class: "card" }, _hoisted_8$1 = ["onClick"], _hoisted_9 = { class: "li" }, _hoisted_10 = {
6323
+ }), _withScopeId$1 = (n) => (pushScopeId("data-v-349bdf4c"), 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 = ["onChange"], _hoisted_7$1 = { class: "card" }, _hoisted_8$1 = ["onClick"], _hoisted_9 = { class: "li" }, _hoisted_10 = {
6324
6324
  key: 0,
6325
6325
  class: "item-card"
6326
6326
  }, _hoisted_11 = ["onClick"], _hoisted_12 = { class: "storeName" }, _hoisted_13 = { class: "name" }, _hoisted_14 = { class: "left" }, _hoisted_15 = {
@@ -6385,7 +6385,7 @@ const takePhoto = () => new Promise((n, r) => {
6385
6385
  X,
6386
6386
  b.value
6387
6387
  );
6388
- }, O = (X) => X.invoiceStatus === "unused" && (X.realStatus === "checked" || X.realStatus === "noNeed" || X.manualModify || X.realStatus === "checkFail") && (X.taskStatus === "ocr_success" || X.taskStatus === "repeat" || X.taskStatus === "finish") && !X.invoiceExceptionInfo, k = ref(!1), I = (X) => {
6388
+ }, O = (X) => X.invoiceStatus === "unused" && ((X.realStatus === "checked" || X.realStatus === "noNeed" || X.realStatus === "checkFail") && (X.taskStatus === "ocr_success" || X.taskStatus === "repeat" || X.taskStatus === "finish") && !X.invoiceExceptionInfo || X.manualModify), k = ref(!1), I = (X) => {
6389
6389
  b.value.forEach((ie) => {
6390
6390
  ie.selected = O(ie) && k.value;
6391
6391
  });
@@ -6642,7 +6642,7 @@ const takePhoto = () => new Promise((n, r) => {
6642
6642
  }, 8, ["show"])
6643
6643
  ], 64));
6644
6644
  }
6645
- }), index_vue_vue_type_style_index_0_scoped_08bf6d6b_lang = "", InvoiceList = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-08bf6d6b"]]), _withScopeId = (n) => (pushScopeId("data-v-87442ad9"), 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" }, [
6645
+ }), index_vue_vue_type_style_index_0_scoped_349bdf4c_lang = "", InvoiceList = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-349bdf4c"]]), _withScopeId = (n) => (pushScopeId("data-v-87442ad9"), 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" }, [
6646
6646
  /* @__PURE__ */ createElementVNode("i", { class: "iconfont icon-xiangyou" })
6647
6647
  ], -1)), _sfc_main$1 = /* @__PURE__ */ defineComponent({
6648
6648
  __name: "index",
package/dist/index.umd.js CHANGED
@@ -14,7 +14,7 @@
14
14
  * Released under the MIT license
15
15
  *
16
16
  * Date: 2023-02-28T14:09:41.732Z
17
- */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,k,I,S;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),k=new Uint8Array(O),I=0;I<L.length;I+=1)k[I]=L.charCodeAt(I);return a?new Blob([l?k:O],{type:w}):(S=new f,S.append(O),S.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("文件大小不能超过20MB"),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()}),selectPhoto=async n=>new Promise((r,o)=>{var a=document.createElement("input");a.type="file",a.accept="image/*, .pdf ,.ofd",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("文件大小不能超过20MB"),o();break}l.append("invoiceFiles",_),r(l)}catch(_){console.log(_),o(_)}}document.body.removeChild(a)},a.oncancel=()=>{showToast("11"),document.body.removeChild(a)},a.click()}),_withScopeId$1=n=>(vue.pushScopeId("data-v-08bf6d6b"),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=["onChange"],_hoisted_7$1={class:"card"},_hoisted_8$1=["onClick"],_hoisted_9={class:"li"},_hoisted_10={key:0,class:"item-card"},_hoisted_11=["onClick"],_hoisted_12={class:"storeName"},_hoisted_13={class:"name"},_hoisted_14={class:"left"},_hoisted_15={key:0,class:"right"},_hoisted_16={class:"tags"},_hoisted_17={key:0,class:"manual"},_hoisted_18={key:1},_hoisted_19={class:"InvoiceInfo"},_hoisted_20={class:"leftinfo"},_hoisted_21={class:"item-info"},_hoisted_22=_withScopeId$1(()=>vue.createElementVNode("span",{class:"label"},"发票金额",-1)),_hoisted_23={class:"value price"},_hoisted_24={class:"item-info"},_hoisted_25=_withScopeId$1(()=>vue.createElementVNode("span",{class:"label"},"发票抬头",-1)),_hoisted_26={class:"value"},_hoisted_27={class:"item-info"},_hoisted_28=_withScopeId$1(()=>vue.createElementVNode("span",{class:"label"},"发票类型",-1)),_hoisted_29={class:"value"},_hoisted_30={class:"item-info"},_hoisted_31=_withScopeId$1(()=>vue.createElementVNode("span",{class:"label"},"发票时间",-1)),_hoisted_32={class:"value"},_hoisted_33={class:"rightCheckbox"},_hoisted_34=["onUpdate:modelValue"],_hoisted_35={key:1,style:{"background-color":"#fff",padding:"21px 0 15px 12px",position:"relative",width:"100%"}},_hoisted_36={key:2,class:"err-card"},_hoisted_37=["onClick"],_hoisted_38=["src"],_hoisted_39={class:"right-errText"},_hoisted_40=_withScopeId$1(()=>vue.createElementVNode("div",{class:"title"},[vue.createElementVNode("span",null,"识别失败")],-1)),_hoisted_41={class:"content"},_hoisted_42=_withScopeId$1(()=>vue.createElementVNode("div",{class:"recognitionResult"},[vue.createElementVNode("p",{class:"errContent"},"OCR识别失败"),vue.createElementVNode("p",null,"可以重新拍照识别,或手动添加信息导入")],-1)),_hoisted_43=["onUpdate:modelValue"],_hoisted_44={class:"btn-form"},_hoisted_45={class:"operate"},_hoisted_46={class:"right-btn"},_hoisted_47={class:"boxPopup"},_hoisted_48=_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:{}},emits:["edit","ok"],setup(n,{emit:r}){const{listId:o,multiple:a,catchList:l}=n,f=vue.ref(sessionStorage.getItem("token")),e=vue.ref(!1),p=vue.ref(!1),b=vue.ref([]);l&&(b.value=l);const _=vue.ref(""),w=vue.computed(()=>b.value.filter(X=>X.selected).map(X=>X.taskId)),E=async()=>new Promise(async(X,ie)=>{const Q={};if(Q.batchId=o,!!Q.batchId)try{const we=await __getUploadInvoiceList(Q,f.value);we.code===200&&(b.value=we.data.invoiceList.map(re=>{let fe=b.value.find(F=>F.taskId===re.taskId)||{};return{...Object.assign(fe,re)}}),_.value=we.data.batchId,b.value.length<=0?k.value=!1:S(),X(b.value))}catch(we){console.log(we),ie(we)}}),C=X=>{X.selected=!X.selected},L=X=>{r("edit",{taskId:X.taskId,batchId:_.value},X,b.value)},O=X=>X.invoiceStatus==="unused"&&(X.realStatus==="checked"||X.realStatus==="noNeed"||X.manualModify||X.realStatus==="checkFail")&&(X.taskStatus==="ocr_success"||X.taskStatus==="repeat"||X.taskStatus==="finish")&&!X.invoiceExceptionInfo,k=vue.ref(!1),I=X=>{b.value.forEach(ie=>{ie.selected=O(ie)&&k.value})},S=()=>{const X=b.value.filter(ie=>O(ie)).every(ie=>ie.selected);k.value=X},$=()=>{if(w.value.length<=0){showToast({type:"text",message:"请先选择发票"});return}showConfirmDialog({title:"提醒",message:"请确认是否需要移除选中项,移除后不可恢复!"}).then(async()=>{var X=new URLSearchParams;X.append("batchId",_.value);const ie=w.value.join(",");X.append("taskIds",ie),(await __deleteInvoice(X,f.value)).code===200&&(showToast({type:"success",message:"移除成功"}),E())}).catch(()=>{})},A=()=>{p.value=!0},U=async X=>{let ie;X===1?ie=await selectPhoto(a):ie=await takePhoto(),ie.append("batchId",_.value),e.value=!0,p.value=!1;try{(await __uploadInvoice(ie)).code===200&&(showToast({type:"success",message:"上传成功"}),ce())}catch(Q){console.log(Q),ce()}e.value=!1},G=vue.computed(()=>b.value.filter(ie=>ie.selected).every(ie=>O(ie))&&b.value.filter(ie=>ie.selected).length>0),R=vue.computed(()=>b.value.filter(X=>X.selected&&O(X)).length),B=vue.computed(()=>b.value.filter(X=>O(X)).length),H=X=>{showImagePreview([X])},ae=()=>{if(w.value.length<=0){showToast({type:"text",message:"请先选择发票"});return}if(!G.value){showToast({type:"text",message:"存在异常发票,无法提交, 请先去修改发票金额"});return}const X=b.value.filter(ie=>ie.selected).map(ie=>{let Q={...ie};return ie.realStatus==="checked"||ie.realStatus==="noNeed"&&!ie.manualModify?Q.verifyTruth=1:ie.manualModify?Q.verifyTruth=2:Q.verifyTruth=3,ie.invoiceStatus==="unused"?Q.checkWeight=1:ie.invoiceStatus==="invalid"?Q.checkWeight=2:Q.checkWeight=3,Q});console.log(X,"selectData"),r("ok",X,_.value)};vue.ref(null);const ce=()=>{E().then(X=>{X.some(Q=>Q.taskStatus==="ocr_doing"||Q.taskStatus==="ocr_success")&&setTimeout(ce,2e3)}).catch(X=>{setTimeout(ce,2e3)})};return vue.onMounted(()=>{ce()}),(X,ie)=>(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(R.value)+"/"+vue.toDisplayString(B.value),1),vue.createElementVNode("div",_hoisted_4$2,[_hoisted_5$1,vue.withDirectives(vue.createElementVNode("input",{type:"checkbox",onChange:vue.withModifiers(I,["self"]),"onUpdate:modelValue":ie[0]||(ie[0]=Q=>k.value=Q),onClick:ie[1]||(ie[1]=vue.withModifiers(()=>{},["stop"])),class:"checkbox"},null,40,_hoisted_6$1),[[vue.vModelCheckbox,k.value]])])]),vue.createElementVNode("div",_hoisted_7$1,[vue.createElementVNode("ul",null,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(b.value,(Q,we)=>(vue.openBlock(),vue.createElementBlock("li",{key:we,onClick:re=>C(Q)},[vue.createElementVNode("div",_hoisted_9,[Q.taskStatus==="finish"||Q.taskStatus==="repeat"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_10,[vue.createElementVNode("div",{class:"details-btn",onClick:vue.withModifiers(re=>L(Q),["stop"])}," 详情 ",8,_hoisted_11),vue.createElementVNode("div",{class:vue.normalizeClass(["title",{person:Q.invoiceCompanyType==="公司"}])},vue.toDisplayString(Q.invoiceCompanyType),3),vue.createElementVNode("div",_hoisted_12,[vue.createElementVNode("div",_hoisted_13,[vue.createElementVNode("div",_hoisted_14,vue.toDisplayString(Q.sellerName),1),Q.taskStatus==="repeat"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_15," 已收录 ")):vue.createCommentVNode("",!0)]),vue.createElementVNode("div",_hoisted_16,[Q.manualModify?(vue.openBlock(),vue.createElementBlock("span",_hoisted_17," 手工录入 ")):Q.invoiceExceptionInfo?(vue.openBlock(),vue.createElementBlock("div",_hoisted_18,[vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(setClass)(Q.invoiceExceptionInfo))},vue.toDisplayString(vue.unref(const_invoiceExceptionInfo)[Q.invoiceExceptionInfo]),3)])):(vue.openBlock(),vue.createElementBlock("span",{key:2,class:vue.normalizeClass(vue.unref(setClass)(Q.realStatus))},vue.toDisplayString(vue.unref(const_realStatus)[Q.realStatus]),3)),vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(setClass)(Q.invoiceStatus))},vue.toDisplayString(vue.unref(const_invoiceStatus)[Q.invoiceStatus]),3)]),vue.createElementVNode("div",_hoisted_19,[vue.createElementVNode("div",_hoisted_20,[vue.createElementVNode("div",_hoisted_21,[_hoisted_22,vue.createElementVNode("span",_hoisted_23,"¥"+vue.toDisplayString(Q.priceTaxTotalFigure||Q.noTaxAmountTotal),1)]),vue.createElementVNode("div",_hoisted_24,[_hoisted_25,vue.createElementVNode("span",_hoisted_26,vue.toDisplayString(Q.payerName),1)]),vue.createElementVNode("div",_hoisted_27,[_hoisted_28,vue.createElementVNode("span",_hoisted_29,vue.toDisplayString(Q.description),1)]),vue.createElementVNode("div",_hoisted_30,[_hoisted_31,vue.createElementVNode("span",_hoisted_32,vue.toDisplayString(Q.invoiceDate),1)])]),vue.createElementVNode("div",_hoisted_33,[vue.withDirectives(vue.createElementVNode("input",{onClick:ie[2]||(ie[2]=vue.withModifiers(()=>{},["stop"])),type:"checkbox",class:"checkbox",onChange:S,"onUpdate:modelValue":re=>Q.selected=re,"icon-size":"22px"},null,40,_hoisted_34),[[vue.vModelCheckbox,Q.selected]])])])])])):Q.taskStatus==="ocr_doing"||Q.taskStatus==="ocr_success"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_35,[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_36,[vue.createElementVNode("div",{class:"left-img",onClick:re=>H(Q.fileUrlKey)},[vue.createElementVNode("img",{src:Q.fileUrlKey,alt:""},null,8,_hoisted_38)],8,_hoisted_37),vue.createElementVNode("div",_hoisted_39,[_hoisted_40,vue.createElementVNode("div",_hoisted_41,[_hoisted_42,vue.createElementVNode("div",null,[vue.withDirectives(vue.createElementVNode("input",{type:"checkbox",class:"checkbox",onClick:ie[3]||(ie[3]=vue.withModifiers(()=>{},["stop"])),"onUpdate:modelValue":re=>Q.selected=re},null,8,_hoisted_43),[[vue.vModelCheckbox,Q.selected]])])])])]))])],8,_hoisted_8$1))),128))])]),vue.createElementVNode("div",_hoisted_44,[vue.createElementVNode("div",_hoisted_45,[vue.createElementVNode("div",{class:"delete"},[vue.createElementVNode("span",{onClick:$},"移除")]),vue.createElementVNode("div",_hoisted_46,[vue.createElementVNode("span",{class:"add",onClick:A},"继续添加发票"),vue.createElementVNode("span",{class:vue.normalizeClass(["ok",{disabledColor:!G.value}]),onClick:ae},"确定选择",2)])])])]),vue.createVNode(vue.unref(Popup),{show:p.value,"onUpdate:show":ie[6]||(ie[6]=Q=>p.value=Q),position:"bottom",closeable:""},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_47,[_hoisted_48,vue.createElementVNode("div",{style:{"padding-bottom":"24px"},onClick:ie[4]||(ie[4]=Q=>U(1))},"从相册中选择"),vue.createElementVNode("div",{onClick:ie[5]||(ie[5]=Q=>U(2))},"拍照上传")])]),_:1},8,["show"]),vue.createVNode(vue.unref(Overlay),{style:{display:"flex","justify-content":"center","align-items":"center"},show:e.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_08bf6d6b_lang="",InvoiceList=_export_sfc(_sfc_main$2,[["__scopeId","data-v-08bf6d6b"]]),_withScopeId=n=>(vue.pushScopeId("data-v-87442ad9"),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"],emits:["uploadSuccess"],setup(n,{emit:r}){const o=n,a=[{text:"拍照",leftIcon:"icon-xiangji"},{text:"相册",leftIcon:"icon-xiangce"}];document.title="请选择添加费用方式";const l=vue.ref(!1),f=async e=>{let p;e=="拍照"&&(p=await takePhoto()),e=="相册"&&(p=await selectPhoto(o.multiple)),o.batchId&&p.append("batchId",o.batchId),l.value=!0;try{const b=await __uploadInvoice(p);b.code===200&&(showToast({type:"success",message:"上传成功"}),r("uploadSuccess",b.data))}catch(b){console.log(b),showFailToast(b.msg)}l.value=!1};return(e,p)=>(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(a,(b,_)=>vue.createElementVNode("div",{class:"method-item",onClick:w=>f(b.text),key:b.id||_},[vue.createElementVNode("div",_hoisted_5,[vue.createElementVNode("span",_hoisted_6,[vue.createElementVNode("i",{class:vue.normalizeClass(["iconfont",b.leftIcon])},null,2)]),vue.createElementVNode("span",_hoisted_7,vue.toDisplayString(b.text),1)]),_hoisted_8],8,_hoisted_4$1)),64))])]),vue.createVNode(vue.unref(Overlay),{style:{display:"flex","justify-content":"center","align-items":"center"},show:l.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_87442ad9_lang="",PaymentMode=_export_sfc(_sfc_main$1,[["__scopeId","data-v-87442ad9"]]);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:{}};/*!
17
+ */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,k,I,S;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),k=new Uint8Array(O),I=0;I<L.length;I+=1)k[I]=L.charCodeAt(I);return a?new Blob([l?k:O],{type:w}):(S=new f,S.append(O),S.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("文件大小不能超过20MB"),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()}),selectPhoto=async n=>new Promise((r,o)=>{var a=document.createElement("input");a.type="file",a.accept="image/*, .pdf ,.ofd",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("文件大小不能超过20MB"),o();break}l.append("invoiceFiles",_),r(l)}catch(_){console.log(_),o(_)}}document.body.removeChild(a)},a.oncancel=()=>{showToast("11"),document.body.removeChild(a)},a.click()}),_withScopeId$1=n=>(vue.pushScopeId("data-v-349bdf4c"),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=["onChange"],_hoisted_7$1={class:"card"},_hoisted_8$1=["onClick"],_hoisted_9={class:"li"},_hoisted_10={key:0,class:"item-card"},_hoisted_11=["onClick"],_hoisted_12={class:"storeName"},_hoisted_13={class:"name"},_hoisted_14={class:"left"},_hoisted_15={key:0,class:"right"},_hoisted_16={class:"tags"},_hoisted_17={key:0,class:"manual"},_hoisted_18={key:1},_hoisted_19={class:"InvoiceInfo"},_hoisted_20={class:"leftinfo"},_hoisted_21={class:"item-info"},_hoisted_22=_withScopeId$1(()=>vue.createElementVNode("span",{class:"label"},"发票金额",-1)),_hoisted_23={class:"value price"},_hoisted_24={class:"item-info"},_hoisted_25=_withScopeId$1(()=>vue.createElementVNode("span",{class:"label"},"发票抬头",-1)),_hoisted_26={class:"value"},_hoisted_27={class:"item-info"},_hoisted_28=_withScopeId$1(()=>vue.createElementVNode("span",{class:"label"},"发票类型",-1)),_hoisted_29={class:"value"},_hoisted_30={class:"item-info"},_hoisted_31=_withScopeId$1(()=>vue.createElementVNode("span",{class:"label"},"发票时间",-1)),_hoisted_32={class:"value"},_hoisted_33={class:"rightCheckbox"},_hoisted_34=["onUpdate:modelValue"],_hoisted_35={key:1,style:{"background-color":"#fff",padding:"21px 0 15px 12px",position:"relative",width:"100%"}},_hoisted_36={key:2,class:"err-card"},_hoisted_37=["onClick"],_hoisted_38=["src"],_hoisted_39={class:"right-errText"},_hoisted_40=_withScopeId$1(()=>vue.createElementVNode("div",{class:"title"},[vue.createElementVNode("span",null,"识别失败")],-1)),_hoisted_41={class:"content"},_hoisted_42=_withScopeId$1(()=>vue.createElementVNode("div",{class:"recognitionResult"},[vue.createElementVNode("p",{class:"errContent"},"OCR识别失败"),vue.createElementVNode("p",null,"可以重新拍照识别,或手动添加信息导入")],-1)),_hoisted_43=["onUpdate:modelValue"],_hoisted_44={class:"btn-form"},_hoisted_45={class:"operate"},_hoisted_46={class:"right-btn"},_hoisted_47={class:"boxPopup"},_hoisted_48=_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:{}},emits:["edit","ok"],setup(n,{emit:r}){const{listId:o,multiple:a,catchList:l}=n,f=vue.ref(sessionStorage.getItem("token")),e=vue.ref(!1),p=vue.ref(!1),b=vue.ref([]);l&&(b.value=l);const _=vue.ref(""),w=vue.computed(()=>b.value.filter(X=>X.selected).map(X=>X.taskId)),E=async()=>new Promise(async(X,ie)=>{const Q={};if(Q.batchId=o,!!Q.batchId)try{const we=await __getUploadInvoiceList(Q,f.value);we.code===200&&(b.value=we.data.invoiceList.map(re=>{let fe=b.value.find(F=>F.taskId===re.taskId)||{};return{...Object.assign(fe,re)}}),_.value=we.data.batchId,b.value.length<=0?k.value=!1:S(),X(b.value))}catch(we){console.log(we),ie(we)}}),C=X=>{X.selected=!X.selected},L=X=>{r("edit",{taskId:X.taskId,batchId:_.value},X,b.value)},O=X=>X.invoiceStatus==="unused"&&((X.realStatus==="checked"||X.realStatus==="noNeed"||X.realStatus==="checkFail")&&(X.taskStatus==="ocr_success"||X.taskStatus==="repeat"||X.taskStatus==="finish")&&!X.invoiceExceptionInfo||X.manualModify),k=vue.ref(!1),I=X=>{b.value.forEach(ie=>{ie.selected=O(ie)&&k.value})},S=()=>{const X=b.value.filter(ie=>O(ie)).every(ie=>ie.selected);k.value=X},$=()=>{if(w.value.length<=0){showToast({type:"text",message:"请先选择发票"});return}showConfirmDialog({title:"提醒",message:"请确认是否需要移除选中项,移除后不可恢复!"}).then(async()=>{var X=new URLSearchParams;X.append("batchId",_.value);const ie=w.value.join(",");X.append("taskIds",ie),(await __deleteInvoice(X,f.value)).code===200&&(showToast({type:"success",message:"移除成功"}),E())}).catch(()=>{})},A=()=>{p.value=!0},U=async X=>{let ie;X===1?ie=await selectPhoto(a):ie=await takePhoto(),ie.append("batchId",_.value),e.value=!0,p.value=!1;try{(await __uploadInvoice(ie)).code===200&&(showToast({type:"success",message:"上传成功"}),ce())}catch(Q){console.log(Q),ce()}e.value=!1},G=vue.computed(()=>b.value.filter(ie=>ie.selected).every(ie=>O(ie))&&b.value.filter(ie=>ie.selected).length>0),R=vue.computed(()=>b.value.filter(X=>X.selected&&O(X)).length),B=vue.computed(()=>b.value.filter(X=>O(X)).length),H=X=>{showImagePreview([X])},ae=()=>{if(w.value.length<=0){showToast({type:"text",message:"请先选择发票"});return}if(!G.value){showToast({type:"text",message:"存在异常发票,无法提交, 请先去修改发票金额"});return}const X=b.value.filter(ie=>ie.selected).map(ie=>{let Q={...ie};return ie.realStatus==="checked"||ie.realStatus==="noNeed"&&!ie.manualModify?Q.verifyTruth=1:ie.manualModify?Q.verifyTruth=2:Q.verifyTruth=3,ie.invoiceStatus==="unused"?Q.checkWeight=1:ie.invoiceStatus==="invalid"?Q.checkWeight=2:Q.checkWeight=3,Q});console.log(X,"selectData"),r("ok",X,_.value)};vue.ref(null);const ce=()=>{E().then(X=>{X.some(Q=>Q.taskStatus==="ocr_doing"||Q.taskStatus==="ocr_success")&&setTimeout(ce,2e3)}).catch(X=>{setTimeout(ce,2e3)})};return vue.onMounted(()=>{ce()}),(X,ie)=>(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(R.value)+"/"+vue.toDisplayString(B.value),1),vue.createElementVNode("div",_hoisted_4$2,[_hoisted_5$1,vue.withDirectives(vue.createElementVNode("input",{type:"checkbox",onChange:vue.withModifiers(I,["self"]),"onUpdate:modelValue":ie[0]||(ie[0]=Q=>k.value=Q),onClick:ie[1]||(ie[1]=vue.withModifiers(()=>{},["stop"])),class:"checkbox"},null,40,_hoisted_6$1),[[vue.vModelCheckbox,k.value]])])]),vue.createElementVNode("div",_hoisted_7$1,[vue.createElementVNode("ul",null,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(b.value,(Q,we)=>(vue.openBlock(),vue.createElementBlock("li",{key:we,onClick:re=>C(Q)},[vue.createElementVNode("div",_hoisted_9,[Q.taskStatus==="finish"||Q.taskStatus==="repeat"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_10,[vue.createElementVNode("div",{class:"details-btn",onClick:vue.withModifiers(re=>L(Q),["stop"])}," 详情 ",8,_hoisted_11),vue.createElementVNode("div",{class:vue.normalizeClass(["title",{person:Q.invoiceCompanyType==="公司"}])},vue.toDisplayString(Q.invoiceCompanyType),3),vue.createElementVNode("div",_hoisted_12,[vue.createElementVNode("div",_hoisted_13,[vue.createElementVNode("div",_hoisted_14,vue.toDisplayString(Q.sellerName),1),Q.taskStatus==="repeat"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_15," 已收录 ")):vue.createCommentVNode("",!0)]),vue.createElementVNode("div",_hoisted_16,[Q.manualModify?(vue.openBlock(),vue.createElementBlock("span",_hoisted_17," 手工录入 ")):Q.invoiceExceptionInfo?(vue.openBlock(),vue.createElementBlock("div",_hoisted_18,[vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(setClass)(Q.invoiceExceptionInfo))},vue.toDisplayString(vue.unref(const_invoiceExceptionInfo)[Q.invoiceExceptionInfo]),3)])):(vue.openBlock(),vue.createElementBlock("span",{key:2,class:vue.normalizeClass(vue.unref(setClass)(Q.realStatus))},vue.toDisplayString(vue.unref(const_realStatus)[Q.realStatus]),3)),vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(setClass)(Q.invoiceStatus))},vue.toDisplayString(vue.unref(const_invoiceStatus)[Q.invoiceStatus]),3)]),vue.createElementVNode("div",_hoisted_19,[vue.createElementVNode("div",_hoisted_20,[vue.createElementVNode("div",_hoisted_21,[_hoisted_22,vue.createElementVNode("span",_hoisted_23,"¥"+vue.toDisplayString(Q.priceTaxTotalFigure||Q.noTaxAmountTotal),1)]),vue.createElementVNode("div",_hoisted_24,[_hoisted_25,vue.createElementVNode("span",_hoisted_26,vue.toDisplayString(Q.payerName),1)]),vue.createElementVNode("div",_hoisted_27,[_hoisted_28,vue.createElementVNode("span",_hoisted_29,vue.toDisplayString(Q.description),1)]),vue.createElementVNode("div",_hoisted_30,[_hoisted_31,vue.createElementVNode("span",_hoisted_32,vue.toDisplayString(Q.invoiceDate),1)])]),vue.createElementVNode("div",_hoisted_33,[vue.withDirectives(vue.createElementVNode("input",{onClick:ie[2]||(ie[2]=vue.withModifiers(()=>{},["stop"])),type:"checkbox",class:"checkbox",onChange:S,"onUpdate:modelValue":re=>Q.selected=re,"icon-size":"22px"},null,40,_hoisted_34),[[vue.vModelCheckbox,Q.selected]])])])])])):Q.taskStatus==="ocr_doing"||Q.taskStatus==="ocr_success"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_35,[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_36,[vue.createElementVNode("div",{class:"left-img",onClick:re=>H(Q.fileUrlKey)},[vue.createElementVNode("img",{src:Q.fileUrlKey,alt:""},null,8,_hoisted_38)],8,_hoisted_37),vue.createElementVNode("div",_hoisted_39,[_hoisted_40,vue.createElementVNode("div",_hoisted_41,[_hoisted_42,vue.createElementVNode("div",null,[vue.withDirectives(vue.createElementVNode("input",{type:"checkbox",class:"checkbox",onClick:ie[3]||(ie[3]=vue.withModifiers(()=>{},["stop"])),"onUpdate:modelValue":re=>Q.selected=re},null,8,_hoisted_43),[[vue.vModelCheckbox,Q.selected]])])])])]))])],8,_hoisted_8$1))),128))])]),vue.createElementVNode("div",_hoisted_44,[vue.createElementVNode("div",_hoisted_45,[vue.createElementVNode("div",{class:"delete"},[vue.createElementVNode("span",{onClick:$},"移除")]),vue.createElementVNode("div",_hoisted_46,[vue.createElementVNode("span",{class:"add",onClick:A},"继续添加发票"),vue.createElementVNode("span",{class:vue.normalizeClass(["ok",{disabledColor:!G.value}]),onClick:ae},"确定选择",2)])])])]),vue.createVNode(vue.unref(Popup),{show:p.value,"onUpdate:show":ie[6]||(ie[6]=Q=>p.value=Q),position:"bottom",closeable:""},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_47,[_hoisted_48,vue.createElementVNode("div",{style:{"padding-bottom":"24px"},onClick:ie[4]||(ie[4]=Q=>U(1))},"从相册中选择"),vue.createElementVNode("div",{onClick:ie[5]||(ie[5]=Q=>U(2))},"拍照上传")])]),_:1},8,["show"]),vue.createVNode(vue.unref(Overlay),{style:{display:"flex","justify-content":"center","align-items":"center"},show:e.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_349bdf4c_lang="",InvoiceList=_export_sfc(_sfc_main$2,[["__scopeId","data-v-349bdf4c"]]),_withScopeId=n=>(vue.pushScopeId("data-v-87442ad9"),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"],emits:["uploadSuccess"],setup(n,{emit:r}){const o=n,a=[{text:"拍照",leftIcon:"icon-xiangji"},{text:"相册",leftIcon:"icon-xiangce"}];document.title="请选择添加费用方式";const l=vue.ref(!1),f=async e=>{let p;e=="拍照"&&(p=await takePhoto()),e=="相册"&&(p=await selectPhoto(o.multiple)),o.batchId&&p.append("batchId",o.batchId),l.value=!0;try{const b=await __uploadInvoice(p);b.code===200&&(showToast({type:"success",message:"上传成功"}),r("uploadSuccess",b.data))}catch(b){console.log(b),showFailToast(b.msg)}l.value=!1};return(e,p)=>(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(a,(b,_)=>vue.createElementVNode("div",{class:"method-item",onClick:w=>f(b.text),key:b.id||_},[vue.createElementVNode("div",_hoisted_5,[vue.createElementVNode("span",_hoisted_6,[vue.createElementVNode("i",{class:vue.normalizeClass(["iconfont",b.leftIcon])},null,2)]),vue.createElementVNode("span",_hoisted_7,vue.toDisplayString(b.text),1)]),_hoisted_8],8,_hoisted_4$1)),64))])]),vue.createVNode(vue.unref(Overlay),{style:{display:"flex","justify-content":"center","align-items":"center"},show:l.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_87442ad9_lang="",PaymentMode=_export_sfc(_sfc_main$1,[["__scopeId","data-v-87442ad9"]]);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:{}};/*!
18
18
  * vConsole v3.15.1 (https://github.com/Tencent/vConsole)
19
19
  *
20
20
  * Tencent is pleased to support the open source community by making vConsole available.