import{_ as e}from"./s-empty.b6c95127.js";import{C as a,c as t,p as s,o as l,e as o,w as i,s as r,b as p,k as n,i as u,u as d,y as c,f as m,h as f,F as y,j as g,z as _,E as h,a1 as b,d as x,l as k,m as v,I as w,J as $,B}from"./index-520dfaee.js";import{g as j,i as V,h as C,b as L,a as A}from"./s-layout.5146c957.js";import{_ as I}from"./s-uploader.026e8b76.js";import{_ as U}from"./_plugin-vue_export-helper.1b428a4d.js";/* empty css                                                                */const M=U({__name:"apply",setup(U){const M=a({code:-1,status:"-",config:{},isAgree:!1,formList:[],protocol:{},applyInfo:[],background:"",imgHeight:400});function E(){M.isAgree=!M.isAgree}const H=t((()=>"normal"===M.status?"修改信息":"needinfo"===M.status?"提交审核":"reject"===M.status?"重新提交":""));async function S(){const{code:e,data:a}=await r.$api.commission.form();M.code=e,1===e&&(M.status=a.status,M.background=a.background,M.formList=a.form,M.applyInfo=a.applyInfo,M.protocol=a.protocol,1!=a.protocol.status&&(M.isAgree=!0),M.formList.forEach((e=>{const a=M.applyInfo.find((a=>a.type===e.type&&a.name===e.name));void 0!==a&&(e.value=a.value)})))}function z(e){M.imgHeight=e.detail.height/e.detail.width*750-88}async function F(){if(!M.isAgree)return void r.$helper.toast("请同意申请协议");if(!M.formList.every((e=>!b.isEmpty(e.value)||("image"!==e.type?r.$helper.toast(`请填写${e.name}`):r.$helper.toast(`请上传${e.name}`),!1))))return;const{code:e}=await r.$api.commission.apply({data:M.formList});1===e&&r.$router.back()}return s((()=>{S()})),(a,t)=>{const s=p(x("s-empty"),e),b=k,U=v,S=p(x("uni-easyinput"),j),G=p(x("s-uploader"),I),T=p(x("uni-forms-item"),V),q=p(x("uni-forms"),C),J=w,D=$,K=B,N=p(x("su-fixed"),L),O=p(x("s-layout"),A);return l(),o(O,{title:"申请分销商",class:"apply-wrap",navbar:"inner"},{default:i((()=>[0===M.code?(l(),o(s,{key:0,paddingTop:"0",icon:"/static/comment-empty.png",text:"未开启分销商申请"})):n("",!0),1===M.code?(l(),o(U,{key:1,class:"distribution-apply-wrap"},{default:i((()=>[u(U,{class:"apply-header"},{default:i((()=>[u(U,{class:"header-box ss-flex"},{default:i((()=>[u(b,{class:"bg-img",src:d(r).$url.cdn(M.background),mode:"widthFix",onLoad:z},null,8,["src"]),u(U,{class:"heaer-title"},{default:i((()=>[c("申请分销商")])),_:1})])),_:1})])),_:1}),u(U,{class:"apply-box bg-white",style:h({marginTop:M.imgHeight+"rpx"})},{default:i((()=>{var e;return[u(q,{"label-width":"200",model:M.model,rules:M.rules,border:"",class:"form-box"},{default:i((()=>[u(U,{class:"item-box"},{default:i((()=>[(l(!0),m(y,null,f(M.formList,((e,a)=>(l(),o(T,{key:a,label:e.name,required:!0,"label-position":"image"==e.type?"top":"left"},{default:i((()=>["image"!==e.type?(l(),o(S,{key:0,inputBorder:!1,type:e.type,styles:{disableColor:"#fff"},placeholderStyle:"color:#BBBBBB;font-size:28rpx;line-height:normal",modelValue:e.value,"onUpdate:modelValue":a=>e.value=a,placeholder:`请填写${e.name}`},null,8,["type","modelValue","onUpdate:modelValue","placeholder"])):n("",!0),"image"===e.type?(l(),o(G,{key:1,modelValue:e.aaa,"onUpdate:modelValue":a=>e.aaa=a,url:e.value,"onUpdate:url":a=>e.value=a,fileMediatype:"image",limit:"1",mode:"grid",imageStyles:{width:"168rpx",height:"168rpx"},class:"file-picker"},null,8,["modelValue","onUpdate:modelValue","url","onUpdate:url"])):n("",!0)])),_:2},1032,["label","label-position"])))),128))])),_:1})])),_:1},8,["model","rules"]),1==(null==(e=M.protocol)?void 0:e.status)?(l(),o(D,{key:0,class:"ss-flex ss-m-t-20",onClick:E},{default:i((()=>[u(J,{checked:M.isAgree,color:"var(--ui-BG-Main)",style:{transform:"scale(0.6)"},onClick:g(E,["stop"])},null,8,["checked","onClick"]),u(U,{class:"agreement-text ss-flex"},{default:i((()=>[u(U,{class:"ss-m-r-4"},{default:i((()=>[c("勾选代表同意")])),_:1}),u(U,{class:"tcp-text",onClick:t[0]||(t[0]=g((e=>d(r).$router.go("/pages/public/richtext",{id:M.protocol.id,title:M.protocol.title})),["stop"]))},{default:i((()=>[c(" 《"+_(M.protocol.title)+"》 ",1)])),_:1})])),_:1})])),_:1})):n("",!0),u(N,{bottom:"",placeholder:""},{default:i((()=>[u(U,{class:"submit-box ss-flex ss-row-center ss-p-30"},{default:i((()=>[u(K,{class:"submit-btn ss-reset-button ui-BG-Main ui-Shadow-Main",onClick:F},{default:i((()=>[c(_(d(H)),1)])),_:1})])),_:1})])),_:1})]})),_:1},8,["style"])])),_:1})):n("",!0)])),_:1})}}},[["__scopeId","data-v-712e93f4"]]);export{M as default};
