You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
431 lines
10 KiB
431 lines
10 KiB
<!-- 库存列表页 -->
|
|
<template>
|
|
<view style="display: flex;flex-direction: column;height: 1280rpx;">
|
|
<view class="" style="display: flex;border-top: 1px solid #eee;border-bottom: 1px solid #eee;">
|
|
<view class="title-left">
|
|
<view class="title-left-box">
|
|
<text>{{warnMsg.tailWarnCount}}</text>
|
|
<text>库存预警</text>
|
|
</view>
|
|
<view class="title-left-box">
|
|
<text>{{warnMsg.salesWeekCount}}</text>
|
|
<text>尾货预警</text>
|
|
</view>
|
|
<view class="title-left-box" style="flex-direction: inherit;">
|
|
<view class="shop-box">
|
|
<view>{{warnMsg.productCount}}</view>
|
|
<view>商品数</view>
|
|
</view>
|
|
<view class="shop-box">
|
|
<view>{{warnMsg.stockCount}}</view>
|
|
<view>库存数</view>
|
|
</view>
|
|
</view>
|
|
<view class="title-left-box">
|
|
<text>¥{{type ==0?warnMsg.stockCost:'0'}}</text>
|
|
<text>库存成本</text>
|
|
</view>
|
|
|
|
</view>
|
|
<view class="title-right" @tap.stop="onGridClick('0')">
|
|
<view class="title-right-top title-btn">
|
|
分类管理
|
|
</view>
|
|
<view class="title-right-bottom title-btn" @tap.stop="onGridClick('2')">
|
|
新增商品
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="search">
|
|
<uni-search-bar class="uni-mt-10" radius="5" placeholder="商品名称/货号/供应商" cancelButton="none" @confirm="search" />
|
|
<view class="title-right-bottom title-btn"
|
|
style="width:22%;float: left;height:75rpx;line-height: 75rpx;margin-top:5px;"
|
|
@tap.stop="onGridClick('1')">
|
|
新增入库
|
|
</view>
|
|
</view>
|
|
<view class="content-box">
|
|
<view class="content-left">
|
|
<view class="left-box" v-for="(item, index) in indexList" :key="item"
|
|
:class="item.parentId ? 'left-box-hover':''" @tap="clickLeftBtn(index)">
|
|
<text style="width: 100%;height: 90rpx;line-height: 90rpx;display: inline-block;overflow: hidden;" :class="item.parentId ? 'red' :''">{{item.categoryName}}</text>
|
|
</view>
|
|
</view>
|
|
<view class="content-right">
|
|
<view class="right-box" v-for="item in shopList" :key="item" @tap="goDetail(item)">
|
|
<view class="box-left">
|
|
<img :src="item.productPicture" alt="">
|
|
</view>
|
|
<view class="box-right">
|
|
<view class="box-right-name">{{item.productName}}</view>
|
|
<view class="box-right-num">{{item.productSn}}</view>
|
|
<!-- 1上架 0下架 -->
|
|
<view class="up-down" v-if="item.delFlag ==1" @tap.stop="upDown('0',item)">下架</view>
|
|
<view class="up-down" v-if="item.delFlag ==0" @tap.stop="upDown('1',item)">上架</view>
|
|
<view class="box-right-price">
|
|
<view class="price-box" v-if='type==0'>
|
|
<text v-if="item.purchasePrice==null" style="color: red;">新商品</text>
|
|
<text v-else>{{item.purchasePrice}}</text>
|
|
<text>采购价</text>
|
|
</view>
|
|
<view class="price-box">
|
|
<text>{{item.wholesalePrice}}</text>
|
|
<text>批发价</text>
|
|
</view>
|
|
<view class="price-box">
|
|
<text>{{item.price}}</text>
|
|
<text>零售价</text>
|
|
</view>
|
|
<view class="price-box">
|
|
<text>{{item.stockCount}}</text>
|
|
<text>库存</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
mapState
|
|
} from 'vuex';
|
|
export default {
|
|
computed: mapState(['shopIndex', 'region']),
|
|
data() {
|
|
return {
|
|
size: 30,
|
|
indexList: [],
|
|
pageNum: 1, //分页的页码
|
|
shopList: [],
|
|
categoryId: '', //分类id
|
|
shopId: '', //店铺id,
|
|
type:'',
|
|
warnMsg:[],
|
|
searchName:''
|
|
}
|
|
},
|
|
onShow() {
|
|
console.log('onshow');
|
|
this.getGategoryList()
|
|
this.getWarnMsg()
|
|
this.type=uni.getStorageSync('type')
|
|
},
|
|
methods: {
|
|
//初始化获取分类列表
|
|
getGategoryList() {
|
|
this.tui.request("/app/productCategory/list", "get", {
|
|
// shopId: 1,
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
this.indexList = res.result;
|
|
for (var i = 0; i < this.indexList.length; i++) {
|
|
if (i == 0) {
|
|
this.indexList[i].parentId = true
|
|
} else {
|
|
this.indexList[i].parentId = false
|
|
}
|
|
}
|
|
this.categoryId = this.indexList[0].id
|
|
this.getShareList(this.indexList[0].id);
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
},
|
|
//获取库存预警信息
|
|
getWarnMsg(){
|
|
this.tui.request("/app/stock/getShopStock", "POST", {}, false, false).then((res) => {
|
|
if (res.code == 200) {
|
|
this.warnMsg = res.result
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
},
|
|
//点击左侧菜单切换
|
|
clickLeftBtn(index) {
|
|
for (var i = 0; i < this.indexList.length; i++) {
|
|
if (i == index) {
|
|
this.indexList[i].parentId = true
|
|
} else {
|
|
this.indexList[i].parentId = false
|
|
}
|
|
}
|
|
this.categoryId = this.indexList[index].id
|
|
this.getShareList(this.indexList[index].id)
|
|
},
|
|
//入库单详情
|
|
goDetail(item) {
|
|
uni.navigateTo({
|
|
url: '/pages/inventory/inventoryDetail?item=' + JSON.stringify(item)
|
|
})
|
|
},
|
|
//点击分类获取商品列表
|
|
getShareList(id) {
|
|
this.tui.request("/app/product/getShareList", "POST", {
|
|
categoryId: this.categoryId,
|
|
supplierName: this.searchName,
|
|
pageNum: this.pageNum,
|
|
pageSize: '10'
|
|
}, false, false).then((res) => {
|
|
if (res.code == 200) {
|
|
console.log(res.result.records)
|
|
this.shopList = res.result.records
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
},
|
|
//商品上下架
|
|
upDown(type, data) {
|
|
let that = this,
|
|
title = "确定将此款商品" + (type == 0 ? "下架" : "上架") + "吗?"
|
|
uni.showModal({
|
|
title: "提示",
|
|
content: title,
|
|
success: function(res) {
|
|
if(res.confirm){
|
|
if (type == 0) { //下架
|
|
that.tui.request("/app/product/down", "POST", {
|
|
id: data.id
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
that.tui.toast("下架成功")
|
|
} else {
|
|
that.tui.toast(res.message)
|
|
}
|
|
this.categoryId = data.categoryId
|
|
that.getShareList(data.categoryId)
|
|
}).catch((res) => {})
|
|
} else { //上架
|
|
that.tui.request("/app/product/up", "POST", {
|
|
id: data.id
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
that.tui.toast("上架成功")
|
|
} else {
|
|
that.tui.toast(res.message)
|
|
}
|
|
this.categoryId = data.categoryId
|
|
that.getShareList(data.categoryId)
|
|
}).catch((res) => {})
|
|
}
|
|
}
|
|
}
|
|
})
|
|
},
|
|
//搜索接口
|
|
search(e){
|
|
this.searchName = e.value
|
|
this.getShareList()
|
|
},
|
|
//点击头部 分类管理 和 新增入库 按钮
|
|
onGridClick(target) {
|
|
if (target == '0') {
|
|
uni.navigateTo({
|
|
url: '/pages/inventory/gategory'
|
|
})
|
|
} else if (target == '1') {
|
|
uni.navigateTo({
|
|
url: '/pages/inventory/addinventory'
|
|
})
|
|
} else {
|
|
uni.navigateTo({
|
|
url: "/pages/inventory/addGoods"
|
|
})
|
|
}
|
|
}
|
|
},
|
|
onReachBottom: function() {}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.search {
|
|
// padding: 20upx;
|
|
background-color: #fff;
|
|
// position: fixed;
|
|
// top: 0;
|
|
// z-index: 100;
|
|
width: 100%;
|
|
background-color: #fff;
|
|
}
|
|
|
|
.title-left {
|
|
width: 70%;
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
float: left;
|
|
}
|
|
|
|
.title-right {
|
|
width: 30%;
|
|
/* margin-top: 110rpx; */
|
|
border-left: 1px solid #eee;
|
|
background: #fff;
|
|
}
|
|
|
|
.title-left-box {
|
|
display: flex;
|
|
flex-direction: column;
|
|
text-align: center;
|
|
width: 50%;
|
|
height: 100rpx;
|
|
padding-top: 20rpx;
|
|
|
|
.shop-box {}
|
|
}
|
|
|
|
// 偶数行
|
|
.title-left-box:nth-child(even) {
|
|
border-left: 1px solid #fff;
|
|
background: #fff;
|
|
}
|
|
|
|
//奇数行
|
|
.title-left-box:nth-child(odd) {
|
|
border-right: 1px solid #fff;
|
|
background: #fff;
|
|
}
|
|
|
|
.title-btn {
|
|
width: 70%;
|
|
height: 80rpx;
|
|
color: #fff;
|
|
border-radius: 10px;
|
|
text-align: center;
|
|
line-height: 80rpx;
|
|
margin: 10rpx auto 10rpx;
|
|
|
|
}
|
|
|
|
.shop-box {
|
|
width: 50%;
|
|
}
|
|
|
|
.title-right-top {
|
|
background: linear-gradient(90deg, #FF9797, #FFC1E0);
|
|
margin-top: 10px;
|
|
}
|
|
|
|
.title-right-bottom {
|
|
background: linear-gradient(90deg, #60F3FF, #088FEB);
|
|
}
|
|
|
|
.content-box {
|
|
background: #fff;
|
|
flex: 1;
|
|
display: flex;
|
|
}
|
|
|
|
.content-left {
|
|
width: 170rpx;
|
|
background: #eee;
|
|
height: 100%;
|
|
}
|
|
|
|
.left-box {
|
|
width: 100%;
|
|
height: 90rpx;
|
|
font-size: 30rpx;
|
|
text-align: center;
|
|
line-height: 90rpx;
|
|
border-bottom: 1px solid #fff;
|
|
}
|
|
|
|
.left-box-hover {
|
|
width: 100%;
|
|
height: 90rpx;
|
|
font-size: 30rpx;
|
|
text-align: center;
|
|
line-height: 90rpx;
|
|
border-bottom: 1px solid #fff;
|
|
background-color: #fff;
|
|
}
|
|
|
|
.red {
|
|
border-right: 3px solid red;
|
|
}
|
|
|
|
.content-right {
|
|
width: 550rpx;
|
|
overflow-y: scroll;
|
|
}
|
|
|
|
.right-box {
|
|
width: 100%;
|
|
height: 190rpx;
|
|
display: flex;
|
|
border-bottom: 1px solid #eee;
|
|
position: relative;
|
|
}
|
|
|
|
.box-left {
|
|
width: 130rpx;
|
|
height: 131rpx;
|
|
background-size: 100%;
|
|
margin: 25rpx 30rpx 35rpx 10rpx;
|
|
border-radius: 20rpx;
|
|
}
|
|
|
|
.box-left img {
|
|
width: 100%;
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
.box-right {
|
|
margin-top: 17rpx;
|
|
}
|
|
|
|
.box-right-name {
|
|
font-size: 30rpx;
|
|
font-weight: bold;
|
|
}
|
|
|
|
.box-right-num {
|
|
padding: 5rpx 0;
|
|
color: #777;
|
|
}
|
|
|
|
.box-right-price {
|
|
display: flex;
|
|
font-size: 25rpx;
|
|
}
|
|
|
|
.price-box {
|
|
display: flex;
|
|
flex-direction: column;
|
|
margin-right: 20rpx;
|
|
}
|
|
|
|
.price-box text:first-child {
|
|
color: #ffa200
|
|
}
|
|
|
|
.uni-mt-10 {
|
|
position: relative;
|
|
width: 74% !important;
|
|
float: left !important;
|
|
}
|
|
|
|
.uni-searchbar,
|
|
.uni-searchbar__box {
|
|
width: 100% !important;
|
|
padding: 5px 10px !important
|
|
}
|
|
|
|
.up-down {
|
|
position: absolute;
|
|
top: 20rpx;
|
|
right: 10rpx;
|
|
color: #fff;
|
|
background: #088FEB;
|
|
padding: 10rpx 10rpx;
|
|
border-radius: 10px;
|
|
}
|
|
</style>
|