<template> <div> <uni-nav-bar title="物料接收" :status-bar="true" background-color="#3F92F9" color="#FFF"> <view slot="left"> <u-icon name="account-fill" color="#FFF" size="35"></u-icon> <span style="padding: 0 5rpx;color: #FFFFFF;">{{ userInfo.name }}</span> </view> <view slot="right" @tap="$utils.back()"> <span style="color: #FFFFFF;">返回</span> </view> </uni-nav-bar> <view class="ul"> <view class="li" v-for="i in dataList" :key="i.id"> <view class="line"> 物料编码:{{i.materialCode}} </view> <view class="line"> 物料名称:{{i.materialName}} </view> <view class="line"> 出库时间:{{i.createTime}} <view class="span"> 数量:<span style="color:red">{{i.changeName}}</span> </view> </view> <view class="line"> 接收人员:{{i.realName}} </view> <view class="btn-warp"> <button @click="operation(4,i.id)">退回</button> <button @click="operation(3,i.id)">确认接收</button> </view> </view> </view> <button class="footer-btn" @click="operation('all')"> 批量接受物料 </button> </div> </template> <script> export default{ name:"xx", data(){ return{ userInfo:this.$storage.getStorageSync('userInfo'), dataList:[], } }, created(){ setTimeout(()=>{ this.getList() },100) }, methods:{ operation(_type,_id){ var idList = [] var operation = '' if(_type == 'all'){ operation = 3 for (var i = 0; i < this.dataList.length; i++) { idList.push(this.dataList[i].id) } }else{ operation = _type idList = [_id] } console.log(idList,operation) uni.request({ url: 'http://120.79.80.64:8050' + '/cloudApi/materialReceive/operation', method: 'POST', header:{ 'Content-Type' : 'application/json', }, data: { idList: idList, operation:operation, }, success: res => { console.log(res) if(res.data.code == 200){ this.$msg.showToast('操作成功!') this.getList() } }, }); }, getList(){ const v = this uni.request({ url: 'http://120.79.80.64:8050' + '/cloudApi/materialReceive/list', method: 'POST', header:{ 'Content-Type' : 'application/json', }, data: { jobNo: this.userInfo.jobNo }, success: res => { console.log(res) this.dataList = res.data.data }, }); }, }, } </script> <style scoped lang="less"> .ul{ padding-bottom: 200rpx; } .li{ background-color: #fff; margin: 20rpx 20rpx 0; padding: 20rpx; list-style: none; .line{ line-height: 70rpx; border: none; display: flex; padding: 0 20rpx; .span{ margin-left: 50rpx; } } } .btn-warp{ display: flex; button{ width: 48%; } } .footer-btn{ position: fixed; bottom: 10rpx; left: 10rpx; right: 10rpx; background-color: red; color: #fff; } </style>