优化商圈部分功能

This commit is contained in:
wuxw 2022-12-02 18:29:56 +08:00
parent b334cfe674
commit bb1615c42b
4 changed files with 67 additions and 49 deletions

View File

@ -56,8 +56,7 @@ export function queryPhoneMainCategoryProduct(dataObj) {
//动态数据 //动态数据
success: function(res) { success: function(res) {
if (res.statusCode == 200) { if (res.statusCode == 200) {
let _products = res.data.data; resolve(res.data);
resolve(_products);
return; return;
} }
reject(); reject();

View File

@ -1,6 +1,6 @@
<template> <template>
<!-- @scrolltolower="lower" --> <!-- @scrolltolower="lower" -->
<scroll-view class="scroll-restaurants-list " scroll-y="true" style="height:300upx"> <scroll-view class="scroll-restaurants-list " scroll-x="true" style="height:300upx">
<swiper class=" padding-top-xs margin-top-sm bg-white c-radius" style="height: 280upx;" indicator-dots="true" indicator-color="rgba(228,228,228,1)" <swiper class=" padding-top-xs margin-top-sm bg-white c-radius" style="height: 280upx;" indicator-dots="true" indicator-color="rgba(228,228,228,1)"
indicator-active-color="#FECA49"> indicator-active-color="#FECA49">
<block v-for="(item, index) in categoryList" :key="index"> <block v-for="(item, index) in categoryList" :key="index">

View File

@ -3,7 +3,8 @@
<view> <view>
<view class="text-left "> <view class="text-left ">
<scroll-view scroll-x class="nav" scroll-with-animation> <scroll-view scroll-x class="nav" scroll-with-animation>
<view class="cu-item" :class="item.mainCategoryId==curCategoryId?'text-catagory-select ':'text-catagory'" <view class="cu-item"
:class="item.mainCategoryId==curCategoryId?'text-catagory-select ':'text-catagory'"
v-for="(item,index) in mainCatagorys" :key="index" @tap="_doSelect(item)" :data-id="index"> v-for="(item,index) in mainCatagorys" :key="index" @tap="_doSelect(item)" :data-id="index">
{{item.categoryName}} {{item.categoryName}}
</view> </view>
@ -57,7 +58,9 @@
}], }],
products: [], products: [],
communityId: "", communityId: "",
noPic:'' noPic: '',
pagesize: 10,
pagefrom: 1,
} }
}, },
mounted() { mounted() {
@ -71,6 +74,10 @@
page: 1, page: 1,
row: 10 row: 10
} }
this.products=[];
this.pagefrom =1;
queryMainCategory(_data) queryMainCategory(_data)
.then((products) => { .then((products) => {
if (!products || products.length < 1) { if (!products || products.length < 1) {
@ -86,14 +93,19 @@
let _that = this; let _that = this;
_that.communityId = getMallCommunityId(); _that.communityId = getMallCommunityId();
let _data = { let _data = {
page: 1, page: this.pagefrom,
row: 10, row: this.pagesize,
communityId: _that.communityId, communityId: _that.communityId,
mainCategoryId: _that.curCategoryId mainCategoryId: _that.curCategoryId
} }
queryPhoneMainCategoryProduct(_data) queryPhoneMainCategoryProduct(_data)
.then((products) => { .then((_data) => {
_that.products = products; _that.products = _that.products.concat(_data.data);
if (_that.pagefrom <= _data.records) {
_that.pagefrom = _that.pagefrom + 1;
} else {
_that.loadingText = "已经到底了";
}
}) })
}, },
_toGoodsDetail: function(_product) { _toGoodsDetail: function(_product) {
@ -103,6 +115,8 @@
}, },
_doSelect: function(item) { _doSelect: function(item) {
this.curCategoryId = item.mainCategoryId; this.curCategoryId = item.mainCategoryId;
this.pagefrom =1;
this.products=[];
this._loadRecommendProdcut(); this._loadRecommendProdcut();
} }
} }
@ -122,11 +136,13 @@
.goods-image { .goods-image {
height: 180upx; height: 180upx;
} }
.text-catagory { .text-catagory {
color: #656565; color: #656565;
font-size: 28upx; font-size: 28upx;
} }
.text-catagory-select { .text-catagory-select {
color: #000000; color: #000000;
font-size: 40upx; font-size: 40upx;

View File

@ -97,6 +97,9 @@
} }
this.shopTypeId = 0 this.shopTypeId = 0
}, },
onReachBottom() {
this.$refs.vcRecommendRef._loadRecommendProdcut();
},
methods: { methods: {
selectType(index) { selectType(index) {
let shopTypeId = this.navList[index].shopTypeId; let shopTypeId = this.navList[index].shopTypeId;