jiuyiUniapp/jiuyi2/unpackage/dist/dev/mp-weixin/pages/index/wallet.js

120 lines
3.5 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const common_assets = require("../../common/assets.js");
const api_intergral = require("../../api/intergral.js");
if (!Array) {
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
(_easycom_uni_icons2 + _easycom_uni_popup2)();
}
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
const _easycom_uni_popup = () => "../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
if (!Math) {
(_easycom_uni_icons + _easycom_uni_popup)();
}
const _sfc_main = {
__name: "wallet",
setup(__props) {
const scrollLog = common_vendor.reactive({
data: [],
pageNum: 1,
pageSize: 30,
total: 0
});
const store = common_vendor.useStore();
common_vendor.onLoad(() => {
getList();
});
common_vendor.onPullDownRefresh(() => {
refreshList();
});
common_vendor.onReachBottom(() => {
getMoreList();
});
const userinfo = common_vendor.computed(() => {
let result = store.state.userinfo;
return result;
});
function refreshList() {
scrollLog.homePageSize = 1;
getList();
}
function getMoreList() {
if (scrollLog.total <= scrollLog.data.length)
return;
scrollLog.pageNum++;
getList();
}
function navigateToPage(path) {
common_vendor.index.navigateTo({
url: path
});
}
function getList() {
api_intergral.intergral.scrollChange({
query: {
pageNum: scrollLog.pageNum,
pageSize: scrollLog.pageSize
}
}).then((rs) => {
if (rs.code == 200) {
if (scrollLog.pageNum == 1)
scrollLog.data.length = 0;
scrollLog.data.push(...rs.rows);
scrollLog.total = rs.total;
console.log(scrollLog);
return;
}
util.alert({
content: rs.msg,
showCancel: false
});
}).finally(() => {
common_vendor.index.stopPullDownRefresh();
});
}
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.t(userinfo.value.balance || 0),
b: common_vendor.t(userinfo.value.fruit || 0),
c: common_vendor.t(userinfo.value.seed || 0),
d: common_vendor.t(userinfo.value.score || 0)
}, {}, {
h: common_vendor.f(scrollLog.data, (item, index, i0) => {
return {
a: common_vendor.t(item.context),
b: common_vendor.t(item.createTime),
c: index
};
}),
i: common_assets._imports_0$4,
j: common_assets._imports_1$1,
k: common_vendor.o$1(($event) => navigateToPage("/pages/shop/settle")),
l: common_vendor.p({
type: "closeempty",
color: "#fff",
size: "34rpx"
}),
m: common_vendor.o$1(($event) => _ctx.$refs.settledRef.close()),
n: common_vendor.sr("settledRef", "f101e3b8-1"),
o: common_vendor.p({
type: "center"
}),
p: common_assets._imports_2$1,
q: common_assets._imports_1$1,
r: common_vendor.p({
type: "closeempty",
color: "#fff",
size: "34rpx"
}),
s: common_vendor.o$1(($event) => _ctx.$refs.offRef.close()),
t: common_vendor.sr("offRef", "f101e3b8-3"),
v: common_vendor.p({
type: "center"
})
});
};
}
};
wx.createPage(_sfc_main);