mirror of
https://gitee.com/java110/WechatOwnerService.git
synced 2026-02-23 21:36:38 +08:00
优化商圈部分功能
This commit is contained in:
parent
b334cfe674
commit
bb1615c42b
@ -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();
|
||||||
|
|||||||
@ -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">
|
||||||
|
|||||||
@ -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>
|
||||||
@ -50,19 +51,21 @@
|
|||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
curCategoryId:'-1',
|
curCategoryId: '-1',
|
||||||
mainCatagorys: [{
|
mainCatagorys: [{
|
||||||
categoryName: "为你推荐",
|
categoryName: "为你推荐",
|
||||||
mainCategoryId: "-1"
|
mainCategoryId: "-1"
|
||||||
}],
|
}],
|
||||||
products: [],
|
products: [],
|
||||||
communityId: "",
|
communityId: "",
|
||||||
noPic:''
|
noPic: '',
|
||||||
|
pagesize: 10,
|
||||||
|
pagefrom: 1,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this._loadMainCatagory();
|
this._loadMainCatagory();
|
||||||
this.noPic = this.imgUrl+'/h5/images/noPic.png'
|
this.noPic = this.imgUrl + '/h5/images/noPic.png'
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
_loadMainCatagory: function() {
|
_loadMainCatagory: function() {
|
||||||
@ -71,14 +74,18 @@
|
|||||||
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) {
|
||||||
return ;
|
return;
|
||||||
}
|
}
|
||||||
_that.mainCatagorys = products;
|
_that.mainCatagorys = products;
|
||||||
_that.curCategoryId = products[0].mainCategoryId;
|
_that.curCategoryId = products[0].mainCategoryId;
|
||||||
}).then(()=>{
|
}).then(() => {
|
||||||
_that._loadRecommendProdcut();
|
_that._loadRecommendProdcut();
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -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) {
|
||||||
@ -101,8 +113,10 @@
|
|||||||
url: '/pages/goods/goods?productId=' + _product.productId + "&shopId=" + _product.shopId
|
url: '/pages/goods/goods?productId=' + _product.productId + "&shopId=" + _product.shopId
|
||||||
}, true);
|
}, true);
|
||||||
},
|
},
|
||||||
_doSelect:function(item){
|
_doSelect: function(item) {
|
||||||
this.curCategoryId = item.mainCategoryId;
|
this.curCategoryId = item.mainCategoryId;
|
||||||
|
this.pagefrom =1;
|
||||||
|
this.products=[];
|
||||||
this._loadRecommendProdcut();
|
this._loadRecommendProdcut();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -122,12 +136,14 @@
|
|||||||
.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;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user