<template>
|
<view>
|
<view class="status_bar">
|
<!-- 这里是状态栏 -->
|
</view>
|
<uni-nav-bar left-icon="left" background-color="#f8f8f8" title="下架物料" @clickLeft="back" :fixed="true"
|
:border="false" rightWidth="160rpx" leftWidth="160rpx"
|
>
|
<block slot="right">
|
<view class="city">
|
<view>
|
<text class="uni-nav-bar-text">{{store}}</text>
|
</view>
|
</view>
|
</block>
|
</uni-nav-bar>
|
<!-- 搜索框 -->
|
<!-- <view class="search-bar">
|
<uni-search-bar v-model="orderNo" placeholder=" 输入" bgColor="#EEEEEE" @input="search" />
|
</view> -->
|
<view class="mat-list-title">
|
<view style="width: 200rpx;"></view>
|
<view style="-webkit-flex: 1;flex: 1;">库位号:{{locNo}}</view>
|
<view style="width: 200rpx;"><button size="mini" type="primary" @click="allSelect()">{{seltitle}}</button></view>
|
</view>
|
|
<view style="height: 60px;"></view>
|
|
<view>
|
<!-- 物料名称 物料号 批号 关联单号 库存数量 出库数量-->
|
<view class="list_item" v-for="(item,index) in dataList">
|
<view class="list_check_box">
|
<label @click="checkboxChange(item)">
|
<checkbox :value="item.matnr" :checked="item.checked" style="transform:scale(0.7)" /><text></text>
|
</label>
|
</view>
|
<view class="list_main">
|
<view>
|
<text class="desc_name">物料号:</text>
|
<text class="desc_connect">{{item.matnr}}</text>
|
</view>
|
<view>
|
<text class="desc_name">物料名称:</text>
|
<text class="desc_connect">{{item.maktx}}</text>
|
</view>
|
<view>
|
<text class="desc_name">订单号:</text>
|
<text class="desc_connect">{{item.orderNo}}</text>
|
</view>
|
<view style="display: flex;">
|
<text class="desc_name">数量:</text>
|
<uni-number-box :value="item.anfme" :step='1' :min="0" :max="item.maxCount" color="#747474" @change="changeValue($event,item)" />
|
<!-- <text class="desc_connect">{{item.anfme}}</text> -->
|
|
</view>
|
</view>
|
<!-- <view class="list_fix">
|
<uni-icons type="compose" color="#9add8b" size="24" @click="revise(item,i)"></uni-icons>
|
</view> -->
|
</view>
|
</view>
|
|
<view style="margin: 8px;text-align: center;color: #777;" v-if="dataList.length == 0">
|
没有数据
|
</view>
|
|
<view style="height: 60px;"></view>
|
|
<!-- 底部操作按钮 -->
|
<view class="buttom">
|
<button size="mini" type="primary" @click="combConfirm('warn')">下架</button>
|
</view>
|
|
|
<!-- 确认组托 -->
|
<view>
|
<uni-popup ref="combConfirm" type="dialog">
|
<uni-popup-dialog :type="msgType" cancelText="取消" confirmText="确认" :title="title" :content="content"
|
@confirm="comb" @close="combClose"></uni-popup-dialog>
|
</uni-popup>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
baseUrl: '',
|
token: '',
|
storeId: 0,
|
store: '',
|
orderNo: '',
|
locNo: '--',
|
seltitle: '取消全选',
|
dataList: [],
|
msgType: 'success',
|
messageText: '',
|
content: '',
|
title: ''
|
}
|
},
|
onShow() {
|
this.baseUrl = uni.getStorageSync('baseUrl');
|
this.token = uni.getStorageSync('token');
|
this.storeId = uni.getStorageSync('store')
|
if (this.storeId == 1) {
|
this.store = '宁波仓'
|
}
|
if (this.storeId == 2) {
|
this.store = '新昌仓'
|
}
|
let that = this
|
const eventChannel = that.getOpenerEventChannel();
|
eventChannel.on('order', function(data) {
|
that.locNo = data.locNo
|
that.orderNo = data.orderNo.orderNo
|
console.log(that.orderNo);
|
that.getLocInfo(data.locNo,data.orderId)
|
})
|
},
|
methods: {
|
back() {
|
uni.navigateBack({})
|
},
|
changeValue(e,item) {
|
item.anfme = e
|
},
|
checkboxChange(e) {
|
let items = this.dataList,
|
values = e.matnr;
|
if (e.checked) {
|
this.$set(e,'checked',false)
|
} else {
|
this.$set(e,'checked',true)
|
}
|
console.log(this.dataList);
|
},
|
getLocInfo(locNo,orderId) {
|
let _this = this
|
uni.request({
|
url: _this.baseUrl + '/mobile/pda/OrderDetlContrastLocDetl',
|
data: {locNo: locNo,orderId: orderId},
|
header: {
|
'token': uni.getStorageSync('token'),
|
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8'
|
},
|
method: 'POST',
|
success(res) {
|
res = res.data
|
if (res.code === 200) {
|
for (let k of res.data) {
|
k['checked'] = true
|
k['maxCount'] = k.anfme
|
}
|
_this.dataList = res.data
|
}
|
}
|
})
|
},
|
allSelect() {
|
if (this.seltitle == '全选') {
|
for (let k of this.dataList) {
|
k.checked = true
|
}
|
this.seltitle = '取消全选'
|
} else {
|
for (let k of this.dataList) {
|
k.checked = false
|
}
|
this.seltitle = '全选'
|
}
|
|
},
|
combConfirm(type) {
|
this.msgType = type
|
this.title = '警告'
|
this.content = '是否现在下架!'
|
this.$refs.combConfirm.open()
|
},
|
combClose() {
|
this.$refs.combConfirm.close()
|
},
|
// 下架
|
comb() {
|
let that = this;
|
if (that.locNo === '') {
|
this.messageText = "请扫描库位号"
|
this.messageToggle('error')
|
return;
|
}
|
if (that.dataList.length === 0) {
|
this.messageText = "请添加商品列表"
|
this.messageToggle('error')
|
return;
|
}
|
let optDataList = []
|
for (let k of that.dataList) {
|
console.log(k);
|
if (k.checked) {
|
optDataList.push(k)
|
}
|
}
|
uni.request({
|
url: that.baseUrl + '/mobile/pda/WarehouseOut',
|
data: JSON.stringify({
|
orderNo: that.orderNo,
|
locno: that.locNo,
|
combMats: optDataList
|
}),
|
method: 'POST',
|
header: {
|
'token': uni.getStorageSync('token')
|
},
|
success(result) {
|
var res = result.data
|
if (res.code === 200) {
|
uni.showToast({ title: res.msg, icon: "success", position: 'top' })
|
setTimeout(()=>{
|
that.getOpenerEventChannel().emit('matList', {});
|
uni.navigateBack({
|
delta: 1, // 返回上一页面
|
})
|
},1500)
|
} else if (res.code == 403) {
|
uni.showToast({ title: res.msg, icon: "error", position: 'top' })
|
setTimeout(() => {
|
uni.reLaunch({
|
url: '../login/login'
|
});
|
}, 1000);
|
} else {
|
uni.showToast({ title: res.msg, icon: "error", position: 'top' })
|
}
|
}
|
});
|
},
|
}
|
}
|
</script>
|
|
<style>
|
@import url('../../static/css/wms.css/wms.css');
|
.mat-list-title {
|
display: flex;
|
align-items: center;
|
height: 80rpx;
|
width: 100%;
|
background-color: white;
|
position: fixed;
|
margin-top: 0;
|
z-index: 9;
|
/* border-top: 1px solid #DCDFE6; */
|
text-align: center;
|
box-shadow: 0px 0px 15px 0px rgba(0, 0, 0, 0.1);
|
}
|
.list_item {
|
margin: 8px;
|
min-height: 40px;
|
border-radius: 8px;
|
display: flex;
|
background-color: #ffffff;
|
}
|
.list_check_box {
|
border-right: 1px solid #e5e5e5;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
padding: 8px;
|
}
|
.list_main {
|
padding: 8px;
|
flex: 1;
|
}
|
.list_fix {
|
border-left: 1px solid #e5e5e5;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
padding: 8px;
|
}
|
.desc_name {
|
font-weight: bold;
|
color: #222;
|
}
|
.desc_connect {
|
color: #333;
|
}
|
</style>
|