Commit 8621717f by liangjianmin

style(consignmentManagement): 统一代码格式并修复空格问题

修复 consignmentRecall.vue 和 createConsignmentRecallOrder.vue 中的代码格式问题,包括:
1. 统一缩进为2个空格
2. 修复对象和数组声明中的多余空格
3. 保持组件导入和使用的格式一致
4. 移除多余空行和注释
parent 21afcb4a
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<el-table-column type="index" label="序号" width="50" align="center" fixed></el-table-column> <el-table-column type="index" label="序号" width="50" align="center" fixed></el-table-column>
<el-table-column prop="msg_sn" label="寄售召回单号" min-width="150" :show-overflow-tooltip="true" align="center"> <el-table-column prop="msg_sn" label="寄售召回单号" min-width="150" :show-overflow-tooltip="true" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-link type="primary" :underline="false" @click="$router.push({path: '/consignmentRecallDetail', query: {recall_id: scope.row.recall_id}})" style="font-size: 12px;">{{ scope.row.recall_sn }}</el-link> <el-link type="primary" :underline="false" @click="$router.push({ path: '/consignmentRecallDetail', query: { recall_id: scope.row.recall_id } })" style="font-size: 12px;">{{ scope.row.recall_sn }}</el-link>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="recall_status_val" label="状态" min-width="200" :show-overflow-tooltip="true" align="center"></el-table-column> <el-table-column prop="recall_status_val" label="状态" min-width="200" :show-overflow-tooltip="true" align="center"></el-table-column>
...@@ -102,270 +102,268 @@ ...@@ -102,270 +102,268 @@
</div> </div>
</template> </template>
<script> <script>
import Vue from 'vue'; import Vue from 'vue';
import Menu from "@/components/menu.vue"; import Menu from "@/components/menu.vue";
import {Autocomplete, Button, Cascader, DatePicker, Descriptions, DescriptionsItem, Dialog, Divider, Dropdown, DropdownItem, DropdownMenu, Form, FormItem, Input, Link, Message, MessageBox, Option, Pagination, Popover, Select, Table, TableColumn, Tag, Tooltip} from 'element-ui' import { Autocomplete, Button, Cascader, DatePicker, Descriptions, DescriptionsItem, Dialog, Divider, Dropdown, DropdownItem, DropdownMenu, Form, FormItem, Input, Link, Message, MessageBox, Option, Pagination, Popover, Select, Table, TableColumn, Tag, Tooltip } from 'element-ui'
import {pcaTextArr} from 'element-china-area-data' import { pcaTextArr } from 'element-china-area-data'
Vue.prototype.$message = Message Vue.prototype.$message = Message
Vue.prototype.$confirm = MessageBox.confirm; Vue.prototype.$confirm = MessageBox.confirm;
Vue.use(Button).use(Link).use(Cascader).use(Form).use(Select).use(Option).use(Input).use(FormItem).use(Dialog).use(Tooltip).use(Autocomplete).use(Popover).use(Tag).use(Divider); Vue.use(Button).use(Link).use(Cascader).use(Form).use(Select).use(Option).use(Input).use(FormItem).use(Dialog).use(Tooltip).use(Autocomplete).use(Popover).use(Tag).use(Divider);
Vue.use(DatePicker).use(Dropdown).use(DropdownMenu).use(DropdownItem).use(TableColumn).use(Table).use(Pagination).use(Descriptions).use(DescriptionsItem); Vue.use(DatePicker).use(Dropdown).use(DropdownMenu).use(DropdownItem).use(TableColumn).use(Table).use(Pagination).use(Descriptions).use(DescriptionsItem);
export default { export default {
name: "consignmentRecall", name: "consignmentRecall",
data() { data() {
return { return {
options: pcaTextArr, options: pcaTextArr,
selectedOptions: ['广东省', '深圳市', '龙岗区'], selectedOptions: ['广东省', '深圳市', '龙岗区'],
multipleSelection: [], multipleSelection: [],
total: 0, total: 0,
page: 1, page: 1,
limit: 10, limit: 10,
list: [], list: [],
dialogVisible_1: false, dialogVisible_1: false,
dialogVisible_2: false, dialogVisible_2: false,
dialogVisible_3: false, dialogVisible_3: false,
recall_ids: '', recall_ids: '',
remark: '', remark: '',
rules: { rules: {
contact: [ contact: [
{required: true, message: '请输入收货人', trigger: 'blur'}, { required: true, message: '请输入收货人', trigger: 'blur' },
], ],
mobile: [ mobile: [
{required: true, message: '请输入收货电话', trigger: 'blur'}, { required: true, message: '请输入收货电话', trigger: 'blur' },
], ],
province: [ province: [
{required: true, message: '请选择收货地址', trigger: 'change'}, { required: true, message: '请选择收货地址', trigger: 'change' },
], ],
detail: [ detail: [
{required: true, message: '请输入详细地址', trigger: 'blur'}, { required: true, message: '请输入详细地址', trigger: 'blur' },
] ]
}, },
updateConsignmentRecallReceiptInfoParams: { updateConsignmentRecallReceiptInfoParams: {
contact: '',//收货人 contact: '',//收货人
mobile: '',//收货电话 mobile: '',//收货电话
country: '中国',//国家 country: '中国',//国家
province: '',//省 province: '',//省
city: '',//市 city: '',//市
district: '',//区 district: '',//区
detail: ''//详细地址 detail: ''//详细地址
}, },
formParam: { formParam: {
recall_sn: '', recall_sn: '',
goods_name: '', goods_name: '',
recall_status: '' recall_status: ''
}
};
},
created() {
this.getData()
},
methods: {
getData() {
var params = Object.assign({}, this.formParam, {page: this.page, limit: this.limit});
this.$http('GET', "/api/consignmentRecall/getConsignmentRecallList", params).then(res => {
if (res.code === 0) {
this.list = res.data.list || [];
this.total = Number(res.data.total) || 0;
} else {
this.$message.error(res.msg);
} }
}) };
}, },
/** created() {
* 省市区级联选择监听 this.getData()
* @param value
*/
handleChange(value) {
if (value && value.length) {
this.updateConsignmentRecallReceiptInfoParams.province = value[0];//省
this.updateConsignmentRecallReceiptInfoParams.city = value[1];//市
this.updateConsignmentRecallReceiptInfoParams.district = value[2];//区
} else {
this.updateConsignmentRecallReceiptInfoParams.province = '';
this.updateConsignmentRecallReceiptInfoParams.city = '';
this.updateConsignmentRecallReceiptInfoParams.district = '';
}
}, },
/** methods: {
* 型号监听 getData() {
* @param queryString var params = Object.assign({}, this.formParam, { page: this.page, limit: this.limit });
* @param cb this.$http('GET', "/api/consignmentRecall/getConsignmentRecallList", params).then(res => {
*/ if (res.code === 0) {
querySearchAsync(queryString, cb) { this.list = res.data.list || [];
if (!queryString) { this.total = Number(res.data.total) || 0;
cb([]); } else {
return; this.$message.error(res.msg);
} }
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 * 省市区级联选择监听
})); * @param value
cb(arr); */
handleChange(value) {
if (value && value.length) {
this.updateConsignmentRecallReceiptInfoParams.province = value[0];//省
this.updateConsignmentRecallReceiptInfoParams.city = value[1];//市
this.updateConsignmentRecallReceiptInfoParams.district = value[2];//区
} else { } else {
cb([]); this.updateConsignmentRecallReceiptInfoParams.province = '';
this.updateConsignmentRecallReceiptInfoParams.city = '';
this.updateConsignmentRecallReceiptInfoParams.district = '';
} }
}).catch(() => { },
cb([]); /**
}); * 型号监听
}, * @param queryString
/** * @param cb
* 搜索 */
*/ querySearchAsync(queryString, cb) {
onSubmit() { if (!queryString) {
this.page = 1; cb([]);
this.getData();
},
/**
* 重置表单
* @param formName
*/
resetForm(formName) {
this.formParam.date = '';
this.$refs[formName].resetFields();
},
/**
* 列表分页条数筛选监听
* @param val
*/
handleSizeChange(val) {
this.limit = val;
this.getData();
},
/**
* 列表分页输入页码监听
* @param val
*/
handleCurrentChange(val) {
this.page = val;
this.getData();
},
/**
* chebox 选择监听
* @param val
*/
handleSelectionChange(val) {
this.multipleSelection = val;
},
/**
* 弹窗事件
*/
popupEvent(type) {
if (type == 1 || type == 2) {
if (!this.multipleSelection.length) {
this.$message.warning('请选择数据');
return; return;
} }
} this.$http('GET', "/api/search/getspu", { spu_name: queryString }).then(res => {
switch (type) { if (res.code == 0 && res.data.list?.length) {
case 1: const arr = res.data.list.map(item => ({
// 提交审核:校验待提审状态 value: item.spu_name
const invalidVerify = this.multipleSelection.filter(item => item.recall_status !== '0'); }));
if (invalidVerify.length) { cb(arr);
this.$message.warning('只能选择待提审状态的数据'); } else {
return; cb([]);
} }
this.recall_ids = this.multipleSelection.map(item => item.recall_id).join(','); }).catch(() => {
this.dialogVisible_1 = true; cb([]);
break; });
case 2: },
// 作废:待提审、待退货出库状态可作废 /**
const invalidCancel = this.multipleSelection.filter(item => !(['0', '2'].includes(item.recall_status))); * 搜索
if (invalidCancel.length) { */
this.$message.warning('待提审、待退货出库状态才可作废'); onSubmit() {
this.page = 1;
this.getData();
},
/**
* 重置表单
* @param formName
*/
resetForm(formName) {
this.formParam.date = '';
this.$refs[formName].resetFields();
},
/**
* 列表分页条数筛选监听
* @param val
*/
handleSizeChange(val) {
this.limit = val;
this.getData();
},
/**
* 列表分页输入页码监听
* @param val
*/
handleCurrentChange(val) {
this.page = val;
this.getData();
},
/**
* chebox 选择监听
* @param val
*/
handleSelectionChange(val) {
this.multipleSelection = val;
},
/**
* 弹窗事件
*/
popupEvent(type) {
if (type == 1 || type == 2) {
if (!this.multipleSelection.length) {
this.$message.warning('请选择数据');
return; return;
} }
this.recall_ids = this.multipleSelection.map(item => item.recall_id).join(',');
this.dialogVisible_2 = true;
break;
case 3:
this.getConsignmentRecallReceiptInfo();
this.dialogVisible_3 = true;
break;
}
},
/**
* 提交审核
*/
verifyConsignmentRecall() {
this.$http('POST', "/api/consignmentRecall/verifyConsignmentRecall", {recall_ids: this.recall_ids, remark: this.remark}).then(res => {
if (res.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
onClose: () => {
this.dialogVisible_1 = false;
this.remark = '';
this.getData();
}
});
} else {
this.$message.error(res.msg || '操作失败');
} }
}) switch (type) {
}, case 1:
/** // 提交审核:校验待提审状态
* 作废 const invalidVerify = this.multipleSelection.filter(item => item.recall_status !== '0');
*/ if (invalidVerify.length) {
cancelConsignmentRecall() { this.$message.warning('只能选择待提审状态的数据');
this.$http('POST', "/api/consignmentRecall/cancelConsignmentRecall", {recall_ids: this.recall_ids, cancel_remark: this.remark}).then(res => { return;
if (res.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
onClose: () => {
this.dialogVisible_2 = false;
this.remark = '';
this.getData();
} }
}); this.recall_ids = this.multipleSelection.map(item => item.recall_id).join(',');
} else { this.dialogVisible_1 = true;
this.$message.error(res.msg || '操作失败'); break;
} case 2:
}) // 作废:待提审、待退货出库状态可作废
}, const invalidCancel = this.multipleSelection.filter(item => !(['0', '2'].includes(item.recall_status)));
/** if (invalidCancel.length) {
* 寄售召回-获取收货地址 this.$message.warning('待提审、待退货出库状态才可作废');
*/ return;
getConsignmentRecallReceiptInfo() {
this.$http('GET', "/api/consignmentRecall/getConsignmentRecallReceiptInfo", {}).then(res => {
if (res.code === 0) {
this.updateConsignmentRecallReceiptInfoParams = res.data;
}
})
},
/**
* 寄售召回-修改收货地址
*/
updateConsignmentRecallReceiptInfo(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$http('POST', "/api/consignmentRecall/updateConsignmentRecallReceiptInfo", this.updateConsignmentRecallReceiptInfoParams).then(res => {
if (res.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
onClose: () => {
this.dialogVisible_3 = false;
}
});
} else {
this.$message.error(res.msg || '操作失败');
} }
}) this.recall_ids = this.multipleSelection.map(item => item.recall_id).join(',');
} else { this.dialogVisible_2 = true;
console.log('error submit!!'); break;
return false; case 3:
this.getConsignmentRecallReceiptInfo();
this.dialogVisible_3 = true;
break;
} }
}); },
/**
* 提交审核
*/
verifyConsignmentRecall() {
this.$http('POST', "/api/consignmentRecall/verifyConsignmentRecall", { recall_ids: this.recall_ids, remark: this.remark }).then(res => {
if (res.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
onClose: () => {
this.dialogVisible_1 = false;
this.remark = '';
this.getData();
}
});
} else {
this.$message.error(res.msg || '操作失败');
}
})
},
/**
* 作废
*/
cancelConsignmentRecall() {
this.$http('POST', "/api/consignmentRecall/cancelConsignmentRecall", { recall_ids: this.recall_ids, cancel_remark: this.remark }).then(res => {
if (res.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
onClose: () => {
this.dialogVisible_2 = false;
this.remark = '';
this.getData();
}
});
} else {
this.$message.error(res.msg || '操作失败');
}
})
},
/**
* 寄售召回-获取收货地址
*/
getConsignmentRecallReceiptInfo() {
this.$http('GET', "/api/consignmentRecall/getConsignmentRecallReceiptInfo", {}).then(res => {
if (res.code === 0) {
this.updateConsignmentRecallReceiptInfoParams = res.data;
}
})
},
/**
* 寄售召回-修改收货地址
*/
updateConsignmentRecallReceiptInfo(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$http('POST', "/api/consignmentRecall/updateConsignmentRecallReceiptInfo", this.updateConsignmentRecallReceiptInfoParams).then(res => {
if (res.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
onClose: () => {
this.dialogVisible_3 = false;
}
});
} else {
this.$message.error(res.msg || '操作失败');
}
})
} else {
console.log('error submit!!');
return false;
}
});
}
},
components: {
Menu
} }
}, };
components: {
Menu
}
};
</script> </script>
<style scoped> <style scoped></style>
\ No newline at end of file
</style>
\ No newline at end of file
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
</div> </div>
<div class="row bothSide" style="margin-bottom: 10px;"> <div class="row bothSide" style="margin-bottom: 10px;">
<div style="width: 48%"> <div style="width: 48%">
<div class="xktitle" style="margin-bottom: 10px">收货信息<i class="el-icon-edit-outline" style="margin-left: 10px;" @click="dialogVisible_3=true"></i></div> <div class="xktitle" style="margin-bottom: 10px">收货信息<i class="el-icon-edit-outline" style="margin-left: 10px;" @click="dialogVisible_3 = true"></i></div>
<div class="row" v-if="updateConsignmentRecallReceiptInfoParams.province"> <div class="row" v-if="updateConsignmentRecallReceiptInfoParams.province">
<i class="el-icon-map-location" style="margin-top: 16px;"></i> <i class="el-icon-map-location" style="margin-top: 16px;"></i>
<el-descriptions :column="1" :colon="false"> <el-descriptions :column="1" :colon="false">
...@@ -119,368 +119,368 @@ ...@@ -119,368 +119,368 @@
</div> </div>
</template> </template>
<script> <script>
import Vue from 'vue'; import Vue from 'vue';
import Menu from "@/components/menu.vue"; import Menu from "@/components/menu.vue";
import {Autocomplete, Button, Cascader, DatePicker, Descriptions, DescriptionsItem, Dialog, Divider, Dropdown, DropdownItem, DropdownMenu, Form, FormItem, Input, Link, Message, MessageBox, Option, Pagination, Popover, Select, Table, TableColumn, Tag, Tooltip} from 'element-ui' import { Autocomplete, Button, Cascader, DatePicker, Descriptions, DescriptionsItem, Dialog, Divider, Dropdown, DropdownItem, DropdownMenu, Form, FormItem, Input, Link, Message, MessageBox, Option, Pagination, Popover, Select, Table, TableColumn, Tag, Tooltip } from 'element-ui'
import {pcaTextArr} from 'element-china-area-data' import { pcaTextArr } from 'element-china-area-data'
Vue.prototype.$message = Message Vue.prototype.$message = Message
Vue.prototype.$confirm = MessageBox.confirm; Vue.prototype.$confirm = MessageBox.confirm;
Vue.use(Button).use(Link).use(Cascader).use(Form).use(Select).use(Option).use(Input).use(FormItem).use(Dialog).use(Tooltip).use(Autocomplete).use(Popover).use(Tag).use(Divider); Vue.use(Button).use(Link).use(Cascader).use(Form).use(Select).use(Option).use(Input).use(FormItem).use(Dialog).use(Tooltip).use(Autocomplete).use(Popover).use(Tag).use(Divider);
Vue.use(DatePicker).use(Dropdown).use(DropdownMenu).use(DropdownItem).use(TableColumn).use(Table).use(Pagination).use(Descriptions).use(DescriptionsItem); Vue.use(DatePicker).use(Dropdown).use(DropdownMenu).use(DropdownItem).use(TableColumn).use(Table).use(Pagination).use(Descriptions).use(DescriptionsItem);
export default { export default {
name: "createConsignmentRecallOrder", name: "createConsignmentRecallOrder",
data() { data() {
return { return {
options: pcaTextArr, options: pcaTextArr,
selectedOptions: [], selectedOptions: [],
total: 0, total: 0,
page: 1, page: 1,
limit: 10, limit: 10,
multipleSelection: [], multipleSelection: [],
recall_json: [],//召回库存明细列表 recall_json: [],//召回库存明细列表
dialogVisible_1: false, dialogVisible_1: false,
dialogVisible_3: false, dialogVisible_3: false,
wmsStockList: [], wmsStockList: [],
delivery_remark: '',//配送备注 delivery_remark: '',//配送备注
updateConsignmentRecallReceiptInfoParams: { updateConsignmentRecallReceiptInfoParams: {
contact: '',//收货人 contact: '',//收货人
mobile: '',//收货电话 mobile: '',//收货电话
country: '中国',//国家 country: '中国',//国家
province: '',//省 province: '',//省
city: '',//市 city: '',//市
district: '',//区 district: '',//区
detail: ''//详细地址 detail: ''//详细地址
}, },
rules: { rules: {
contact: [ contact: [
{required: true, message: '请输入收货人', trigger: 'blur'}, { required: true, message: '请输入收货人', trigger: 'blur' },
], ],
mobile: [ mobile: [
{required: true, message: '请输入收货电话', trigger: 'blur'}, { required: true, message: '请输入收货电话', trigger: 'blur' },
], ],
province: [ province: [
{required: true, message: '请选择收货地址', trigger: 'change'}, { required: true, message: '请选择收货地址', trigger: 'change' },
], ],
detail: [ detail: [
{required: true, message: '请输入详细地址', trigger: 'blur'}, { required: true, message: '请输入详细地址', trigger: 'blur' },
] ]
}, },
wmsStockListParams: { wmsStockListParams: {
goods_name: '', goods_name: '',
brand_name: '' brand_name: ''
}, },
}; };
},
created() {
this.getData();
this.getConsignmentRecallReceiptInfo();
},
methods: {
getData() {
var params = Object.assign({}, this.formParam, {page: this.page, limit: this.limit});
this.$http('GET', "/api/consignmentRecall/getConsignmentRecallList", params).then(res => {
if (res.code === 0) {
this.list = res.data.list || [];
this.total = Number(res.data.total) || 0;
} else {
this.$message.error(res.msg);
}
})
}, },
/** created() {
* 省市区级联选择监听 this.getData();
* @param value this.getConsignmentRecallReceiptInfo();
*/
handleChange(value) {
if (value && value.length) {
this.updateConsignmentRecallReceiptInfoParams.province = value[0];//省
this.updateConsignmentRecallReceiptInfoParams.city = value[1];//市
this.updateConsignmentRecallReceiptInfoParams.district = value[2];//区
} else {
this.updateConsignmentRecallReceiptInfoParams.province = '';
this.updateConsignmentRecallReceiptInfoParams.city = '';
this.updateConsignmentRecallReceiptInfoParams.district = '';
}
}, },
/** methods: {
* 生成寄售召回单-提交 getData() {
*/ var params = Object.assign({}, this.formParam, { page: this.page, limit: this.limit });
generateConsignmentRecall() { this.$http('GET', "/api/consignmentRecall/getConsignmentRecallList", params).then(res => {
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) { if (res.code === 0) {
this.$message.success('提交成功'); this.list = res.data.list || [];
this.closetab('/createConsignmentRecallOrder') this.total = Number(res.data.total) || 0;
this.$router.push('/consignmentRecall');
} else { } else {
this.$message.error(res.msg); this.$message.error(res.msg);
} }
}) })
}).catch(() => { },
// 取消操作 /**
}); * 省市区级联选择监听
}, * @param value
/** */
* 寄售召回-获取收货地址 handleChange(value) {
*/ if (value && value.length) {
getConsignmentRecallReceiptInfo() { this.updateConsignmentRecallReceiptInfoParams.province = value[0];//省
this.$http('GET', "/api/consignmentRecall/getConsignmentRecallReceiptInfo", {}).then(res => { this.updateConsignmentRecallReceiptInfoParams.city = value[1];//市
if (res.code === 0) { this.updateConsignmentRecallReceiptInfoParams.district = value[2];//区
this.updateConsignmentRecallReceiptInfoParams = res.data; } else {
this.updateConsignmentRecallReceiptInfoParams.province = '';
// 如果省份为空,弹出收货信息弹窗 this.updateConsignmentRecallReceiptInfoParams.city = '';
if (!res.data.province) { this.updateConsignmentRecallReceiptInfoParams.district = '';
this.dialogVisible_3 = true
} else {
this.selectedOptions = [res.data.province, res.data.city, res.data.district];
}
} }
}) },
}, /**
/** * 生成寄售召回单-提交
* 寄售召回-修改收货地址 */
*/ generateConsignmentRecall() {
updateConsignmentRecallReceiptInfo(formName) { if (!this.recall_json.length) {
this.$refs[formName].validate((valid) => { this.$message.warning('请添加召回库存明细');
if (valid) { return;
this.$http('POST', "/api/consignmentRecall/updateConsignmentRecallReceiptInfo", this.updateConsignmentRecallReceiptInfoParams).then(res => { }
// 处理 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) { if (res.code === 0) {
this.$message({ this.$message.success('提交成功');
message: '收货信息更新成功', this.closetab('/createConsignmentRecallOrder')
type: 'success', this.$router.push('/consignmentRecall');
onClose: () => {
this.dialogVisible_3 = false;
this.getConsignmentRecallReceiptInfo();
}
});
} else { } else {
this.$message.error(res.msg || '操作失败'); this.$message.error(res.msg);
} }
}) })
} else { }).catch(() => {
console.log('error submit!!'); // 取消操作
return false; });
} },
}); /**
}, * 寄售召回-获取收货地址
/** */
* 添加 getConsignmentRecallReceiptInfo() {
*/ this.$http('GET', "/api/consignmentRecall/getConsignmentRecallReceiptInfo", {}).then(res => {
add() { if (res.code === 0) {
this.dialogVisible_1 = true; this.updateConsignmentRecallReceiptInfoParams = res.data;
this.getWmsStockList();
}, // 如果省份为空,弹出收货信息弹窗
/** if (!res.data.province) {
* 关闭当前页面 this.dialogVisible_3 = true
* @param path
*/
closetab(path) {
let tab_arr = JSON.parse(sessionStorage.getItem('tabs'))
for (var i = 0; i < tab_arr.length; i++) {
if (tab_arr[i].path == path) {
tab_arr.splice(i, 1);
sessionStorage.setItem('tabs', JSON.stringify(tab_arr));
if (path == this.$route.path) {
if (i == 0) {
this.$router.push({
path: "/"
})
} else { } else {
if (tab_arr[i - 1].query) { this.selectedOptions = [res.data.province, res.data.city, res.data.district];
this.$router.push({ }
path: tab_arr[i - 1].path, }
query: tab_arr[i - 1].query })
}) },
/**
* 寄售召回-修改收货地址
*/
updateConsignmentRecallReceiptInfo(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$http('POST', "/api/consignmentRecall/updateConsignmentRecallReceiptInfo", this.updateConsignmentRecallReceiptInfoParams).then(res => {
if (res.code === 0) {
this.$message({
message: '收货信息更新成功',
type: 'success',
onClose: () => {
this.dialogVisible_3 = false;
this.getConsignmentRecallReceiptInfo();
}
});
} else { } else {
this.$message.error(res.msg || '操作失败');
}
})
} else {
console.log('error submit!!');
return false;
}
});
},
/**
* 添加
*/
add() {
this.dialogVisible_1 = true;
this.getWmsStockList();
},
/**
* 关闭当前页面
* @param path
*/
closetab(path) {
let tab_arr = JSON.parse(sessionStorage.getItem('tabs'))
for (var i = 0; i < tab_arr.length; i++) {
if (tab_arr[i].path == path) {
tab_arr.splice(i, 1);
sessionStorage.setItem('tabs', JSON.stringify(tab_arr));
if (path == this.$route.path) {
if (i == 0) {
this.$router.push({ this.$router.push({
path: tab_arr[i - 1].path, path: "/"
}) })
} else {
if (tab_arr[i - 1].query) {
this.$router.push({
path: tab_arr[i - 1].path,
query: tab_arr[i - 1].query
})
} else {
this.$router.push({
path: tab_arr[i - 1].path,
})
}
} }
} }
break;
} }
break;
} }
} },
}, /**
/** * 获取wms库存列表
* 获取wms库存列表 */
*/ getWmsStockList() {
getWmsStockList() { var params = Object.assign({}, this.wmsStockListParams, { page: this.page, limit: this.limit });
var params = Object.assign({}, this.wmsStockListParams, {page: this.page, limit: this.limit}); this.$http('GET', "/api/consignmentRecall/getWmsStockList", params).then(res => {
this.$http('GET', "/api/consignmentRecall/getWmsStockList", params).then(res => { if (res.code === 0) {
if (res.code === 0) { this.wmsStockList = res.data.list || [];
this.wmsStockList = res.data.list || []; this.total = Number(res.data.total) || 0;
this.total = Number(res.data.total) || 0; } else {
} else { this.$message.error(res.msg);
this.$message.error(res.msg); }
})
},
/**
* 添加库存
* @param {number} type - 0:添加选中 1:一键添加全部
*/
async addInventory(type) {
if (!this.multipleSelection.length && type === 0) {
this.$message.warning('请选择数据');
return;
} }
})
},
/**
* 添加库存
* @param {number} type - 0:添加选中 1:一键添加全部
*/
async addInventory(type) {
if (!this.multipleSelection.length && type === 0) {
this.$message.warning('请选择数据');
return;
}
// 检查重复数据 // 检查重复数据
const checkDuplicate = (newItems) => { const checkDuplicate = (newItems) => {
return newItems.filter(newItem => return newItems.filter(newItem =>
!this.recall_json.some(existingItem => existingItem.stock_id === newItem.stock_id) !this.recall_json.some(existingItem => existingItem.stock_id === newItem.stock_id)
); );
}; };
if (type == 1) { if (type == 1) {
try { try {
// 一键添加全部库存时,先获取完整列表 // 一键添加全部库存时,先获取完整列表
const originalLimit = this.limit; const originalLimit = this.limit;
this.limit = 1000000; // 临时设置较大的limit this.limit = 1000000; // 临时设置较大的limit
const params = Object.assign({}, this.wmsStockListParams, {page: this.page, limit: this.limit}); const params = Object.assign({}, this.wmsStockListParams, { page: this.page, limit: this.limit });
const res = await this.$http('GET', "/api/consignmentRecall/getWmsStockList", params); const res = await this.$http('GET', "/api/consignmentRecall/getWmsStockList", params);
if (res.code === 0) { if (res.code === 0) {
this.recall_json = res.data.list || []; this.recall_json = res.data.list || [];
this.$message.success('成功添加全部商品'); this.$message.success('成功添加全部商品');
} else { } else {
this.$message.error(res.msg); this.$message.error(res.msg);
} }
this.limit = originalLimit; // 恢复原来的limit值 this.limit = originalLimit; // 恢复原来的limit值
} catch (error) { } catch (error) {
this.$message.error('获取数据失败'); this.$message.error('获取数据失败');
}
} else {
// 添加选中的库存
const uniqueItems = checkDuplicate(this.multipleSelection);
this.recall_json = [...this.recall_json, ...uniqueItems];
this.$message.success('成功添加选中商品');
} }
} else {
// 添加选中的库存
const uniqueItems = checkDuplicate(this.multipleSelection);
this.recall_json = [...this.recall_json, ...uniqueItems];
this.$message.success('成功添加选中商品');
}
this.dialogVisible_1 = false; // 关闭弹窗 this.dialogVisible_1 = false; // 关闭弹窗
}, },
/** /**
* 列表分页条数筛选监听 * 列表分页条数筛选监听
* @param val * @param val
*/ */
handleSizeChange(val) { handleSizeChange(val) {
this.limit = val; this.limit = val;
this.getWmsStockList(); this.getWmsStockList();
}, },
/** /**
* 列表分页输入页码监听 * 列表分页输入页码监听
* @param val * @param val
*/ */
handleCurrentChange(val) { handleCurrentChange(val) {
this.page = val; this.page = val;
this.getWmsStockList(); this.getWmsStockList();
}, },
/** /**
* chebox 选择监听 * chebox 选择监听
* @param val * @param val
*/ */
handleSelectionChange(val) { handleSelectionChange(val) {
this.multipleSelection = val; this.multipleSelection = val;
}, },
/** /**
* 型号监听 * 型号监听
* @param queryString * @param queryString
* @param cb * @param cb
*/ */
querySearchAsync(queryString, cb) { querySearchAsync(queryString, cb) {
if (!queryString) { 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([]); cb([]);
return;
} }
}).catch(() => { this.$http('GET', "/api/search/getspu", { spu_name: queryString }).then(res => {
cb([]); if (res.code == 0 && res.data.list?.length) {
}); const arr = res.data.list.map(item => ({
}, value: item.spu_name
/** }));
* 搜索 cb(arr);
*/ } else {
onSubmit() { cb([]);
this.page = 1; }
this.getWmsStockList(); }).catch(() => {
}, cb([]);
/** });
* 重置表单 },
* @param formName /**
*/ * 搜索
resetForm(formName) { */
this.$refs[formName].resetFields(); 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
* @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
}
};
</script> </script>
<style scoped> <style scoped>
.xktitle { .xktitle {
border-left: 5px solid #1969F9; border-left: 5px solid #1969F9;
height: 38px; height: 38px;
line-height: 38px; line-height: 38px;
background: #f3f3f3; background: #f3f3f3;
padding-left: 20px; padding-left: 20px;
font-weight: bold; font-weight: bold;
color: #333; color: #333;
} }
.el-icon-edit-outline { .el-icon-edit-outline {
cursor: pointer; cursor: pointer;
&:hover { &:hover {
color: #409eff; color: #409eff;
}
} }
}
</style> </style>
\ No newline at end of file
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