287 lines
8.5 KiB
Vue
Raw Normal View History

2025-03-11 17:57:17 +08:00
<template>
<view>
<u-navbar back-text="返回" title="销售出库确认" :background="background"></u-navbar>
<u-form ref="testForm">
<u-form-item :border-bottom="false">
<p>单号:</p>
<u-select v-model="dlistShow" mode="single-column" value-name="id" :list="dlist"
@confirm="selShipRequestName" confirm-text="确认选择" class="single-out" />
<u-input :focus="focusShipRequest" :border="true" v-model="ShipRequestName" placeholder="请输入单号"
@confirm="serachMaterialList" />
<u-button @click="selectShipRequestName" type="primary" size="mini">选择单号</u-button>
</u-form-item>
<u-form-item :border-bottom="false">
<p>条码:</p>
<u-input :border="true" v-model="barCode" placeholder="请扫描条码" :focus="focusBarCode"
@confirm="confirmBarcode" />
</u-form-item>
</u-form>
<!-- <uni-table ref="ConfirmTable" border stripe type="false" height="650" style="width: 100%" emptyText="暂无更多数据"
virtualScroll>
<uni-tr>
<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-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 BoxInfoList" :key="index"
:style="{ backgroundColor: item.ISCHECK != '' ? 'yellowgreen' : 'white' }">
<uni-td align="center">{{ item.MATERIALPACKINGNAME}}</uni-td>
<uni-td align="center">{{ item.CHARGE}}</uni-td>
<uni-td align="center">{{ item.MATERIALSPECNAME}}</uni-td>
<uni-td align="center">{{ item.DES_CN}}</uni-td>
<uni-td align="center">{{ item.SDK_SPEC}}</uni-td>
<uni-td align="center">{{ item.PHASE }}</uni-td>
<uni-td align="center">{{ item.ERPLOCATION }}</uni-td>
<uni-td align="center">{{ item.LOCATIONNAME }}</uni-td>
<uni-td align="center">{{ item.MATERIALQUANTITY }}</uni-td>
<uni-td align="center">{{ item.ISCHECK }}</uni-td>
</uni-tr>
</uni-table>-->
<!-- fit 列的宽度是否自撑开 -->
<view>
<zb-table
style="height: 600upx;"
ref="zbTable"
:show-header="true"
:columns="column"
:stripe="true"
:fit="false"
:highlight="true"
:border="true"
:data="BoxInfoList"
:isShowLoadMore="true"
:cell-style="cellStyleFn"
@pullUpLoading="pullUpLoading"
:pullUpLoading="pullUp"
></zb-table>
</view>
<uni-load-more class="font-more" iconType="auto" :status="moreStatus" v-show="BoxInfoList.length && totalAll < pageSize" />
<u-form>
<u-form-item>
<u-button @click="ConfirmButton" type="primary" size="mini" :disabled="disableButton"
style="background-color: green;width: 80%;">发货确认</u-button>
</u-form-item>
</u-form>
</view>
</template>
<script>
export default {
data() {
return {
column:[ //列
// width:180
{ name: 'MATERIALPACKINGNAME', label: '条码',fixed:true,width:170},
{ name: 'CHARGE', label: '批次',align:'right'},
{ name: 'MATERIALSPECNAME', label: '料号'},
{ name: 'DES_CN', label: '品名'},
{ name: 'SDK_SPEC', label: '规格' },
{ name: 'PHASE', label: '阶段',sorter:true },
{ name: 'ERPLOCATION', label: '库位' },
{ name: 'LOCATIONNAME', label: '货架' },
{ name: 'MATERIALQUANTITY', label: '数量',sorter:true},
{ name: 'ISCHECK', label: '校验标识' }
],
pageNum: 1, // 页数
pageSize: 8, // 条数
total: 0, //每页总数
totalAll:0,
moreStatus:'more', // 上拉加载更多 more加载前 loading加载中 no-more没有更多数据
flag: true, // 上拉加载开关 防止一次触底查询多次问题,防止数据查完后触底还调接口问题
dlist: [{
id: '',
label: ''
}], //选择内容
dlistShow: false, //是否显示选择框
BoxInfoList: [],
ShipRequestName: "",
shipRequestType: "",
barCode: "",
userId: "",
siteName: "",
background: {
backgroundImage: 'linear-gradient(45deg, rgb(28, 187, 180), rgb(141, 198, 63))'
},
focusBarCode: false, //焦点是否被选中
focusShipRequest: true, //默认焦点在单号
disableButton : false,
}
},
mounted() {
this.tabH = this.$GetRemainingHeight(4, 0); //定义表格的高度
let that = this
uni.getStorage({
key: "siteName",
success(res) {
that.siteName = res.data
}
})
uni.getStorage({
key: "userid",
success(res) {
that.userId = res.data
}
})
},
methods: {
// 设置是否审核的颜色状态
cellStyleFn({row, column, rowIndex, columnIndex}) {
return {backgroundColor: row.ISCHECK != '' ? 'yellowgreen' : 'white'}
},
// 上拉刷新
pullUp(done) {
if(this.flag) {
// this.moreStatus = 'loading' //加载中时的状态 转圈
this.serachMaterialList()
done('')
this.moreStatus = 'more'
}else {
this.moreStatus = 'no-more'
done('ok')
}
},
pullUpLoading(){
// this.$refs.zbTable.pullUpCompleteLoading('ok')
},
selShipRequestName(e) {
this.BoxInfoList = []
this.pageNum = 1
this.ShipRequestName = e[0].value;
this.serachMaterialList();
},
serachMaterialList() {
this.$MyRequest('/invoice/getShipReservedBoxInfo', {
ShipRequestName: this.ShipRequestName,
pageSize: this.pageSize,
pageNum: this.pageNum
}).then(res => {
// 开始
this.flag = true
if (res.data.success) {
const result = res.data.resultObj.list || [];
const totalAll = res.data.resultObj.total;
this.BoxInfoList = this.BoxInfoList.concat(result);
if (result.length == 0 && this.pageNum == 1) {
this.flag = false
} else {
this.pageNum += 1
this.total = result ? result.length : 0
console.log(this.total,this.pageSize)
if (this.total < this.pageSize) {
this.flag = false
}
}
} else {
uni.showToast({
title: res.data.message,
icon: 'none'
});
}
this.focusBarCode = true
this.focusShipRequest = false
}).catch(err => {
this.$showMessage(err)
})
},
tableRowStyleName({
row
}) {
if (row.ISCHECK == 'Y') {
return 'background-color: yellowgreen;';
}
},
selectShipRequestName() {
this.dlist = [];
this.$MyRequest('/invoice/getShipList', {
ShipRequestName: this.ShipRequestName,
shipRequestType: "4C"
}).then(res => {
if (res.data.success) {
for (var i = 0; i < res.data.resultObj.length; i++) {
console.log(res.data.resultObj[i].SHIPREQUESTNAME)
this.dlist.push({
id: res.data.resultObj[i].SHIPREQUESTNAME,
label: res.data.resultObj[i].SHIPREQUESTNAME
});
}
console.log(this.dlist[0].id + "############################################");
this.dlistShow = true;
} else {
this.$showMessage(res.data.message)
}
}).catch(err => {
this.$showMessage(err)
})
},
confirmBarcode() {
let list = this.BoxInfoList;
console.log(list)
this.focusBarCode = false
for (var i = 0; i < list.length; ++i) {
var LbarCode = this.barCode;
console.log(LbarCode)
if (this.BoxInfoList[i]['MATERIALPACKINGNAME'] === LbarCode) {
this.BoxInfoList[i]['ISCHECK'] = "Y"
this.barCode = ""
}
this.focusBarCode = true
}
},
ConfirmButton() {
this.disableButton = true;
let list = this.BoxInfoList;
if (list <= 0) {
this.$showMessage("不存在需要提交的信息")
this.disableButton = false;
return;
}
for (var i = 0; i < list.length; ++i) {
var judge = this.BoxInfoList[i]['ISCHECK']
if (judge != "Y") {
this.disableButton = false;
this.$showMessage("存在未审核确认的信息")
return;
}
}
this.$MyRequest('/invoice/commitShipRequestName', {
ShipRequestName: this.ShipRequestName,
user: this.userId,
siteName: this.siteName
}).then(res => {
this.$showMessage(res.data.message) //执行出库后返回的消息
this.BoxInfoList = null; //清空条码,继续扫
this.focusShipRequest = true //获取焦点,好继续扫描
this.disableButton = false;
}).catch(err => {
this.BoxInfoList = null; //请空条码
this.focusShipRequest = true
this.disableButton = false;
this.$showMessage(err)
})
}
}
}
</script>
<style>
.single-out {
pointerEvents: "none"
}
</style>