feat:完善首页会员优选、我的社员ui重构
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
>
|
||||
<view class="flex-row wrap w100">
|
||||
<view class="cardItem" v-for="(v, i) in goods" :key="i">
|
||||
<card_goods :data="v"></card_goods>
|
||||
<card_goods :data="v" :memberPreferred="isMemberPreferred"></card_goods>
|
||||
</view>
|
||||
</view>
|
||||
</mescroll-body>
|
||||
@@ -20,7 +20,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import { ref, watch, computed } from 'vue';
|
||||
import useMescroll from '@/uni_modules/mescroll-uni/hooks/useMescroll.js';
|
||||
import SpuApi from '@/sheep/api/product/spu';
|
||||
import { getAiProduct } from '@/sheep/api/ai';
|
||||
@@ -89,6 +89,8 @@
|
||||
};
|
||||
|
||||
const isInit = ref(isAutoInit); // 当前tab是否已初始化
|
||||
const tabName = computed(() => String(props.tabs?.[props.i]?.name || '').trim());
|
||||
const isMemberPreferred = computed(() => tabName.value === '会员优选');
|
||||
// 监听下标的变化
|
||||
watch(
|
||||
() => props.index,
|
||||
@@ -110,11 +112,7 @@
|
||||
}
|
||||
};
|
||||
const upCallback = (mescroll) => {
|
||||
const tab = props.tabs?.[props.i] || {};
|
||||
const tabName = String(tab?.name || '').trim();
|
||||
const isMemberPreferred = tabName === '会员优选';
|
||||
|
||||
if (isMemberPreferred) {
|
||||
if (isMemberPreferred.value) {
|
||||
getAiProduct({
|
||||
pageNo: mescroll.num,
|
||||
pageSize: mescroll.size,
|
||||
@@ -135,7 +133,7 @@
|
||||
SpuApi.getSpuPage({
|
||||
pageNo: mescroll.num,
|
||||
pageSize: mescroll.size,
|
||||
tagTypeId: tab.id,
|
||||
tagTypeId: props.tabs?.[props.i]?.id,
|
||||
})
|
||||
.then((res) => {
|
||||
const list = res.data.list || []; // 当前页数据
|
||||
|
||||
Reference in New Issue
Block a user