import{a2 as e,e as a,r as t,f as n,g as i,o as s,h as o,w as r,a as l,i as d,j as c,t as p,N as u,a7 as m,y as _,z as f,a8 as g,d as x,a9 as y,K as h,x as b,aa as v,J as j,m as k,aq as T}from"./index-Dnh6GPlT.js";import{d as I}from"./index.C9RyZqIW.js";import{i as w}from"./invoiceList.kEs151sJ.js";import{c as C}from"./customerTab.DSkSeei-.js";import{g as D}from"./index.pjiugiR4.js";import{_ as z}from"./uni-datetime-picker.BvABLVwC.js";import{a as N}from"./finance.b3zRqUNk.js";import{i as E}from"./invoiceExamine.DtDaeSs9.js";import{_ as R}from"./_plugin-vue_export-helper.BCo6x5W8.js";import"./uni-nav-bar.Bf2crVgQ.js";import"./uni-icons.C_vWVLAq.js";/* empty css *//* empty css *//* empty css */import"./uni-row.C8l4_QpR.js";import"./uni-dateformat.C-BKL-OF.js";import"./uni-list.Y9x-0uJ_.js";import"./uni-badge.B-SCmJj5.js";import"./index.ZMpzRqor.js";/* empty css */import"./uni-datetime-picker.vue_vue_type_style_index_0_scoped_6f474695_lang.CKy4NM-m.js";import"./uni-forms.DIiVZ_NN.js";import"./uni-forms.vue_vue_type_style_index_0_scoped_a2a9907e_lang.DijPs27m.js";import"./uni-easyinput.B9QjCcys.js";/* empty css */import"./uni-popup.LDlA9brl.js";import"./uni-popup.vue_vue_type_style_index_0_scoped_90b62717_lang.B5-y41yX.js";import"./file.Clzwct6P.js";const $={__name:"formBox",props:{type:{type:String,default:"center"},status:{type:Number,default:-2}},emits:["change"],setup(x,{emit:y}){const h=x,{type:b,status:v}=e(h),j=a({typeText:"发票类型",timeText:"申请日期",payTime:"开票日期",labelText:"审核状态",typeIndex:0}),k=a({time:"",date:"",status:"",type:""}),T=t(null),I=t(null);let w=y;const C=a([{name:"所有类型",id:""},{name:"个人普通发票",id:1},{name:"企业普通发票",id:2},{name:"企业专用发票",id:3}]),D=a([{name:"所有状态",id:""},{name:"待开票",id:1},{name:"已开票",id:5},{name:"申请作废",id:4},{name:"已作废",id:-1}]),N=e=>{const a=e.detail.value;j.typeText=C[a].name,k.type=C[a].id,""===k.type&&(j.typeText="所有类型"),w("change",k)},E=e=>{const a=e.detail.value;j.labelText=D[a].name,k.status=D[a].id,""===k.status&&(j.labelText="审核状态"),w("change",k)},R=e=>{1===e?I.value.clear():T.value.clear(),w("change",k)},$=e=>{const a=J(e);j.payTime=a.text?a.text:"开票时间",k.date=a.time,w("change",k)},H=e=>{const a=J(e);j.timeText=a.text?a.text:"申请时间",k.time=a.time,w("change",k)},J=e=>{let a={};return e.length>0?(a.time=e[0].replace(/-/g,"/")+"-"+e[1].replace(/-/g,"/"),a.text=e[0].substring(5).replace("-","/")+"-"+e[1].substring(5).replace("-","/")):(a.time="",a.text=""),a};return(e,a)=>{const t=_,x=f,y=g,h=n(i("uni-datetime-picker"),z);return s(),o(x,{class:"cr-search-content plr10"},{default:r((()=>[1!==l(v)?(s(),o(y,{key:0,class:"picker-selector",mode:"selector",onChange:E,range:l(D),"range-key":"name"},{default:r((()=>[d(x,{class:"search-default-label"},{default:r((()=>[c(p(l(j).labelText)+" ",1),d(t,{class:"iconfont icon-zhankai1"})])),_:1})])),_:1},8,["range"])):u("",!0),d(y,{class:"picker-selector",mode:"selector",onChange:N,value:l(j).typeIndex,range:l(C),"range-key":"name"},{default:r((()=>[d(x,{class:"search-default-label"},{default:r((()=>[d(x,{class:"line1-1"},{default:r((()=>[c(p(l(j).typeText),1)])),_:1}),d(t,{class:"iconfont icon-zhankai1"})])),_:1})])),_:1},8,["value","range"]),d(h,{ref_key:"payTimeRef",ref:I,type:"daterange","clear-icon":!1,border:!1,onChange:$},{default:r((()=>[d(x,{class:"search-default-date"},{default:r((()=>[c(p(l(j).payTime)+" ",1),l(k).date?u("",!0):(s(),o(t,{key:0,class:"date-open-icon iconfont icon-zhankai1"}))])),_:1}),l(k).date?(s(),o(t,{key:0,class:"iconfont date-clear icon-shenpizhongxin-jujue",onClick:a[0]||(a[0]=m((e=>R(1)),["stop"]))})):u("",!0)])),_:1},512),d(h,{ref_key:"timeRef",ref:T,type:"daterange","clear-icon":!1,border:!1,onChange:H},{default:r((()=>[d(x,{class:"search-default-date"},{default:r((()=>[c(p(l(j).timeText)+" ",1),l(k).time?u("",!0):(s(),o(t,{key:0,class:"date-open-icon iconfont icon-zhankai1"}))])),_:1}),l(k).time?(s(),o(t,{key:0,class:"iconfont date-clear icon-shenpizhongxin-jujue",onClick:a[1]||(a[1]=m((e=>R(2)),["stop"]))})):u("",!0)])),_:1},512)])),_:1})}}},H=R(x({__name:"index",setup(e){const n=a({typeIndex:0,tabIndex:0,tabId:1,emptyTitle:"当前暂无发票~",customStyle:{border:"none",lineHeight:"20px",background:"#ED4014"},examineTabData:[{name:"待开发票",id:1},{name:"开票记录",id:2}],listData:[],config:{},where:{way:"",page:1,limit:10,status:1,time:"",name:"",invoiced:"",from:1,date:"",salesman_name:"",types:""}});y((e=>{if(e.tab){n.tabIndex=Number(e.tab);const a=n.examineTabData[n.tabIndex];n.tabId=a.id,n.where.status=1===n.tabId?1:"",g(!0)}else g()}));const i=a([{type:1,icon:"icon-sousuo"}]),l=()=>{k(`/pages/finance/invoice/search?index=${n.tabIndex}`)},c=t(null),p=e=>{n.config=e,c.value.popupOpen()},u=()=>{g(!0)},m=e=>{if(n.tabId===e.id)return!1;n.where.page>1&&T(),n.tabId=e.id,n.tabIndex=e.index,n.where.status=1===n.tabId?1:"",g(!0)},_=e=>{n.where.status=1===n.tabId?1:e.status,n.where.types=e.type,n.where.time=e.time,n.where.date=e.date,g(!0)},g=(e=!1)=>{n.where.page=1,z(e)},x=t(!1),z=(e=!1)=>{N(n.where).then((a=>{e&&(n.listData=[]),n.listData.push(...a.data.list);const t=Math.ceil(a.data.count/n.where.limit);x.value=!(n.listData.length<=0||n.where.page>=t),h()})).catch((e=>{b.error(e.message)}))};return v((()=>{x.value&&(n.where.page++,z())})),j((()=>{n.where.page=1,n.listData=[],z()})),(e,a)=>{const t=f;return s(),o(t,{class:"content"},{default:r((()=>[d(t,{class:"cr-position-header"},{default:r((()=>[d(t,{class:"status_bar"}),d(I,{"jump-url":"/pages/workbench/index","is-right":!0,"right-data":i,onHandleNarItem:l},null,8,["right-data"]),d(C,{"examine-tab-data":n.examineTabData,index:n.tabIndex,onChange:m},null,8,["examine-tab-data","index"]),d($,{onChange:_,status:n.tabId,type:"approve"},null,8,["status"])])),_:1}),d(t,{class:"examine-content m10"},{default:r((()=>[d(w,{"list-data":n.listData,"empty-title":n.emptyTitle,"is-finance":!0,tab:n.tabIndex,onChange:p},null,8,["list-data","empty-title","tab"])])),_:1}),d(D),d(E,{ref_key:"invoiceExamineRef",ref:c,"config-data":n.config,onChange:u},null,8,["config-data"])])),_:1})}}}),[["__scopeId","data-v-47f9ab07"]]);export{H as default};