mg-ocr-invoice 0.3.1 → 0.3.2

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
@@ -6393,7 +6393,7 @@ const takePhoto = () => new Promise((n, r) => {
6393
6393
  }, a.oncancel = () => {
6394
6394
  document.body.removeChild(a);
6395
6395
  }, a.click();
6396
- }), _withScopeId$1 = (n) => (pushScopeId("data-v-0faad01d"), 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 = {
6396
+ }), _withScopeId$1 = (n) => (pushScopeId("data-v-a122f852"), 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 = {
6397
6397
  key: 0,
6398
6398
  class: "item-card"
6399
6399
  }, _hoisted_11 = ["onClick"], _hoisted_12 = { class: "storeName" }, _hoisted_13 = { class: "name" }, _hoisted_14 = { class: "left" }, _hoisted_15 = {
@@ -6506,7 +6506,7 @@ const takePhoto = () => new Promise((n, r) => {
6506
6506
  if (!R.value) {
6507
6507
  showToast({
6508
6508
  type: "text",
6509
- message: "存在异常发票,无法提交, 请先去修改发票金额"
6509
+ message: "发票无效或已被使用,请进行确认"
6510
6510
  });
6511
6511
  return;
6512
6512
  }
@@ -6717,7 +6717,7 @@ const takePhoto = () => new Promise((n, r) => {
6717
6717
  }, 8, ["show"])
6718
6718
  ], 64));
6719
6719
  }
