add-edit-form.1452ecae.js 6.7 KB

1
  1. import{_ as Q,d as X,n as $,W as ee,w as c,aO as ue,aP as T,Z as le,x as ae,r as p,aC as oe,o as m,c as C,H as te,u as D,G as f,C as o,l,F as g,D as k,a as ne,b as R,M as re,aR as ie,y as se,aY as v}from"./index.88f7d256.js";import{convertInvoiceTitleData as z,convertInvoiceTitle as U}from"./columns.46bdf7aa.js";import{h as L}from"./index.e10227e5.js";import{g as me}from"./index.3cc65789.js";import de from"./choose-form.b8932547.js";import M from"./invoice-title.731c68e9.js";import{A as pe}from"./configs.8289f3c3.js";import{f as ce}from"./status.2df4810d.js";import"./index.9fa951c4.js";import"./index.69815c3e.js";import"./basic-descriptions.5c20357d.js";import"./orderRecord.c9c18fd5.js";import"./tootip.514b092e.js";import"./porder.b626a198.js";import"./calc.850c7422.js";import"./choose-modal.9bcf68e9.js";import"./date-range.b361462b.js";const ve={class:"addEditForm"},fe={"w-full":""},_e={class:"flex justify-end w-full"},ye=X({__name:"add-edit-form",setup(Ce){const{push:O}=$(),{companyList:V,currentCompany:H}=ee(),_=c(null),N=c(null),B=ue(),F=T(!1),P=T(0),S={buyer:"",email:"",remark:"",invtype:"",companyNo:"",exam_remark:"",companyType:"01",platform_type:"",orderArr:[]},x=c([]),a=c({...S}),A=le({...pe});function G(){const{invtype:t}=a.value;A.email[0].required=t==="special_electronic"||t==="electronic"||t==="fully_digitalized_special_electronic"||t==="fully_digitalized_normal_electronic"}const y=c({}),E=c({});function I(t,e){if(!e)return t?y.value={}:E.value={};if(t){const{invoiceType:r,denomination:i}=e;P.value=Number(i)*1e4;const n=r.split(",");a.value.invtype="",x.value=ce.filter(({value:s})=>n.includes(s))}t?y.value=z(U(e)):E.value=z(U(e))}const j=I.bind(null,!0),q=I.bind(null,!1);async function W(t,e=!0){a.value[e?"companyNo":"buyer"]=t;const{code:r,data:i,message:n}=await L({companyNo:t});se(()=>{_.value&&_.value.validateField("companyNo")}),B({code:r,message:n,handler:()=>j(i.list[0])})}async function Y({companyNo:t,companyName:e}){a.value.buyer=e;const{code:r,data:i,message:n}=await L({noRela:!0,size:1e3});B({code:r,message:n,handler:()=>{const s=i.list.find(({companyNo:d})=>d===t);q(s||{})}})}async function Z(){var t;try{const{data:e,orderArr:r,totalCommonPrice:i,totalCommonCount:n}=((t=N.value)==null?void 0:t.getOpenInvInfo())||{},{winv_fee:s,payNo:d}=e;if(await _.value.validate(),!d){v.warning("\u8BF7\u9009\u62E9\u5BF9\u8D26\u5355");return}if(r.length===0){v.warning("\u8BF7\u81F3\u5C11\u9009\u4E2D\u4E00\u4E2A\u8BA2\u5355");return}if(Number(i)>Number(s)){v.warning("\u5F00\u7968\u603B\u91D1\u989D\u4E0D\u80FD\u5927\u4E8E\u672A\u5F00\u7968\u91D1\u989D");return}if(a.value.invtype==="fully_digitalized_special_electronic"||a.value.invtype==="fully_digitalized_normal_electronic"){if(Number(i)>1e3*1e4)return v.error("\u8BA2\u5355\u603B\u91D1\u989D\u4E0D\u80FD\u8D85\u8FC71000\u4E07")}else if(Number(i)>Number(y.value.denomination.split("\u4E07\u5143")[0]*1e4)){v.warning("\u5F00\u7968\u603B\u91D1\u989D\u4E0D\u80FD\u8D85\u8FC7\u9500\u552E\u65B9\u516C\u53F8\u5F00\u7968\u6700\u5927\u9762\u989D");return}if(n>150){v.warning("\u9009\u62E9\u7684\u901A\u7528\u8BA2\u5355\u4E0D\u80FD\u8D85\u8FC7150\u4E2A");return}const{invtype:w,email:b,remark:h,exam_remark:u}=a.value;F.value=!0;const{code:J,message:K}=await me({email:b,payNo:d,remark:h,invtype:w,orderArr:r,exam_remark:u});F.value=!1,B({code:J,message:K,handler:()=>O("/InvoiceSales/invoiceApply")})}catch(e){const{warn:r}=console;r(e)}}return ae(()=>W(H.value.companyNo)),(t,e)=>{const r=p("el-option"),i=p("el-select"),n=p("el-form-item"),s=p("el-col"),d=p("el-input"),w=p("ElButton"),b=p("el-row"),h=oe("loading");return m(),C("div",ve,[te((m(),f(D(ie),{model:a.value,rules:A,ref_key:"formRef",ref:_,"status-icon":"",size:"small"},{default:o(()=>[l(b,{gutter:"10"},{default:o(()=>[l(s,{span:12},{default:o(()=>[l(n,{label:"\u9500\u552E\u65B9\u516C\u53F8\u62AC\u5934",prop:"companyNo"},{default:o(()=>[l(i,{disabled:"",style:{width:"100%"},placeholder:"\u9500\u552E\u65B9\u516C\u53F8\u62AC\u5934",modelValue:a.value.companyNo,"onUpdate:modelValue":e[0]||(e[0]=u=>a.value.companyNo=u)},{default:o(()=>[(m(!0),C(g,null,k(D(V),u=>(m(),f(r,{key:u.companyCode,value:u.companyCode,label:u.companyName},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(M,{detail:y.value},null,8,["detail"])]),_:1}),l(s,{span:12},{default:o(()=>[l(n,{label:"\u8D2D\u4E70\u65B9\u516C\u53F8\u62AC\u5934",prop:"companyNo"},{default:o(()=>[l(i,{style:{width:"100%"},placeholder:"\u8D2D\u4E70\u65B9\u516C\u53F8\u62AC\u5934",disabled:"",modelValue:a.value.buyer,"onUpdate:modelValue":e[1]||(e[1]=u=>a.value.buyer=u)},{default:o(()=>[(m(!0),C(g,null,k(D(V),u=>(m(),f(r,{key:u.companyCode,value:u.companyCode,label:u.companyName},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1}),a.value.buyer?(m(),f(M,{key:0,detail:E.value},null,8,["detail"])):ne("v-if",!0)]),_:1}),l(s,{span:6},{default:o(()=>[l(n,{label:"\u53D1\u7968\u7C7B\u578B",prop:"invtype"},{default:o(()=>[l(i,{modelValue:a.value.invtype,"onUpdate:modelValue":e[2]||(e[2]=u=>a.value.invtype=u),style:{width:"100%"},onChange:G,"no-data-text":"\u8BF7\u9009\u62E9\u5176\u4ED6\u9500\u552E\u65B9\u516C\u53F8",placeholder:"\u53D1\u7968\u7C7B\u578B"},{default:o(()=>[(m(!0),C(g,null,k(x.value,u=>(m(),f(r,{key:u.value,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),l(n,{label:"\u7535\u5B50\u90AE\u7BB1",prop:"email"},{default:o(()=>[l(d,{modelValue:a.value.email,"onUpdate:modelValue":e[3]||(e[3]=u=>a.value.email=u),placeholder:"\u7535\u5B50\u90AE\u7BB1"},null,8,["modelValue"])]),_:1})]),_:1}),l(s,{span:18},{default:o(()=>[l(n,{label:"\u7533\u8BF7\u5907\u6CE8",prop:"exam_remark"},{default:o(()=>[l(d,{"w-full":"",modelValue:a.value.exam_remark,"onUpdate:modelValue":e[4]||(e[4]=u=>a.value.exam_remark=u),rows:5,type:"textarea",maxlength:"2000",placeholder:"\u7533\u8BF7\u5907\u6CE8","show-word-limit":""},null,8,["modelValue"])]),_:1})]),_:1}),l(s,{span:24},{default:o(()=>[l(n,{label:"\u53D1\u7968\u5907\u6CE8",prop:"remark"},{default:o(()=>[R("div",fe,[l(d,{"w-full":"",modelValue:a.value.remark,"onUpdate:modelValue":e[5]||(e[5]=u=>a.value.remark=u),rows:3,type:"textarea",maxlength:"2000","show-word-limit":"",placeholder:"\u53D1\u7968\u5907\u6CE8"},null,8,["modelValue"])])]),_:1})]),_:1}),l(s,{span:24},{default:o(()=>[l(n,{label:"\u8BA2\u5355\u5BF9\u8D26"},{default:o(()=>[l(de,{ref_key:"chooseFormRef",ref:N,onGetBuyer:e[6]||(e[6]=u=>Y(u)),platformType:a.value.platform_type},null,8,["platformType"])]),_:1})]),_:1}),R("div",_e,[l(w,{type:"primary",size:"",onClick:Z},{default:o(()=>[re("\u4FDD\u5B58")]),_:1})])]),_:1})]),_:1},8,["model","rules"])),[[h,D(F)]])])}}});var Ue=Q(ye,[["__scopeId","data-v-21656682"],["__file","D:/work/accout-vue3-ui2/settle-vue3/src/views/InvoiceSales/invoiceApply/components/currentcy-form/add-edit-form.vue"]]);export{Ue as default};