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.
163 lines
3.6 KiB
163 lines
3.6 KiB
<style lang="scss" scoped>
|
|
.container{
|
|
height: 100%;
|
|
background:#F6F6F6;
|
|
padding-bottom:20rpx;
|
|
|
|
scroll-view{
|
|
flex-grow: 1;
|
|
height:1rpx;
|
|
|
|
.item{
|
|
margin-top:0;
|
|
.title{
|
|
display:flex;
|
|
align-items: center;
|
|
font-weight: bold;
|
|
text{
|
|
margin-left:auto;
|
|
color:#333;
|
|
}
|
|
}
|
|
.adder{
|
|
color:#999;
|
|
font-size:24rpx;
|
|
margin-top: 16rpx;
|
|
}
|
|
.data{
|
|
display:flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-top:16rpx;
|
|
color:#999;
|
|
font-size:24rpx;
|
|
text:nth-child(2){
|
|
color:#10C176;
|
|
font-weight: bold;
|
|
font-size: 32rpx;
|
|
}
|
|
}
|
|
.btns{
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
border-top:2rpx solid #D8D8D8;
|
|
margin:20rpx 0 -30rpx 0;
|
|
text{
|
|
padding:16rpx 0 30rpx 0;
|
|
color:#999;
|
|
font-size:24rpx;
|
|
&:before{
|
|
color:#10C176;
|
|
margin-right:8rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|
|
<template>
|
|
<view class="container flex">
|
|
<d-navbar style="--bg:#10C176;--c:#fff;" text="仓库管理" isBack>
|
|
<text class="plant-xinjian" slot="right" @click="toAdd"/>
|
|
</d-navbar>
|
|
|
|
<d-search v-model="searchVal.search" style="margin-top:30rpx;" @search="clean();search()"/>
|
|
|
|
<scroll-view scroll-y @scrolltolower="search">
|
|
<view class="card item" v-for="(v,k) in list" :key="k" @click="$u.route({url:'pages/warehouse/detail',params:{id:v.warehouseId}})">
|
|
<view class="title">{{v.warehouseName}} <text class="plant-youbian"/></view>
|
|
<view class="adder">{{v.warehouseAddress}}</view>
|
|
<view class="data">
|
|
<text>库存种类:{{v.inventoryType||0}}种</text> <text>{{v.capacity||0}}㎡</text>
|
|
</view>
|
|
<view class="btns">
|
|
<text class="plant-xiugai" @click="toAdd(v.warehouseId)">修改</text>
|
|
<text class="plant-shanchu" @click.stop="del(k)">删除</text>
|
|
<text class="plant-chakan" @click.stop="$u.route({url:'pages/warehouse/info'})">查看库存</text>
|
|
</view>
|
|
</view>
|
|
</scroll-view>
|
|
</view>
|
|
</template>
|
|
<script>
|
|
import request from '@/common/request.js'
|
|
export default {
|
|
data(){
|
|
return{
|
|
searchVal:{
|
|
baseId: this.$store.state.plantBaseInfoId,
|
|
search:"",
|
|
pageNo:1,
|
|
pageSize:6
|
|
},
|
|
list:[],
|
|
total:0,
|
|
}
|
|
},
|
|
onLoad(options){
|
|
this.search()
|
|
},
|
|
methods:{
|
|
clean(){
|
|
this.list=[]
|
|
this.total=0
|
|
this.searchVal.pageNo=1
|
|
},
|
|
async search(){
|
|
if(this.total==0||this.list.length<this.total){
|
|
var res=await request("/api/WarehouseManageApi/queryWarehouseList",{
|
|
method:"post",
|
|
body: this.searchVal
|
|
})
|
|
if(res.statu){
|
|
this.list=this.list.concat(res.data.warehouseList)
|
|
this.total=res.data.total
|
|
}else{
|
|
uni.showModal({
|
|
title:"提示",
|
|
content:res.msg||"获取仓库列表失败!",
|
|
showCancel:false,
|
|
})
|
|
}
|
|
}
|
|
},
|
|
del(index){
|
|
uni.showModal({
|
|
title:"提示",
|
|
content:"确定删除?",
|
|
success: async res=>{
|
|
if(res.confirm){
|
|
var res=await request("/api/WarehouseManageApi/delete",{
|
|
params:{id: this.list[index].warehouseId}
|
|
})
|
|
if(res.statu){
|
|
if(this.list.length>10){
|
|
this.list.splice(index,1)
|
|
}else{
|
|
this.clean()
|
|
this.search()
|
|
}
|
|
uni.showToast({
|
|
title:"删除成功!",
|
|
icon:"success"
|
|
})
|
|
}else{
|
|
uni.showToast({
|
|
title:"删除失败!",
|
|
icon:"error"
|
|
})
|
|
}
|
|
}
|
|
}
|
|
})
|
|
},
|
|
toAdd(id){
|
|
uni.navigateTo({
|
|
url:`/pages/warehouse/info?id=${id}`
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|