Commit 0a712e88 by LJM

生成寄售召回单

parent 49b6905f
......@@ -134,6 +134,27 @@ export default {
*/
handleSelectionChange(val) {
this.multipleSelection = val;
},
/**
* 添加库存
* @param {number} type - 0:添加选中 1:一键添加全部
*/
addInventory(type) {
if (!this.multipleSelection.length) {
this.$message.warning('请选择数据');
return;
}
if (type) {
// 一键添加全部库存
this.recall_json = this.list;
} else {
// 添加选中的库存
this.recall_json = this.multipleSelection;
}
this.dialogVisible_1 = false; // 关闭弹窗
this.$message.success('添加成功');
}
},
components: {
......
......@@ -11,17 +11,17 @@
<div style="margin-top: 10px;">
<el-table :data="recall_json" border max-height="600">
<el-table-column type="index" label="序号" width="50" align="center" fixed></el-table-column>
<el-table-column prop="" label="SKUID" width="200" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="" label="型号" min-width="180" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="" label="标准品牌" min-width="180" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="" label="可用库存数量" width="150" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="" label="召回数量" width="100" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="" label="D/C" width="100" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="" label="产地" width="80" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="" label="入库时间" width="160" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="sku_id" label="SKUID" width="200" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="goods_name" label="型号" min-width="180" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="brand_name" label="标准品牌" min-width="180" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="useable_qty" label="可用库存数量" width="150" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="useable_qty" label="召回数量" width="100" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="date_code" label="D/C" width="100" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="coo" label="产地" width="80" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="create_time" label="入库时间" width="160" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column fixed="right" label="操作" width="80" align="center">
<template slot-scope="scope">
<el-button type="danger" size="mini">删除</el-button>
<el-button type="danger" size="mini" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
......@@ -30,45 +30,38 @@
<Menu></Menu>
<!--添加-->
<el-dialog title="添加" :close-on-click-modal="false" :visible.sync="dialogVisible_1" width="1100px">
<el-form :inline="true" :model="wmsStockListParams" label-width="80px" size="mini">
<el-form-item label="型号" prop="contact">
<el-input v-model="wmsStockListParams.goods_name" placeholder="请输入型号"></el-input>
<el-form :inline="true" :model="wmsStockListParams" ref="wmsStockListParams" label-width="80px" size="mini">
<el-form-item label="型号" prop="goods_name">
<el-autocomplete v-model="wmsStockListParams.goods_name" :trigger-on-focus="false" @keyup.enter.native="onSubmit" :fetch-suggestions="querySearchAsync" placeholder="请输入型号" clearable></el-autocomplete>
</el-form-item>
<el-form-item label="标准品牌" prop="contact">
<el-form-item label="标准品牌" prop="brand_name">
<el-input v-model="wmsStockListParams.brand_name" placeholder="请输入标准品牌"></el-input>
</el-form-item>
<el-form-item size="mini" style="text-align: right">
<el-button type="primary" @click="updateConsignmentRecallReceiptInfo('updateConsignmentRecallReceiptInfoParams')">搜索</el-button>
<el-button @click="dialogVisible_3 = false">重置</el-button>
<el-button type="primary" @click="onSubmit">搜索</el-button>
<el-button @click="resetForm('wmsStockListParams')">重置</el-button>
</el-form-item>
</el-form>
<!--操作区-->
<div class="operation-area row verCenter bothSide">
<div class="operation-button row verCenter">
<el-button>取消</el-button>
<el-button type="primary">添加</el-button>
<el-button type="primary">一键添加全部库存</el-button>
<el-button type="primary" @click="addInventory(0)">添加</el-button>
<el-button type="primary" @click="addInventory(1)">一键添加全部库存</el-button>
</div>
<div class="text-tip row verCenter">
<i class="el-icon-warning"></i>
<span>选择要召回的商品,将召回该商品的全部可用库存数量</span>
</div>
</div>
<el-table :data="wmsStockList" border max-height="600">
<el-table :data="wmsStockList" border max-height="600" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="40" align="center" fixed></el-table-column>
<el-table-column prop="" label="SKUID" width="200" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="" label="型号" min-width="180" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="" label="标准品牌" min-width="180" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="" label="可用库存数量" width="150" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="" label="召回数量" width="100" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="" label="D/C" width="100" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="" label="产地" width="80" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="" label="入库时间" width="160" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column fixed="right" label="操作" width="80" align="center">
<template slot-scope="scope">
<el-button type="danger" size="mini">删除</el-button>
</template>
</el-table-column>
<el-table-column prop="sku_id" label="SKUID" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="goods_name" label="型号" width="180" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="brand_name" label="标准品牌" width="180" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="useable_qty" label="可用库存数量" width="150" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="date_code" label="D/C" width="100" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="coo" label="产地" width="80" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="create_time" label="入库时间" width="160" :show-overflow-tooltip="true" align="center"></el-table-column>
</el-table>
<el-pagination layout="total, sizes, prev, pager, next, jumper" :page-sizes="[10, 20, 50, 100, 200]" :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page"></el-pagination>
</el-dialog>
......@@ -90,9 +83,11 @@ export default {
total: 0,
page: 1,
limit: 10,
multipleSelection: [],
recall_json: [],//召回库存明细列表
dialogVisible_1: false,
wmsStockList: [],
delivery_remark: '',//配送备注
wmsStockListParams: {
goods_name: '',
brand_name: ''
......@@ -118,7 +113,37 @@ export default {
* 生成寄售召回单-提交
*/
generateConsignmentRecall() {
if (!this.recall_json.length) {
this.$message.warning('请添加召回库存明细');
return;
}
// 处理 recall_json,添加 recall_num 字段
const processedRecallJson = this.recall_json.map(item => ({
...item,
recall_num: item.useable_qty
}));
this.$confirm(`<p style="font-size: 13px;">确定将选择的库存提交寄售召回?</p><p style="color: #FF7E11;font-size: 13px;">提交后,猎芯将进行出库作业,寄回到指定收货地址</p>`, '提交', {
confirmButtonText: '确定',
cancelButtonText: '取消',
dangerouslyUseHTMLString: true,
type: 'normal'
}).then(() => {
this.$http('POST', "/api/consignmentRecall/generateConsignmentRecall", {
delivery_remark: this.delivery_remark,
recall_json: JSON.stringify(processedRecallJson)
}).then(res => {
if (res.code === 0) {
this.$message.success('提交成功');
this.$router.push('/consignmentRecall');
} else {
this.$message.error(res.msg);
}
})
}).catch(() => {
// 取消操作
});
},
/**
* 添加
......@@ -142,12 +167,58 @@ export default {
})
},
/**
* 添加库存
* @param {number} type - 0:添加选中 1:一键添加全部
*/
async addInventory(type) {
if (!this.multipleSelection.length && type === 0) {
this.$message.warning('请选择数据');
return;
}
// 检查重复数据
const checkDuplicate = (newItems) => {
return newItems.filter(newItem =>
!this.recall_json.some(existingItem => existingItem.stock_id === newItem.stock_id)
);
};
if (type == 1) {
try {
// 一键添加全部库存时,先获取完整列表
const originalLimit = this.limit;
this.limit = 1000000; // 临时设置较大的limit
const params = Object.assign({}, this.wmsStockListParams, {page: this.page, limit: this.limit});
const res = await this.$http('GET', "/api/consignmentRecall/getWmsStockList", params);
if (res.code === 0) {
this.recall_json = res.data.list || [];
this.$message.success('成功添加全部商品');
} else {
this.$message.error(res.msg);
}
this.limit = originalLimit; // 恢复原来的limit值
} catch (error) {
this.$message.error('获取数据失败');
}
} else {
// 添加选中的库存
const uniqueItems = checkDuplicate(this.multipleSelection);
this.recall_json = [...this.recall_json, ...uniqueItems];
this.$message.success('成功添加选中商品');
}
this.dialogVisible_1 = false; // 关闭弹窗
},
/**
* 列表分页条数筛选监听
* @param val
*/
handleSizeChange(val) {
this.limit = val;
this.getData();
this.getWmsStockList();
},
/**
* 列表分页输入页码监听
......@@ -155,7 +226,7 @@ export default {
*/
handleCurrentChange(val) {
this.page = val;
this.getData();
this.getWmsStockList();
},
/**
* chebox 选择监听
......@@ -164,6 +235,60 @@ export default {
handleSelectionChange(val) {
this.multipleSelection = val;
},
/**
* 型号监听
* @param queryString
* @param cb
*/
querySearchAsync(queryString, cb) {
if (!queryString) {
cb([]);
return;
}
this.$http('GET', "/api/search/getspu", {spu_name: queryString}).then(res => {
if (res.code == 0 && res.data.list?.length) {
const arr = res.data.list.map(item => ({
value: item.spu_name
}));
cb(arr);
} else {
cb([]);
}
}).catch(() => {
cb([]);
});
},
/**
* 搜索
*/
onSubmit() {
this.page = 1;
this.getWmsStockList();
},
/**
* 重置表单
* @param formName
*/
resetForm(formName) {
this.$refs[formName].resetFields();
},
/**
* 删除召回库存明细
* @param {number} index - 当前行的索引
* @param {object} row - 当前行数据
*/
handleDelete(index, row) {
this.$confirm('确认删除该库存商品?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.recall_json.splice(index, 1);
this.$message.success('删除成功');
}).catch(() => {
// 取消删除操作
});
}
},
components: {
Menu
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment