import{u as I}from"./useInstance.233fbdde.js";import{az as p,d as P,a6 as $,s as O,r as E,p as B,b as V,c as n,e as m,k as b,i,h as a,u as l,f as R,j as T,F as j,m as C,t as z,A as M,a2 as G,E as H}from"./index.0308b213.js";const ee=d=>p.request({url:"addon/creditLimit.web.total_credit_limit/list",params:d}),J=d=>p.request({url:"addon/creditLimit.web.total_credit_limit/add",method:"POST",data:d}),K=()=>p.request({url:"addon/creditLimit.web.total_credit_limit/getStoreList"}),Q=d=>p.request({url:"addon/creditLimit.web.total_credit_limit/getCreditLimitInfo",params:d}),W=C("\u63D0\u4EA4"),X=C("\u53D6\u6D88"),te=P({props:{modelValue:{type:Boolean,default:!1},id:null},emits:["update:modelValue","onClose"],setup(d,{emit:k}){const r=d,{OpPlatform:L}=$(),{global:y}=I();let h=O(()=>Number(r.id)>0);const c=E(!1);B(()=>r.modelValue,u=>{c.value=u,u&&r.id&&(e.id=r.id)});const D=E(),e=V({id:"",sid:"",uid:"",amount:"",remark:""}),v=()=>{L.value=="shangpu"&&(e.id>0||J(e).then(u=>{H({message:"\u65B0\u589E\u6210\u529F",type:"success"}),_()}))};V({list:[]});const _=()=>{k("update:modelValue",!1),k("onClose"),y.$resetForm(D.value,e)},f=V({list:[]}),w=()=>{K().then(u=>{f.list=u})},U=()=>{let u=f.list.find(t=>t.id==e.sid);console.log("current",u),e.uid=u.uid||""};w();let g=E("");return B(()=>e.uid,u=>{u&&Q({uid:u}).then(t=>{console.log("res",t),g.value=`\u5F53\u524D\u603B\u6388\u4FE1\u989D\u5EA6\uFF1A${t.total_credit_limit}\uFF0C\u5269\u4F59\u6388\u4FE1\u989D\u5EA6\uFF1A${t.credit_limit}`})}),(u,t)=>{const q=n("el-option"),x=n("el-select"),s=n("el-form-item"),F=n("el-input"),S=n("el-tag"),A=n("el-button"),N=n("el-dialog");return m(),b(N,{modelValue:c.value,"onUpdate:modelValue":t[4]||(t[4]=o=>c.value=o),title:l(h)?"\u67E5\u770B":"\u65B0\u589E",width:"70%","destroy-on-close":"",onClose:_},{default:i(()=>[a(l(G),{ref_key:"formRef",ref:D,model:l(e),"inline-message":!0,"label-width":"160px"},{default:i(()=>[a(s,{label:"\u95E8\u5E97",prop:"sid"},{default:i(()=>[a(x,{modelValue:l(e).sid,"onUpdate:modelValue":t[0]||(t[0]=o=>l(e).sid=o),placeholder:"\u8BF7\u9009\u62E9\u95E8\u5E97",clearable:"",onChange:U,filterable:""},{default:i(()=>[(m(!0),R(j,null,T(l(f).list,o=>(m(),b(q,{key:o.id,label:o.title,value:o.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),a(s,{label:"uid",prop:"uid"},{default:i(()=>[a(F,{modelValue:l(e).uid,"onUpdate:modelValue":t[1]||(t[1]=o=>l(e).uid=o),placeholder:"\u8BF7\u8F93\u5165uid"},null,8,["modelValue"]),l(g)?(m(),b(S,{key:0,type:"info"},{default:i(()=>[C(z(l(g)),1)]),_:1})):M("",!0)]),_:1}),a(s,{label:"\u53D8\u66F4\u989D\u5EA6",prop:"amount"},{default:i(()=>[a(F,{modelValue:l(e).amount,"onUpdate:modelValue":t[2]||(t[2]=o=>l(e).amount=o),placeholder:"\u8BF7\u8F93\u5165\u53D8\u66F4\u989D\u5EA6"},null,8,["modelValue"])]),_:1}),a(s,{label:"\u5907\u6CE8",prop:"remark"},{default:i(()=>[a(F,{modelValue:l(e).remark,"onUpdate:modelValue":t[3]||(t[3]=o=>l(e).remark=o),placeholder:"\u8BF7\u8F93\u5165\u5907\u6CE8"},null,8,["modelValue"])]),_:1}),a(s,null,{default:i(()=>[a(A,{type:"primary",onClick:v},{default:i(()=>[W]),_:1}),a(A,{onClick:_},{default:i(()=>[X]),_:1})]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue","title"])}}});export{te as _,ee as g};
