<template>
|
<div class="scan-container">
|
<el-card class="scan-card">
|
<div slot="header" class="clearfix">
|
<span>闪电发货校验</span>
|
</div>
|
<el-form ref="form" :model="formData" label-width="120px" class="scan-form">
|
<el-form-item label="波次号">
|
<el-input v-model="formData.orderPrintCode" autofocus class="input-300" @keyup.native.enter.stop="getData"></el-input>
|
</el-form-item>
|
<el-form-item label="包材条码">
|
<el-input ref="wrapperBarcode" v-model="formData.wrapperBarcode" class="input-300" @keyup.native.enter.stop="bathSet(1)"></el-input>
|
</el-form-item>
|
<el-form-item label="重量(KG)">
|
<el-input ref="weight" v-model.number="formData.weight" :step="0.01" type="number" class="input-300" @keyup.native.enter.stop="bathSet(2)"></el-input>
|
</el-form-item>
|
<el-form-item>
|
<!-- <el-button type="primary">设置选中项的包材和重量</el-button> -->
|
<el-button type="primary" @click="onSubmit">确认发货</el-button>
|
<el-button @click="onReset">重置</el-button>
|
</el-form-item>
|
</el-form>
|
</el-card>
|
<el-card class="scan-card body-no-padding">
|
<div slot="header" class="clearfix">
|
<span>扫描结果</span>
|
</div>
|
<el-table :data="tableData" stripe style="width: 100%">
|
<el-table-column prop="orderCode" label="订单编号" width="150">
|
</el-table-column>
|
<el-table-column prop="expressCorpName" label="快递公司" width="100">
|
</el-table-column>
|
<el-table-column prop="expressCode" label="快递单号" width="130">
|
</el-table-column>
|
<el-table-column prop="statusText" label="订单状态" width="100">
|
</el-table-column>
|
<el-table-column prop="totalQuantityOrder" label="合计数量" width="80">
|
</el-table-column>
|
<el-table-column prop="wrapperBarcode" label="包装条码" width="150">
|
</el-table-column>
|
<el-table-column prop="weight" label="订单重量(KG)">
|
<template slot-scope="{row}">
|
<el-input-number v-model.number="row.weight" :min="0" :step="0.01" size="mini" class="w-150" controls-position="right"></el-input-number>
|
</template>
|
</el-table-column>
|
</el-table>
|
</el-card>
|
</div>
|
</template>
|
|
<script>
|
export default {
|
name: "outbound-scan-order-send-batch",
|
data() {
|
return {
|
formData: {
|
orderCode: null,
|
orderPrintCode: "", // 波次号
|
wrapperBarcode: "", // 包装条码
|
weight: "" // 重量
|
},
|
// 明细数据
|
tableData: []
|
};
|
},
|
methods: {
|
// 获得数据
|
getData() {
|
var the = this;
|
var orderPrintCode = the.formData.orderPrintCode;
|
if (!orderPrintCode) {
|
this.$message.error("波次号不能为空");
|
return;
|
}
|
const url = "/api/outbound/orderSendBatch/getData";
|
const parment = {
|
orderPrintCode: orderPrintCode
|
};
|
const callback = res => {
|
the.common.showMsg(res);
|
if (res.result) {
|
if (res.data.length > 0) {
|
the.tableData = res.data;
|
this.$refs.wrapperBarcode.focus();
|
} else {
|
this.$message.error(orderPrintCode + ",没有可发货的数据!");
|
return;
|
}
|
}
|
};
|
the.common.ajax(url, parment, callback, the.$refs["form"]);
|
},
|
// 包材条码和重量回车事件
|
bathSet(code) {
|
if (code === 1) {
|
var wrapperBarcode = this.formData.wrapperBarcode;
|
this.tableData.forEach(rowData => {
|
this.$set(rowData, "wrapperBarcode", wrapperBarcode);
|
});
|
this.$refs.weight.focus();
|
}
|
if (code === 2) {
|
var weight = this.formData.weight;
|
this.tableData.forEach(rowData => {
|
this.$set(rowData, "weight", weight);
|
});
|
}
|
},
|
// 提交数据
|
onSubmit() {
|
const the = this;
|
var orderPrintCode = this.formData.orderPrintCode;
|
if (!this.formData.orderPrintCode) {
|
this.$message.error("波次号不能为空!");
|
return;
|
}
|
var dataList = [];
|
this.tableData.forEach(rowData => {
|
var orderCode = rowData.orderCode;
|
var wrapperBarcode = this.formData.wrapperBarcode;
|
const weight = rowData.weight || this.formData.weight;
|
|
dataList.push({
|
orderCode: orderCode,
|
wrapperBarcode: wrapperBarcode,
|
weight: weight
|
});
|
});
|
if (!dataList.length) {
|
this.$message.error("明细不能为空!");
|
return;
|
}
|
const url = "/api/outbound/orderSendBatch/saveScan";
|
const params = {
|
orderPrintCode: orderPrintCode,
|
dataList: dataList,
|
weight: this.formData.weight || 0
|
};
|
var callback = res => {
|
the.common.showMsg(res);
|
if (res.result) {
|
this.onReset();
|
}
|
};
|
the.common.ajax(url, params, callback, true);
|
},
|
// 重置数据
|
onReset() {
|
this.formData = {
|
orderCode: null,
|
orderPrintCode: "", // 波次号
|
wrapperBarcode: "", // 包装条码
|
weight: "" // 重量
|
};
|
// 明细数据
|
this.tableData = [];
|
}
|
}
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
@import "../../../styles/scan.scss";
|
</style>
|