123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- "use strict";
- const common_vendor = require("../common/vendor.js");
- const _sfc_main = {
- mixins: [MescrollMixin],
- data() {
- return {
- integral: 0,
- type: "0",
- typeOptions: [],
- tabIndex: 0,
- tabs: [],
- mescroll: null,
- downOption: {
- //下拉刷新
- use: true,
- auto: false
- // 不自动加载 (mixin已处理第一个tab触发downCallback)
- },
- upOption: {
- onScroll: false,
- use: true,
- // 是否启用上拉加载; 默认true
- page: {
- pae: 0,
- // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
- size: 10
- // 每页数据的数量,默认10
- },
- noMoreSize: 10,
- // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
- textNoMore: "已经到底了",
- empty: {
- icon: "https://cos.his.cdwjyyh.com/fs/20240423/cf4a86b913a04341bb44e34bb4d37aa2.png",
- tip: "暂无数据"
- }
- },
- dataList: []
- };
- },
- onLoad() {
- this.getDictByKey("sys_integral_goods_type");
- this.getUserInfo();
- },
- methods: {
- getUserInfo() {
- getUserInfo().then(
- (res) => {
- if (res.code == 200) {
- if (res.user != null) {
- this.integral = res.user.integral;
- }
- } else {
- common_vendor.index.showToast({
- icon: "none",
- title: "请求失败"
- });
- }
- },
- (rej) => {
- }
- );
- },
- navTo(url) {
- common_vendor.index.navigateTo({
- url
- });
- },
- goIntegral() {
- let pages = getCurrentPages();
- let url = pages[pages.length - 2];
- if (pages.length > 1 && url && url.route == "pages/user/integral/points") {
- common_vendor.index.navigateBack();
- } else {
- common_vendor.index.navigateTo({
- url: "/pages/user/integral/points"
- });
- }
- },
- getDictByKey(key) {
- var data = { key };
- var that = this;
- getDictByKey(data).then(
- (res) => {
- if (res.code == 200) {
- this.typeOptions = res.data;
- this.typeOptions.forEach(function(item, index) {
- var data2 = { name: item.dictLabel };
- that.tabs.push(data2);
- });
- if (this.tabs.length > 0) {
- this.tabIndex = 0;
- }
- }
- },
- (err) => {
- }
- );
- },
- tabChange(item) {
- console.log(item.index);
- this.type = this.typeOptions[item.index].dictValue;
- this.mescroll.resetUpScroll();
- },
- mescrollInit(mescroll) {
- this.mescroll = mescroll;
- },
- /*下拉刷新的回调 */
- downCallback(mescroll) {
- mescroll.resetUpScroll();
- },
- upCallback(page) {
- var that = this;
- var data = {
- pageNum: page.num,
- pageSize: page.size
- };
- if (this.type != null) {
- data.goodsType = this.type;
- }
- getIntegralGoodsList(data).then((res) => {
- if (res.code == 200) {
- if (page.num == 1) {
- that.dataList = res.data.list;
- } else {
- that.dataList = that.dataList.concat(res.data.list);
- }
- that.mescroll.endBySize(res.data.list.length, res.data.total);
- } else {
- common_vendor.index.showToast({
- icon: "none",
- title: "请求失败"
- });
- that.dataList = null;
- that.mescroll.endErr();
- }
- });
- }
- }
- };
- if (!Array) {
- const _easycom_u_tabs2 = common_vendor.resolveComponent("u-tabs");
- const _easycom_u_sticky2 = common_vendor.resolveComponent("u-sticky");
- const _component_mescroll_body = common_vendor.resolveComponent("mescroll-body");
- (_easycom_u_tabs2 + _easycom_u_sticky2 + _component_mescroll_body)();
- }
- const _easycom_u_tabs = () => "../uni_modules/uview-plus/components/u-tabs/u-tabs.js";
- const _easycom_u_sticky = () => "../uni_modules/uview-plus/components/u-sticky/u-sticky.js";
- if (!Math) {
- (_easycom_u_tabs + _easycom_u_sticky)();
- }
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return common_vendor.e({
- a: common_vendor.t($data.integral),
- b: common_vendor.o((...args) => $options.goIntegral && $options.goIntegral(...args)),
- c: common_vendor.o(($event) => $options.navTo("/pages/user/integral/integralLogsList")),
- d: common_vendor.o(($event) => $options.navTo("/pages/user/integral/integralOrderList")),
- e: $data.tabs.length > 0
- }, $data.tabs.length > 0 ? {
- f: common_vendor.o($options.tabChange),
- g: common_vendor.p({
- current: $data.tabIndex,
- scrollable: true,
- list: $data.tabs,
- lineColor: "#FF5C03"
- })
- } : {}, {
- h: common_vendor.f($data.dataList, (item, index, i0) => {
- return {
- a: item.imgUrl,
- b: common_vendor.t(item.goodsName),
- c: common_vendor.t(item.integral),
- d: common_vendor.t(item.otPrice.toFixed(2)),
- e: common_vendor.o(($event) => $options.navTo("/pages/user/integral/integralGoodsDetails?goodsId=" + item.goodsId))
- };
- }),
- i: common_vendor.sr("mescrollRef", "a55124e7-2"),
- j: common_vendor.o($options.mescrollInit),
- k: common_vendor.o($options.downCallback),
- l: common_vendor.o($options.upCallback),
- m: common_vendor.p({
- bottom: "0",
- down: $data.downOption,
- up: $data.upOption
- })
- });
- }
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-a55124e7"]]);
- wx.createPage(MiniProgramPage);
|