| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 | "use strict";const common_vendor = require("../../common/vendor.js");const sheep_index = require("../../sheep/index.js");const sheep_api_promotion_rewardActivity = require("../../sheep/api/promotion/rewardActivity.js");const sheep_hooks_useGoods = require("../../sheep/hooks/useGoods.js");const sheep_api_product_spu = require("../../sheep/api/product/spu.js");require("../../sheep/url/index.js");require("../../sheep/store/index.js");require("../../sheep/store/app.js");require("../../sheep/api/promotion/diy.js");require("../../sheep/request/index.js");require("../../sheep/config/index.js");require("../../sheep/platform/index.js");require("../../sheep/platform/provider/wechat/index.js");require("../../sheep/platform/provider/wechat/miniProgram.js");require("../../sheep/api/member/auth.js");require("../../sheep/api/member/social.js");require("../../sheep/api/member/user.js");require("../../sheep/platform/provider/apple/index.js");require("../../sheep/platform/share.js");require("../../sheep/router/index.js");require("../../sheep/hooks/useModal.js");require("../../sheep/helper/index.js");require("../../sheep/helper/test.js");require("../../sheep/helper/digit.js");require("../../sheep/helper/throttle.js");require("../../sheep/platform/pay.js");require("../../sheep/api/pay/order.js");require("../../sheep/store/user.js");require("../../sheep/store/cart.js");require("../../sheep/api/trade/cart.js");require("../../sheep/api/pay/wallet.js");require("../../sheep/api/trade/order.js");require("../../sheep/api/promotion/coupon.js");require("../../sheep/store/sys.js");require("../../sheep/store/modal.js");require("../../sheep/config/zIndex.js");require("../../sheep/util/index.js");if (!Array) {  const _easycom_su_sticky2 = common_vendor.resolveComponent("su-sticky");  const _easycom_s_goods_column2 = common_vendor.resolveComponent("s-goods-column");  const _easycom_uni_load_more2 = common_vendor.resolveComponent("uni-load-more");  const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");  (_easycom_su_sticky2 + _easycom_s_goods_column2 + _easycom_uni_load_more2 + _easycom_s_layout2)();}const _easycom_su_sticky = () => "../../sheep/ui/su-sticky/su-sticky.js";const _easycom_s_goods_column = () => "../../sheep/components/s-goods-column/s-goods-column.js";const _easycom_uni_load_more = () => "../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js";const _easycom_s_layout = () => "../../sheep/components/s-layout/s-layout.js";if (!Math) {  (_easycom_su_sticky + _easycom_s_goods_column + _easycom_uni_load_more + _easycom_s_layout)();}const _sfc_main = {  __name: "index",  setup(__props) {    const state = common_vendor.reactive({      activityId: 0,      // 获得编号      activityInfo: {},      // 获得信息      pagination: {        list: [],        total: 1,        pageNo: 1,        pageSize: 8      },      loadStatus: "",      leftGoodsList: [],      rightGoodsList: []    });    let count = 0;    let leftHeight = 0;    let rightHeight = 0;    function mountMasonry(height = 0, where = "left") {      if (!state.pagination.list[count])        return;      if (where === "left") {        leftHeight += height;      } else {        rightHeight += height;      }      if (leftHeight <= rightHeight) {        state.leftGoodsList.push(state.pagination.list[count]);      } else {        state.rightGoodsList.push(state.pagination.list[count]);      }      count++;    }    async function getList() {      const params = {};      if (state.activityInfo.productScope === 2) {        params.ids = state.activityInfo.productSpuIds.join(",");      } else if (state.activityInfo.productScope === 3) {        params.categoryIds = state.activityInfo.productSpuIds.join(",");      }      state.loadStatus = "loading";      const { code, data } = await sheep_api_product_spu.SpuApi.getSpuPage({        pageNo: state.pagination.pageNo,        pageSize: state.pagination.pageSize,        ...params      });      if (code !== 0) {        return;      }      state.pagination.list = common_vendor._.concat(state.pagination.list, data.list);      state.pagination.total = data.total;      state.loadStatus = state.pagination.list.length < state.pagination.total ? "more" : "noMore";      mountMasonry();    }    async function getActivity(id) {      const { code, data } = await sheep_api_promotion_rewardActivity.RewardActivityApi.getRewardActivity(id);      if (code === 0) {        state.activityInfo = data;      }    }    function loadMore() {      if (state.loadStatus === "noMore") {        return;      }      state.pagination.pageNo++;      getList();    }    common_vendor.onReachBottom(() => {      loadMore();    });    common_vendor.onLoad(async (options) => {      state.activityId = options.activityId;      await getActivity(state.activityId);      await getList(state.activityId);    });    return (_ctx, _cache) => {      return common_vendor.e({        a: common_vendor.f(state.activityInfo.rules, (item, k0, i0) => {          return {            a: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.formatRewardActivityRule)(state.activityInfo, item)),            b: item          };        }),        b: common_vendor.p({          bgColor: "#fff"        }),        c: common_vendor.f(state.leftGoodsList, (item, k0, i0) => {          return {            a: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/goods/index", {              id: item.id            }), item.id),            b: common_vendor.o(($event) => mountMasonry($event, "left"), item.id),            c: "2c61ebca-2-" + i0 + ",2c61ebca-0",            d: common_vendor.p({              size: "md",              data: item            }),            e: item.id          };        }),        d: common_vendor.f(state.rightGoodsList, (item, k0, i0) => {          return {            a: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/goods/index", {              id: item.id            }), item.id),            b: common_vendor.o(($event) => mountMasonry($event, "right"), item.id),            c: "2c61ebca-3-" + i0 + ",2c61ebca-0",            d: common_vendor.p({              size: "md",              data: item            }),            e: item.id          };        }),        e: state.pagination.total > 0      }, state.pagination.total > 0 ? {        f: common_vendor.o(loadMore),        g: common_vendor.p({          status: state.loadStatus,          ["content-text"]: {            contentdown: "上拉加载更多"          }        })      } : {}, {        h: common_vendor.p({          title: state.activityInfo.title        })      });    };  }};const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-2c61ebca"], ["__file", "/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-app/pages/activity/index.vue"]]);wx.createPage(MiniProgramPage);
 |