<template>
|
<view>
|
<view>
|
<uni-table border stripe type="selection" emptyText="没有更多数据">
|
<uni-tr>
|
<uni-th align="center">数量</uni-th>
|
<uni-th align="center">批号</uni-th>
|
<uni-th align="center">商品编号</uni-th>
|
<uni-th align="center">商品名称</uni-th>
|
<uni-th align="center">规格</uni-th>
|
<uni-th align="center">单价</uni-th>
|
<uni-th align="center">操作</uni-th>
|
</uni-tr>
|
<uni-tr v-for="(item,index) in stockInData" :key="index">
|
<uni-td width="50">
|
<view class="flex justify-center">
|
<button class="cu-btn bg-orange sm" style="width: 60rpx;" @click="changeCount(index,item)">{{item.count}}</button>
|
</view>
|
</uni-td>
|
<uni-td align="center" width="50">{{item.batch}}</uni-td>
|
<uni-td align="center" width="100">{{item.matnr}}</uni-td>
|
<uni-td align="center" width="100">{{item.maktx}}</uni-td>
|
<uni-td align="center" width="50">{{item.specs}}</uni-td>
|
<uni-td align="center" width="50">{{item.price}}</uni-td>
|
<uni-td align="center" width="50">空</uni-td>
|
</uni-tr>
|
</uni-table>
|
</view>
|
<view class="cu-bar foot input justify-center" style="height: 150rpx;">
|
<view style="width: 80%;">
|
<button class="cu-btn bg-yellow lg shadow-blur" style="width: 250rpx;color: #fff;" @click="getMat()">新 增</button>
|
<button class="cu-btn bg-orange lg shadow-blur" style="float: right;width: 250rpx;color: #fff;" @click="confirm()">确认入库</button>
|
</view>
|
</view>
|
<!-- ******************************************************************************************* -->
|
<view>
|
<!-- 修改数量弹框 -->
|
<uni-popup ref="inputDialog" type="dialog">
|
<uni-popup-dialog ref="inputClose" mode="input" title="物料数量" @confirm="dialogInputConfirm">
|
<uni-number-box :max="999" v-model="value" />
|
</uni-popup-dialog>
|
</uni-popup>
|
</view>
|
<view>
|
<!-- 提示信息弹窗 -->
|
<uni-popup ref="message" type="message">
|
<uni-popup-message :type="msgType" :message="messageText" :duration="2000"></uni-popup-message>
|
</uni-popup>
|
</view>
|
<view>
|
<!-- 显示表单弹窗 -->
|
<uni-popup ref="showNodeSelect" type="dialog">
|
<uni-popup-dialog ref="inputClose" mode="input" title="选择入库货位" >
|
|
</uni-popup-dialog>
|
</uni-popup>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
type:'bottom',
|
stockInData: [],
|
value:'',
|
rowNum:'',
|
msgType: '',
|
messageText: '',
|
}
|
},
|
mounted(){
|
const UIP = uni.getStorageSync('UIP');
|
this.baseIP = UIP;
|
const UPORT = uni.getStorageSync('UPORT');
|
this.basePORT = UPORT
|
},
|
methods: {
|
// 弹出层
|
toggle(type) {
|
this.type = type
|
// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
|
this.$refs.popup.open(type)
|
},
|
// 提醒弹窗
|
messageToggle(type) {
|
this.msgType = type
|
this.messageText = '提取失败'
|
this.$refs.message.open()
|
},
|
getMat() {
|
let that = this
|
uni.navigateTo({
|
url: 'stockIn?baseIP=' + that.baseIP + '&basePORT=' + that.basePORT
|
});
|
},
|
// 初始化上架数量
|
initCount() {
|
this.stockInData.forEach(function(element){
|
element.count = 0
|
})
|
},
|
otherFun(object){ // 接收上个页面的传值
|
let that = this
|
if(!!object){
|
if ( that.stockInData.length == 0 ) {
|
that.stockInData = object
|
} else {
|
that.addSotokInData(object)
|
}
|
|
|
}
|
that.initCount()
|
},
|
addSotokInData(object) {
|
let that = this
|
for (var i = 1; i < object.length; i++) {
|
var toPush = true
|
for (var j = 0; j < that.stockInData.length; j++) {
|
if (object[i].matnr == that.stockInData[j].matnr) {
|
toPush = false
|
}
|
}
|
if (toPush) {
|
that.stockInData.push(object[i])
|
}
|
|
}
|
},
|
// 修改数量
|
changeCount(index,item) {
|
this.$refs.inputDialog.open()
|
this.rowNum = index
|
this.value = 0
|
},
|
// 修改数量弹窗
|
dialogInputConfirm() {
|
this.stockInData[this.rowNum].count = this.value
|
},
|
// 确认入库
|
confirm() {
|
let that = this
|
if (that.stockInData.length == 0) {
|
that.messageToggle('error')
|
that.messageText = '请先添加物料'
|
return;
|
}
|
for (var i = 0; i < that.stockInData.length; i++) {
|
if (that.stockInData[i].count === 0){
|
that.messageToggle('error')
|
that.messageText = '数量不能为零'
|
return;
|
}
|
}
|
this.$refs.showNodeSelect.open()
|
uni.request({
|
url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + "/work/stock/pakin",
|
header: { 'token':uni.getStorageSync('token') },
|
data: {},
|
method:'POST',
|
success(res) {
|
console.log(res)
|
}
|
})
|
}
|
}
|
}
|
</script>
|
|
<style>
|
|
</style>
|