首页热门类目图片大小调整;增加展示当前定位城市的服务列表;

This commit is contained in:
donqi 2022-08-26 16:06:42 +08:00
parent ddb2560121
commit 9e8e906ece
3 changed files with 195 additions and 54 deletions

View File

@ -67,7 +67,7 @@
}
.multi-pic-container {
height: 350rpx;
height: 246rpx;
overflow: hidden;
}

View File

@ -0,0 +1,67 @@
<template>
<view>
<view class="bg-img img-box bg-gray" :style="'background-image:url(' + product.goodsImgUrl + ');'"></view>
<view class="padding bg-white">
<view class="flex justify-between align-center">
<view v-if="product.goodsStandardList && product.goodsStandardList.length > 0">
<view v-if="product.goodsStandardList[0].discountPrice" class="flex justify-start align-center">
<text class="text-price text-red text-bold text-xl">{{product.goodsStandardList[0].discountPrice}}</text>
<text class="text-del" v-if="product.goodsPrice">¥{{product.goodsStandardList[0].goodsPrice}}</text>
</view>
<view v-else-if="product.goodsStandardList[0].goodsPrice" class="flex justify-start align-center">
<text class="text-price text-red text-bold text-xl">{{product.goodsStandardList[0].goodsPrice}}</text>
</view>
</view>
<view class="padding-xs" v-if="product.type">
<view class='cu-tag light bg-blue'>{{product.type}}</view>
</view>
</view>
<view class="text-black">{{product.goodsName}}</view>
<view class="text-sm">{{product.goodsDesc}}</view>
<view v-if="product.goodsAreaList && product.goodsAreaList.length">
<view class="cu-capsule">
<view class='cu-tag bg-main-color sm'>
<text class='cuIcon-locationfill'></text>
</view>
<view class="cu-tag line-main-color sm">
服务区域
</view>
</view>
<text v-for="(item,index) in product.goodsAreaList">
<text class="margin-lr-xs text-sm">{{item.areaName}}<text v-if="index != product.goodsAreaList.length - 1">,</text></text>
</text>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'flow-goods-card',
props: {
product: {
type: Object,
default: {}
}
},
data() {
return {
}
}
}
</script>
<style scoped>
.cu-list.menu-avatar>.cu-item .content .cu-tag.sm {
display: inline-block;
margin-left: 0;
height: 28rpx;
font-size: 16rpx;
line-height: 32rpx;
}
.img-box {
padding-bottom: 100%;
width: 100%;
height: 0;
}
</style>

View File

