mg-ocr-invoice 0.0.7 → 0.0.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 +3 -3
- package/dist/index.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -5831,7 +5831,7 @@ const processImage = async (n) => {
|
|
|
5831
5831
|
default:
|
|
5832
5832
|
return "ok";
|
|
5833
5833
|
}
|
|
5834
|
-
}, _withScopeId$1 = (n) => (pushScopeId("data-v-
|
|
5834
|
+
}, _withScopeId$1 = (n) => (pushScopeId("data-v-39c18419"), n = n(), popScopeId(), n), _hoisted_1$2 = { class: "InvoiceList" }, _hoisted_2$1 = { class: "card" }, _hoisted_3$1 = ["onClick"], _hoisted_4$1 = { class: "li" }, _hoisted_5$1 = {
|
|
5835
5835
|
key: 0,
|
|
5836
5836
|
class: "item-card"
|
|
5837
5837
|
}, _hoisted_6$1 = { class: "storeName" }, _hoisted_7$1 = { class: "name" }, _hoisted_8$1 = { class: "left" }, _hoisted_9 = {
|
|
@@ -5916,7 +5916,7 @@ const processImage = async (n) => {
|
|
|
5916
5916
|
}
|
|
5917
5917
|
h.value = !1;
|
|
5918
5918
|
}, $ = computed(() => {
|
|
5919
|
-
const L = g.value.filter((B) => B.selected).every((B) => B.invoiceStatus === "unused" && B.taskStatus === "ocr_success" || B.taskStatus === "repeat" || B.taskStatus === "finish");
|
|
5919
|
+
const L = g.value.filter((B) => B.selected).every((B) => (console.log(B), B.invoiceStatus === "unused" && (B.taskStatus === "ocr_success" || B.taskStatus === "repeat" || B.taskStatus === "finish")));
|
|
5920
5920
|
return console.log(L && g.value.filter((B) => B.selected).length > 0), L && g.value.filter((B) => B.selected).length > 0;
|
|
5921
5921
|
}), D = () => {
|
|
5922
5922
|
if (y.value.length <= 0) {
|
|
@@ -6093,7 +6093,7 @@ const processImage = async (n) => {
|
|
|
6093
6093
|
}, 8, ["show"])
|
|
6094
6094
|
], 64));
|
|
6095
6095
|
}
|
|
6096
|
-
}),
|
|
6096
|
+
}), index_vue_vue_type_style_index_0_scoped_39c18419_lang = "", InvoiceList = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-39c18419"]]), _withScopeId = (n) => (pushScopeId("data-v-54509002"), n = n(), popScopeId(), n), _hoisted_1$1 = { class: "PaymentMode" }, _hoisted_2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "title" }, "选择识别方式", -1)), _hoisted_3 = { class: "list" }, _hoisted_4 = ["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" }, [
|
|
6097
6097
|
/* @__PURE__ */ createElementVNode("i", { class: "iconfont icon-xiangyou" })
|
|
6098
6098
|
], -1)), _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
6099
6099
|
__name: "index",
|
package/dist/index.umd.js
CHANGED
|
@@ -20,7 +20,7 @@ usage: app.provide(ID_INJECTION_KEY, {
|
|
|
20
20
|
* Released under the MIT license
|
|
21
21
|
*
|
|
22
22
|
* Date: 2023-02-28T14:09:41.732Z
|
|
23
|
-
*/function ownKeys(n,a){var o=Object.keys(n);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(n);a&&(u=u.filter(function(v){return Object.getOwnPropertyDescriptor(n,v).enumerable})),o.push.apply(o,u)}return o}function _objectSpread2(n){for(var a=1;a<arguments.length;a++){var o=arguments[a]!=null?arguments[a]:{};a%2?ownKeys(Object(o),!0).forEach(function(u){_defineProperty(n,u,o[u])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):ownKeys(Object(o)).forEach(function(u){Object.defineProperty(n,u,Object.getOwnPropertyDescriptor(o,u))})}return n}function _classCallCheck(n,a){if(!(n instanceof a))throw new TypeError("Cannot call a class as a function")}function _defineProperties(n,a){for(var o=0;o<a.length;o++){var u=a[o];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(n,_toPropertyKey(u.key),u)}}function _createClass(n,a,o){return a&&_defineProperties(n.prototype,a),o&&_defineProperties(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n}function _defineProperty(n,a,o){return a=_toPropertyKey(a),a in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o,n}function _extends(){return _extends=Object.assign?Object.assign.bind():function(n){for(var a=1;a<arguments.length;a++){var o=arguments[a];for(var u in o)Object.prototype.hasOwnProperty.call(o,u)&&(n[u]=o[u])}return n},_extends.apply(this,arguments)}function _toPrimitive(n,a){if(typeof n!="object"||n===null)return n;var o=n[Symbol.toPrimitive];if(o!==void 0){var u=o.call(n,a||"default");if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(n)}function _toPropertyKey(n){var a=_toPrimitive(n,"string");return typeof a=="symbol"?a:String(a)}var canvasToBlob={exports:{}};(function(n){typeof window>"u"||function(a){var o=a.HTMLCanvasElement&&a.HTMLCanvasElement.prototype,u=a.Blob&&function(){try{return!!new Blob}catch{return!1}}(),v=u&&a.Uint8Array&&function(){try{return new Blob([new Uint8Array(100)]).size===100}catch{return!1}}(),p=a.BlobBuilder||a.WebKitBlobBuilder||a.MozBlobBuilder||a.MSBlobBuilder,e=/^data:((.*?)(;charset=.*?)?)(;base64)?,/,g=(u||p)&&a.atob&&a.ArrayBuffer&&a.Uint8Array&&function(w){var y,x,E,I,k,T,$,D,S;if(y=w.match(e),!y)throw new Error("invalid data URI");for(x=y[2]?y[1]:"text/plain"+(y[3]||";charset=US-ASCII"),E=!!y[4],I=w.slice(y[0].length),E?k=atob(I):k=decodeURIComponent(I),T=new ArrayBuffer(k.length),$=new Uint8Array(T),D=0;D<k.length;D+=1)$[D]=k.charCodeAt(D);return u?new Blob([v?$:T],{type:x}):(S=new p,S.append(T),S.getBlob(x))};a.HTMLCanvasElement&&!o.toBlob&&(o.mozGetAsFile?o.toBlob=function(w,y,x){var E=this;setTimeout(function(){x&&o.toDataURL&&g?w(g(E.toDataURL(y,x))):w(E.mozGetAsFile("blob",y))})}:o.toDataURL&&g&&(o.msToBlob?o.toBlob=function(w,y,x){var E=this;setTimeout(function(){(y&&y!=="image/png"||x)&&o.toDataURL&&g?w(g(E.toDataURL(y,x))):w(E.msToBlob(y))})}:o.toBlob=function(w,y,x){var E=this;setTimeout(function(){w(g(E.toDataURL(y,x)))})})),n.exports?n.exports=g:a.dataURLtoBlob=g}(window)})(canvasToBlob);var toBlob=canvasToBlob.exports,isBlob=function(a){return typeof Blob>"u"?!1:a instanceof Blob||Object.prototype.toString.call(a)==="[object Blob]"},DEFAULTS={strict:!0,checkOrientation:!0,retainExif:!1,maxWidth:1/0,maxHeight:1/0,minWidth:0,minHeight:0,width:void 0,height:void 0,resize:"none",quality:.8,mimeType:"auto",convertTypes:["image/png"],convertSize:5e6,beforeDraw:null,drew:null,success:null,error:null},IS_BROWSER=typeof window<"u"&&typeof window.document<"u",WINDOW=IS_BROWSER?window:{},isPositiveNumber=function(a){return a>0&&a<1/0},slice=Array.prototype.slice;function toArray(n){return Array.from?Array.from(n):slice.call(n)}var REGEXP_IMAGE_TYPE=/^image\/.+$/;function isImageType(n){return REGEXP_IMAGE_TYPE.test(n)}function imageTypeToExtension(n){var a=isImageType(n)?n.substr(6):"";return a==="jpeg"&&(a="jpg"),".".concat(a)}var fromCharCode=String.fromCharCode;function getStringFromCharCode(n,a,o){var u="",v;for(o+=a,v=a;v<o;v+=1)u+=fromCharCode(n.getUint8(v));return u}var btoa$1=WINDOW.btoa;function arrayBufferToDataURL(n,a){for(var o=[],u=8192,v=new Uint8Array(n);v.length>0;)o.push(fromCharCode.apply(null,toArray(v.subarray(0,u)))),v=v.subarray(u);return"data:".concat(a,";base64,").concat(btoa$1(o.join("")))}function resetAndGetOrientation(n){var a=new DataView(n),o;try{var u,v,p;if(a.getUint8(0)===255&&a.getUint8(1)===216)for(var e=a.byteLength,g=2;g+1<e;){if(a.getUint8(g)===255&&a.getUint8(g+1)===225){v=g;break}g+=1}if(v){var w=v+4,y=v+10;if(getStringFromCharCode(a,w,4)==="Exif"){var x=a.getUint16(y);if(u=x===18761,(u||x===19789)&&a.getUint16(y+2,u)===42){var E=a.getUint32(y+4,u);E>=8&&(p=y+E)}}}if(p){var I=a.getUint16(p,u),k,T;for(T=0;T<I;T+=1)if(k=p+T*12+2,a.getUint16(k,u)===274){k+=8,o=a.getUint16(k,u),a.setUint16(k,1,u);break}}}catch{o=1}return o}function parseOrientation(n){var a=0,o=1,u=1;switch(n){case 2:o=-1;break;case 3:a=-180;break;case 4:u=-1;break;case 5:a=90,u=-1;break;case 6:a=90;break;case 7:a=90,o=-1;break;case 8:a=-90;break}return{rotate:a,scaleX:o,scaleY:u}}var REGEXP_DECIMALS=/\.\d*(?:0|9){12}\d*$/;function normalizeDecimalNumber(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return REGEXP_DECIMALS.test(n)?Math.round(n*a)/a:n}function getAdjustedSizes(n){var a=n.aspectRatio,o=n.height,u=n.width,v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"none",p=isPositiveNumber(u),e=isPositiveNumber(o);if(p&&e){var g=o*a;(v==="contain"||v==="none")&&g>u||v==="cover"&&g<u?o=u/a:u=o*a}else p?o=u/a:e&&(u=o*a);return{width:u,height:o}}function getExif(n){for(var a=toArray(new Uint8Array(n)),o=a.length,u=[],v=0;v+3<o;){var p=a[v],e=a[v+1];if(p===255&&e===218)break;if(p===255&&e===216)v+=2;else{var g=a[v+2]*256+a[v+3],w=v+g+2,y=a.slice(v,w);u.push(y),v=w}}return u.reduce(function(x,E){return E[0]===255&&E[1]===225?x.concat(E):x},[])}function insertExif(n,a){var o=toArray(new Uint8Array(n));if(o[2]!==255||o[3]!==224)return n;var u=o[4]*256+o[5],v=[255,216].concat(a,o.slice(4+u));return new Uint8Array(v)}var ArrayBuffer$1=WINDOW.ArrayBuffer,FileReader=WINDOW.FileReader,URL$1=WINDOW.URL||WINDOW.webkitURL,REGEXP_EXTENSION=/\.\w+$/,AnotherCompressor=WINDOW.Compressor,Compressor=function(){function n(a,o){_classCallCheck(this,n),this.file=a,this.exif=[],this.image=new Image,this.options=_objectSpread2(_objectSpread2({},DEFAULTS),o),this.aborted=!1,this.result=null,this.init()}return _createClass(n,[{key:"init",value:function(){var o=this,u=this.file,v=this.options;if(!isBlob(u)){this.fail(new Error("The first argument must be a File or Blob object."));return}var p=u.type;if(!isImageType(p)){this.fail(new Error("The first argument must be an image File or Blob object."));return}if(!URL$1||!FileReader){this.fail(new Error("The current browser does not support image compression."));return}ArrayBuffer$1||(v.checkOrientation=!1,v.retainExif=!1);var e=p==="image/jpeg",g=e&&v.checkOrientation,w=e&&v.retainExif;if(URL$1&&!g&&!w)this.load({url:URL$1.createObjectURL(u)});else{var y=new FileReader;this.reader=y,y.onload=function(x){var E=x.target,I=E.result,k={},T=1;g&&(T=resetAndGetOrientation(I),T>1&&_extends(k,parseOrientation(T))),w&&(o.exif=getExif(I)),g||w?!URL$1||T>1?k.url=arrayBufferToDataURL(I,p):k.url=URL$1.createObjectURL(u):k.url=I,o.load(k)},y.onabort=function(){o.fail(new Error("Aborted to read the image with FileReader."))},y.onerror=function(){o.fail(new Error("Failed to read the image with FileReader."))},y.onloadend=function(){o.reader=null},g||w?y.readAsArrayBuffer(u):y.readAsDataURL(u)}}},{key:"load",value:function(o){var u=this,v=this.file,p=this.image;p.onload=function(){u.draw(_objectSpread2(_objectSpread2({},o),{},{naturalWidth:p.naturalWidth,naturalHeight:p.naturalHeight}))},p.onabort=function(){u.fail(new Error("Aborted to load the image."))},p.onerror=function(){u.fail(new Error("Failed to load the image."))},WINDOW.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(WINDOW.navigator.userAgent)&&(p.crossOrigin="anonymous"),p.alt=v.name,p.src=o.url}},{key:"draw",value:function(o){var u=this,v=o.naturalWidth,p=o.naturalHeight,e=o.rotate,g=e===void 0?0:e,w=o.scaleX,y=w===void 0?1:w,x=o.scaleY,E=x===void 0?1:x,I=this.file,k=this.image,T=this.options,$=document.createElement("canvas"),D=$.getContext("2d"),S=Math.abs(g)%180===90,L=(T.resize==="contain"||T.resize==="cover")&&isPositiveNumber(T.width)&&isPositiveNumber(T.height),B=Math.max(T.maxWidth,0)||1/0,j=Math.max(T.maxHeight,0)||1/0,z=Math.max(T.minWidth,0)||0,R=Math.max(T.minHeight,0)||0,V=v/p,U=T.width,J=T.height;if(S){var ae=[j,B];B=ae[0],j=ae[1];var se=[R,z];z=se[0],R=se[1];var we=[J,U];U=we[0],J=we[1]}L&&(V=U/J);var K=getAdjustedSizes({aspectRatio:V,width:B,height:j},"contain");B=K.width,j=K.height;var re=getAdjustedSizes({aspectRatio:V,width:z,height:R},"cover");if(z=re.width,R=re.height,L){var de=getAdjustedSizes({aspectRatio:V,width:U,height:J},T.resize);U=de.width,J=de.height}else{var be=getAdjustedSizes({aspectRatio:V,width:U,height:J}),G=be.width;U=G===void 0?v:G;var X=be.height;J=X===void 0?p:X}U=Math.floor(normalizeDecimalNumber(Math.min(Math.max(U,z),B))),J=Math.floor(normalizeDecimalNumber(Math.min(Math.max(J,R),j)));var pe=-U/2,Ee=-J/2,ie=U,Q=J,A=[];if(L){var q=0,ee=0,_e=v,Pe=p,Ae=getAdjustedSizes({aspectRatio:V,width:v,height:p},{contain:"cover",cover:"contain"}[T.resize]);_e=Ae.width,Pe=Ae.height,q=(v-_e)/2,ee=(p-Pe)/2,A.push(q,ee,_e,Pe)}if(A.push(pe,Ee,ie,Q),S){var Ve=[J,U];U=Ve[0],J=Ve[1]}$.width=U,$.height=J,isImageType(T.mimeType)||(T.mimeType=I.type);var Re="transparent";I.size>T.convertSize&&T.convertTypes.indexOf(T.mimeType)>=0&&(T.mimeType="image/jpeg");var Me=T.mimeType==="image/jpeg";if(Me&&(Re="#fff"),D.fillStyle=Re,D.fillRect(0,0,U,J),T.beforeDraw&&T.beforeDraw.call(this,D,$),!this.aborted&&(D.save(),D.translate(U/2,J/2),D.rotate(g*Math.PI/180),D.scale(y,E),D.drawImage.apply(D,[k].concat(A)),D.restore(),T.drew&&T.drew.call(this,D,$),!this.aborted)){var Ue=function(Ze){if(!u.aborted){var Be=function(lt){return u.done({naturalWidth:v,naturalHeight:p,result:lt})};if(Ze&&Me&&T.retainExif&&u.exif&&u.exif.length>0){var je=function(lt){return Be(toBlob(arrayBufferToDataURL(insertExif(lt,u.exif),T.mimeType)))};if(Ze.arrayBuffer)Ze.arrayBuffer().then(je).catch(function(){u.fail(new Error("Failed to read the compressed image with Blob.arrayBuffer()."))});else{var Ne=new FileReader;u.reader=Ne,Ne.onload=function(rt){var lt=rt.target;je(lt.result)},Ne.onabort=function(){u.fail(new Error("Aborted to read the compressed image with FileReader."))},Ne.onerror=function(){u.fail(new Error("Failed to read the compressed image with FileReader."))},Ne.onloadend=function(){u.reader=null},Ne.readAsArrayBuffer(Ze)}}else Be(Ze)}};$.toBlob?$.toBlob(Ue,T.mimeType,T.quality):Ue(toBlob($.toDataURL(T.mimeType,T.quality)))}}},{key:"done",value:function(o){var u=o.naturalWidth,v=o.naturalHeight,p=o.result,e=this.file,g=this.image,w=this.options;if(URL$1&&g.src.indexOf("blob:")===0&&URL$1.revokeObjectURL(g.src),p)if(w.strict&&!w.retainExif&&p.size>e.size&&w.mimeType===e.type&&!(w.width>u||w.height>v||w.minWidth>u||w.minHeight>v||w.maxWidth<u||w.maxHeight<v))p=e;else{var y=new Date;p.lastModified=y.getTime(),p.lastModifiedDate=y,p.name=e.name,p.name&&p.type!==e.type&&(p.name=p.name.replace(REGEXP_EXTENSION,imageTypeToExtension(p.type)))}else p=e;this.result=p,w.success&&w.success.call(this,p)}},{key:"fail",value:function(o){var u=this.options;if(u.error)u.error.call(this,o);else throw o}},{key:"abort",value:function(){this.aborted||(this.aborted=!0,this.reader?this.reader.abort():this.image.complete?this.fail(new Error("The compression process has been aborted.")):(this.image.onload=null,this.image.onabort()))}}],[{key:"noConflict",value:function(){return window.Compressor=AnotherCompressor,n}},{key:"setDefaults",value:function(o){_extends(DEFAULTS,o)}}]),n}();const processImage=async n=>{if(console.log(n,"file"),!!n)return new Promise((a,o)=>{new Compressor(n,{quality:.6,mimeType:n.type,success(u){const v=new File([u],n.name,{type:n.type,lastModified:n.lastModified});console.log(v),a(v)},error(u){console.log(u.message),o(u)}})})},takePhoto=()=>new Promise((n,a)=>{var o=document.createElement("input");o.type="file",o.accept="image/*",o.capture="camera",o.style.display="none",document.body.appendChild(o);let u=new FormData;o.onchange=async function(v){var p=v.target.files[0];try{const e=await processImage(p);u.append("invoiceFiles",e),document.body.removeChild(o),n(u)}catch(e){console.log(e),document.body.removeChild(o),a(e)}},o.oncancel=()=>{document.body.removeChild(o)},o.click()}),selectPhoto=async n=>new Promise((a,o)=>{var u=document.createElement("input");u.type="file",u.accept="image/*, .pdf ,.ofd",console.log(n,"multiple"),u.multiple=n,u.style.visibility="none",document.body.appendChild(u);let v=new FormData;u.onchange=async function(p){var e=p.target.files;if(e.length>9){u.value="",showFailToast("一次最多选择9张图片!");return}for(let g=0;g<e.length;g++){const w=e[g];try{const y=w;v.append("invoiceFiles",y),a(v)}catch(y){console.log(y),o(y)}}document.body.removeChild(u)},u.oncancel=()=>{document.body.removeChild(u)},u.click()}),const_invoiceStatus={invalid:"无效发票",unused:"未使用",using:"使用中",used:"已使用"},const_realStatus={noNeed:"无需验真",notCheck:"未验真",checked:"已验真",checkFail:"验真失败"},setClass=n=>{switch(n){case"invalid":return"error";case"unused":return"warning";case"using":return"ok";case"used":return"default";case"noNeed":return"ok";case"notCheck":return"warning";case"checked":return"ok";case"checkFail":return"error";default:return"ok"}},_withScopeId$1=n=>(vue.pushScopeId("data-v-fea31d2c"),n=n(),vue.popScopeId(),n),_hoisted_1$2={class:"InvoiceList"},_hoisted_2$1={class:"card"},_hoisted_3$1=["onClick"],_hoisted_4$1={class:"li"},_hoisted_5$1={key:0,class:"item-card"},_hoisted_6$1={class:"storeName"},_hoisted_7$1={class:"name"},_hoisted_8$1={class:"left"},_hoisted_9={key:0,class:"right"},_hoisted_10={class:"tags"},_hoisted_11={class:"InvoiceInfo"},_hoisted_12={class:"leftinfo"},_hoisted_13={class:"item-info"},_hoisted_14=_withScopeId$1(()=>vue.createElementVNode("span",{class:"label"},"发票金额",-1)),_hoisted_15={class:"value price"},_hoisted_16={class:"item-info"},_hoisted_17=_withScopeId$1(()=>vue.createElementVNode("span",{class:"label"},"发票抬头",-1)),_hoisted_18={class:"value"},_hoisted_19={class:"item-info"},_hoisted_20=_withScopeId$1(()=>vue.createElementVNode("span",{class:"label"},"发票类型",-1)),_hoisted_21={class:"value"},_hoisted_22={class:"item-info"},_hoisted_23=_withScopeId$1(()=>vue.createElementVNode("span",{class:"label"},"发票时间",-1)),_hoisted_24={class:"value"},_hoisted_25={class:"rightCheckbox"},_hoisted_26={key:1,style:{"background-color":"#fff",padding:"21px 0 15px 12px",position:"relative",width:"100%"}},_hoisted_27={key:2,class:"err-card"},_hoisted_28={class:"left-img"},_hoisted_29=["src"],_hoisted_30={class:"right-errText"},_hoisted_31=_withScopeId$1(()=>vue.createElementVNode("div",{class:"title"},[vue.createElementVNode("span",null,"识别失败")],-1)),_hoisted_32={class:"content"},_hoisted_33=_withScopeId$1(()=>vue.createElementVNode("div",{class:"recognitionResult"},[vue.createElementVNode("p",{class:"errContent"},"OCR识别失败"),vue.createElementVNode("p",null,"可以重新拍照识别,或手动添加信息导入")],-1)),_hoisted_34={class:"btn-form"},_hoisted_35={class:"operate"},_hoisted_36={class:"right-btn"},_hoisted_37={class:"boxPopup"},_hoisted_38=_withScopeId$1(()=>vue.createElementVNode("div",{class:"title"},[vue.createElementVNode("span",null,"添加发票")],-1)),_sfc_main$2=vue.defineComponent({__name:"index",props:{listId:{required:!0,type:String},multiple:{required:!0,type:Boolean}},emits:["edit","ok"],setup(n,{emit:a}){const{listId:o,multiple:u}=n,v=vue.ref(sessionStorage.getItem("token")),p=vue.ref(!1),e=vue.ref(!1),g=vue.ref([]),w=vue.ref(""),y=vue.computed(()=>g.value.filter(L=>L.selected).map(L=>L.taskId)),x=async()=>new Promise(async(L,B)=>{const j={};j.batchId=o;try{const z=await __getUploadInvoiceList(j,v.value);console.log(z),z.code===200&&(g.value=z.data.invoiceList.map(R=>({...R,selected:!1})),w.value=z.data.batchId,L(g.value))}catch(z){console.log(z),B(z)}}),E=L=>{L.taskStatus!=="finish"&&L.taskStatus!=="repeat"||a("edit",{taskId:L.taskId,batchId:w.value},L)},I=()=>{if(y.value.length<=0){showToast({type:"text",message:"请先选择发票"});return}showConfirmDialog({title:"提醒",message:"请确认是否需要移除选中项,移除后不可恢复!"}).then(async()=>{var L=new URLSearchParams;L.append("batchId",w.value);const B=y.value.join(",");L.append("taskIds",B),(await __deleteInvoice(L,v.value)).code===200&&(showToast({type:"success",message:"移除成功"}),x())}).catch(()=>{})},k=()=>{e.value=!0},T=async L=>{let B;L===1?B=await selectPhoto(u):B=await takePhoto(),B.append("batchId",w.value),p.value=!0,e.value=!1;try{(await __uploadInvoice(B)).code===200&&(showToast({type:"success",message:"上传成功"}),S())}catch(j){console.log(j),S()}p.value=!1},$=vue.computed(()=>{const L=g.value.filter(B=>B.selected).every(B=>B.invoiceStatus==="unused"&&B.taskStatus==="ocr_success"||B.taskStatus==="repeat"||B.taskStatus==="finish");return console.log(L&&g.value.filter(B=>B.selected).length>0),L&&g.value.filter(B=>B.selected).length>0}),D=()=>{if(y.value.length<=0){showToast({type:"text",message:"请先选择发票"});return}const L=g.value.filter(B=>B.selected);console.log(L),a("ok",L)};vue.ref(null);const S=()=>{x().then(L=>{L.some(j=>j.taskStatus==="ocr_doing"||j.taskStatus==="ocr_success")&&setTimeout(S,2e3)}).catch(L=>{setTimeout(S,2e3)})};return vue.onMounted(()=>{S()}),(L,B)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",_hoisted_1$2,[vue.createElementVNode("div",_hoisted_2$1,[vue.createElementVNode("ul",null,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(g.value,(j,z)=>(vue.openBlock(),vue.createElementBlock("li",{key:z,onClick:R=>E(j)},[vue.createElementVNode("div",_hoisted_4$1,[j.taskStatus==="finish"||j.taskStatus==="repeat"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_5$1,[vue.createElementVNode("div",{class:vue.normalizeClass(["title",{person:j.invoiceCompanyType==="公司"}])},vue.toDisplayString(j.invoiceCompanyType),3),vue.createElementVNode("div",_hoisted_6$1,[vue.createElementVNode("div",_hoisted_7$1,[vue.createElementVNode("div",_hoisted_8$1,vue.toDisplayString(j.sellerName),1),j.taskStatus==="repeat"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_9," 重复录入 ")):vue.createCommentVNode("",!0)]),vue.createElementVNode("div",_hoisted_10,[vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(setClass)(j.realStatus))},vue.toDisplayString(vue.unref(const_realStatus)[j.realStatus]),3),vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(setClass)(j.invoiceStatus))},vue.toDisplayString(vue.unref(const_invoiceStatus)[j.invoiceStatus]),3)]),vue.createElementVNode("div",_hoisted_11,[vue.createElementVNode("div",_hoisted_12,[vue.createElementVNode("div",_hoisted_13,[_hoisted_14,vue.createElementVNode("span",_hoisted_15,"¥"+vue.toDisplayString(j.priceTaxTotalFigure||j.noTaxAmountTotal),1)]),vue.createElementVNode("div",_hoisted_16,[_hoisted_17,vue.createElementVNode("span",_hoisted_18,vue.toDisplayString(j.payerName),1)]),vue.createElementVNode("div",_hoisted_19,[_hoisted_20,vue.createElementVNode("span",_hoisted_21,vue.toDisplayString(j.description),1)]),vue.createElementVNode("div",_hoisted_22,[_hoisted_23,vue.createElementVNode("span",_hoisted_24,vue.toDisplayString(j.invoiceDate),1)])]),vue.createElementVNode("div",_hoisted_25,[vue.createVNode(vue.unref(Checkbox),{onClick:B[0]||(B[0]=vue.withModifiers(()=>{},["stop"])),modelValue:j.selected,"onUpdate:modelValue":R=>j.selected=R,"icon-size":"22px"},null,8,["modelValue","onUpdate:modelValue"])])])])])):j.taskStatus==="ocr_doing"||j.taskStatus==="ocr_success"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_26,[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_27,[vue.createElementVNode("div",_hoisted_28,[vue.createElementVNode("img",{src:j.fileUrlKey,alt:""},null,8,_hoisted_29)]),vue.createElementVNode("div",_hoisted_30,[_hoisted_31,vue.createElementVNode("div",_hoisted_32,[_hoisted_33,vue.createElementVNode("div",null,[vue.createVNode(vue.unref(Checkbox),{onClick:B[1]||(B[1]=vue.withModifiers(()=>{},["stop"])),modelValue:j.selected,"onUpdate:modelValue":R=>j.selected=R,"icon-size":"22px"},null,8,["modelValue","onUpdate:modelValue"])])])])]))])],8,_hoisted_3$1))),128))])]),vue.createElementVNode("div",_hoisted_34,[vue.createElementVNode("div",_hoisted_35,[vue.createElementVNode("div",{class:"delete"},[vue.createElementVNode("span",{onClick:I},"移除")]),vue.createElementVNode("div",_hoisted_36,[vue.createElementVNode("span",{class:"add",onClick:k},"继续添加发票"),vue.createElementVNode("span",{class:vue.normalizeClass(["ok",{disabledColor:!$.value}]),onClick:D},"确定选择",2)])])])]),vue.createVNode(vue.unref(Popup),{show:e.value,"onUpdate:show":B[4]||(B[4]=j=>e.value=j),position:"bottom",closeable:""},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_37,[_hoisted_38,vue.createElementVNode("div",{style:{"padding-bottom":"24px"},onClick:B[2]||(B[2]=j=>T(1))},"从相册中选择"),vue.createElementVNode("div",{onClick:B[3]||(B[3]=j=>T(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_fea31d2c_lang="",InvoiceList=_export_sfc(_sfc_main$2,[["__scopeId","data-v-fea31d2c"]]),_withScopeId=n=>(vue.pushScopeId("data-v-54509002"),n=n(),vue.popScopeId(),n),_hoisted_1$1={class:"PaymentMode"},_hoisted_2=_withScopeId(()=>vue.createElementVNode("div",{class:"title"},"选择识别方式",-1)),_hoisted_3={class:"list"},_hoisted_4=["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"],emits:["uploadSuccess"],setup(n,{emit:a}){const{multiple:o}=n,u=[{text:"拍照",leftIcon:"icon-xiangji"},{text:"相册",leftIcon:"icon-xiangce"}];document.title="请选择添加费用方式";const v=vue.ref(!1),p=async e=>{let g;e=="拍照"&&(g=await takePhoto()),e=="相册"&&(g=await selectPhoto(o)),v.value=!0;try{const w=await __uploadInvoice(g);console.log(w),w.code===200&&(showToast({type:"success",message:"上传成功"}),a("uploadSuccess",w.data))}catch(w){console.log(w),showFailToast("上传失败")}v.value=!1};return(e,g)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",_hoisted_1$1,[_hoisted_2,vue.createElementVNode("div",_hoisted_3,[(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,vue.renderList(u,(w,y)=>vue.createElementVNode("div",{class:"method-item",onClick:x=>p(w.text),key:w.id||y},[vue.createElementVNode("div",_hoisted_5,[vue.createElementVNode("span",_hoisted_6,[vue.createElementVNode("i",{class:vue.normalizeClass(["iconfont",w.leftIcon])},null,2)]),vue.createElementVNode("span",_hoisted_7,vue.toDisplayString(w.text),1)]),_hoisted_8],8,_hoisted_4)),64))])]),vue.createVNode(vue.unref(Overlay),{style:{display:"flex","justify-content":"center","align-items":"center"},show:v.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_54509002_lang="",PaymentMode=_export_sfc(_sfc_main$1,[["__scopeId","data-v-54509002"]]);function getUrlParams(n){const a={},o=n.split("?")[1];return o&&o.split("&").forEach(v=>{const[p,e]=v.split("=");a[p]=decodeURIComponent(e)}),a}var vconsole_min={exports:{}};/*!
|
|
23
|
+
*/function ownKeys(n,a){var o=Object.keys(n);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(n);a&&(u=u.filter(function(v){return Object.getOwnPropertyDescriptor(n,v).enumerable})),o.push.apply(o,u)}return o}function _objectSpread2(n){for(var a=1;a<arguments.length;a++){var o=arguments[a]!=null?arguments[a]:{};a%2?ownKeys(Object(o),!0).forEach(function(u){_defineProperty(n,u,o[u])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(o)):ownKeys(Object(o)).forEach(function(u){Object.defineProperty(n,u,Object.getOwnPropertyDescriptor(o,u))})}return n}function _classCallCheck(n,a){if(!(n instanceof a))throw new TypeError("Cannot call a class as a function")}function _defineProperties(n,a){for(var o=0;o<a.length;o++){var u=a[o];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(n,_toPropertyKey(u.key),u)}}function _createClass(n,a,o){return a&&_defineProperties(n.prototype,a),o&&_defineProperties(n,o),Object.defineProperty(n,"prototype",{writable:!1}),n}function _defineProperty(n,a,o){return a=_toPropertyKey(a),a in n?Object.defineProperty(n,a,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[a]=o,n}function _extends(){return _extends=Object.assign?Object.assign.bind():function(n){for(var a=1;a<arguments.length;a++){var o=arguments[a];for(var u in o)Object.prototype.hasOwnProperty.call(o,u)&&(n[u]=o[u])}return n},_extends.apply(this,arguments)}function _toPrimitive(n,a){if(typeof n!="object"||n===null)return n;var o=n[Symbol.toPrimitive];if(o!==void 0){var u=o.call(n,a||"default");if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(n)}function _toPropertyKey(n){var a=_toPrimitive(n,"string");return typeof a=="symbol"?a:String(a)}var canvasToBlob={exports:{}};(function(n){typeof window>"u"||function(a){var o=a.HTMLCanvasElement&&a.HTMLCanvasElement.prototype,u=a.Blob&&function(){try{return!!new Blob}catch{return!1}}(),v=u&&a.Uint8Array&&function(){try{return new Blob([new Uint8Array(100)]).size===100}catch{return!1}}(),p=a.BlobBuilder||a.WebKitBlobBuilder||a.MozBlobBuilder||a.MSBlobBuilder,e=/^data:((.*?)(;charset=.*?)?)(;base64)?,/,g=(u||p)&&a.atob&&a.ArrayBuffer&&a.Uint8Array&&function(w){var y,x,E,I,k,T,$,D,S;if(y=w.match(e),!y)throw new Error("invalid data URI");for(x=y[2]?y[1]:"text/plain"+(y[3]||";charset=US-ASCII"),E=!!y[4],I=w.slice(y[0].length),E?k=atob(I):k=decodeURIComponent(I),T=new ArrayBuffer(k.length),$=new Uint8Array(T),D=0;D<k.length;D+=1)$[D]=k.charCodeAt(D);return u?new Blob([v?$:T],{type:x}):(S=new p,S.append(T),S.getBlob(x))};a.HTMLCanvasElement&&!o.toBlob&&(o.mozGetAsFile?o.toBlob=function(w,y,x){var E=this;setTimeout(function(){x&&o.toDataURL&&g?w(g(E.toDataURL(y,x))):w(E.mozGetAsFile("blob",y))})}:o.toDataURL&&g&&(o.msToBlob?o.toBlob=function(w,y,x){var E=this;setTimeout(function(){(y&&y!=="image/png"||x)&&o.toDataURL&&g?w(g(E.toDataURL(y,x))):w(E.msToBlob(y))})}:o.toBlob=function(w,y,x){var E=this;setTimeout(function(){w(g(E.toDataURL(y,x)))})})),n.exports?n.exports=g:a.dataURLtoBlob=g}(window)})(canvasToBlob);var toBlob=canvasToBlob.exports,isBlob=function(a){return typeof Blob>"u"?!1:a instanceof Blob||Object.prototype.toString.call(a)==="[object Blob]"},DEFAULTS={strict:!0,checkOrientation:!0,retainExif:!1,maxWidth:1/0,maxHeight:1/0,minWidth:0,minHeight:0,width:void 0,height:void 0,resize:"none",quality:.8,mimeType:"auto",convertTypes:["image/png"],convertSize:5e6,beforeDraw:null,drew:null,success:null,error:null},IS_BROWSER=typeof window<"u"&&typeof window.document<"u",WINDOW=IS_BROWSER?window:{},isPositiveNumber=function(a){return a>0&&a<1/0},slice=Array.prototype.slice;function toArray(n){return Array.from?Array.from(n):slice.call(n)}var REGEXP_IMAGE_TYPE=/^image\/.+$/;function isImageType(n){return REGEXP_IMAGE_TYPE.test(n)}function imageTypeToExtension(n){var a=isImageType(n)?n.substr(6):"";return a==="jpeg"&&(a="jpg"),".".concat(a)}var fromCharCode=String.fromCharCode;function getStringFromCharCode(n,a,o){var u="",v;for(o+=a,v=a;v<o;v+=1)u+=fromCharCode(n.getUint8(v));return u}var btoa$1=WINDOW.btoa;function arrayBufferToDataURL(n,a){for(var o=[],u=8192,v=new Uint8Array(n);v.length>0;)o.push(fromCharCode.apply(null,toArray(v.subarray(0,u)))),v=v.subarray(u);return"data:".concat(a,";base64,").concat(btoa$1(o.join("")))}function resetAndGetOrientation(n){var a=new DataView(n),o;try{var u,v,p;if(a.getUint8(0)===255&&a.getUint8(1)===216)for(var e=a.byteLength,g=2;g+1<e;){if(a.getUint8(g)===255&&a.getUint8(g+1)===225){v=g;break}g+=1}if(v){var w=v+4,y=v+10;if(getStringFromCharCode(a,w,4)==="Exif"){var x=a.getUint16(y);if(u=x===18761,(u||x===19789)&&a.getUint16(y+2,u)===42){var E=a.getUint32(y+4,u);E>=8&&(p=y+E)}}}if(p){var I=a.getUint16(p,u),k,T;for(T=0;T<I;T+=1)if(k=p+T*12+2,a.getUint16(k,u)===274){k+=8,o=a.getUint16(k,u),a.setUint16(k,1,u);break}}}catch{o=1}return o}function parseOrientation(n){var a=0,o=1,u=1;switch(n){case 2:o=-1;break;case 3:a=-180;break;case 4:u=-1;break;case 5:a=90,u=-1;break;case 6:a=90;break;case 7:a=90,o=-1;break;case 8:a=-90;break}return{rotate:a,scaleX:o,scaleY:u}}var REGEXP_DECIMALS=/\.\d*(?:0|9){12}\d*$/;function normalizeDecimalNumber(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return REGEXP_DECIMALS.test(n)?Math.round(n*a)/a:n}function getAdjustedSizes(n){var a=n.aspectRatio,o=n.height,u=n.width,v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"none",p=isPositiveNumber(u),e=isPositiveNumber(o);if(p&&e){var g=o*a;(v==="contain"||v==="none")&&g>u||v==="cover"&&g<u?o=u/a:u=o*a}else p?o=u/a:e&&(u=o*a);return{width:u,height:o}}function getExif(n){for(var a=toArray(new Uint8Array(n)),o=a.length,u=[],v=0;v+3<o;){var p=a[v],e=a[v+1];if(p===255&&e===218)break;if(p===255&&e===216)v+=2;else{var g=a[v+2]*256+a[v+3],w=v+g+2,y=a.slice(v,w);u.push(y),v=w}}return u.reduce(function(x,E){return E[0]===255&&E[1]===225?x.concat(E):x},[])}function insertExif(n,a){var o=toArray(new Uint8Array(n));if(o[2]!==255||o[3]!==224)return n;var u=o[4]*256+o[5],v=[255,216].concat(a,o.slice(4+u));return new Uint8Array(v)}var ArrayBuffer$1=WINDOW.ArrayBuffer,FileReader=WINDOW.FileReader,URL$1=WINDOW.URL||WINDOW.webkitURL,REGEXP_EXTENSION=/\.\w+$/,AnotherCompressor=WINDOW.Compressor,Compressor=function(){function n(a,o){_classCallCheck(this,n),this.file=a,this.exif=[],this.image=new Image,this.options=_objectSpread2(_objectSpread2({},DEFAULTS),o),this.aborted=!1,this.result=null,this.init()}return _createClass(n,[{key:"init",value:function(){var o=this,u=this.file,v=this.options;if(!isBlob(u)){this.fail(new Error("The first argument must be a File or Blob object."));return}var p=u.type;if(!isImageType(p)){this.fail(new Error("The first argument must be an image File or Blob object."));return}if(!URL$1||!FileReader){this.fail(new Error("The current browser does not support image compression."));return}ArrayBuffer$1||(v.checkOrientation=!1,v.retainExif=!1);var e=p==="image/jpeg",g=e&&v.checkOrientation,w=e&&v.retainExif;if(URL$1&&!g&&!w)this.load({url:URL$1.createObjectURL(u)});else{var y=new FileReader;this.reader=y,y.onload=function(x){var E=x.target,I=E.result,k={},T=1;g&&(T=resetAndGetOrientation(I),T>1&&_extends(k,parseOrientation(T))),w&&(o.exif=getExif(I)),g||w?!URL$1||T>1?k.url=arrayBufferToDataURL(I,p):k.url=URL$1.createObjectURL(u):k.url=I,o.load(k)},y.onabort=function(){o.fail(new Error("Aborted to read the image with FileReader."))},y.onerror=function(){o.fail(new Error("Failed to read the image with FileReader."))},y.onloadend=function(){o.reader=null},g||w?y.readAsArrayBuffer(u):y.readAsDataURL(u)}}},{key:"load",value:function(o){var u=this,v=this.file,p=this.image;p.onload=function(){u.draw(_objectSpread2(_objectSpread2({},o),{},{naturalWidth:p.naturalWidth,naturalHeight:p.naturalHeight}))},p.onabort=function(){u.fail(new Error("Aborted to load the image."))},p.onerror=function(){u.fail(new Error("Failed to load the image."))},WINDOW.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(WINDOW.navigator.userAgent)&&(p.crossOrigin="anonymous"),p.alt=v.name,p.src=o.url}},{key:"draw",value:function(o){var u=this,v=o.naturalWidth,p=o.naturalHeight,e=o.rotate,g=e===void 0?0:e,w=o.scaleX,y=w===void 0?1:w,x=o.scaleY,E=x===void 0?1:x,I=this.file,k=this.image,T=this.options,$=document.createElement("canvas"),D=$.getContext("2d"),S=Math.abs(g)%180===90,L=(T.resize==="contain"||T.resize==="cover")&&isPositiveNumber(T.width)&&isPositiveNumber(T.height),B=Math.max(T.maxWidth,0)||1/0,j=Math.max(T.maxHeight,0)||1/0,z=Math.max(T.minWidth,0)||0,R=Math.max(T.minHeight,0)||0,V=v/p,U=T.width,J=T.height;if(S){var ae=[j,B];B=ae[0],j=ae[1];var se=[R,z];z=se[0],R=se[1];var we=[J,U];U=we[0],J=we[1]}L&&(V=U/J);var K=getAdjustedSizes({aspectRatio:V,width:B,height:j},"contain");B=K.width,j=K.height;var re=getAdjustedSizes({aspectRatio:V,width:z,height:R},"cover");if(z=re.width,R=re.height,L){var de=getAdjustedSizes({aspectRatio:V,width:U,height:J},T.resize);U=de.width,J=de.height}else{var be=getAdjustedSizes({aspectRatio:V,width:U,height:J}),G=be.width;U=G===void 0?v:G;var X=be.height;J=X===void 0?p:X}U=Math.floor(normalizeDecimalNumber(Math.min(Math.max(U,z),B))),J=Math.floor(normalizeDecimalNumber(Math.min(Math.max(J,R),j)));var pe=-U/2,Ee=-J/2,ie=U,Q=J,A=[];if(L){var q=0,ee=0,_e=v,Pe=p,Ae=getAdjustedSizes({aspectRatio:V,width:v,height:p},{contain:"cover",cover:"contain"}[T.resize]);_e=Ae.width,Pe=Ae.height,q=(v-_e)/2,ee=(p-Pe)/2,A.push(q,ee,_e,Pe)}if(A.push(pe,Ee,ie,Q),S){var Ve=[J,U];U=Ve[0],J=Ve[1]}$.width=U,$.height=J,isImageType(T.mimeType)||(T.mimeType=I.type);var Re="transparent";I.size>T.convertSize&&T.convertTypes.indexOf(T.mimeType)>=0&&(T.mimeType="image/jpeg");var Me=T.mimeType==="image/jpeg";if(Me&&(Re="#fff"),D.fillStyle=Re,D.fillRect(0,0,U,J),T.beforeDraw&&T.beforeDraw.call(this,D,$),!this.aborted&&(D.save(),D.translate(U/2,J/2),D.rotate(g*Math.PI/180),D.scale(y,E),D.drawImage.apply(D,[k].concat(A)),D.restore(),T.drew&&T.drew.call(this,D,$),!this.aborted)){var Ue=function(Ze){if(!u.aborted){var Be=function(lt){return u.done({naturalWidth:v,naturalHeight:p,result:lt})};if(Ze&&Me&&T.retainExif&&u.exif&&u.exif.length>0){var je=function(lt){return Be(toBlob(arrayBufferToDataURL(insertExif(lt,u.exif),T.mimeType)))};if(Ze.arrayBuffer)Ze.arrayBuffer().then(je).catch(function(){u.fail(new Error("Failed to read the compressed image with Blob.arrayBuffer()."))});else{var Ne=new FileReader;u.reader=Ne,Ne.onload=function(rt){var lt=rt.target;je(lt.result)},Ne.onabort=function(){u.fail(new Error("Aborted to read the compressed image with FileReader."))},Ne.onerror=function(){u.fail(new Error("Failed to read the compressed image with FileReader."))},Ne.onloadend=function(){u.reader=null},Ne.readAsArrayBuffer(Ze)}}else Be(Ze)}};$.toBlob?$.toBlob(Ue,T.mimeType,T.quality):Ue(toBlob($.toDataURL(T.mimeType,T.quality)))}}},{key:"done",value:function(o){var u=o.naturalWidth,v=o.naturalHeight,p=o.result,e=this.file,g=this.image,w=this.options;if(URL$1&&g.src.indexOf("blob:")===0&&URL$1.revokeObjectURL(g.src),p)if(w.strict&&!w.retainExif&&p.size>e.size&&w.mimeType===e.type&&!(w.width>u||w.height>v||w.minWidth>u||w.minHeight>v||w.maxWidth<u||w.maxHeight<v))p=e;else{var y=new Date;p.lastModified=y.getTime(),p.lastModifiedDate=y,p.name=e.name,p.name&&p.type!==e.type&&(p.name=p.name.replace(REGEXP_EXTENSION,imageTypeToExtension(p.type)))}else p=e;this.result=p,w.success&&w.success.call(this,p)}},{key:"fail",value:function(o){var u=this.options;if(u.error)u.error.call(this,o);else throw o}},{key:"abort",value:function(){this.aborted||(this.aborted=!0,this.reader?this.reader.abort():this.image.complete?this.fail(new Error("The compression process has been aborted.")):(this.image.onload=null,this.image.onabort()))}}],[{key:"noConflict",value:function(){return window.Compressor=AnotherCompressor,n}},{key:"setDefaults",value:function(o){_extends(DEFAULTS,o)}}]),n}();const processImage=async n=>{if(console.log(n,"file"),!!n)return new Promise((a,o)=>{new Compressor(n,{quality:.6,mimeType:n.type,success(u){const v=new File([u],n.name,{type:n.type,lastModified:n.lastModified});console.log(v),a(v)},error(u){console.log(u.message),o(u)}})})},takePhoto=()=>new Promise((n,a)=>{var o=document.createElement("input");o.type="file",o.accept="image/*",o.capture="camera",o.style.display="none",document.body.appendChild(o);let u=new FormData;o.onchange=async function(v){var p=v.target.files[0];try{const e=await processImage(p);u.append("invoiceFiles",e),document.body.removeChild(o),n(u)}catch(e){console.log(e),document.body.removeChild(o),a(e)}},o.oncancel=()=>{document.body.removeChild(o)},o.click()}),selectPhoto=async n=>new Promise((a,o)=>{var u=document.createElement("input");u.type="file",u.accept="image/*, .pdf ,.ofd",console.log(n,"multiple"),u.multiple=n,u.style.visibility="none",document.body.appendChild(u);let v=new FormData;u.onchange=async function(p){var e=p.target.files;if(e.length>9){u.value="",showFailToast("一次最多选择9张图片!");return}for(let g=0;g<e.length;g++){const w=e[g];try{const y=w;v.append("invoiceFiles",y),a(v)}catch(y){console.log(y),o(y)}}document.body.removeChild(u)},u.oncancel=()=>{document.body.removeChild(u)},u.click()}),const_invoiceStatus={invalid:"无效发票",unused:"未使用",using:"使用中",used:"已使用"},const_realStatus={noNeed:"无需验真",notCheck:"未验真",checked:"已验真",checkFail:"验真失败"},setClass=n=>{switch(n){case"invalid":return"error";case"unused":return"warning";case"using":return"ok";case"used":return"default";case"noNeed":return"ok";case"notCheck":return"warning";case"checked":return"ok";case"checkFail":return"error";default:return"ok"}},_withScopeId$1=n=>(vue.pushScopeId("data-v-39c18419"),n=n(),vue.popScopeId(),n),_hoisted_1$2={class:"InvoiceList"},_hoisted_2$1={class:"card"},_hoisted_3$1=["onClick"],_hoisted_4$1={class:"li"},_hoisted_5$1={key:0,class:"item-card"},_hoisted_6$1={class:"storeName"},_hoisted_7$1={class:"name"},_hoisted_8$1={class:"left"},_hoisted_9={key:0,class:"right"},_hoisted_10={class:"tags"},_hoisted_11={class:"InvoiceInfo"},_hoisted_12={class:"leftinfo"},_hoisted_13={class:"item-info"},_hoisted_14=_withScopeId$1(()=>vue.createElementVNode("span",{class:"label"},"发票金额",-1)),_hoisted_15={class:"value price"},_hoisted_16={class:"item-info"},_hoisted_17=_withScopeId$1(()=>vue.createElementVNode("span",{class:"label"},"发票抬头",-1)),_hoisted_18={class:"value"},_hoisted_19={class:"item-info"},_hoisted_20=_withScopeId$1(()=>vue.createElementVNode("span",{class:"label"},"发票类型",-1)),_hoisted_21={class:"value"},_hoisted_22={class:"item-info"},_hoisted_23=_withScopeId$1(()=>vue.createElementVNode("span",{class:"label"},"发票时间",-1)),_hoisted_24={class:"value"},_hoisted_25={class:"rightCheckbox"},_hoisted_26={key:1,style:{"background-color":"#fff",padding:"21px 0 15px 12px",position:"relative",width:"100%"}},_hoisted_27={key:2,class:"err-card"},_hoisted_28={class:"left-img"},_hoisted_29=["src"],_hoisted_30={class:"right-errText"},_hoisted_31=_withScopeId$1(()=>vue.createElementVNode("div",{class:"title"},[vue.createElementVNode("span",null,"识别失败")],-1)),_hoisted_32={class:"content"},_hoisted_33=_withScopeId$1(()=>vue.createElementVNode("div",{class:"recognitionResult"},[vue.createElementVNode("p",{class:"errContent"},"OCR识别失败"),vue.createElementVNode("p",null,"可以重新拍照识别,或手动添加信息导入")],-1)),_hoisted_34={class:"btn-form"},_hoisted_35={class:"operate"},_hoisted_36={class:"right-btn"},_hoisted_37={class:"boxPopup"},_hoisted_38=_withScopeId$1(()=>vue.createElementVNode("div",{class:"title"},[vue.createElementVNode("span",null,"添加发票")],-1)),_sfc_main$2=vue.defineComponent({__name:"index",props:{listId:{required:!0,type:String},multiple:{required:!0,type:Boolean}},emits:["edit","ok"],setup(n,{emit:a}){const{listId:o,multiple:u}=n,v=vue.ref(sessionStorage.getItem("token")),p=vue.ref(!1),e=vue.ref(!1),g=vue.ref([]),w=vue.ref(""),y=vue.computed(()=>g.value.filter(L=>L.selected).map(L=>L.taskId)),x=async()=>new Promise(async(L,B)=>{const j={};j.batchId=o;try{const z=await __getUploadInvoiceList(j,v.value);console.log(z),z.code===200&&(g.value=z.data.invoiceList.map(R=>({...R,selected:!1})),w.value=z.data.batchId,L(g.value))}catch(z){console.log(z),B(z)}}),E=L=>{L.taskStatus!=="finish"&&L.taskStatus!=="repeat"||a("edit",{taskId:L.taskId,batchId:w.value},L)},I=()=>{if(y.value.length<=0){showToast({type:"text",message:"请先选择发票"});return}showConfirmDialog({title:"提醒",message:"请确认是否需要移除选中项,移除后不可恢复!"}).then(async()=>{var L=new URLSearchParams;L.append("batchId",w.value);const B=y.value.join(",");L.append("taskIds",B),(await __deleteInvoice(L,v.value)).code===200&&(showToast({type:"success",message:"移除成功"}),x())}).catch(()=>{})},k=()=>{e.value=!0},T=async L=>{let B;L===1?B=await selectPhoto(u):B=await takePhoto(),B.append("batchId",w.value),p.value=!0,e.value=!1;try{(await __uploadInvoice(B)).code===200&&(showToast({type:"success",message:"上传成功"}),S())}catch(j){console.log(j),S()}p.value=!1},$=vue.computed(()=>{const L=g.value.filter(B=>B.selected).every(B=>(console.log(B),B.invoiceStatus==="unused"&&(B.taskStatus==="ocr_success"||B.taskStatus==="repeat"||B.taskStatus==="finish")));return console.log(L&&g.value.filter(B=>B.selected).length>0),L&&g.value.filter(B=>B.selected).length>0}),D=()=>{if(y.value.length<=0){showToast({type:"text",message:"请先选择发票"});return}const L=g.value.filter(B=>B.selected);console.log(L),a("ok",L)};vue.ref(null);const S=()=>{x().then(L=>{L.some(j=>j.taskStatus==="ocr_doing"||j.taskStatus==="ocr_success")&&setTimeout(S,2e3)}).catch(L=>{setTimeout(S,2e3)})};return vue.onMounted(()=>{S()}),(L,B)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",_hoisted_1$2,[vue.createElementVNode("div",_hoisted_2$1,[vue.createElementVNode("ul",null,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(g.value,(j,z)=>(vue.openBlock(),vue.createElementBlock("li",{key:z,onClick:R=>E(j)},[vue.createElementVNode("div",_hoisted_4$1,[j.taskStatus==="finish"||j.taskStatus==="repeat"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_5$1,[vue.createElementVNode("div",{class:vue.normalizeClass(["title",{person:j.invoiceCompanyType==="公司"}])},vue.toDisplayString(j.invoiceCompanyType),3),vue.createElementVNode("div",_hoisted_6$1,[vue.createElementVNode("div",_hoisted_7$1,[vue.createElementVNode("div",_hoisted_8$1,vue.toDisplayString(j.sellerName),1),j.taskStatus==="repeat"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_9," 重复录入 ")):vue.createCommentVNode("",!0)]),vue.createElementVNode("div",_hoisted_10,[vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(setClass)(j.realStatus))},vue.toDisplayString(vue.unref(const_realStatus)[j.realStatus]),3),vue.createElementVNode("span",{class:vue.normalizeClass(vue.unref(setClass)(j.invoiceStatus))},vue.toDisplayString(vue.unref(const_invoiceStatus)[j.invoiceStatus]),3)]),vue.createElementVNode("div",_hoisted_11,[vue.createElementVNode("div",_hoisted_12,[vue.createElementVNode("div",_hoisted_13,[_hoisted_14,vue.createElementVNode("span",_hoisted_15,"¥"+vue.toDisplayString(j.priceTaxTotalFigure||j.noTaxAmountTotal),1)]),vue.createElementVNode("div",_hoisted_16,[_hoisted_17,vue.createElementVNode("span",_hoisted_18,vue.toDisplayString(j.payerName),1)]),vue.createElementVNode("div",_hoisted_19,[_hoisted_20,vue.createElementVNode("span",_hoisted_21,vue.toDisplayString(j.description),1)]),vue.createElementVNode("div",_hoisted_22,[_hoisted_23,vue.createElementVNode("span",_hoisted_24,vue.toDisplayString(j.invoiceDate),1)])]),vue.createElementVNode("div",_hoisted_25,[vue.createVNode(vue.unref(Checkbox),{onClick:B[0]||(B[0]=vue.withModifiers(()=>{},["stop"])),modelValue:j.selected,"onUpdate:modelValue":R=>j.selected=R,"icon-size":"22px"},null,8,["modelValue","onUpdate:modelValue"])])])])])):j.taskStatus==="ocr_doing"||j.taskStatus==="ocr_success"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_26,[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_27,[vue.createElementVNode("div",_hoisted_28,[vue.createElementVNode("img",{src:j.fileUrlKey,alt:""},null,8,_hoisted_29)]),vue.createElementVNode("div",_hoisted_30,[_hoisted_31,vue.createElementVNode("div",_hoisted_32,[_hoisted_33,vue.createElementVNode("div",null,[vue.createVNode(vue.unref(Checkbox),{onClick:B[1]||(B[1]=vue.withModifiers(()=>{},["stop"])),modelValue:j.selected,"onUpdate:modelValue":R=>j.selected=R,"icon-size":"22px"},null,8,["modelValue","onUpdate:modelValue"])])])])]))])],8,_hoisted_3$1))),128))])]),vue.createElementVNode("div",_hoisted_34,[vue.createElementVNode("div",_hoisted_35,[vue.createElementVNode("div",{class:"delete"},[vue.createElementVNode("span",{onClick:I},"移除")]),vue.createElementVNode("div",_hoisted_36,[vue.createElementVNode("span",{class:"add",onClick:k},"继续添加发票"),vue.createElementVNode("span",{class:vue.normalizeClass(["ok",{disabledColor:!$.value}]),onClick:D},"确定选择",2)])])])]),vue.createVNode(vue.unref(Popup),{show:e.value,"onUpdate:show":B[4]||(B[4]=j=>e.value=j),position:"bottom",closeable:""},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_37,[_hoisted_38,vue.createElementVNode("div",{style:{"padding-bottom":"24px"},onClick:B[2]||(B[2]=j=>T(1))},"从相册中选择"),vue.createElementVNode("div",{onClick:B[3]||(B[3]=j=>T(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_39c18419_lang="",InvoiceList=_export_sfc(_sfc_main$2,[["__scopeId","data-v-39c18419"]]),_withScopeId=n=>(vue.pushScopeId("data-v-54509002"),n=n(),vue.popScopeId(),n),_hoisted_1$1={class:"PaymentMode"},_hoisted_2=_withScopeId(()=>vue.createElementVNode("div",{class:"title"},"选择识别方式",-1)),_hoisted_3={class:"list"},_hoisted_4=["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"],emits:["uploadSuccess"],setup(n,{emit:a}){const{multiple:o}=n,u=[{text:"拍照",leftIcon:"icon-xiangji"},{text:"相册",leftIcon:"icon-xiangce"}];document.title="请选择添加费用方式";const v=vue.ref(!1),p=async e=>{let g;e=="拍照"&&(g=await takePhoto()),e=="相册"&&(g=await selectPhoto(o)),v.value=!0;try{const w=await __uploadInvoice(g);console.log(w),w.code===200&&(showToast({type:"success",message:"上传成功"}),a("uploadSuccess",w.data))}catch(w){console.log(w),showFailToast("上传失败")}v.value=!1};return(e,g)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",_hoisted_1$1,[_hoisted_2,vue.createElementVNode("div",_hoisted_3,[(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,vue.renderList(u,(w,y)=>vue.createElementVNode("div",{class:"method-item",onClick:x=>p(w.text),key:w.id||y},[vue.createElementVNode("div",_hoisted_5,[vue.createElementVNode("span",_hoisted_6,[vue.createElementVNode("i",{class:vue.normalizeClass(["iconfont",w.leftIcon])},null,2)]),vue.createElementVNode("span",_hoisted_7,vue.toDisplayString(w.text),1)]),_hoisted_8],8,_hoisted_4)),64))])]),vue.createVNode(vue.unref(Overlay),{style:{display:"flex","justify-content":"center","align-items":"center"},show:v.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_54509002_lang="",PaymentMode=_export_sfc(_sfc_main$1,[["__scopeId","data-v-54509002"]]);function getUrlParams(n){const a={},o=n.split("?")[1];return o&&o.split("&").forEach(v=>{const[p,e]=v.split("=");a[p]=decodeURIComponent(e)}),a}var vconsole_min={exports:{}};/*!
|
|
24
24
|
* vConsole v3.15.1 (https://github.com/Tencent/vConsole)
|
|
25
25
|
*
|
|
26
26
|
* Tencent is pleased to support the open source community by making vConsole available.
|