| | |
| | | <template> |
| | | <view> |
| | | <view> |
| | | <uni-table border emptyText="没有更多数据"> |
| | | <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>数量</uni-th> |
| | | <uni-th>批号</uni-th> |
| | | <uni-th>商品编号</uni-th> |
| | | <uni-th>商品名称</uni-th> |
| | | <uni-th>规格</uni-th> |
| | | <uni-th>单价</uni-th> |
| | | <uni-th>操作</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-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;">确认入库</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="popup" background-color="#fff" style="position: fixed; border-radius: 5px;" > |
| | | <view class="popup-content " :class="{ 'popup-height': type === 'left' || type === 'right' }"> |
| | | <view style="width: 700rpx;"></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> |
| | |
| | | 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: { |
| | | // 弹出层 |
| | |
| | | // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性 |
| | | this.$refs.popup.open(type) |
| | | }, |
| | | // 提醒弹窗 |
| | | messageToggle(type) { |
| | | this.msgType = type |
| | | this.messageText = '提取失败' |
| | | this.$refs.message.open() |
| | | }, |
| | | getMat() { |
| | | this.toggle('left') |
| | | 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; |
| | | } |
| | | } |
| | | uni.request({ |
| | | url: that.baseHttp + that.baseIP + ':' +that.basePORT + that.baseUrl + "//work/stock/pakin", |
| | | header: { |
| | | 'content-type':'application/json', |
| | | 'token':uni.getStorageSync('token') |
| | | }, |
| | | data: { |
| | | nodeId: this.nodeSel, |
| | | mats: this.stockInData, |
| | | }, |
| | | method:'POST', |
| | | success(res) { |
| | | console.log(res) |
| | | var res = res.data |
| | | if (res.code === 200 ) { |
| | | console.log(res) |
| | | } |
| | | } |
| | | }) |
| | | }, |
| | | 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 |
| | | this.changeNum(this.sum) |
| | | }, |
| | | changeNum() { |
| | | switch (this.sum) { |
| | | case "0-0-0": |
| | | this.nodeSel = 1 |
| | | break; |
| | | case "1-0-0": |
| | | this.nodeSel = 4 |
| | | break; |
| | | case "1-0-1": |
| | | this.nodeSel = 5 |
| | | break; |
| | | case "1-0-2": |
| | | this.nodeSel = 6 |
| | | break; |
| | | case "1-0-3": |
| | | this.nodeSel = 7 |
| | | break; |
| | | case "1-0-4": |
| | | this.nodeSel = 8 |
| | | break; |
| | | case "1-0-5": |
| | | this.nodeSel = 9 |
| | | break; |
| | | case "1-0-6": |
| | | this.nodeSel = 10 |
| | | break; |
| | | case "1-0-7": |
| | | this.nodeSel = 11 |
| | | break; |
| | | case "1-0-8": |
| | | this.nodeSel = 12 |
| | | break; |
| | | case "1-0-9": |
| | | this.nodeSel = 13 |
| | | break; |
| | | case "1-0-10": |
| | | this.nodeSel = 14 |
| | | break; |
| | | case "1-0-11": |
| | | this.nodeSel = 15 |
| | | break; |
| | | case "1-0-12": |
| | | this.nodeSel = 16 |
| | | break; |
| | | case "1-0-13": |
| | | this.nodeSel = 17 |
| | | break; |
| | | case "1-0-14": |
| | | this.nodeSel = 18 |
| | | break; |
| | | case "1-0-15": |
| | | this.nodeSel = 19 |
| | | break; |
| | | case "1-1-0": |
| | | this.nodeSel = 21 |
| | | break; |
| | | case "1-1-1": |
| | | this.nodeSel = 22 |
| | | break; |
| | | case "1-1-2": |
| | | this.nodeSel = 23 |
| | | break; |
| | | case "1-1-3": |
| | | this.nodeSel = 24 |
| | | break; |
| | | case "1-1-4": |
| | | this.nodeSel = 25 |
| | | break; |
| | | case "1-1-5": |
| | | this.nodeSel = 26 |
| | | break; |
| | | case "1-1-6": |
| | | this.nodeSel = 27 |
| | | break; |
| | | case "1-1-7": |
| | | this.nodeSel = 28 |
| | | break; |
| | | case "1-1-8": |
| | | this.nodeSel = 29 |
| | | break; |
| | | case "1-1-9": |
| | | this.nodeSel = 30 |
| | | break; |
| | | case "1-1-10": |
| | | this.nodeSel = 31 |
| | | break; |
| | | case "1-1-11": |
| | | this.nodeSel = 32 |
| | | break; |
| | | case "1-1-12": |
| | | this.nodeSel = 33 |
| | | break; |
| | | case "1-1-13": |
| | | this.nodeSel = 34 |
| | | break; |
| | | case "1-1-14": |
| | | this.nodeSel = 35 |
| | | break; |
| | | case "1-1-15": |
| | | this.nodeSel = 36 |
| | | break; |
| | | |
| | | } |
| | | }, |
| | | 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> |