myPoints.js 1.7 KB
"use strict";const e=require("../../common/vendor.js"),a=require("../../api/index.js");require("../../utils/request.js");Array||e.resolveComponent("u-navbar")();const _=()=>"../../uni_modules/uview-plus/components/u-navbar/u-navbar.js";Math||_();const f={__name:"myPoints",setup(s){e.onLoad(o=>{t.value=o.type,o.type==0?(i(),u()):(g(),y())});const l=()=>{e.index.navigateTo({url:"/pages/mine/recharge"})};let r=e.ref(0),c=e.ref([]),t=e.ref(0);const i=async()=>{try{const o=await a.getyue();r.value=o.money,e.index.setStorageSync("balance",o.money),console.log("getyue",o)}catch(o){e.index.showToast({title:o,icon:"none"}),console.log("getyue",o)}},u=async()=>{try{const o=await a.getMoneyDetail();c.value=o,console.log("getMoneyDetail",o)}catch(o){e.index.showToast({title:o,icon:"none"}),console.log("getMoneyDetail",o)}},g=async()=>{try{const o=await a.getMyScore();r.value=o.score,e.index.setStorageSync("myPoints",o.score),console.log("getMyScore",o)}catch(o){e.index.showToast({title:o,icon:"none"}),console.log("getMyScore",o)}},y=async()=>{try{const o=await a.getScoreDetail();c.value=o,console.log("getScoreDetail",o)}catch(o){e.index.showToast({title:o,icon:"none"}),console.log("getScoreDetail",o)}};return(o,d)=>e.e({a:e.p({placeholder:!0,title:e.unref(t)==0?"我的余额":"我的积分",bgColor:"#F6F8FA",autoBack:!0}),b:e.t(e.unref(t)==0?"余额":"积分"),c:e.unref(t)==0},e.unref(t)==0?{d:e.t(e.unref(r)),e:e.o(l)}:{f:e.t(e.unref(r))},{g:e.t(e.unref(t)==0?"余额明细":"积分明细"),h:e.f(e.unref(c),(n,h,m)=>({a:e.t(n.createtime),b:e.t(n.before*1-n.after*1>0?"-":"+"),c:e.t(e.unref(t)==0?n.money:n.score),d:n.id}))})}},v=e._export_sfc(f,[["__file","D:/vue/大健康商城/healthMall/pages/mine/myPoints.vue"]]);wx.createPage(v);