Commit 30716461 authored by caimeng's avatar caimeng

bug 修复23

parent 3f5ae249
......@@ -11,7 +11,7 @@
.i-header {
position: fixed;
left: 0;
top: 0;
top: -1rpx;
z-index: 900;
width: 100vw;
min-height: 176rpx;
......
......@@ -92,8 +92,7 @@
<view class='main-box' v-show="IndexList && IndexList.length > 0">
<view class='box-item' v-for="(item, index) in IndexList" :key="index" @click="GoDetail(item)">
<view class='item-top'>
<image :src="item.goodsImage" class='top-img'></image>
<i class='top-icon'></i>
<image :src="item.goodsImage" mode="aspectFit" class='top-img'></image>
</view>
<view class='item-footer'>
<view class='footer-des'>{{ item.goodsName }}</view>
......@@ -125,7 +124,7 @@ const cacheIndexData = uni.getStorageSync('dataIndex') ? JSON.parse(uni.getStora
const indexGoods = uni.getStorageSync('indexGoods') ? JSON.parse(uni.getStorageSync('indexGoods')) : [];
console.log('首页数据',cacheIndexData)
console.log('首页数据', cacheIndexData)
console.log('沃日', indexGoods)
export default {
......@@ -188,16 +187,17 @@ export default {
await this.checkAppVersion()
},
async onShow() {
const that = this;
// 设置页面滚动条位置
uni.pageScrollTo({
scrollTop: 0,
duration: 0
})
this.Topdistance = 0;
setTimeout(() => {
that.GetTop() // 获取元素距离顶部的距离
}, 1000)
}, 1500)
// 初始化首页数据
await this.init()
......@@ -223,10 +223,10 @@ export default {
async init() {
try {
const res = await API.initIndex()
console.log('初始化首页的接口',res)
console.log('初始化首页的接口', res)
if (res.success) {
const data = res.result;
console.log('首页',res.result.result)
console.log('首页', res.result.result)
this.index = data;
uni.setStorageSync('dataIndex', JSON.stringify(data))
}
......@@ -381,7 +381,7 @@ export default {
const { current, size } = this.params
try {
this.$request('/app/goods/getGoodsPage', 'POST', params).then(res => {
console.log('初始化首页商品列表',res)
console.log('初始化首页商品列表', res)
const { total, data } = res.result
if (current > 1) {
this.IndexList = this.IndexList.concat(data)
......
......@@ -5,148 +5,138 @@
<view class="leftTab">
<scroll-view scroll-y="true" class="tabBox">
<block v-for="item in tabList" :key="item.id">
<view class="tabItem" :class="tabCurrent == item.id ?'tabActive':''" @click="changeTab(item.id)">
{{item.categoryName}}
<view class="tabItem" :class="tabCurrent == item.id ? 'tabActive' : ''"
@click="changeTab(item.id)">
{{ item.categoryName }}
</view>
</block>
</scroll-view>
</view>
<!-- 右侧商品 -->
<view class="rightGoods" v-show="listIndex && listIndex.length>0">
<scroll-view
class="whiteBox"
scroll-y="true"
refresher-default-style="none"
@scrolltoupper="toupperTop"
@scrolltolower="lowerMore">
<view class="list">
<view class='l-item' v-for="item in listIndex" :key="item.id" @click="goProduct(item)">
<image class='item-img' mode="aspectFit" :src='item.goodsImage'></image>
<view class='item-text'>{{item.goodsName}}</view>
</view>
</view>
</scroll-view>
<view class="rightGoods" v-show="listIndex && listIndex.length > 0">
<scroll-view class="whiteBox" scroll-y="true" refresher-default-style="none" @scrolltoupper="toupperTop"
@scrolltolower="lowerMore">
<view class="list">
<view class='l-item' v-for="item in listIndex" :key="item.id" @click="goProduct(item)">
<image class='item-img' mode="aspectFit" :src='item.goodsImage'></image>
<view class='item-text'>{{ item.goodsName }}</view>
</view>
</view>
</scroll-view>
</view>
</view>
</view>
</template>
<script>
import { switchShowTabbar, isLogin,initSettings } from '@/utils/index'
export default {
data() {
return {
// 分类列表
tabList: [],
tabCurrent: 1,
fromStore: false,
pageNum: 1,
pageSize: 50,//每页展示几条数据
total: 0,
hasNextText:'上拉加载更多',
loadFlag:true,
hasNextPage:false,
listIndex:[],
inputValue:''
}
import { switchShowTabbar, isLogin, initSettings } from '@/utils/index'
export default {
data() {
return {
// 分类列表
tabList: [],
tabCurrent: 1,
fromStore: false,
pageNum: 1,
pageSize: 50,//每页展示几条数据
total: 0,
hasNextText: '上拉加载更多',
loadFlag: true,
hasNextPage: false,
listIndex: [],
inputValue: ''
}
},
async onLoad(options) {
// 有传值说明是从门店进入
if (options.fromStore) {
this.fromStore = options.fromStore
}
await this.init()
await this.initSearch()
},
methods: {
init() {
const self = this
self.$request('/app/goods/getCategoryList', 'POST').then((res) => {
self.tabList = res.result
})
},
onLoad(options) {
// 有传值说明是从门店进入
if (options.fromStore) {
this.fromStore = options.fromStore
initSearch() {
const self = this
const { tabCurrent, pageNum, pageSize } = self
const parmas = {
"categoryId": tabCurrent,
"current": pageNum,
"size": pageSize,
"sort": "id desc"
}
this.init()
this.initSearch()
},
methods: {
init(){
const self=this
self.$request('/app/goods/getCategoryList','POST').then((res)=>{
self.tabList=res.result
})
},
initSearch(){
const self=this
const {tabCurrent,pageNum,pageSize}=self
const parmas={
"categoryId":tabCurrent,
"current": pageNum,
"size": pageSize,
"sort": "id desc"
console.log(parmas, 'parmas')
self.$request('/app/goods/getGoodsPage', 'POST', parmas).then((res) => {
const { data, total } = res.result
const hasNextPage = total - self.pageSize * self.pageNum > 0 ? true : false //是否有下一页
if (self.loadFlag) {
console.log(33);
self.listIndex = self.listIndex.concat(data)
} else {
console.log(34);
self.listIndex = data
}
console.log(parmas,'parmas')
self.$request('/app/goods/getGoodsPage','POST',parmas).then((res)=>{
console.log(res,'res')
const {data,total}=res.result
const hasNextPage=total-self.pageSize*self.pageNum>0?true:false //是否有下一页
if(self.loadFlag){
console.log(33);
self.listIndex=self.listIndex.concat(data)
}else{
console.log(34);
self.listIndex=data
}
self.hasNextPage=hasNextPage
self.loadFlag=false
console.log(self.hasNextPage,'sort8888')
})
},
goProduct(item){
const params={
goodId:item.id
}
uni.navigateTo({
url:'/subPackage/productDetails/productDetails?mydata='+encodeURIComponent(JSON.stringify(params))
})
},
changeTab(index) {
self.hasNextPage = hasNextPage
self.loadFlag = false
})
},
goProduct(item) {
const params = { goodId: item.id }
uni.navigateTo({
url: '/subPackage/productDetails/productDetails?mydata=' + encodeURIComponent(JSON.stringify(params))
})
},
changeTab(index) {
this.tabCurrent = index
// this.categoryId=index
this.pageNum=1
if(index!=0){
this.recommandStatus=''
}else{
this.recommandStatus=1
}
this.initSearch()
},
goInput(e){
console.log(e.detail.value,'9644')
this.inputValue=e.detail.value
this.pageNum=1
this.initSearch()
},
toupperTop(e){
console.log(e,'到顶了');
},
lowerMore(e){
console.log(e,'触底了');
if(!this.hasNextPage){
// uni.showToast({
// icon: 'none',
// title: '到底了',
// })
return false;
}
if(this.loadFlag) return;
this.loadFlag=true,
this.pageNum=this.pageNum+1
this.initSearch();
this.tabCurrent = index
// this.categoryId=index
this.pageNum = 1
if (index != 0) {
this.recommandStatus = ''
} else {
this.recommandStatus = 1
}
},
onShow() {
this.buryingPoint('app:sort_pageView')
this.init()
this.initSearch()
switchShowTabbar()
},
goInput(e) {
console.log(e.detail.value, '9644')
this.inputValue = e.detail.value
this.pageNum = 1
this.initSearch()
},
toupperTop(e) {
console.log(e, '到顶了');
},
lowerMore(e) {
console.log(e, '触底了');
if (!this.hasNextPage) {
// uni.showToast({
// icon: 'none',
// title: '到底了',
// })
return false;
}
if (this.loadFlag) return;
this.loadFlag = true,
this.pageNum = this.pageNum + 1
this.initSearch();
}
},
onShow() {
this.buryingPoint('app:sort_pageView')
this.init()
this.initSearch()
switchShowTabbar()
}
}
</script>
<style src="./index.less" lang="less" scoped></style>
......@@ -2,12 +2,12 @@
width: 100%;
background: #F7FAFF;
box-sizing: border-box;
padding-bottom: 160rpx;
padding-bottom: 150rpx;
.p-banner {
width: 100%;
height: 450rpx;
min-height: 450rpx;
margin-bottom: 20rpx;
box-sizing: border-box;
padding: 0 30rpx;
......@@ -156,10 +156,12 @@
position: fixed;
bottom: 0;
width: 1000%;
height: 140rpx;
height: 150rpx;
background: #FFFFFF;
display: flex;
align-items: center;
box-sizing: border-box;
padding-bottom: 10rpx;
.footer-l {
display: flex;
......
<template>
<view class='product-page' v-show="productInfo != null">
<view class='p-banner' v-show="goodsImage != ''">
<image :src='goodsImage' class='banner-item'></image>
<image :src='goodsImage' mode="widthFix" class='banner-item'></image>
</view>
<view class="p-box">
<view class='box-top'>
......
.use-page{
width: 100%;
height: 100vh;
max-height: 1624rpx;
background: #F7FAFF;
.use-mian{
padding-top:8rpx;
......@@ -63,8 +62,10 @@
position: fixed;
bottom:0 ;
width: 100%;
height: 126rpx;
height: 136rpx;
background: #FFFFFF;
box-sizing: border-box;
padding-bottom: 10rpx;
.footer-btn{
margin: 23rpx 40rpx;
width: 670rpx;
......
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