<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="code">
|
<view style="display: flex;align-items: center;">
|
<view style="width: 70rpx;padding-left: 20rpx;" @click="changeST">{{searchType}}</view>
|
<view style="flex: 1;margin-left: -8rpx;">
|
<uni-search-bar v-model="searchValue"
|
maxlength="500" ancel="cancel" @confirm="getMatList()" @clear="clear" placeholder="输入 / 扫描">
|
</uni-search-bar>
|
</view>
|
|
</view>
|
<view class="code-title">
|
<view style="flex: 1;"></view>
|
<view style="flex: 1;width: 100%;text-align: center;margin: 16rpx 0;">{{searchValue}} 总数量:- {{total}} -</view>
|
<view style="flex: 1;display: flex;align-items: center;"><button size="mini" type="primary" @click="allSelect()">{{seltitle}}</button></view>
|
</view>
|
</view>
|
|
<view class="order__list" v-for="(orderDetl,index) in dataList" :key="index">
|
<view class="order__list__left">
|
<view>No:{{index + 1}}</view>
|
<view>订单号:{{orderDetl.orderNo}}</view>
|
<view>料号:{{orderDetl.matnr}}</view>
|
<view>料名:{{orderDetl.maktx}}</view>
|
<view>批号:{{orderDetl.batch}}</view>
|
<view>可用数量:{{orderDetl.count}}</view>
|
</view>
|
<view class="order__list__right">
|
<!-- <view class="order__list__right" @click="addItem(orderDetl)"> -->
|
<label @click="checkboxChange(orderDetl)">
|
<checkbox :value="orderDetl.matnr" :checked="orderDetl.checked" style="transform:scale(0.7)" /><text></text>
|
</label>
|
</view>
|
</view>
|
<!-- 底部操作按钮 -->
|
<view class="buttom">
|
<button size="mini" type="primary" @click="addItems()">提取</button>
|
</view>
|
<view style="height: 100rpx;width: 100%;text-align: center;line-height: 100rpx;">- 已经到底了 -</view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
baseUrl: '',
|
token: '',
|
storeId: 0,
|
store: '',
|
total: 0,
|
searchType: '物料',
|
searchValue: '',
|
dataList: [],
|
selectedList: [],
|
seltitle: '全选'
|
}
|
},
|
onShow() {
|
let _this = this
|
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 = '新昌仓'
|
}
|
const eventChannel = this.getOpenerEventChannel();
|
eventChannel.on('matList', function(data) {
|
_this.selectedList = data.matList
|
})
|
this.getMatList()
|
},
|
methods: {
|
back() { uni.navigateBack({}) },
|
checkboxChange(e) {
|
let items = this.dataList,
|
values = e.matnr;
|
if (e.checked) {
|
this.$set(e,'checked',false)
|
} else {
|
this.$set(e,'checked',true)
|
}
|
var count = 0
|
for (let k of items) {
|
if (k.checked) {
|
count++
|
}
|
}
|
if (count == items.length && count > 0) {
|
this.seltitle = '取消全选'
|
} else {
|
this.seltitle = '全选'
|
}
|
},
|
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 = '全选'
|
}
|
|
},
|
set(e) {
|
var ck = this.dataList[e].checked
|
this.dataList[e].checked = ck ? false : true
|
},
|
changeST() {
|
if (this.searchType == '物料') this.searchType = '订单'
|
else this.searchType = '物料'
|
},
|
getMatList() {
|
let that = this
|
let searchParam = {}
|
if (this.searchType == '物料') searchParam = {matnr: that.searchValue}
|
else searchParam = {orderNo: that.searchValue}
|
console.log(searchParam);
|
uni.request({
|
url: that.baseUrl + '/mobile/pick/mat/list',
|
header: {
|
'token': uni.getStorageSync('token')
|
},
|
data: searchParam,
|
method: 'GET',
|
success(res) {
|
res = res.data;
|
if (res.code === 200) {
|
that.total = res.data.length
|
const result1 = res.data.filter(obj1 =>
|
!that.selectedList.some(obj2 => obj1.matnr === obj2.matnr && obj1.orderNo === obj2.orderNo)
|
);
|
that.dataList = result1
|
that.total = result1.length
|
} else if (res.code == 403) {
|
uni.showToast({ title: res.msg, icon: "error", position: 'center' })
|
setTimeout(() => { uni.reLaunch({ url: '../login/login' }); }, 1000);
|
} else {
|
uni.showToast({ title: res.msg, icon: "error", position: 'center' })
|
}
|
}
|
})
|
|
},
|
addItems() {
|
let pickList = []
|
for (let k of this.dataList) {
|
if (k.checked) {
|
pickList.push(k)
|
}
|
}
|
this.getOpenerEventChannel().emit('pickList', {data: pickList});
|
uni.navigateBack({
|
|
})
|
},
|
// addItem(mat) {
|
// this.getOpenerEventChannel().emit('sMat', {data: mat});
|
// uni.navigateBack({
|
|
// })
|
// }
|
}
|
}
|
</script>
|
|
<style>
|
@import url('../../static/css/wms.css/wms.css');
|
.code {
|
background-color: #d9d9d9;
|
z-index: 99;
|
position: sticky;
|
top: 0rpx;
|
left: 0;
|
}
|
.code-title {
|
display: flex;
|
}
|
.order__list {
|
margin: 20rpx;
|
font-size: 14px;
|
background-color: #fff;
|
border-radius: 20rpx;
|
border: 1px solid #eeeeee;
|
display: flex;
|
position: relative;
|
background-color: #3eb689;
|
color: #FFF;
|
}
|
.order__list__left {
|
flex: 1;
|
padding: 20rpx;
|
position: relative;
|
}
|
.order__list__right {
|
width: 70rpx;
|
border-left: 1px solid #eeeeee;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
}
|
</style>
|