import{a,x as e,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 p,A as v,a5 as g,G as _,H as h,l as k,p as y}from"./index-90c12cc1.js";import{_ as j,a as x}from"./u-radio-group.226ac9ee.js";import{H as V}from"./index.0e2fd26a.js";import{u as b}from"./useScroll.50272fa4.js";import{G as S}from"./images.cf3befb9.js";import{u as w}from"./useInterface.bd4f041a.js";import{g as B,c as I}from"./index.53c532fb.js";import{d as O,P}from"./paymentUtils.6e4e6391.js";import{_ as A}from"./_plugin-vue_export-helper.1b428a4d.js";import"./u-icon.ec8b667f.js";import"./uv-icon.c815b875.js";import"./uv-icon.vue_vue_type_style_index_0_scoped_23936b10_lang.7145f5b2.js";import"./utils.80a0ac72.js";import"./order.190c4706.js";import"./config.6730da78.js";const C=A({__name:"index",setup(A){const{toast:C,loading:E,hideLoading:G}=w(),{scrollTop:M}=b(),U=a([{label:"微信",value:0,icon:S}]),H=a(void 0),$=a({content:"",customMin:0,customSwitch:0,rechargePackageBaseVOS:[]});const z=e((()=>$.value.rechargePackageBaseVOS.findIndex((a=>"other"===a.id))));function D(a){J.value.amount=parseInt(a.detail.value)}const F=a(!1),J=a({type:0,amount:0,packageId:null});async function L(){try{if(F.value=!0,J.value.amount=parseInt(J.value.amount),"other"===H.value&&(delete J.value.packageId,J.value.amount<$.value.customMin))return C({title:`最低充值${$.value.customMin}元`});const a=await I(J.value);await O({type:P[0],payInfo:{orderId:a}})}catch(a){throw console.error(a),new Error(a)}finally{F.value=!1}}return l((async a=>{await async function(){const a=await B();1===a.customSwitch&&a.rechargePackageBaseVOS.push({id:"other",name:"其他",rechargeAmount:""}),a.rechargePackageBaseVOS.length>0&&(H.value=a.rechargePackageBaseVOS[0].id,J.value.amount=a.rechargePackageBaseVOS[0].rechargeAmount,J.value.packageId=a.rechargePackageBaseVOS[0].id),$.value=a}()})),(a,e)=>{const l=r,b=v,S=g,w=y,B=_(h("u-radio"),j),I=_(h("u-radio-group"),x);return t(),s(l,null,{default:o((()=>[u(V,{"scroll-top":n(M),"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($.value.rechargePackageBaseVOS,(a=>(t(),s(l,{class:f(["select-item",{current:H.value===a.id}]),key:a.value,onClick:e=>{return l=a,H.value=l.id,J.value.packageId=l.id,void(J.value.amount=l.rechargeAmount);var l}},{default:o((()=>[c(k("other"===a.id?a.name:a.rechargeAmount)+" ",1),a.giftAmount>0?(t(),s(l,{key:0,class:"give"},{default:o((()=>[c("送"+k(a.giftAmount)+"元 ",1)])),_:2},1024)):p("",!0)])),_:2},1032,["class","onClick"])))),128))])),_:1}),u(l,{class:f(["input row",{hidden:"other"!==H.value}])},{default:o((()=>[u(l,{class:"flex flex-ai__center"},{default:o((()=>[u(b,{class:"price"},{default:o((()=>[c("￥")])),_:1}),$.value.rechargePackageBaseVOS[n(z)]?(t(),s(S,{key:0,modelValue:$.value.rechargePackageBaseVOS[n(z)].rechargeAmount,"onUpdate:modelValue":e[0]||(e[0]=a=>$.value.rechargePackageBaseVOS[n(z)].rechargeAmount=a),type:"number",placeholder:"请输入充值金额",onInput:D},null,8,["modelValue"])):p("",!0)])),_:1})])),_:1},8,["class"])])),_:1}),u(l,{class:"ver-card"},{default:o((()=>[u(l,{class:"title"},{default:o((()=>[c("支付方式")])),_:1}),u(I,{activeColor:"#EE6D46",modelValue:J.value.type,"onUpdate:modelValue":e[1]||(e[1]=a=>J.value.type=a),placement:"column"},{default:o((()=>[(t(!0),i(m,null,d(U.value,(a=>(t(),s(l,{key:a.value,class:"flex flex-jc__sb flex-ai__center",onClick:e=>J.value.type=a.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(w,{class:"icon",src:a.icon},null,8,["src"]),u(b,{class:"text"},{default:o((()=>[c(k(a.label),1)])),_:2},1024)])),_:2},1024)])),_:2},1024),u(B,{customStyle:{marginBottom:"8px"},label:" ",name:a.value},null,8,["name"])])),_:2},1032,["onClick"])))),128))])),_:1},8,["modelValue"])])),_:1}),u(l,{class:f(["btn-row row animation-button",{disabled:J.value.amount<=0}]),onClick:L},{default:o((()=>[c(" 确认充值 ")])),_:1},8,["class"])])),_:1})])),_:1})}}},[["__scopeId","data-v-0d33711b"]]);export{C as default};
