|
@@ -3,12 +3,13 @@
|
|
|
<el-form ref="goodsExchangeAddForm" :model="goodsExchangeAddForm" :rules="goodsExchangeAddFormRule"
|
|
|
label-width="160px" inline class="change-form">
|
|
|
<el-form-item label="订单" prop="order_id" class="change-form-item">
|
|
|
- <span>
|
|
|
+ {{ goodsExchangeAddForm.sn }}
|
|
|
+ <!-- <span>
|
|
|
<el-input v-model="goodsExchangeAddForm.sn" ref="order" @keyup.enter.native="blurUsername()">
|
|
|
</el-input>
|
|
|
<el-button @click="blurUsername()">搜索</el-button>
|
|
|
<el-button @click="orderBtn">订单列表</el-button>
|
|
|
- </span>
|
|
|
+ </span> -->
|
|
|
</el-form-item>
|
|
|
<el-form-item prop="warehouse_id" label="入库仓库" class="change-form-item">
|
|
|
<el-select v-model="goodsExchangeAddForm.warehouse_id" clearable
|
|
@@ -33,7 +34,8 @@
|
|
|
<h3>商品明细</h3>
|
|
|
<el-button class="button" size="mini" type="primary" v-if="type !== 'detail' && type !== 'audit'"
|
|
|
@click="scanCode">扫码入库</el-button>
|
|
|
- <el-button class="button" size="mini" type="primary" v-if="type !== 'detail' && type !== 'audit'"
|
|
|
+ <el-button class="button" size="mini" type="primary"
|
|
|
+ v-if="type !== 'detail' && type !== 'audit' && goodsExchangeAddForm.type !== 'TRANSFER_ENTRY' && goodsExchangeAddForm.type !== 'HAIL_ENTRY' && goodsExchangeAddForm.type !== 'SALE_AFTER'"
|
|
|
@click="handleSelectWarehouseEntryBatch">选择</el-button>
|
|
|
</div>
|
|
|
<div style="width: 100%; display: block">
|
|
@@ -92,13 +94,24 @@
|
|
|
<span v-else>{{ scope.row.product_vo.unit }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <!-- <el-table-column label="订单数量">
|
|
|
|
|
|
- </el-table-column> -->
|
|
|
- <el-table-column label="入库数量">
|
|
|
+
|
|
|
+ <el-table-column label="入库数量" width="155">
|
|
|
<template slot-scope="scope">
|
|
|
<el-input-number v-model="scope.row.num" type="number" :min="0" :maxlength="20"
|
|
|
- :disabled="type === 'detail' || type === 'audit'"></el-input-number>
|
|
|
+ :disabled="type === 'detail' || type === 'audit' || goodsExchangeAddForm.type == 'TRANSFER_ENTRY' || goodsExchangeAddForm.type == 'HAIL_ENTRY' || goodsExchangeAddForm.type == 'SALE_AFTER'"></el-input-number>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="entry_num" label="已入库数量"
|
|
|
+ v-if="goodsExchangeAddForm.type == 'TRANSFER_ENTRY' || goodsExchangeAddForm.type == 'HAIL_ENTRY' || goodsExchangeAddForm.type == 'SALE_AFTER'">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.entry_num }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="not_entry_num" label="未入库数量"
|
|
|
+ v-if="goodsExchangeAddForm.type == 'TRANSFER_ENTRY' || goodsExchangeAddForm.type == 'HAIL_ENTRY' || goodsExchangeAddForm.type == 'SALE_AFTER'">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{ scope.row.not_entry_num }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="订单数量"
|
|
@@ -121,10 +134,11 @@
|
|
|
<template slot-scope="scope">
|
|
|
<span v-if="scope.row.order_num">{{
|
|
|
scope.row.num - scope.row.order_num || 0
|
|
|
- }}</span>
|
|
|
+ }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="操作" v-if="type !== 'detail' && type !== 'audit'">
|
|
|
+ <el-table-column label="操作"
|
|
|
+ v-if="type !== 'detail' && type !== 'audit' && goodsExchangeAddForm.type !== 'TRANSFER_ENTRY' && goodsExchangeAddForm.type !== 'HAIL_ENTRY' && goodsExchangeAddForm.type !== 'SALE_AFTER'">
|
|
|
<template slot-scope="scope">
|
|
|
<!-- <el-button
|
|
|
size="mini"
|
|
@@ -145,8 +159,9 @@
|
|
|
</el-button>
|
|
|
<el-button v-if="type === 'audit'" type="danger" @click="dialogVisible = true">审核驳回
|
|
|
</el-button> -->
|
|
|
- <el-button v-if="type !== 'audit' && type !== 'detail' && checkPermission(['warehouseEntry2:add'])" type="primary"
|
|
|
- @click="savegoodsExchangeAddForm">保存
|
|
|
+ <el-button
|
|
|
+ v-if="type !== 'audit' && type !== 'detail' && checkPermission(['warehouseEntry2:add']) && goodsExchangeAddForm.type !== 'TRANSFER_ENTRY' && goodsExchangeAddForm.type !== 'HAIL_ENTRY' && goodsExchangeAddForm.type !== 'SALE_AFTER'"
|
|
|
+ type="primary" @click="savegoodsExchangeAddForm">保存
|
|
|
</el-button>
|
|
|
<el-button v-if="type !== 'audit' && type !== 'detail' && checkPermission(['warehouseEntry:update'])"
|
|
|
type="primary" @click="submitgoodsExchangeAddForm">入库
|
|
@@ -239,7 +254,7 @@
|
|
|
<el-table-column prop="order_time" label="下单时间">
|
|
|
<template slot-scope="scope">{{
|
|
|
scope.row.order_time | unixToDate
|
|
|
- }}</template>
|
|
|
+ }}</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="" label="仓库名称">
|
|
|
<template slot-scope="scope">
|
|
@@ -249,7 +264,7 @@
|
|
|
<el-table-column prop="" label="配送方式">
|
|
|
<template slot-scope="scope">{{
|
|
|
deliveryType(scope.row.send_type)
|
|
|
- }}</template>
|
|
|
+ }}</template>
|
|
|
</el-table-column>
|
|
|
<!-- <el-table-column prop="pay_type" label="付款方式">
|
|
|
<template slot-scope="scope">{{
|
|
@@ -259,7 +274,7 @@
|
|
|
<el-table-column prop="" label="实付金额">
|
|
|
<template slot-scope="scope">{{
|
|
|
"¥" + scope.row.pay_price
|
|
|
- }}</template>
|
|
|
+ }}</template>
|
|
|
</el-table-column>
|
|
|
<!-- <el-table-column prop="" label="订单状态">
|
|
|
<template slot-scope="scope">
|
|
@@ -466,9 +481,9 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.$nextTick(() => {
|
|
|
+ /* this.$nextTick(() => {
|
|
|
this.$refs.order.focus();
|
|
|
- });
|
|
|
+ }); */
|
|
|
this.routeName = this.$route.name;
|
|
|
this.sttorageType = this.$route.params.type;
|
|
|
this.GET_WarehouseList();
|
|
@@ -582,6 +597,9 @@ export default {
|
|
|
if (this.TO_BE_RETURN == 'TO_BE_RETURN') {
|
|
|
if (this.goodsExchangeAddForm.product_list[this.index].num >= this.goodsExchangeAddForm.product_list[this.index].stock_num) return this.$message.warning("录入数量大于在途库存!")
|
|
|
}
|
|
|
+ if (this.goodsExchangeAddForm.type == 'TRANSFER_ENTRY' || this.goodsExchangeAddForm.type == 'HAIL_ENTRY' || this.goodsExchangeAddForm.type == 'SALE_AFTER') {
|
|
|
+ if (this.goodsExchangeAddForm.product_list[this.index].num >= this.goodsExchangeAddForm.product_list[this.index].not_entry_num) return this.$message.warning("录入数量大于未入库数量!")
|
|
|
+ }
|
|
|
this.goodsExchangeAddForm.product_list[this.index].num =
|
|
|
this.goodsExchangeAddForm.product_list[
|
|
|
this.index
|
|
@@ -840,44 +858,72 @@ export default {
|
|
|
},
|
|
|
// 打印功能
|
|
|
printIng() { },
|
|
|
- /* 扫条码 */
|
|
|
+ /* 扫SKU */
|
|
|
toSearch() {
|
|
|
API_GoodsExchange.getProduct(
|
|
|
this.goodsExchangeAddForm.warehouse_id,
|
|
|
this.scanGoodsForm.bar_code.replace(/\s+/g, '')
|
|
|
).then((res) => {
|
|
|
+ if (!res) {
|
|
|
+ return this.$message.error("未找到商品信息");
|
|
|
+ }
|
|
|
+
|
|
|
res.sn_code_list = [];
|
|
|
this.sku = res.product_vo.sku;
|
|
|
+
|
|
|
// 查找当前商品是否已存在于列表中
|
|
|
- const indexs = this.goodsExchangeAddForm.product_list.findIndex(
|
|
|
- (el) => {
|
|
|
- console.log("Comparing with:", el);
|
|
|
- return (
|
|
|
- el.goods_id === res.goods_id &&
|
|
|
- el.product_id === res.product_id &&
|
|
|
- el.warehouse_id === res.warehouse_id &&
|
|
|
- el.product_vo.sku === res.product_vo.sku
|
|
|
- );
|
|
|
- }
|
|
|
- );
|
|
|
+ const indexs = this.goodsExchangeAddForm.product_list.findIndex((el) => {
|
|
|
+ return (
|
|
|
+ el.goods_id === res.goods_id &&
|
|
|
+ el.product_id === res.product_id &&
|
|
|
+ el.product_vo.sku === res.product_vo.sku
|
|
|
+ );
|
|
|
+ });
|
|
|
+
|
|
|
// 如果商品不存在,则添加到列表
|
|
|
if (indexs === -1) {
|
|
|
this.index = this.goodsExchangeAddForm.product_list.length;
|
|
|
- this.goodsExchangeAddForm.product_list.push(res);
|
|
|
+ if (
|
|
|
+ this.goodsExchangeAddForm.type === 'TRANSFER_ENTRY' ||
|
|
|
+ this.goodsExchangeAddForm.type === 'HAIL_ENTRY' ||
|
|
|
+ this.goodsExchangeAddForm.type === 'SALE_AFTER'
|
|
|
+ ) {
|
|
|
+ this.goodsExchangeAddForm.product_list.push({ ...res, num: 1 });
|
|
|
+ } else {
|
|
|
+ return this.$message.warning("请扫描订单内的商品!");
|
|
|
+ }
|
|
|
} else {
|
|
|
this.index = indexs;
|
|
|
}
|
|
|
+
|
|
|
if (res.product_vo.have_sn) {
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.sn_input.focus();
|
|
|
});
|
|
|
} else {
|
|
|
- if (this.TO_BE_RETURN == 'TO_BE_RETURN') {
|
|
|
- if (this.goodsExchangeAddForm.product_list[this.index].num >= this.goodsExchangeAddForm.product_list[this.index].stock_num) return this.$message.warning("录入数量大于在途库存!")
|
|
|
+ const currentProduct = this.goodsExchangeAddForm.product_list[this.index];
|
|
|
+
|
|
|
+ if (this.TO_BE_RETURN === 'TO_BE_RETURN') {
|
|
|
+ if (currentProduct.num >= currentProduct.stock_num) {
|
|
|
+ return this.$message.warning("录入数量大于在途库存!");
|
|
|
+ }
|
|
|
}
|
|
|
- this.goodsExchangeAddForm.product_list[this.index].num += 1
|
|
|
- /* this.scanDialogVisible = false; */
|
|
|
+
|
|
|
+ if (
|
|
|
+ this.goodsExchangeAddForm.type === 'TRANSFER_ENTRY' ||
|
|
|
+ this.goodsExchangeAddForm.type === 'HAIL_ENTRY' ||
|
|
|
+ this.goodsExchangeAddForm.type === 'SALE_AFTER'
|
|
|
+ ) {
|
|
|
+ if (currentProduct.num >= currentProduct.not_entry_num) {
|
|
|
+ return this.$message.warning("录入数量大于未入库数量!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$set(this.goodsExchangeAddForm.product_list[this.index], 'num', currentProduct.num + 1);
|
|
|
}
|
|
|
+ }).catch((error) => {
|
|
|
+ console.error("API 调用失败:", error);
|
|
|
+ this.$message.error("获取商品信息失败");
|
|
|
});
|
|
|
},
|
|
|
// 扫码入库
|
|
@@ -1062,8 +1108,10 @@ export default {
|
|
|
},
|
|
|
//入库
|
|
|
submitgoodsExchangeAddForm() {
|
|
|
+
|
|
|
this.$refs["goodsExchangeAddForm"].validate((valid) => {
|
|
|
if (valid) {
|
|
|
+
|
|
|
const { id } = this.goodsExchangeAddForm;
|
|
|
const params = this.MixinClone(this.goodsExchangeAddForm);
|
|
|
params.handled_by = this.deptListAll;
|
|
@@ -1090,12 +1138,14 @@ export default {
|
|
|
this.$message.error("请选择商品!");
|
|
|
return;
|
|
|
}
|
|
|
- params.product_list.map((el) => {
|
|
|
- el.product_stock_id = el.id;
|
|
|
- el.product_id = el.product_vo.id;
|
|
|
- el.id = "";
|
|
|
- });
|
|
|
- /* */ if (this.$route.name === "editInventory") {
|
|
|
+ /* let numReturn = false
|
|
|
+ params.product_list.map(el => {
|
|
|
+ if (el.num > el.not_entry_num) {
|
|
|
+ numReturn = true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if(numReturn) return */
|
|
|
+ if (this.$route.name === "editInventory") {
|
|
|
/* params.contract_product_list.map(el=>{
|
|
|
el.product_id=el.id
|
|
|
el.goods_id=el.id
|
|
@@ -1120,6 +1170,11 @@ export default {
|
|
|
}
|
|
|
);
|
|
|
} else if (this.$route.name === "addInventory") {
|
|
|
+ params.product_list.map((el) => {
|
|
|
+ el.product_stock_id = el.id;
|
|
|
+ el.product_id = el.product_vo.id;
|
|
|
+ el.id = "";
|
|
|
+ });
|
|
|
// 新增入库
|
|
|
API_GoodsExchange.warehouseEntry(params).then(() => {
|
|
|
this.$message.success("添加成功!");
|
|
@@ -1285,25 +1340,28 @@ export default {
|
|
|
this.goodsExchangeAddForm.change_time * 1000
|
|
|
);
|
|
|
/* 获取缓存数据 */
|
|
|
- API_GoodsExchange.skuRedis({ send_order_id: this.id, type: 'enter' }).then(response => {
|
|
|
- response.product_list.map((el) => {
|
|
|
+ response.product_list.map((el) => {
|
|
|
+ if (response.type !== 'SALE_AFTER') {
|
|
|
el.return_num = el.num
|
|
|
- Object.keys(response).map(item => {
|
|
|
- if (el.id == item) {
|
|
|
- el.sn_code_list = response[item]
|
|
|
- el.num = el.sn_code_list.length
|
|
|
- }
|
|
|
- })
|
|
|
- if (!el.sn_code_list) {
|
|
|
- el.sn_code_list = [];
|
|
|
- }/* else {
|
|
|
+ }
|
|
|
+
|
|
|
+ /* Object.keys(response).map(item => {
|
|
|
+ if (el.id == item) {
|
|
|
+ el.sn_code_list = response[item]
|
|
|
el.num = el.sn_code_list.length
|
|
|
- } */
|
|
|
- });
|
|
|
- })
|
|
|
+ }
|
|
|
+ }) */
|
|
|
+ el.num = 0
|
|
|
+ if (!el.sn_code_list) {
|
|
|
+ el.sn_code_list = [];
|
|
|
+ } else {
|
|
|
+ el.num = el.sn_code_list.length
|
|
|
+ }
|
|
|
+ });
|
|
|
+ console.log(response.product_list);
|
|
|
this.goodsExchangeAddForm.distribution_name = response.staff_name;
|
|
|
this.goodsExchangeAddForm.product_list = response.product_list;
|
|
|
- /* .map((item) => {
|
|
|
+ /* .map((item) => {SALE_AFTER
|
|
|
//change_list
|
|
|
item.name=item.goods_do.name
|
|
|
item.sn=item.goods_do.sn
|