2 lines
8.3 KiB
JavaScript
2 lines
8.3 KiB
JavaScript
import{b2 as e,bt as t,ag as a,b4 as l,bQ as o,aZ as n,c as s,e as r,N as i,w as p,l as d,d8 as c,an as u,O as h,bM as m,bK as g,cH as w,am as _,bb as y,m as C,al as f,t as b,E as v,ce as x,g as B,c8 as k,a_ as S,aO as U}from"./index.BgnNQvP_.js";import{_ as D}from"./index.CVnxqUMV.js";/* empty css */import{E as V}from"./el-text.CE868r_2.js";import R from"./add-pay-channel.CgI-6nEo.js";import T from"./select-channel.54PXbhAX.js";import{a as F,s as A,h as P,i as j,j as z,k as E}from"./payee-channel.twN1ovz7.js";/* empty css */import"./el-col.DBcFv4d7.js";const I={class:"operate-btn"},O=e({__name:"payment-products-set",setup(e){t({legacy:!0});const O=a({columns:[{prop:"id",label:"ID",align:"center",width:"80"},{prop:"name",label:"通道名称",align:"center"},{prop:"code",label:"通道代码",align:"center"},{prop:"pr",label:"通道费率(千分位‰)",align:"center",slot:"pr_slot"},{prop:"expire_time",label:"状态",align:"center",slot:"status_slot"},{prop:"",label:"渠道设置",align:"left",slot:"channel_slot",width:"600px"},{prop:"notify_time",label:"操作",align:"center",slot:"operate_slot",width:"200px"}],tableData:[],searchFields:[{prop:"name",label:"通道名称",type:"input",value:""}],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:""}},showBatchFateSetting:!1,showRiskControlDialog:!1,batchSettingType:"1",showAddPayChannel:!1,currentRow:{},showSingleFee:!1,showSelectChannel:!1}),H=()=>{O.searchFields.forEach(e=>{"datetimerange"==e.dateType?e.value=[]:e.value=""}),M()};l(()=>{M()});const M=()=>{var e,t;O.loading=!0;let a={limit:O.per_page,page:O.page},l=function(e){const t={};return e.forEach(e=>{e.prop&&void 0!==e.value&&(t[e.prop]=e.value)}),t}(O.searchFields);(null==(e=l.created_at)?void 0:e.length)>0&&(l.created_at_start=l.created_at[0]?o(l.created_at[0]):"",l.created_at_end=l.created_at[1]?o(l.created_at[1]):""),(null==(t=l.completed_at)?void 0:t.length)>0&&(l.completed_at_start=l.completed_at[0]?o(l.completed_at[0]):"",l.completed_at_end=l.completed_at[1]?o(l.completed_at[1]):""),F(Object.assign(a,l)).then(e=>{O.tableData=e.data,O.total=e.total,O.loading=!1}).catch(()=>{O.loading=!1})},q=()=>{O.showBatchSettingDialog=!0},G=()=>{O.showBatchSettingDialog=!1},K=()=>{O.showAddPayChannel=!0,O.currentRow={}},L=e=>{},N=e=>{e.id?E(e).then(e=>{U.success("修改成功"),O.showAddPayChannel=!1,M()}):z(e).then(e=>{U.success("添加成功"),O.showAddPayChannel=!1,M()})},Q=()=>{M()},X=e=>{j({ids:[e]}).then(e=>{M()})};return(e,t)=>{const a=u,l=V,o=n("EditPen"),F=v,j=x,z=y,E=w,Y=g,Z=_,J=m,W=c,$=D,ee=k;return r(),s("div",null,[i($,{type:"export",columns:B(O).columns,searchFields:B(O).searchFields,"onUpdate:searchFields":t[0]||(t[0]=e=>B(O).searchFields=e),data:B(O).tableData,per_page:B(O).per_page,"onUpdate:per_page":t[1]||(t[1]=e=>B(O).per_page=e),page:B(O).page,"onUpdate:page":t[2]||(t[2]=e=>B(O).page=e),total:B(O).total,onGetTableData:M,onResetForm:H,loading:B(O).loading,showSelection:!1,showRightRefreshSlot:!1},{btns:p(({row:e})=>[i(a,{type:"primary",onClick:q},{default:p(()=>t[7]||(t[7]=[h("批量开启/关闭")])),_:1,__:[7]}),i(a,{type:"primary",onClick:K},{default:p(()=>t[8]||(t[8]=[h("添加支付通道")])),_:1,__:[8]})]),pr_slot:p(({row:e})=>[e.edit?f("",!0):(r(),C(l,{key:0},{default:p(()=>[h(b(e.pr),1)]),_:2},1024)),e.edit?f("",!0):(r(),C(l,{key:1,type:"primary",onClick:t=>e.edit=!0},{default:p(()=>[i(F,null,{default:p(()=>[i(o)]),_:1})]),_:2},1032,["onClick"])),e.edit?(r(),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"])):f("",!0),e.edit?(r(),C(a,{key:3,type:"primary",style:{"margin-left":"4px"},size:"small",onClick:t=>(e=>{e.id,e.code,e.name,e.pr,e.status,e.supplierApi.some(t=>t.pr-e.pr>0)?S({title:"提示",message:'<span style="color: red">通道费率小于渠道成本</span>',confirmButtonText:"我已知晓",cancelButtonText:"取消",showCancelButton:!0,type:"warning",dangerouslyUseHTMLString:!0}).then(()=>{S.alert("确定修改通道费率吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",showCancelButton:!0,type:"warning"}).then(()=>{editUserFee(params).then(e=>{M()})}).catch(()=>{e.edit=!1})}).catch(()=>{e.edit=!1}):S.alert("确定修改通道费率吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",showCancelButton:!0,type:"warning"}).then(()=>{editUserFee(params).then(e=>{M()})}).catch(()=>{e.edit=!1})})(e)},{default:p(()=>t[9]||(t[9]=[h("保存")])),_:2,__:[9]},1032,["onClick"])):f("",!0)]),status_slot:p(({row:e})=>[i(z,{modelValue:e.status,"onUpdate:modelValue":t=>e.status=t,"active-value":1,"inactive-value":2,"inline-prompt":"","active-text":"开启","inactive-text":"关闭",onChange:t=>(e=>{S.alert("是否确定对当前产品进行状态切换?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",showCancelButton:!0,type:"warning"}).then(()=>{P({id:e.id,status:e.status}).then(e=>{U.success("修改成功!")})}).catch(()=>{e.status=1==e.status?2:1})})(e)},null,8,["modelValue","onUpdate:modelValue","onChange"])]),channel_slot:p(({row:e})=>[i(a,{type:"primary",style:{margin:"4px"},size:"small",onClick:t=>(e=>{O.currentRow=e,O.showSelectChannel=!0})(e)},{default:p(()=>t[10]||(t[10]=[h("添加渠道")])),_:2,__:[10]},1032,["onClick"]),i(J,{data:e.supplierApi,style:{width:"100%"},onSelectionChange:L},{default:p(()=>[i(Y,{width:"55"},{default:p(t=>[i(E,{modelValue:t.row.pivot.status,"onUpdate:modelValue":e=>t.row.pivot.status=e,"true-value":1,"false-value":2,onChange:a=>((e,t)=>{1==e.pivot.status&&t-e.pr<0?S.alert("当前渠道费率高于支付通道费率,是否确定开启此通道","提示",{confirmButtonText:"确定开启",cancelButtonText:"取消",showCancelButton:!0,type:"warning"}).then(()=>{A({id:e.pivot.id,status:e.pivot.status})}).catch(()=>{e.pivot.status=2}):A({id:e.pivot.id,status:e.pivot.status})})(t.row,e.pr)},null,8,["modelValue","onUpdate:modelValue","onChange"])]),_:2},1024),i(Y,{label:"渠道代码",prop:"code"}),i(Y,{label:"渠道名称",prop:"name"}),i(Y,{label:"渠道成本费率",prop:"pr"}),i(Y,{label:"权重(1-9)"},{default:p(e=>[i(Z,{modelValue:e.row.pivot.weight,"onUpdate:modelValue":t=>e.row.pivot.weight=t,type:"number",onInput:t=>((e,t)=>{t&&A({id:e.pivot.id,weight:t})})(e.row,e.row.pivot.weight),placeholder:"请输入内容"},null,8,["modelValue","onUpdate:modelValue","onInput"])]),_:2},1024),i(Y,{label:"操作"},{default:p(e=>[i(a,{type:"danger",size:"small",onClick:t=>(e=>{S.alert("确定解除支付通道与此渠道的绑定吗","提示",{confirmButtonText:"确定",cancelButtonText:"取消",showCancelButton:!0,type:"warning"}).then(()=>{X(e.pivot.id)}).catch(()=>{})})(e.row)},{default:p(()=>t[11]||(t[11]=[h("解绑")])),_:2,__:[11]},1032,["onClick"])]),_:2},1024)]),_:2},1032,["data"])]),operate_slot:p(({row:l})=>[d("div",I,[i(W,{style:{"margin-bottom":"4px"}},{default:p(()=>[i(a,{type:"primary",onClick:e=>(e=>{O.showAddPayChannel=!0,O.currentRow=e})(l),size:"small"},{default:p(()=>t[12]||(t[12]=[h("编辑")])),_:2,__:[12]},1032,["onClick"]),i(a,{type:"primary",onClick:t=>e.handleFeeRisk(l),size:"small"},{default:p(()=>t[13]||(t[13]=[h("删除")])),_:2,__:[13]},1032,["onClick"])]),_:2},1024)])]),_:1},8,["columns","searchFields","data","per_page","page","total","loading"]),i(ee,{showDialog:B(O).showBatchSettingDialog,"onUpdate:showDialog":t[3]||(t[3]=e=>B(O).showBatchSettingDialog=e),formData:B(O).batchSetting,"onUpdate:formData":t[4]||(t[4]=e=>B(O).batchSetting=e),ref:"productRef"},{submit:p(()=>[i(a,{type:"primary",onClick:G},{default:p(()=>t[14]||(t[14]=[h("确定")])),_:1,__:[14]})]),_:1},8,["showDialog","formData"]),i(R,{showAddPayChannel:B(O).showAddPayChannel,"onUpdate:showAddPayChannel":t[5]||(t[5]=e=>B(O).showAddPayChannel=e),onConfirmAddPayChannel:N,currentRow:B(O).currentRow},null,8,["showAddPayChannel","currentRow"]),i(T,{showSelectChannel:B(O).showSelectChannel,"onUpdate:showSelectChannel":t[6]||(t[6]=e=>B(O).showSelectChannel=e),currentRow:B(O).currentRow,onConfirmSelect:Q},null,8,["showSelectChannel","currentRow"])])}}},[["__scopeId","data-v-adc81e4d"]]);export{O as default};
|