pages-user-wallet-scoreToConsumption.M6LK5ZNp.js 3.3 KB

1
  1. import{c as e,v as s,t,r as a,a0 as o,o as l,G as r,a as n,b as u,d as i,w as c,u as _,s as m,e as d,f as p,g as f,j as b,a3 as v,R as g,bR as w,ar as y,bg as q,i as x,l as j,M as h}from"./index-CIHXBJK6.js";import{_ as I,a as F,b as k}from"./phone-international-input.11CX4hdU.js";import{a as T,_ as $}from"./s-layout.DsRVkhyD.js";import{p as C}from"./useGoods.BMh-0Uau.js";import"./phone-international-input.vue_vue_type_style_index_0_scoped_a793e264_lang._Ymtd1hH.js";import{_ as R}from"./_plugin-vue_export-helper.BCo6x5W8.js";import"./uni-icons.Dn5XuiUW.js";import"./s-menu-tools.Di3ooeY2.js";import"./s-search-block.vue_vue_type_style_index_0_scoped_f692e81a_lang.XupmRtHT.js";import"./s-layout.vue_vue_type_style_index_0_scoped_d5f7c468_lang.X__YG5gI.js";import"./s-search-block.Bj2KQbpW.js";const V=R({__name:"scoreToConsumption",setup(R){e((()=>m.$store("user").userInfo));const V=e((()=>m.$store("user").userWallet)),z=s({model:{quota:void 0},rules:{quota:{rules:[{required:!0,errorMessage:t("wallet.transfer_amount_cannot_be_empty")},{validateFunction:function(e,s,a,o){return s<=0&&o(t("wallet.transfer_amount_cannot_be_zero")),!0}}]}}}),G=e((()=>C(V.value.integralDO.currentQuota)));async function M(e){const s=parseInt(e),t=e.toString(),[a,o]=t.split(".");o&&v((()=>{z.model.quota=a})),s>parseInt(G.value)?v((()=>{z.model.quota=parseInt(G.value)})):v((()=>{z.model.quota=s}))}const P=a(null),Q=async()=>{await _(P).validate().catch((e=>{console.log("error: ",e)}))&&g({title:t("setting.prompt"),content:t("wallet.commission_to_points_irreversible"),success:async function(e){if(!e.confirm)return;const{data:s,code:a}=await w.quotaTransition(z.model.quota);0===a&&(y({title:t("wallet.conversion_successful"),icon:"none",duration:2e3}),q("consumptionTransfersComplete"),m.$router.redirect("/pages/user/wallet/score"))}})},S=e((()=>m.$store("user").isLogin));return o((()=>S.value),(e=>{e&&window.location.reload()}),{deep:!0}),l((async e=>{S.value||r()})),(e,s)=>{const a=n(u("uni-easyinput"),I),o=n(u("uni-forms-item"),F),l=x,r=n(u("uni-forms"),k),m=j,v=h,g=n(u("su-fixed"),T),w=n(u("s-layout"),$);return d(),i(w,{class:"set-wrap",title:_(t)("wallet.commission_to_points"),bgStyle:{color:"#FFF"}},{default:c((()=>[p(r,{model:z.model,rules:z.rules,validateTrigger:"bind",labelPosition:"left",border:"",class:"form-box",labelWidth:"200",ref_key:"FormRef",ref:P},{default:c((()=>[p(l,{class:"bg-white ss-p-x-30"},{default:c((()=>[p(o,{name:"quota",label:_(t)("wallet.consumption_points"),required:!0},{default:c((()=>[p(a,{modelValue:z.model.quota,"onUpdate:modelValue":s[0]||(s[0]=e=>z.model.quota=e),type:"number",placeholder:_(t)("wallet.enter_transfer_amount"),inputBorder:!1,clearable:!1,onInput:M},null,8,["modelValue","placeholder"])])),_:1},8,["label"])])),_:1})])),_:1},8,["model","rules"]),p(l,{class:"ss-flex ss-row-center ss-col-center ss-m-t-30"},{default:c((()=>[f(b(_(t)("wallet.current_commission_available"))+":",1),p(m,{class:"text-red"},{default:c((()=>[f(b(G.value),1)])),_:1})])),_:1}),p(g,{bottom:"",placeholder:"",bg:"none"},{default:c((()=>[p(l,{class:"footer-box ss-p-20 ss-flex"},{default:c((()=>[p(v,{class:"ss-rest-button btn",onClick:Q},{default:c((()=>[f(b(_(t)("common.confirm")),1)])),_:1})])),_:1})])),_:1})])),_:1},8,["title"])}}},[["__scopeId","data-v-49ffa4ca"]]);export{V as default};