商家列表

parent 6f8cab2a
...@@ -14,14 +14,12 @@ ...@@ -14,14 +14,12 @@
<text class="one-text">{{ item.evaluationVos[0].evaluation }}</text> <text class="one-text">{{ item.evaluationVos[0].evaluation }}</text>
</view> </view>
<view class="labelBox"> <view class="labelBox">
<view>卤味爱好者最佳选择</view> <view v-for="(item, index) in item.labels" :key="index">{{ item }}</view>
<view>免费wifi</view>
<view>服务态度很好</view>
</view> </view>
<view class="groupPurchasePrice"> <view class="groupPurchasePrice">
<image class="img" src="../../static/index/groupBuying.png" mode="widthFix" /> <image class="img" src="../../static/index/groupBuying.png" mode="widthFix" />
<text class="one-text">¥19</text> <text class="one-text">¥19</text>
<view class="two-text">7.8折</view> <!-- <view class="two-text">7.8折</view> -->
<text class="three-text">¥29.8</text> <text class="three-text">¥29.8</text>
<text class="four-text">深夜加班续命套餐</text> <text class="four-text">深夜加班续命套餐</text>
</view> </view>
......
...@@ -87,7 +87,7 @@ import Search from '../../components/index/Search.vue'; ...@@ -87,7 +87,7 @@ import Search from '../../components/index/Search.vue';
import Classification from '../../components/index/Classification.vue'; import Classification from '../../components/index/Classification.vue';
import Position from '../../components/index/Position.vue'; import Position from '../../components/index/Position.vue';
import Sort from '../../components/index/Sort.vue'; import Sort from '../../components/index/Sort.vue';
import { getByParentId } from '../../api/index'; import { getByParentId, merchantList } from '../../api/index';
const business = reactive(['优选商家', '超值半价', '今日可订', '经典单人']); const business = reactive(['优选商家', '超值半价', '今日可订', '经典单人']);
const active = ref(null); const active = ref(null);
...@@ -98,7 +98,9 @@ onLoad((option) => { ...@@ -98,7 +98,9 @@ onLoad((option) => {
const { parentId } = option; const { parentId } = option;
query(parentId); query(parentId);
}); });
onMounted(() => {
getMerchantList();
});
// 根据父级分类id查询子分类列表 // 根据父级分类id查询子分类列表
const query = (parentId) => { const query = (parentId) => {
getByParentId(parentId).then((res) => { getByParentId(parentId).then((res) => {
...@@ -113,7 +115,7 @@ const query = (parentId) => { ...@@ -113,7 +115,7 @@ const query = (parentId) => {
const choice = (index) => { const choice = (index) => {
active.value = index; active.value = index;
}; };
const cardData = reactive([ const cardData = ref([
{ {
text: '测试', text: '测试',
}, },
...@@ -144,6 +146,29 @@ const locationFiltering = (index) => { ...@@ -144,6 +146,29 @@ const locationFiltering = (index) => {
break; break;
} }
}; };
// 商家列表分页-搜索列表
const getMerchantList = () => {
const data = {
current: 1,
size: 10,
lon: 106.68650025025502,
lat: 26.567192352601154,
};
merchantList(data).then((res) => {
console.log('商家列表', res);
res.data.content.forEach((item) => {
item.shopLogo = import.meta.env.VITE_APP_IMG_URL + item.shopLogo;
if (item.evaluationVos.length > 0) {
item.evaluationVos[0].avatar =
import.meta.env.VITE_APP_IMG_URL + item.evaluationVos[0].avatar;
}
if (item.labels) {
item.labels = item.labels.split(',');
}
});
cardData.value = res.data.content;
});
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -274,6 +274,9 @@ const getMerchantList = () => { ...@@ -274,6 +274,9 @@ const getMerchantList = () => {
item.evaluationVos[0].avatar = item.evaluationVos[0].avatar =
import.meta.env.VITE_APP_IMG_URL + item.evaluationVos[0].avatar; import.meta.env.VITE_APP_IMG_URL + item.evaluationVos[0].avatar;
} }
if (item.labels) {
item.labels = item.labels.split(',');
}
}); });
cardData.value = res.data.content.slice(0, 2); cardData.value = res.data.content.slice(0, 2);
cardData1.value = res.data.content.slice(2, 4); cardData1.value = res.data.content.slice(2, 4);
......
...@@ -63,7 +63,11 @@ import FoodDetails from '../../components/index/FoodDetails.vue'; ...@@ -63,7 +63,11 @@ import FoodDetails from '../../components/index/FoodDetails.vue';
import Classification from '../../components/index/Classification.vue'; import Classification from '../../components/index/Classification.vue';
import Position from '../../components/index/Position.vue'; import Position from '../../components/index/Position.vue';
import Sort from '../../components/index/Sort.vue'; import Sort from '../../components/index/Sort.vue';
import { merchantList } from '../../api/index';
onMounted(() => {
getMerchantList();
});
const business = reactive(['优选商家', '超值半价', '今日可订', '经典单人']); const business = reactive(['优选商家', '超值半价', '今日可订', '经典单人']);
const active = ref(null); const active = ref(null);
...@@ -75,10 +79,33 @@ const back = () => { ...@@ -75,10 +79,33 @@ const back = () => {
delta: 1, delta: 1,
}); });
}; };
// 商家列表分页-搜索列表
const getMerchantList = () => {
const data = {
current: 1,
size: 10,
lon: 106.68650025025502,
lat: 26.567192352601154,
};
merchantList(data).then((res) => {
console.log('商家列表', res);
res.data.content.forEach((item) => {
item.shopLogo = import.meta.env.VITE_APP_IMG_URL + item.shopLogo;
if (item.evaluationVos.length > 0) {
item.evaluationVos[0].avatar =
import.meta.env.VITE_APP_IMG_URL + item.evaluationVos[0].avatar;
}
if (item.labels) {
item.labels = item.labels.split(',');
}
});
cardData.value = res.data.content;
});
};
const choice = (index) => { const choice = (index) => {
active.value = index; active.value = index;
}; };
const cardData = reactive([ const cardData = ref([
{ {
text: '测试', text: '测试',
}, },
......
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