import{_ as e}from"./vendor-FQTr8nuw.js";import{d as s}from"./vendor-CB_mu4eO.js";import{f as t,l,E as o}from"./souav-BTAG2baT.js";import{c as n}from"./vendor-Dm9fpm6x.js";import{u as i}from"./vendor-DosMhv8T.js";import{r as a,c as r,ag as c,q as p,a4 as x,a5 as d,bf as u,v,K as m,b1 as f,aL as g,a3 as h,aW as b}from"./vendor-BXdGExd0.js";import{j,i as w}from"./vendor-BJZ6tUoe.js";import"./vendor-CDxkAdJH.js";import"./vendor-Cv8m7sE6.js";import"./vendor-BCo6x5W8.js";import"./vendor-bo_0oRCG.js";import"./vendor-Dos3PyFQ.js";import"./vendor-Dwl46Tfs.js";import"./vendor-DN37M9Hi.js";import"./vendor-BHR_E30J.js";import"./vendor-DzK633Zd.js";import"./vendor-CfyHAoLP.js";import"./vendor-Dm4oB1Pn.js";import"./vendor-DBhUxCDU.js";import"./vendor-Nz4M5R8X.js";const y=s("vipExchange",()=>{const e=t(),s=i(),c=a(0),p=r(()=>{var e,t;return 0===c.value?(null==(e=s.exchangeVip1)?void 0:e.price)??0:(null==(t=s.exchangeVip2)?void 0:t.price)??0});return{selectedPlanIndex:c,cost:p,init:async function(){await e.refreshUserInfo(),await s.queryExchangeGoods()},selectPlan:function(e){c.value=e},executeExchange:async function(){if(p.value>e.coin)return void j("金币不足");const s={exchangeType:0===c.value?l.Vip1:l.Vip2},t=w({message:"兑换中...",forbidClick:!0,duration:0});try{const l=await n.exchangeVip(s);t.close(),l.code===o.Success?(j("兑换成功"),await e.refreshUserInfo()):j(l.msg||"兑换失败")}catch(i){t.close(),j("网络请求失败")}}}}),V={class:"min-h-dvh bg-[#0E0F12] flex flex-col relative overflow-hidden"},E={class:"relative w-full"},F={class:"absolute top-0 left-0 w-full h-12 flex items-center justify-center z-20"},k={class:"absolute inset-0 z-10"},C={class:"absolute top-[70px] left-[40px] flex flex-col items-center"},I={class:"flex items-center bg-black/10 rounded-[25px] px-[20px] py-[3px]"},P={class:"ml-[10px] text-[#FFD755] text-[36px] font-semibold leading-none"},z={class:"flex-1 -mt-[160px] relative z-20 pb-10"},D={class:"bg-[#0E0F12] rounded-t-[20px] min-h-full pt-[29px] flex flex-col items-center"},_={class:"w-full px-4"},A={class:"w-full flex flex-col gap-[21px]"},q=["onClick"],B={class:"text-[17px] font-bold text-white"},M={class:"text-[#FFEA00] text-[31px] font-bold leading-none"},U={key:0,class:"absolute right-[-2px] bottom-[-2px] icon-sprite icon-vip_selected"},G=c({__name:"exchange",emits:["ppw-close"],setup(s){const l=y(),o=t(),n=i(),a=e=>{var s,t,l,o;return 0===e?(null==(t=null==(s=n.exchangeVip1)?void 0:s.name)?void 0:t.replace(/\D/g,""))||"1":(null==(o=null==(l=n.exchangeVip2)?void 0:l.name)?void 0:o.replace(/\D/g,""))||"2"},r=e=>{var s,t;return 0===e?(null==(s=n.exchangeVip1)?void 0:s.price)??0:(null==(t=n.exchangeVip2)?void 0:t.price)??0};return p(()=>{l.init()}),(s,t)=>(b(),x("div",V,[d("div",E,[t[7]||(t[7]=d("img",{src:e,class:"w-full h-auto object-cover z-0"},null,-1)),d("div",F,[d("button",{onClick:t[0]||(t[0]=e=>s.$emit("ppw-close")),class:"absolute left-4 p-2 -ml-2"},[...t[2]||(t[2]=[d("i",{class:"icon-sprite icon-back"},null,-1)])]),t[3]||(t[3]=d("h1",{class:"text-lg font-medium text-white font-sans"},"会员兑换",-1))]),d("div",k,[t[6]||(t[6]=d("img",{src:"https://ggjs.bdrcp.cn/pwa/1.0.1/assets/verdor-OcsVi0M2.png",class:"absolute right-[40px] top-[20px] w-[185px] h-[142px] object-cover"},null,-1)),d("div",C,[t[5]||(t[5]=d("span",{class:"text-[15px] text-white mb-[10px]"},"当前金币",-1)),d("div",I,[t[4]||(t[4]=d("i",{class:"icon-sprite icon-coin w-[20px] h-[20px]"},null,-1)),d("span",P,u(Math.floor(v(o).coin)),1)])])])]),d("main",z,[d("div",D,[t[12]||(t[12]=d("img",{src:"https://ggjs.bdrcp.cn/pwa/1.0.1/assets/verdor-ChZAeN5d.png",class:"w-[213px] mb-[25px]"},null,-1)),d("div",_,[d("div",A,[(b(),x(m,null,f([0,1],(e,s)=>d("div",{key:s,onClick:e=>v(l).selectPlan(s),class:g(["relative w-full h-[60px] rounded-[10px] border flex items-center px-[25px] transition-colors cursor-pointer",v(l).selectedPlanIndex===s?"bg-[#442D37] border-[#FE2B54] border-2":"bg-[#1D1B2F] border-[#272640] border-[1.5px]"])},[d("span",B," 兑换"+u(a(s))+"个月VIP ",1),t[8]||(t[8]=d("div",{class:"flex-1"},null,-1)),t[9]||(t[9]=d("i",{class:"icon-sprite icon-coin w-[25px] h-[25px] mr-[4px]"},null,-1)),d("span",M,u(r(s)),1),t[10]||(t[10]=d("div",{class:"w-[30px]"},null,-1)),v(l).selectedPlanIndex===s?(b(),x("i",U)):h("",!0)],10,q)),64))]),t[11]||(t[11]=d("div",{class:"h-[80px]"},null,-1))]),d("button",{onClick:t[1]||(t[1]=(...e)=>v(l).executeExchange&&v(l).executeExchange(...e)),class:"w-[90%] h-[40px] rounded-[20px] bg-[#F2C94C] mx-[34px] flex items-center justify-center text-[14px] font-bold text-[#0E0F12] active:opacity-90 transition-opacity"}," 立即成为尊贵VIP ")])])]))}});export{G as default};
