feat: 添加首页会员优选列表
This commit is contained in:
@@ -20,11 +20,11 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch, getCurrentInstance } from 'vue';
|
||||
import { ref, watch } 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';
|
||||
import card_goods from './card_goods.vue';
|
||||
const { proxy } = getCurrentInstance();
|
||||
let goods = ref([]);
|
||||
const column = ref(2);
|
||||
const columnChange = ref(false);
|
||||
@@ -110,18 +110,35 @@
|
||||
}
|
||||
};
|
||||
const upCallback = (mescroll) => {
|
||||
const tab = props.tabs?.[props.i] || {};
|
||||
const tabName = String(tab?.name || '').trim();
|
||||
const isMemberPreferred = tabName === '会员优选';
|
||||
|
||||
if (isMemberPreferred) {
|
||||
getAiProduct({
|
||||
pageNo: mescroll.num,
|
||||
pageSize: mescroll.size,
|
||||
})
|
||||
.then((res) => {
|
||||
const list = res?.data?.list || [];
|
||||
const next = Array.isArray(list) ? list : [];
|
||||
if (mescroll.num == 1) goods.value = [];
|
||||
goods.value = goods.value.concat(next);
|
||||
mescroll.endSuccess(next.length);
|
||||
})
|
||||
.catch(() => {
|
||||
mescroll.endErr();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
SpuApi.getSpuPage({
|
||||
pageNo: mescroll.num,
|
||||
pageSize: mescroll.size,
|
||||
tagTypeId: props.tabs[props.i].id,
|
||||
tagTypeId: tab.id,
|
||||
})
|
||||
.then((res) => {
|
||||
const list = res.data.list || []; // 当前页数据
|
||||
// if(list.length){
|
||||
// list.forEach(e=>{
|
||||
// e.hide = true
|
||||
// })
|
||||
// }
|
||||
if (mescroll.num == 1) goods.value = []; //如果是第一页需手动制空列表
|
||||
goods.value = goods.value.concat(list); //追加新数据
|
||||
mescroll.endSuccess(list.length); // 请求成功, 结束加载
|
||||
|
||||
Reference in New Issue
Block a user