首页搜索bug

parent da817e72
...@@ -226,8 +226,6 @@ const swiperList = ref(['../../static/index/guiyang.png', '../../static/index/gu ...@@ -226,8 +226,6 @@ const swiperList = ref(['../../static/index/guiyang.png', '../../static/index/gu
let listParams = { let listParams = {
current: 1, current: 1,
size: 10, size: 10,
lon: 106.68650025025502,
lat: 26.567192352601154,
categoryIds: ['6'], categoryIds: ['6'],
}; };
const coupon = ref([]); const coupon = ref([]);
...@@ -255,8 +253,8 @@ const getTop = () => { ...@@ -255,8 +253,8 @@ const getTop = () => {
}); });
}; };
onPullDownRefresh(() => { onPullDownRefresh(async () => {
reset(); await reset();
getClassification(); getClassification();
rotatingBroadcast(); rotatingBroadcast();
nearbyFood(); nearbyFood();
...@@ -266,8 +264,8 @@ onPullDownRefresh(() => { ...@@ -266,8 +264,8 @@ onPullDownRefresh(() => {
}); });
// 排序参数来源 // 排序参数来源
const sortParams = (params) => { const sortParams = async (params) => {
reset(); await reset();
const { sortName, sortMode } = params; const { sortName, sortMode } = params;
listParams.sortName = sortName; listParams.sortName = sortName;
listParams.sortMode = sortMode; listParams.sortMode = sortMode;
...@@ -289,9 +287,9 @@ function jumpProductDetails(item) { ...@@ -289,9 +287,9 @@ function jumpProductDetails(item) {
// }); // });
// }; // };
// 搜索 // 搜索
const toSearch = (res) => { const toSearch = async (res) => {
await reset();
listParams.keyword = res.detail.value; listParams.keyword = res.detail.value;
reset();
getMerchantList(); getMerchantList();
}; };
// 获取优惠券 // 获取优惠券
...@@ -386,18 +384,25 @@ const recommendedClassification = () => { ...@@ -386,18 +384,25 @@ const recommendedClassification = () => {
}; };
// 重置数据 // 重置数据
const reset = () => { const reset = () => {
listParams = { return new Promise((resolve) => {
current: 1, listParams = {
size: 10, current: 1,
lon: 106.68650025025502, size: 10,
lat: 26.567192352601154, categoryIds: ['6'],
categoryIds: ['6'], };
}; shopCardData.value = {};
shopCardData.value = {}; cardData.value = [];
cardData.value = []; cardData1.value = [];
cardData1.value = []; cardData2.value = [];
cardData2.value = []; show.value = false;
show.value = false; xma.pageScrollTo({
scrollTop: 0,
duration: 0,
success: () => {
resolve();
},
});
});
}; };
const toUse = (data) => { const toUse = (data) => {
...@@ -492,9 +497,9 @@ const refresh = () => { ...@@ -492,9 +497,9 @@ const refresh = () => {
getMerchantList(); getMerchantList();
}; };
// distance参数来源 // distance参数来源
const nearby = (distance) => { const nearby = async (distance) => {
// console.log('distance', distance); // console.log('distance', distance);
reset(); await reset();
if (distance === 0) { if (distance === 0) {
delete listParams.distance; delete listParams.distance;
} else { } else {
...@@ -503,9 +508,9 @@ const nearby = (distance) => { ...@@ -503,9 +508,9 @@ const nearby = (distance) => {
getMerchantList(); getMerchantList();
}; };
// communityName参数来源 // communityName参数来源
const popular = (communityName) => { const popular = async (communityName) => {
console.log('communityName', communityName); console.log('communityName', communityName);
reset(); await reset();
listParams.communityName = communityName; listParams.communityName = communityName;
if (listParams.area) { if (listParams.area) {
delete listParams.area; delete listParams.area;
...@@ -513,9 +518,9 @@ const popular = (communityName) => { ...@@ -513,9 +518,9 @@ const popular = (communityName) => {
getMerchantList(); getMerchantList();
}; };
// area参数来源 // area参数来源
const region = (area) => { const region = async (area) => {
console.log('area', area); console.log('area', area);
reset(); await reset();
listParams.area = area; listParams.area = area;
if (listParams.communityName) { if (listParams.communityName) {
delete listParams.communityName; delete listParams.communityName;
...@@ -523,8 +528,8 @@ const region = (area) => { ...@@ -523,8 +528,8 @@ const region = (area) => {
getMerchantList(); getMerchantList();
}; };
// tabs // tabs
const choice = (index, categoryId) => { const choice = async (index, categoryId) => {
reset(); await reset();
rotate.value = false; rotate.value = false;
light.value = index; light.value = index;
listParams.categoryIds = [categoryId]; listParams.categoryIds = [categoryId];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment