2 lines
12 KiB
JavaScript
2 lines
12 KiB
JavaScript
import{b2 as e,r as t,bs as a,ag as o,b4 as l,bQ as n,aZ as s,c as r,e as i,N as p,w as c,l as h,d9 as u,an as d,O as m,m as w,al as _,t as g,E as C,ce as y,bb as b,g as f,c8 as k,a_ as R,aO as v}from"./index.DpTrk04W.js";import{_ as F}from"./index.B9z9vlz0.js";/* empty css */import{E as j}from"./el-text._Dsb_OuH.js";import D from"./add-channel.BgUP1WRV.js";import S from"./channel-code.CtBhXevZ.js";import x from"./single_fee.PhfUhTEI.js";import B from"./test_channel.C0al2tct.js";import U from"./fee-risk.BA_jQKJs.js";import T from"./copy-channel.dbjbwfms.js";import V from"./sub-channel.BzgQa-eZ.js";import A from"./channel-fee.Boe8XR5U.js";import E from"./channel-risk.D9x9BHrG.js";import{g as z,e as O,d as $,f as P}from"./payee-channel.CxDNt_0m.js";import{g as I}from"./payee-suppiler.jkhhq4F7.js";import{s as L}from"./staticData.8wZxkmL4.js";/* empty css */import"./el-col.C6R59TWy.js";import"./el-link.BpTeNAFy.js";import"./el-time-select.D8jmlFuI.js";import"./el-card.Hc3mYuG1.js";import"./sub-channel-add.BK37O9pT.js";import"./sub-channel-fee.BuJWZco2.js";import"./sub-channel-risk.t1PeJqtY.js";const N={key:0},q={key:1},H={key:2},M={class:"operate-btn"},Q=e({__name:"deposit-channels-set",props:{currentRow:{type:Object,default:{}}},setup(e,{expose:Q}){t("status"),t("1"),a({legacy:!0});let Z=t([]);const G=o({columns:[{prop:"id",label:"ID",align:"center",width:"80"},{prop:"shop_id",label:"供应商编码",align:"center"},{prop:"shop_id",label:"供应商名称",align:"center",slot:"shop_name_slot"},{prop:"name",label:"渠道名称",align:"center"},{prop:"code",label:"渠道代码",align:"center"},{prop:"",label:"跑量",align:"center",slot:"run_num_slot",sortable:"custom"},{prop:"",label:"成功率",align:"center",slot:"success_rate_slot",sortable:"custom"},{prop:"status",label:"接口状态",align:"center",slot:"status_slot"},{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:Z.value,value:""},{label:"是否开启",type:"select",prop:"status",value:"",options:L.status}],total:0,page:1,per_page:10,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}),J=()=>{G.searchFields.forEach(e=>{"datetimerange"==e.dateType?e.value=[]:e.value=""}),W()};l(async()=>{W(),oe();let e=(await z({saiType:"all"})).map(e=>({label:e.name,value:e.name}));G.searchFields.forEach(t=>{"name"==t.prop&&(t.options=e)})});const W=()=>{var e,t;G.loading=!0;let a={limit:G.per_page,page:G.page},o=function(e){const t={};return e.forEach(e=>{e.prop&&void 0!==e.value&&(t[e.prop]=e.value)}),t}(G.searchFields);(null==(e=o.created_at)?void 0:e.length)>0&&(o.created_at_start=o.created_at[0]?n(o.created_at[0]):"",o.created_at_end=o.created_at[1]?n(o.created_at[1]):""),(null==(t=o.completed_at)?void 0:t.length)>0&&(o.completed_at_start=o.completed_at[0]?n(o.completed_at[0]):"",o.completed_at_end=o.completed_at[1]?n(o.completed_at[1]):""),z(Object.assign(a,o)).then(e=>{G.tableData=e.data,G.total=e.total,G.loading=!1}).catch(()=>{G.loading=!1})},X=()=>{G.showBatchSettingDialog=!0},Y=()=>{G.showBatchSettingDialog=!1},K=()=>{G.showRiskControlDialog=!0},ee=e=>{G.showAddChannel=!0,G.currentRow=e},te=o({}),ae=e=>{e.id?O(e).then(e=>{W(),v.success("修改成功"),G.showAddChannel=!1}):P(e).then(e=>{W(),v.success("添加成功"),G.showAddChannel=!1,G.showCopyChannel=!1})},oe=()=>{I({saiType:"all"}).then(e=>{Z.value=[],e.forEach(e=>{Z.value.push({label:e.supplier_name,value:e.shop_id})}),G.searchFields[1].options=Z.value})};return Q({filterChannel:e=>{G.searchFields[1].value=e.shop_id,W()}}),(e,t)=>{const a=d,o=b,l=j,n=s("EditPen"),v=C,z=y,P=u,I=F,L=k;return i(),r("div",null,[p(I,{type:"export",columns:f(G).columns,searchFields:f(G).searchFields,"onUpdate:searchFields":t[1]||(t[1]=e=>f(G).searchFields=e),data:f(G).tableData,per_page:f(G).per_page,"onUpdate:per_page":t[2]||(t[2]=e=>f(G).per_page=e),page:f(G).page,"onUpdate:page":t[3]||(t[3]=e=>f(G).page=e),total:f(G).total,onGetTableData:W,onResetForm:J,loading:f(G).loading,showSelection:!1,showRightRefreshSlot:!1},{btns:c(({row:e})=>[p(a,{type:"primary",onClick:X},{default:c(()=>t[18]||(t[18]=[m("批量开启/关闭")])),_:1,__:[18]}),p(a,{type:"primary",onClick:K},{default:c(()=>t[19]||(t[19]=[m("风控实况")])),_:1,__:[19]}),p(a,{type:"primary",onClick:t[0]||(t[0]=e=>ee({}))},{default:c(()=>t[20]||(t[20]=[m("添加渠道")])),_:1,__:[20]})]),shop_name_slot:c(({row:e})=>{var t;return[h("div",null,g(null==(t=f(Z).find(t=>t.value==e.shop_id))?void 0:t.label),1)]}),run_num_slot:c(({row:e})=>[h("div",null,g(`${e.succ_num?e.succ_num:0}/${e.num?e.num:0}单`),1),h("div",null,g(`${e.pay_succ_money?e.pay_succ_money:0}/${e.pay_money?e.pay_money:0}元`),1)]),success_rate_slot:c(({row:e})=>[m(g((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:c(({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?R({title:"提示",message:`<span style="color: red">通道[${t.join(",")}]费率小于渠道成本</span>`,confirmButtonText:"我已知晓",cancelButtonText:"取消",showCancelButton:!0,type:"warning",dangerouslyUseHTMLString:!0}).then(()=>{R.alert("确定修改渠道状态吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",showCancelButton:!0,type:"warning"}).then(()=>{$({id:e.id,status:e.status})}).catch(()=>{e.status=1==e.status?2:1})}).catch(()=>{e.status=1==e.status?2:1}):R.alert("确定修改渠道状态吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",showCancelButton:!0,type:"warning"}).then(()=>{$({id:e.id,status:e.status})}).catch(()=>{e.status=1==e.status?2:1})})(e)},null,8,["modelValue","onUpdate:modelValue","onChange"])]),limit_slot:c(({row:e})=>[2==e.money_type?(i(),r("div",N,"区间:"+g(e.min_money)+"~"+g(e.max_money),1)):_("",!0),1==e.money_type&&(null==e?void 0:e.allow_money)?(i(),r("div",q,"固定:"+g((null==e?void 0:e.allow_money)?JSON.parse(e.allow_money).join(","):""),1)):_("",!0),e.not_allow_money?(i(),r("div",H,"限额:"+g(e.not_allow_money),1)):_("",!0)]),pr_slot:c(({row:e})=>[e.edit?_("",!0):(i(),w(l,{key:0},{default:c(()=>[m(g(e.pr),1)]),_:2},1024)),e.edit?_("",!0):(i(),w(l,{key:1,type:"primary",onClick:t=>(e=>{Object.assign(te,e),e.edit=!0})(e)},{default:c(()=>[p(v,null,{default:c(()=>[p(n)]),_:1})]),_:2},1032,["onClick"])),e.edit?(i(),w(z,{key:2,modelValue:e.pr,"onUpdate:modelValue":t=>e.pr=t,type:"number",controls:!1,placeholder:"请输入",style:{width:"80px"}},null,8,["modelValue","onUpdate:modelValue"])):_("",!0),e.edit?(i(),w(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?R({title:"提示",message:`<span style="color: red">通道[${t.join(",")}]费率小于渠道成本</span>`,confirmButtonText:"我已知晓",cancelButtonText:"取消",showCancelButton:!0,type:"warning",dangerouslyUseHTMLString:!0}).then(()=>{R.alert("确定修改渠道费率吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",showCancelButton:!0,type:"warning"}).then(()=>{O(a).then(e=>{W()})}).catch(()=>{e.edit=!1,Object.assign(e,te)})}).catch(()=>{e.edit=!1,W()}):R.alert("确定修改渠道费率吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",showCancelButton:!0,type:"warning"}).then(()=>{O(a).then(e=>{W()})}).catch(()=>{e.edit=!1,Object.assign(e,te)})})(e)},{default:c(()=>t[21]||(t[21]=[m("保存")])),_:2,__:[21]},1032,["onClick"])):_("",!0)]),operate_slot:c(({row:o})=>[h("div",M,[p(P,{style:{"margin-bottom":"4px"}},{default:c(()=>[p(a,{type:"primary",onClick:e=>(e=>{G.showSubChannel=!0,G.currentRow=e})(o),size:"small"},{default:c(()=>t[22]||(t[22]=[m("子账号")])),_:2,__:[22]},1032,["onClick"]),p(a,{type:"primary",onClick:e=>(e=>{G.showChannelRisk=!0,G.currentRow=e})(o),size:"small"},{default:c(()=>t[23]||(t[23]=[m("风控")])),_:2,__:[23]},1032,["onClick"]),p(a,{type:"primary",onClick:e=>ee(o),size:"small"},{default:c(()=>t[24]||(t[24]=[m("编辑")])),_:2,__:[24]},1032,["onClick"])]),_:2},1024),p(P,null,{default:c(()=>[p(a,{type:"primary",onClick:e=>(e=>{G.channelVisible=!0,G.currentRow=e})(o),size:"small"},{default:c(()=>t[25]||(t[25]=[m("测试渠道")])),_:2,__:[25]},1032,["onClick"]),p(a,{type:"primary",onClick:e=>(e=>{G.showCopyChannel=!0,G.currentRow=e})(o),size:"small"},{default:c(()=>t[26]||(t[26]=[m("复制渠道")])),_:2,__:[26]},1032,["onClick"]),p(a,{type:"primary",onClick:t=>e.handleDelete(o),size:"small"},{default:c(()=>t[27]||(t[27]=[m("删除")])),_:2,__:[27]},1032,["onClick"])]),_:2},1024)])]),_:1},8,["columns","searchFields","data","per_page","page","total","loading"]),p(L,{showDialog:f(G).showBatchSettingDialog,"onUpdate:showDialog":t[4]||(t[4]=e=>f(G).showBatchSettingDialog=e),formData:f(G).batchSetting,"onUpdate:formData":t[5]||(t[5]=e=>f(G).batchSetting=e),ref:"productRef"},{submit:c(()=>[p(a,{type:"primary",onClick:Y},{default:c(()=>t[28]||(t[28]=[m("确定")])),_:1,__:[28]})]),_:1},8,["showDialog","formData"]),p(L,{showDialog:f(G).showRiskControlDialog,"onUpdate:showDialog":t[7]||(t[7]=e=>f(G).showRiskControlDialog=e),formData:f(G).riskControl,"onUpdate:formData":t[8]||(t[8]=e=>f(G).riskControl=e),ref:"productRef",dialogWidth:"900px"},{otherInfo:c(()=>[p(I,{type:"export",columns:f(G).riskControlColumns,searchFields:f(G).riskControlSearchFields,"onUpdate:searchFields":t[6]||(t[6]=e=>f(G).riskControlSearchFields=e),data:f(G).riskControlData,loading:f(G).loading,showSelection:!1,showRightRefreshSlot:!1},null,8,["columns","searchFields","data","loading"])]),_:1},8,["showDialog","formData"]),p(D,{showAddChannel:f(G).showAddChannel,"onUpdate:showAddChannel":t[9]||(t[9]=e=>f(G).showAddChannel=e),onConfirmAddChannel:ae,currentRow:f(G).currentRow},null,8,["showAddChannel","currentRow"]),p(x,{showSingleFee:f(G).showSingleFee,"onUpdate:showSingleFee":t[10]||(t[10]=e=>f(G).showSingleFee=e),currentRow:f(G).currentRow},null,8,["showSingleFee","currentRow"]),p(B,{channelVisible:f(G).channelVisible,"onUpdate:channelVisible":t[11]||(t[11]=e=>f(G).channelVisible=e),currentRow:f(G).currentRow},null,8,["channelVisible","currentRow"]),p(U,{showFeeRisk:f(G).showFeeRisk,"onUpdate:showFeeRisk":t[12]||(t[12]=e=>f(G).showFeeRisk=e),currentRow:f(G).currentRow},null,8,["showFeeRisk","currentRow"]),p(T,{showCopyChannel:f(G).showCopyChannel,"onUpdate:showCopyChannel":t[13]||(t[13]=e=>f(G).showCopyChannel=e),currentRow:f(G).currentRow,onConfirmAddChannel:ae},null,8,["showCopyChannel","currentRow"]),p(V,{showSubChannel:f(G).showSubChannel,"onUpdate:showSubChannel":t[14]||(t[14]=e=>f(G).showSubChannel=e),currentRow:f(G).currentRow},null,8,["showSubChannel","currentRow"]),p(A,{showChannelFee:f(G).showChannelFee,"onUpdate:showChannelFee":t[15]||(t[15]=e=>f(G).showChannelFee=e),currentRow:f(G).currentRow},null,8,["showChannelFee","currentRow"]),p(E,{showChannelRisk:f(G).showChannelRisk,"onUpdate:showChannelRisk":t[16]||(t[16]=e=>f(G).showChannelRisk=e),currentRow:f(G).currentRow,onLoadData:W},null,8,["showChannelRisk","currentRow"]),p(S,{showChannelCode:f(G).showChannelCode,"onUpdate:showChannelCode":t[17]||(t[17]=e=>f(G).showChannelCode=e)},null,8,["showChannelCode"])])}}},[["__scopeId","data-v-11bb6dfb"]]);export{Q as default};
|