<template>
|
<view>
|
<view class="cu-form-group margin-top">
|
<view>
|
出库口
|
</view>
|
<view class="uni-list-cell-db">
|
<picker @change="bindPickerChange" :value="index" :range="array" range-key="name">
|
<view class="uni-input">{{array[index]}}</view>
|
</picker>
|
</view>
|
<view>
|
<button v-model="matBtn" class="cu-btn bg-yellow" @click="toggle('right')"><text>+补充</text></button>
|
</view>
|
</view>
|
<view class="margin-top">
|
<uni-table border stripe emptyText="暂无更多数据">
|
<uni-tr>
|
<uni-th width="50">数量</uni-th>
|
<uni-th width="100">产品ID</uni-th>
|
<uni-th width="100">产品名称</uni-th>
|
<uni-th width="100">库位</uni-th>
|
</uni-tr>
|
<uni-tr v-for="(item, index) in locDetlData" :key="index">
|
<uni-td>{{item.count}}</uni-td>
|
<uni-td>{{item.matNo}}</uni-td>
|
<uni-td>{{item.matName}}</uni-td>
|
<uni-td>{{item.locNo}}</uni-td>
|
</uni-tr>
|
</uni-table>
|
|
</view>
|
<view>
|
<button class="cu-btn bg-yellow pda-btn">确认</button>
|
<button class="cu-btn bg-grey pda-btn">重置</button>
|
</view>
|
<view>
|
<uni-popup ref="popup" background-color="#fff" style="width: 500rpx;">
|
<view class="popup-content" :class="{ 'popup-height': type === 'left' || type === 'right' }">
|
<view class="cu-form-group margin-top">
|
<text>补充产品</text>
|
</view>
|
<view class="cu-form-group margin-top">
|
<text class="title">产品ID</text>
|
<input type="text" v-model="matNo" placeholder="扫码 / 输入" name="input" autocomplete="off" focus @input="find()">
|
</view>
|
<view class="cu-form-group margin-top">
|
<text class="title">产品名称</text>
|
<input type="text" name="input" autocomplete="off" v-model="matName">
|
</view>
|
<view class="cu-form-group margin-top">
|
<text class="title">规格型号</text>
|
<input type="text" name="input" autocomplete="off" v-model="specs">
|
</view>
|
<view class="cu-form-group margin-top">
|
<text class="title">单位</text>
|
<input type="text" name="input" autocomplete="off" v-model="unit">
|
</view>
|
<view class="cu-form-group margin-top">
|
<text class="title">数量</text>
|
<uni-number-box @change="countDom" v-model="count" />
|
</view>
|
<button class="cu-btn bg-yellow pda-btn2" @click="confirm">补充</button>
|
|
</view>
|
</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>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
index: 0,
|
array: [],
|
matBtn:'',
|
souceData:[], // 初始化表格数据记录
|
locDetlData:[],
|
matNo:'',
|
matName:'',
|
specs:'',
|
unit:'',
|
count:'0',
|
type: '',
|
msgType:'',
|
messageText:'',
|
}
|
},
|
onLoad(){
|
let that = this
|
uni.request({
|
url: that.baseUrl + "/available/take/check/site",
|
header: {
|
'token':uni.getStorageSync('token')
|
},
|
method: 'POST',
|
async: false,
|
success(res){
|
if(res.data.code === 200){
|
that.array = res.data.data
|
}
|
}
|
})
|
},
|
methods: {
|
bindPickerChange: function(e) {
|
console.log('picker发送选择改变,携带值为:' + e.detail.value)
|
this.index = e.detail.value
|
},
|
// 提取
|
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()
|
},
|
countDom(value) {
|
|
},
|
find(){
|
let that = this
|
let thatId = that.matNo
|
if(that.matNo.length===0){
|
return;
|
}
|
uni.request({
|
url: that.baseUrl + "/matCode/auth",
|
header: {
|
'content-type':'application/x-www-form-urlencoded',
|
'token':uni.getStorageSync('token')
|
},
|
data: {
|
id:thatId
|
},
|
method: 'POST',
|
success(res){
|
let data = res.data.data
|
|
if(res.data.code === 200){
|
if(data != null){
|
that.matName = data.matName
|
that.specs = data.specs
|
that.unit = data.unit
|
}
|
} else if (res.data.code ===403 ){
|
// 待定
|
} else {
|
// 待定
|
}
|
}
|
})
|
},
|
confirm(){
|
let that = this
|
let data = {
|
matNo:that.matNo,
|
matName:that.matName,
|
count:that.count
|
}
|
that.addTableData(data)
|
|
},
|
initTableData(data){
|
for(var i=0;i<data.length;i++){
|
var toPush =true
|
for(var j = 0; j<this.locDetlDate.length;j++){
|
if (data[i].matNo === this.locDetlData[j].matNo && data[i].locNo === this.locDetlData[j].locNo) {
|
toPush = false;
|
}
|
}
|
if(toPush){
|
this.locDetlDate.push(data[i])
|
}
|
}
|
},
|
addTableData(data){
|
let that = this
|
if(data.matNo.length === 0){
|
that.messageToggle('error')
|
that.messageText = '提取失败'
|
return
|
}
|
this.$refs.popup.close()
|
var toPush = true
|
for (var j = 0; j < this.locDetlData.length; j++) {
|
if (data.matNo === this.locDetlData[j].matNo && data.locNo === this.locDetlData[j].locNo) {
|
toPush = false;
|
}
|
}
|
if (toPush) {
|
var pushData = {
|
locNo: this.locDetlData[0] ? this.locDetlData[0].locNo : null,
|
matNo: data.matNo,
|
count: data.count,
|
matName: data.matName
|
}
|
locDetlData.push(pushData);
|
}
|
|
},
|
}
|
}
|
</script>
|
|
<style>
|
|
</style>
|