"use strict";
const common_vendor = require("../../../common/vendor.js");
const components_request = require("../../../components/request.js");
const components_formatDate = require("../../../components/formatDate.js");
const _sfc_main = {
  data() {
    return {
      title: "Hello",
      userinfo: {},
      page: 0,
      triggered: false,
      pointslist: []
    };
  },
  onLoad() {
    common_vendor.index.getStorage({
      key: "userinfo",
      success: (res) => {
        this.userinfo = res.data;
        this.onRefresherRefresh();
      }
    });
  },
  methods: {
    formatDate: components_formatDate.formatDate,
    //下拉刷新
    onRefresherRefresh() {
      this.page = 0;
      this.triggered = true;
      this.pointslist = [];
      this.getPointsDetail();
    },
    //上拉加载
    onScrollToLower() {
      this.page += 1;
      this.getPointsDetail();
    },
    //获取积分详情
    getPointsDetail() {
      components_request.request({
        url: "user/pointsDetail",
        method: "POST",
        data: {
          userId: this.userinfo.id,
          page: this.page,
          size: 10
        },
        userInfo: true
      }).then((res) => {
        if (res.code === 200) {
          this.pointslist.push(...res.data);
          this.triggered = false;
        } else {
          common_vendor.index.__f__("log", "at pages/Mine/minecomponents/points.vue:101", res.msg);
        }
      });
    },
    // 返回上一页
    onBack() {
      common_vendor.index.navigateBack({
        delta: 1
      });
    }
  }
};
if (!Array) {
  const _component_uni_card = common_vendor.resolveComponent("uni-card");
  _component_uni_card();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  return common_vendor.e({
    a: common_vendor.o$1((...args) => $options.onBack && $options.onBack(...args)),
    b: $data.pointslist.length != 0
  }, $data.pointslist.length != 0 ? {
    c: common_vendor.f($data.pointslist, (item, index, i0) => {
      return {
        a: common_vendor.t(item.info),
        b: common_vendor.t(item.status == 0 ? "-" + item.number : "+" + item.number),
        c: common_vendor.t($options.formatDate(item.time)),
        d: item.status == 0 ? "#ff000011" : "#11ff002b",
        e: index,
        f: "cd2929c5-0-" + i0
      };
    }),
    d: common_vendor.o$1((...args) => $options.onRefresherRefresh && $options.onRefresherRefresh(...args)),
    e: common_vendor.o$1((...args) => $options.onScrollToLower && $options.onScrollToLower(...args)),
    f: $data.triggered
  } : {}, {
    g: $data.pointslist.length == 0
  }, $data.pointslist.length == 0 ? {} : {});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-cd2929c5"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../../.sourcemap/mp-weixin/pages/Mine/minecomponents/points.js.map
