mg-ocr-invoice 0.2.5 → 0.2.6
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 +3 -3
- package/dist/index.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/InvoiceList/index.vue +9 -11
package/dist/index.es.js
CHANGED
|
@@ -6323,7 +6323,7 @@ const takePhoto = () => new Promise((n, r) => {
|
|
|
6323
6323
|
}, a.oncancel = () => {
|
|
6324
6324
|
document.body.removeChild(a);
|
|
6325
6325
|
}, a.click();
|
|
6326
|
-
}), _withScopeId$1 = (n) => (pushScopeId("data-v-
|
|
6326
|
+
}), _withScopeId$1 = (n) => (pushScopeId("data-v-f27340ac"), 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 = {
|
|
6327
6327
|
key: 0,
|
|
6328
6328
|
class: "item-card"
|
|
6329
6329
|
}, _hoisted_11 = ["onClick"], _hoisted_12 = { class: "storeName" }, _hoisted_13 = { class: "name" }, _hoisted_14 = { class: "left" }, _hoisted_15 = {
|
|
@@ -6388,7 +6388,7 @@ const takePhoto = () => new Promise((n, r) => {
|
|
|
6388
6388
|
X,
|
|
6389
6389
|
b.value
|
|
6390
6390
|
);
|
|
6391
|
-
}, O = (X) => X.invoiceStatus
|
|
6391
|
+
}, O = (X) => X.invoiceStatus || X.manualModify ? !0 : !X.invoiceExceptionInfo, k = ref(!1), I = (X) => {
|
|
6392
6392
|
b.value.forEach((ae) => {
|
|
6393
6393
|
ae.selected = O(ae) && k.value;
|
|
6394
6394
|
});
|
|
@@ -6645,7 +6645,7 @@ const takePhoto = () => new Promise((n, r) => {
|
|
|
6645
6645
|
}, 8, ["show"])
|
|
6646
6646
|
], 64));
|
|
6647
6647
|
}
|
|
6648
|
-
}),
|
|
6648
|
+
}), index_vue_vue_type_style_index_0_scoped_f27340ac_lang = "", InvoiceList = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-f27340ac"]]), _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" }, [
|
|
6649
6649
|
/* @__PURE__ */ createElementVNode("i", { class: "iconfont icon-xiangyou" })
|
|
6650
6650
|
], -1)), _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
6651
6651
|
__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=()=>{document.body.removeChild(a)},a.click()}),_withScopeId$1=n=>(vue.pushScopeId("data-v-20b8af39"),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,ae)=>{const te={};if(te.batchId=o,!!te.batchId)try{const we=await __getUploadInvoiceList(te,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),ae(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(ae=>{ae.selected=O(ae)&&k.value})},S=()=>{const X=b.value.filter(ae=>O(ae)).every(ae=>ae.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 ae=w.value.join(",");X.append("taskIds",ae),(await __deleteInvoice(X,f.value)).code===200&&(showToast({type:"success",message:"移除成功"}),E())}).catch(()=>{})},A=()=>{p.value=!0},U=async X=>{let ae;X===1?ae=await selectPhoto(a):ae=await takePhoto(),ae.append("batchId",_.value),e.value=!0,p.value=!1;try{(await __uploadInvoice(ae)).code===200&&(showToast({type:"success",message:"上传成功"}),ce())}catch(te){console.log(te),ce()}e.value=!1},G=vue.computed(()=>b.value.filter(ae=>ae.selected).every(ae=>O(ae))&&b.value.filter(ae=>ae.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])},ie=()=>{if(w.value.length<=0){showToast({type:"text",message:"请先选择发票"});return}if(!G.value){showToast({type:"text",message:"存在异常发票,无法提交, 请先去修改发票金额"});return}const X=b.value.filter(ae=>ae.selected).map(ae=>{let te=VerificationOfTruth(ae);return{...ae,...te}});r("ok",X,_.value)};vue.ref(null);const ce=()=>{E().then(X=>{X.some(te=>te.taskStatus==="ocr_doing"||te.taskStatus==="ocr_success")&&setTimeout(ce,2e3)}).catch(X=>{setTimeout(ce,2e3)})};return vue.onMounted(()=>{ce()}),(X,ae)=>(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":ae[0]||(ae[0]=te=>k.value=te),onClick:ae[1]||(ae[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,(te,we)=>(vue.openBlock(),vue.createElementBlock("li",{key:we,onClick:re=>C(te)},[vue.createElementVNode("div",_hoisted_9,[te.taskStatus==="finish"||te.taskStatus==="repeat"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_10,[vue.createElementVNode("div",{class:"details-btn",onClick:vue.withModifiers(re=>L(te),["stop"])}," 详情 ",8,_hoisted_11),vue.createElementVNode("div",{class:vue.normalizeClass(["title",{person:te.invoiceCompanyType==="公司"}])},vue.toDisplayString(te.invoiceCompanyType),3),vue.createElementVNode("div",_hoisted_12,[vue.createElementVNode("div",_hoisted_13,[vue.createElementVNode("div",_hoisted_14,vue.toDisplayString(te.sellerName),1),te.taskStatus==="repeat"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_15," 已收录 ")):vue.createCommentVNode("",!0)]),vue.createElementVNode("div",_hoisted_16,[te.manualModify?(vue.openBlock(),vue.createElementBlock("span",_hoisted_17," 手工录入 ")):te.invoiceExceptionInfo?(vue.openBlock(),vue.createElementBlock("div",_hoisted_18,[vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(setClass)(te.invoiceExceptionInfo))},vue.toDisplayString(vue.unref(const_invoiceExceptionInfo)[te.invoiceExceptionInfo]),3)])):(vue.openBlock(),vue.createElementBlock("span",{key:2,class:vue.normalizeClass(vue.unref(setClass)(te.realStatus))},vue.toDisplayString(vue.unref(const_realStatus)[te.realStatus]),3)),vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(setClass)(te.invoiceStatus))},vue.toDisplayString(vue.unref(const_invoiceStatus)[te.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(te.priceTaxTotalFigure||te.noTaxAmountTotal),1)]),vue.createElementVNode("div",_hoisted_24,[_hoisted_25,vue.createElementVNode("span",_hoisted_26,vue.toDisplayString(te.payerName),1)]),vue.createElementVNode("div",_hoisted_27,[_hoisted_28,vue.createElementVNode("span",_hoisted_29,vue.toDisplayString(te.description),1)]),vue.createElementVNode("div",_hoisted_30,[_hoisted_31,vue.createElementVNode("span",_hoisted_32,vue.toDisplayString(te.invoiceDate),1)])]),vue.createElementVNode("div",_hoisted_33,[vue.withDirectives(vue.createElementVNode("input",{onClick:ae[2]||(ae[2]=vue.withModifiers(()=>{},["stop"])),type:"checkbox",class:"checkbox",onChange:S,"onUpdate:modelValue":re=>te.selected=re,"icon-size":"22px"},null,40,_hoisted_34),[[vue.vModelCheckbox,te.selected]])])])])])):te.taskStatus==="ocr_doing"||te.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(te.fileUrlKey)},[vue.createElementVNode("img",{src:te.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:ae[3]||(ae[3]=vue.withModifiers(()=>{},["stop"])),"onUpdate:modelValue":re=>te.selected=re},null,8,_hoisted_43),[[vue.vModelCheckbox,te.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:ie},"确定选择",2)])])])]),vue.createVNode(vue.unref(Popup),{show:p.value,"onUpdate:show":ae[6]||(ae[6]=te=>p.value=te),position:"bottom",closeable:""},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_47,[_hoisted_48,vue.createElementVNode("div",{style:{"padding-bottom":"24px"},onClick:ae[4]||(ae[4]=te=>U(1))},"从相册中选择"),vue.createElementVNode("div",{onClick:ae[5]||(ae[5]=te=>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_20b8af39_lang="",InvoiceList=_export_sfc(_sfc_main$2,[["__scopeId","data-v-20b8af39"]]),_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=()=>{document.body.removeChild(a)},a.click()}),_withScopeId$1=n=>(vue.pushScopeId("data-v-f27340ac"),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,ae)=>{const te={};if(te.batchId=o,!!te.batchId)try{const we=await __getUploadInvoiceList(te,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),ae(we)}}),C=X=>{X.selected=!X.selected},L=X=>{r("edit",{taskId:X.taskId,batchId:_.value},X,b.value)},O=X=>X.invoiceStatus||X.manualModify?!0:!X.invoiceExceptionInfo,k=vue.ref(!1),I=X=>{b.value.forEach(ae=>{ae.selected=O(ae)&&k.value})},S=()=>{const X=b.value.filter(ae=>O(ae)).every(ae=>ae.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 ae=w.value.join(",");X.append("taskIds",ae),(await __deleteInvoice(X,f.value)).code===200&&(showToast({type:"success",message:"移除成功"}),E())}).catch(()=>{})},A=()=>{p.value=!0},U=async X=>{let ae;X===1?ae=await selectPhoto(a):ae=await takePhoto(),ae.append("batchId",_.value),e.value=!0,p.value=!1;try{(await __uploadInvoice(ae)).code===200&&(showToast({type:"success",message:"上传成功"}),ce())}catch(te){console.log(te),ce()}e.value=!1},G=vue.computed(()=>b.value.filter(ae=>ae.selected).every(ae=>O(ae))&&b.value.filter(ae=>ae.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])},ie=()=>{if(w.value.length<=0){showToast({type:"text",message:"请先选择发票"});return}if(!G.value){showToast({type:"text",message:"存在异常发票,无法提交, 请先去修改发票金额"});return}const X=b.value.filter(ae=>ae.selected).map(ae=>{let te=VerificationOfTruth(ae);return{...ae,...te}});r("ok",X,_.value)};vue.ref(null);const ce=()=>{E().then(X=>{X.some(te=>te.taskStatus==="ocr_doing"||te.taskStatus==="ocr_success")&&setTimeout(ce,2e3)}).catch(X=>{setTimeout(ce,2e3)})};return vue.onMounted(()=>{ce()}),(X,ae)=>(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":ae[0]||(ae[0]=te=>k.value=te),onClick:ae[1]||(ae[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,(te,we)=>(vue.openBlock(),vue.createElementBlock("li",{key:we,onClick:re=>C(te)},[vue.createElementVNode("div",_hoisted_9,[te.taskStatus==="finish"||te.taskStatus==="repeat"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_10,[vue.createElementVNode("div",{class:"details-btn",onClick:vue.withModifiers(re=>L(te),["stop"])}," 详情 ",8,_hoisted_11),vue.createElementVNode("div",{class:vue.normalizeClass(["title",{person:te.invoiceCompanyType==="公司"}])},vue.toDisplayString(te.invoiceCompanyType),3),vue.createElementVNode("div",_hoisted_12,[vue.createElementVNode("div",_hoisted_13,[vue.createElementVNode("div",_hoisted_14,vue.toDisplayString(te.sellerName),1),te.taskStatus==="repeat"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_15," 已收录 ")):vue.createCommentVNode("",!0)]),vue.createElementVNode("div",_hoisted_16,[te.manualModify?(vue.openBlock(),vue.createElementBlock("span",_hoisted_17," 手工录入 ")):te.invoiceExceptionInfo?(vue.openBlock(),vue.createElementBlock("div",_hoisted_18,[vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(setClass)(te.invoiceExceptionInfo))},vue.toDisplayString(vue.unref(const_invoiceExceptionInfo)[te.invoiceExceptionInfo]),3)])):(vue.openBlock(),vue.createElementBlock("span",{key:2,class:vue.normalizeClass(vue.unref(setClass)(te.realStatus))},vue.toDisplayString(vue.unref(const_realStatus)[te.realStatus]),3)),vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(setClass)(te.invoiceStatus))},vue.toDisplayString(vue.unref(const_invoiceStatus)[te.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(te.priceTaxTotalFigure||te.noTaxAmountTotal),1)]),vue.createElementVNode("div",_hoisted_24,[_hoisted_25,vue.createElementVNode("span",_hoisted_26,vue.toDisplayString(te.payerName),1)]),vue.createElementVNode("div",_hoisted_27,[_hoisted_28,vue.createElementVNode("span",_hoisted_29,vue.toDisplayString(te.description),1)]),vue.createElementVNode("div",_hoisted_30,[_hoisted_31,vue.createElementVNode("span",_hoisted_32,vue.toDisplayString(te.invoiceDate),1)])]),vue.createElementVNode("div",_hoisted_33,[vue.withDirectives(vue.createElementVNode("input",{onClick:ae[2]||(ae[2]=vue.withModifiers(()=>{},["stop"])),type:"checkbox",class:"checkbox",onChange:S,"onUpdate:modelValue":re=>te.selected=re,"icon-size":"22px"},null,40,_hoisted_34),[[vue.vModelCheckbox,te.selected]])])])])])):te.taskStatus==="ocr_doing"||te.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(te.fileUrlKey)},[vue.createElementVNode("img",{src:te.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:ae[3]||(ae[3]=vue.withModifiers(()=>{},["stop"])),"onUpdate:modelValue":re=>te.selected=re},null,8,_hoisted_43),[[vue.vModelCheckbox,te.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:ie},"确定选择",2)])])])]),vue.createVNode(vue.unref(Popup),{show:p.value,"onUpdate:show":ae[6]||(ae[6]=te=>p.value=te),position:"bottom",closeable:""},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_47,[_hoisted_48,vue.createElementVNode("div",{style:{"padding-bottom":"24px"},onClick:ae[4]||(ae[4]=te=>U(1))},"从相册中选择"),vue.createElementVNode("div",{onClick:ae[5]||(ae[5]=te=>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_f27340ac_lang="",InvoiceList=_export_sfc(_sfc_main$2,[["__scopeId","data-v-f27340ac"]]),_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.
|