pages-user-wallet-scoreToConsumption.DKVf0BDR.js 4.2 KB

1
  1. import{c as e,v as a,t as l,r as t,a2 as s,o,I as r,a as n,b as u,d as i,w as c,u as d,s as m,e as p,f as _,x as f,y,F as v,z as g,g as b,j as w,a5 as x,V as h,ao as q,l as j,au as T,i as k,O as I,bU as C,at as F,bi as O,P,Q as V}from"./index-dGICJBA1.js";import{a as $,_ as z,b as Q}from"./phone-international-input.BSO1ObdH.js";import{a as B,_ as D}from"./s-layout.2n749i-h.js";import{p as G}from"./useGoods.jFp9m3ab.js";import"./phone-international-input.vue_vue_type_style_index_0_scoped_0f0268ff_lang.DfrFtxCM.js";import{_ as M}from"./_plugin-vue_export-helper.BCo6x5W8.js";import"./uni-icons.BZJC71FJ.js";import"./s-menu-tools.BHmVopdZ.js";import"./s-search-block.vue_vue_type_style_index_0_scoped_f692e81a_lang.BkXbqiPQ.js";import"./s-layout.vue_vue_type_style_index_0_scoped_c1143e8c_lang.C9LLV9dD.js";import"./s-search-block.DW-gs1wX.js";const S=M({__name:"scoreToConsumption",setup(M){e((()=>m.$store("user").userInfo));const S=e((()=>m.$store("user").userWallet));console.log(S.value.categoryId);const U=e((()=>{const e=[];return e.push({value:2,text:l("wallet.黄转红")}),3===S.value.categoryId&&e.push({value:1,text:l("wallet.红转绿")}),e})),W=a({data:U,model:{quota:void 0,integralType:2},rules:{quota:{rules:[{required:!0,errorMessage:l("wallet.transfer_amount_cannot_be_empty")},{validateFunction:function(e,a,t,s){return a<=0&&s(l("wallet.transfer_amount_cannot_be_zero")),!0}}]}}}),E=e((()=>1==W.model.integralType?G(S.value.integralDO.redCurrentQuota):G(S.value.integralDO.yellowCurrentQuota)));async function J(e){const a=parseInt(e),l=e.toString(),[t,s]=l.split(".");s&&x((()=>{W.model.quota=t})),a>parseInt(E.value)?x((()=>{W.model.quota=parseInt(E.value)})):x((()=>{W.model.quota=a}))}const L=t(null),N=async()=>{await d(L).validate().catch((e=>{console.log("error: ",e)}))&&h({title:l("setting.prompt"),content:l("wallet.转换后不可逆,是否继续"),success:function(e){e.confirm&&q((async e=>{W.model.payPassword=e;const{data:a,code:t}=await C.quotaTransition(W.model);0===t&&(F({title:l("wallet.conversion_successful"),icon:"none",duration:2e3}),O("consumptionTransfersComplete"),m.$router.redirect("/pages/user/wallet/score"))}))}})},R=e((()=>m.$store("user").isLogin));return s((()=>R.value),(e=>{e&&window.location.reload()}),{deep:!0}),o((async e=>{R.value||r()})),(e,a)=>{const t=P,s=j,o=V,r=T,m=n(u("uni-forms-item"),$),x=n(u("uni-easyinput"),z),h=k,q=n(u("uni-forms"),Q),C=I,F=n(u("su-fixed"),B),O=n(u("s-layout"),D);return p(),i(O,{class:"set-wrap",title:d(l)("wallet.积分转换"),bgStyle:{color:"#FFF"}},{default:c((()=>[_(q,{model:W.model,rules:W.rules,validateTrigger:"bind",labelPosition:"left",border:"",class:"form-box",labelWidth:"200",ref_key:"FormRef",ref:L},{default:c((()=>[_(h,{class:"bg-white ss-p-x-30"},{default:c((()=>[_(m,{name:"integralType",label:d(l)("wallet.积分转换类型"),required:!0},{default:c((()=>[_(r,{onChange:a[0]||(a[0]=e=>W.model.integralType=Number(e.detail.value))},{default:c((()=>[(p(!0),f(v,null,y(W.data,(e=>(p(),i(o,{key:e.value,class:"ss-m-r-20"},{default:c((()=>[_(t,{value:e.value,color:"var(--ui-BG-Main)",style:{transform:"scale(0.8)"},checked:W.model.integralType==e.value},null,8,["value","checked"]),_(s,{class:"ss-m-l-10"},{default:c((()=>[b(w(e.text),1)])),_:2},1024)])),_:2},1024)))),128))])),_:1})])),_:1},8,["label"]),W.model.integralType?(p(),i(m,{key:0,name:"quota",label:d(l)("wallet.积分"),required:!0},{default:c((()=>[_(x,{modelValue:W.model.quota,"onUpdate:modelValue":a[1]||(a[1]=e=>W.model.quota=e),type:"number",placeholder:d(l)("wallet.请输入转换积分"),inputBorder:!1,clearable:!1,onInput:J},null,8,["modelValue","placeholder"])])),_:1},8,["label"])):g("",!0)])),_:1})])),_:1},8,["model","rules"]),_(h,{class:"ss-flex ss-row-center ss-col-center ss-m-t-30"},{default:c((()=>[W.model.integralType?(p(),f(v,{key:0},[b(w(d(l)("wallet.current_commission_available"))+":",1),_(s,{class:"text-red"},{default:c((()=>[b(w(E.value),1)])),_:1})],64)):g("",!0)])),_:1}),W.model.integralType?(p(),i(F,{key:0,bottom:"",placeholder:"",bg:"none"},{default:c((()=>[_(h,{class:"footer-box ss-p-20 ss-flex"},{default:c((()=>[_(C,{class:"ss-rest-button btn",onClick:N},{default:c((()=>[b(w(d(l)("common.confirm")),1)])),_:1})])),_:1})])),_:1})):g("",!0)])),_:1},8,["title"])}}},[["__scopeId","data-v-e726428c"]]);export{S as default};