import{a as e,b as a,d as t}from"./phone-international-input.3617e4e0.js";import{c as s,B as o,o as r,f as n,g as i,w as l,s as p,bN as c,q as u,n as d,m,t as f,a4 as g,a3 as y,u as P,l as _,L as b}from"./index-007bf156.js";import{_ as x}from"./s-layout.19bedb43.js";import"./md5.831cbfbc.js";import{_ as h}from"./_plugin-vue_export-helper.1b428a4d.js";import"./useGoods.ac3bf93e.js";const v=h({__name:"topupConsumptionPoints",setup(h){s((()=>p.$store("user").userWallet));const v=s((()=>p.$store("user").userInfo)),w=o({model:{},payPrice:void 0,percentage:{consumptionMagnification:0,userTopUpConsumptionPoints:0,triggerMagnificationPoints:0}}),C=s((()=>{if(!w.payPrice)return 0;let e;return e=w.payPrice>=parseFloat(w.percentage.triggerMagnificationPoints)?(parseFloat(w.percentage.consumptionMagnification)*w.payPrice).toFixed(2):w.payPrice,e}));async function j(e){const a=e.toString(),[t,s]=a.split(".");s&&g((()=>{w.payPrice=t}))}const F=async()=>{if(!w.payPrice)return void p.$helper.toast("请输入充值金额");if(parseFloat(w.payPrice)<w.percentage.userTopUpConsumptionPoints)return void p.$helper.toast(`充值金额不能少于${w.percentage.userTopUpConsumptionPoints}`);let{code:e,data:a}=await y.topupConsumptionPointsCreate({payPrice:w.payPrice,topUpConsumptionPoints:w.payPrice,userName:v.value.username});0===e&&p.$router.redirect("/pages/pay/index",{id:a.payOrderId,type:2})};return r((async e=>{await(async()=>{const{code:e,data:a}=await c.getWithdrawalPercentage();0===e&&(w.percentage=a)})()})),(s,o)=>{const r=u(P("uni-easyinput"),e),p=u(P("uni-forms-item"),a),c=_,g=u(P("uni-forms"),t),y=b,h=u(P("s-layout"),x);return n(),i(h,{title:"消费分充值"},{default:l((()=>[d(c,{class:"bg-white ss-modal-box ss-flex-col"},{default:l((()=>[d(c,{class:"modal-content ss-m-t-30"},{default:l((()=>[d(g,{model:w.model,rules:w.rules,validateTrigger:"bind",labelPosition:"left",border:"",class:"form-box",labelWidth:"200",ref:"FormRef"},{default:l((()=>[d(c,{class:"bg-white ss-p-x-30"},{default:l((()=>[d(p,{name:"quota",label:"充值金额",required:!0},{default:l((()=>[d(r,{modelValue:w.payPrice,"onUpdate:modelValue":o[0]||(o[0]=e=>w.payPrice=e),type:"number",placeholder:"请输入金额",inputBorder:!1,clearable:!1,onInput:j,maxlength:9},null,8,["modelValue"])])),_:1}),d(p,{name:"quota",label:"实到消费分"},{default:l((()=>[d(c,{class:"ss-flex ss-h-100"},{default:l((()=>[m(f(C.value),1)])),_:1})])),_:1})])),_:1})])),_:1},8,["model","rules"]),d(c,{class:"ss-flex ss-row-center ss-col-center ss-m-t-30 text-red text-center"},{default:l((()=>[m("备注：充值"+f(w.percentage.triggerMagnificationPoints)+"元及以上，可获得"+f(parseFloat(w.percentage.consumptionMagnification))+"倍消费分 ",1)])),_:1})])),_:1}),d(c,{class:"modal-footer ss-flex ss-row-center ss-col-center ss-m-t-80 ss-m-b-40 ss-flex-5"},{default:l((()=>[d(y,{class:"ss-reset-button save-btn",onClick:F},{default:l((()=>[m(" 确定 ")])),_:1})])),_:1})])),_:1})])),_:1})}}},[["__scopeId","data-v-c92d9663"]]);export{v as default};
