406 lines
9.8 KiB
Vue
406 lines
9.8 KiB
Vue
|
<template>
|
|||
|
<!--
|
|||
|
add by 胡传文 2021-01-06
|
|||
|
供应商退货
|
|||
|
-->
|
|||
|
<uni-base-page>
|
|||
|
<view slot="page">
|
|||
|
<uni-input-row title="日期" type="date"
|
|||
|
:isTime="false" labelWidth="50px"
|
|||
|
v-model="ruKuDate" @change="onRuKuDateChange($event)"
|
|||
|
showButton buttonVal="选单" buttonWidth="100px" buttonType="default" buttonColor="#4cd964" buttonlabColor="#fff" @buttonClick="onRuKuDateClick"/>
|
|||
|
<uni-input-row title="单号" labelWidth="50px" type="combox" v-model="cmbBillNoSelValue" :range="cmbBillNoGroup" rangeKey="value" rangeVal="text"
|
|||
|
@change="onBillNoChange($event)" :clearable="true" placeholder="请选择单号"
|
|||
|
showButton buttonVal="拆" buttonWidth="75px" buttonlabColor="#fff" @buttonClick="onSplitBarcodeClick"/>
|
|||
|
<uni-lr-row :layout="70">
|
|||
|
<uni-input-row slot="left" labelWidth="50px" title="条码" v-model="BarCode" canScan="true"
|
|||
|
:focus="focusBarCode" @resetFocus="e=>{focusBarCode=e}"
|
|||
|
@confirm="onBarCodeConfirm($event)" placeholder="请扫描条码"/>
|
|||
|
<uni-input-row slot="right" type="switch" v-model="switchResults" :range="switchType" rangeKey="value" rangeVal="name"/>
|
|||
|
</uni-lr-row>
|
|||
|
<uni-segmented-control :isBadge="true" :badge="badge" :current="current" :values="items" @clickItem="onClickItem"></uni-segmented-control>
|
|||
|
<view v-show="current === 0">
|
|||
|
<uni-z-table :style="{'height': tabH+'px'}"
|
|||
|
:tableData="matTableData"
|
|||
|
:columns="matColumns"
|
|||
|
:showBottomSum="true"
|
|||
|
:rowNumbers="true"
|
|||
|
:pagination="true"
|
|||
|
@onSelect="onSelectMatTb">
|
|||
|
</uni-z-table>
|
|||
|
</view>
|
|||
|
<view v-show="current === 1">
|
|||
|
<uni-z-table :style="{'height': tabH+'px'}"
|
|||
|
:tableData="KwTableData"
|
|||
|
:columns="KwColumns"
|
|||
|
:rowNumbers="true"
|
|||
|
:pagination="true">
|
|||
|
</uni-z-table>
|
|||
|
</view>
|
|||
|
<view v-show="current === 2">
|
|||
|
<uni-z-table :style="{'height': tabH+'px'}"
|
|||
|
:tableData="SmTableData"
|
|||
|
:columns="SmColumns"
|
|||
|
:rowNumbers="true"
|
|||
|
:pagination="true">
|
|||
|
</uni-z-table>
|
|||
|
</view>
|
|||
|
</view>
|
|||
|
</uni-base-page>
|
|||
|
</template>
|
|||
|
|
|||
|
<script>
|
|||
|
export default {
|
|||
|
data() {
|
|||
|
//这里是我们要存放的变量
|
|||
|
return {
|
|||
|
tabH: 800,
|
|||
|
current: 0,
|
|||
|
badge:[0,0,0],//分段器标签值
|
|||
|
ruKuDate:"", //日期
|
|||
|
cmbBillNoSelValue: {}, //单号选择项
|
|||
|
cmbBillNoGroup: [], //单号集合
|
|||
|
BarCode: "", //条码
|
|||
|
focusBarCode: true,
|
|||
|
waitySendQty: 0,
|
|||
|
IsOutProcess: '0', //1-委外加工;0-不委外加工
|
|||
|
materialId: "", //物料编号
|
|||
|
BillType: "", //单据类型
|
|||
|
switchResults:{},//开关选择结果
|
|||
|
switchType:[
|
|||
|
{value:'Y',name:"取消"},
|
|||
|
{value:'N',name:"使用"},
|
|||
|
],//开关数据源
|
|||
|
|
|||
|
items: ['物料明细','库位列表','已扫描列表'],//分段器集合
|
|||
|
|
|||
|
matColumns: [
|
|||
|
{
|
|||
|
title:'物料编号',
|
|||
|
field: "DKB003",
|
|||
|
width: 200,
|
|||
|
sort: true,
|
|||
|
},
|
|||
|
{
|
|||
|
title:'应退数量',
|
|||
|
field: "DKB006",
|
|||
|
width: 120,
|
|||
|
sort: true,
|
|||
|
align: "right"
|
|||
|
},
|
|||
|
{
|
|||
|
title:'实退数量',
|
|||
|
field: "DKB007",
|
|||
|
width: 120,
|
|||
|
sort: true,
|
|||
|
align: "right"
|
|||
|
},
|
|||
|
{
|
|||
|
title:'物料名称',
|
|||
|
field: "DKB004",
|
|||
|
width: 200,
|
|||
|
sort: true,
|
|||
|
},
|
|||
|
{
|
|||
|
title:'物料规格',
|
|||
|
field: "DKB005",
|
|||
|
width: 200,
|
|||
|
sort: true,
|
|||
|
}
|
|||
|
],//物料明细--表格列数据
|
|||
|
matTableData: [],//物料明细--表格数据源
|
|||
|
|
|||
|
KwColumns: [
|
|||
|
{
|
|||
|
title:'仓库',
|
|||
|
field: "DAB002",
|
|||
|
width: 200,
|
|||
|
sort: true,
|
|||
|
},
|
|||
|
{
|
|||
|
title:'库位',
|
|||
|
field: "DAB003",
|
|||
|
width: 300,
|
|||
|
sort: true,
|
|||
|
}
|
|||
|
],//库位列表--表格列数据
|
|||
|
KwTableData: [],//库位列表--表格数据源
|
|||
|
|
|||
|
SmColumns: [
|
|||
|
{
|
|||
|
title:'条码',
|
|||
|
field: "DKC004",
|
|||
|
width: 250,
|
|||
|
sort: true,
|
|||
|
},
|
|||
|
{
|
|||
|
title:'物料编码',
|
|||
|
field: "DKC005",
|
|||
|
width: 200,
|
|||
|
sort: true,
|
|||
|
},
|
|||
|
{
|
|||
|
title:'数量',
|
|||
|
field: "DKC008",
|
|||
|
width: 100,
|
|||
|
sort: true,
|
|||
|
align: "right"
|
|||
|
},
|
|||
|
{
|
|||
|
title:'物料名称',
|
|||
|
field: "DKC006",
|
|||
|
width: 200,
|
|||
|
sort: true,
|
|||
|
},
|
|||
|
{
|
|||
|
title:'物料规格',
|
|||
|
field: "DKC007",
|
|||
|
width: 350,
|
|||
|
sort: true,
|
|||
|
},
|
|||
|
{
|
|||
|
title:'扫描人员',
|
|||
|
field: "DKC009",
|
|||
|
width: 150,
|
|||
|
sort: true,
|
|||
|
},
|
|||
|
{
|
|||
|
title:'扫描时间',
|
|||
|
field: "DKC010",
|
|||
|
width: 300,
|
|||
|
sort: true,
|
|||
|
}
|
|||
|
],//库位列表--表格列数据
|
|||
|
SmTableData: [],//库位列表--表格数据源
|
|||
|
}
|
|||
|
},
|
|||
|
//页面加载后默认执行的固定方法
|
|||
|
mounted() {
|
|||
|
this.tabH = this.$GetRemainingHeight(4,0); //定义表格的高度
|
|||
|
this.init();
|
|||
|
},
|
|||
|
methods: {
|
|||
|
//页面初始化方法
|
|||
|
init() {
|
|||
|
this.badge.splice(0,1,0);
|
|||
|
this.badge.splice(1,1,0);
|
|||
|
this.badge.splice(2,1,0);
|
|||
|
this.GetBillNoList();
|
|||
|
},
|
|||
|
onClickItem(e) {
|
|||
|
if (this.current !== e.currentIndex) {
|
|||
|
this.current = e.currentIndex;
|
|||
|
if (this.current==0) {
|
|||
|
|
|||
|
}
|
|||
|
else if (this.current==1) {
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
},
|
|||
|
//获取单号
|
|||
|
GetBillNoList() {
|
|||
|
// console.log('日期'+this.ruKuDate+'日期');
|
|||
|
// console.log(this.IsOutProcess);
|
|||
|
this.$uni_request({
|
|||
|
url: '/PURDKA/GetBillNo',
|
|||
|
data: {
|
|||
|
date: this.ruKuDate,
|
|||
|
IsWW: this.IsOutProcess
|
|||
|
},
|
|||
|
success: (res)=>{
|
|||
|
// console.log(JSON.stringify(res.data));
|
|||
|
this.cmbBillNoGroup = res.data;
|
|||
|
|
|||
|
this.BarCode = "";
|
|||
|
this.focusBarCode = true;
|
|||
|
},
|
|||
|
fail:(res)=>{
|
|||
|
this.cmbBillNoGroup = [];
|
|||
|
this.cmbBillNoSelValue.index = -1;
|
|||
|
this.$showMessage(res.message);
|
|||
|
}
|
|||
|
});
|
|||
|
},
|
|||
|
//日期选择
|
|||
|
onRuKuDateChange() {
|
|||
|
this.GetBillNoList();
|
|||
|
},
|
|||
|
//选单按钮点击
|
|||
|
onRuKuDateClick() {
|
|||
|
this.GetBillNoList();
|
|||
|
},
|
|||
|
//获取物料明细
|
|||
|
GetMaterialData() {
|
|||
|
this.$uni_request({
|
|||
|
url: '/PURDKA/GetMaterialData',
|
|||
|
data: {
|
|||
|
DKB001: this.cmbBillNoSelValue.key,
|
|||
|
IsWW: this.IsOutProcess
|
|||
|
},
|
|||
|
success: (res)=>{
|
|||
|
// console.log(JSON.stringify(res.data));
|
|||
|
this.matTableData = res.data.tbData;
|
|||
|
if (this.matTableData.length>0) {
|
|||
|
this.materialId = this.matTableData[0].DKB003;
|
|||
|
}
|
|||
|
else {
|
|||
|
this.materialId = '';
|
|||
|
}
|
|||
|
this.BillType = res.data.BillType;
|
|||
|
this.GetKuWeiData(this.materialId);
|
|||
|
},
|
|||
|
fail:(res)=>{
|
|||
|
this.matTableData = [];
|
|||
|
this.$showMessage(res.message);
|
|||
|
}
|
|||
|
});
|
|||
|
},
|
|||
|
//获取库位信息
|
|||
|
GetKuWeiData(matId) {
|
|||
|
this.$uni_request({
|
|||
|
url: '/PURDKA/GetKuWeiData',
|
|||
|
data: {
|
|||
|
materialId: matId,
|
|||
|
BillType: this.BillType
|
|||
|
},
|
|||
|
success: (res)=>{
|
|||
|
// console.log(JSON.stringify(res.data));
|
|||
|
this.KwTableData = res.data;
|
|||
|
},
|
|||
|
fail:(res)=>{
|
|||
|
this.KwTableData = [];
|
|||
|
this.$showMessage(res.message);
|
|||
|
}
|
|||
|
});
|
|||
|
},
|
|||
|
//获取已扫描条码列表
|
|||
|
GetBarCodeList() {
|
|||
|
this.$uni_request({
|
|||
|
url: '/PURDKA/GetBarCodeList',
|
|||
|
data: {
|
|||
|
BillNo: this.cmbBillNoSelValue.key
|
|||
|
},
|
|||
|
success: (res)=>{
|
|||
|
// console.log(JSON.stringify(res.data));
|
|||
|
this.SmTableData = res.data;
|
|||
|
},
|
|||
|
fail:(res)=>{
|
|||
|
this.$showMessage(res.message);
|
|||
|
}
|
|||
|
});
|
|||
|
},
|
|||
|
//获取相关数据
|
|||
|
GetData() {
|
|||
|
this.GetMaterialData();
|
|||
|
this.GetBarCodeList();
|
|||
|
},
|
|||
|
//单号选择
|
|||
|
onBillNoChange() {
|
|||
|
if (this.cmbBillNoSelValue.key != '') {
|
|||
|
this.matTableData = [];
|
|||
|
this.KwTableData = [];
|
|||
|
this.GetData();
|
|||
|
}
|
|||
|
},
|
|||
|
//扫描条码
|
|||
|
onBarCodeConfirm() {
|
|||
|
this.BarCode = this.BarCode.toUpperCase();
|
|||
|
if (this.cmbBillNoSelValue.key=='') {
|
|||
|
this.$play("NG");
|
|||
|
this.$showMessage("请先选择单号");
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.BarCode=='') {
|
|||
|
this.$play("NG");
|
|||
|
this.$showMessage("请扫码条码");
|
|||
|
this.focusBarCode = true;
|
|||
|
return;
|
|||
|
}
|
|||
|
if (this.switchResults.value=="Y") {
|
|||
|
uni.showModal({
|
|||
|
title: "提示",
|
|||
|
content: "是否确定取消退货!",
|
|||
|
success:(conf)=>{
|
|||
|
if(!conf.confirm) {
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
this.$uni_request({
|
|||
|
url: '/PURDKA/GetBarInfo',
|
|||
|
data: {
|
|||
|
barCode: this.BarCode,
|
|||
|
billNo: this.cmbBillNoSelValue.key,
|
|||
|
userid: this.$loginInfo.account,
|
|||
|
billtype: this.BillType,
|
|||
|
quXiao: this.switchResults.value=="Y"?"true":"false"
|
|||
|
},
|
|||
|
success: (res)=>{
|
|||
|
// console.log(JSON.stringify(res.data));
|
|||
|
if (this.switchResults.value=="Y") {
|
|||
|
this.$showMessage("取消退货成功!");
|
|||
|
}
|
|||
|
else {
|
|||
|
this.$showMessage("退货成功!");
|
|||
|
}
|
|||
|
this.GetData();
|
|||
|
this.BarCode = '';
|
|||
|
this.focusBarCode = true;
|
|||
|
},
|
|||
|
fail:(res)=>{
|
|||
|
this.waitySendQty=res.data;
|
|||
|
if(this.waitySendQty=='') {
|
|||
|
this.waitySendQty=0;
|
|||
|
this.BarCode = '';
|
|||
|
this.focusBarCode = true;
|
|||
|
}
|
|||
|
this.$showMessage(res.message);
|
|||
|
}
|
|||
|
});
|
|||
|
},
|
|||
|
//选择物料明细行
|
|||
|
onSelectMatTb(e) {
|
|||
|
var matId = e.row.DKB003;
|
|||
|
this.GetKuWeiData(matId);
|
|||
|
},
|
|||
|
//拆按钮点击--跳转到条码拆分模块中
|
|||
|
onSplitBarcodeClick() {
|
|||
|
if (this.BarCode == "") {
|
|||
|
this.$play("NG");
|
|||
|
this.$showMessage("请先扫描条码,再拆分操作~");
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
if (this.waitySendQty == "") {
|
|||
|
this.$play("NG");
|
|||
|
this.$showMessage("无待发数量,不需要拆分操作~");
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
uni.navigateTo({
|
|||
|
url: 'WARBCF',
|
|||
|
events: { },
|
|||
|
success: function(res) {
|
|||
|
//通过eventChannel向被打开页面传送数据
|
|||
|
let item={BarCode:this.BarCode,waitySendQty:this.waitySendQty};
|
|||
|
res.eventChannel.emit('acceptDataFromOpenerPage', item)
|
|||
|
}
|
|||
|
});
|
|||
|
this.BarCode = '';
|
|||
|
}
|
|||
|
},
|
|||
|
onLoad(option) {
|
|||
|
//设置标题-这个方法一般不要动它,套用即可
|
|||
|
this.$setTitle(option);
|
|||
|
this.ruKuDate = '2019-11-21'; //this.$GetLocalDateTime(0);
|
|||
|
}
|
|||
|
}
|
|||
|
</script>
|
|||
|
|
|||
|
<style>
|
|||
|
|
|||
|
</style>
|