import{ac as d,aY as h,aN as v,aM as I,_ as M,d as R,w as F,n as S,W as j,a7 as K,aX as U,az as Y,r as N,at as H,H as $,l as e,o as B,G as V,C as a,j as u,aT as c,aL as f,b6 as G,a as y,c as L,a$ as J,aR as T,J as Q,aO as W,M as k,L as z,aP as X,aQ as x,h as q,aK as Z}from"./index.js";import{b as ee}from"./index.01c9e0ad.js";import{c as ue,r as le}from"./shared.80186348.js";import ae from"./index.bb93f8.js";import{B as te}from"./basic-descriptions.fb5b2628.js";import{c as w}from"./status.4e0ebdbc.js";import{h as se}from"./index.4344e637.js";const oe=[{span:12,field:"seller_name",label:"\u9500\u552E\u65B9\u516C\u53F8"},{span:12,field:"buyer_name",label:"\u8D2D\u4E70\u65B9\u516C\u53F8"},{span:12,field:"goodName",label:"\u8BA2\u5355\u5546\u54C1\u540D\u79F0"},{span:12,field:"inv_good_name",label:"\u53D1\u7968\u5546\u54C1\u540D\u79F0"},{span:6,label:"\u5546\u54C1\u7C7B\u578B",render(E,{good_type:t}){return d(h,{size:"small"},{default:()=>{var o;return((o=w.find(s=>s.value==t))==null?void 0:o.label)||"--"}})}},{span:6,field:"good_code",label:"\u5546\u54C1\u4EE3\u7801"},{span:6,field:"spec",label:"\u89C4\u683C"},{span:6,field:"unit",label:"\u5355\u4F4D"},{span:6,field:"unit_price",label:"\u7A0E\u524D\u5355\u4EF7"},{span:6,field:"subunit_price",label:"\u7A0E\u540E\u5355\u4EF7"},{span:6,field:"unit_weight",label:"\u91CD\u91CF"},{span:6,field:"spectral",label:"\u5206\u5149"},{field:"cat_name",label:"\u8FDB\u9879\u7C7B\u76EE",span:24}],ve=[{span:12,field:"seller_name",label:"\u9500\u552E\u65B9\u516C\u53F8"},{span:12,field:"buyer_name",label:"\u8D2D\u4E70\u65B9\u516C\u53F8"},{span:12,field:"goodName",label:"\u8BA2\u5355\u5546\u54C1\u540D\u79F0"},{span:12,field:"inv_good_name",label:"\u53D1\u7968\u5546\u54C1\u540D\u79F0"},{span:6,label:"\u5546\u54C1\u7C7B\u578B",render(E,{good_type:t}){return d(h,{size:"small"},{default:()=>{var o;return((o=w.find(s=>s.value==t))==null?void 0:o.label)||"--"}})}},{span:6,field:"good_code",label:"\u5546\u54C1\u4EE3\u7801"},{span:6,field:"spec",label:"\u89C4\u683C"},{span:6,field:"unit",label:"\u5355\u4F4D"},{span:6,field:"unit_price",label:"\u7A0E\u524D\u5355\u4EF7"},{span:6,field:"subunit_price",label:"\u7A0E\u540E\u5355\u4EF7"},{span:6,field:"unit_weight",label:"\u91CD\u91CF"},{span:6,field:"spectral",label:"\u5206\u5149"},{field:"cat_name",label:"\u8FDB\u9879\u7C7B\u76EE",span:24},{label:"\u5B50\u5546\u54C1",span:24,render(E,{ProductsCombind:t=[]}){return d(I,{size:"small",data:t,border:!0},{default:()=>[d(v,{label:"\u6BD4\u4F8B",prop:"child_num",width:100,showOverflowTooltip:!0}),d(v,{label:"\u5546\u54C1\u7F16\u53F7",showOverflowTooltip:!0},{default:o=>{var s;return(s=o.row.products)==null?void 0:s.skuCode}}),d(v,{label:"\u5546\u54C1\u7C7B\u578B",showOverflowTooltip:!0},{default:o=>d(h,{size:"small"},{default:()=>{var s;return((s=w.find(m=>{var p;return m.value==((p=o.row.products)==null?void 0:p.good_type)}))==null?void 0:s.label)||"--"}})}),d(v,{label:"\u5546\u54C1\u540D\u79F0"},{default:o=>{var s;return(s=o.row.products)==null?void 0:s.goodName}})]})}}],ne={key:1,class:"flex items-start"},ie={class:"w-full flex justify-end"},re=R({__name:"BaseForm",setup(E){const t=F(null),o=i=>{const l=new Date;return i.getTime()>l.setHours(0,0,0,0)},s=S(),m=F(null),p=j({editVisible:!1,visible:!1,companies:[],index:-1,data:{}}),D=K(()=>{var _,b,C;const i=(((_=t.value)==null?void 0:_.residue_stock)-Number(n.value.check_num)||0)*-1,l=i*((b=t.value)==null?void 0:b.subunit_price)||0;return Number(l)===0&&n.value.check_type=="2"&&(n.value.check_type=""),{ykNum:i,yKPrice:i*((C=t.value)==null?void 0:C.subunit_price)||0}}),n=F(ue()),g=U({success(){Y.success("\u521B\u5EFA\u6210\u529F!"),s.push("/invoiceInOut/inventoryCheck")}});async function A(){var i;try{await((i=m.value)==null?void 0:i.validate()),g.run(se(n.value))}catch{}}function O(i){t.value=i[0],n.value.product_id=i[0].id}function P(){t.value=null,n.value.product_id=""}return async function(){const l=await ee({size:1e4});l.code==0&&(p.companies=[...l.data.list])}(),(i,l)=>{const _=N("ElDatePicker"),b=N("ElRow"),C=H("loading");return $((B(),V(e(Z),{ref_key:"formRef",ref:m,rules:e(le),model:n.value,"label-width":"140px"},{default:a(()=>[u(b,null,{default:a(()=>[u(e(c),{span:24},{default:a(()=>[u(e(f),{label:"\u5546\u54C1\u4FE1\u606F",prop:"product_id"},{default:a(()=>[t.value?y("v-if",!0):(B(),V(e(G),{key:0,placeholder:"\u5546\u54C1\u4FE1\u606F",onClick:l[0]||(l[0]=r=>p.visible=!0)})),t.value?(B(),L("div",ne,[u(e(te),{data:t.value,columns:e(oe)},null,8,["data","columns"]),u(e(J),{content:"\u91CD\u65B0\u9009\u62E9",placement:"top"},{default:a(()=>[u(e(T),{link:"",type:"info",icon:e(Q)("close-circle-line"),onClick:P},null,8,["icon"])]),_:1})])):y("v-if",!0)]),_:1})]),_:1}),u(e(c),{span:24},{default:a(()=>[u(e(f),{label:"\u76D8\u70B9\u6570\u91CF",prop:"check_num"},{default:a(()=>[u(e(W),{modelValue:n.value.check_num,"onUpdate:modelValue":l[1]||(l[1]=r=>n.value.check_num=r),placeholder:"\u76D8\u70B9\u6570\u91CF"},null,8,["modelValue"])]),_:1})]),_:1}),u(e(c),{span:24},{default:a(()=>[u(e(f),{label:"\u76C8\u4E8F\u6570\u91CF",prop:"ykNum"},{default:a(()=>[k(z(D.value.ykNum),1)]),_:1})]),_:1}),u(e(c),{span:24},{default:a(()=>[u(e(f),{label:"\u76C8\u4E8F\u91D1\u989D",prop:"ykPrice"},{default:a(()=>[y(" =(\u8D26\u9762\u6570\u91CF-\u76D8\u70B9\u6570\u91CF) * \u7A0E\u524D\u5355\u4EF7 "),k(" "+z(D.value.yKPrice),1)]),_:1})]),_:1}),u(e(c),{span:24},{default:a(()=>[u(e(f),{label:"\u7ED3\u679C\u7C7B\u578B",prop:"check_type"},{default:a(()=>[u(e(X),{modelValue:n.value.check_type,"onUpdate:modelValue":l[2]||(l[2]=r=>n.value.check_type=r),placeholder:"\u7ED3\u679C\u7C7B\u578B"},{default:a(()=>[u(e(x),{disabled:D.value.yKPrice==0,label:"\u8C03\u6574\u5355",value:"2"},null,8,["disabled"]),u(e(x),{label:"\u524D\u671F\u6570\u636E\u5BFC\u5165",value:"1"})]),_:1},8,["modelValue"])]),_:1})]),_:1}),u(e(c),{span:24},{default:a(()=>[u(e(f),{label:"\u8C03\u6574\u5355\u5165\u8D26\u6708\u4EFD",prop:"fz_date"},{default:a(()=>[u(_,{type:"month",placeholder:"\u5165\u8D26\u6708\u4EFD",modelValue:n.value.fz_date,"onUpdate:modelValue":l[3]||(l[3]=r=>n.value.fz_date=r),disabledDate:o,"value-format":"YYYY-MM"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),q("div",ie,[u(e(T),{type:"primary",onClick:A},{default:a(()=>l[5]||(l[5]=[k("\u4FDD\u5B58")])),_:1})]),u(ae,{visible:p.visible,"onUpdate:visible":l[4]||(l[4]=r=>p.visible=r),onSubmit:O},null,8,["visible"])]),_:1},8,["rules","model"])),[[C,e(g).loading]])}}});var de=M(re,[["__file","C:/Users/89793/Desktop/projects/ticket-system/src/views/invoiceInOut/inventoryCheck/components/BaseForm.vue"]]),Ee=Object.freeze(Object.defineProperty({__proto__:null,default:de},Symbol.toStringTag,{value:"Module"}));export{de as B,oe as a,Ee as b,ve as g};