页面调整
parent
905a408129
commit
67ffe34097
|
|
@ -67,7 +67,7 @@ const user = {
|
|||
return new Promise((resolve, reject) => {
|
||||
getInfo().then(res => {
|
||||
const user = res.user
|
||||
let avatar = user.avatar || ""
|
||||
let avatar = (isEmpty(user) || isEmpty(user.avatar)) ? "" : user.avatar
|
||||
if (!isHttp(avatar)) {
|
||||
avatar = (isEmpty(avatar)) ? defAva : baseUrl + avatar
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
module.exports = {
|
||||
// baseUrl: 'https://vue.ruoyi.vip/prod-api',
|
||||
|
||||
baseUrl:'http://yunzs.haich.cc',
|
||||
// baseUrl:'http://yunzs2.haich.cc',
|
||||
baseUrl:'https://yunzs.haich.cc',
|
||||
// baseUrl:'http://193.112.94.36:8080',
|
||||
// baseUrl = 'https://api.ruoyi.com'
|
||||
// prodApi: 'https://vue.ruoyi.vip/prod-api',
|
||||
|
|
@ -15,6 +16,7 @@ module.exports = {
|
|||
version: "1.2.0",
|
||||
// 应用logo
|
||||
logo: "http://193.112.94.36:8099/static/images/logo.png",
|
||||
// logo: "http://yunzs.haich.cc/static/images/logo.png",
|
||||
// 官方网站
|
||||
site_url: "http://ruoyi.vip",
|
||||
// 政策协议
|
||||
|
|
|
|||
|
|
@ -174,6 +174,12 @@
|
|||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/navailable/navailable",
|
||||
"style": {
|
||||
"navigationBarTitleText": ""
|
||||
}
|
||||
}
|
||||
],
|
||||
"tabBar": {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<!-- 顶部导航栏 -->
|
||||
<view class="navbar">
|
||||
<view class="back-btn" @click="goBack">
|
||||
<text class="back-icon">←</text>
|
||||
<!-- <text class="back-icon">←</text> -->
|
||||
</view>
|
||||
<view class="title">品牌管理</view>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<!-- 顶部导航栏 -->
|
||||
<view class="navbar">
|
||||
<view class="nav-left" @click="navBack">
|
||||
<text class="icon">←</text>
|
||||
<!-- <text class="icon">←</text> -->
|
||||
</view>
|
||||
<view class="nav-title">编辑商品</view>
|
||||
<view class="nav-right">
|
||||
|
|
|
|||
|
|
@ -126,19 +126,32 @@
|
|||
</view>
|
||||
|
||||
<!-- 更多操作弹窗 -->
|
||||
|
||||
<uni-popup ref="popup" type="bottom">
|
||||
<view class="popup-content">
|
||||
<view class="popup-item" @tap="editGoods(selectedGoods)">
|
||||
<uni-icons type="compose" size="20" color="#333"></uni-icons>
|
||||
<text>编辑商品</text>
|
||||
<view class="popup-item" @tap="goToInventoryCount">
|
||||
<uni-icons type="scan" size="20" color="#333"></uni-icons>
|
||||
<text>盘点库存</text>
|
||||
</view>
|
||||
<view class="popup-item" @tap="adjustStock(selectedGoods)">
|
||||
<uni-icons type="plus" size="20" color="#333"></uni-icons>
|
||||
<text>调整库存</text>
|
||||
<view class="popup-item" @tap="goToOutbound">
|
||||
<uni-icons type="arrowright" size="20" color="#333"></uni-icons>
|
||||
<text>出库</text>
|
||||
</view>
|
||||
<view class="popup-item" @tap="deleteGoods(selectedGoods)">
|
||||
<uni-icons type="trash" size="20" color="#ff4444"></uni-icons>
|
||||
<text style="color: #ff4444;">删除商品</text>
|
||||
<view class="popup-item" @tap="batchDeleteGoods">
|
||||
<uni-icons type="trash" size="20" color="#333"></uni-icons>
|
||||
<text>批量删除商品</text>
|
||||
</view>
|
||||
<view class="popup-item" @tap="goToCategoryManagement">
|
||||
<uni-icons type="apps" size="20" color="#333"></uni-icons>
|
||||
<text>分类管理</text>
|
||||
</view>
|
||||
<view class="popup-item" @tap="goToBrandManagement">
|
||||
<uni-icons type="navigate" size="20" color="#333"></uni-icons>
|
||||
<text>品牌管理</text>
|
||||
</view>
|
||||
<view class="popup-item" @tap="goToBarcodeSettings">
|
||||
<uni-icons type="settings" size="20" color="#333"></uni-icons>
|
||||
<text>条码规则设置</text>
|
||||
</view>
|
||||
<view class="popup-item cancel" @tap="$refs.popup.close()">
|
||||
<text>取消</text>
|
||||
|
|
@ -233,18 +246,23 @@
|
|||
}
|
||||
},
|
||||
|
||||
switchTab(tab) {
|
||||
if (tab === 'all' || tab === 'outstock') {
|
||||
// 跳转到商品列表页面,并传递当前标签
|
||||
uni.navigateTo({
|
||||
url: `/pages/product/product?tab=${tab}`
|
||||
});
|
||||
} else {
|
||||
this.currentTab = tab;
|
||||
// 这里可以添加筛选逻辑
|
||||
console.log('切换到标签:', tab);
|
||||
}
|
||||
},
|
||||
switchTab(tab) {
|
||||
if (tab === 'all') {
|
||||
// 跳转到商品列表页面,并传递当前标签
|
||||
uni.navigateTo({
|
||||
url: `/pages/product/product?tab=${tab}`
|
||||
});
|
||||
} else if (tab === 'outstock') {
|
||||
// 跳转到缺货页面
|
||||
uni.navigateTo({
|
||||
url: `/pages/navailable/navailable?tab=${tab}`
|
||||
});
|
||||
} else {
|
||||
this.currentTab = tab;
|
||||
// 这里可以添加筛选逻辑
|
||||
console.log('切换到标签:', tab);
|
||||
}
|
||||
},
|
||||
|
||||
onSearch() {
|
||||
console.log('搜索关键词:', this.searchText);
|
||||
|
|
|
|||
172
pages/index.vue
172
pages/index.vue
|
|
@ -2,10 +2,62 @@
|
|||
<view class="container">
|
||||
|
||||
<view class="one">
|
||||
<view class="barsOne" ><uni-icons type="bars" size="30" class="barsIcons"></uni-icons></view>
|
||||
<view class="barsOne" @click="showDrawer('showLeft')" ><uni-icons type="bars" size="30" class="barsIcons"></uni-icons></view>
|
||||
<view class="scanOne"><uni-icons type="scan" size="30" class="scanIcons"></uni-icons></view>
|
||||
<view class="gearOne"><uni-icons type="gear" size="30" class="gearIcons"></uni-icons></view>
|
||||
<view class="gearOne" @click="goSetting"><uni-icons type="gear" size="30" class="gearIcons"></uni-icons></view>
|
||||
</view>
|
||||
|
||||
<!-- 左侧抽屉 -->
|
||||
<uni-drawer ref="showLeft" mode="left" :width="320" @change="change($event,'showLeft')">
|
||||
<!-- 替换后的抽屉内容 -->
|
||||
<!-- 顶部个人信息区 -->
|
||||
<view class="drawer-header">
|
||||
<image class="avatar" src="/static/avatar.png" mode="widthFix"></image>
|
||||
<view class="name-wrap" @click="goToUser">
|
||||
<text class="user-name">名称</text>
|
||||
<text class="arrow">></text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 个人店模块 -->
|
||||
<view class="section">
|
||||
<text class="section-title">个人店</text>
|
||||
<!-- 绑定点击事件和动态active类 -->
|
||||
<view class="shop-item" :class="{active: selectedShop === 'personal'}" @click="selectShop('personal')">
|
||||
<image class="shop-icon" src="/static/shop.png" mode="widthFix"></image>
|
||||
<view class="shop-info">
|
||||
<text class="shop-name">微店智能店</text>
|
||||
<text class="shop-id">ID:1234567890 | 管理员</text>
|
||||
</view>
|
||||
<uni-icons type="checkbox-filled" size="18" color="#FF9900" v-if="selectedShop === 'personal'"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 企业管理模块 -->
|
||||
<view class="section">
|
||||
<text class="section-title">企业管理</text>
|
||||
<!-- 绑定点击事件和动态active类 -->
|
||||
<view class="shop-item" :class="{active: selectedShop === 'enterprise'}" @click="selectShop('enterprise')">
|
||||
<image class="shop-icon" src="/static/shop.png" mode="widthFix"></image>
|
||||
<view class="shop-info">
|
||||
<text class="shop-name">企业名称</text>
|
||||
<text class="shop-id">总部/管理员</text>
|
||||
</view>
|
||||
<uni-icons type="checkbox-filled" size="18" color="#FF9900" v-if="selectedShop === 'enterprise'"></uni-icons>
|
||||
</view>
|
||||
<view class="create-btn">
|
||||
<uni-icons type="plusempty" size="16"></uni-icons>
|
||||
<text class="create-text">创建企业组织</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部创建店铺按钮 -->
|
||||
<view class="bottom-create-btn">
|
||||
<uni-icons type="plusempty" size="16"></uni-icons>
|
||||
<text class="create-text">创建店铺</text>
|
||||
</view>
|
||||
</uni-drawer>
|
||||
|
||||
<!-- 顶部状态栏 -->
|
||||
<view class="page-wrapper">
|
||||
<view class="function-gridss">
|
||||
|
|
@ -21,7 +73,7 @@
|
|||
|
||||
<!-- 中间:店铺信息和状态 -->
|
||||
<view class="status-center">
|
||||
<view class="store-name" @click="goToUser">{{ storeName }}</view>
|
||||
<view class="store-name" >{{ storeName }}</view>
|
||||
<view class="status-info">
|
||||
<text class="status-text">值守中</text>
|
||||
<view class="status-dot"></view>
|
||||
|
|
@ -56,19 +108,19 @@
|
|||
<!-- 页面内容(第二张图片的布局) -->
|
||||
<view class="stats">
|
||||
<view class="stat-item">
|
||||
<text class="stat-value">202</text>
|
||||
<text class="stat-value">0</text>
|
||||
<text class="stat-label">今日进店</text>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<text class="stat-value">121</text>
|
||||
<text class="stat-value">0</text>
|
||||
<text class="stat-label">支付订单</text>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<text class="stat-value">433.23</text>
|
||||
<text class="stat-value">0</text>
|
||||
<text class="stat-label">支付金额</text>
|
||||
</view>
|
||||
<view class="stat-item">
|
||||
<text class="stat-value"> <uni-icons type="redo-filled" size="30"></uni-icons></text>
|
||||
<text class="stat-value"><uni-icons type="redo-filled" size="30"></uni-icons></text>
|
||||
<text class="stat-label">分享</text>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -244,7 +296,8 @@ export default {
|
|||
return {
|
||||
// 可以在这里添加数据
|
||||
showLeft: false,
|
||||
storeName: '我的便利店' // 门店名称
|
||||
storeName: '我的便利店', // 门店名称
|
||||
selectedShop: 'personal' // 新增:默认选中个人店
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
|
|
@ -255,6 +308,10 @@ export default {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
// 新增:切换选中店铺的方法
|
||||
selectShop(type) {
|
||||
this.selectedShop = type;
|
||||
},
|
||||
navigateTo(page) {
|
||||
uni.showToast({
|
||||
title: `跳转到${page}`,
|
||||
|
|
@ -270,6 +327,11 @@ export default {
|
|||
url: '/pages/user/user'
|
||||
})
|
||||
},
|
||||
goSetting(){
|
||||
uni.navigateTo({
|
||||
url: '/pages/settings/settings'
|
||||
})
|
||||
},
|
||||
goToProduct() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/product/product'
|
||||
|
|
@ -338,6 +400,100 @@ export default {
|
|||
<style lang="scss" scoped>
|
||||
@import "@/static/scss/theme-variables.scss";
|
||||
|
||||
// 新增抽屉样式
|
||||
.drawer-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 20px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
.avatar {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border-radius: 50%;
|
||||
margin-right: 12px;
|
||||
}
|
||||
.name-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.user-name {
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
}
|
||||
.arrow {
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
margin-left: 4px;
|
||||
}
|
||||
.section {
|
||||
padding: 12px 0;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
.section-title {
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
padding: 0 20px 8px;
|
||||
}
|
||||
.shop-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 12px 20px;
|
||||
background: #f8f8f8;
|
||||
cursor: pointer; // 新增:鼠标指针样式
|
||||
transition: all 0.2s; // 新增:过渡动画
|
||||
}
|
||||
.shop-item.active {
|
||||
background: #fff8e8;
|
||||
border-right: 4px solid #ff9900;
|
||||
}
|
||||
// 新增:未选中项hover效果
|
||||
.shop-item:not(.active):hover {
|
||||
background: #f0f0f0;
|
||||
}
|
||||
.shop-icon {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
margin-right: 12px;
|
||||
}
|
||||
.shop-info {
|
||||
flex: 1;
|
||||
}
|
||||
.shop-name {
|
||||
display: block;
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
.shop-id {
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
}
|
||||
.create-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 12px 20px;
|
||||
color: #666;
|
||||
font-size: 14px;
|
||||
}
|
||||
.create-text {
|
||||
margin-left: 6px;
|
||||
}
|
||||
.bottom-create-btn {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 16px 0;
|
||||
border-top: 1px solid #eee;
|
||||
color: #666;
|
||||
font-size: 14px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.one{
|
||||
width: 100%;
|
||||
height: 200rpx;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<view class="logo-content align-center justify-center flex">
|
||||
<image style="width: 100rpx;height: 100rpx;" :src="globalConfig.appInfo.logo" mode="widthFix">
|
||||
</image>
|
||||
<text class="title">若依移动端登录</text>
|
||||
<text class="title">移动端登录</text>
|
||||
</view>
|
||||
<view class="login-form-content">
|
||||
<view class="input-item flex align-center">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,863 @@
|
|||
<template>
|
||||
<view class="container">
|
||||
<!-- 顶部状态栏/时间 -->
|
||||
<view class="status-bar">
|
||||
<text class="time">9:41</text>
|
||||
</view>
|
||||
|
||||
<!-- 搜索栏 -->
|
||||
<view class="search-bar">
|
||||
<view class="search-input">
|
||||
<uni-icons type="search" size="18" color="#999"></uni-icons>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="搜索商品名称、条码"
|
||||
placeholder-class="placeholder"
|
||||
v-model="searchText"
|
||||
@confirm="onSearch"
|
||||
|
||||
<uni-icons type="scan" size="18" color="#999"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 筛选标签 -->
|
||||
<view class="filter-tabs">
|
||||
<scroll-view class="tabs-scroll" scroll-x="true">
|
||||
<view
|
||||
class="tab-item"
|
||||
:class="{ active: currentTab === 'all' }"
|
||||
@tap="switchTab('all')"
|
||||
>
|
||||
全部
|
||||
</view>
|
||||
<view
|
||||
class="tab-item"
|
||||
:class="{ active: currentTab === 'expiring' }"
|
||||
@tap="navigateToExpiredPage"
|
||||
>
|
||||
临期/过期<text class="badge">0</text>
|
||||
</view>
|
||||
<view
|
||||
class="tab-item"
|
||||
:class="{ active: currentTab === 'outstock' }"
|
||||
@tap="switchTab('outstock')"
|
||||
>
|
||||
缺货<text class="badge">0</text>
|
||||
</view>
|
||||
<view class="tab-item filter-btn" @tap="showFilter = !showFilter">
|
||||
<text>筛选</text>
|
||||
<uni-icons type="arrowdown" size="14" color="#666"></uni-icons>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<!-- 库存不足预警设置 -->
|
||||
<view class="store-status">
|
||||
<view class="status-content">
|
||||
<view class="dui">
|
||||
<image class="dui-img" src="http://193.112.94.36:8099/static/images/Mask group (1).png"></image>
|
||||
</view>
|
||||
<view class="status-left">
|
||||
<text class="status-text">库存不足预警设置</text>
|
||||
<text class="status-num">库存低于已设置阈值时,会收到APP推送提醒</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="status-right" @tap="goToSettings">
|
||||
<text class="set-text">设置</text>
|
||||
<uni-icons type="forward" size="14" color="#666"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 商品列表/空状态 -->
|
||||
<scroll-view class="goods-list" scroll-y="true">
|
||||
<view class="empty-state" v-if="goodsList.length === 0">
|
||||
<image class="empty-img" src="/static/empty.png"></image>
|
||||
<text class="empty-text">没有找到相关商品</text>
|
||||
</view>
|
||||
<view class="goods-item" v-for="item in goodsList" :key="item.id">
|
||||
<view class="goods-more-icon" @tap="toggleDeleteMenu(item)">
|
||||
<uni-icons type="more-filled" size="18"></uni-icons>
|
||||
</view>
|
||||
<view class="goods-delete-menu" v-if="item.showDeleteMenu" @tap="showDeleteConfirm(item)">
|
||||
<text class="delete-menu-text">删除商品</text>
|
||||
</view>
|
||||
<view class="goods-top" @tap="goToStockDetail(item)">
|
||||
<view class="goods-tou">
|
||||
<image :src="item.mainImage ? 'http://193.112.94.36:8081' + item.mainImage : '/static/687b6f95b14eff60f4b77147b3726ab2.jpg'"></image>
|
||||
</view>
|
||||
<view class="goods-info">
|
||||
<text class="goods-name">{{ item.productName }}</text>
|
||||
<text class="goods-barcode">{{ item.productBarCode }}</text>
|
||||
<text class="goods-price">¥{{ item.storePrice ? item.storePrice.toFixed(2) : '0.00' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="goods-divider"></view>
|
||||
<view class="goods-stock" >
|
||||
<text class="stock-label">总库存</text>
|
||||
<text class="stock-num">{{ item.stockQuantity }} 件</text>
|
||||
<text class="stock-arrow">></text>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 底部操作按钮 -->
|
||||
<view class="bottom-actions">
|
||||
<view class="action-btn more-btn" @tap="showMoreActions()">
|
||||
<text>更多</text>
|
||||
</view>
|
||||
<button class="action-button primary" @tap="addNewGoods">
|
||||
添加商品/库存
|
||||
</button>
|
||||
<!-- <button class="action-button" @tap="batchOperation">
|
||||
批量操作
|
||||
</button> -->
|
||||
</view>
|
||||
|
||||
<!-- 更多操作弹窗 -->
|
||||
<uni-popup ref="popup" type="bottom">
|
||||
<view class="popup-content">
|
||||
<view class="popup-item" @tap="goToInventoryCount">
|
||||
<uni-icons type="scan" size="20" color="#333"></uni-icons>
|
||||
<text>盘点库存</text>
|
||||
</view>
|
||||
<view class="popup-item" @tap="goToOutbound">
|
||||
<uni-icons type="arrowright" size="20" color="#333"></uni-icons>
|
||||
<text>出库</text>
|
||||
</view>
|
||||
<view class="popup-item" @tap="batchDeleteGoods">
|
||||
<uni-icons type="trash" size="20" color="#333"></uni-icons>
|
||||
<text>批量删除商品</text>
|
||||
</view>
|
||||
<view class="popup-item" @tap="goToCategoryManagement">
|
||||
<uni-icons type="apps" size="20" color="#333"></uni-icons>
|
||||
<text>分类管理</text>
|
||||
</view>
|
||||
<view class="popup-item" @tap="goToBrandManagement">
|
||||
<uni-icons type="navigate" size="20" color="#333"></uni-icons>
|
||||
<text>品牌管理</text>
|
||||
</view>
|
||||
<view class="popup-item" @tap="goToBarcodeSettings">
|
||||
<uni-icons type="settings" size="20" color="#333"></uni-icons>
|
||||
<text>条码规则设置</text>
|
||||
</view>
|
||||
<view class="popup-item cancel" @tap="$refs.popup.close()">
|
||||
<text>取消</text>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
|
||||
<!-- 更多操作弹窗 -->
|
||||
<!-- <uni-popup ref="popup" type="bottom">
|
||||
<view class="popup-content">
|
||||
<view class="popup-item" @tap="editGoods(selectedGoods)">
|
||||
<uni-icons type="compose" size="20" color="#333"></uni-icons>
|
||||
<text>编辑商品</text>
|
||||
</view>
|
||||
<view class="popup-item" @tap="adjustStock(selectedGoods)">
|
||||
<uni-icons type="plus" size="20" color="#333"></uni-icons>
|
||||
<text>调整库存</text>
|
||||
</view>
|
||||
<view class="popup-item" @tap="deleteGoods(selectedGoods)">
|
||||
<uni-icons type="trash" size="20" color="#ff4444"></uni-icons>
|
||||
<text style="color: #ff4444;">删除商品</text>
|
||||
</view>
|
||||
<view class="popup-item cancel" @tap="$refs.popup.close()">
|
||||
<text>取消</text>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getProductList as fetchProductList, deleteProduct } from '@/api/product'
|
||||
import { getToken, getStoreId } from '@/utils/auth'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
currentTab: 'expiring',
|
||||
searchText: '',
|
||||
showFilter: false,
|
||||
selectedGoods: null,
|
||||
storeId: null, // 门店ID
|
||||
goodsList: []
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
// 获取门店ID
|
||||
const storeId = getStoreId();
|
||||
if (storeId) {
|
||||
this.storeId = storeId;
|
||||
console.log('当前门店ID:', storeId);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '请先选择门店',
|
||||
icon: 'none'
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 1500);
|
||||
return;
|
||||
}
|
||||
|
||||
// 处理tab参数
|
||||
if (options && options.tab) {
|
||||
this.currentTab = options.tab;
|
||||
}
|
||||
|
||||
this.getProductList();
|
||||
},
|
||||
onShow() {
|
||||
this.getProductList();
|
||||
},
|
||||
methods: {
|
||||
async getProductList(searchParams = {}) {
|
||||
try {
|
||||
const token = getToken();
|
||||
console.log('当前Token:', token);
|
||||
console.log('Token是否存在:', !!token);
|
||||
console.log('查询参数:', searchParams);
|
||||
|
||||
// 添加门店ID参数
|
||||
if (this.storeId) {
|
||||
searchParams.storeId = this.storeId;
|
||||
}
|
||||
|
||||
// 如果是缺货标签,调用缺货商品接口
|
||||
if (this.currentTab === 'outstock') {
|
||||
// 这里应该调用缺货商品接口,传参stockQuantity=0
|
||||
// 暂时使用原接口,后续需要替换为正确的接口
|
||||
searchParams.stockQuantity = 0;
|
||||
}
|
||||
|
||||
const res = await fetchProductList(searchParams);
|
||||
|
||||
console.log('商品列表接口返回:', res);
|
||||
|
||||
|
||||
if (res && res.code === 200 && res.data) {
|
||||
this.goodsList = res.data.map(item => ({
|
||||
...item,
|
||||
showDeleteMenu: false
|
||||
}));
|
||||
console.log('处理后的商品列表:', this.goodsList);
|
||||
} else {
|
||||
this.goodsList = [];
|
||||
uni.showToast({
|
||||
title: res?.msg || '获取商品列表失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
this.goodsList = [];
|
||||
console.error('获取商品列表失败:', error);
|
||||
console.error('错误详情:', JSON.stringify(error));
|
||||
uni.showToast({
|
||||
title: '网络请求失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
switchTab(tab) {
|
||||
if (tab === 'all') {
|
||||
// 跳转到商品列表页面,并传递当前标签
|
||||
uni.navigateTo({
|
||||
url: `/pages/product/product?tab=${tab}`
|
||||
});
|
||||
} else if (tab === 'outstock') {
|
||||
// 跳转到缺货页面
|
||||
uni.navigateTo({
|
||||
url: `/pages/navailable/navailable?tab=${tab}`
|
||||
});
|
||||
} else {
|
||||
this.currentTab = tab;
|
||||
// 这里可以添加筛选逻辑
|
||||
console.log('切换到标签:', tab);
|
||||
}
|
||||
},
|
||||
// 缺货页面批量删除商品
|
||||
batchDeleteGoods() {
|
||||
this.$refs.popup.close();
|
||||
uni.navigateTo({
|
||||
// url: '/pages/batchDeleteProduct/batchDeleteProduct'
|
||||
});
|
||||
},
|
||||
|
||||
onSearch() {
|
||||
console.log('搜索关键词:', this.searchText);
|
||||
|
||||
if (!this.searchText || this.searchText.trim() === '') {
|
||||
this.getProductList();
|
||||
return;
|
||||
}
|
||||
|
||||
const searchText = this.searchText.trim();
|
||||
let searchParams = {};
|
||||
|
||||
if (/^\d+$/.test(searchText)) {
|
||||
searchParams = { productBarCode: searchText };
|
||||
console.log('按条形码精准查询:', searchParams);
|
||||
} else {
|
||||
searchParams = { productName: searchText };
|
||||
console.log('商品名称模糊查询:', searchParams);
|
||||
}
|
||||
|
||||
this.getProductList(searchParams);
|
||||
},
|
||||
|
||||
goToAlertSettings() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/alertSettings/index'
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
showMoreActions() {
|
||||
this.$refs.popup.open();
|
||||
},
|
||||
|
||||
goToStockTake() {
|
||||
this.$refs.moreMenu.close();
|
||||
uni.navigateTo({
|
||||
url: '/pages/stockTake/index'
|
||||
});
|
||||
},
|
||||
|
||||
goToOutbound() {
|
||||
this.$refs.moreMenu.close();
|
||||
uni.navigateTo({
|
||||
url: '/pages/outbound/index'
|
||||
});
|
||||
},
|
||||
|
||||
batchDelete() {
|
||||
this.$refs.moreMenu.close();
|
||||
uni.showModal({
|
||||
title: '批量删除',
|
||||
content: '确定要批量删除商品吗?',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
// 执行批量删除操作
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
goToCategory() {
|
||||
this.$refs.moreMenu.close();
|
||||
uni.navigateTo({
|
||||
url: '/pages/category/index'
|
||||
});
|
||||
},
|
||||
|
||||
goToBrand() {
|
||||
this.$refs.moreMenu.close();
|
||||
uni.navigateTo({
|
||||
url: '/pages/brand/index'
|
||||
});
|
||||
},
|
||||
|
||||
goToBarcodeRule() {
|
||||
this.$refs.moreMenu.close();
|
||||
uni.navigateTo({
|
||||
url: '/pages/barcodeRule/index'
|
||||
});
|
||||
},
|
||||
|
||||
goToStockDetail(item) {
|
||||
// 跳转到编辑页面,传递商品ID
|
||||
uni.navigateTo({
|
||||
url: `/pages/edit/edit?id=${item.id}`
|
||||
});
|
||||
},
|
||||
|
||||
toggleDeleteMenu(item) {
|
||||
item.showDeleteMenu = !item.showDeleteMenu;
|
||||
},
|
||||
|
||||
showDeleteConfirm(item) {
|
||||
uni.showModal({
|
||||
title: '确认删除',
|
||||
content: `确定要删除商品"${item.productName}"吗?`,
|
||||
success: async (res) => {
|
||||
if (res.confirm) {
|
||||
try {
|
||||
const result = await deleteProduct(item.id);
|
||||
console.log('删除商品结果:', result);
|
||||
|
||||
if (result && result.code === 200) {
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success'
|
||||
});
|
||||
// 重新加载商品列表
|
||||
this.getProductList();
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: result?.msg || '删除失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('删除商品失败:', error);
|
||||
uni.showToast({
|
||||
title: '删除失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
addNewGoods() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/enter/enter'
|
||||
});
|
||||
},
|
||||
|
||||
// 临期/过期商品页面,不需要跳转
|
||||
navigateToExpiredPage() {
|
||||
uni.navigateTo({
|
||||
url: '/pages/expired/expired'
|
||||
});
|
||||
},
|
||||
|
||||
editGoods(goods) {
|
||||
this.$refs.popup.close();
|
||||
uni.navigateTo({
|
||||
url: `/pages/goods/edit?id=${goods.id}`
|
||||
});
|
||||
},
|
||||
|
||||
adjustStock(goods) {
|
||||
this.$refs.popup.close();
|
||||
uni.showModal({
|
||||
title: '调整库存',
|
||||
content: `调整 ${goods.productName} 的库存数量`,
|
||||
editable: true,
|
||||
placeholderText: '请输入调整数量',
|
||||
success: (res) => {
|
||||
if (res.confirm && res.content) {
|
||||
console.log('调整库存数量:', res.content);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
deleteGoods(goods) {
|
||||
this.$refs.popup.close();
|
||||
uni.showModal({
|
||||
title: '确认删除',
|
||||
content: `确定要删除商品"${goods.productName}"吗?`,
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
console.log('删除商品:', goods);
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success'
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.container {
|
||||
background-color: #f5f5f5;
|
||||
min-height: 100vh;
|
||||
}
|
||||
.goods-tou{
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
margin-right: 16rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.dui-img {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
}
|
||||
.goods-tou image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
/* 状态栏 */
|
||||
.status-bar {
|
||||
padding: 10px 16px;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.time {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
}
|
||||
/* 搜索栏 */
|
||||
.search-bar {
|
||||
padding: 12px 16px;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.search-input {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #f5f5f5;
|
||||
border-radius: 8px;
|
||||
padding: 10px 12px;
|
||||
}
|
||||
|
||||
.search-input input {
|
||||
flex: 1;
|
||||
margin-left: 8px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.placeholder {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
/* 筛选标签 */
|
||||
.filter-tabs {
|
||||
background-color: #fff;
|
||||
padding: 12px 16px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.tabs-scroll {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.tab-item {
|
||||
display: inline-block;
|
||||
padding: 6px 12px;
|
||||
margin-right: 10px;
|
||||
border-radius: 16px;
|
||||
font-size: 14px;
|
||||
background-color: #f5f5f5;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.tab-item.active {
|
||||
background-color: #e8f4ff;
|
||||
color: #007aff;
|
||||
}
|
||||
|
||||
.badge {
|
||||
margin-left: 4px;
|
||||
color: #ff4444;
|
||||
}
|
||||
|
||||
.filter-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* 库存不足预警栏 */
|
||||
.alert-bar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
background-color: #E8F4FF;
|
||||
padding: 12px 16px;
|
||||
margin: 8px 16px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.alert-left {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.alert-text-group {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.alert-text {
|
||||
display: block;
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.alert-desc {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.alert-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.setting-text {
|
||||
font-size: 14px;
|
||||
color: #007AFF;
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
/* 商品列表 */
|
||||
.goods-list {
|
||||
height: calc(100vh - 320px);
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
/* 空状态 */
|
||||
.empty-state {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.empty-img {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.goods-item {
|
||||
background-color: #fff;
|
||||
border-radius: 8px;
|
||||
padding: 16px;
|
||||
margin-bottom: 12px;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.goods-more-icon {
|
||||
position: absolute;
|
||||
top: 12px;
|
||||
right: 12px;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.goods-delete-menu {
|
||||
position: absolute;
|
||||
top: 40px;
|
||||
right: 12px;
|
||||
background-color: #fff;
|
||||
border-radius: 8rpx;
|
||||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.15);
|
||||
padding: 12rpx 24rpx;
|
||||
z-index: 9;
|
||||
}
|
||||
|
||||
.delete-menu-text {
|
||||
font-size: 28rpx;
|
||||
color: #ff4444;
|
||||
}
|
||||
|
||||
.goods-top {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.goods-info {
|
||||
flex: 1;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.goods-name {
|
||||
display: block;
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.goods-barcode {
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.goods-price {
|
||||
font-size: 18px;
|
||||
color: #ff4444;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.goods-divider {
|
||||
height: 1px;
|
||||
border-bottom: 1px dashed #e0e0e0;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.goods-stock {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 8px 0;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.stock-arrow {
|
||||
font-size: 20px;
|
||||
color: #999;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.stock-label {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.stock-num {
|
||||
font-size: 16px;
|
||||
color: #333;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* 底部操作按钮 */
|
||||
.bottom-actions {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
display: flex;
|
||||
padding: 16px;
|
||||
background-color: #fff;
|
||||
border-top: 1px solid #eee;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
padding: 8px 16px;
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.more-btn {
|
||||
background-color: #f5f5f5;
|
||||
color: #666;
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.action-button {
|
||||
flex: 1;
|
||||
margin: 0 8px;
|
||||
padding: 12px;
|
||||
border-radius: 8px;
|
||||
font-size: 16px;
|
||||
background-color: #f5f5f5;
|
||||
color: #333;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.action-button.primary {
|
||||
background-color: #007aff;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* 左侧菜单样式 */
|
||||
.menu-content {
|
||||
background-color: #fff;
|
||||
height: 100vh;
|
||||
width: 280rpx;
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
|
||||
.menu-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 20rpx 30rpx;
|
||||
font-size: 14px;
|
||||
border-bottom: 1px solid #f5f5f5;
|
||||
}
|
||||
|
||||
.menu-item text {
|
||||
margin-left: 12rpx;
|
||||
}
|
||||
|
||||
/* 弹窗样式 */
|
||||
.popup-content {
|
||||
background-color: #fff;
|
||||
border-radius: 16px 16px 0 0;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.popup-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 16px 0;
|
||||
border-bottom: 1px solid #f5f5f5;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.popup-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.popup-item text {
|
||||
margin-left: 12px;
|
||||
}
|
||||
|
||||
.popup-item.cancel {
|
||||
justify-content: center;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
/* 微店状态栏 */
|
||||
.store-status {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 12px 16px;
|
||||
background-color: #fff;
|
||||
border-radius: 20rpx;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.status-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.dui {
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
.dui-img {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
}
|
||||
.status-left {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-left: 0;
|
||||
}
|
||||
.status-text {
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
}
|
||||
.status-num {
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
margin-top: 4px;
|
||||
}
|
||||
.status-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 1rpx;
|
||||
}
|
||||
.set-text {
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
margin-right: 4px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -71,6 +71,11 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="logout-module">
|
||||
<view class="logout-btn" @click="handleLogout">
|
||||
<text class="logout-text">退出登录</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
|
@ -100,7 +105,14 @@ export default {
|
|||
// break;
|
||||
// // ... 其他页面跳转
|
||||
// }
|
||||
}
|
||||
},
|
||||
handleLogout() {
|
||||
this.$modal.confirm('确定注销并退出系统吗?').then(() => {
|
||||
this.$store.dispatch('LogOut').then(() => {}).finally(()=>{
|
||||
this.$tab.reLaunch('/pages/index')
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -122,7 +134,26 @@ export default {
|
|||
color: #333333;
|
||||
}
|
||||
}
|
||||
.logout-text {
|
||||
font-size: 34rpx;
|
||||
color: red;
|
||||
}
|
||||
.logout-btn {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
background-color: #ffffff;
|
||||
border-radius: 12rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* ========== 退出登录模块 ========== */
|
||||
.logout-module {
|
||||
margin-top: 40rpx;
|
||||
padding: 0 40rpx;
|
||||
}
|
||||
.settings-section {
|
||||
margin-top: 30rpx;
|
||||
background-color: #ffffff;
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@
|
|||
|
||||
<!-- 退出登录模块 -->
|
||||
<view class="logout-module">
|
||||
<view class="logout-btn" @tap="handleLogout">
|
||||
<view class="logout-btn" @click="handleLogout">
|
||||
<text class="logout-text">退出登录</text>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -138,6 +138,13 @@
|
|||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
handleLogout() {
|
||||
this.$modal.confirm('确定注销并退出系统吗?').then(() => {
|
||||
this.$store.dispatch('LogOut').then(() => {}).finally(()=>{
|
||||
this.$tab.reLaunch('/pages/index')
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,12 +68,12 @@ const user = {
|
|||
return new Promise((resolve, reject) => {
|
||||
getInfo().then(res => {
|
||||
const user = res.user
|
||||
let avatar = user.avatar || ""
|
||||
if (!isHttp(avatar)) {
|
||||
let avatar = (isEmpty(user) || isEmpty(user.avatar)) ? "" : user.avatar
|
||||
if (!isHttp(avatar)) {
|
||||
avatar = (isEmpty(avatar)) ? defAva : baseUrl + avatar
|
||||
}
|
||||
const userid = (isEmpty(user) || isEmpty(user.userId)) ? "" : user.userId
|
||||
const username = (isEmpty(user) || isEmpty(user.userName)) ? "" : user.userName
|
||||
const username = (isEmpty(user) || isEmpty(user.userName)) ? "" : user.userName
|
||||
if (res.roles && res.roles.length > 0) {
|
||||
commit('SET_ROLES', res.roles)
|
||||
commit('SET_PERMISSIONS', res.permissions)
|
||||
|
|
|
|||
Loading…
Reference in New Issue