平板端快衣店
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.
 
 
 
 
 

592 lines
14 KiB

<!-- 库存列表页 -->
<template>
<view style="display: flex;flex-direction: column;" :style="{height: windowHeight + 'px'}">
<view class="" style="display: flex;border-top: 1px solid #eee;border-bottom: 1px solid #eee;">
<view class="title-left">
<view class="title-left-box" style="color:blue;text-decoration: underline;" @tap="goWarnList">
<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;width: 66%;">
<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" style="width: 34%;">
<text>{{type ==0?warnMsg.stockCost:'0'}}</text>
<text>库存成本</text>
</view>
</view>
<view class="title-right">
<view class="title-right-top title-btn" @tap.stop="onGridClick('1')">
新增入库
</view>
<view class="title-right-bottom title-btn" @tap.stop="onGridClick('3')">
更多
</view>
</view>
</view>
<view class="search">
<uni-search-bar class="uni-mt-10" radius="5" placeholder="商品名称/货号/供应商" cancelButton="none" @confirm="search" @blur="search" @clear="clearSearch" />
</view>
<view class="content-box">
<view class="content-left">
<view v-if="gateType == ''" class="left-box" v-for="(item, index) in indexList" :key="index"
: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,index) in shopList" :key="index" @tap="goDetail(item)">
<view class="box-left">
<img :src="item.productPicture" class="img-radius" alt="" v-if="item.productPicture">
<view class="noPic" v-else>暂无图片</view>
</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 style="color: red;">{{item.inStorageStatus==0?'待入库':item.purchasePrice==null?'新商品':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 class="right-box" v-for="(item,index) in shopList1" :key="index" @tap="goDetail(item)">
<view class="box-left">
<img :src="item.productPicture" class="img-radius" alt="" v-if="item.productPicture">
<view class="noPic" v-else>暂无图片</view>
</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 style="color: red;">{{item.inStorageStatus==0?'待入库':item.purchasePrice==null?'新商品':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>
<!-- 新增入库弹出层 -->
<uni-popup ref="popup" background-color="#fff">
<view style="height:340rpx;">
<view @tap="addInventory('0')" class="popup-photo">AI入库</view>
<view @tap="addInventory('1')" class="popup-photo">扫码入库</view>
<view @tap="$refs.popup.close()" class="popup-photo" style="border-bottom:0;border-top:10px solid #eee;">取消</view>
</view>
</uni-popup>
<!-- 弹出输入框 -->
<uni-popup ref="payDialog" background-color="#fff">
<view class="popup-pay-content">
<view class="popup-pay-title">
<text>请选择</text>
</view>
<view class="popup-pay-container" @tap="onGridClick('0')">
<text style="display: inline-block">分类管理</text>
</view>
<view class="popup-pay-container" @tap="onGridClick('2')">
<text style="display: inline-block">新增商品</text>
</view>
<view class="popup-pay-container" @tap="onGridClick('4')">
<text style="display: inline-block">批量打印商品码</text>
</view>
</view>
</uni-popup>
</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:'',
categoryIndex:0,
windowHeight:0,
shopList1:[],
gateType:''
}
},
onLoad(){
let that = this
uni.getSystemInfo({
success: function (info) {
console.log(info.windowHeight)
that.windowHeight = info.windowHeight
}
});
},
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 == this.categoryIndex) {
this.indexList[i].parentId = true
} else {
this.indexList[i].parentId = false
}
}
this.categoryId = this.indexList[this.categoryIndex].id
this.getShareList();
} 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) {
this.categoryIndex = 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()
},
//入库单详情
goDetail(item) {
uni.navigateTo({
url: '/pages/inventory/inventoryDetail?item=' + JSON.stringify(item)
})
},
goWarnList(){
uni.navigateTo({
url: '/package1/inventory/inventoryWarn'
})
},
//点击分类获取商品列表
getShareList(type) {
let data = {}
if(type=='search'){
this.gateType = 'search'
data = {
categoryId: "",
searchStr: this.searchName,
pageNum: this.pageNum,
pageSize: '100'
}
}else{
this.gateType = ''
data = {
categoryId: this.categoryId,
searchStr: this.searchName,
pageNum: this.pageNum,
pageSize: '100'
}
}
this.tui.request("/app/product/getShareList", "POST", data, false, false).then((res) => {
if (res.code == 200) {
if(type=='search'){
this.shopList = []
this.shopList1 = res.result.records
}else{
this.shopList1 = []
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()
}).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()
}).catch((res) => {})
}
}
}
})
},
//搜索接口
search(e){
if(e.value == ''){
this.searchName = ""
this.getShareList()
}else{
this.searchName = e.value
this.getShareList('search')
}
},
//清空搜索条件
clearSearch(){
this.searchName = ''
this.getShareList()
},
addInventory(type){
if(type=='0'){
uni.navigateTo({
url: '/package1/AI/AIInventoryList'
})
}else{
uni.navigateTo({
url: '/pages/inventory/addinventory'
})
}
this.$refs.popup.close()
},
//点击头部 更多 和 新增入库 按钮
onGridClick(target) {
if (target == '0') {
uni.navigateTo({
url: '/package1/inventory/gategory'
})
this.$refs.payDialog.close()
} else if (target == '1') {
this.$refs.popup.open('bottom')
} else if (target == '2') {
uni.navigateTo({
url: "/package1/inventory/addGoods"
})
this.$refs.payDialog.close()
}else if(target == '3'){
this.$refs.payDialog.open('center')
}else{
uni.navigateTo({
url: "/package1/inventory/batchPrint"
})
this.$refs.payDialog.close()
}
}
}
}
</script>
<style lang="scss">
.search {
background-color: #fff;
width: 100%;
background-color: #fff;
}
.title-left {
width: 70%;
display: flex;
flex-wrap: wrap;
float: left;
}
.title-right {
width: 30%;
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;
overflow: scroll;
}
.content-left {
width: 170rpx;
background: #eee;
height: 100%;
overflow: scroll;
}
.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: 100% !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;
}
.noPic{
border-radius: 10px;
width: 140rpx;
height: 140rpx;
// margin: 30rpx 0 0 30rpx;
text-align: center;
line-height: 140rpx;
color: #777;
background: #eee;
}
.popup-pay-content {
align-items: center;
justify-content: center;
padding: 15px;
width: 500rpx;
height: auto;
background-color: #fff;
}
.popup-pay-title {
font-size: 36rpx;
font-weight: bold;
text-align: center;
position: relative;
}
.popup-pay-container {
margin-top: 20rpx;
height: 100rpx;
border-radius: 10px;
background: #088FEB;
line-height: 100rpx;
text-align: center;
border-bottom: 1px solid #eee;
border-top: 1px solid #eee;
color: #fff;
}
.popup-photo{
height: 110rpx;
line-height: 110rpx;
text-align: center;
font-size: 36rpx;
font-weight: 800;
border-bottom: 1px solid #eee;
}
.vue-ref{
padding-bottom:0 !important;
}
</style>