<template>
|
<view>
|
<view class="margin-top">
|
<view class="app-list">
|
<view class="app-list-cell">
|
<view class="app-list-cell-left">上架货位</view>
|
<view class="app-list-cell-db">
|
<picker mode="multiSelector" @columnchange="bindMultiPickerColumnChange" :value="multiIndex" :range="multiArray">
|
<view class="app-input">{{multiArray[0][multiIndex[0]]}}
|
,{{multiArray[1][multiIndex[1]]}}
|
,{{multiArray[2][multiIndex[2]]}}</view>
|
</picker>
|
</view>
|
</view>
|
</view>
|
</view>
|
|
<view class="margin-top">
|
<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="选择入库货位" @confirm="aabbcc()">
|
|
</uni-popup-dialog>
|
</uni-popup>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
type:'bottom',
|
stockInData: [],
|
value:'',
|
rowNum:'',
|
msgType: '',
|
messageText: '',
|
selectData: "",
|
index: 0,
|
multiArray: [
|
['请选择'],
|
['请选择'],
|
['请选择']
|
],
|
multiIndex: [0, 0, 0],
|
date: getDate({
|
format: true
|
}),
|
startDate:getDate('start'),
|
endDate:getDate('end'),
|
sum: '',
|
nodeSel: '',
|
}
|
},
|
onLoad() {
|
|
},
|
mounted(){
|
const UIP = uni.getStorageSync('UIP');
|
this.baseIP = UIP;
|
const UPORT = uni.getStorageSync('UPORT');
|
this.basePORT = UPORT
|
let that = this
|
uni.request({
|
url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + "/node/tree/auth",
|
header: { 'token':uni.getStorageSync('token') },
|
data: {},
|
method:'POST',
|
success(res) {
|
var res = res.data
|
if (res.code === 200 ) {
|
that.selectData = res.data
|
that.multiArray[0] = [res.data[0].title,res.data[0].children[0].title]
|
}
|
}
|
})
|
},
|
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()
|
},
|
bindMultiPickerColumnChange: function(e) {
|
var selectData = this.selectData
|
var selectData2 = this.selectData[0].children[0].children[0].children
|
var selectData3 = this.selectData[0].children[0].children[1].children
|
this.multiIndex[e.detail.column] = e.detail.value
|
switch (e.detail.column) {
|
case 0: //拖动第1列
|
|
switch (this.multiIndex[0]) {
|
case 0:
|
this.multiArray[1] = [selectData[0].title]
|
this.multiArray[2] = [selectData[0].title]
|
break
|
case 1:
|
this.multiArray[1] = [selectData[0].children[0].children[0].title,
|
selectData[0].children[0].children[1].title]
|
this.multiArray[2] = [selectData2[0].title,
|
selectData2[1].title,
|
selectData2[2].title,
|
selectData2[3].title,
|
selectData2[4].title,
|
selectData2[5].title,
|
selectData2[6].title,
|
selectData2[7].title,
|
selectData2[8].title,
|
selectData2[9].title,
|
selectData2[10].title,
|
selectData2[11].title,
|
selectData2[12].title,
|
selectData2[13].title,
|
selectData2[14].title,
|
selectData2[15].title, ]
|
break
|
}
|
this.multiIndex.splice(1, 1, 0)
|
this.multiIndex.splice(2, 1, 0)
|
break
|
case 1: //拖动第2列
|
|
switch (this.multiIndex[0]) { //判断第一列是什么
|
case 0:
|
switch (this.multiIndex[1]) {
|
case 0:
|
|
break
|
case 1:
|
this.multiArray[2] = ['东京','北海道']
|
break
|
}
|
break
|
case 1:
|
switch (this.multiIndex[1]) {
|
case 0:
|
this.multiArray[2] = [selectData2[0].title,
|
selectData2[1].title,
|
selectData2[2].title,
|
selectData2[3].title,
|
selectData2[4].title,
|
selectData2[5].title,
|
selectData2[6].title,
|
selectData2[7].title,
|
selectData2[8].title,
|
selectData2[9].title,
|
selectData2[10].title,
|
selectData2[11].title,
|
selectData2[12].title,
|
selectData2[13].title,
|
selectData2[14].title,
|
selectData2[15].title, ]
|
break
|
case 1:
|
this.multiArray[2] = [selectData3[0].title,
|
selectData3[1].title,
|
selectData3[2].title,
|
selectData3[3].title,
|
selectData3[4].title,
|
selectData3[5].title,
|
selectData3[6].title,
|
selectData3[7].title,
|
selectData3[8].title,
|
selectData3[9].title,
|
selectData3[10].title,
|
selectData3[11].title,
|
selectData3[12].title,
|
selectData3[13].title,
|
selectData3[14].title,
|
selectData3[15].title, ]
|
break
|
}
|
break
|
}
|
this.multiIndex.splice(2, 1, 0)
|
break
|
}
|
this.$forceUpdate()
|
var num1 = this.multiIndex[0]
|
var num2 = this.multiIndex[1]
|
var num3 = this.multiIndex[2]
|
this.sum = num1 + "-" + num2 + "-" + num3
|
console.log(this.sum)
|
this.changeNum(this.sum)
|
},
|
changeNum() {
|
console.log(this.sum)
|
switch (this.sum) {
|
case 0-0-0:
|
console.log('ycq')
|
this.nodeSel = 1
|
break;
|
case 1-0-0:
|
console.log('ycq')
|
this.nodeSel = 1
|
break;
|
}
|
console.log(this.nodeSel)
|
},
|
aabbcc(e) {
|
console.log(e)
|
}
|
}
|
}
|
</script>
|
|
<style>
|
.app-list {
|
background-color: #ffffff;
|
position: relative;
|
width: 100%;
|
display: flex;
|
flex-direction: column;
|
}
|
.app-list:after {
|
position: absolute;
|
z-index: 10;
|
right: 0;
|
bottom: 0;
|
left: 0;
|
height: 1px;
|
content: '';
|
-webkit-transform: scaleY(.5);
|
transform: scaleY(.5);
|
background-color: #c8c7cc;
|
}
|
.app-list::before {
|
position: absolute;
|
z-index: 10;
|
right: 0;
|
top: 0;
|
left: 0;
|
height: 1px;
|
content: '';
|
-webkit-transform: scaleY(.5);
|
transform: scaleY(.5);
|
background-color: #c8c7cc;
|
}
|
.app-list-cell {
|
position: relative;
|
display: flex;
|
flex-direction: row;
|
justify-content: space-between;
|
align-items: center;
|
}
|
.app-list-cell-left {
|
white-space: nowrap;
|
font-size:28rpx;
|
padding: 0 30rpx;
|
}
|
.app-list-cell-db,
|
.app-list-cell-right {
|
flex: 1;
|
}
|
.app-input {
|
height: 80rpx;
|
padding: 15rpx 25rpx;
|
line-height:50rpx;
|
font-size:28rpx;
|
background:#FFF;
|
flex: 1;
|
}
|
.app-list-cell::after {
|
position: absolute;
|
z-index: 3;
|
right: 0;
|
bottom: 0;
|
left: 30rpx;
|
height: 1px;
|
content: '';
|
-webkit-transform: scaleY(.5);
|
transform: scaleY(.5);
|
background-color: #c8c7cc;
|
}
|
</style>
|