import{a as e,x as a,O as l,o as t,j as s,w as o,B as r,h as u,I as c,i as n,e as i,k as d,F as m,m as f,z as v,A as p,a5 as g,G as _,H as h,l as k,p as y}from"./index-9bec188e.js";import{a as x,_ as V}from"./uv-radio.2cd26a6d.js";import{H as j}from"./index.bdca3eba.js";import{u as b}from"./useScroll.c0a86152.js";import{G as w}from"./images.52fc6216.js";import{u as S}from"./useInterface.982c71ba.js";import{g as I,c as B}from"./index.7c825887.js";import{d as O,P}from"./paymentUtils.238419a9.js";import{_ as A}from"./_plugin-vue_export-helper.1b428a4d.js";import"./uv-icon.27c7246d.js";import"./uv-icon.vue_vue_type_style_index_0_scoped_23936b10_lang.7145f5b2.js";import"./utils.3f9740a5.js";import"./order.f67793d3.js";import"./config.6730da78.js";const C=A({__name:"index",setup(A){const{toast:C,loading:H,hideLoading:M}=S(),{scrollTop:E}=b(),L=e([{label:"微信",value:0,icon:w}]),T=e(void 0),U=e({content:"",customMin:0,customSwitch:0,rechargePackageBaseVOS:[]});const G=a((()=>U.value.rechargePackageBaseVOS.findIndex((e=>"other"===e.id))));function $(e){D.value.amount=parseInt(e.detail.value)}const z=e(!1),D=e({type:0,amount:0,packageId:null});async function F(){try{if(z.value=!0,D.value.amount=parseInt(D.value.amount),"other"===T.value&&(delete D.value.packageId,D.value.amount<U.value.customMin))return C({title:`最低充值${U.value.customMin}元`});const e=await B(D.value);await O({type:P[0],payInfo:{orderId:e}})}catch(e){throw console.error(e),new Error(e)}finally{z.value=!1}}return l((async e=>{await async function(){const e=await I();1===e.customSwitch&&e.rechargePackageBaseVOS.push({id:"other",name:"其他",rechargeAmount:""}),e.rechargePackageBaseVOS.length>0&&(T.value=e.rechargePackageBaseVOS[0].id,D.value.amount=e.rechargePackageBaseVOS[0].rechargeAmount,D.value.packageId=e.rechargePackageBaseVOS[0].id),U.value=e}()})),(e,a)=>{const l=r,b=p,w=g,S=y,I=_(h("uv-radio"),x),B=_(h("uv-radio-group"),V);return t(),s(l,null,{default:o((()=>[u(j,{"scroll-top":n(E),"system-bar-area-bg":"#fff","header-area-bg":"#fff"},{default:o((()=>[c(" 充值 ")])),_:1},8,["scroll-top"]),u(l,{class:"verification"},{default:o((()=>[u(l,{class:"ver-card"},{default:o((()=>[u(l,{class:"title"},{default:o((()=>[c("选择充值面额")])),_:1}),u(l,{class:"select-row"},{default:o((()=>[(t(!0),i(m,null,d(U.value.rechargePackageBaseVOS,(e=>(t(),s(l,{class:f(["select-item",{current:T.value===e.id}]),key:e.value,onClick:a=>{return l=e,T.value=l.id,D.value.packageId=l.id,void(D.value.amount=l.rechargeAmount);var l}},{default:o((()=>[c(k("other"===e.id?e.name:e.rechargeAmount)+" ",1),e.giftAmount>0?(t(),s(l,{key:0,class:"give"},{default:o((()=>[c("送"+k(e.giftAmount)+"元 ",1)])),_:2},1024)):v("",!0)])),_:2},1032,["class","onClick"])))),128))])),_:1}),u(l,{class:f(["input row",{hidden:"other"!==T.value}])},{default:o((()=>[u(l,{class:"flex flex-ai__center"},{default:o((()=>[u(b,{class:"price"},{default:o((()=>[c("￥")])),_:1}),U.value.rechargePackageBaseVOS[n(G)]?(t(),s(w,{key:0,modelValue:U.value.rechargePackageBaseVOS[n(G)].rechargeAmount,"onUpdate:modelValue":a[0]||(a[0]=e=>U.value.rechargePackageBaseVOS[n(G)].rechargeAmount=e),type:"number",placeholder:"请输入充值金额",onInput:$},null,8,["modelValue"])):v("",!0)])),_:1})])),_:1},8,["class"])])),_:1}),u(l,{class:"ver-card"},{default:o((()=>[u(l,{class:"title"},{default:o((()=>[c("支付方式")])),_:1}),u(B,{activeColor:"#EE6D46",modelValue:D.value.type,"onUpdate:modelValue":a[1]||(a[1]=e=>D.value.type=e),placement:"column"},{default:o((()=>[(t(!0),i(m,null,d(L.value,(e=>(t(),s(l,{key:e.value,class:"flex flex-jc__sb flex-ai__center",onClick:a=>D.value.type=e.value},{default:o((()=>[u(l,{class:"input row method none-border none-bg"},{default:o((()=>[u(l,{class:"flex flex-ai__center"},{default:o((()=>[u(S,{class:"icon",src:e.icon},null,8,["src"]),u(b,{class:"text"},{default:o((()=>[c(k(e.label),1)])),_:2},1024)])),_:2},1024)])),_:2},1024),u(I,{customStyle:{marginBottom:"8px"},label:" ",name:e.value},null,8,["name"])])),_:2},1032,["onClick"])))),128))])),_:1},8,["modelValue"])])),_:1}),u(l,{class:"tips-content"},{default:o((()=>[u(l,{class:"title"},{default:o((()=>[c("充值说明")])),_:1}),u(l,{class:"content",innerHTML:U.value.content},null,8,["innerHTML"])])),_:1}),u(l,{style:{width:"100%",height:"140rpx"}}),u(l,{class:f(["btn-row row animation-button",{disabled:D.value.amount<=0}]),onClick:F},{default:o((()=>[c(" 确认充值 ")])),_:1},8,["class"])])),_:1})])),_:1})}}},[["__scopeId","data-v-6832483e"]]);export{C as default};
