import{_ as e,a,b as l}from"./phone-international-input.pCSce8vH.js";import{c as r,v as t,t as o,r as d,a2 as n,o as i,I as s,c7 as u,bT as c,a as m,b as p,d as h,w as b,u as _,s as f,e as g,x as y,f as S,g as v,j as w,z as V,F as x,i as q,O as k}from"./index-Dhufwzns.js";import{_ as U}from"./s-uploader.CtsEPV3k.js";import{_ as C}from"./uni-data-picker.QbAa0K9d.js";import{a as E,_ as M}from"./s-layout.UkBM_zOd.js";import"./phone-international-input.vue_vue_type_style_index_0_scoped_87b92f91_lang.E5-DcFQJ.js";import{_ as B}from"./_plugin-vue_export-helper.BCo6x5W8.js";import"./uni-icons.CqGKW-3y.js";import"./uni-cloud.es.Doqgjrqq.js";import"./uni-load-more.CFP12jIR.js";import"./s-menu-tools.BxnijmDR.js";import"./s-search-block.vue_vue_type_style_index_0_scoped_f692e81a_lang.DInbba3a.js";import"./s-layout.vue_vue_type_style_index_0_scoped_05ef8b08_lang.DrO-exW9.js";import"./s-search-block.o4Jo1XRm.js";const L="color:#BBBBBB;font-size:28rpx;line-height:normal",P=B({__name:"merchant",setup(B){const P=r((()=>f.$store("user").userInfo)),j=t({canUse:!0,userApplyStatus:!1,formStatus:!1,changeIng:!1,model:{checkStatus:void 0,id:void 0,name:void 0,status:void 0,description:void 0,contact:void 0,address:void 0,contactNumber:void 0,website:void 0,createTime:void 0,complaintsHotline:void 0,customerServiceHotline:void 0,email:void 0,businessLicensePicture:void 0,expireTime:void 0,areaId:void 0,accountName:void 0,accountNumber:void 0,bankName:void 0,logoUrl:void 0,brandLicensing:void 0,otherCertificate:[],legalPerson:void 0,legalPersonNumber:void 0,identityCardFront:void 0,identityCardReverseSide:void 0},areaIdError:"",businessLicensePictureError:"",brandLicensingError:"",identityCardFrontError:"",identityCardReverseSideError:"",rules:{name:{rules:[{required:!0,errorMessage:o("merchant.merchant_name_required")}]},contact:{rules:[{required:!0,errorMessage:o("merchant.contact_required")}]},contactNumber:{rules:[{required:!0,errorMessage:o("merchant.contact_phone_required")}]}}}),I=r((()=>{const e=j.model.checkStatus;return 0===e?o("merchant.under_review"):1===e?o("merchant.approved"):2===e?o("merchant.rejected"):""})),N=()=>{const e=document.createElement("a");e.href="https://zxgz.newfeifan.cn/static/file/%E9%9D%9E%E7%8B%AC%E5%AE%B6%E5%93%81%E7%89%8C%E6%8E%88%E6%9D%83%E4%B9%A6.docx",e.download=o("merchant.non_exclusive_authorization")+".docx",document.body.appendChild(e),e.click(),document.body.removeChild(e)},A=d(null),F=async()=>{if(!(await _(A).validate().catch((e=>{console.log("error: ",e)}))))return;if(!j.model.businessLicensePicture)return void(j.businessLicensePictureError=o("merchant.upload_business_license"));if(!j.model.brandLicensing)return void(j.brandLicensingError=o("merchant.upload_brand_authorization"));const{data:e,code:a}=await u.createMerchant(j.model);0===a&&await O()},H=()=>{j.formStatus=!1,j.changeIng=!0},z=()=>{j.formStatus=!0,j.changeIng=!1},R=()=>{f.$router.go("/pages/public/merchantApplyList",{merchantApplyId:j.model.id})},T=async()=>{if(!(await _(A).validate().catch((e=>{console.log("error: ",e)}))))return;const{data:e,code:a}=await u.updateMerchant(j.model);0===a&&(j.formStatus=!0,j.changeIng=!1,await O())},$=d([]);function D(e){return e.map((e=>({text:e.name,value:e.id,children:e.children.length?D(e.children):null})))}const O=async()=>{const{data:e,code:a}=await u.getMerchant();0===a&&e?(j.model=e,j.userApplyStatus=!0,j.formStatus=!0):(j.userApplyStatus=!1,j.formStatus=!1)},G=r((()=>f.$store("user").isLogin));return n((()=>G.value),(e=>{e&&window.location.reload()}),{deep:!0}),i((async e=>{G.value?(await u.checkSystemUser().then((e=>{console.log(!e.data),j.canUse=!e.data})),await c.getAreaTree().then((e=>{$.value=D(e.data)})),await O()):s()})),(r,t)=>{const d=m(p("uni-easyinput"),e),n=m(p("uni-forms-item"),a),i=m(p("s-uploader"),U),s=m(p("uni-data-picker"),C),u=q,c=m(p("uni-forms"),l),f=k,B=m(p("su-fixed"),E),D=m(p("s-layout"),M);return g(),h(D,{class:"set-wrap",title:_(o)("merchant.merchant_registration"),bgStyle:{color:"#FFF"}},{default:b((()=>[j.canUse?(g(),y(x,{key:0},[S(c,{model:j.model,rules:j.rules,validateTrigger:"bind",labelPosition:"left",border:"",class:"form-box",labelWidth:"200",ref_key:"merchantFormRef",ref:A},{default:b((()=>[S(u,{class:"bg-white ss-p-x-30"},{default:b((()=>[S(n,{name:"name",label:_(o)("merchant.merchant_name"),required:!j.formStatus},{default:b((()=>[S(d,{modelValue:j.model.name,"onUpdate:modelValue":t[0]||(t[0]=e=>j.model.name=e),type:"name",":placeholder":_(o)("merchant.merchant_name"),inputBorder:!1,placeholderStyle:L,clearable:!1,disabled:j.formStatus},null,8,["modelValue",":placeholder","disabled"])])),_:1},8,["label","required"]),S(n,{name:"contact",label:_(o)("merchant.contact_person"),required:!j.formStatus},{default:b((()=>[S(d,{modelValue:j.model.contact,"onUpdate:modelValue":t[1]||(t[1]=e=>j.model.contact=e),type:"contact",placeholder:_(o)("merchant.enter_contact_person"),inputBorder:!1,placeholderStyle:L,clearable:!1,disabled:j.formStatus},null,8,["modelValue","placeholder","disabled"])])),_:1},8,["label","required"]),S(n,{name:"contactNumber",label:_(o)("merchant.contact_phone"),required:!j.formStatus},{default:b((()=>[S(d,{modelValue:j.model.contactNumber,"onUpdate:modelValue":t[2]||(t[2]=e=>j.model.contactNumber=e),type:"contactNumber",placeholder:_(o)("merchant.enter_contact_phone"),inputBorder:!1,placeholderStyle:L,clearable:!1,disabled:j.formStatus},null,8,["modelValue","placeholder","disabled"])])),_:1},8,["label","required"]),S(n,{name:"legalPerson",label:_(o)("merchant.legal_person"),required:!j.formStatus},{default:b((()=>[S(d,{modelValue:j.model.legalPerson,"onUpdate:modelValue":t[3]||(t[3]=e=>j.model.legalPerson=e),type:"legalPerson",placeholder:_(o)("merchant.enter_legal_person"),inputBorder:!1,placeholderStyle:L,clearable:!1,disabled:j.formStatus},null,8,["modelValue","placeholder","disabled"])])),_:1},8,["label","required"]),S(n,{name:"legalPersonNumber",label:_(o)("merchant.legal_person_phone"),required:!j.formStatus},{default:b((()=>[S(d,{modelValue:j.model.legalPersonNumber,"onUpdate:modelValue":t[4]||(t[4]=e=>j.model.legalPersonNumber=e),type:"legalPersonNumber",placeholder:_(o)("merchant.enter_legal_person_phone"),inputBorder:!1,placeholderStyle:L,clearable:!1,disabled:j.formStatus},null,8,["modelValue","placeholder","disabled"])])),_:1},8,["label","required"]),S(n,{name:"identityCardFront",label:_(o)("merchant.legal_person_id_front"),required:!j.formStatus,errorMessage:j.identityCardFrontError},{default:b((()=>[S(i,{url:j.model.identityCardFront,"onUpdate:url":t[5]||(t[5]=e=>j.model.identityCardFront=e),fileMediatype:"image",limit:"1",mode:"grid",imageStyles:{width:"299rpx",height:"168rpx"},readonly:j.formStatus},null,8,["url","readonly"])])),_:1},8,["label","required","errorMessage"]),S(n,{name:"identityCardReverseSide",label:_(o)("merchant.legal_person_id_back"),required:!j.formStatus,errorMessage:r.identityCardReverseSideError},{default:b((()=>[S(i,{url:j.model.identityCardReverseSide,"onUpdate:url":t[6]||(t[6]=e=>j.model.identityCardReverseSide=e),fileMediatype:"image",limit:"1",mode:"grid",imageStyles:{width:"299rpx",height:"168rpx"},readonly:j.formStatus},null,8,["url","readonly"])])),_:1},8,["label","required","errorMessage"]),S(n,{name:"areaId",label:_(o)("merchant.location"),required:!j.formStatus,errorMessage:j.areaIdError},{default:b((()=>[S(s,{modelValue:j.model.areaId,"onUpdate:modelValue":t[7]||(t[7]=e=>j.model.areaId=e),localdata:$.value,readonly:j.formStatus},null,8,["modelValue","localdata","readonly"])])),_:1},8,["label","required","errorMessage"]),S(n,{name:"email",label:_(o)("merchant.email"),required:!j.formStatus},{default:b((()=>[S(d,{modelValue:j.model.email,"onUpdate:modelValue":t[8]||(t[8]=e=>j.model.email=e),type:"email",placeholder:_(o)("merchant.enter_email"),inputBorder:!1,placeholderStyle:L,clearable:!1,disabled:j.formStatus},null,8,["modelValue","placeholder","disabled"])])),_:1},8,["label","required"]),S(n,{name:"address",label:_(o)("merchant.office_address")},{default:b((()=>[S(d,{modelValue:j.model.address,"onUpdate:modelValue":t[9]||(t[9]=e=>j.model.address=e),type:"address",placeholder:_(o)("merchant.office_address"),inputBorder:!1,placeholderStyle:L,clearable:!1,disabled:j.formStatus},null,8,["modelValue","placeholder","disabled"])])),_:1},8,["label"]),S(n,{name:"complaintsHotline",label:_(o)("merchant.rights_phone")},{default:b((()=>[S(d,{modelValue:j.model.complaintsHotline,"onUpdate:modelValue":t[10]||(t[10]=e=>j.model.complaintsHotline=e),type:"complaintsHotline",placeholder:_(o)("merchant.enter_rights_phone"),inputBorder:!1,placeholderStyle:L,clearable:!1,disabled:j.formStatus},null,8,["modelValue","placeholder","disabled"])])),_:1},8,["label"]),S(n,{name:"customerServiceHotline",label:_(o)("merchant.customer_service_phone"),required:!j.formStatus},{default:b((()=>[S(d,{modelValue:j.model.customerServiceHotline,"onUpdate:modelValue":t[11]||(t[11]=e=>j.model.customerServiceHotline=e),type:"customerServiceHotline",placeholder:_(o)("merchant.enter_customer_service_phone"),inputBorder:!1,placeholderStyle:L,clearable:!1,disabled:j.formStatus},null,8,["modelValue","placeholder","disabled"])])),_:1},8,["label","required"]),S(n,{name:"website",label:_(o)("merchant.website")},{default:b((()=>[S(d,{modelValue:j.model.website,"onUpdate:modelValue":t[12]||(t[12]=e=>j.model.website=e),type:"website",placeholder:_(o)("merchant.enter_website"),inputBorder:!1,placeholderStyle:L,clearable:!1,disabled:j.formStatus},null,8,["modelValue","placeholder","disabled"])])),_:1},8,["label"]),S(n,{name:"logoUrl",label:"Logo"},{default:b((()=>[S(i,{url:j.model.logoUrl,"onUpdate:url":t[13]||(t[13]=e=>j.model.logoUrl=e),fileMediatype:"image",limit:"1",mode:"grid",imageStyles:{width:"299rpx",height:"168rpx"},readonly:j.formStatus},null,8,["url","readonly"])])),_:1}),S(n,{name:"businessLicensePicture",label:_(o)("merchant.business_license"),required:!j.formStatus,errorMessage:j.businessLicensePictureError},{default:b((()=>[S(i,{url:j.model.businessLicensePicture,"onUpdate:url":t[14]||(t[14]=e=>j.model.businessLicensePicture=e),fileMediatype:"image",limit:"1",mode:"grid",imageStyles:{width:"299rpx",height:"168rpx"},readonly:j.formStatus},null,8,["url","readonly"])])),_:1},8,["label","required","errorMessage"]),S(n,{name:"brandLicensing",label:_(o)("merchant.brand_authorization"),required:!j.formStatus,errorMessage:j.brandLicensingError},{default:b((()=>[S(i,{url:j.model.brandLicensing,"onUpdate:url":t[15]||(t[15]=e=>j.model.brandLicensing=e),fileMediatype:"image",limit:"1",mode:"grid",imageStyles:{width:"299rpx",height:"168rpx"},readonly:j.formStatus},null,8,["url","readonly"]),j.model.brandLicensing?V("",!0):(g(),h(u,{key:0,class:"ss-m-t-20",style:{color:"var(--ui-BG-Main)"},onClick:N},{default:b((()=>[v(w(_(o)("merchant.download_template")),1)])),_:1}))])),_:1},8,["label","required","errorMessage"]),S(n,{name:"otherCertificate",label:_(o)("merchant.other_certificates")},{default:b((()=>[S(i,{url:j.model.otherCertificate,"onUpdate:url":t[16]||(t[16]=e=>j.model.otherCertificate=e),fileMediatype:"image",limit:"9",mode:"grid",imageStyles:{width:"299rpx",height:"168rpx"},readonly:j.formStatus},null,8,["url","readonly"])])),_:1},8,["label"]),S(n,{name:"description",label:_(o)("merchant.introduction"),required:!j.formStatus},{default:b((()=>[S(d,{modelValue:j.model.description,"onUpdate:modelValue":t[17]||(t[17]=e=>j.model.description=e),type:"description",placeholder:_(o)("merchant.enter_introduction"),inputBorder:!1,placeholderStyle:L,clearable:!1,disabled:j.formStatus},null,8,["modelValue","placeholder","disabled"])])),_:1},8,["label","required"]),j.userApplyStatus?(g(),h(n,{key:0,name:"description",label:_(o)("merchant.status")},{default:b((()=>[S(d,{modelValue:I.value,"onUpdate:modelValue":t[18]||(t[18]=e=>I.value=e),type:"description",inputBorder:!1,placeholderStyle:L,clearable:!1,disabled:!0},null,8,["modelValue"])])),_:1},8,["label"])):V("",!0)])),_:1})])),_:1},8,["model","rules"]),S(B,{bottom:"",placeholder:"",bg:"none"},{default:b((()=>[S(u,{class:"footer-box ss-p-20 ss-flex"},{default:b((()=>[j.userApplyStatus?V("",!0):(g(),h(f,{key:0,class:"ss-rest-button btn",onClick:F},{default:b((()=>[v(w(_(o)("common.submit")),1)])),_:1})),[0].includes(j.model.checkStatus)?(g(),h(f,{key:1,class:"ss-rest-button btn"},{default:b((()=>[v(w(_(o)("merchant.review_in_progress")),1)])),_:1})):V("",!0),[1,2].includes(j.model.checkStatus)?(g(),y(x,{key:2},[j.changeIng?(g(),y(x,{key:1},[S(f,{class:"ss-rest-button btn-two",onClick:z},{default:b((()=>[v(w(_(o)("common.cancel")),1)])),_:1}),S(f,{class:"ss-rest-button btn-two",onClick:T},{default:b((()=>[v(w(_(o)("merchant.save_and_submit")),1)])),_:1})],64)):(g(),y(x,{key:0},[S(f,{class:"ss-rest-button btn-two",onClick:R},{default:b((()=>[v(w(_(o)("merchant.review_records")),1)])),_:1}),S(f,{class:"ss-rest-button btn-two",onClick:H},{default:b((()=>[v(w(_(o)("merchant.changes")),1)])),_:1})],64))],64)):V("",!0)])),_:1})])),_:1})],64)):V("",!0),j.canUse?V("",!0):(g(),h(u,{key:1,style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%,-50%)","text-align":"center"}},{default:b((()=>[v(w(_(o)("merchant.existing_merchant_alert",{user:P.value.mobile})),1)])),_:1}))])),_:1},8,["title"])}}},[["__scopeId","data-v-d7cf7cf1"]]);export{P as default};