import{b2 as e,bs as a,r as t,ag as l,b4 as o,d8 as r,c as s,e as n,N as i,w as p,O as u,l as c,d9 as m,an as d,t as g,bb as h,g as _,c8 as w,aX as y,aO as f,a_ as v,ai as D}from"./index.BcEkoiPt.js";import{_ as b}from"./index.RVD1gHlP.js";/* empty css */import{E as C}from"./el-text.DDaZ3U-z.js";import j from"./merge-list.DveJ6GU-.js";import k from"./bind-aircraft.CCBejeXO.js";import P from"./add-reduce-prepayment.DpJZmoqS.js";import R from"./prepayment-log.B_wk_QFd.js";import S from"./deposit-channels-set.B2DRHJOK.js";import{g as F,c as B,e as x,a as U}from"./payee-suppiler.Cj-nKpjL.js";import{k as A,l as L}from"./payee-user.B-AJwaEl.js";import{b as T}from"./payee-order.BE6-2IPP.js";/* empty css */import"./el-col.BsIzjLdp.js";import"./el-card.CMRZHxxo.js";import"./settlement-log.CbW4kc3i.js";import"./payee-count.PkgtM9SU.js";import"./add-channel.DO6S5-KB.js";import"./payee-channel.DQWQ6M7Q.js";import"./channel-code.DUFx60Pg.js";import"./single_fee.CIpeoU0k.js";import"./test_channel.B4prTzuP.js";import"./el-link.f_5DA-TY.js";import"./fee-risk.zJ5B6vVO.js";import"./el-time-select.-AzEl2DB.js";import"./copy-channel.XNA2y44G.js";import"./sub-channel.DHfKgTjn.js";import"./sub-channel-add.D4fLf-R-.js";import"./sub-channel-fee.CSiHaF2O.js";import"./sub-channel-risk.DUmVFaVg.js";import"./channel-fee.BRR5rBrg.js";import"./channel-risk.D02WfLsx.js";import"./staticData.8wZxkmL4.js";const V={style:{"margin-bottom":"4px"}},M=e({__name:"supplier-info",setup(e){a({legacy:!0});let M=[],z=t("create_time"),I=t("DESC");const E=t("日切清账,关闭通道"),q=t("warning"),O=t("0"),X=l({columns:[{prop:"id",label:"ID",align:"center",width:"80"},{prop:"shop_id",label:"供应商编号",align:"center",width:"100"},{prop:"supplier_name",label:"供应商名称",align:"center"},{prop:"telegram_group",label:"飞机群ID",align:"center"},{prop:"warn_money",label:"预警金额",align:"center"},{prop:"credit_money",label:"授信额度",align:"center"},{prop:"prepay",label:"预付",align:"center",sortable:"custom"},{prop:"pay_money",label:"跑量",align:"center",sortable:"custom"},{prop:"prepay_money",label:"剩余预付",align:"center",slot:"prepay_money_slot",sortable:"custom"},{prop:"notify_time",label:"应下发",align:"center",sortable:"custom"},{prop:"status",label:"状态",align:"center",slot:"status_slot",width:"80"},{prop:"create_time",label:"注册时间",align:"center"},{prop:"ca",label:"操作",align:"center",slot:"operate_slot",width:"240px"}],tableData:[],searchFields:[{prop:"supplier_name",label:"供应商编号/名称",type:"input",value:""}],total:0,page:1,per_page:10,loading:!1,showAddSupplierDialog:!1,addForm:{title:"添加供应商",fields:[{label:"供应商名称",type:"input",prop:"supplier_name",value:""},{label:"预警金额",type:"input_num",prop:"warn_money",value:""},{label:"授信额度",type:"number",prop:"credit_money",value:""}],rules:{status:[{required:!0,message:"请选择设置",trigger:"blur"}]},values:{supplier_name:"",warn_money:"",credit_money:"",id:""}},showMergeSupplierDialog:!1,mergeForm:{title:"合并供应商",fields:[{label:"供应商从",type:"select",prop:"status",options:M,value:[]},{label:"合并到",type:"select",prop:"status",options:M,value:[]}],rules:{status:[{required:!0,message:"请选择设置",trigger:"blur"}]},values:{status:""}},showMergeListDialog:!1,showBindAircraftDialog:!1,currentRow:{},showPrePaymentDialog:!1,showPrePaymentLogDialog:!1,dialogShowChannelVisible:!1}),G=()=>{X.searchFields.forEach(e=>{"datetimerange"==e.dateType?e.value=[]:e.value=""}),Y()};o(()=>{Y(),Q(),le()}),r(()=>{clearInterval(ae.value)});let N=!1;const Q=()=>{T().then(e=>{0!=e.system_clear_status&&2!=e.system_clear_status||clearInterval(ae.value),O.value=e.system_clear_status,1==e.system_clear_status&&(q.value="danger",E.value="日切清账中,所有支付通道已关闭",N||(le(),N=!0)),2==e.system_clear_status&&(q.value="success",E.value="日切清账完成,请手动点击开启所有通道")})};const Y=()=>{let e={limit:X.per_page,page:X.page,orderBy:z.value,orderType:I.value},a=function(e){const a={};return e.forEach(e=>{e.prop&&void 0!==e.value&&(a[e.prop]=e.value)}),a}(X.searchFields);F(Object.assign(e,a)).then(e=>{X.tableData=e.data,X.total=e.total}).catch(()=>{X.loading=!1})},Z=()=>{X.showAddSupplierDialog=!0,X.addForm.values.id=""},H=t(null),J=()=>{X.dialogShowChannelVisible=!1},K=()=>{let e=X.addForm.values;e.id?x(e).then(e=>{X.showAddSupplierDialog=!1,f.success("编辑成功!"),Y()}):U(e).then(e=>{X.showAddSupplierDialog=!1,Y(),f.success("添加成功!")})},W=()=>{if(1==O.value)return f.warning("清账中,请勿重复点击");2!=O.value?te(4,[]):v.alert("确定开启所有通道","提示",{confirmButtonText:"确定",cancelButtonText:"取消",showCancelButton:!0,type:"warning"}).then(()=>{$()}).catch(()=>{})},$=()=>{L({onoff:"on"}).then(e=>{Y(),Q(),E.value="日切清账,关闭通道",q.value="warning",clearInterval(ae.value)}).catch(()=>{})},ee=()=>{v.confirm("确定要重置供应的预付吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then(()=>{}).catch(()=>{})};let ae=t(null);const te=(e,a)=>{A({type:e,clear_ids:a}).then(e=>{Q(),le(),setTimeout(()=>{Y()},1e3)})},le=()=>{clearInterval(ae.value),ae.value=setInterval(()=>{Q()},1e4)},oe=()=>{Y()},re=e=>{z.value=e.prop,I.value="descending"==e.order?"DESC":"ASC",Y()};return(e,a)=>{const t=d,l=C,o=h,r=m,F=b,x=w,U=y;return n(),s("div",null,[i(F,{type:"export",columns:_(X).columns,searchFields:_(X).searchFields,"onUpdate:searchFields":a[0]||(a[0]=e=>_(X).searchFields=e),data:_(X).tableData,per_page:_(X).per_page,"onUpdate:per_page":a[1]||(a[1]=e=>_(X).per_page=e),page:_(X).page,"onUpdate:page":a[2]||(a[2]=e=>_(X).page=e),total:_(X).total,onGetTableData:Y,onResetForm:G,loading:_(X).loading,showSelection:!1,showRightRefreshSlot:!1,onSortChange:re},{btns:p(()=>[i(t,{type:"primary",onClick:Z},{default:p(()=>a[15]||(a[15]=[u("添加供应商")])),_:1,__:[15]}),i(t,{type:_(q),onClick:W},{default:p(()=>[u(g(_(E)),1)]),_:1},8,["type"]),i(t,{type:"danger",onClick:ee},{default:p(()=>a[16]||(a[16]=[u("重置预付")])),_:1,__:[16]})]),count:p(()=>[i(l,null,{default:p(()=>a[17]||(a[17]=[u("总跑量:0.0000 总预付:0.0000 总应下发:0.0000 总剩余:0.0000")])),_:1,__:[17]})]),prepay_money_slot:p(({row:e})=>[c("div",null,g(e.account.prepay_money),1)]),status_slot:p(({row:e})=>[i(o,{modelValue:e.status,"onUpdate:modelValue":a=>e.status=a,"inline-prompt":"","active-value":1,"inactive-value":2,onChange:a=>(e=>{v.alert("是否确定对当前用户进行状态切换?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",showCancelButton:!0,type:"warning"}).then(()=>{B({id:e.id,status:e.status}).then(e=>{f.success("修改成功!")})}).catch(()=>{e.status=1==e.status?2:1})})(e),"active-text":"正常","inactive-text":"停用"},null,8,["modelValue","onUpdate:modelValue","onChange"])]),operate_slot:p(({row:l})=>[c("div",V,[i(r,null,{default:p(()=>[i(t,{type:1==l.clear_status?"danger":"warning",size:"small",onClick:e=>(e=>"1"==e.clear_status?f.warning("清账中,请勿重复点击"):"日切清账完成,请手动点击开启所有通道"==E.value?f.error(E.value):void v.alert("是否确定对当前用户进行日切清账?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",showCancelButton:!0,type:"warning"}).then(()=>{f.success("清账中"),te(4,[e.shop_id])}).catch(()=>{}))(l)},{default:p(()=>[u(g(1==l.clear_status?"清账中":"清账"),1)]),_:2},1032,["type","onClick"]),i(t,{type:"primary",onClick:e=>((e={})=>{X.showBindAircraftDialog=!0,X.currentRow=e})(l),size:"small"},{default:p(()=>a[18]||(a[18]=[u("飞机")])),_:2,__:[18]},1032,["onClick"]),i(t,{type:"primary",onClick:e=>((e={})=>{X.showPrePaymentDialog=!0,X.currentRow=e})(l),size:"small"},{default:p(()=>a[19]||(a[19]=[u("加/减预付")])),_:2,__:[19]},1032,["onClick"])]),_:2},1024)]),c("div",null,[i(r,null,{default:p(()=>[i(t,{type:"primary",onClick:e=>((e={})=>{X.showPrePaymentLogDialog=!0,X.currentRow=e})(l),size:"small"},{default:p(()=>a[20]||(a[20]=[u("预付日志")])),_:2,__:[20]},1032,["onClick"]),i(t,{type:"primary",onClick:e=>((e={})=>{X.dialogShowChannelVisible=!0,D(()=>{H.value&&H.value.filterChannel(e)})})(l),size:"small"},{default:p(()=>a[21]||(a[21]=[u("渠道")])),_:2,__:[21]},1032,["onClick"]),i(t,{type:"primary",onClick:e=>(e=>{X.showAddSupplierDialog=!0,X.addForm.values.supplier_name=e.supplier_name,X.addForm.values.warn_money=e.warn_money,X.addForm.values.credit_money=e.credit_money,X.addForm.values.id=e.id})(l),size:"small"},{default:p(()=>a[22]||(a[22]=[u("编辑")])),_:2,__:[22]},1032,["onClick"]),i(t,{type:"primary",onClick:a=>e.handleFeeRisk(l),size:"small"},{default:p(()=>a[23]||(a[23]=[u("删除")])),_:2,__:[23]},1032,["onClick"])]),_:2},1024)])]),default:p(()=>[a[24]||(a[24]=u('" '))]),_:1,__:[24]},8,["columns","searchFields","data","per_page","page","total","loading"]),i(x,{showDialog:_(X).showAddSupplierDialog,"onUpdate:showDialog":a[3]||(a[3]=e=>_(X).showAddSupplierDialog=e),formData:_(X).addForm,"onUpdate:formData":a[4]||(a[4]=e=>_(X).addForm=e),ref:"addSupplierRef"},{submit:p(()=>[i(t,{type:"primary",onClick:K},{default:p(()=>a[25]||(a[25]=[u("确定")])),_:1,__:[25]})]),_:1},8,["showDialog","formData"]),i(x,{showDialog:_(X).showMergeSupplierDialog,"onUpdate:showDialog":a[5]||(a[5]=e=>_(X).showMergeSupplierDialog=e),formData:_(X).mergeForm,"onUpdate:formData":a[6]||(a[6]=e=>_(X).mergeForm=e),ref:"productRef"},{submit:p(()=>[i(t,{type:"primary",onClick:e.confirmBatchSetting},{default:p(()=>a[26]||(a[26]=[u("确定")])),_:1,__:[26]},8,["onClick"])]),_:1},8,["showDialog","formData"]),i(j,{showMergeListDialog:_(X).showMergeListDialog,"onUpdate:showMergeListDialog":a[7]||(a[7]=e=>_(X).showMergeListDialog=e)},null,8,["showMergeListDialog"]),i(k,{showBindAircraftDialog:_(X).showBindAircraftDialog,"onUpdate:showBindAircraftDialog":a[8]||(a[8]=e=>_(X).showBindAircraftDialog=e),currentRow:_(X).currentRow,"onUpdate:currentRow":a[9]||(a[9]=e=>_(X).currentRow=e)},null,8,["showBindAircraftDialog","currentRow"]),i(P,{showPrePaymentDialog:_(X).showPrePaymentDialog,"onUpdate:showPrePaymentDialog":a[10]||(a[10]=e=>_(X).showPrePaymentDialog=e),onConfrimPrePay:oe,currentRow:_(X).currentRow,"onUpdate:currentRow":a[11]||(a[11]=e=>_(X).currentRow=e)},null,8,["showPrePaymentDialog","currentRow"]),i(R,{showPrePaymentLogDialog:_(X).showPrePaymentLogDialog,"onUpdate:showPrePaymentLogDialog":a[12]||(a[12]=e=>_(X).showPrePaymentLogDialog=e),currentRow:_(X).currentRow,"onUpdate:currentRow":a[13]||(a[13]=e=>_(X).currentRow=e)},null,8,["showPrePaymentLogDialog","currentRow"]),i(U,{modelValue:_(X).dialogShowChannelVisible,"onUpdate:modelValue":a[14]||(a[14]=e=>_(X).dialogShowChannelVisible=e),title:"渠道管理",width:"70vw","before-close":J},{default:p(()=>[i(S,{ref_key:"depositChannelRef",ref:H},null,512)]),_:1},8,["modelValue"])])}}},[["__scopeId","data-v-2e13fae5"]]);export{M as default};