Browse Source

feat: 统一货源管理按钮显示条件

pull/19/head
徐飞洋 1 month ago
parent
commit
724099ecf6
  1. 24
      pages/index/index.js
  2. 4
      pages/index/index.wxml

24
pages/index/index.js

@ -61,6 +61,7 @@ Page({
testMode: true, testMode: true,
partnerstatus: '', partnerstatus: '',
viewedGoods: [], // 已浏览商品ID列表 viewedGoods: [], // 已浏览商品ID列表
isInPersonnel: false, // 用户手机号是否在personnel表中
// 广告轮播图数据 // 广告轮播图数据
adCarouselList: [ adCarouselList: [
@ -452,6 +453,27 @@ Page({
}); });
}, },
// 检查用户手机号是否在personnel表中
checkPhoneInPersonnel() {
const userInfo = this.data.userInfo;
const phoneNumber = userInfo.phoneNumber;
if (!phoneNumber) {
this.setData({ isInPersonnel: false });
return;
}
console.log('开始检查手机号是否在personnel表中:', phoneNumber);
API.checkPhoneInPersonnel(phoneNumber).then(isInPersonnel => {
console.log('用户手机号是否在personnel表中:', isInPersonnel);
this.setData({ isInPersonnel });
}).catch(err => {
console.error('检查personnel表失败:', err);
this.setData({ isInPersonnel: false });
});
},
// 切换按钮显示/隐藏到侧边栏 // 切换按钮显示/隐藏到侧边栏
toggleSidebarBtn() { toggleSidebarBtn() {
this.setData({ this.setData({
@ -558,6 +580,7 @@ Page({
this.checkAndRestoreLoginStatus() this.checkAndRestoreLoginStatus()
this.loadCategories() this.loadCategories()
this.loadGoods() this.loadGoods()
this.checkPhoneInPersonnel()
// 计算搜索区域高度 // 计算搜索区域高度
setTimeout(() => { setTimeout(() => {
@ -634,6 +657,7 @@ Page({
}); });
this.checkAndRestoreLoginStatus() this.checkAndRestoreLoginStatus()
this.checkPhoneInPersonnel()
}, },
onHide: function () { onHide: function () {

4
pages/index/index.wxml

@ -171,6 +171,10 @@
<view class="goods-list-container"> <view class="goods-list-container">
<!-- 功能按钮区域 --> <!-- 功能按钮区域 -->
<view class="function-buttons"> <view class="function-buttons">
<view class="function-btn" bindtap="navigateToSettlement" wx:if="{{isInPersonnel}}">
<text class="function-btn-icon">🛒</text>
<text class="function-btn-text">货源管理</text>
</view>
<view class="function-btn" bindtap="navigateToSettlement"> <view class="function-btn" bindtap="navigateToSettlement">
<text class="function-btn-icon">🥚</text> <text class="function-btn-icon">🥚</text>
<text class="function-btn-text">我要卖蛋</text> <text class="function-btn-text">我要卖蛋</text>

Loading…
Cancel
Save