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.

186 lines
4.5 KiB

2 years ago
<style lang="scss" scoped>
2 years ago
.container{
height: 100%;
2 years ago
background:#F6F6F6;
2 years ago
padding-bottom:20rpx;
2 years ago
scroll-view{
flex-grow: 1;
height:1rpx;
.item{
2 years ago
margin-top:0;
display:flex;
.u-transition{
flex-shrink: 0;
margin-right:28rpx;
2 years ago
}
.info{
flex-grow: 1;
width:1rpx;
.title{
display:flex;
align-items: center;
2 years ago
font-weight: bold;
text{
margin-left:auto;
color:#333;
}
2 years ago
}
.adder{
2 years ago
color:#999;
2 years ago
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){
2 years ago
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;
}
2 years ago
}
}
}
}
}
}
</style>
<template>
<view class="container flex">
2 years ago
<d-navbar style="--bg:#10C176;--c:#fff;" text="仓库管理" isBack>
<text class="plant-xinjian" slot="right" @click="toAdd()"/>
2 years ago
</d-navbar>
2 years ago
<d-search v-model="searchVal.search" style="margin-top:30rpx;" @search="clean();search()"/>
2 years ago
<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}})">
<u-image width="164rpx" height="164rpx" radius="16rpx" mode="aspectFill" :src="`${host}/${v.warehousePic[0]}`">
<text slot="error" class="plant-xiaopangchetupianjiazaishibai" style="font-size:45rpx"/>
</u-image>
<view class="info">
<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.stop="toAdd(v.warehouseId)">修改</text>
<text class="plant-shanchu" @click.stop="del(k)">删除</text>
<text class="plant-chakan" @click.stop="$u.route({url:'pages/stock/mana',params:{id:v.warehouseId}})">查看库存</text>
</view>
2 years ago
</view>
</view>
2 years ago
<u-empty v-if="list.length==0" text="为查询到相关信息" width="70%" icon="/static/noData.png"/>
</scroll-view>
2 years ago
</view>
</template>
<script>
import request,{host} from '@/common/request.js'
2 years ago
export default {
data(){
return{
searchVal:{
baseId: this.$store.state.plantBaseInfoId,
search:"",
pageNo:1,
pageSize:6
},
list:[],
total:0,
host:host('imgUrl'),
}
},
onLoad(options){
this.search()
},
2 years ago
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.map(v=>({...v,warehousePic:(v.warehousePic||'').split(",").filter(v=>v)})))
this.total=res.data.total
this.searchVal.pageNo++
if(this.list.length==this.total)uni.showToast({title:"加载完成!",icon:"none"})
}else{
uni.showModal({
title:"提示",
content:res.msg||"获取仓库列表失败!",
showCancel:false,
})
}
}
2 years ago
},
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||''}`,
events:{update:()=>{
this.clean()
this.search()
}}
2 years ago
})
}
2 years ago
}
2 years ago
}
</script>