myPoints.js
3.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
"use strict";
var common_vendor = require("../../common/vendor.js");
var api_index = require("../../api/index.js");
require("../../utils/request.js");
if (!Array) {
const _easycom_u_navbar2 = common_vendor.resolveComponent("u-navbar");
_easycom_u_navbar2();
}
const _easycom_u_navbar = () => "../../uni_modules/uview-plus/components/u-navbar/u-navbar.js";
if (!Math) {
_easycom_u_navbar();
}
const _sfc_main = {
setup(__props) {
common_vendor.onLoad((e) => {
type.value = e.type;
if (e.type == 0) {
getyues();
getMoneyDetails();
} else {
getMyScores();
getScoreDetails();
}
});
const toRecharge = () => {
common_vendor.index.navigateTo({
url: "/pages/mine/recharge"
});
};
let integral = common_vendor.ref(0);
let recordList = common_vendor.ref([]);
let type = common_vendor.ref(0);
const getyues = async () => {
try {
const res = await api_index.getyue();
integral.value = res.money;
common_vendor.index.setStorageSync("balance", res.money);
console.log("getyue", res);
} catch (err) {
common_vendor.index.showToast({ title: err, icon: "none" });
console.log("getyue", err);
}
};
const getMoneyDetails = async () => {
try {
const res = await api_index.getMoneyDetail();
recordList.value = res.mingxi;
console.log("getMoneyDetail", res);
} catch (err) {
common_vendor.index.showToast({ title: err, icon: "none" });
console.log("getMoneyDetail", err);
}
};
const getMyScores = async () => {
try {
const res = await api_index.getMyScore();
integral.value = res.score;
common_vendor.index.setStorageSync("myPoints", res.score);
console.log("getMyScore", res);
} catch (err) {
common_vendor.index.showToast({ title: err, icon: "none" });
console.log("getMyScore", err);
}
};
const getScoreDetails = async () => {
try {
const res = await api_index.getScoreDetail();
recordList.value = res;
console.log("getScoreDetail", res);
} catch (err) {
common_vendor.index.showToast({ title: err, icon: "none" });
console.log("getScoreDetail", err);
}
};
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.p({
placeholder: true,
title: common_vendor.unref(type) == 0 ? "\u6211\u7684\u4F59\u989D" : "\u6211\u7684\u79EF\u5206",
bgColor: "#F6F8FA",
autoBack: true
}),
b: common_vendor.t(common_vendor.unref(type) == 0 ? "\u4F59\u989D" : "\u79EF\u5206"),
c: common_vendor.unref(type) == 0
}, common_vendor.unref(type) == 0 ? {
d: common_vendor.t(common_vendor.unref(integral)),
e: common_vendor.o(toRecharge)
} : {
f: common_vendor.t(common_vendor.unref(integral))
}, {
g: common_vendor.t(common_vendor.unref(type) == 0 ? "\u4F59\u989D\u660E\u7EC6" : "\u79EF\u5206\u660E\u7EC6"),
h: common_vendor.f(common_vendor.unref(recordList), (item, k0, i0) => {
return {
a: common_vendor.t(item.createtime),
b: common_vendor.t(item.before * 1 - item.after * 1 > 0 ? "-" : "+"),
c: common_vendor.t(common_vendor.unref(type) == 0 ? item.money : item.score),
d: item.id
};
})
});
};
}
};
var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "D:/vue/\u5927\u5065\u5EB7\u5546\u57CE/healthMall/pages/mine/myPoints.vue"]]);
wx.createPage(MiniProgramPage);