"use strict"; var common_vendor = require("../common/vendor.js"); var api_common = require("../api/common.js"); var api_integral = require("../api/integral.js"); require("../common/request.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, tags: [{ lable: "\u5168\u90E8", value: 0 }, { lable: "\u83B7\u5F97", value: 1 }, { lable: "\u6D88\u8017", value: 2 }], 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: { bg: function() { return "rgba(255,142,60, " + this.top / 30 + ")"; } }, methods: { getDictByKey(key) { var data = { key }; api_common.getDictByKey(data).then((res) => { if (res.code == 200) { this.typeOptions = res.data; } }, (err) => { }); }, doSign() { var data = {}; api_integral.doSign(data).then((res) => { 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() { api_integral.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: "\u8BF7\u6C42\u5931\u8D25" }); } }, (rej) => { }); }, getUserIntegralLogsList() { let that = this; if (that.loaded == true || that.loading == true) return; that.loading = true; common_vendor.index.showLoading({ title: "\u52A0\u8F7D\u4E2D..." }); api_integral.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(); }, 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 }) }); } var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__file", "E:/Project/2023/\u95EE\u8BCA\u5E73\u53F0/his_user_miniapp/pages_user/integral.vue"]]); _sfc_main.__runtimeHooks = 1; wx.createPage(MiniProgramPage);