Commit 0c6eb041 by LJM

寄售库存

parent b5740f64
...@@ -439,14 +439,14 @@ ...@@ -439,14 +439,14 @@
<el-table-column prop="stock" label="可用库存数量" min-width="25%"></el-table-column> <el-table-column prop="stock" label="可用库存数量" min-width="25%"></el-table-column>
<el-table-column label="申请召回数量" min-width="25%"> <el-table-column label="申请召回数量" min-width="25%">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.updateStock" placeholder="申请召回数量" @input="validateInput(scope.row)" onkeyup="if(event.keyCode !=37 &amp;&amp; event.keyCode != 39){if (!/^[\d]+$/ig.test(this.value)){this.value='';}}"></el-input> <el-input v-model="scope.row.recall_num" placeholder="申请召回数量" @input="validateInput(scope.row)" onkeyup="if(event.keyCode !=37 &amp;&amp; event.keyCode != 39){if (!/^[\d]+$/ig.test(this.value)){this.value='';}}"></el-input>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="dialogVisibleConsignmentRecall = false">取 消</el-button> <el-button @click="dialogVisibleConsignmentRecall = false">取 消</el-button>
<el-button type="primary">确 定</el-button> <el-button type="primary" @click="addConsignmentRecallFromStock">确 定</el-button>
</span> </span>
</el-dialog> </el-dialog>
<Menu/> <Menu/>
...@@ -681,7 +681,8 @@ export default { ...@@ -681,7 +681,8 @@ export default {
brand_id: this.formParam.brand_id, brand_id: this.formParam.brand_id,
brand_name: this.formParam.brand_name, brand_name: this.formParam.brand_name,
action_time: this.formParam.date[0], action_time: this.formParam.date[0],
end_time: this.formParam.date[1] end_time: this.formParam.date[1],
source: 12
}).then(res => { }).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.disabled = true this.disabled = true
...@@ -769,7 +770,6 @@ export default { ...@@ -769,7 +770,6 @@ export default {
*/ */
getTimes(date, type) { getTimes(date, type) {
if (type) { if (type) {
var cp_time_day = localStorage.getItem('cp_time_day'); var cp_time_day = localStorage.getItem('cp_time_day');
if (cp_time_day == -1) { if (cp_time_day == -1) {
// “无限制”,则修改上架有效期默认为:2035-01-01 // “无限制”,则修改上架有效期默认为:2035-01-01
...@@ -777,8 +777,6 @@ export default { ...@@ -777,8 +777,6 @@ export default {
} else { } else {
var date = new Date(new Date().getTime() + cp_time_day * 24 * 60 * 60 * 1000); var date = new Date(new Date().getTime() + cp_time_day * 24 * 60 * 60 * 1000);
} }
// var date = new Date(new Date(date).getTime() + 30 * 24 * 60 * 60 * 1000);
} else { } else {
var date = new Date(date); var date = new Date(date);
} }
...@@ -990,7 +988,7 @@ export default { ...@@ -990,7 +988,7 @@ export default {
// 使用reduce将库存数据转换为对象 // 使用reduce将库存数据转换为对象
const stockUpdates = this.kucundata.reduce((acc, item) => ({ const stockUpdates = this.kucundata.reduce((acc, item) => ({
...acc, ...acc,
[item.goods_id]: { stock: item.updateStock } [item.goods_id]: {stock: item.updateStock}
}), {}); }), {});
this.$http('post', "/api/sku/updateSku", stockUpdates) this.$http('post', "/api/sku/updateSku", stockUpdates)
...@@ -1111,7 +1109,8 @@ export default { ...@@ -1111,7 +1109,8 @@ export default {
goods_name: item.goods_name, goods_name: item.goods_name,
brand_name: item.brand_name, brand_name: item.brand_name,
stock: item.stock, stock: item.stock,
updateStock: item.stock date_code: item.batch_sn,//批次
recall_num: item.stock
} }
}); });
this.dialogVisibleConsignmentRecall = true; this.dialogVisibleConsignmentRecall = true;
...@@ -1152,17 +1151,49 @@ export default { ...@@ -1152,17 +1151,49 @@ export default {
*/ */
validateInput(row) { validateInput(row) {
// 转换为数字进行比较 // 转换为数字进行比较
let inputValue = Number(row.updateStock) || 0; let inputValue = Number(row.recall_num) || 0;
let stockValue = Number(row.stock) || 0; let stockValue = Number(row.stock) || 0;
// 如果输入值大于库存,则设置为库存值 // 如果输入值大于库存,则设置为库存值
if (inputValue > stockValue) { if (inputValue > stockValue) {
row.updateStock = stockValue; row.recall_num = stockValue;
this.$message({ this.$message({
message: '申请召回数量不能大于可用库存数量', message: '申请召回数量不能大于可用库存数量',
type: 'warning' type: 'warning'
}); });
} }
},
/**
* 寄售库存-新增寄售召回单
*/
addConsignmentRecallFromStock() {
// 检查是否有空的召回数量
const hasEmptyRecallNum = this.consignmentRecallData.some(item => !item.recall_num);
if (hasEmptyRecallNum) {
this.$message({
message: '请填写申请召回数量',
type: 'warning'
});
return;
}
this.$http('POST', "/api/consignmentRecall/addConsignmentRecallFromStock", {
recall_json: JSON.stringify(this.consignmentRecallData)
}).then(res => {
if (res.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
onClose: () => {
this.dialogVisibleConsignmentRecall = false;
this.getData();
}
});
} else {
this.$message.error(res.msg || '操作失败');
}
})
} }
}, },
components: { components: {
......
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