<template>
|
<view class="page-container">
|
<!-- 顶部固定区域 -->
|
<view class="form-section">
|
<!-- 订单号 -->
|
<view class="form-item">
|
<view class="form-label">
|
<uni-icons type="staff" size="18" color="#667eea"></uni-icons>
|
<text class="label-text">订单号</text>
|
</view>
|
<view class="form-input-wrap">
|
<input class="form-input" type="text" placeholder="扫码 / 输入订单号" v-model="orderNo"
|
:focus="orderNoFocus" disabled />
|
</view>
|
</view>
|
|
<!-- 托盘码 -->
|
<view class="form-item">
|
<view class="form-label">
|
<uni-icons type="scan" size="18" color="#667eea"></uni-icons>
|
<text class="label-text">托盘码</text>
|
</view>
|
<view class="form-input-wrap">
|
<input class="form-input" type="text" placeholder="扫码 / 输入托盘码" v-model="barcode"
|
:focus="barcodeFocus" @input="barcodeInput()" />
|
<uni-icons v-if="barcode" type="clear" size="20" color="#c0c4cc" @click="clearBarcode"></uni-icons>
|
</view>
|
</view>
|
|
<!-- 物料码 -->
|
<view class="form-item">
|
<view class="form-label">
|
<uni-icons type="list" size="18" color="#667eea"></uni-icons>
|
<text class="label-text">物料码</text>
|
</view>
|
<view class="form-input-wrap">
|
<input class="form-input" type="text" placeholder="扫码复核物料" v-model="matnr"
|
:focus="matFocus" @input="findMat()" />
|
</view>
|
</view>
|
</view>
|
|
<!-- 商品列表标题 -->
|
<view class="list-header">
|
<view class="header-left">
|
<text class="header-title">商品列表</text>
|
<view class="count-badge" v-if="dataList.length > 0">
|
<text class="count-text">{{dataList.length}}</text>
|
</view>
|
</view>
|
<view class="header-right">
|
<text class="review-status">已复核: {{reviewedCount}} / {{dataList.length}}</text>
|
</view>
|
</view>
|
|
<!-- 商品列表 -->
|
<view class="list-container">
|
<view class="mat-card" v-for="(item, i) in dataList" :key="i">
|
<!-- 卡片头部 -->
|
<view class="card-top">
|
<view class="card-index">{{i + 1}}</view>
|
<view class="mat-code-wrap">
|
<text class="mat-code">{{item.matnr}}</text>
|
</view>
|
<view class="review-badge" :class="item.review === '已复核' ? 'reviewed' : 'unreviewed'">
|
<text class="badge-text">{{item.review}}</text>
|
</view>
|
</view>
|
|
<!-- 卡片内容 -->
|
<view class="card-content">
|
<view class="info-row">
|
<view class="info-col">
|
<text class="info-label">品名</text>
|
<text class="info-value">{{item.maktx || '-'}}</text>
|
</view>
|
</view>
|
<view class="info-row">
|
<view class="info-col half">
|
<text class="info-label">规格</text>
|
<text class="info-value">{{item.specs || '-'}}</text>
|
</view>
|
<view class="info-col half">
|
<text class="info-label">批号</text>
|
<text class="info-value highlight">{{item.batch || '-'}}</text>
|
</view>
|
</view>
|
<view class="info-row">
|
<view class="info-col half">
|
<text class="info-label">数量</text>
|
<text class="info-value qty">{{item.anfme}}</text>
|
</view>
|
</view>
|
</view>
|
|
<!-- 卡片操作 -->
|
<view class="card-actions">
|
<view class="action-btn edit-btn" @click="revise(item, i)">
|
<uni-icons type="compose" size="18" color="#667eea"></uni-icons>
|
<text class="action-text">修改</text>
|
</view>
|
<view class="action-btn delete-btn" @click="remove(item, i, 'warn')">
|
<uni-icons type="trash" size="18" color="#f56c6c"></uni-icons>
|
<text class="action-text delete-text">移除</text>
|
</view>
|
</view>
|
</view>
|
|
<!-- 空状态 -->
|
<view class="empty-state" v-if="dataList.length === 0">
|
<uni-icons type="cart" size="60" color="#CCCCCC"></uni-icons>
|
<text class="empty-text">暂无商品</text>
|
<text class="empty-hint">请从订单明细选择商品</text>
|
</view>
|
|
<!-- 底部占位 -->
|
<view class="bottom-placeholder"></view>
|
</view>
|
|
<!-- 底部操作按钮 -->
|
<view class="bottom-bar">
|
<view class="btn-reset" @click="reset('warn')">
|
<uni-icons type="refresh" size="18" color="#909399"></uni-icons>
|
<text class="btn-text">重置</text>
|
</view>
|
<view class="btn-submit" :class="{'btn-disabled': isDisabled || dataList.length === 0}"
|
@click="combConfirm('warn')">
|
<uni-icons type="checkbox" size="18" color="#ffffff"></uni-icons>
|
<text class="btn-text">确认组托</text>
|
</view>
|
</view>
|
|
<!-- 弹窗区域 -->
|
<!-- 修改数量 -->
|
<uni-popup ref="revise" type="dialog">
|
<view class="popup-card">
|
<view class="popup-header">
|
<text class="popup-title">修改信息</text>
|
</view>
|
<view class="popup-body">
|
<view class="popup-row">
|
<text class="popup-label">编码</text>
|
<view class="popup-value disabled">{{matnr}}</view>
|
</view>
|
<view class="popup-row">
|
<text class="popup-label">批号</text>
|
<input class="popup-value input" type="text" v-model="batch" placeholder="输入批号" />
|
</view>
|
<view class="popup-row">
|
<text class="popup-label">数量</text>
|
<view class="popup-value number">
|
<uni-number-box :value="count" :step='0.001' :max="9999999" color="#747474" @change="changeValue" />
|
</view>
|
</view>
|
</view>
|
<view class="popup-footer">
|
<view class="popup-btn cancel" @click="reviseClose">取消</view>
|
<view class="popup-btn confirm" @click="reviseConfirm()">确认</view>
|
</view>
|
</view>
|
</uni-popup>
|
|
<!-- 移除确认 -->
|
<uni-popup ref="alertDialog" type="dialog">
|
<uni-popup-dialog :type="msgType" confirmText="移除" :title="title" :content="content"
|
@confirm="removeConfirm()" @close="removeClose"></uni-popup-dialog>
|
</uni-popup>
|
|
<!-- 提示信息弹窗 -->
|
<uni-popup ref="message" type="message">
|
<uni-popup-message :type="msgType1" :message="messageText" :duration="2000"></uni-popup-message>
|
</uni-popup>
|
|
<!-- 确认组托 -->
|
<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>
|
|
<!-- 确认重置 -->
|
<uni-popup ref="resetConfirm" type="dialog">
|
<uni-popup-dialog :type="msgType" cancelText="取消" confirmText="确认" :title="title" :content="content"
|
@confirm="resetConfirm" @close="resetClose"></uni-popup-dialog>
|
</uni-popup>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
data() {
|
return {
|
baseUrl: '',
|
token: '',
|
barcode: '',
|
orderNo: '',
|
dataList: [],
|
count: 0,
|
rowNum: '',
|
matnr: '',
|
batch: '',
|
weight: '',
|
msgType1: 'success',
|
msgType: 'success',
|
messageText: '',
|
title: '',
|
content: '',
|
orderNoFocus: false,
|
barcodeFocus: true,
|
matFocus: false,
|
matData: '',
|
removeNum: 0,
|
isDisabled: false
|
}
|
},
|
computed: {
|
// 已复核数量
|
reviewedCount() {
|
return this.dataList.filter(item => item.review === '已复核').length;
|
}
|
},
|
onLoad() {
|
let that = this;
|
const eventChannel = this.getOpenerEventChannel();
|
if (eventChannel) {
|
eventChannel.on('orderItem', function(data) {
|
that.orderNo = data.item.orderNo;
|
that.checkMat(data.item);
|
});
|
}
|
},
|
onShow() {
|
this.baseUrl = uni.getStorageSync('baseUrl');
|
this.token = uni.getStorageSync('token');
|
},
|
methods: {
|
messageToggle(type) {
|
this.msgType1 = type;
|
this.$refs.message.open();
|
},
|
clearBarcode() {
|
this.barcode = '';
|
this.barcodeFocus = false;
|
setTimeout(() => {
|
this.barcodeFocus = true;
|
}, 100);
|
},
|
clearOrderNo() {
|
this.orderNo = '';
|
let that = this;
|
that.orderNoFocus = false;
|
setTimeout(() => {
|
that.orderNo = '';
|
that.orderNoFocus = true;
|
}, 100);
|
},
|
orderNoInput() {
|
setTimeout(() => {
|
var len = this.orderNo.length;
|
this.barcodeFocuss();
|
}, 200);
|
},
|
barcodeInput() {
|
setTimeout(() => {
|
var len = this.barcode.length;
|
this.focuss();
|
}, 200);
|
},
|
barcodeFocuss() {
|
let that = this;
|
that.barcodeFocus = false;
|
setTimeout(() => {
|
that.barcode = '';
|
that.barcodeFocus = true;
|
}, 100);
|
},
|
focuss() {
|
this.focus = false;
|
setTimeout(() => {
|
this.matnr = '';
|
this.matFocus = true;
|
}, 100);
|
},
|
// 搜索物料 - 扫码复核
|
findMat() {
|
let that = this;
|
let m = that.matnr.split(";");
|
let matnr1 = m[0].slice(3);
|
let found = false;
|
for (var i = 0; i < that.dataList.length; i++) {
|
if (that.dataList[i].matnr === matnr1) {
|
that.dataList[i].review = "已复核";
|
found = true;
|
}
|
}
|
if (found) {
|
that.messageText = "复核成功";
|
that.messageToggle('success');
|
}
|
setTimeout(() => {
|
this.matnr = '';
|
}, 100);
|
},
|
selectMat() {
|
let that = this;
|
uni.navigateTo({
|
url: "../mat/matQuery",
|
success: function(res) {
|
res.eventChannel.emit('commonUrl', {
|
commonUrl: ''
|
});
|
},
|
events: {
|
acceptDataFromOpenedPage: function(data) {
|
that.matnr = data.data;
|
that.findMat(that.matnr);
|
},
|
},
|
});
|
that.matnr = '';
|
},
|
checkMat(mat) {
|
mat.review = "未复核";
|
mat.anfme = mat.enableQty;
|
var len = this.dataList.length;
|
var add = true, sameItem = false;
|
for (var i = 0; i < len; i++) {
|
if (mat.matnr == this.dataList[i].matnr) {
|
for (var j = 0; j < len; j++) {
|
if (mat.batch == this.dataList[j].batch) {
|
sameItem = true;
|
}
|
}
|
if (mat.batch != this.dataList[i].batch) {
|
this.$forceUpdate();
|
if (sameItem) {
|
add = false;
|
} else {
|
add = true;
|
}
|
} else {
|
this.dataList[i].anfme += mat.anfme;
|
this.$forceUpdate();
|
add = false;
|
}
|
}
|
}
|
if (add) {
|
this.dataList.unshift(mat);
|
}
|
},
|
// 修改
|
revise(item, i) {
|
this.matnr = this.dataList[i].matnr;
|
this.count = this.dataList[i].anfme;
|
this.batch = this.dataList[i].batch;
|
this.weight = this.dataList[i].weight;
|
this.rowNum = i;
|
this.eject();
|
},
|
eject(type) {
|
this.type = type;
|
this.$refs.revise.open(type);
|
},
|
// 列表移除按钮
|
remove(item, i, type) {
|
this.removeNum = i;
|
this.msgType = type;
|
this.title = '确认移除';
|
this.content = '是否移除该商品?';
|
this.$refs.alertDialog.open(i);
|
},
|
// 确认移除
|
removeConfirm() {
|
this.messageText = "移除成功";
|
this.messageToggle('success');
|
this.dataList.splice(this.removeNum, 1);
|
},
|
// 取消移除
|
removeClose() {
|
this.$refs.alertDialog.close();
|
},
|
reviseConfirm() {
|
this.dataList[this.rowNum].anfme = this.count;
|
this.dataList[this.rowNum].batch = this.batch;
|
this.dataList[this.rowNum].weight = this.weight;
|
this.matnr = '';
|
this.messageText = "修改成功";
|
this.messageToggle('success');
|
this.$refs.revise.close();
|
},
|
reviseClose() {
|
this.$refs.revise.close();
|
},
|
changeValue(value) {
|
this.count = value;
|
},
|
combConfirm(type) {
|
if (this.isDisabled || this.dataList.length === 0) return;
|
this.msgType = type;
|
this.title = '确认组托';
|
this.content = '确认将商品组托入库?';
|
this.$refs.combConfirm.open();
|
},
|
combClose() {
|
this.$refs.combConfirm.close();
|
},
|
comb() {
|
let that = this;
|
that.isDisabled = true;
|
if (that.orderNo === '') {
|
this.messageText = "请输入订单号";
|
this.messageToggle('error');
|
that.isDisabled = false;
|
return;
|
}
|
if (that.barcode === '') {
|
this.messageText = "请扫描托盘码";
|
this.messageToggle('error');
|
that.isDisabled = false;
|
return;
|
}
|
if (that.dataList.length === 0) {
|
this.messageText = "请添加商品";
|
this.messageToggle('error');
|
that.isDisabled = false;
|
return;
|
}
|
uni.request({
|
url: that.baseUrl + '/mobile/comb/auth',
|
data: JSON.stringify({
|
orderNo: that.orderNo,
|
barcode: that.barcode,
|
combMats: that.dataList
|
}),
|
method: 'POST',
|
header: {
|
'token': uni.getStorageSync('token')
|
},
|
success(result) {
|
var res = result.data;
|
if (res.code === 200) {
|
that.resst();
|
that.messageText = "组托成功";
|
that.messageToggle('success');
|
const innerAudioContext = uni.createInnerAudioContext();
|
innerAudioContext.src = '/static/music/pakinOk.mp3';
|
innerAudioContext.play();
|
// 返回上一页
|
setTimeout(() => {
|
uni.navigateBack();
|
}, 1500);
|
} else if (res.code == 403) {
|
that.messageText = res.msg;
|
that.messageToggle('error');
|
setTimeout(() => {
|
uni.reLaunch({ url: '../login/login' });
|
}, 1000);
|
} else {
|
that.messageText = res.msg;
|
that.messageToggle('error');
|
}
|
},
|
fail: () => {
|
that.messageText = "网络请求超时";
|
that.messageToggle('error');
|
},
|
complete: () => {
|
that.isDisabled = false;
|
}
|
});
|
},
|
reset(type) {
|
this.msgType = type;
|
this.title = '确认重置';
|
this.content = '是否清空所有商品?';
|
this.$refs.resetConfirm.open();
|
},
|
// 确认重置
|
resetConfirm() {
|
this.dataList = [];
|
this.barcode = '';
|
this.messageText = "重置完成";
|
this.messageToggle('success');
|
},
|
// 取消重置
|
resetClose() {},
|
// 清空
|
resst() {
|
this.orderNo = '';
|
this.dataList = [];
|
this.barcode = '';
|
let that = this;
|
that.orderNoFocus = false;
|
setTimeout(() => {
|
that.orderNo = '';
|
that.orderNoFocus = true;
|
}, 100);
|
},
|
}
|
}
|
</script>
|
|
<style>
|
/* 引入公共样式 */
|
@import url('../../static/css/common.css');
|
@import url('../../static/css/wms.css/wms.css');
|
|
|
|
.header-right {
|
display: flex;
|
align-items: center;
|
}
|
|
.review-status {
|
font-size: 22rpx;
|
color: #909399;
|
}
|
|
.review-badge {
|
padding: 4rpx 12rpx;
|
border-radius: 16rpx;
|
}
|
|
.reviewed {
|
background: #28a745;
|
}
|
|
.unreviewed {
|
background: rgba(255, 255, 255, 0.3);
|
}
|
|
.badge-text {
|
font-size: 20rpx;
|
color: #ffffff;
|
}
|
|
.empty-state {
|
padding: 60rpx 0;
|
}
|
</style>
|