acdr-ui/dist/dev/mp-weixin/sheep/components/s-activity-pop/s-activity-pop.js

85 lines
2.5 KiB
JavaScript

"use strict";
const common_vendor = require("../../../common/vendor.js");
const sheep_index = require("../../index.js");
const sheep_api_promotion_rewardActivity = require("../../api/promotion/rewardActivity.js");
const sheep_hooks_useGoods = require("../../hooks/useGoods.js");
if (!Array) {
const _easycom_su_popup2 = common_vendor.resolveComponent("su-popup");
_easycom_su_popup2();
}
const _easycom_su_popup = () => "../../ui/su-popup/su-popup.js";
if (!Math) {
_easycom_su_popup();
}
const _sfc_main = {
__name: "s-activity-pop",
props: {
modelValue: {
type: Object,
default() {
}
},
show: {
type: Boolean,
default: false
}
},
emits: ["close"],
setup(__props, { emit: __emit }) {
const props = __props;
const emits = __emit;
const state = common_vendor.reactive({
activityInfo: common_vendor.computed(() => props.modelValue),
activityMap: {}
});
common_vendor.watch(
() => props.show,
() => {
var _a;
if (props.show) {
(_a = state.activityInfo) == null ? void 0 : _a.forEach((activity) => {
sheep_api_promotion_rewardActivity.RewardActivityApi.getRewardActivity(activity.id).then((res) => {
if (res.code !== 0) {
return;
}
state.activityMap[activity.id] = res.data;
});
});
}
}
);
function onGoodsList(e) {
sheep_index.sheep.$router.go("/modules/mall/activity/index", {
activityId: e.id
});
}
return (_ctx, _cache) => {
return {
a: common_vendor.f(state.activityInfo, (item, k0, i0) => {
var _a;
return {
a: common_vendor.f((_a = state.activityMap[item.id]) == null ? void 0 : _a.rules, (rule, k1, i1) => {
return {
a: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.formatRewardActivityRule)(state.activityMap[item.id], rule)),
b: rule
};
}),
b: common_vendor.o(($event) => onGoodsList(item), item.id),
c: item.id
};
}),
b: common_vendor.o(($event) => emits("close")),
c: common_vendor.p({
show: __props.show,
type: "bottom",
round: "20",
showClose: true
})
};
};
}
};
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-2a06d108"]]);
wx.createComponent(Component);
//# sourceMappingURL=s-activity-pop.js.map