import{_ as X,d as J,n as f,k as K,aa as Q,di as q,cm as g,r as s,aw as Y,B as T,i as o,o as n,c as N,h as u,y as l,A as m,a as b,e as y,H as B,F as Z,z as ee,d6 as te,G as le}from"./index.js";import{o as ae,a as oe,S as ue}from"./sales-modal.953ca2.js";import{I as se}from"./global.9ad647c8.js";import ne from"./index.bf23e4.js";import{h as re,a as de}from"./index.afe5f4bc.js";import{F as ie}from"./index.7f6a2162.js";const pe={class:"flex flex-col"},fe={class:"flex flex-col w-full"},me={class:"flex w-full justify-end mb-[10px]"},ce={key:0,flex:"","justify-end":"","mt-3":""},ve=J({__name:"index",props:{readonly:{type:Boolean,required:!1}},emits:["create-btn-click"],setup(M,{emit:_e}){const P=M,D=f(!1),j=K(),E=Q(()=>!P.readonly),d=f([]),c=f({tradNo:"",orderArr:[]}),x=f(!1),C=q({success(){x.value?(g.success("\u65B0\u5EFA\u6210\u529F"),c.value={tradNo:"",orderArr:[]},d.value=[],r.value={},i.data=null):(g.success("\u65B0\u5EFA\u6210\u529F"),j.push("/InvoiceSales/capitalPool"))}}),z={tradNo:[{required:!0,message:"\u8BF7\u9009\u62E9\u8D44\u91D1",trigger:"change"}],orderArr:[{required:!0,message:"\u8BF7\u9009\u62E9\u5173\u8054\u8BA2\u5355"}]},i=q({initialData:null}),r=f({}),A=f(null);function R(a){a.forEach(e=>{const{sequenceNo:v,wpay_fee:p}=e;r.value[v]||(r.value[v]=p,d.value.push(e))})}function h(a){x.value=a;const e=[];if(Object.keys(r.value).forEach(_=>e.push({sequenceNo:_,trad_fee:r.value[_]})),e.length===0)return g.error("\u8BF7\u6DFB\u52A0\u5173\u8054\u8BA2\u5355");const p={tradNo:c.value.tradNo,orderArr:e};C.run(re(p))}function U(a){delete r.value[a],d.value=d.value.filter(e=>e.sequenceNo!==a)}function $(a={}){i.run(de({tradNo:a.tradNo})),c.value.tradNo=a.tradNo,d.value=[]}return(a,e)=>{const v=s("ElInput"),p=s("ElFormItem"),_=s("el-button"),L=s("el-input"),O=s("el-tag"),w=s("el-table-column"),G=s("el-table"),H=s("ElForm"),I=s("ElButton"),S=Y("loading");return T((n(),N("div",pe,[u(H,{model:c.value,rules:z},{default:l(()=>[T((n(),m(p,{label:"\u8D44\u91D1\u7F16\u53F7",prop:"tradNo"},{default:l(()=>[u(v,{class:"mb-[10px]",modelValue:c.value.tradNo,onClick:e[0]||(e[0]=t=>D.value=!0),placeholder:"\u8D44\u91D1\u7F16\u53F7"},null,8,["modelValue"]),o(i).data?(n(),m(ie,{key:0,tradeInfo:o(i).data},null,8,["tradeInfo"])):b("v-if",!0)]),_:1})),[[S,o(i).loading]]),u(p,null,{label:l(()=>e[5]||(e[5]=[y("div",{class:"flex"},[y("span",{style:{color:"#f56c6c"}},"*"),y("div",{style:{"margin-left":"3px","font-weight":"600"}},"\u5173\u8054\u8BA2\u5355")],-1)])),default:l(()=>[y("div",fe,[y("div",me,[E.value?(n(),m(_,{key:0,style:{width:"40px"},type:"primary",size:"small",onClick:e[1]||(e[1]=()=>A.value.onDisplay(o(d.value)))},{default:l(()=>e[6]||(e[6]=[B(" \u6DFB\u52A0 ")])),_:1})):b("v-if",!0)]),u(G,{data:d.value,size:"small",border:"",prop:"orderArr"},{default:l(()=>[(n(!0),N(Z,null,ee(o(ae),(t,V)=>(n(),m(w,{key:V,label:t.label,prop:t.prop,width:t.width,"show-overflow-tooltip":""},{default:l(({row:F})=>[t.label==="\u6B64\u6B21\u8BA4\u9886"?(n(),m(L,te({key:0,size:"small",placeholder:"\u6B64\u6B21\u8BA4\u9886\u91D1\u989D",modelValue:r.value[F.sequenceNo],"onUpdate:modelValue":k=>r.value[F.sequenceNo]=k,ref_for:!0},o(se)),null,16,["modelValue","onUpdate:modelValue"])):t.prop==="status"?(n(),m(O,{key:1},{default:l(()=>{var k;return[B(le((k=o(oe).find(W=>String(F.status)===W.value))==null?void 0:k.label),1)]}),_:2},1024)):b("v-if",!0)]),_:2},1032,["label","prop","width"]))),128)),u(w,{label:"\u64CD\u4F5C",fixed:"right"},{default:l(({row:t})=>[u(_,{type:"danger",link:"",onClick:V=>U(t.sequenceNo)},{default:l(()=>e[7]||(e[7]=[B(" \u5220\u9664 ")])),_:2},1032,["onClick"])]),_:1})]),_:1},8,["data"])])]),_:1})]),_:1},8,["model"]),E.value?(n(),N("div",ce,[u(I,{onClick:e[2]||(e[2]=t=>h(!1))},{default:l(()=>e[8]||(e[8]=[B(" \u4FDD\u5B58\u5E76\u8FD4\u56DE ")])),_:1}),u(I,{type:"primary",onClick:e[3]||(e[3]=t=>h(!0))},{default:l(()=>e[9]||(e[9]=[B(" \u4EC5\u4FDD\u5B58 ")])),_:1})])):b("v-if",!0),u(ue,{isCommon:o(i).data&&o(i).data.trade_type=="1",ref_key:"saleModalRef",ref:A,onSaveClickButton:R},null,8,["isCommon"]),u(ne,{visible:D.value,"onUpdate:visible":e[4]||(e[4]=t=>D.value=t),onSubmit:$},null,8,["visible"])])),[[S,o(C).loading]])}}});var ge=X(ve,[["__file","D:/work/jiesuan/settle-vue3/src/views/InvoiceSales/capitalPool/base-form/index.vue"]]);export{ge as default};
