提交 34ab4e72 编写于 作者: api工厂's avatar api工厂

分类页面定位bug,分销团队页面优化,购物车红点位置bug

上级 68f96567
module.exports = {
version: '10.4.0',
note: '商品列表页面增加触底加载下一页', // 这个为版本描述,无需修改
version: '10.5.0',
note: '分类页面定位bug,分销团队页面优化,购物车红点位置bug', // 这个为版本描述,无需修改
subDomain: 'tz', // 此处改成你自己的专属域名。什么是专属域名?请看教程 https://www.it120.cc/help/qr6l4m.html
sdkAppID: 1400450467, // 腾讯实时音视频应用编号,请看教程 https://www.it120.cc/help/nxoqsl.html
}
\ No newline at end of file
......@@ -39,25 +39,26 @@ Page({
let activeCategory = 0
let categorySelected = this.data.categorySelected
if (res.code == 0) {
if (this.data.categorySelected.id) {
activeCategory = res.data.findIndex(ele => {
return ele.id == this.data.categorySelected.id
})
categorySelected = res.data[activeCategory]
} else {
categorySelected = res.data[0]
}
const categories = res.data
categories.forEach(p => {
p.childs = categories.filter(ele => {
return p.id == ele.pid
})
console.log(p.childs);
})
const firstCategories = categories.filter(ele => { return ele.level == 1 })
if (this.data.categorySelected.id) {
activeCategory = firstCategories.findIndex(ele => {
return ele.id == this.data.categorySelected.id
})
categorySelected = firstCategories[activeCategory]
} else {
categorySelected = firstCategories[0]
}
this.setData({
page: 1,
activeCategory,
categories,
firstCategories,
categorySelected
})
this.getGoodsList()
......@@ -122,7 +123,7 @@ Page({
page: 1,
secondCategoryId: '',
activeCategory: idx,
categorySelected: this.data.categories[idx],
categorySelected: this.data.firstCategories[idx],
scrolltop: 0
});
this.getGoodsList();
......
......@@ -2,7 +2,7 @@
<view class="main">
<scroll-view class="category-container" scroll-y="true" scroll-with-animation="true" scroll-into-view="{{ aaa }}">
<van-sidebar active-key="{{ activeCategory }}">
<van-sidebar-item wx:if="{{item.level == 1}}" id="category{{item.id}}" wx:for="{{categories}}" wx:key="id" data-idx="{{index}}" bindtap="onCategoryClick" title="{{ item.name }}" />
<van-sidebar-item wx:if="{{item.level == 1}}" id="category{{item.id}}" wx:for="{{firstCategories}}" wx:key="id" data-idx="{{index}}" bindtap="onCategoryClick" title="{{ item.name }}" />
</van-sidebar>
</scroll-view>
<scroll-view class="goods-container" scroll-y="true" scroll-top="{{scrolltop}}" wx:if='{{onLoadStatus}}' bindscrolltolower="goodsGoBottom">
......
const app = getApp()
const WXAPI = require('apifm-wxapi')
var sliderWidth = 96;
Page({
/**
* 页面的初始数据
*/
data: {
number1: 0,
number2: 0,
activeIndex: 0,
sliderOffset: 0,
sliderLeft: 0,
grids: [0, 1, 2, 3, 4, 5, 6, 7, 8]
number1: 0, // 直推用户数
number2: 0, // 间推用户数
activeIndex: 0, // tab点亮索引
page: 1 // 读取第几页
},
onLoad: function () {
var that = this;
wx.getSystemInfo({
success: function (res) {
that.setData({
sliderLeft: (res.windowWidth / 2 - sliderWidth) / 2,
sliderOffset: res.windowWidth / 2 * that.data.activeIndex
});
}
});
},
tabClick: function (e) {
this.setData({
sliderOffset: e.currentTarget.offsetLeft,
activeIndex: e.currentTarget.id
});
this.fxMembersStatistics()
this.fxMembers()
},
onShow: function () {
const _this = this
WXAPI.fxMembers({
},
async fxMembersStatistics() {
const res = await WXAPI.fxMembersStatistics(wx.getStorageSync('token'))
if (res.code == 0) {
this.setData({
number1: res.data.totleFansLevel1,
number2: res.data.totleFansLevel2
})
}
},
async fxMembers() {
const res = await WXAPI.fxMembers({
token: wx.getStorageSync('token'),
pageSize: 100000
}).then(res => {
if (res.code == 700) {
_this.setData({
members: [],
number1: 0,
number2: 0
page: this.data.page,
level: this.data.activeIndex == 0 ? 1 : 2
})
if (res.code == 700) {
if (this.data.page == 1) {
this.setData({
members: []
})
} else {
wx.showToast({
title: '没有更多了',
icon: 'none'
})
}
if (res.code == 0) {
let number1 = 0
let number2 = 0
res.data.result.forEach(ele => {
if (ele.level == 1) {
number1++
}
if (ele.level == 2) {
number2++
}
}
if (res.code == 0) {
const statisticsCommisionMap = res.data.statisticsCommisionMap
res.data.result.forEach(ele => {
if (!ele.avatarUrls) {
ele.avatarUrls = '/images/face.png'
}
if (!ele.nicks) {
ele.nicks = '用户' + ele.uids
}
const _statisticsCommisionMap = statisticsCommisionMap[ele.uids]
if (_statisticsCommisionMap) {
ele.saleroom = _statisticsCommisionMap.saleroom
}
})
if (this.data.page == 1) {
this.setData({
members: res.data.result
})
_this.setData({
members: res.data.result,
number1: number1,
number2: number2
} else {
this.setData({
members: this.data.members.concat(res.data.result)
})
}
}
},
tabChange(e) {
this.setData({
activeIndex: e.detail.index,
page: 1
})
this.fxMembers()
},
onReachBottom: function() {
this.data.page += 1
this.fxMembers()
},
onPullDownRefresh: function() {
this.data.page = 1
this.fxMembersStatistics()
this.fxMembers()
wx.stopPullDownRefresh()
},
})
\ No newline at end of file
{
"navigationBarTitleText": "我的团队"
"navigationBarTitleText": "我的团队",
"enablePullDownRefresh": true
}
\ No newline at end of file
<view class="page">
<view class="page__bd">
<view class="weui-tab">
<view class="weui-navbar">
<view id="0" class="weui-navbar__item {{activeIndex == 0 ? 'weui-bar__item_on' : ''}}" bindtap="tabClick">
<view class="weui-navbar__title">
一级
<view wx:if="{{number1 > 0}}" class="weui-badge" style="margin-left: 5px;">{{number1}}</view>
</view>
</view>
<view id="1" class="weui-navbar__item {{activeIndex == 1 ? 'weui-bar__item_on' : ''}}" bindtap="tabClick">
<view class="weui-navbar__title">
二级
<view wx:if="{{number2 > 0}}" class="weui-badge" style="margin-left: 5px;">{{number2}}</view>
</view>
</view>
<view class="weui-navbar__slider" style="left: {{sliderLeft}}px; transform: translateX({{sliderOffset}}px); -webkit-transform: translateX({{sliderOffset}}px);"></view>
</view>
<view class="weui-tab__panel">
<view class="weui-tab__content" hidden="{{activeIndex != 0}}">
<view wx:if="{{number1 <= 0}}" class="weui-loadmore weui-loadmore_line" style='margin-top:300rpx;'>
<view class="weui-loadmore__tips weui-loadmore__tips_in-line">暂无数据</view>
</view>
<view wx:if="{{number1 > 0}}" class="weui-panel weui-panel_access">
<view class="weui-panel__bd">
<view wx:if="{{item.level == 1}}" wx:for="{{members}}" wx:key="*this" class="weui-media-box weui-media-box_text">
<view class="weui-media-box__title weui-media-box__title_in-text">{{ item.nicks }} {{ item.mobileMasks }}</view>
<view class="weui-media-box__desc">{{ item.dateAdd }}</view>
</view>
</view>
</view>
</view>
<view class="weui-tab__content" hidden="{{activeIndex != 1}}">
<view wx:if="{{number2 <= 0}}" class="weui-loadmore weui-loadmore_line" style='margin-top:300rpx;'>
<view class="weui-loadmore__tips weui-loadmore__tips_in-line">暂无数据</view>
</view>
<view wx:if="{{number2 > 0}}" class="weui-panel weui-panel_access">
<view class="weui-panel__bd">
<view wx:if="{{item.level == 2}}" wx:for="{{members}}" wx:key="*this" class="weui-media-box weui-media-box_text">
<view class="weui-media-box__title weui-media-box__title_in-text">{{ item.nicks }} {{ item.mobileMasks }}</view>
<view class="weui-media-box__desc">{{ item.dateAdd }}</view>
</view>
</view>
</view>
</view>
</view>
</view>
<van-tabs active="{{ activeIndex }}" bind:change="tabChange">
<van-tab title="直推" info="{{ number1 ? number1 : '' }}" />
<van-tab title="间推" info="{{ number2 ? number2 : '' }}" />
</van-tabs>
<van-empty wx:if="{{ !members || members.length == 0 }}" description="暂无用户" />
<view wx:for="{{members}}" wx:key="id" class="list">
<image src="{{ item.avatarUrls }}" mode="aspectFill" class="l"></image>
<view class="r">
<van-cell
custom-class="r"
size="large"
title="{{ item.nicks }}"
label="{{ item.mobileMasks}}"
value="{{ item.saleroom ? '销售额:¥' + item.saleroom : ''}}"
/>
</view>
</view>
<float-menu />
\ No newline at end of file
</view>
\ No newline at end of file
page,
.page,
.page__bd{
height: 100%;
.list {
display: flex;
align-items: center;
width: 100vw;
padding: 8rpx 32rpx;
box-sizing: border-box;
}
.page__bd{
padding-bottom: 0;
.list .l {
width: 88rpx;
height: 88rpx;
}
.list .r {
flex: 1;
}
\ No newline at end of file
......@@ -182,18 +182,34 @@ async function authorize() {
code: code,
referrer: referrer
}).then(function (res) {
wx.setStorageSync('token', res.data.token)
wx.setStorageSync('uid', res.data.uid)
resolve(res)
if (res.code == 0) {
wx.setStorageSync('token', res.data.token)
wx.setStorageSync('uid', res.data.uid)
resolve(res)
} else {
wx.showToast({
title: res.msg,
icon: 'none'
})
reject(res.msg)
}
})
} else {
WXAPI.authorize({
code: code,
referrer: referrer
}).then(function (res) {
wx.setStorageSync('token', res.data.token)
wx.setStorageSync('uid', res.data.uid)
resolve(res)
if (res.code == 0) {
wx.setStorageSync('token', res.data.token)
wx.setStorageSync('uid', res.data.uid)
resolve(res)
} else {
wx.showToast({
title: res.msg,
icon: 'none'
})
reject(res.msg)
}
})
}
},
......
......@@ -9,17 +9,17 @@ function showTabBarBadge(){
WXAPI.shippingCarInfo(token).then(res => {
if (res.code == 700) {
wx.removeTabBarBadge({
index: 2
index: 3
});
}
if (res.code == 0) {
if (res.data.number == 0) {
wx.removeTabBarBadge({
index: 2
index: 3
});
} else {
wx.setTabBarBadge({
index: 2,
index: 3,
text: `${res.data.number}`
});
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册