2 lines
5.3 KiB
JavaScript
2 lines
5.3 KiB
JavaScript
import{L as P,W as F,_ as G,k as N,o as $,c as f,b as s,l as I,q as i,F as L,x as T,n as C,m as H,r as n,S as M,j as g,Q as j,t as c,y as O,D as R,E as W}from"./index-CIAVq8iD-1776148658686.js";import{s as q,b as Q}from"./toast-aIWCznBB-1776148658686.js";import{s as J}from"./userInfo-gLO2xl8i-1776148658686.js";import{G as K}from"./GeneralHeader-ClI1i1Ud-1776148658686.js";import{m as X}from"./MaskLayer-CMaJd7Gb-1776148658686.js";const Y=async a=>{try{return await P(`/sys/manager/props?propsType=${a.propsType}¤cyType=${a.currencyType}`)}catch(o){throw console.error("Failed to fetch admin center list:",o),console.error("error:"+o.response.errorMsg),o}},Z=async a=>{try{return await F("/sys/manager/send",a)}catch(o){throw console.error("Failed to fetch give props:",o),console.error("error:"+o.response.errorMsg),o}},ee=async a=>{try{return await P(`/app/h5/own-permission?propsType=${a}`)}catch(o){throw console.error("Failed to fetch has send gifts permission:",o),console.error("error:"+o.response.errorMsg),o}},oe={class:"fullPage"},te={class:"bg"},se={style:{display:"flex","justify-content":"space-around","background-color":"transparent",position:"relative"}},re=["onClick"],ne={style:{width:"100%",display:"grid","grid-template-columns":"repeat(2, 1fr)",gap:"12px",padding:"15px"}},ae=["onClick"],le={style:{"background-color":"white","border-radius":"10px","box-shadow":"0px 0px 3px 1px rgba(0, 0, 0, 0.2)",display:"flex","flex-direction":"column","align-items":"center"}},ie=["src"],ce={style:{"background-color":"#bb92ff",color:"white","margin-bottom":"10px",border:"0","border-radius":"20px",padding:"5px 10px"}},de=["src"],pe={style:{"font-weight":"600",margin:"10px 0"}},ue={style:{color:"#00000080","margin-right":"10px"}},fe={style:{"font-weight":"700",color:"#000"}},ge={style:{width:"90%",display:"flex","justify-content":"center","align-items":"center",gap:"4px"}},he=["placeholder"],me={__name:"ItemDistribution",setup(a){const{t:o,locale:S}=N(),v=n([{id:1,name:"frames"},{id:2,name:"vehicles"}]),h=n(0),y=n("frames"),m=n([]),l=n(!0),E=e=>{h.value!=e&&(console.log("切换标签"),b.value=[],h.value=e,y.value=v.value[e].name,w())},x=M(()=>{console.log("计算属性");const e=S.value;if(console.log("当前语言:",e),m.value.length===0)return{};const t=m.value[h.value];return console.log("选中元素的左边距",t.offsetLeft),{position:"absolute",left:`${t.offsetLeft+t.offsetWidth/2-15/2}px`,bottom:"0",transition:"left 0.3s ease"}}),d=n(""),B=async e=>{const t=await ee(e);return console.log("response:",t),t.body},D=async()=>{if(l.value){l.value=!1,console.log("赠送用户id:",d.value),console.log("赠送商品:",p.value);try{const e=await J(d.value);if(console.log("targetUserInfo:",e),e.status&&e.body){const t={propsId:p.value.id,acceptUserId:e.body.id},r=await Z(t);r.errorCode==0&&r.status?(k(),q(o("gift_delivery_successful"))):l.value=!0}else l.value=!0}catch(e){throw console.log("error:",e),Q(e.response.errorMsg),l.value=!0,e}}},V=()=>({frames:"AVATAR_FRAME",vehicles:"RIDE",chat_box:"CHAT_BUBBLE",theme:"THEME",vip:"NOBLE_VIP"})[y.value],w=async()=>{try{const e={propsType:V(),currencyType:"GOLD"},t=await Y(e);console.log("response:",t),b.value=t.body}catch(e){throw e}},b=n([]),p=n({}),A=M(()=>y.value=="VIP"?"3":"7"),_=n(!1),U=e=>{console.log("product:",e),p.value=e,_.value=!0},k=()=>{l.value=!0,p.value={},d.value="",_.value=!1};return $(()=>{console.log("onMounted"),B("NOBLE_VIP")&&v.value.push({id:3,name:"vip"}),m.value.length>0&&x.value,w()}),(e,t)=>(g(),f("div",oe,[s("div",te,[I(K,{showLanguageList:!0,title:i(o)("item_distribution"),color:"black",style:{"box-shadow":"0 0 10px rgba(0, 0, 0, 0.1)","z-index":"999"}},null,8,["title"]),s("div",se,[(g(!0),f(L,null,T(v.value,(r,u)=>(g(),f("div",{key:u,style:{"font-size":"1.3em",padding:"10px 0",flex:"1","text-align":"center"},class:j(["tab-item",h.value==u?"tabName-active":"tabName"]),ref_for:!0,ref_key:"tabItems",ref:m,onClick:z=>E(u)},c(i(o)(r.name)),11,re))),128)),s("div",{style:C([{width:"15px",height:"3px","background-color":"#bb92ff"},x.value])},null,4)]),s("div",ne,[(g(!0),f(L,null,T(b.value,(r,u)=>(g(),f("div",{key:u,onClick:z=>U(r)},[s("div",le,[s("img",{src:r.cover,alt:"",style:{width:"60%",margin:"10px 0"}},null,8,ie),s("button",ce,c(i(o)("send")),1)])],8,ae))),128))]),I(X,{maskLayerShow:_.value,onClick:k},{default:H(()=>[s("div",{style:{padding:"20px","background-color":"white",display:"flex","flex-direction":"column","align-items":"center","border-radius":"20px",margin:"20% 5%"},onClick:t[1]||(t[1]=O(()=>{},["stop"]))},[s("img",{src:p.value.cover,alt:"",style:{width:"60%",margin:"5px 0"}},null,8,de),s("div",pe,[s("span",ue,c(i(o)("validity"))+":",1),s("span",fe,c(A.value)+c(i(o)("day")),1)]),s("div",ge,[R(s("input",{type:"text",placeholder:i(o)("enter_user_id_placeholder"),style:{flex:"1","min-width":"0","align-self":"stretch","border-radius":"8px",border:"0",outline:"none","background-color":"#f1f1f1b2",padding:"8px","margin-right":"4px","font-size":"1em","font-weight":"590"},"onUpdate:modelValue":t[0]||(t[0]=r=>d.value=r)},null,8,he),[[W,d.value]]),s("button",{style:C([{width:"auto","min-width":"0","align-self":"stretch","border-radius":"8px",border:"0",padding:"8px",color:"white","font-size":"1em","font-weight":"590"},{backgroundColor:l.value?"#bb92ff":"#00000080"}]),onClick:D},c(i(o)("confirm")),5)])])]),_:1},8,["maskLayerShow"])])]))}},we=G(me,[["__scopeId","data-v-1d82bfd1"]]);export{we as default};
|