Commit 5e949a9f by LJM

库存

parent bdf52313
......@@ -139,9 +139,9 @@
<el-button type="primary" @click="changeStatus(3)">下架</el-button>
<el-button type="primary" @click="downOut">导出</el-button>
<a :href="downHref" ref="downs" target="_blank" style="display:none">下载</a>
<el-button type="primary" style="margin-left: 10px;" @click="batchModify()">批量修改</el-button>
<el-button type="primary" @click="consignmentReplenishment()">寄售补货</el-button>
<el-button type="primary" @click="consignmentRecall()">寄售召回</el-button>
<el-button type="primary" style="margin-left: 10px;" @click="popupEvent(1)">批量修改</el-button>
<el-button type="primary" @click="popupEvent(2)">寄售补货</el-button>
<el-button type="primary" @click="popupEvent(3)">寄售召回</el-button>
</div>
<div class="text-tip row verCenter">
<i class="el-icon-warning"></i>
......@@ -420,7 +420,7 @@
</el-dialog>
<!--批量修改-->
<el-dialog title="批量修改" :close-on-click-modal="false" :visible.sync="dialogVisibleBatchModify" width="500px">
<el-upload drag action="https://jsonplaceholder.typicode.com/posts/">
<el-upload drag action="/api/sku/batchUpdateSku" :on-success="handleUploadSuccess" :on-error="handleUploadError" accept=".csv" :show-file-list="false">
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div class="el-upload__tip" slot="tip">
......@@ -516,10 +516,6 @@ export default {
};
},
created() {
let status = this.$route.query.status;
if (status) {
this.formParam.status = status;
}
this.getData();
this.getSkuRankList();
},
......@@ -596,14 +592,8 @@ export default {
} else {
this.formParam.cp_time = '';
}
var params = Object.assign({},
{page: this.page},
{limit: this.limit},
this.formParam,
{action_time: this.formParam.date ? this.formParam.date[0] : ''},
{end_time: this.formParam.date ? this.formParam.date[1] : ''})
this.$http('get', "/api/sku/list", params).then(res => {
var params = Object.assign({}, this.formParam, {page: this.page, limit: this.limit, source: 12}, {action_time: this.formParam.date ? this.formParam.date[0] : ''}, {end_time: this.formParam.date ? this.formParam.date[1] : ''})
this.$http('GET', "/api/sku/list", params).then(res => {
if (res.code === 0) {
this.tableData = res.data.list || [];
this.total = Number(res.data.count) || 0;
......@@ -636,24 +626,22 @@ export default {
* @param cb
*/
querySearchAsync(queryString, cb) {
this.$http('get', "/api/search/getspu", {
spu_name: queryString
}).then(res => {
if (res.code == 0) {
if (res.data.list.length > 0) {
var arrlist_ = res.data.list || [];
var arr_ = []
for (var i = 0; i < arrlist_.length; i++) {
arr_.push({
value: arrlist_[i]['spu_name']
})
if (!queryString) {
cb([]);
return;
}
cb(arr_);
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([]);
});
},
/**
* 品牌
......@@ -1060,10 +1048,7 @@ export default {
sku_ids = this.multipleSelection.map(obj => {
return obj.goods_id;
});
this.$http('post', "/api/sku/updateSkuStatus", {
sku_ids: sku_ids.join(","),
status: status == 1 ? 'passed' : 'offshelf'
}).then(res => {
this.$http('post', "/api/sku/updateSkuStatus", {sku_ids: sku_ids.join(","), status: status == 1 ? 'passed' : 'offshelf'}).then(res => {
if (res.code === 0) {
this.$message({
message: '操作成功',
......@@ -1079,20 +1064,16 @@ export default {
})
},
/**
* 批量修改
* 弹窗事件
*/
batchModify() {
popupEvent(type) {
switch (type) {
case 1:
this.dialogVisibleBatchModify = true;
},
/**
* 寄售补货
*/
consignmentReplenishment() {
if (this.multipleSelection.length === 0) {
this.$message({
message: '请至少选择一条数据',
type: 'warning'
});
break;
case 2:
if (!this.multipleSelection.length) {
this.$message.warning('请选择数据');
return;
}
var html = `
......@@ -1104,20 +1085,56 @@ export default {
cancelButtonText: '取消',
dangerouslyUseHTMLString: true
}).then(() => {
// TODO: 在这里添加确认后的处理逻辑
let sku_ids = this.multipleSelection.map(item => item.sku_id).join(',');
this.$http('POST', "/api/consignmentReplenishment/addConsignmentReplenishment", {sku_ids: sku_ids}).then(res => {
if (res.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
message: '提交成功'
onClose: () => {
this.getData();
}
});
} else {
this.$message.error(res.msg || '操作失败');
}
})
}).catch(() => {
// 取消时不需要提示
});
break;
case 3:
this.dialogVisibleConsignmentRecall = true;
break;
}
},
/**
* 上传成功
* @param res
* @param file
* @param fileList
*/
handleUploadSuccess(res, file, fileList) {
if (res.code === 0) {
this.$message({
message: res.msg,
type: 'success',
onClose: () => {
this.dialogVisibleBatchModify = false;
}
});
} else {
this.$message.error(res.msg || '上传失败');
}
},
/**
* 寄售召回
* 上传失败
* @param err
* @param file
* @param fileList
*/
consignmentRecall() {
this.dialogVisibleConsignmentRecall=true;
handleUploadError(err, file, fileList) {
this.$message.error('上传失败,请重试');
}
},
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