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

851 lines
22 KiB

<!-- 库存列表页 -->
<template>
<view>
<view class="" style="width: 100%;display: flex;border-top: 1px solid #eee;border-bottom: 1px solid #eee;position: fixed;background: #fff;top: 0;z-index: 99;">
<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="color:blue;text-decoration: underline;" @tap="goRuku">
<text>{{total}}</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" @tap="clickModel('num')">
<view>{{warnMsg.stockCount}}</view>
<view>
库存数
<uni-icons type="help" size="15"></uni-icons>
</view>
</view>
</view>
<view class="title-left-box" style="width: 34%;" @tap="clickModel">
<text>{{type ==0?warnMsg.stockCost:'0'}}</text>
<view>
库存成本
<uni-icons type="help" size="15"></uni-icons>
</view>
</view>
</view>
<view class="title-right">
<view class="title-right-top title-btn" @tap.stop="onGridClick('2')">
新增商品
</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" @blur="search" @clear="clearSearch" />
</view>
<view class="content-left" style="height: 78%;float: left;position: fixed;top: 23%;">
<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" style="width: 570rpx;background: #fff;margin-left:170rpx;margin-top: 300rpx;">
<view style="display: flex;height: 60rpx;line-height: 60rpx;background: #C6E2FF;color: #777;text-align: center;">
<view style="width: 50%;">商品数:{{indexList[categoryIndex].count != undefined ? indexList[categoryIndex].count : 0}}</view>
<view style="width: 50%;">库存数:{{indexList[categoryIndex].stockCount != undefined ? indexList[categoryIndex].stockCount : 0}}</view>
</view>
<view class="right-box" v-for="(item,index) in shopList" :key="index" @tap="goDetail(item)">
<view class="box-left" @tap.stop="largeImg(item)">
<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-num">货号:{{item.productSn==null?'':item.productSn}}</view>
<view class="box-right-name">名称:{{item.productName == null?'暂无':item.productName}}</view>
<view class="box-right-name">供应商:{{item.supplierName == null?'暂无':item.supplierName}}</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 @tap.stop="oneShare(item)" style="position: absolute;top: 20rpx;right: 20rpx;width: 100rpx;height: 100rpx;">
<button class="shareBtn">
<uni-icons type="redo" size="22"></uni-icons>
</button>
</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" @tap.stop="largeImg(item)">
<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-num">货号:{{item.productSn}}</view>
<view class="box-right-name">名称:{{item.productName == null?'暂无':item.productName}}</view>
<view class="box-right-name">供应商:{{item.supplierName == null?'暂无':item.supplierName}}</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 @tap.stop="oneShare(item)" style="position: absolute;top: 20rpx;right: 20rpx;width: 100rpx;height: 100rpx;">
<button class="shareBtn">
<uni-icons type="redo" size="22"></uni-icons>
</button>
</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>
<u-loadmore :status="status" />
</view>
<!-- 弹出输入框 -->
<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('4')">
<text style="display: inline-block">批量打印商品码</text>
</view>
<view class="popup-pay-container" @tap="onGridClick('5')">
<text style="display: inline-block">批量下架</text>
</view>
<view v-if="type == 0" class="popup-pay-container" @tap="onGridClick('6')">
<text style="display: inline-block">批量删除商品</text>
</view>
</view>
</uni-popup>
<!-- 弹出输入框 -->
<uni-popup ref="sharePriceDialog" background-color="#fff">
<view class="popup-pay-content">
<view class="popup-pay-title">
<text>选择商品价格</text>
</view>
<view class="popup-pay-container" @tap="checkPay('0')">
<text style="display: inline-block">以零售价分享</text>
</view>
<view class="popup-pay-container" @tap="checkPay('1')">
<text style="display: inline-block">以批发价分享</text>
</view>
</view>
</uni-popup>
<!-- 弹出层 -->
<uni-popup ref="sharePopup" background-color="#fff">
<view style="height: 250rpx;">
<button open-type="share" @tap="$refs.sharePopup.close()" class="popup-photo">分享给微信好友</button>
<view @tap="$refs.sharePopup.close()" class="popup-photo" style="border-bottom:0;border-top:10px solid #eee;">取消</view>
</view>
</uni-popup>
<!-- 弹出多图轮播 -->
<uni-popup ref="imgPopup" background-color="#fff">
<view class="showImg-box">
<swiper indicator-dots class="swiper-box" @change="lunbochange" circular autoplay :current="swiperDotIndex">
<swiper-item v-for="(item, index) in bigImg" :key="index">
<view class="swiper-item">
<image mode='aspectFit' show-menu-by-longpress :src="item.productPicture" alt="" style="width: 100%;height: 100%;border-radius: 10px;" /></image>
</view>
</swiper-item>
</swiper>
</view>
</uni-popup>
</view>
</template>
<script>
import {
mapState
} from 'vuex';
export default {
computed: mapState(['shopIndex', 'region']),
data() {
return {
size: 30,
indexList: [],
bigImg:[],
swiperDotIndex:0,
// status: 'loadmore',
pageNum: 1, //分页的页码
shopList: [],
categoryId: '', //分类id
shopId: '', //店铺id,
type:'',
warnMsg:[],
goodsData:[],
searchName:'',
categoryIndex:0,
windowHeight:0,
shopList1:[],
picture:'',
gateType:'',
total:0
}
},
onLoad(option){
if (option.khid != undefined) {
uni.redirectTo({
url: "/package1/index/downStearmList?khid=" + option.khid
})
}
// if(uni.getStorageSync('noReload') == true){
// uni.removeStorageSync('noReload')
// }
let that = this
this.type=uni.getStorageSync('type')
uni.getSystemInfo({
success: function (info) {
that.windowHeight = info.windowHeight
}
});
},
onShareAppMessage() {
return {
title: '查看我的推荐',
imageUrl:this.picture,
path: '/pages/index/shareStyle?khid=' + this.khid
}
},
onReachBottom() {
if (this.pageNum >= this.pages) return;
// this.status = 'loading';
this.pageNum ++;
if(this.gateType == 'search'){
this.getShareList('search');
}else{
this.getShareList();
}
},
onShow() {
if(uni.getStorageSync('noReload') == true){
this.searchName = ''
uni.removeStorageSync('noReload')
}else{
this.searchName = ''
this.getGategoryList()
}
this.getWarnMsg()
this.getweiruku()
},
methods: {
lunbochange(e) {
this.current = e.detail.current
},
largeImg(img) {
if(img.productPicture == null &&img.productPictures == null ){
this.tui.toast("暂无可展示的图片",1000)
return
}
this.bigImg = []
if(img.productPicture != null){
let data = {
productPicture:img.productPicture
}
this.bigImg.push(data)
}
if(img.productPictures != null){
for(let i=0;i<img.productPictures.length;i++){
this.bigImg.push(img.productPictures[i])
}
}
this.$refs.imgPopup.open()
},
checkPay(type){
this.tui.request("/app/productShare/save", "POST", {
shareType: '2',
shareProductId: [this.goodsData.id],
priceType:1
}, false, true).then((res) => {
if (res.code == 200) {
this.khid = res.result.id
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
this.checkPayData = type
this.$refs.sharePriceDialog.close()
this.$refs.sharePopup.open('bottom')
},
//初始化获取分类列表
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.pageNum = 1
this.searchName = ""
this.shopList1 = []
this.shopList = []
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) {
uni.removeStorageSync('noReload')
for (var i = 0; i < this.indexList.length; i++) {
if (i == index) {
this.indexList[i].parentId = true
} else {
this.indexList[i].parentId = false
}
}
this.categoryIndex = index
this.categoryId = this.indexList[index].id
this.pageNum = 1
this.searchName = ""
this.shopList1 = []
this.shopList = []
this.getShareList()
},
//待入库
goRuku(){
uni.navigateTo({
url: '/pages/index/waitStorage?inStorageStatus=0'
})
},
getweiruku(){
this.tui.request("/app/purchase/list", "POST", {
inStorageStatus: 0
}, false, false).then((res) => {
this.status = 'nomore';
if (res.code == 200) {
this.total = res.result.total
} else {
this.tui.toast(res.message)
}
})
},
//入库单详情
goDetail(item) {
uni.setStorageSync('noReload',true)
uni.navigateTo({
url: '/pages/inventory/inventoryDetail?item=' + JSON.stringify(item)
})
},
goWarnList(){
uni.navigateTo({
url: '/package1/inventory/inventoryWarn'
})
},
clickModel(type){
if(type="num"){
this.tui.toast("商品规格库存数为负数,则该规格库存数不计入库存总数中")
}else{
this.tui.toast("商品规格库存数为负数,则该规格的库存成本不计入总库存成本")
}
},
//点击分类获取商品列表
getShareList(type) {
uni.showLoading({
title:'加载中...',
mask:true
})
let data = {}
if(type=='search'){
this.gateType = 'search'
data = {
categoryId: "",
searchStr: this.searchName,
pageNum: this.pageNum,
pageSize: '10'
}
}else{
this.gateType = ''
data = {
categoryId: this.categoryId,
searchStr: this.searchName,
pageNum: this.pageNum,
pageSize: '10'
}
}
this.status = 'loading';
this.tui.request("/app/product/getShareList", "POST", data, false, false).then((res) => {
if (res.code == 200) {
if(type=='search'){
this.shopList = []
this.status = 'nomore';
if (this.pages == 1) {
this.shopList1 = res.result.records
} else {
this.shopList1 = [...this.shopList1, ...res.result.records]
}
this.pages = res.result.pages
}else{
this.shopList1 = []
this.status = 'nomore';
if (this.pages == 1) {
this.shopList = res.result.records
} else {
this.shopList = [...this.shopList, ...res.result.records]
}
this.pages = res.result.pages
}
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
uni.hideLoading()
},
oneShare(item){
this.goodsData = item
this.picture = item.productPicture == null || item.productPicture == "" ?'https://jewel-shop.oss-cn-beijing.aliyuncs.com/70c3d9a274ff4feeb6df0bcb8be0f733.jpg':item.productPicture
this.$refs.sharePriceDialog.open()
},
//商品上下架
upDown(type, data) {
let that = this,
title = "确定将此款商品" + (type == 0 ? "下架" : "上架") + "吗?"
uni.showModal({
title: "提示",
content: title,
success: function(res) {
if(res.confirm){
that.pageNum = 1
that.searchName = ""
that.shopList1 = []
that.shopList = []
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)
}
that.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)
}
that.categoryId = data.categoryId
that.getShareList()
}).catch((res) => {})
}
}
}
})
},
//搜索接口
search(e){
if(e.value == ''){
this.pageNum = 1
this.shopList1 = []
this.shopList = []
this.searchName = ""
this.getShareList()
}else{
this.pageNum = 1
this.shopList1 = []
this.shopList = []
this.searchName = e.value
this.getShareList('search')
}
},
//清空搜索条件
clearSearch(){
this.searchName = ''
this.getShareList()
},
//点击头部 更多 和 新增入库 按钮
onGridClick(target) {
if (target == '0') {
uni.navigateTo({
url: '/package1/inventory/gategory'
})
this.$refs.payDialog.close()
} else if (target == '1') {
// this.$refs.popup.open('bottom')
uni.navigateTo({
url: '/pages/inventory/addinventory'
})
} else if (target == '2') {
uni.navigateTo({
url: "/package1/inventory/addGoods"
})
this.$refs.payDialog.close()
}else if(target == '3'){
this.$refs.payDialog.open('center')
}else if(target == '4'){
uni.navigateTo({
url: "/package1/inventory/batchPrint"
})
this.$refs.payDialog.close()
}else if(target == '5'){
uni.navigateTo({
url: "/package1/inventory/goodsDelisting"
})
this.$refs.payDialog.close()
}else{
uni.navigateTo({
url: "/package1/inventory/goodsDelete"
})
this.$refs.payDialog.close()
}
}
}
}
</script>
<style lang="scss">
.search {
width: 100%;
height: 7%;
background-color: #fff;
position: fixed;
top: 200rpx;
z-index: 99;
}
.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: 33%;
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;
height: 78%;
overflow-y: scroll;
}
.right-box {
width: 100%;
height: 250rpx;
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-price {
display: flex;
font-size: 25rpx;
}
.price-box {
display: flex;
flex-direction: column;
margin-right: 20rpx;
margin-top:10rpx;
}
.box-right-name {
font-size: 26rpx;
height: 50rpx;
line-height: 50rpx;
}
.box-right-num {
padding: 5rpx 0;
color: #000;
font-weight: bold;
font-size: 30rpx;
}
.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;
bottom: 10rpx;
left: 10rpx;
color: #fff;
background: #088FEB;
padding: 10rpx 10rpx;
border-radius: 5px;
width: 140rpx;
text-align: center;
}
.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;
}
.showImg-box{
width: 700rpx;
height: 1000rpx;
border-radius: 10px;
}
.swiper-box {
height: 1000rpx;
}
.swiper-item {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 1000rpx;
color: #fff;
background-color: #cee1fd;
border-radius: 10px;
}
.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;
}
.shareBtn{
background: rgba(255, 255, 255, 0);
width: 90rpx;
height: 50;
height: 80rpx;
line-height: 80rpx;
border: 1px solid #fff;
background-color: rgba(255,255,255,0);
}
.shareBtn::after{
border: none;
}
.popup-photo{
height: 110rpx;
line-height: 110rpx;
text-align: center;
font-size: 36rpx;
font-weight: 800;
border-bottom: 1px solid #eee;
}
@media screen and (min-width: 470px) {
/* 适配宽度为375px及以上的屏幕 */
.content-left {
height: 75% !important;
float: left;
position: fixed;
top: 25% !important;
}
}
</style>