2 lines
5.9 KiB
JavaScript
2 lines
5.9 KiB
JavaScript
import{ag as e,r as l,D as a,m as o,e as t,w as d,N as u,bo as r,g as n,al as s,bp as p,bW as i,c,a7 as m,a8 as _,bX as h,am as f,O as y,bO as b,d3 as g,l as V,an as w,aX as v,a_ as C}from"./index.BwAC69Ng.js";import{g as U}from"./payee-suppiler.CHbksLZE.js";import{a as k}from"./payee-channel.D41yhsm3.js";const A={class:"dialog-footer"},B={__name:"add-channel",props:{showAddChannel:{type:Boolean,default:!1},currentRow:{type:Object,default:{}}},emits:["update:showAddChannel","confirmAddChannel"],setup(B,{emit:x}){const T=B,R=e({shop_id:"",name:"",code:"",gateway:"",notify_url:"",notify_server:"",pr:"",bak_url:"",status:"",product_id:[],class_name:""}),q=e({shop_id:[{required:!0,message:"请选择供应商",trigger:"change"}],name:[{required:!0,message:"请输入中文名称",trigger:"blur"}],code:[{required:!0,message:"请输入英文名称",trigger:"blur"}],pr:[{required:!0,message:"请输入费率",trigger:"blur"}],status:[{required:!0,message:"请选择状态",trigger:"change"}],product_id:[{required:!0,message:"请选择支付通道",trigger:"change"}]}),j=l([]),O=l([]);a(()=>T.showAddChannel,e=>{if(e&&(E(),F(),"{}"!=JSON.stringify(T.currentRow))){let e=T.currentRow;R.code=e.code,R.name=e.name,R.shop_id=e.shop_id,R.gateway=e.gateway,R.status=e.status,R.notify_url=e.notify_url,R.notify_server=e.notify_server,R.pr=e.pr,R.bak_url=e.bak_url,R.id=e.id,R.class_name=e.class_name,e.payProduct&&e.payProduct.map(e=>{R.product_id=e.id})}});const E=()=>{U({saiType:"all"}).then(e=>{j.value=[],e.forEach(e=>{j.value.push({label:e.supplier_name,value:e.shop_id})})})},F=()=>{k({saiType:"all",status:"1"}).then(e=>{O.value=[],e.forEach(e=>{O.value.push({label:e.name,value:e.id})})})},P=x,N=()=>{S.value.resetFields(),P("update:showAddChannel",!1)},S=l(),X=()=>{S.value.validate(e=>{if(e){R.pay_info=[],R.pay_info.push({id:R.product_id});let e=[];T.currentRow.payProduct.forEach(l=>{T.currentRow.pr-l.pr>0&&e.push(l.name)}),e.length>0?C({title:"提示",message:`<span style="color: red">通道[${e.join(",")}]费率小于渠道成本</span>`,confirmButtonText:"我已知晓",cancelButtonText:"取消",showCancelButton:!0,type:"warning",dangerouslyUseHTMLString:!0}).then(()=>{C.alert("确定修改渠道吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",showCancelButton:!0,type:"warning"}).then(()=>{P("update:showAddChannel",!1),P("confirmAddChannel",R),S.value.resetFields()}).catch(()=>{})}).catch(()=>{}):C.alert("确定修改渠道吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",showCancelButton:!0,type:"warning"}).then(()=>{P("update:showAddChannel",!1),P("confirmAddChannel",R),S.value.resetFields()}).catch(()=>{})}})};return(e,l)=>{const a=h,C=i,U=p,k=f,x=g,T=b,E=r,F=w,P=v;return t(),o(P,{"model-value":B.showAddChannel,title:"添加渠道配置",width:"600","before-close":N},{footer:d(()=>[V("div",A,[u(F,{type:"primary",onClick:X},{default:d(()=>l[14]||(l[14]=[y(" 提交保存 ")])),_:1,__:[14]})])]),default:d(()=>[u(E,{model:n(R),"label-width":"auto",ref_key:"channelRef",ref:S,rules:n(q)},{default:d(()=>[u(U,{label:"供应商",prop:"shop_id"},{default:d(()=>[u(C,{modelValue:n(R).shop_id,"onUpdate:modelValue":l[0]||(l[0]=e=>n(R).shop_id=e),placeholder:"选择供应商",filterable:"",clearable:""},{default:d(()=>[(t(!0),c(m,null,_(n(j),(e,l)=>(t(),o(a,{key:l,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),u(U,{label:"中文名称",prop:"name"},{default:d(()=>[u(k,{modelValue:n(R).name,"onUpdate:modelValue":l[1]||(l[1]=e=>n(R).name=e),placeholder:"请输入中文名称"},null,8,["modelValue"])]),_:1}),u(U,{label:"英文名称",prop:"code"},{default:d(()=>[u(k,{modelValue:n(R).code,"onUpdate:modelValue":l[2]||(l[2]=e=>n(R).code=e),placeholder:"注意:即支付渠道类名称(不含Controller)"},null,8,["modelValue"])]),_:1}),u(U,{label:"网关网站",prop:"gateway"},{default:d(()=>[u(k,{modelValue:n(R).gateway,"onUpdate:modelValue":l[3]||(l[3]=e=>n(R).gateway=e),placeholder:"请输入网关网站地址"},null,8,["modelValue"])]),_:1}),u(U,{label:"页面通知",prop:"notify_url"},{default:d(()=>[u(k,{modelValue:n(R).notify_url,"onUpdate:modelValue":l[4]||(l[4]=e=>n(R).notify_url=e),placeholder:"请输入页面通知地址"},null,8,["modelValue"])]),_:1}),u(U,{label:"服务器通知",prop:"notify_server"},{default:d(()=>[u(k,{modelValue:n(R).notify_server,"onUpdate:modelValue":l[5]||(l[5]=e=>n(R).notify_server=e),placeholder:"请输入服务器通知地址"},null,8,["modelValue"])]),_:1}),u(U,{label:"成本费率(‰)",prop:"pr"},{default:d(()=>[u(k,{modelValue:n(R).pr,"onUpdate:modelValue":l[6]||(l[6]=e=>n(R).pr=e),placeholder:"‰,例如:千分之一填 0.001",style:{width:"300px"}},null,8,["modelValue"]),l[11]||(l[11]=y("‰ "))]),_:1,__:[11]}),B.currentRow.id?s("",!0):(t(),o(U,{key:0,label:"选择支付通道",prop:"product_id"},{default:d(()=>[u(C,{modelValue:n(R).product_id,"onUpdate:modelValue":l[7]||(l[7]=e=>n(R).product_id=e),placeholder:"选择支付产品",filterable:"",clearable:""},{default:d(()=>[(t(!0),c(m,null,_(n(O),(e,l)=>(t(),o(a,{key:l,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})),u(U,{label:"支付通道方法",prop:"class_name"},{default:d(()=>[u(k,{modelValue:n(R).class_name,"onUpdate:modelValue":l[8]||(l[8]=e=>n(R).class_name=e),placeholder:"支付通道方法"},null,8,["modelValue"])]),_:1}),u(U,{label:"防封域名",prop:"bak_url"},{default:d(()=>[u(k,{modelValue:n(R).bak_url,"onUpdate:modelValue":l[9]||(l[9]=e=>n(R).bak_url=e),placeholder:"请输入防封域名"},null,8,["modelValue"])]),_:1}),u(U,{label:"状态",prop:"status"},{default:d(()=>[u(T,{modelValue:n(R).status,"onUpdate:modelValue":l[10]||(l[10]=e=>n(R).status=e)},{default:d(()=>[u(x,{value:1},{default:d(()=>l[12]||(l[12]=[y("开启")])),_:1,__:[12]}),u(x,{value:2},{default:d(()=>l[13]||(l[13]=[y("关闭")])),_:1,__:[13]})]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["model-value"])}}};export{B as default};
|