6720
- }), index_vue_vue_type_style_index_0_scoped_0faad01d_lang = "", InvoiceList = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-0faad01d"]]), _withScopeId = (n) => (pushScopeId("data-v-63754c49"), 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" }, [
6720
+ }), index_vue_vue_type_style_index_0_scoped_a122f852_lang = "", InvoiceList = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-a122f852"]]), _withScopeId = (n) => (pushScopeId("data-v-63754c49"), 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" }, [
6721
6721
  /* @__PURE__ */ createElementVNode("i", { class: "iconfont icon-xiangyou" })
6722
6722
  ], -1)), _sfc_main$1 = /* @__PURE__ */ defineComponent({
6723
6723
  __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}}(),u=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 _,y,E,C,L,O,S,$,k;if(_=b.match(e),!_)throw new Error("invalid data URI");for(y=_[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),$=0;$<L.length;$+=1)S[$]=L.charCodeAt($);return a?new Blob([u?S:O],{type:y}):(k=new f,k.append(O),k.getBlob(y))};r.HTMLCanvasElement&&!o.toBlob&&(o.mozGetAsFile?o.toBlob=function(b,_,y){var E=this;setTimeout(function(){y&&o.toDataURL&&p?b(p(E.toDataURL(_,y))):b(E.mozGetAsFile("blob",_))})}:o.toDataURL&&p&&(o.msToBlob?o.toBlob=function(b,_,y){var E=this;setTimeout(function(){(_&&_!=="image/png"||y)&&o.toDataURL&&p?b(p(E.toDataURL(_,y))):b(E.msToBlob(_))})}:o.toBlob=function(b,_,y){var E=this;setTimeout(function(){b(p(E.toDataURL(_,y)))})})),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(u){var f=u.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 u=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,y=_.size,E=20*1024*1024;if(y>E){showToast("文件大小不能超过20MB"),o();break}u.append("invoiceFiles",_),r(u)}catch(_){console.log(_),o(_)}}document.body.removeChild(a)},a.oncancel=()=>{document.body.removeChild(a)},a.click()}),_withScopeId$1=n=>(vue.pushScopeId("data-v-0faad01d"),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 o=r,{listId:a,multiple:u,catchList:f}=n,e=vue.ref(sessionStorage.getItem("token")),p=vue.ref(!1),b=vue.ref(!1),_=vue.ref([]);f&&(_.value=f);const y=vue.ref(""),E=vue.computed(()=>_.value.filter(ie=>ie.selected).map(ie=>ie.taskId)),C=async()=>new Promise(async(ie,te)=>{const ce={};if(ce.batchId=a,!!ce.batchId)try{const ne=await __getUploadInvoiceList(ce,e.value);ne.code===200&&(_.value=ne.data.invoiceList.map(le=>{let H=_.value.find(X=>X.taskId===le.taskId)||{};return{...Object.assign(H,le)}}),y.value=ne.data.batchId,_.value.length<=0?$.value=!1:I(),ie(_.value))}catch(ne){console.log(ne),te(ne)}}),L=ie=>{if(console.log(ie.invoiceStatus),ie.invoiceStatus!=="unused")return showToast("发票已被使用!");ie.selected=!ie.selected},O=ie=>{o("edit",{taskId:ie.taskId,batchId:y.value},ie,_.value)},S=ie=>ie.invoiceStatus==="unused"?!!(ie.manualModify||!ie.invoiceExceptionInfo):!1,$=vue.ref(!1),k=ie=>{$.value&&showToast("存在已使用或异常发票, 已自动过滤"),_.value.forEach(te=>{te.selected=S(te)&&$.value})},I=()=>{const ie=_.value.filter(te=>S(te)).every(te=>te.selected);$.value=ie},A=()=>{if(E.value.length<=0){showToast({type:"text",message:"请先选择发票"});return}showConfirmDialog({title:"提醒",message:"请确认是否需要移除选中项,移除后不可恢复!"}).then(async()=>{var ie=new URLSearchParams;ie.append("batchId",y.value);const te=E.value.join(",");ie.append("taskIds",te),(await __deleteInvoice(ie,e.value)).code===200&&(showToast({type:"success",message:"移除成功"}),C())}).catch(()=>{})},U=()=>{b.value=!0},G=async ie=>{let te;ie===1?te=await selectPhoto(u):te=await takePhoto(),te.append("batchId",y.value),p.value=!0,b.value=!1;try{(await __uploadInvoice(te)).code===200&&(showToast({type:"success",message:"上传成功"}),se())}catch(ce){console.log(ce),se()}p.value=!1},R=vue.computed(()=>_.value.filter(te=>te.selected).every(te=>S(te))&&_.value.filter(te=>te.selected).length>0),N=vue.computed(()=>_.value.filter(ie=>ie.selected&&S(ie)).length),F=vue.computed(()=>_.value.filter(ie=>S(ie)).length),re=ie=>{showImagePreview([ie])},fe=()=>{if(E.value.length<=0){showToast({type:"text",message:"请先选择发票"});return}if(!R.value){showToast({type:"text",message:"存在异常发票,无法提交, 请先去修改发票金额"});return}const ie=_.value.filter(te=>te.selected).map(te=>{let ce=VerificationOfTruth(te);return{...te,...ce}});o("ok",ie,y.value)};vue.ref(null);const se=()=>{C().then(ie=>{ie.some(ce=>ce.taskStatus==="ocr_doing"||ce.taskStatus==="ocr_success")&&setTimeout(se,2e3)}).catch(ie=>{setTimeout(se,2e3)})};return vue.onMounted(()=>{se()}),(ie,te)=>(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(N.value)+"/"+vue.toDisplayString(F.value),1),vue.createElementVNode("div",_hoisted_4$2,[_hoisted_5$1,vue.withDirectives(vue.createElementVNode("input",{type:"checkbox",onChange:vue.withModifiers(k,["self"]),"onUpdate:modelValue":te[0]||(te[0]=ce=>$.value=ce),onClick:te[1]||(te[1]=vue.withModifiers(()=>{},["stop"])),class:"checkbox"},null,40,_hoisted_6$1),[[vue.vModelCheckbox,$.value]])])]),vue.createElementVNode("div",_hoisted_7$1,[vue.createElementVNode("ul",null,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(_.value,(ce,ne)=>(vue.openBlock(),vue.createElementBlock("li",{key:ne,onClick:le=>L(ce)},[vue.createElementVNode("div",_hoisted_9,[ce.taskStatus==="finish"||ce.taskStatus==="repeat"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_10,[vue.createElementVNode("div",{class:"details-btn",onClick:vue.withModifiers(le=>O(ce),["stop"])}," 详情 ",8,_hoisted_11),vue.createElementVNode("div",{class:vue.normalizeClass(["title",{person:ce.invoiceCompanyType==="公司"}])},vue.toDisplayString(ce.invoiceCompanyType),3),vue.createElementVNode("div",_hoisted_12,[vue.createElementVNode("div",_hoisted_13,[vue.createElementVNode("div",_hoisted_14,vue.toDisplayString(ce.sellerName),1),ce.taskStatus==="repeat"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_15," 已收录 ")):vue.createCommentVNode("",!0)]),vue.createElementVNode("div",_hoisted_16,[ce.manualModify?(vue.openBlock(),vue.createElementBlock("span",_hoisted_17," 手工录入 ")):ce.invoiceExceptionInfo?(vue.openBlock(),vue.createElementBlock("div",_hoisted_18,[vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(setClass)(ce.invoiceExceptionInfo))},vue.toDisplayString(vue.unref(const_invoiceExceptionInfo)[ce.invoiceExceptionInfo]),3)])):(vue.openBlock(),vue.createElementBlock("span",{key:2,class:vue.normalizeClass(vue.unref(setClass)(ce.realStatus))},vue.toDisplayString(vue.unref(const_realStatus)[ce.realStatus]),3)),vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(setClass)(ce.invoiceStatus))},vue.toDisplayString(vue.unref(const_invoiceStatus)[ce.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(ce.priceTaxTotalFigure||ce.noTaxAmountTotal),1)]),vue.createElementVNode("div",_hoisted_24,[_hoisted_25,vue.createElementVNode("span",_hoisted_26,vue.toDisplayString(ce.payerName),1)]),vue.createElementVNode("div",_hoisted_27,[_hoisted_28,vue.createElementVNode("span",_hoisted_29,vue.toDisplayString(ce.description),1)]),vue.createElementVNode("div",_hoisted_30,[_hoisted_31,vue.createElementVNode("span",_hoisted_32,vue.toDisplayString(ce.invoiceDate),1)])]),vue.createElementVNode("div",_hoisted_33,[vue.withDirectives(vue.createElementVNode("input",{onClick:te[2]||(te[2]=vue.withModifiers(()=>{},["stop"])),type:"checkbox",class:"checkbox",onChange:I,"onUpdate:modelValue":le=>ce.selected=le,"icon-size":"22px"},null,40,_hoisted_34),[[vue.vModelCheckbox,ce.selected]])])])])])):ce.taskStatus==="ocr_doing"||ce.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:le=>re(ce.fileUrlKey)},[vue.createElementVNode("img",{src:ce.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:te[3]||(te[3]=vue.withModifiers(()=>{},["stop"])),"onUpdate:modelValue":le=>ce.selected=le},null,8,_hoisted_43),[[vue.vModelCheckbox,ce.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:A},"移除")]),vue.createElementVNode("div",_hoisted_46,[vue.createElementVNode("span",{class:"add",onClick:U},"继续添加发票"),vue.createElementVNode("span",{class:vue.normalizeClass(["ok",{disabledColor:!R.value}]),onClick:fe},"确定选择",2)])])])]),vue.createVNode(vue.unref(Popup),{show:b.value,"onUpdate:show":te[6]||(te[6]=ce=>b.value=ce),position:"bottom",closeable:""},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_47,[_hoisted_48,vue.createElementVNode("div",{style:{"padding-bottom":"24px"},onClick:te[4]||(te[4]=ce=>G(1))},"从相册中选择"),vue.createElementVNode("div",{onClick:te[5]||(te[5]=ce=>G(2))},"拍照上传")])]),_:1},8,["show"]),vue.createVNode(vue.unref(Overlay),{style:{display:"flex","justify-content":"center","align-items":"center"},show:p.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_0faad01d_lang="",InvoiceList=_export_sfc(_sfc_main$2,[["__scopeId","data-v-0faad01d"]]),_withScopeId=n=>(vue.pushScopeId("data-v-63754c49"),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=r,u=[{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),f.value=!0;try{const _=await __uploadInvoice(b);_.code===200&&(showToast({type:"success",message:"上传成功"}),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(u,(_,y)=>vue.createElementVNode("div",{class:"method-item",onClick:E=>e(_.text),key:_.id||y},[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_63754c49_lang="",PaymentMode=_export_sfc(_sfc_main$1,[["__scopeId","data-v-63754c49"]]);function getUrlParams(n){const r={},o=n.split("?")[1];return o&&o.split("&").forEach(u=>{const[f,e]=u.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}}(),u=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 _,y,E,C,L,O,S,$,k;if(_=b.match(e),!_)throw new Error("invalid data URI");for(y=_[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),$=0;$<L.length;$+=1)S[$]=L.charCodeAt($);return a?new Blob([u?S:O],{type:y}):(k=new f,k.append(O),k.getBlob(y))};r.HTMLCanvasElement&&!o.toBlob&&(o.mozGetAsFile?o.toBlob=function(b,_,y){var E=this;setTimeout(function(){y&&o.toDataURL&&p?b(p(E.toDataURL(_,y))):b(E.mozGetAsFile("blob",_))})}:o.toDataURL&&p&&(o.msToBlob?o.toBlob=function(b,_,y){var E=this;setTimeout(function(){(_&&_!=="image/png"||y)&&o.toDataURL&&p?b(p(E.toDataURL(_,y))):b(E.msToBlob(_))})}:o.toBlob=function(b,_,y){var E=this;setTimeout(function(){b(p(E.toDataURL(_,y)))})})),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(u){var f=u.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 u=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,y=_.size,E=20*1024*1024;if(y>E){showToast("文件大小不能超过20MB"),o();break}u.append("invoiceFiles",_),r(u)}catch(_){console.log(_),o(_)}}document.body.removeChild(a)},a.oncancel=()=>{document.body.removeChild(a)},a.click()}),_withScopeId$1=n=>(vue.pushScopeId("data-v-a122f852"),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 o=r,{listId:a,multiple:u,catchList:f}=n,e=vue.ref(sessionStorage.getItem("token")),p=vue.ref(!1),b=vue.ref(!1),_=vue.ref([]);f&&(_.value=f);const y=vue.ref(""),E=vue.computed(()=>_.value.filter(ie=>ie.selected).map(ie=>ie.taskId)),C=async()=>new Promise(async(ie,te)=>{const ce={};if(ce.batchId=a,!!ce.batchId)try{const ne=await __getUploadInvoiceList(ce,e.value);ne.code===200&&(_.value=ne.data.invoiceList.map(le=>{let H=_.value.find(X=>X.taskId===le.taskId)||{};return{...Object.assign(H,le)}}),y.value=ne.data.batchId,_.value.length<=0?$.value=!1:I(),ie(_.value))}catch(ne){console.log(ne),te(ne)}}),L=ie=>{if(console.log(ie.invoiceStatus),ie.invoiceStatus!=="unused")return showToast("发票已被使用!");ie.selected=!ie.selected},O=ie=>{o("edit",{taskId:ie.taskId,batchId:y.value},ie,_.value)},S=ie=>ie.invoiceStatus==="unused"?!!(ie.manualModify||!ie.invoiceExceptionInfo):!1,$=vue.ref(!1),k=ie=>{$.value&&showToast("存在已使用或异常发票, 已自动过滤"),_.value.forEach(te=>{te.selected=S(te)&&$.value})},I=()=>{const ie=_.value.filter(te=>S(te)).every(te=>te.selected);$.value=ie},A=()=>{if(E.value.length<=0){showToast({type:"text",message:"请先选择发票"});return}showConfirmDialog({title:"提醒",message:"请确认是否需要移除选中项,移除后不可恢复!"}).then(async()=>{var ie=new URLSearchParams;ie.append("batchId",y.value);const te=E.value.join(",");ie.append("taskIds",te),(await __deleteInvoice(ie,e.value)).code===200&&(showToast({type:"success",message:"移除成功"}),C())}).catch(()=>{})},U=()=>{b.value=!0},G=async ie=>{let te;ie===1?te=await selectPhoto(u):te=await takePhoto(),te.append("batchId",y.value),p.value=!0,b.value=!1;try{(await __uploadInvoice(te)).code===200&&(showToast({type:"success",message:"上传成功"}),se())}catch(ce){console.log(ce),se()}p.value=!1},R=vue.computed(()=>_.value.filter(te=>te.selected).every(te=>S(te))&&_.value.filter(te=>te.selected).length>0),N=vue.computed(()=>_.value.filter(ie=>ie.selected&&S(ie)).length),F=vue.computed(()=>_.value.filter(ie=>S(ie)).length),re=ie=>{showImagePreview([ie])},fe=()=>{if(E.value.length<=0){showToast({type:"text",message:"请先选择发票"});return}if(!R.value){showToast({type:"text",message:"发票无效或已被使用,请进行确认"});return}const ie=_.value.filter(te=>te.selected).map(te=>{let ce=VerificationOfTruth(te);return{...te,...ce}});o("ok",ie,y.value)};vue.ref(null);const se=()=>{C().then(ie=>{ie.some(ce=>ce.taskStatus==="ocr_doing"||ce.taskStatus==="ocr_success")&&setTimeout(se,2e3)}).catch(ie=>{setTimeout(se,2e3)})};return vue.onMounted(()=>{se()}),(ie,te)=>(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(N.value)+"/"+vue.toDisplayString(F.value),1),vue.createElementVNode("div",_hoisted_4$2,[_hoisted_5$1,vue.withDirectives(vue.createElementVNode("input",{type:"checkbox",onChange:vue.withModifiers(k,["self"]),"onUpdate:modelValue":te[0]||(te[0]=ce=>$.value=ce),onClick:te[1]||(te[1]=vue.withModifiers(()=>{},["stop"])),class:"checkbox"},null,40,_hoisted_6$1),[[vue.vModelCheckbox,$.value]])])]),vue.createElementVNode("div",_hoisted_7$1,[vue.createElementVNode("ul",null,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(_.value,(ce,ne)=>(vue.openBlock(),vue.createElementBlock("li",{key:ne,onClick:le=>L(ce)},[vue.createElementVNode("div",_hoisted_9,[ce.taskStatus==="finish"||ce.taskStatus==="repeat"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_10,[vue.createElementVNode("div",{class:"details-btn",onClick:vue.withModifiers(le=>O(ce),["stop"])}," 详情 ",8,_hoisted_11),vue.createElementVNode("div",{class:vue.normalizeClass(["title",{person:ce.invoiceCompanyType==="公司"}])},vue.toDisplayString(ce.invoiceCompanyType),3),vue.createElementVNode("div",_hoisted_12,[vue.createElementVNode("div",_hoisted_13,[vue.createElementVNode("div",_hoisted_14,vue.toDisplayString(ce.sellerName),1),ce.taskStatus==="repeat"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_15," 已收录 ")):vue.createCommentVNode("",!0)]),vue.createElementVNode("div",_hoisted_16,[ce.manualModify?(vue.openBlock(),vue.createElementBlock("span",_hoisted_17," 手工录入 ")):ce.invoiceExceptionInfo?(vue.openBlock(),vue.createElementBlock("div",_hoisted_18,[vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(setClass)(ce.invoiceExceptionInfo))},vue.toDisplayString(vue.unref(const_invoiceExceptionInfo)[ce.invoiceExceptionInfo]),3)])):(vue.openBlock(),vue.createElementBlock("span",{key:2,class:vue.normalizeClass(vue.unref(setClass)(ce.realStatus))},vue.toDisplayString(vue.unref(const_realStatus)[ce.realStatus]),3)),vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(setClass)(ce.invoiceStatus))},vue.toDisplayString(vue.unref(const_invoiceStatus)[ce.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(ce.priceTaxTotalFigure||ce.noTaxAmountTotal),1)]),vue.createElementVNode("div",_hoisted_24,[_hoisted_25,vue.createElementVNode("span",_hoisted_26,vue.toDisplayString(ce.payerName),1)]),vue.createElementVNode("div",_hoisted_27,[_hoisted_28,vue.createElementVNode("span",_hoisted_29,vue.toDisplayString(ce.description),1)]),vue.createElementVNode("div",_hoisted_30,[_hoisted_31,vue.createElementVNode("span",_hoisted_32,vue.toDisplayString(ce.invoiceDate),1)])]),vue.createElementVNode("div",_hoisted_33,[vue.withDirectives(vue.createElementVNode("input",{onClick:te[2]||(te[2]=vue.withModifiers(()=>{},["stop"])),type:"checkbox",class:"checkbox",onChange:I,"onUpdate:modelValue":le=>ce.selected=le,"icon-size":"22px"},null,40,_hoisted_34),[[vue.vModelCheckbox,ce.selected]])])])])])):ce.taskStatus==="ocr_doing"||ce.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:le=>re(ce.fileUrlKey)},[vue.createElementVNode("img",{src:ce.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:te[3]||(te[3]=vue.withModifiers(()=>{},["stop"])),"onUpdate:modelValue":le=>ce.selected=le},null,8,_hoisted_43),[[vue.vModelCheckbox,ce.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:A},"移除")]),vue.createElementVNode("div",_hoisted_46,[vue.createElementVNode("span",{class:"add",onClick:U},"继续添加发票"),vue.createElementVNode("span",{class:vue.normalizeClass(["ok",{disabledColor:!R.value}]),onClick:fe},"确定选择",2)])])])]),vue.createVNode(vue.unref(Popup),{show:b.value,"onUpdate:show":te[6]||(te[6]=ce=>b.value=ce),position:"bottom",closeable:""},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_47,[_hoisted_48,vue.createElementVNode("div",{style:{"padding-bottom":"24px"},onClick:te[4]||(te[4]=ce=>G(1))},"从相册中选择"),vue.createElementVNode("div",{onClick:te[5]||(te[5]=ce=>G(2))},"拍照上传")])]),_:1},8,["show"]),vue.createVNode(vue.unref(Overlay),{style:{display:"flex","justify-content":"center","align-items":"center"},show:p.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_a122f852_lang="",InvoiceList=_export_sfc(_sfc_main$2,[["__scopeId","data-v-a122f852"]]),_withScopeId=n=>(vue.pushScopeId("data-v-63754c49"),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=r,u=[{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),f.value=!0;try{const _=await __uploadInvoice(b);_.code===200&&(showToast({type:"success",message:"上传成功"}),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(u,(_,y)=>vue.createElementVNode("div",{class:"method-item",onClick:E=>e(_.text),key:_.id||y},[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_63754c49_lang="",PaymentMode=_export_sfc(_sfc_main$1,[["__scopeId","data-v-63754c49"]]);function getUrlParams(n){const r={},o=n.split("?")[1];return o&&o.split("&").forEach(u=>{const[f,e]=u.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.