✨ 指定满减送的活动列表:100%
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user