sf_web_dist/js/add-channel.Dg1b_8sT.js
2025-08-19 16:39:02 +08:00

2 lines
6.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{ag as e,r as l,D as a,m as t,e as o,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 g,d3 as b,l as v,an as V,aX as w,a_ as C}from"./index.mTcqLH5d.js";import{g as A}from"./payee-suppiler.B0nQhxL5.js";import{a as U}from"./payee-channel.DjKE5cIY.js";const k={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:""}),j=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"}]}),q=l([]),F=l([]),O=l(!1);a(()=>T.showAddChannel,e=>{if(e&&(E(),P(),"{}"!=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}),O.value=!0}});const E=()=>{A({saiType:"all"}).then(e=>{q.value=[],e.forEach(e=>{q.value.push({label:e.supplier_name,value:e.shop_id})})})},P=()=>{U({saiType:"all",status:"1"}).then(e=>{F.value=[],e.forEach(e=>{F.value.push({label:e.name,value:e.id})})})},N=x,S=()=>{X.value.resetFields(),N("update:showAddChannel",!1)},X=l(),D=()=>{O.value?H():X.value.validate(e=>{e&&(R.pay_info=[],R.product_id.length>0&&R.pay_info.push({id:R.product_id}),N("update:showAddChannel",!1),N("confirmAddChannel",R),X.value.resetFields())})},H=()=>{X.value.validate(e=>{var l;if(e){R.pay_info=[],R.product_id.length>0&&R.pay_info.push({id:R.product_id});let e=[];null==(l=null==T?void 0:T.currentRow)||l.payProduct.forEach(l=>{T.currentRow.pr-l.pr>0&&e.push(l.name)}),e.length>0&&1==R.status?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(()=>{N("update:showAddChannel",!1),N("confirmAddChannel",R),X.value.resetFields()}).catch(()=>{})}).catch(()=>{}):C.alert("确定修改渠道吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",showCancelButton:!0,type:"warning"}).then(()=>{N("update:showAddChannel",!1),N("confirmAddChannel",R),X.value.resetFields()}).catch(()=>{})}})};return(e,l)=>{const a=h,C=i,A=p,U=f,x=b,T=g,O=r,E=V,P=w;return o(),t(P,{"model-value":B.showAddChannel,title:"添加渠道配置",width:"600","before-close":S},{footer:d(()=>[v("div",k,[u(E,{type:"primary",onClick:D},{default:d(()=>l[14]||(l[14]=[y(" 提交保存 ")])),_:1,__:[14]})])]),default:d(()=>[u(O,{model:n(R),"label-width":"auto",ref_key:"channelRef",ref:X,rules:n(j)},{default:d(()=>[u(A,{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(()=>[(o(!0),c(m,null,_(n(q),(e,l)=>(o(),t(a,{key:l,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),u(A,{label:"中文名称",prop:"name"},{default:d(()=>[u(U,{modelValue:n(R).name,"onUpdate:modelValue":l[1]||(l[1]=e=>n(R).name=e),placeholder:"请输入中文名称"},null,8,["modelValue"])]),_:1}),u(A,{label:"英文名称",prop:"code"},{default:d(()=>[u(U,{modelValue:n(R).code,"onUpdate:modelValue":l[2]||(l[2]=e=>n(R).code=e),placeholder:"注意即支付渠道类名称不含Controller"},null,8,["modelValue"])]),_:1}),u(A,{label:"网关网站",prop:"gateway"},{default:d(()=>[u(U,{modelValue:n(R).gateway,"onUpdate:modelValue":l[3]||(l[3]=e=>n(R).gateway=e),placeholder:"请输入网关网站地址"},null,8,["modelValue"])]),_:1}),u(A,{label:"页面通知",prop:"notify_url"},{default:d(()=>[u(U,{modelValue:n(R).notify_url,"onUpdate:modelValue":l[4]||(l[4]=e=>n(R).notify_url=e),placeholder:"请输入页面通知地址"},null,8,["modelValue"])]),_:1}),u(A,{label:"服务器通知",prop:"notify_server"},{default:d(()=>[u(U,{modelValue:n(R).notify_server,"onUpdate:modelValue":l[5]||(l[5]=e=>n(R).notify_server=e),placeholder:"请输入服务器通知地址"},null,8,["modelValue"])]),_:1}),u(A,{label:"成本费率(‰)",prop:"pr"},{default:d(()=>[u(U,{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):(o(),t(A,{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(()=>[(o(!0),c(m,null,_(n(F),(e,l)=>(o(),t(a,{key:l,label:e.label,value:e.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})),u(A,{label:"支付通道方法",prop:"class_name"},{default:d(()=>[u(U,{modelValue:n(R).class_name,"onUpdate:modelValue":l[8]||(l[8]=e=>n(R).class_name=e),placeholder:"支付通道方法"},null,8,["modelValue"])]),_:1}),u(A,{label:"防封域名",prop:"bak_url"},{default:d(()=>[u(U,{modelValue:n(R).bak_url,"onUpdate:modelValue":l[9]||(l[9]=e=>n(R).bak_url=e),placeholder:"请输入防封域名"},null,8,["modelValue"])]),_:1}),u(A,{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};