import{c as e,B as a,P as s,a1 as o,o as t,y as l,f as r,g as n,w as u,s as i,q as d,n as c,m,t as f,a4 as p,z as _,R as b,bM as q,aq as g,aJ as v,u as y,l as x,K as w,L as h}from"./index-007bf156.js";import{a as j,b as I,d as F}from"./phone-international-input.3617e4e0.js";import{a as T,_ as $}from"./s-layout.19bedb43.js";import{p as k}from"./useGoods.ac3bf93e.js";import{_ as C}from"./_plugin-vue_export-helper.1b428a4d.js";const V=C({__name:"scoreToConsumption",setup(C){e((()=>i.$store("user").userInfo));const V=e((()=>i.$store("user").userWallet)),B=a({model:{quota:void 0},rules:{quota:{rules:[{required:!0,errorMessage:"转换金额不能为空"},{validateFunction:function(e,a,s,o){return a<=0&&o("转换金额不能小于等于0"),!0}}]}}}),L=e((()=>k(V.value.integralDO.currentQuota)));async function M(e){const a=parseInt(e),s=e.toString(),[o,t]=s.split(".");t&&p((()=>{B.model.quota=o})),a>parseInt(L.value)?p((()=>{B.model.quota=parseInt(L.value)})):p((()=>{B.model.quota=a}))}const P=s(null),R=async()=>{await _(P).validate().catch((e=>{console.log("error: ",e)}))&&b({title:"提示",content:"佣金转为消费分后不可逆，是否转换？",success:async function(e){if(!e.confirm)return;const{data:a,code:s}=await q.quotaTransition(B.model.quota);0===s&&(g({title:"转换成功",icon:"none",duration:2e3}),v("consumptionTransfersComplete"),i.$router.redirect("/pages/user/wallet/score"))}})},S=e((()=>i.$store("user").isLogin));return o((()=>S.value),(e=>{e&&window.location.reload()}),{deep:!0}),t((async e=>{S.value||l()})),(e,a)=>{const s=d(y("uni-easyinput"),j),o=d(y("uni-forms-item"),I),t=x,l=d(y("uni-forms"),F),i=w,p=h,_=d(y("su-fixed"),T),b=d(y("s-layout"),$);return r(),n(b,{class:"set-wrap",title:"佣金转消费分",bgStyle:{color:"#FFF"}},{default:u((()=>[c(l,{model:B.model,rules:B.rules,validateTrigger:"bind",labelPosition:"left",border:"",class:"form-box",labelWidth:"200",ref_key:"FormRef",ref:P},{default:u((()=>[c(t,{class:"bg-white ss-p-x-30"},{default:u((()=>[c(o,{name:"quota",label:"消费分",required:!0},{default:u((()=>[c(s,{modelValue:B.model.quota,"onUpdate:modelValue":a[0]||(a[0]=e=>B.model.quota=e),type:"number",placeholder:"请输入转换金额",inputBorder:!1,clearable:!1,onInput:M},null,8,["modelValue"])])),_:1})])),_:1})])),_:1},8,["model","rules"]),c(t,{class:"ss-flex ss-row-center ss-col-center ss-m-t-30"},{default:u((()=>[m(" 您当前可转换的佣金额度:"),c(i,{class:"text-red"},{default:u((()=>[m(f(L.value),1)])),_:1})])),_:1}),c(_,{bottom:"",placeholder:"",bg:"none"},{default:u((()=>[c(t,{class:"footer-box ss-p-20 ss-flex"},{default:u((()=>[c(p,{class:"ss-rest-button btn",onClick:R},{default:u((()=>[m("确定")])),_:1})])),_:1})])),_:1})])),_:1})}}},[["__scopeId","data-v-4484a35a"]]);export{V as default};
