"use strict"; const common_vendor = require("../common/vendor.js"); const Loading = () => "../components/Loading.js"; const _sfc_main = { components: { Loading }, data() { return { typeOptions: [], isDaySign: false, top: 0, signNum: 0, integral: 0, sign: [], // 状态栏的高度 statusBarHeight: common_vendor.index.getStorageSync("menuInfo").statusBarHeight, // tab切换 tags: [{ lable: "全部", value: 0 }, { lable: "获得", value: 1 }, { lable: "消耗", value: 2 }], // 选中的tab tabIndex: 0, current: 0, page: { type: 0, page: 1, pageSize: 10 }, list: [], loaded: false, loading: false }; }, onLoad(option) { this.getDictByKey("sys_integral_log_type"); this.getUserSign(); this.getUserIntegralLogsList(); }, onReachBottom() { !this.loading && this.getUserIntegralLogsList(); }, onPageScroll(e) { if (e.scrollTop > 30) { this.topFixed = true; } else { this.topFixed = false; } }, onPageScroll(e) { this.top = e.scrollTop; }, computed: { // 计算属性的 getter bg: function() { return "rgba(255,142,60, " + this.top / 30 + ")"; } }, methods: { getDictByKey(key) { var data = { key }; getDictByKey(data).then( (res) => { if (res.code == 200) { this.typeOptions = res.data; } }, (err) => { } ); }, doSign() { var data = {}; common_vendor.index.showLoading({ title: "正在加载中..." }); doSign(data).then( (res) => { common_vendor.index.hideLoading(); if (res.code == 200) { common_vendor.index.showToast({ icon: "success", title: res.msg }); this.list = []; this.page.page = 1; this.list = []; this.loaded = false; this.loading = false; this.getUserIntegralLogsList(); this.getUserSign(); } else { common_vendor.index.showToast({ icon: "none", title: res.msg }); } }, (rej) => { } ); }, getUserSign() { getUserSign().then( (res) => { if (res.code == 200) { this.data = res.member; this.signNum = res.signNum; this.isDaySign = res.isDaySign; this.integral = res.integral; this.sign = JSON.parse(res.sign); } else { common_vendor.index.showToast({ icon: "none", title: "请求失败" }); } }, (rej) => { } ); }, getUserIntegralLogsList() { let that = this; if (that.loaded == true || that.loading == true) return; that.loading = true; common_vendor.index.showLoading({ title: "加载中..." }); getUserIntegralLogsList(that.page).then( (res) => { that.loading = false; that.loaded = res.data.list.length < that.page.pageSize; that.page.page = that.page.page + 1; that.list.push.apply(that.list, res.data.list); common_vendor.index.hideLoading(); }, (err) => { common_vendor.index.hideLoading(); common_vendor.index.showToast({ title: err.msg, icon: "none", duration: 2e3 }); } ); }, // 返回上一页 back() { common_vendor.index.navigateBack(); }, // tab选择 tabChange(item) { console.log(item); this.tabIndex = item.value; this.page.type = this.tabIndex; this.page.page = 1; this.list = []; this.loaded = false; this.loading = false; this.getUserIntegralLogsList(); } } }; if (!Array) { const _component_Loading = common_vendor.resolveComponent("Loading"); _component_Loading(); } function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return common_vendor.e({ a: $data.statusBarHeight, b: common_vendor.o((...args) => $options.back && $options.back(...args)), c: $options.bg, d: $data.statusBarHeight, e: common_vendor.t($data.integral), f: common_vendor.t($data.signNum), g: common_vendor.f($data.sign, (item, index, i0) => { return common_vendor.e({ a: $data.signNum >= index + 1 }, $data.signNum >= index + 1 ? {} : {}, { b: common_vendor.t(item.day), c: index, d: common_vendor.n($data.signNum >= index + 1 ? "item active" : "item") }); }), h: $data.isDaySign == false }, $data.isDaySign == false ? { i: common_vendor.o(($event) => $options.doSign()) } : {}, { j: common_vendor.f($data.tags, (item, index, i0) => { return { a: common_vendor.t(item.lable), b: $data.tabIndex == item.value, c: index, d: common_vendor.n($data.tabIndex == item.value ? "item active" : "item"), e: common_vendor.o(($event) => $options.tabChange(item), index) }; }), k: common_vendor.f($data.list, (item, index, i0) => { return common_vendor.e({ a: common_vendor.t(_ctx.$getDictLabelName($data.typeOptions, item.logType)), b: common_vendor.t(item.createTime), c: item.integral < 0 }, item.integral < 0 ? { d: common_vendor.t(item.integral) } : { e: common_vendor.t(item.integral) }, { f: index }); }), l: common_vendor.p({ loaded: $data.loaded, loading: $data.loading }) }); } const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]); _sfc_main.__runtimeHooks = 1; wx.createPage(MiniProgramPage);