Commit 12fa9e8d by 谢中龙

修改

parent 33c72a74
<!--component/tabSort/tabSort.wxml--> <!--component/tabSort/tabSort.wxml-->
<view class="category-tab-container clear-box"> <view class="category-tab-container clear-box">
<view class="category-tab {{categoryTabFixed ? 'fixed' : ''}}"> <view class="category-tab {{categoryTabFixed ? 'fixed' : ''}}" wx:if="{{currentCategoryTab.categorys.length > 1}}">
<view class="scroll-view_H"> <view class="scroll-view_H" >
<view class="category-tab-item active">鞋子</view> <view class="category-tab-item {{item.actived ? 'active' : ''}}"
<view class="category-tab-item">裤子</view> wx:for="{{currentCategoryTab.categorys}}" wx:key="*this"
<view class="category-tab-item">帽子</view> wx:for-index="idx" wx:for-item="item"
<view class="category-tab-item">衣服</view> data-item="{{item}}" data-index="{{idx}}" bindtap="onTapChangeCategory">{{item.title}}</view>
<view class="category-tab-item">衣服</view>
<view class="category-tab-item">衣服</view>
<view class="category-tab-item">衣服</view>
<view class="category-tab-item">衣服</view>
</view> </view>
</view> </view>
<!-- 商品列表 --> <!-- 商品列表 -->
<view class="product-list" wx:if="{{proData.length}}"> <view class="product-list" wx:if="{{proData.length}}" style="padding-top: {{currentCategoryTab.categorys.length > 1 ? 0 : '1rpx'}};">
<product-list-style-one image-data="{{proData}}" /> <product-list-style-one image-data="{{proData}}" />
</view> </view>
</view> </view>
......
...@@ -49,4 +49,5 @@ ...@@ -49,4 +49,5 @@
.category-tab-container .product-list{ .category-tab-container .product-list{
background: #ffffff; background: #ffffff;
} }
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
// 修改 BRANCH_ID 为对应的商户id // 修改 BRANCH_ID 为对应的商户id
// app.js 中brandId 修改为对应 // app.js 中brandId 修改为对应
const PROJECT_ENV = 'test' // 生产 prod, 开发 dev, 测试 test , 测试门户 test_store, 预生产 pre const PROJECT_ENV = 'dev' // 生产 prod, 开发 dev, 测试 test , 测试门户 test_store, 预生产 pre
//仅生产环境时 配置 : //仅生产环境时 配置 :
//3001 3001 , wx313ec36b710125d4 有直播 //3001 3001 , wx313ec36b710125d4 有直播
//2006 泰华 , wx40fec8944623c8b3 有直播 //门户 wx833d5ece112fc3fd //2006 泰华 , wx40fec8944623c8b3 有直播 //门户 wx833d5ece112fc3fd
...@@ -27,7 +27,7 @@ const PROJECT_ENV = 'test' // 生产 prod, 开发 dev, 测试 test , 测试门 ...@@ -27,7 +27,7 @@ const PROJECT_ENV = 'test' // 生产 prod, 开发 dev, 测试 test , 测试门
//2002 巴黎贝甜 wx21968cb3a486d4ab //2002 巴黎贝甜 wx21968cb3a486d4ab
//2014 包小姐与鞋先生 wxa00302e2f53dd9c5 //2014 包小姐与鞋先生 wxa00302e2f53dd9c5
const BRANCH_ID = 1002 const BRANCH_ID = 1001
const isMall = true const isMall = true
// const needMock = '' // // const needMock = '' //
......
...@@ -35,6 +35,7 @@ wxService.page({ ...@@ -35,6 +35,7 @@ wxService.page({
contactUsModal: false, contactUsModal: false,
//显示广告 //显示广告
pageInfo : null, pageInfo : null,
categoryTabFixed : false,
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
...@@ -63,8 +64,84 @@ wxService.page({ ...@@ -63,8 +64,84 @@ wxService.page({
handlerDataOnPage = new utils.HandlerDataOnPage() handlerDataOnPage = new utils.HandlerDataOnPage()
renderPage = require('../../utils/renderPage').getRenderPage() renderPage = require('../../utils/renderPage').getRenderPage()
handlerDataOnPage.init(this, 'pages') handlerDataOnPage.init(this, 'pages')
this.initPage(this.data.pageId) this.initPage(this.data.pageId);
setTimeout(() => {
this.getElementTop();
// categoryTab
},500);
},
// 页面滚动到底部
onReachBottom(){
if(this.categoryTabComponent){
this.categoryTabComponent.getTagProducts('scrollBottom');
}
},
//页面滚动
onPageScroll(e){
if(!this.scrollTop){
return ;
}
let scrollTop = e.scrollTop;
this.throttle(scoTop => {
if(scoTop > this.scrollTop){
this.data.categoryTabFixed = true;
}
else{
this.data.categoryTabFixed = false;
}
this.setData({
categoryTabFixed : this.data.categoryTabFixed
});
},null,0,scrollTop);
},
//节流器
throttle(fn, context, delay, text){
clearTimeout(fn.timeoutId)
fn.timeoutId = setTimeout(function () {
fn.call(context, text)
}, delay)
},
//获取元素到顶部的里
getElementTop(){
wx.createSelectorQuery().select('.categoryTab').boundingClientRect(res => {
if(res){
this.scrollTop = res.top;
this.categoryTabComponent = this.selectComponent('#categoryTab');
}
}).exec();
},
//子组件更新成功
loadProductComplete(e){
if(e.detail == 'tabChange'){
let filterLevel = this.data.pages.filter(item => item.type == 11);
if(filterLevel.length != 0){
let levelIndex = filterLevel[0].levelIndex;
this.data.pages.filter(item => item.levelIndex > levelIndex).forEach(item => {
item.pShow = false;
});
this.setData({
pages : this.data.pages
});
}
}
else{
this.data.pages.forEach(item => {
item.pShow = true;
});
this.setData({
pages : this.data.pages
})
}
}, },
/** /**
* 监听子组件事件 * 监听子组件事件
* */ * */
...@@ -255,6 +332,8 @@ wxService.page({ ...@@ -255,6 +332,8 @@ wxService.page({
// wx.hideLoading() // wx.hideLoading()
}) })
this.handleParaphe(products);
const render = renderPage.initPaging(filterResult).initRenderData(products) const render = renderPage.initPaging(filterResult).initRenderData(products)
this.data.render = render this.data.render = render
const renderData = render.next() const renderData = render.next()
...@@ -286,6 +365,26 @@ wxService.page({ ...@@ -286,6 +365,26 @@ wxService.page({
wx.hideLoading(); wx.hideLoading();
}) })
}, },
//处理段落隐藏和显示
handleParaphe(products){
//把段落增加一个index
products.forEach((item,index) => {
item.levelIndex = index;
item.pShow = true;//默认都显示
});
//查找一下 看看有没有类型是11的
let filterCategoryTab = products.filter(item => item.type == 11);
//如果有的话 则把其以下的都隐藏 (目前仅支持一个)
if(filterCategoryTab.length != 0){
let levelIndex = filterCategoryTab[0].levelIndex;
products.filter(item => item.levelIndex > levelIndex).forEach(c => {
c.pShow = false;
});
}
},
/** /**
* 渲染数据(合并之前的数据) * 渲染数据(合并之前的数据)
* @param products 数组数据 * @param products 数组数据
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
"pic-nav": "/component/picNav/picNav", "pic-nav": "/component/picNav/picNav",
"bottom": "/component/bottom/bottom", "bottom": "/component/bottom/bottom",
"tab-sort": "/component/tabSort/tabSort", "tab-sort": "/component/tabSort/tabSort",
"category-tab": "/component/categoryTab/categoryTab",
"announcement": "/component/announcement/announcement", "announcement": "/component/announcement/announcement",
"icon-swiper": "/component/iconSwiper/iconSwiper", "icon-swiper": "/component/iconSwiper/iconSwiper",
"bannerAd": "/component/bannerAd/bannerAd", "bannerAd": "/component/bannerAd/bannerAd",
......
<view class='user-center' style="background: {{pageBackgroundColor == 1? '#eee': '#fff'}};min-height: {{outoHeigth}}px"> <view class='user-center' style="background: {{pageBackgroundColor == 1? '#eee': '#fff'}};min-height: {{outoHeigth}}px">
<!-- 1 轮播 2 个人中心 3 图片导航 4 底部左划 5 底部 Tab 6 公告 7 分类 8 关注公众号 9 plus(9/5-权重高)--> <!-- 1 轮播 2 个人中心 3 图片导航 4 底部左划 5 底部 Tab 6 公告 7 分类 8 关注公众号 9 plus(9/5-权重高)-->
<block wx:for="{{pages}}" wx:key="{{index}}" wx:for-item="pItem"> <block wx:for="{{pages}}" wx:key="{{index}}" wx:for-item="pItem">
<view wx:if="{{pItem.type == 1}}"> <view wx:if="{{pItem.type == 1 && pItem.pShow}}">
<image-swiper image-data="{{pItem.rotationchart.images}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}"/> <image-swiper image-data="{{pItem.rotationchart.images}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}"/>
</view> </view>
<view class="" wx:if="{{pItem.type == 2}}"> <view class="" wx:if="{{pItem.type == 2 && pItem.pShow}}">
<person-center isVip="{{isVip}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" base-user-info="{{baseUserInfo}}" person-data="{{pItem.customer}}" valueCardNum="{{valueCardNum}}" integral-num="{{integralNum}}" coupon-num="{{couponNum}}" token="{{token}}"/> <person-center isVip="{{isVip}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" base-user-info="{{baseUserInfo}}" person-data="{{pItem.customer}}" valueCardNum="{{valueCardNum}}" integral-num="{{integralNum}}" coupon-num="{{couponNum}}" token="{{token}}"/>
</view> </view>
<view class="" wx:if="{{pItem.type == 3}}"> <view class="" wx:if="{{pItem.type == 3 && pItem.pShow}}">
<pic-nav pic-nav="{{pItem.navigation.images}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" bind:updatePage="updatePage"/> <pic-nav pic-nav="{{pItem.navigation.images}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" bind:updatePage="updatePage"/>
</view> </view>
<view class="" wx:if="{{pItem.type == 4}}"> <view class="" wx:if="{{pItem.type == 4 && pItem.pShow}}">
<bottom bottom="{{pItem.bottom}}" /> <bottom bottom="{{pItem.bottom}}" />
</view> </view>
<view class="" wx:if="{{pItem.type == 5}}"> <view class="" wx:if="{{pItem.type == 5}}">
<bottom-tabs currHomePageId="{{currHomePageId}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" tab-bar="{{pItem.tabBar}}" bind:updatePage="updatePage"/> <bottom-tabs currHomePageId="{{currHomePageId}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" tab-bar="{{pItem.tabBar}}" bind:updatePage="updatePage"/>
</view> </view>
<view class="" wx:if="{{pItem.type == 6}}"> <view class="" wx:if="{{pItem.type == 6 && pItem.pShow}}">
<announcement notice="{{pItem.notice}}"/> <announcement notice="{{pItem.notice}}"/>
</view> </view>
<view class="" wx:if="{{pItem.type == 7}}"> <view class="" wx:if="{{pItem.type == 7 && pItem.pShow}}">
<tab-sort currHomePageId="{{currHomePageId}}" category-type="{{pItem.categoryType}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" bind:updatePage="updatePage"/> <tab-sort currHomePageId="{{currHomePageId}}" category-type="{{pItem.categoryType}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" bind:updatePage="updatePage"/>
</view> </view>
<view class="" wx:if="{{pItem.type == 8}}"> <view class="" wx:if="{{pItem.type == 8 && pItem.pShow}}">
<attention focus-wx="{{pItem.focusWx}}" /> <attention focus-wx="{{pItem.focusWx}}" />
</view> </view>
<view class="" wx:if="{{pItem.type == 9}}"> <view class="" wx:if="{{pItem.type == 9}}">
<plus sku-list="{{skuVOList}}" plus-bgi="{{pItem.plus}}" currentHasUserInfo="{{currentHasUserInfo}}" bind:updatePage="updatePage"/> <plus sku-list="{{skuVOList}}" plus-bgi="{{pItem.plus}}" currentHasUserInfo="{{currentHasUserInfo}}" bind:updatePage="updatePage"/>
</view> </view>
<!-- 分类组件 -->
<view class="categoryTab" wx:if="{{pItem.type == 11}}">
<category-tab currHomePageId="{{currHomePageId}}"
categoryTab="{{pItem.categoryTab}}"
categoryTabFixed="{{categoryTabFixed}}" id="categoryTab"
bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}"
bind:updatePage="updatePage"
bind:loadProductComplete="loadProductComplete"/>
</view>
</block> </block>
</view> </view>
<guide-page-modal show="{{guidePageModalShow}}" /> <guide-page-modal show="{{guidePageModalShow}}" />
......
...@@ -93,14 +93,14 @@ wxService.page({ ...@@ -93,14 +93,14 @@ wxService.page({
setTimeout(() => { setTimeout(() => {
this.getElementTop(); this.getElementTop();
// categoryTab // categoryTab
},300); },500);
}, },
// 页面滚动到底部 // 页面滚动到底部
onReachBottom(){ onReachBottom(){
console.log(this.categoryTabComponent) console.log(this.categoryTabComponent)
if(this.categoryTabComponent){ if(this.categoryTabComponent){
this.categoryTabComponent.getTagProducts(2); this.categoryTabComponent.getTagProducts('scrollBottom');
} }
}, },
...@@ -335,6 +335,7 @@ wxService.page({ ...@@ -335,6 +335,7 @@ wxService.page({
this.initHomePage() this.initHomePage()
}, },
//初始化首页数据
initHomePage() { initHomePage() {
wx.showLoading({ wx.showLoading({
title: '加载中' title: '加载中'
...@@ -380,6 +381,8 @@ wxService.page({ ...@@ -380,6 +381,8 @@ wxService.page({
// wx.hideLoading() // wx.hideLoading()
}) })
this.handleParaphe(products);
const render = renderPage.initPaging(filterResult).initRenderData(products) const render = renderPage.initPaging(filterResult).initRenderData(products)
this.data.render = render this.data.render = render
const renderData = render.next() const renderData = render.next()
...@@ -417,6 +420,50 @@ wxService.page({ ...@@ -417,6 +420,50 @@ wxService.page({
}); });
}) })
}, },
//子组件更新成功
loadProductComplete(e){
if(e.detail == 'tabChange'){
let filterLevel = this.data.pages.filter(item => item.type == 11);
if(filterLevel.length != 0){
let levelIndex = filterLevel[0].levelIndex;
this.data.pages.filter(item => item.levelIndex > levelIndex).forEach(item => {
item.pShow = false;
});
this.setData({
pages : this.data.pages
});
}
}
else{
this.data.pages.forEach(item => {
item.pShow = true;
});
this.setData({
pages : this.data.pages
})
}
},
//handleParaphe
//处理段落隐藏和显示
handleParaphe(products){
//把段落增加一个index
products.forEach((item,index) => {
item.levelIndex = index;
item.pShow = true;//默认都显示
});
//查找一下 看看有没有类型是11的
let filterCategoryTab = products.filter(item => item.type == 11);
//如果有的话 则把其以下的都隐藏 (目前仅支持一个)
if(filterCategoryTab.length != 0){
let levelIndex = filterCategoryTab[0].levelIndex;
products.filter(item => item.levelIndex > levelIndex).forEach(c => {
c.pShow = false;
});
}
},
/** /**
* 渲染数据(合并之前的数据) * 渲染数据(合并之前的数据)
* @param products 数组数据 * @param products 数组数据
...@@ -443,19 +490,6 @@ wxService.page({ ...@@ -443,19 +490,6 @@ wxService.page({
}) })
}, },
// 获取plus购买信息
// getPlusPurchase() {
// wxService.get(`/sale/premium/query`).then(res => {
// if(!res) return false
// const { result, data } = res.data
// if (result == 0) {
// this.setData({
// skuVOList: data
// })
// }
// }).finally(() => {
// })
// },
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
......
...@@ -3,27 +3,27 @@ ...@@ -3,27 +3,27 @@
<view class='user-center' style="background: {{pageBackgroundColor == 1? '#eee': '#fff'}};min-height: {{outoHeigth}}px"> <view class='user-center' style="background: {{pageBackgroundColor == 1? '#eee': '#fff'}};min-height: {{outoHeigth}}px">
<!-- 1 轮播 2 个人中心 3 图片导航 4 底部左划 5 底部 Tab 6 公告 7 分类 8 关注公众号 9 plus(9/5-权重高)--> <!-- 1 轮播 2 个人中心 3 图片导航 4 底部左划 5 底部 Tab 6 公告 7 分类 8 关注公众号 9 plus(9/5-权重高)-->
<block wx:for="{{pages}}" wx:key="*this" wx:for-item="pItem"> <block wx:for="{{pages}}" wx:key="*this" wx:for-item="pItem">
<view wx:if="{{pItem.type == 1}}"> <view wx:if="{{pItem.type == 1 && pItem.pShow }}">
<image-swiper <image-swiper
image-data="{{pItem.rotationchart.images}}" image-data="{{pItem.rotationchart.images}}"
bind:updatePage="updatePage" bind:updatePage="updatePage"
bind:getAuth="_getUserInfo" bind:getAuth="_getUserInfo"
currentHasUserInfo="{{currentHasUserInfo}}"/> currentHasUserInfo="{{currentHasUserInfo}}"/>
</view> </view>
<view class="" wx:if="{{pItem.type == 2}}"> <view class="" wx:if="{{pItem.type == 2 && pItem.pShow}}">
<person-center isVip="{{isVip}}" bind:getAuth="_getUserInfo" <person-center isVip="{{isVip}}" bind:getAuth="_getUserInfo"
currentHasUserInfo="{{currentHasUserInfo}}" base-user-info="{{baseUserInfo}}" currentHasUserInfo="{{currentHasUserInfo}}" base-user-info="{{baseUserInfo}}"
person-data="{{pItem.customer}}" integral-num="{{integralNum}}" person-data="{{pItem.customer}}" integral-num="{{integralNum}}"
valueCardNum="{{valueCardNum}}" coupon-num="{{couponNum}}" token="{{token}}"/> valueCardNum="{{valueCardNum}}" coupon-num="{{couponNum}}" token="{{token}}"/>
</view> </view>
<view class="" wx:if="{{pItem.type == 3}}"> <view class="" wx:if="{{pItem.type == 3 && pItem.pShow}}">
<pic-nav <pic-nav
pic-nav="{{pItem.navigation.images}}" pic-nav="{{pItem.navigation.images}}"
bind:getAuth="_getUserInfo" bind:getAuth="_getUserInfo"
currentHasUserInfo="{{currentHasUserInfo}}" currentHasUserInfo="{{currentHasUserInfo}}"
bind:updatePage="updatePage"/> bind:updatePage="updatePage"/>
</view> </view>
<view class="" wx:if="{{pItem.type == 4}}"> <view class="" wx:if="{{pItem.type == 4 && pItem.pShow}}">
<bottom bottom="{{pItem.bottom}}" /> <bottom bottom="{{pItem.bottom}}" />
</view> </view>
<view class="" wx:if="{{pItem.type == 5}}"> <view class="" wx:if="{{pItem.type == 5}}">
...@@ -31,15 +31,15 @@ ...@@ -31,15 +31,15 @@
bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}"
tab-bar="{{pItem.tabBar}}" bind:updatePage="updatePage"/> tab-bar="{{pItem.tabBar}}" bind:updatePage="updatePage"/>
</view> </view>
<view class="" wx:if="{{pItem.type == 6}}"> <view class="" wx:if="{{pItem.type == 6 && pItem.pShow}}">
<announcement notice="{{pItem.notice}}"/> <announcement notice="{{pItem.notice}}"/>
</view> </view>
<view class="" wx:if="{{pItem.type == 7}}"> <view class="" wx:if="{{pItem.type == 7 && pItem.pShow}}">
<tab-sort currHomePageId="{{currHomePageId}}" category-type="{{pItem.categoryType}}" <tab-sort currHomePageId="{{currHomePageId}}" category-type="{{pItem.categoryType}}"
bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" bind:updatePage="updatePage"/> bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" bind:updatePage="updatePage"/>
</view> </view>
<view class="" wx:if="{{pItem.type == 8}}"> <view class="" wx:if="{{pItem.type == 8 && pItem.pShow}}">
<attention focus-wx="{{pItem.focusWx}}" /> <attention focus-wx="{{pItem.focusWx}}" />
</view> </view>
<view class="" wx:if="{{pItem.type == 9}}"> <view class="" wx:if="{{pItem.type == 9}}">
...@@ -47,12 +47,14 @@ ...@@ -47,12 +47,14 @@
currentHasUserInfo="{{currentHasUserInfo}}" bind:updatePage="updatePage"/> currentHasUserInfo="{{currentHasUserInfo}}" bind:updatePage="updatePage"/>
</view> </view>
<!-- 分类组件 --> <!-- 分类组件 -->
<view class="categoryTab" wx:if="{{pItem.type == 7}}"> <view class="categoryTab" wx:if="{{pItem.type == 11}}">
<category-tab currHomePageId="{{currHomePageId}}" categoryTab="{{pItem.categoryType}}" categoryTabFixed="{{categoryTabFixed}}" <category-tab currHomePageId="{{currHomePageId}}"
id="categoryTab" categoryTab="{{pItem.categoryTab}}"
bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" bind:updatePage="updatePage"/> categoryTabFixed="{{categoryTabFixed}}" id="categoryTab"
bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}"
bind:updatePage="updatePage"
bind:loadProductComplete="loadProductComplete"/>
</view> </view>
</block> </block>
</view> </view>
<guide-page-modal show="{{guidePageModalShow}}" /> <guide-page-modal show="{{guidePageModalShow}}" />
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
"urlCheck": false, "urlCheck": false,
"es6": true, "es6": true,
"postcss": true, "postcss": true,
"preloadBackgroundData": false,
"minified": true, "minified": true,
"newFeature": true, "newFeature": true,
"coverView": true, "coverView": true,
...@@ -21,13 +22,12 @@ ...@@ -21,13 +22,12 @@
"disablePlugins": [], "disablePlugins": [],
"outputPath": "" "outputPath": ""
}, },
"useCompilerModule": true, "useCompilerModule": false,
"userConfirmedUseCompilerModuleSwitch": false, "userConfirmedUseCompilerModuleSwitch": false
"preloadBackgroundData": false
}, },
"compileType": "miniprogram", "compileType": "miniprogram",
"libVersion": "2.11.0", "libVersion": "2.11.0",
"appid": "wxac09792264c49b5c", "appid": "wxc3b64b09b1d3dfc2",
"projectname": "%E5%BE%AE%E5%95%86%E5%9F%8E", "projectname": "%E5%BE%AE%E5%95%86%E5%9F%8E",
"debugOptions": { "debugOptions": {
"hidedInDevtools": [] "hidedInDevtools": []
...@@ -143,7 +143,7 @@ ...@@ -143,7 +143,7 @@
"id": 13, "id": 13,
"name": "subPage", "name": "subPage",
"pathName": "subPackage/page/pages/subPage/subPage", "pathName": "subPackage/page/pages/subPage/subPage",
"query": "pageId=73", "query": "pageId=72",
"scene": null "scene": null
}, },
{ {
......
...@@ -18,7 +18,7 @@ wxService.page({ ...@@ -18,7 +18,7 @@ wxService.page({
form: { form: {
mallCategoryId: '', mallCategoryId: '',
sortType:'', sortType:'',
order:'' order:'',
}, },
navTab:[ navTab:[
{ {
...@@ -153,7 +153,8 @@ wxService.page({ ...@@ -153,7 +153,8 @@ wxService.page({
let url = `/sale/product/mallCategory/listPageProductByMallCategoryIdAndItsSons?pageNo=${pageNo}&pageSize=${pageSize}`; let url = `/sale/product/mallCategory/listPageProductByMallCategoryIdAndItsSons?pageNo=${pageNo}&pageSize=${pageSize}`;
if(this.data.pageFrom == 'category'){ if(this.data.pageFrom == 'category'){
url = `/sale/product/buyer/listPageByCategoryId?pageNo=${pageNo}&pageSize=${pageSize}` this.data.form.categoryId = this.data.form.mallCategoryId;
url = `/sale/product/buyer/listPageByCategoryId?pageNo=${pageNo}&pageSize=${pageSize}`;
} }
wxService.post(url, this.data.form).then(res => { wxService.post(url, this.data.form).then(res => {
...@@ -230,26 +231,52 @@ wxService.page({ ...@@ -230,26 +231,52 @@ wxService.page({
}); });
let pageNo = this.data.pageNo, let pageNo = this.data.pageNo,
pageSize = this.data.pageSize; pageSize = this.data.pageSize;
wxService.post(`/sale/product/listPage?pageSize=${pageSize}&pageNo=${pageNo}`,{ this.data.form.state = 1;
productName: "", if(this.data.form.sortType == 'recommend'){
showStockData: true, this.data.form.order = 'desc';
categoryIds: [], }
productTagIds : [this.data.tagId],
productStatus : 2, this.data.form.tagId = this.data.tagId;
showListUrls : true, this.data.form.categoryId = null;
}).then(res => { this.data.form.mallCategoryId = null;
wxService.post(`/sale/product/buyer/listPageByTagId?pageSize=${pageSize}&pageNo=${pageNo}`,this.data.form).then(res => {
const { result, data } = res.data const { result, data } = res.data
if (result == 0 && data.content) { if (result == 0 && data.content) {
wx.hideLoading(); wx.hideLoading();
this.data.proData = this.data.pageNo == 1 ? [...data.content] : [...this.data.proData, ...data.content]; this.data.proData = this.data.pageNo == 1 ? [...data.content] : [...this.data.proData, ...data.content];
this.data.proData.forEach(item => { this.data.proData.forEach(item => {
item.indexUrl = item.indexUrl ? item.indexUrl : 'https://img3.bigaka.com/prd/3001/202003/20200331/30019aa78220-546f-41e0-8075-c2feb69e10b8.jpg'; //营销标签类型 1固定样式 2左下角显示商品当前金额 3左下角显示指定数额
item.indexUrl = item.indexUrl ? item.indexUrl : defaultImg;
//处理商品身上的营销标签数据
item.hasPromotionTag = item.markTagInfo ? true : false;
let tagPrice = item.minSalePrice;
if(item.hasPromotionTag){
item.tagPic = item.markTagInfo.tagPicUrl;
if(item.markTagInfo.tagType == 2){
tagPrice = item.minSalePrice;
}
else{
tagPrice = item.markTagInfo.assignPrice;
}
item.tagType = item.markTagInfo.tagType;
}
//判断价格是否大于1000了
if(tagPrice/100 > 1000){
tagPrice = parseFloat(tagPrice/10/10).toFixed(1);
}
else{
tagPrice = parseFloat(tagPrice/10/10).toFixed(2);
}
item.tagPrice = tagPrice;
}); });
this.setData({ this.setData({
proData: this.data.proData, proData: this.data.proData,
totalPages: data.totalPages, totalPages: data.totalPages,
totalElements: data.totalElements totalElements: data.totalElements
}) });
} }
if(refresh){ if(refresh){
......
...@@ -35,6 +35,7 @@ wxService.page({ ...@@ -35,6 +35,7 @@ wxService.page({
skuVOList:[], skuVOList:[],
//显示广告 //显示广告
pageInfo : null, pageInfo : null,
categoryTabFixed : false,
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
...@@ -65,7 +66,11 @@ wxService.page({ ...@@ -65,7 +66,11 @@ wxService.page({
pageId: this.data.pageId pageId: this.data.pageId
}); });
this.initPage(this.data.pageId) this.initPage(this.data.pageId);
setTimeout(() => {
this.getElementTop();
// categoryTab
},500);
} }
else{ else{
let pageId = shareId; let pageId = shareId;
...@@ -82,6 +87,8 @@ wxService.page({ ...@@ -82,6 +87,8 @@ wxService.page({
}); });
this.initPage(this.data.pageId); this.initPage(this.data.pageId);
} }
//判断是否带m 触点 //判断是否带m 触点
let memberId = options.memberId; let memberId = options.memberId;
...@@ -96,8 +103,78 @@ wxService.page({ ...@@ -96,8 +103,78 @@ wxService.page({
this.generatePointObject(tentacleInfo); this.generatePointObject(tentacleInfo);
} }
},
// 页面滚动到底部
onReachBottom(){
if(this.categoryTabComponent){
this.categoryTabComponent.getTagProducts('scrollBottom');
}
}, },
//页面滚动
onPageScroll(e){
if(!this.scrollTop){
return ;
}
let scrollTop = e.scrollTop;
this.throttle(scoTop => {
if(scoTop > this.scrollTop){
this.data.categoryTabFixed = true;
}
else{
this.data.categoryTabFixed = false;
}
this.setData({
categoryTabFixed : this.data.categoryTabFixed
});
},null,0,scrollTop);
},
//节流器
throttle(fn, context, delay, text){
clearTimeout(fn.timeoutId)
fn.timeoutId = setTimeout(function () {
fn.call(context, text)
}, delay)
},
//获取元素到顶部的里
getElementTop(){
wx.createSelectorQuery().select('.categoryTab').boundingClientRect(res => {
if(res){
this.scrollTop = res.top;
this.categoryTabComponent = this.selectComponent('#categoryTab');
}
}).exec();
},
//子组件更新成功
loadProductComplete(e){
if(e.detail == 'tabChange'){
let filterLevel = this.data.pages.filter(item => item.type == 11);
if(filterLevel.length != 0){
let levelIndex = filterLevel[0].levelIndex;
this.data.pages.filter(item => item.levelIndex > levelIndex).forEach(item => {
item.pShow = false;
});
this.setData({
pages : this.data.pages
});
}
}
else{
this.data.pages.forEach(item => {
item.pShow = true;
});
this.setData({
pages : this.data.pages
})
}
},
/** /**
* 监听子组件事件 * 监听子组件事件
* */ * */
...@@ -269,6 +346,8 @@ wxService.page({ ...@@ -269,6 +346,8 @@ wxService.page({
// wx.hideLoading() // wx.hideLoading()
}) })
this.handleParaphe(products);
const render = renderPage.initPaging(filterResult).initRenderData(products) const render = renderPage.initPaging(filterResult).initRenderData(products)
this.data.render = render this.data.render = render
const renderData = render.next() const renderData = render.next()
...@@ -296,13 +375,29 @@ wxService.page({ ...@@ -296,13 +375,29 @@ wxService.page({
paddingBottom: '0rpx' paddingBottom: '0rpx'
}) })
} }
} }
}).finally(() => { }).finally(() => {
wx.hideLoading(); wx.hideLoading();
}) })
}, },
//处理段落隐藏和显示
handleParaphe(products){
//把段落增加一个index
products.forEach((item,index) => {
item.levelIndex = index;
item.pShow = true;//默认都显示
});
//查找一下 看看有没有类型是11的
let filterCategoryTab = products.filter(item => item.type == 11);
//如果有的话 则把其以下的都隐藏 (目前仅支持一个)
if(filterCategoryTab.length != 0){
let levelIndex = filterCategoryTab[0].levelIndex;
products.filter(item => item.levelIndex > levelIndex).forEach(c => {
c.pShow = false;
});
}
},
/** /**
* 渲染数据(合并之前的数据) * 渲染数据(合并之前的数据)
* @param products 数组数据 * @param products 数组数据
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
"bottom": "/component/bottom/bottom", "bottom": "/component/bottom/bottom",
"go-guid": "/component/goGuid/goGuid", "go-guid": "/component/goGuid/goGuid",
"tab-sort": "/component/tabSort/tabSort", "tab-sort": "/component/tabSort/tabSort",
"category-tab": "/component/categoryTab/categoryTab",
"announcement": "/component/announcement/announcement", "announcement": "/component/announcement/announcement",
"icon-swiper": "/component/iconSwiper/iconSwiper", "icon-swiper": "/component/iconSwiper/iconSwiper",
"bannerAd": "/component/bannerAd/bannerAd", "bannerAd": "/component/bannerAd/bannerAd",
......
...@@ -3,33 +3,42 @@ ...@@ -3,33 +3,42 @@
<!-- 1 轮播 2 个人中心 3 图片导航 4 底部左划 5 底部 Tab 6 公告 7 分类 8 关注公众号 9 plus(9/5-权重高)--> <!-- 1 轮播 2 个人中心 3 图片导航 4 底部左划 5 底部 Tab 6 公告 7 分类 8 关注公众号 9 plus(9/5-权重高)-->
<!-- {{pages}} --> <!-- {{pages}} -->
<block wx:for="{{pages}}" wx:key="{{index}}" wx:for-item="pItem"> <block wx:for="{{pages}}" wx:key="{{index}}" wx:for-item="pItem">
<view wx:if="{{pItem.type == 1}}"> <view wx:if="{{pItem.type == 1 && pItem.pShow}}">
<image-swiper image-data="{{pItem.rotationchart.images}}" bind:updatePage="updatePage" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}"/> <image-swiper image-data="{{pItem.rotationchart.images}}" bind:updatePage="updatePage" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}"/>
</view> </view>
<view class="" wx:if="{{pItem.type == 2}}"> <view class="" wx:if="{{pItem.type == 2 && pItem.pShow}}">
<person-center bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" base-user-info="{{baseUserInfo}}" person-data="{{pItem.customer}}" valueCardNum="{{valueCardNum}}" integral-num="{{integralNum}}" coupon-num="{{couponNum}}" token="{{token}}"/> <person-center bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" base-user-info="{{baseUserInfo}}" person-data="{{pItem.customer}}" valueCardNum="{{valueCardNum}}" integral-num="{{integralNum}}" coupon-num="{{couponNum}}" token="{{token}}"/>
</view> </view>
<view class="" wx:if="{{pItem.type == 3}}"> <view class="" wx:if="{{pItem.type == 3 && pItem.pShow}}">
<pic-nav pic-nav="{{pItem.navigation.images}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" bind:updatePage="updatePage"/> <pic-nav pic-nav="{{pItem.navigation.images}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" bind:updatePage="updatePage"/>
</view> </view>
<view class="" wx:if="{{pItem.type == 4}}"> <view class="" wx:if="{{pItem.type == 4 && pItem.pShow}}">
<bottom bottom="{{pItem.bottom}}" /> <bottom bottom="{{pItem.bottom}}" />
</view> </view>
<view class="" wx:if="{{pItem.type == 5}}"> <view class="" wx:if="{{pItem.type == 5}}">
<bottom-tabs currHomePageId="{{currHomePageId}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" tab-bar="{{pItem.tabBar}}" bind:updatePage="updatePage"/> <bottom-tabs currHomePageId="{{currHomePageId}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" tab-bar="{{pItem.tabBar}}" bind:updatePage="updatePage"/>
</view> </view>
<view class="" wx:if="{{pItem.type == 6}}"> <view class="" wx:if="{{pItem.type == 6 && pItem.pShow}}">
<announcement notice="{{pItem.notice}}"/> <announcement notice="{{pItem.notice}}"/>
</view> </view>
<view class="" wx:if="{{pItem.type == 7}}"> <view class="" wx:if="{{pItem.type == 7 && pItem.pShow}}">
<tab-sort currHomePageId="{{currHomePageId}}" category-type="{{pItem.categoryType}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" bind:updatePage="updatePage"/> <tab-sort currHomePageId="{{currHomePageId}}" category-type="{{pItem.categoryType}}" bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}" bind:updatePage="updatePage"/>
</view> </view>
<view class="" wx:if="{{pItem.type == 8}}"> <view class="" wx:if="{{pItem.type == 8 && pItem.pShow}}">
<attention focus-wx="{{pItem.focusWx}}" /> <attention focus-wx="{{pItem.focusWx}}" />
</view> </view>
<view class="" wx:if="{{pItem.type == 9}}"> <view class="" wx:if="{{pItem.type == 9}}">
<plus sku-list="{{skuVOList}}" plus-bgi="{{pItem.plus}}" currentHasUserInfo="{{currentHasUserInfo}}" bind:updatePage="updatePage"/> <plus sku-list="{{skuVOList}}" plus-bgi="{{pItem.plus}}" currentHasUserInfo="{{currentHasUserInfo}}" bind:updatePage="updatePage"/>
</view> </view>
<!-- 分类组件 -->
<view class="categoryTab" wx:if="{{pItem.type == 11}}">
<category-tab currHomePageId="{{currHomePageId}}"
categoryTab="{{pItem.categoryTab}}"
categoryTabFixed="{{categoryTabFixed}}" id="categoryTab"
bind:getAuth="_getUserInfo" currentHasUserInfo="{{currentHasUserInfo}}"
bind:updatePage="updatePage"
bind:loadProductComplete="loadProductComplete"/>
</view>
</block> </block>
</view> </view>
<guide-page-modal show="{{guidePageModalShow}}" /> <guide-page-modal show="{{guidePageModalShow}}" />
......
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