recharge.js
1.6 KB
"use strict";const e=require("../../common/vendor.js"),r=require("../../api/index.js");require("../../utils/request.js");Array||e.resolveComponent("u-navbar")();const p=()=>"../../uni_modules/uview-plus/components/u-navbar/u-navbar.js";Math||p();const b={__name:"recharge",setup(i){e.onShow(()=>{f(),d(),m()});let s=e.ref([]),o=e.ref(""),l=e.ref(0),u=e.ref(0);const c=e.ref({}),v=(a,t)=>{l.value=t},h=()=>{let a=s.value[l.value].money;_(o.value==""?a:o.value)},{proxy:y}=e.getCurrentInstance(),_=async a=>{try{const t=await r.getRecharge(a);y.$methods.pay(t),console.log("getRecharge",t)}catch(t){e.index.showToast({title:t,icon:"none"}),console.log("getRecharge",t)}},f=async()=>{try{const a=await r.getPackage();s.value=a,console.log("getPackage",a)}catch(a){e.index.showToast({title:a,icon:"none"}),console.log("getPackage",a)}},d=async()=>{try{const a=await r.getyue();u.value=a.money,e.index.setStorageSync("balance",a.money),console.log("getyue",a)}catch(a){e.index.showToast({title:a,icon:"none"}),console.log("getyue",a)}},m=async()=>{try{const a=await r.getMine();c.value=a.userInfo,c.value.avatar=a.avatar}catch(a){e.index.showToast({title:a,icon:"none"}),console.log("getMine",a)}};return(a,t)=>({a:e.p({leftIconColor:"#fff",placeholder:!0,title:"会员中心",bgColor:"#1D1E24",autoBack:!0}),b:e.t(e.unref(u)),c:c.value.avatar,d:e.t(c.value.nickname),e:e.unref(o),f:e.o(n=>e.isRef(o)?o.value=n.detail.value:o=n.detail.value),g:e.f(e.unref(s),(n,g,w)=>({a:e.t(n.money),b:e.t(n.discount),c:e.o(x=>v(n,g),n.id),d:e.n(e.unref(l)==g?"check":""),e:n.id})),h:e.o(h)})}},k=e._export_sfc(b,[["__file","D:/vue/大健康商城/healthMall/pages/mine/recharge.vue"]]);wx.createPage(k);