2 lines
12 KiB
JavaScript
2 lines
12 KiB
JavaScript
import{b2 as e,r as t,bv as a,ag as o,b4 as l,df as n,bT as s,aZ as r,c as i,e as c,N as p,w as h,l as d,dm as u,an as m,O as w,m as _,al as g,t as C,E as y,ch as b,bb as f,g as k,cb as R,a_ as v,dE as F,dF as x,aO as j,dG as D}from"./index.1757051889208DRqHAyxg.js";import{_ as S}from"./index.1757051889208B27YTq0N.js";/* empty css */import{E as B}from"./el-text.1757051889208Dqvtkogw.js";import U from"./add-channel.1757051889208CV8HrmUQ.js";import T from"./channel-code.1757051889208G0S2DI6u.js";import V from"./single_fee.1757051889208CxiruYd_.js";import A from"./test_channel.1757051889208fLTS-ik_.js";import E from"./fee-risk.1757051889208tneT2_uB.js";import z from"./copy-channel.1757051889208Q-S8fXof.js";import O from"./sub-channel.1757051889208P5yILys0.js";import $ from"./channel-fee.1757051889208DPr-2M_U.js";import P from"./channel-risk.1757051889208DCpiniWN.js";import{g as H}from"./payee-suppiler.1757051889208WcCyUo6Y.js";import{s as I}from"./staticData.17570518892088wZxkmL4.js";/* empty css */import"./el-col.1757051889208m32Fovi8.js";import"./el-link.1757051889208D3Ew2ssK.js";import"./el-time-select.1757051889208z64V71Qf.js";import"./el-card.1757051889208DQ50vU5q.js";import"./sub-channel-add.1757051889208DlZD_A6H.js";import"./sub-channel-fee.1757051889208Q-kbfo8o.js";import"./sub-channel-risk.1757051889208CBb-4zF8.js";const L={key:0},N={key:1},q={key:2},G={class:"operate-btn"},M=e({__name:"deposit-channels-set",props:{currentRow:{type:Object,default:{}}},setup(e,{expose:M}){t("status"),t("1"),a({legacy:!0});let J=t([]);const W=o({columns:[{prop:"id",label:"ID",align:"center",width:"80"},{prop:"shop_id",label:"供应商编码",align:"center",width:"100"},{prop:"shop_id",label:"供应商名称",align:"center",slot:"shop_name_slot",width:"100"},{prop:"name",label:"渠道名称",align:"center",width:"320px"},{prop:"code",label:"渠道代码",align:"center",width:"100"},{prop:"",label:"跑量",align:"center",slot:"run_num_slot",sortable:"custom"},{prop:"",label:"成功率",align:"center",slot:"success_rate_slot",sortable:"custom",width:"100"},{prop:"status",label:"接口状态",align:"center",slot:"status_slot",width:"100"},{prop:"pr",label:"费率",align:"center",slot:"pr_slot"},{prop:"limit",label:"风控限额",align:"center",slot:"limit_slot"},{prop:"notify_time",label:"操作",slot:"operate_slot",width:"280px"}],tableData:[],searchFields:[{label:"渠道名称",prop:"name",type:"select",options:[],value:""},{label:"供应商",prop:"shop_id",type:"select",options:J.value,value:""},{label:"是否开启",type:"select",prop:"status",value:"",options:I.status}],total:0,page:1,per_page:50,loading:!1,showBatchSettingDialog:!1,batchSetting:{title:"批量设置",fields:[{label:"设置",type:"radio",prop:"status",options:[{label:"开启",value:1},{label:"关闭",value:0}]}],rules:{status:[{required:!0,message:"请选择设置",trigger:"blur"}]},values:{status:""}},showRiskControlDialog:!1,riskControl:{title:"风控实况",fields:[],rules:{},values:{}},riskControlColumns:[{label:"通道名称/子账号",prop:"channelName"},{label:"交易时间",prop:"channelCode"},{label:"今天交易金额/可交易金额",prop:"status"},{label:"上线请款",prop:"description"}],riskControlSearchFields:[],riskControlData:[],showAddChannel:!1,batchSettingType:"1",showProduct:!1,productData:{},currentRow:{},channelVisible:!1,showFeeRisk:!1,showCopyChannel:!1,showSubChannel:!1,showChannelCode:!1}),Z=()=>{W.searchFields.forEach(e=>{"datetimerange"==e.dateType?e.value=[]:e.value=""}),K()};l(async()=>{K(),te();let e=(await n({saiType:"all"})).map(e=>({label:e.name,value:e.name}));W.searchFields.forEach(t=>{"name"==t.prop&&(t.options=e)})});const K=()=>{var e,t;W.loading=!0;let a={limit:W.per_page,page:W.page},o=function(e){const t={};return e.forEach(e=>{e.prop&&void 0!==e.value&&(t[e.prop]=e.value)}),t}(W.searchFields);(null==(e=o.created_at)?void 0:e.length)>0&&(o.created_at_start=o.created_at[0]?s(o.created_at[0]):"",o.created_at_end=o.created_at[1]?s(o.created_at[1]):""),(null==(t=o.completed_at)?void 0:t.length)>0&&(o.completed_at_start=o.completed_at[0]?s(o.completed_at[0]):"",o.completed_at_end=o.completed_at[1]?s(o.completed_at[1]):""),n(Object.assign(a,o)).then(e=>{W.tableData=e.data,W.total=e.total,W.loading=!1}).catch(()=>{W.loading=!1})},Q=()=>{W.showBatchSettingDialog=!1},X=e=>{W.showAddChannel=!0,W.currentRow=e},Y=o({}),ee=e=>{e.id?F(e).then(e=>{K(),j.success("修改成功"),W.showAddChannel=!1}):D(e).then(e=>{K(),j.success("添加成功"),W.showAddChannel=!1,W.showCopyChannel=!1})},te=()=>{H({saiType:"all"}).then(e=>{J.value=[],e.forEach(e=>{J.value.push({label:e.supplier_name,value:e.shop_id})}),W.searchFields[1].options=J.value})};return M({filterChannel:e=>{W.searchFields[1].value=e.shop_id,K()}}),(e,t)=>{const a=m,o=f,l=B,n=r("EditPen"),s=y,j=b,D=u,H=S,I=R;return c(),i("div",null,[p(H,{type:"export",columns:k(W).columns,searchFields:k(W).searchFields,"onUpdate:searchFields":t[1]||(t[1]=e=>k(W).searchFields=e),data:k(W).tableData,per_page:k(W).per_page,"onUpdate:per_page":t[2]||(t[2]=e=>k(W).per_page=e),page:k(W).page,"onUpdate:page":t[3]||(t[3]=e=>k(W).page=e),total:k(W).total,onGetTableData:K,onResetForm:Z,loading:k(W).loading,showSelection:!1,showRightRefreshSlot:!1,maxHeight:"58vh"},{btns:h(({row:e})=>[p(a,{type:"primary",onClick:t[0]||(t[0]=e=>X({}))},{default:h(()=>t[18]||(t[18]=[w("添加渠道")])),_:1,__:[18]})]),shop_name_slot:h(({row:e})=>{var t;return[d("div",null,C(null==(t=k(J).find(t=>t.value==e.shop_id))?void 0:t.label),1)]}),run_num_slot:h(({row:e})=>[d("div",null,C(`${e.succ_num?e.succ_num:0}/${e.num?e.num:0}单`),1),d("div",null,C(`${e.pay_succ_money?e.pay_succ_money:0}/${e.pay_money?e.pay_money:0}元`),1)]),success_rate_slot:h(({row:e})=>[w(C((null==e?void 0:e.num)&&(null==e?void 0:e.succ_num)?((null==e?void 0:e.succ_num)/(null==e?void 0:e.num)*100).toFixed(2):0)+"% ",1)]),status_slot:h(({row:e})=>[p(o,{modelValue:e.status,"onUpdate:modelValue":t=>e.status=t,"inline-prompt":"","active-value":1,"inactive-value":2,"active-text":"正常","inactive-text":"停用",onChange:t=>(e=>{let t=[];e.payProduct.forEach(a=>{e.pr-a.pr>0&&t.push(a.name)}),t.length>0&&1==e.status?v({title:"提示",message:`<span style="color: red">通道[${t.join(",")}]费率小于渠道成本</span>`,confirmButtonText:"我已知晓",cancelButtonText:"取消",showCancelButton:!0,type:"warning",dangerouslyUseHTMLString:!0}).then(()=>{v.alert("确定修改渠道状态吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",showCancelButton:!0,type:"warning"}).then(()=>{x({id:e.id,status:e.status})}).catch(()=>{e.status=1==e.status?2:1})}).catch(()=>{e.status=1==e.status?2:1}):v.alert("确定修改渠道状态吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",showCancelButton:!0,type:"warning"}).then(()=>{x({id:e.id,status:e.status})}).catch(()=>{e.status=1==e.status?2:1})})(e)},null,8,["modelValue","onUpdate:modelValue","onChange"])]),limit_slot:h(({row:e})=>[2==e.money_type?(c(),i("div",L,"区间:"+C(e.min_money)+"~"+C(e.max_money),1)):g("",!0),1==e.money_type&&(null==e?void 0:e.allow_money)?(c(),i("div",N,"固定:"+C((null==e?void 0:e.allow_money)?JSON.parse(e.allow_money).join(","):""),1)):g("",!0),e.not_allow_money?(c(),i("div",q,"限额:"+C(e.not_allow_money),1)):g("",!0)]),pr_slot:h(({row:e})=>[e.edit?g("",!0):(c(),_(l,{key:0},{default:h(()=>[w(C(e.pr),1)]),_:2},1024)),e.edit?g("",!0):(c(),_(l,{key:1,type:"primary",onClick:t=>(e=>{Object.assign(Y,e),e.edit=!0})(e)},{default:h(()=>[p(s,null,{default:h(()=>[p(n)]),_:1})]),_:2},1032,["onClick"])),e.edit?(c(),_(j,{key:2,modelValue:e.pr,"onUpdate:modelValue":t=>e.pr=t,type:"number",controls:!1,placeholder:"请输入",style:{width:"80px"}},null,8,["modelValue","onUpdate:modelValue"])):g("",!0),e.edit?(c(),_(a,{key:3,type:"primary",style:{"margin-left":"4px"},size:"small",onClick:t=>(e=>{e.edit=!1;let t=[],a={id:e.id,pr:e.pr,name:e.name,gateway:e.gateway,status:e.status,code:e.code};e.payProduct.forEach(a=>{e.pr-a.pr>0&&t.push(a.name)}),t.length>0?v({title:"提示",message:`<span style="color: red">通道[${t.join(",")}]费率小于渠道成本</span>`,confirmButtonText:"我已知晓",cancelButtonText:"取消",showCancelButton:!0,type:"warning",dangerouslyUseHTMLString:!0}).then(()=>{v.alert("确定修改渠道费率吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",showCancelButton:!0,type:"warning"}).then(()=>{F(a).then(e=>{K()})}).catch(()=>{e.edit=!1,Object.assign(e,Y)})}).catch(()=>{e.edit=!1,K()}):v.alert("确定修改渠道费率吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",showCancelButton:!0,type:"warning"}).then(()=>{F(a).then(e=>{K()})}).catch(()=>{e.edit=!1,Object.assign(e,Y)})})(e)},{default:h(()=>t[19]||(t[19]=[w("保存")])),_:2,__:[19]},1032,["onClick"])):g("",!0)]),operate_slot:h(({row:o})=>[d("div",G,[p(D,{style:{"margin-bottom":"4px"}},{default:h(()=>[p(a,{type:"primary",onClick:e=>(e=>{W.showSubChannel=!0,W.currentRow=e})(o),size:"small"},{default:h(()=>t[20]||(t[20]=[w("子账号")])),_:2,__:[20]},1032,["onClick"]),p(a,{type:"primary",onClick:e=>(e=>{W.showChannelRisk=!0,W.currentRow=e})(o),size:"small"},{default:h(()=>t[21]||(t[21]=[w("风控")])),_:2,__:[21]},1032,["onClick"]),p(a,{type:"primary",onClick:e=>X(o),size:"small"},{default:h(()=>t[22]||(t[22]=[w("编辑")])),_:2,__:[22]},1032,["onClick"])]),_:2},1024),p(D,null,{default:h(()=>[p(a,{type:"primary",onClick:e=>(e=>{W.channelVisible=!0,W.currentRow=e})(o),size:"small"},{default:h(()=>t[23]||(t[23]=[w("测试渠道")])),_:2,__:[23]},1032,["onClick"]),p(a,{type:"primary",onClick:e=>(e=>{W.showCopyChannel=!0,W.currentRow=e})(o),size:"small"},{default:h(()=>t[24]||(t[24]=[w("复制渠道")])),_:2,__:[24]},1032,["onClick"]),p(a,{type:"primary",onClick:t=>e.handleDelete(o),size:"small"},{default:h(()=>t[25]||(t[25]=[w("删除")])),_:2,__:[25]},1032,["onClick"])]),_:2},1024)])]),_:1},8,["columns","searchFields","data","per_page","page","total","loading"]),p(I,{showDialog:k(W).showBatchSettingDialog,"onUpdate:showDialog":t[4]||(t[4]=e=>k(W).showBatchSettingDialog=e),formData:k(W).batchSetting,"onUpdate:formData":t[5]||(t[5]=e=>k(W).batchSetting=e),ref:"productRef"},{submit:h(()=>[p(a,{type:"primary",onClick:Q},{default:h(()=>t[26]||(t[26]=[w("确定")])),_:1,__:[26]})]),_:1},8,["showDialog","formData"]),p(I,{showDialog:k(W).showRiskControlDialog,"onUpdate:showDialog":t[7]||(t[7]=e=>k(W).showRiskControlDialog=e),formData:k(W).riskControl,"onUpdate:formData":t[8]||(t[8]=e=>k(W).riskControl=e),ref:"productRef",dialogWidth:"900px"},{otherInfo:h(()=>[p(H,{type:"export",columns:k(W).riskControlColumns,searchFields:k(W).riskControlSearchFields,"onUpdate:searchFields":t[6]||(t[6]=e=>k(W).riskControlSearchFields=e),data:k(W).riskControlData,loading:k(W).loading,showSelection:!1,showRightRefreshSlot:!1},null,8,["columns","searchFields","data","loading"])]),_:1},8,["showDialog","formData"]),p(U,{showAddChannel:k(W).showAddChannel,"onUpdate:showAddChannel":t[9]||(t[9]=e=>k(W).showAddChannel=e),onConfirmAddChannel:ee,currentRow:k(W).currentRow},null,8,["showAddChannel","currentRow"]),p(V,{showSingleFee:k(W).showSingleFee,"onUpdate:showSingleFee":t[10]||(t[10]=e=>k(W).showSingleFee=e),currentRow:k(W).currentRow},null,8,["showSingleFee","currentRow"]),p(A,{channelVisible:k(W).channelVisible,"onUpdate:channelVisible":t[11]||(t[11]=e=>k(W).channelVisible=e),currentRow:k(W).currentRow},null,8,["channelVisible","currentRow"]),p(E,{showFeeRisk:k(W).showFeeRisk,"onUpdate:showFeeRisk":t[12]||(t[12]=e=>k(W).showFeeRisk=e),currentRow:k(W).currentRow},null,8,["showFeeRisk","currentRow"]),p(z,{showCopyChannel:k(W).showCopyChannel,"onUpdate:showCopyChannel":t[13]||(t[13]=e=>k(W).showCopyChannel=e),currentRow:k(W).currentRow,onConfirmAddChannel:ee},null,8,["showCopyChannel","currentRow"]),p(O,{showSubChannel:k(W).showSubChannel,"onUpdate:showSubChannel":t[14]||(t[14]=e=>k(W).showSubChannel=e),currentRow:k(W).currentRow},null,8,["showSubChannel","currentRow"]),p($,{showChannelFee:k(W).showChannelFee,"onUpdate:showChannelFee":t[15]||(t[15]=e=>k(W).showChannelFee=e),currentRow:k(W).currentRow},null,8,["showChannelFee","currentRow"]),p(P,{showChannelRisk:k(W).showChannelRisk,"onUpdate:showChannelRisk":t[16]||(t[16]=e=>k(W).showChannelRisk=e),currentRow:k(W).currentRow,onLoadData:K},null,8,["showChannelRisk","currentRow"]),p(T,{showChannelCode:k(W).showChannelCode,"onUpdate:showChannelCode":t[17]||(t[17]=e=>k(W).showChannelCode=e)},null,8,["showChannelCode"])])}}},[["__scopeId","data-v-8b7cbdfc"]]);export{M as default};
|