gameapi-client/dist-API/assets/AddMerchantsDialog.Bi0RXl5j.js

2 lines
6.4 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import{r as u,z as Y,C as x,F as U,w as ee,k as s,o as C,m as T,e as n,n as S,d as l,q as m,t as i,f as r,c as te,K as ae,L as le,p as oe,H as ne,I as re,D as se,h as ue}from"./index.R3qQMktZ.js";import{s as de,f as pe,h as me}from"./tenant.5hwMVhFj.js";import{a as ie}from"./index.BhcO8UcA.js";import{C as ce}from"./index.DU8FQYf7.js";/* empty css */const fe={class:"label-scoreRatio"},ge={class:"dialog-footer"},we={__name:"AddMerchantsDialog",props:{show:{type:Boolean,default:!1},modifyDate:{type:Object,default:{}},addEditStatus:{type:String,default:"add"}},emits:["submit","update:show"],setup(D,{emit:O}){const{proxy:d}=ue(),{ff_tenant_type:z,ff_tenant_status:_e}=d.useDict("ff_tenant_type","ff_tenant_status"),$=O,B=D;u(B.addEditStatus=="detail");const w=u(null);u([]);const A=u([]),J=u([]),g=Y({get(){return B.show},set(e){$("update:show",e)}}),a=x({account:"",password:"",scoreRatio:1,tenantType:1,tenantSystemPlatforms:[],realBalance:[]}),j=u({account:[{required:!0,message:d.t("商户账号不能为空"),trigger:"change"},{pattern:/^[a-zA-Z0-9_]{4,15}$/,message:d.t("请输入4-15位字符"),trigger:"change"}],password:[{required:!0,message:d.t("密码不能为空"),trigger:"change"}],scoreRatio:[{required:!0,message:d.t("买分比例不能为空"),trigger:"change"}],tenantType:[{required:!0,message:d.t("商户模式不能为空"),trigger:"change"}],realBalanceNum:[{required:!0,message:d.t("信誉额度不能为空"),trigger:"change"}],timeZone:[{required:!0,message:d.t("时区不能为空"),trigger:"change"}]}),c=u({pageNum:1,pageSize:100,orderByColumn:"platformCode",isAsc:"desc"}),V=u(0);function N(){ie(c.value).then(e=>{a.tenantSystemPlatforms=e.rows,V.value=e.total,A.value=JSON.parse(JSON.stringify(e.rows))})}const P=u(!1);function E(){P.value=!0,de({}).then(e=>{let t=e.data.map(p=>({...p,balance:"",currencyCode:p.currencyCode}));a.realBalance=t,J.value=JSON.parse(JSON.stringify(t)),P.value=!1})}const R=u([]),h=u(!0),F=()=>{h.value=!1,pe({}).then(e=>{R.value=e.data.map(t=>({value:t.code,label:t.name})),h.value=!0})};U(()=>{N(),E(),F()}),U(()=>{ee(()=>{var e;return[(e=w==null?void 0:w.value)==null?void 0:e.getLangContentList()]},([e],[t])=>{(e==null?void 0:e.length)>0&&(a.name=e[0].content)},{deep:!0})});const k=()=>{g.value=!1},_=u(0);function Z(e){a.tenantSystemPlatforms=a.tenantSystemPlatforms.map((t,p)=>(e=="del"&&t.useCost>t.cost?t.useCost-=.5:e=="add"&&(t.useCost+=.5),t)),e==="del"&&_.value>0?_.value-=.5:e==="add"&&(_.value+=.5),a.proportion=_.value}u(null);function I(){d.$refs.agentRef.validate(e=>{if(e){a.realBalance.map(p=>({balance:p.balance,currencyCode:p.currencyCode}));let t={account:a.account,password:a.password,realBalance:[],scoreRatio:a.scoreRatio,tenantType:a.tenantType,proportion:a.proportion||0,timeZone:a.timeZone||""};me(t).then(p=>{d.$modal.msgSuccess(d.t("新增成功")),k(),getList()})}})}return(e,t)=>{const p=s("el-input"),f=s("el-form-item"),b=s("el-col"),q=s("el-row"),L=s("el-radio-button"),H=s("el-radio-group"),K=s("el-input-number"),y=s("el-button"),v=s("el-table-column"),M=s("el-table"),G=s("pagination"),Q=s("el-form"),W=s("el-scrollbar"),X=s("el-dialog");return C(),T(X,{title:e.t("添加商户"),modelValue:r(g),"onUpdate:modelValue":t[9]||(t[9]=o=>se(g)?g.value=o:null),width:"820px","append-to-body":""},{footer:n(()=>[S("div",ge,[l(y,{type:"primary",onClick:I},{default:n(()=>[m(i(e.t("确 定")),1)]),_:1}),l(y,{onClick:k},{default:n(()=>[m(i(e.t("取 消")),1)]),_:1})])]),default:n(()=>[l(W,{"max-height":"600px"},{default:n(()=>[l(Q,{ref:"agentRef",model:r(a),rules:j.value,"label-width":"120px"},{default:n(()=>[l(q,null,{default:n(()=>[l(b,{span:12},{default:n(()=>[l(f,{label:e.t("商户账号"),prop:"account"},{default:n(()=>[l(p,{modelValue:r(a).account,"onUpdate:modelValue":t[0]||(t[0]=o=>r(a).account=o),placeholder:e.t("请输入商户账号")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1}),l(b,{span:12},{default:n(()=>[l(f,{label:e.t("密码"),prop:"password"},{default:n(()=>[l(p,{modelValue:r(a).password,"onUpdate:modelValue":t[1]||(t[1]=o=>r(a).password=o),"auto-complete":"off",type:"password",placeholder:e.t("请输入商户账号")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1})]),_:1}),l(q,null,{default:n(()=>[l(b,{span:12},{default:n(()=>[l(f,{label:e.t("商户模式"),prop:"tenantType"},{default:n(()=>[l(H,{modelValue:r(a).tenantType,"onUpdate:modelValue":t[2]||(t[2]=o=>r(a).tenantType=o)},{default:n(()=>[(C(!0),te(ae,null,le(r(z),o=>(C(),T(L,{key:o.value,value:o.value},{default:n(()=>[m(i(o.label),1)]),_:2},1032,["value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1}),l(b,{span:12},{default:n(()=>[l(f,{label:e.t("时区"),prop:"timeZone"},{default:n(()=>[h.value?(C(),T(r(ce),{key:0,modelValue:r(a).timeZone,"onUpdate:modelValue":t[3]||(t[3]=o=>r(a).timeZone=o),options:R.value,placeholder:"请选择币种",style:{width:"200px"}},null,8,["modelValue","options"])):oe("",!0)]),_:1},8,["label"])]),_:1})]),_:1}),l(f,{label:e.t("买分比例"),prop:"scoreRatio"},{default:n(()=>[l(K,{modelValue:r(a).scoreRatio,"onUpdate:modelValue":t[4]||(t[4]=o=>r(a).scoreRatio=o),precision:1,min:.9,step:.1,max:2},null,8,["modelValue"]),m("   "+i(e.t(" (万法定货币=1万通用额度)")),1)]),_:1},8,["label"]),S("div",fe,[S("span",null,i(e.t("平台比例")),1),S("div",null,[l(y,{type:"danger",onClick:t[5]||(t[5]=o=>Z("del")),disabled:!r(a).tenantSystemPlatforms.length},{default:n(()=>[m("-0.5")]),_:1},8,["disabled"]),l(y,{type:"primary",onClick:t[6]||(t[6]=o=>Z("add")),disabled:!r(a).tenantSystemPlatforms.length},{default:n(()=>[m("+0.5")]),_:1},8,["disabled"])])]),l(M,{data:r(a).tenantSystemPlatforms,class:"scoreRatioTable"},{default:n(()=>[l(v,{label:e.t("平台"),align:"center",prop:"platformCode"},null,8,["label"]),l(v,{label:e.t("币种"),align:"center",prop:"currencyCode"},null,8,["label"]),l(v,{label:e.t("成本比例(%"),align:"center",prop:"cost"},{default:n(o=>[m(i(o.row.cost)+"% ",1)]),_:1},8,["label"]),l(v,{label:e.t("商户通用比例(%"),align:"center",prop:"useCost"},{default:n(o=>[m(i(o.row.useCost)+"% ",1)]),_:1},8,["label"])]),_:1},8,["data"]),ne(l(G,{total:V.value,page:c.value.pageNum,"onUpdate:page":t[7]||(t[7]=o=>c.value.pageNum=o),limit:c.value.pageSize,"onUpdate:limit":t[8]||(t[8]=o=>c.value.pageSize=o),onPagination:N},null,8,["total","page","limit"]),[[re,V.value>0]])]),_:1},8,["model","rules"])]),_:1})]),_:1},8,["title","modelValue"])}}};export{we as default};