|
|
@ -91,28 +91,30 @@ |
|
|
|
</style> |
|
|
|
<template> |
|
|
|
<view class="container flex"> |
|
|
|
<d-search v-model="searchVal.search" @search="clean();search()"/> |
|
|
|
<d-search v-model="searchVal.search" @search="search()"/> |
|
|
|
|
|
|
|
<scroll-view scroll-y> |
|
|
|
<view class="card" v-for="(v,k) in list" :key="k" @click="toSpecs(v)"> |
|
|
|
<view class="head"> |
|
|
|
<text class="type">{{v.goodsType}}</text> |
|
|
|
<text class="name over">{{v.substanceName}}</text> |
|
|
|
<block v-if="!loading"> |
|
|
|
<view class="card" v-for="(v,k) in comList" :key="k" @click="toSpecs(v)"> |
|
|
|
<view class="head"> |
|
|
|
<text class="type">{{v.goodsType}}</text> |
|
|
|
<text class="name over">{{v.substanceName}}</text> |
|
|
|
</view> |
|
|
|
<view class="item"> |
|
|
|
<text class="over PA-hebing">入库编号:{{v.inOutBatchNo}}</text> <text class="amount" :data-unit="v.unit">{{v.equivalentAmount}}</text> |
|
|
|
</view> |
|
|
|
<view class="item"> |
|
|
|
<text class="PA-path1">入库日期:{{v.operateTime}}</text> <text class="surplus">剩余:{{v.surplus}}{{v.unit||v.specs[1]}}</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="item"> |
|
|
|
<text class="over PA-hebing">入库编号:{{v.inOutBatchNo}}</text> <text class="amount" :data-unit="v.unit">{{v.equivalentAmount}}</text> |
|
|
|
</view> |
|
|
|
<view class="item"> |
|
|
|
<text class="PA-path1">入库日期:{{v.operateTime}}</text> <text class="surplus">剩余:{{Math.round(v.number*v.unitNum*100)/100+(saveList.find(i=>i.inventoryId==v.inventoryId)?saveList.find(i=>i.inventoryId==v.inventoryId).inputTotal:0)}}{{v.unit}}</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<u-empty v-if="list.length==0" text="未查询到相关信息" width="70%" icon="/static/noData.png"/> |
|
|
|
</block> |
|
|
|
<u-empty v-else-if="comList.length==0||loading" text="未查询到相关信息" width="70%" icon="/static/noData.png"/> |
|
|
|
<view style="border:0.5rpx solid transparent"/> |
|
|
|
</scroll-view> |
|
|
|
|
|
|
|
<u-toast ref="toast"/> |
|
|
|
<u-modal :show="!!detail" @close="detail=null" @cancel="detail=null" showCancelButton closeOnClickOverlay @confirm="confirm"> |
|
|
|
<input v-if="!!detail" placeholder="请输入数量" type="digit" v-model="detail.inputQuantity"/> |
|
|
|
<input v-if="!!detail" placeholder="请输入数量" type="digit" v-model="detail.inputTotal"/> |
|
|
|
</u-modal> |
|
|
|
</view> |
|
|
|
</template> |
|
|
@ -128,6 +130,7 @@ export default { |
|
|
|
pageSize:50, |
|
|
|
search:"", |
|
|
|
}, |
|
|
|
loading:true, |
|
|
|
list:[], |
|
|
|
saveList:[], |
|
|
|
detail:null, |
|
|
@ -135,63 +138,63 @@ export default { |
|
|
|
eventChannel:null, |
|
|
|
} |
|
|
|
}, |
|
|
|
computed:{ |
|
|
|
comList(){ |
|
|
|
return this.saveList.concat(this.list.filter(v=>!this.saveList.some(i=>i.id==v.id))) |
|
|
|
}, |
|
|
|
}, |
|
|
|
onLoad(){ |
|
|
|
this.eventChannel=this.getOpenerEventChannel() |
|
|
|
this.eventChannel.on("list", e=>this.saveList=e) |
|
|
|
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/Inventory/queryCollectingList",{ |
|
|
|
method:"post", |
|
|
|
body: this.searchVal |
|
|
|
this.loading=true |
|
|
|
var res=await request("/api/Inventory/queryCollectingList",{ |
|
|
|
method:"post", |
|
|
|
body: this.searchVal |
|
|
|
}) |
|
|
|
this.loading=false |
|
|
|
if(res.statu){ |
|
|
|
this.list=res.data.records.map(v=>({ |
|
|
|
...v, |
|
|
|
unitNum:parseFloat(v.specDescribe.match(/^[\d\.]+/)?.[0]||0), |
|
|
|
})) |
|
|
|
}else{ |
|
|
|
uni.showModal({ |
|
|
|
title:"提示", |
|
|
|
content:res.msg||"获取领用农资失败!", |
|
|
|
showCancel:false, |
|
|
|
}) |
|
|
|
if(res.statu){ |
|
|
|
this.list=this.list.concat(res.data.records.map(v=>({...v,unitNum:parseFloat(v.specDescribe.match(/^[\d\.]+/)?.[0]||0)}))) |
|
|
|
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, |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
toSpecs(e){ |
|
|
|
this.detail={ |
|
|
|
goodsType: e.goodsType, |
|
|
|
inputQuantity:'', |
|
|
|
inventoryId: e.inventoryId, |
|
|
|
number:e.number, |
|
|
|
specDescribe:e.specDescribe, |
|
|
|
specificationId: e.specId, |
|
|
|
specs: (e.specDescribe.match(/(\d+)(.+?)\/(.+?)/)||[]).slice(1,4), |
|
|
|
inputTotal:'', |
|
|
|
inOutId: e.id, |
|
|
|
surplus:e.surplus, |
|
|
|
specificationId: e.specificationId||e.specId, |
|
|
|
specs: e.specs||(e.specDescribe.match(/(\d+)(.+?)\/(.+?)/)||[]).slice(1,4), |
|
|
|
substanceName: e.substanceName, |
|
|
|
} |
|
|
|
}, |
|
|
|
confirm(){ |
|
|
|
if(!(parseFloat(this.detail.inputQuantity))){ |
|
|
|
if(!(parseFloat(this.detail.inputTotal))){ |
|
|
|
this.$refs.toast.show({ |
|
|
|
type:"error", |
|
|
|
icon:false, |
|
|
|
message:"请输入数量!", |
|
|
|
}) |
|
|
|
}else if(parseFloat(this.detail.inputQuantity)>this.detail.number*this.detail.specs[0]){ |
|
|
|
}else if(parseFloat(this.detail.inputTotal)>this.detail.surplus){ |
|
|
|
this.$refs.toast.show({ |
|
|
|
type:"error", |
|
|
|
icon:false, |
|
|
|
message:"输入数量不能大于剩余数量!", |
|
|
|
}) |
|
|
|
}else{ |
|
|
|
this.eventChannel.emit("addSpecs", {...this.detail, inputQuantity:parseFloat(this.detail.inputQuantity)}) |
|
|
|
this.eventChannel.emit("addSpecs", {...this.detail, inputTotal:parseFloat(this.detail.inputTotal)}) |
|
|
|
uni.navigateBack() |
|
|
|
} |
|
|
|
}, |
|
|
|