指定满减送的活动列表:100%

This commit is contained in:
YunaiV
2024-01-06 20:40:39 +08:00
parent eb9138a668
commit b95e711f80
5 changed files with 116 additions and 65 deletions
@@ -12,15 +12,9 @@
<view v-for="item in state.activityInfo" :key="item.id">
<view class="ss-flex ss-col-top ss-m-b-40" @tap="onGoodsList(item)">
<view class="model-content-tag ss-flex ss-row-center">满减</view>
<!-- TODO 芋艿先简单做未来再搞成满 xxx yyy -->
<!-- <view class="ss-m-l-20 model-content-title ss-flex-1">-->
<!-- <view class="ss-m-b-24" v-for="text in item.texts" :key="text">-->
<!-- {{ text }}-->
<!-- </view>-->
<!-- </view>-->
<view class="ss-m-l-20 model-content-title ss-flex-1">
<view class="ss-m-b-24">
{{ item.name }}
<view class="ss-m-b-24" v-for="rule in state.activityMap[item.id]?.rules" :key="rule">
{{ formatRewardActivityRule(state.activityMap[item.id], rule) }}
</view>
</view>
<text class="cicon-forward" />
@@ -32,7 +26,10 @@
</template>
<script setup>
import sheep from '@/sheep';
import { computed, reactive } from 'vue';
import { computed, reactive, watch } from 'vue';
import RewardActivityApi from '@/sheep/api/promotion/rewardActivity';
import { formatRewardActivityRule } from '@/sheep/hooks/useGoods';
const props = defineProps({
modelValue: {
type: Object,
@@ -46,7 +43,26 @@
const emits = defineEmits(['close']);
const state = reactive({
activityInfo: computed(() => props.modelValue),
activityMap: {}
});
watch(
() => props.show,
() => {
// 展示的情况下,加载每个活动的详细信息
if (props.show) {
state.activityInfo?.forEach(activity => {
RewardActivityApi.getRewardActivity(activity.id).then(res => {
if (res.code !== 0) {
return;
}
state.activityMap[activity.id] = res.data;
})
});
}
},
);
function onGoodsList(e) {
sheep.$router.go('/pages/activity/index', {
activityId: e.id,