1 |
- import{c as e,v as s,t as a,r as t,a0 as o,o as l,G as r,a as n,b as u,d as i,w as c,u as m,s as d,e as _,f as p,g as f,j as b,a3 as v,R as w,bP as g,aq as y,be as q,i as x,l as j,M as h}from"./index-rA9LQu-Z.js";import{_ as I,a as F,b as C}from"./phone-international-input.xRkWv9wR.js";import{a as T,_ as $}from"./s-layout.B9qvEa4L.js";import{p as V}from"./useGoods.BijVnshj.js";import"./phone-international-input.vue_vue_type_style_index_0_scoped_a793e264_lang.BKCNw0rf.js";import{_ as k}from"./_plugin-vue_export-helper.BCo6x5W8.js";import"./s-menu-tools.DS1kA6Tz.js";import"./s-layout.vue_vue_type_style_index_0_scoped_d5f7c468_lang.DsLhC4_3.js";import"./s-tabbar.DG8GxPLd.js";const G=k({__name:"scoreToConsumption",setup(k){e((()=>d.$store("user").userInfo));const G=e((()=>d.$store("user").userWallet)),M=s({model:{quota:void 0},rules:{quota:{rules:[{required:!0,errorMessage:a("wallet.transfer_amount_cannot_be_empty")},{validateFunction:function(e,s,t,o){return s<=0&&o(a("wallet.transfer_amount_cannot_be_zero")),!0}}]}}}),O=e((()=>V(G.value.integralDO.currentQuota)));async function P(e){const s=parseInt(e),a=e.toString(),[t,o]=a.split(".");o&&v((()=>{M.model.quota=t})),s>parseInt(O.value)?v((()=>{M.model.quota=parseInt(O.value)})):v((()=>{M.model.quota=s}))}const R=t(null),S=async()=>{await m(R).validate().catch((e=>{console.log("error: ",e)}))&&w({title:a("setting.prompt"),content:a("wallet.commission_to_points_irreversible"),success:async function(e){if(!e.confirm)return;const{data:s,code:t}=await g.quotaTransition(M.model.quota);0===t&&(y({title:a("wallet.conversion_successful"),icon:"none",duration:2e3}),q("consumptionTransfersComplete"),d.$router.redirect("/pages/user/wallet/score"))}})},W=e((()=>d.$store("user").isLogin));return o((()=>W.value),(e=>{e&&window.location.reload()}),{deep:!0}),l((async e=>{W.value||r()})),(e,s)=>{const t=n(u("uni-easyinput"),I),o=n(u("uni-forms-item"),F),l=x,r=n(u("uni-forms"),C),d=j,v=h,w=n(u("su-fixed"),T),g=n(u("s-layout"),$);return _(),i(g,{class:"set-wrap",title:m(a)("wallet.commission_to_points"),bgStyle:{color:"#FFF"}},{default:c((()=>[p(r,{model:M.model,rules:M.rules,validateTrigger:"bind",labelPosition:"left",border:"",class:"form-box",labelWidth:"200",ref_key:"FormRef",ref:R},{default:c((()=>[p(l,{class:"bg-white ss-p-x-30"},{default:c((()=>[p(o,{name:"quota",label:m(a)("wallet.consumption_points"),required:!0},{default:c((()=>[p(t,{modelValue:M.model.quota,"onUpdate:modelValue":s[0]||(s[0]=e=>M.model.quota=e),type:"number",placeholder:m(a)("wallet.enter_transfer_amount"),inputBorder:!1,clearable:!1,onInput:P},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(m(a)("wallet.current_commission_available"))+":",1),p(d,{class:"text-red"},{default:c((()=>[f(b(O.value),1)])),_:1})])),_:1}),p(w,{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:S},{default:c((()=>[f(b(m(a)("common.confirm")),1)])),_:1})])),_:1})])),_:1})])),_:1},8,["title"])}}},[["__scopeId","data-v-49ffa4ca"]]);export{G as default};
|