Commit 8621717f by liangjianmin

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

修复 consignmentRecall.vue 和 createConsignmentRecallOrder.vue 中的代码格式问题,包括:
1. 统一缩进为2个空格
2. 修复对象和数组声明中的多余空格
3. 保持组件导入和使用的格式一致
4. 移除多余空行和注释
parent 21afcb4a
......@@ -38,7 +38,7 @@
<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">
<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>
</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 @@
</div>
</template>
<script>
import Vue from '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 {pcaTextArr} from 'element-china-area-data'
import Vue from '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 { pcaTextArr } from 'element-china-area-data'
Vue.prototype.$message = Message
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(DatePicker).use(Dropdown).use(DropdownMenu).use(DropdownItem).use(TableColumn).use(Table).use(Pagination).use(Descriptions).use(DescriptionsItem);
export default {
name: "consignmentRecall",
data() {
return {
options: pcaTextArr,
selectedOptions: ['广东省', '深圳市', '龙岗区'],
multipleSelection: [],
total: 0,
page: 1,
limit: 10,
list: [],
dialogVisible_1: false,
dialogVisible_2: false,
dialogVisible_3: false,
recall_ids: '',
remark: '',
rules: {
contact: [
{required: true, message: '请输入收货人', trigger: 'blur'},
],
mobile: [
{required: true, message: '请输入收货电话', trigger: 'blur'},
],
province: [
{required: true, message: '请选择收货地址', trigger: 'change'},
],
detail: [
{required: true, message: '请输入详细地址', trigger: 'blur'},
]
},
updateConsignmentRecallReceiptInfoParams: {
contact: '',//收货人
mobile: '',//收货电话
country: '中国',//国家
province: '',//省
city: '',//市
district: '',//区
detail: ''//详细地址
},
formParam: {
recall_sn: '',
goods_name: '',
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);
Vue.prototype.$message = Message
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(DatePicker).use(Dropdown).use(DropdownMenu).use(DropdownItem).use(TableColumn).use(Table).use(Pagination).use(Descriptions).use(DescriptionsItem);
export default {
name: "consignmentRecall",
data() {
return {
options: pcaTextArr,
selectedOptions: ['广东省', '深圳市', '龙岗区'],
multipleSelection: [],
total: 0,
page: 1,
limit: 10,
list: [],
dialogVisible_1: false,
dialogVisible_2: false,
dialogVisible_3: false,
recall_ids: '',
remark: '',
rules: {
contact: [
{ required: true, message: '请输入收货人', trigger: 'blur' },
],
mobile: [
{ required: true, message: '请输入收货电话', trigger: 'blur' },
],
province: [
{ required: true, message: '请选择收货地址', trigger: 'change' },
],
detail: [
{ required: true, message: '请输入详细地址', trigger: 'blur' },
]
},
updateConsignmentRecallReceiptInfoParams: {
contact: '',//收货人
mobile: '',//收货电话
country: '中国',//国家
province: '',//省
city: '',//市
district: '',//区
detail: ''//详细地址
},
formParam: {
recall_sn: '',
goods_name: '',
recall_status: ''
}
})
};
},
/**
* 省市区级联选择监听
* @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 = '';
}
created() {
this.getData()
},
/**
* 型号监听
* @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);
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);
}
})
},
/**
* 省市区级联选择监听
* @param value
*/
handleChange(value) {
if (value && value.length) {
this.updateConsignmentRecallReceiptInfoParams.province = value[0];//省
this.updateConsignmentRecallReceiptInfoParams.city = value[1];//市
this.updateConsignmentRecallReceiptInfoParams.district = value[2];//区
} else {
cb([]);
this.updateConsignmentRecallReceiptInfoParams.province = '';
this.updateConsignmentRecallReceiptInfoParams.city = '';
this.updateConsignmentRecallReceiptInfoParams.district = '';
}
}).catch(() => {
cb([]);
});
},
/**
* 搜索
*/
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('请选择数据');
},
/**
* 型号监听
* @param queryString
* @param cb
*/
querySearchAsync(queryString, cb) {
if (!queryString) {
cb([]);
return;
}
}
switch (type) {
case 1:
// 提交审核:校验待提审状态
const invalidVerify = this.multipleSelection.filter(item => item.recall_status !== '0');
if (invalidVerify.length) {
this.$message.warning('只能选择待提审状态的数据');
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([]);
}
this.recall_ids = this.multipleSelection.map(item => item.recall_id).join(',');
this.dialogVisible_1 = true;
break;
case 2:
// 作废:待提审、待退货出库状态可作废
const invalidCancel = this.multipleSelection.filter(item => !(['0', '2'].includes(item.recall_status)));
if (invalidCancel.length) {
this.$message.warning('待提审、待退货出库状态才可作废');
}).catch(() => {
cb([]);
});
},
/**
* 搜索
*/
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;
}
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 || '操作失败');
}
})
},
/**
* 作废
*/
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();
switch (type) {
case 1:
// 提交审核:校验待提审状态
const invalidVerify = this.multipleSelection.filter(item => item.recall_status !== '0');
if (invalidVerify.length) {
this.$message.warning('只能选择待提审状态的数据');
return;
}
});
} 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 || '操作失败');
this.recall_ids = this.multipleSelection.map(item => item.recall_id).join(',');
this.dialogVisible_1 = true;
break;
case 2:
// 作废:待提审、待退货出库状态可作废
const invalidCancel = this.multipleSelection.filter(item => !(['0', '2'].includes(item.recall_status)));
if (invalidCancel.length) {
this.$message.warning('待提审、待退货出库状态才可作废');
return;
}
})
} else {
console.log('error submit!!');
return false;
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 || '操作失败');
}
})
},
/**
* 作废
*/
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>
<style scoped>
</style>
\ No newline at end of file
<style scoped></style>
\ No newline at end of file
......@@ -7,7 +7,7 @@
</div>
<div class="row bothSide" style="margin-bottom: 10px;">
<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">
<i class="el-icon-map-location" style="margin-top: 16px;"></i>
<el-descriptions :column="1" :colon="false">
......@@ -119,368 +119,368 @@
</div>
</template>
<script>
import Vue from '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 {pcaTextArr} from 'element-china-area-data'
import Vue from '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 { pcaTextArr } from 'element-china-area-data'
Vue.prototype.$message = Message
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(DatePicker).use(Dropdown).use(DropdownMenu).use(DropdownItem).use(TableColumn).use(Table).use(Pagination).use(Descriptions).use(DescriptionsItem);
export default {
name: "createConsignmentRecallOrder",
data() {
return {
options: pcaTextArr,
selectedOptions: [],
total: 0,
page: 1,
limit: 10,
multipleSelection: [],
recall_json: [],//召回库存明细列表
dialogVisible_1: false,
dialogVisible_3: false,
wmsStockList: [],
delivery_remark: '',//配送备注
updateConsignmentRecallReceiptInfoParams: {
contact: '',//收货人
mobile: '',//收货电话
country: '中国',//国家
province: '',//省
city: '',//市
district: '',//区
detail: ''//详细地址
},
rules: {
contact: [
{required: true, message: '请输入收货人', trigger: 'blur'},
],
mobile: [
{required: true, message: '请输入收货电话', trigger: 'blur'},
],
province: [
{required: true, message: '请选择收货地址', trigger: 'change'},
],
detail: [
{required: true, message: '请输入详细地址', trigger: 'blur'},
]
},
wmsStockListParams: {
goods_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);
}
})
Vue.prototype.$message = Message
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(DatePicker).use(Dropdown).use(DropdownMenu).use(DropdownItem).use(TableColumn).use(Table).use(Pagination).use(Descriptions).use(DescriptionsItem);
export default {
name: "createConsignmentRecallOrder",
data() {
return {
options: pcaTextArr,
selectedOptions: [],
total: 0,
page: 1,
limit: 10,
multipleSelection: [],
recall_json: [],//召回库存明细列表
dialogVisible_1: false,
dialogVisible_3: false,
wmsStockList: [],
delivery_remark: '',//配送备注
updateConsignmentRecallReceiptInfoParams: {
contact: '',//收货人
mobile: '',//收货电话
country: '中国',//国家
province: '',//省
city: '',//市
district: '',//区
detail: ''//详细地址
},
rules: {
contact: [
{ required: true, message: '请输入收货人', trigger: 'blur' },
],
mobile: [
{ required: true, message: '请输入收货电话', trigger: 'blur' },
],
province: [
{ required: true, message: '请选择收货地址', trigger: 'change' },
],
detail: [
{ required: true, message: '请输入详细地址', trigger: 'blur' },
]
},
wmsStockListParams: {
goods_name: '',
brand_name: ''
},
};
},
/**
* 省市区级联选择监听
* @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 = '';
}
created() {
this.getData();
this.getConsignmentRecallReceiptInfo();
},
/**
* 生成寄售召回单-提交
*/
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 => {
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.$message.success('提交成功');
this.closetab('/createConsignmentRecallOrder')
this.$router.push('/consignmentRecall');
this.list = res.data.list || [];
this.total = Number(res.data.total) || 0;
} else {
this.$message.error(res.msg);
}
})
}).catch(() => {
// 取消操作
});
},
/**
* 寄售召回-获取收货地址
*/
getConsignmentRecallReceiptInfo() {
this.$http('GET', "/api/consignmentRecall/getConsignmentRecallReceiptInfo", {}).then(res => {
if (res.code === 0) {
this.updateConsignmentRecallReceiptInfoParams = res.data;
// 如果省份为空,弹出收货信息弹窗
if (!res.data.province) {
this.dialogVisible_3 = true
} else {
this.selectedOptions = [res.data.province, res.data.city, res.data.district];
}
},
/**
* 省市区级联选择监听
* @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 = '';
}
})
},
/**
* 寄售召回-修改收货地址
*/
updateConsignmentRecallReceiptInfo(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$http('POST', "/api/consignmentRecall/updateConsignmentRecallReceiptInfo", this.updateConsignmentRecallReceiptInfoParams).then(res => {
},
/**
* 生成寄售召回单-提交
*/
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({
message: '收货信息更新成功',
type: 'success',
onClose: () => {
this.dialogVisible_3 = false;
this.getConsignmentRecallReceiptInfo();
}
});
this.$message.success('提交成功');
this.closetab('/createConsignmentRecallOrder')
this.$router.push('/consignmentRecall');
} else {
this.$message.error(res.msg || '操作失败');
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({
path: "/"
})
}).catch(() => {
// 取消操作
});
},
/**
* 寄售召回-获取收货地址
*/
getConsignmentRecallReceiptInfo() {
this.$http('GET', "/api/consignmentRecall/getConsignmentRecallReceiptInfo", {}).then(res => {
if (res.code === 0) {
this.updateConsignmentRecallReceiptInfoParams = res.data;
// 如果省份为空,弹出收货信息弹窗
if (!res.data.province) {
this.dialogVisible_3 = true
} else {
if (tab_arr[i - 1].query) {
this.$router.push({
path: tab_arr[i - 1].path,
query: tab_arr[i - 1].query
})
this.selectedOptions = [res.data.province, res.data.city, res.data.district];
}
}
})
},
/**
* 寄售召回-修改收货地址
*/
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 {
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({
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库存列表
*/
getWmsStockList() {
var params = Object.assign({}, this.wmsStockListParams, {page: this.page, limit: this.limit});
this.$http('GET', "/api/consignmentRecall/getWmsStockList", params).then(res => {
if (res.code === 0) {
this.wmsStockList = res.data.list || [];
this.total = Number(res.data.total) || 0;
} else {
this.$message.error(res.msg);
},
/**
* 获取wms库存列表
*/
getWmsStockList() {
var params = Object.assign({}, this.wmsStockListParams, { page: this.page, limit: this.limit });
this.$http('GET', "/api/consignmentRecall/getWmsStockList", params).then(res => {
if (res.code === 0) {
this.wmsStockList = res.data.list || [];
this.total = Number(res.data.total) || 0;
} else {
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) => {
return newItems.filter(newItem =>
// 检查重复数据
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
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);
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);
}
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('获取数据失败');
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('成功添加选中商品');
}
} 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.getWmsStockList();
},
/**
* 列表分页输入页码监听
* @param val
*/
handleCurrentChange(val) {
this.page = val;
this.getWmsStockList();
},
/**
* chebox 选择监听
* @param val
*/
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 {
this.dialogVisible_1 = false; // 关闭弹窗
},
/**
* 列表分页条数筛选监听
* @param val
*/
handleSizeChange(val) {
this.limit = val;
this.getWmsStockList();
},
/**
* 列表分页输入页码监听
* @param val
*/
handleCurrentChange(val) {
this.page = val;
this.getWmsStockList();
},
/**
* chebox 选择监听
* @param val
*/
handleSelectionChange(val) {
this.multipleSelection = val;
},
/**
* 型号监听
* @param queryString
* @param cb
*/
querySearchAsync(queryString, cb) {
if (!queryString) {
cb([]);
return;
}
}).catch(() => {
cb([]);
});
},
/**
* 搜索
*/
onSubmit() {
this.page = 1;
this.getWmsStockList();
},
/**
* 重置表单
* @param formName
*/
resetForm(formName) {
this.$refs[formName].resetFields();
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(() => {
// 取消删除操作
});
}
},
/**
* 删除召回库存明细
* @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
}
},
components: {
Menu
}
};
};
</script>
<style scoped>
.xktitle {
border-left: 5px solid #1969F9;
height: 38px;
line-height: 38px;
background: #f3f3f3;
padding-left: 20px;
font-weight: bold;
color: #333;
}
.xktitle {
border-left: 5px solid #1969F9;
height: 38px;
line-height: 38px;
background: #f3f3f3;
padding-left: 20px;
font-weight: bold;
color: #333;
}
.el-icon-edit-outline {
cursor: pointer;
.el-icon-edit-outline {
cursor: pointer;
&:hover {
color: #409eff;
&:hover {
color: #409eff;
}
}
}
</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