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