@ -32,63 +32,78 @@
</picker>
</view>
</view>
<view class="margin-lr-sm margin-bottom-with-bar">
<!-- 大类 -->
<view class="flex justify-between text-black">
<view class="padding text-lg" @click="showProductCategories">
<text>分类</text>
<text class="cuIcon-apps text-main-color"></text>
<text class="cuIcon-triangledownfill"></text>
<view class="margin-bottom-with-bar">
<view class="margin-lr-sm">
<!-- 大类 -->
<view class="flex justify-between text-black">
<view class="padding text-lg" @click="showProductCategories">
<text>分类</text>
<text class="cuIcon-apps text-main-color"></text>
<text class="cuIcon-triangledownfill"></text>
</view>
<view class="flex-twice">
<scroll-view scroll-x class="nav text-right" :scroll-with-animation="true" :scroll-left="scrollLeft">
<view class="cu-item" :class="index==tabCur?'text-main-color cur':''" v-if="index < 2"
v-for="(item,index) in categories" :key="item.goodsCategoryId" @tap="tabSelect($event, item)" :data-index="index">
{{item.goodsCategoryName}}
</view>
</scroll-view>
</view>
</view>
<view class="flex-twice">
<scroll-view scroll-x class="nav text-right" :scroll-with-animation="true" :scroll-left="scrollLeft">
<view class="cu-item" :class="index==tabCur?'text-main-color cur':''" v-if="index < 2"
v-for="(item,index) in categories" :key="item.goodsCategoryId" @tap="tabSelect($event, item)" :data-index="index">
{{item.goodsCategoryName}}
<!-- 热门细类 -->
<view class="cu-list grid no-border hot-sub-category" :class="['col-5']">
<view class="cu-item" v-for="(item,index) in subCategories" :key="index" v-if="index < 5"
@click="chooseCategory(item)">
<view class="hot-sub-category-icon" :class="['cuIcon-' + item.cuIcon,'text-' + item.color]">
<!-- <view class="cu-tag badge" v-if="item.badge!=0">
<block v-if="item.badge!=1">{{item.badge}}</block>
</view> -->
</view>
</scroll-view>
</view>
</view>
<!-- 热门细类 -->
<view class="cu-list grid no-border hot-sub-category" :class="['col-5']">
<view class="cu-item" v-for="(item,index) in subCategories" :key="index" v-if="index < 5"
@click="chooseCategory(item)">
<view class="hot-sub-category-icon" :class="['cuIcon-' + item.cuIcon,'text-' + item.color]">
<!-- <view class="cu-tag badge" v-if="item.badge!=0">
<block v-if="item.badge!=1">{{item.badge}}</block>
</view> -->
<text>{{item.goodsCategoryName}}</text>
</view>
<text>{{item.goodsCategoryName}}</text>
</view>
</view>
<!-- 细类 -->
<view class="cu-list grid no-border" :class="['col-5']" v-if="subCategories.length > 5">
<view class="cu-item" v-for="(item,index) in subCategories" :key="index"
v-if="index < subCategories.length && index > 4" @click="chooseCategory(item)">
<view :class="['cuIcon-' + item.cuIcon,'text-' + item.color]">
<!-- <view class="cu-tag badge" v-if="item.badge!=0">
<block v-if="item.badge!=1">{{item.badge}}</block>
</view> -->
<!-- 细类 -->
<view class="cu-list grid no-border" :class="['col-5']" v-if="subCategories.length > 5">
<view class="cu-item" v-for="(item,index) in subCategories" :key="index"
v-if="index < subCategories.length && index > 4" @click="chooseCategory(item)">
<view :class="['cuIcon-' + item.cuIcon,'text-' + item.color]">
<!-- <view class="cu-tag badge" v-if="item.badge!=0">
<block v-if="item.badge!=1">{{item.badge}}</block>
</view> -->
</view>
<text>{{item.goodsCategoryName}}</text>
</view>
<text>{{item.goodsCategoryName}}</text>
</view>
<!-- 超值服务 -->
<!-- <vertical-goods-card ref="discountGoodsCard" :goodsInfos="discountGoods.goodsInfos"
:title="discountGoods.title"></vertical-goods-card> -->
<!-- 热门服务 -->
<vertical-card :list="hotCategory" :multiPicMode="true" title="大家都在买"></vertical-card>
</view>
<!-- 当前城市服务列表 -->
<view>
<view class="margin-top-sm margin-lr-sm waterfall-grid">
<view @click="showDetails(item)" v-for="(item, index) in productList" class="waterfall-grid-item">
<flow-goods-card :product="item"></flow-goods-card>
</view>
</view>
<load-status-bar ref="loadStatusBar" @loadMore="loadProductPage"></load-status-bar>
</view>
<!-- 超值服务 -->
<!-- <vertical-goods-card ref="discountGoodsCard" :goodsInfos="discountGoods.goodsInfos"
:title="discountGoods.title"></vertical-goods-card> -->
<!-- 热门服务 -->
<vertical-card :list="hotCategory" :multiPicMode="true" title="大家都在买"></vertical-card>
</view>
</view>
</template>
<script>
import verticalCard from '@/components/common-card/vertical-card.vue';
import loadStatusBar from '@/components/custom-bar/load-status-bar.vue';
import flowGoodsCard from '@/components/goods-card/flow-goods-card.vue';
export default {
name: 'index',
components: {
verticalCard
verticalCard,
loadStatusBar,
flowGoodsCard
},
data() {
return {
@ -104,6 +119,9 @@
searchInfo: {},
areaList: [],
areaMultiIndex: [0, 0, 0],
productList: [],
pageNum: 0,
pageSize: 0
}
},
mounted() {
@ -118,9 +136,10 @@
},
methods: {
async loadData() {
this.initBasicData();
//
this.loadRegionList();
this.getCurAreaArr();
await this.getCurAreaArr();
//
let hotCategoryRes = await this.$request.getHotCategory({
type: 1
@ -128,6 +147,8 @@
this.hotCategory = hotCategoryRes.data;
//
this.loadCategoryList();
//
this.loadProductPage();
this.swiperList = await this.$api.data('swiperList');
// this.categories = await this.$api.data('categories');
@ -184,6 +205,7 @@
chosenArea.push(this.areaList[i][this.areaMultiIndex[i]]);
}
this.searchInfo.area = chosenArea;
this.reloadProductPage();
},
async regionColChange(e) {
let colObj = e.detail;
@ -277,7 +299,49 @@
uni.navigateTo({
url: '/pages/product/product-category'
})
},
/* 底部当前城市服务列表 start */
initBasicData() {
this.pageNum = this.$globalData.initPageNum;
this.pageSize = this.$globalData.initPageSize;
this.productList = [];
},
showDetails(productItem) {
let params = {
goodsId: productItem.goodsId
}
uni.navigateTo({
url: '/pages/product/product-detail?params=' + encodeURIComponent(JSON.stringify(params))
});
},
async reloadProductPage() {
this.initBasicData();
this.loadProductPage();
},
async loadProductPage(params = {}) {
params.pageNum = this.pageNum;
params.pageSize = this.pageSize;
params.status = 0;
params.areaId = this.searchInfo.area && this.searchInfo.area.length ? this.searchInfo.area[this.searchInfo.area.length - 1].areaId : null;
this.$refs.loadStatusBar.showLoading();
try {
let res = await this.$request.qryProductPage(params);
let rowsLength = res[1].data.rows.length;
if (rowsLength > 0) {
this.productList = this.productList.concat(res[1].data.rows);
this.pageNum++;
if (rowsLength === this.pageSize) {
this.$refs.loadStatusBar.showLoadMore();
return;
}
}
this.$refs.loadStatusBar.showLoadOver();
} catch (e) {
console.error(e)
this.$refs.loadStatusBar.showLoadErr();
}
}
/* 底部当前城市服务列表 end */
}
}
</script>
@ -305,4 +369,14 @@
align-items: center;
justify-content: center;
}
.waterfall-grid {
column-count: 2;
column-gap: 15rpx;
}
.waterfall-grid-item {
break-inside: avoid;
margin-bottom: 15rpx;
}
</style>