feat:
1. 新增自营商家产品目录库存
This commit is contained in:
@@ -48,3 +48,18 @@ export const update = (row) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const increaseStock = (id, num) => {
|
||||||
|
return request({
|
||||||
|
url: '/market/merchant-catalog/increase-stock',
|
||||||
|
method: 'post',
|
||||||
|
params: {id, num}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const reduceStock = (id, num) => {
|
||||||
|
return request({
|
||||||
|
url: '/market/merchant-catalog/reduce-stock',
|
||||||
|
method: 'post',
|
||||||
|
params: {id, num}
|
||||||
|
})
|
||||||
|
}
|
||||||
50
src/api/market/merchantCatalogOperateLog.js
Normal file
50
src/api/market/merchantCatalogOperateLog.js
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
import request from '@/axios';
|
||||||
|
|
||||||
|
export const getList = (current, size, params) => {
|
||||||
|
return request({
|
||||||
|
url: '/market/catalog-operate-log/page',
|
||||||
|
method: 'get',
|
||||||
|
params: {
|
||||||
|
...params,
|
||||||
|
current,
|
||||||
|
size,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getDetail = (id) => {
|
||||||
|
return request({
|
||||||
|
url: '/market/catalog-operate-log/detail',
|
||||||
|
method: 'get',
|
||||||
|
params: {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const remove = (ids) => {
|
||||||
|
return request({
|
||||||
|
url: '/market/catalog-operate-log/remove',
|
||||||
|
method: 'post',
|
||||||
|
params: {
|
||||||
|
ids,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const add = (row) => {
|
||||||
|
return request({
|
||||||
|
url: '/market/catalog-operate-log/submit',
|
||||||
|
method: 'post',
|
||||||
|
data: row
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export const update = (row) => {
|
||||||
|
return request({
|
||||||
|
url: '/market/catalog-operate-log/submit',
|
||||||
|
method: 'post',
|
||||||
|
data: row
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
@@ -48,17 +48,51 @@ export default {
|
|||||||
prop: "productName",
|
prop: "productName",
|
||||||
type: "input",
|
type: "input",
|
||||||
overHidden: true,
|
overHidden: true,
|
||||||
span:24
|
span:24,
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入商品名称',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "进货价",
|
label: "进货价",
|
||||||
prop: "costPrice",
|
prop: "costPrice",
|
||||||
type: "number",
|
type: "number",
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请填写进货价格',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "销售价",
|
label: "销售价",
|
||||||
prop: "salePrice",
|
prop: "salePrice",
|
||||||
type: "number",
|
type: "number",
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请填写销售价格',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "库存",
|
||||||
|
prop: "stock",
|
||||||
|
type: "number",
|
||||||
|
editDisplay: false,
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请填写库存',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "所属用户",
|
label: "所属用户",
|
||||||
@@ -80,7 +114,14 @@ export default {
|
|||||||
res: 'data',
|
res: 'data',
|
||||||
url: 'link'
|
url: 'link'
|
||||||
},
|
},
|
||||||
span:24
|
span:24,
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请上传缩略图',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "商品主图",
|
label: "商品主图",
|
||||||
@@ -93,7 +134,14 @@ export default {
|
|||||||
res: 'data',
|
res: 'data',
|
||||||
url: 'link'
|
url: 'link'
|
||||||
},
|
},
|
||||||
span:24
|
span:24,
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请上传商品主图',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "商品详情图",
|
label: "商品详情图",
|
||||||
@@ -106,7 +154,14 @@ export default {
|
|||||||
res: 'data',
|
res: 'data',
|
||||||
url: 'link'
|
url: 'link'
|
||||||
},
|
},
|
||||||
span:24
|
span:24,
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请上传商品主图',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "备注",
|
label: "备注",
|
||||||
|
|||||||
134
src/option/market/merchantCatalogOperateLog.js
Normal file
134
src/option/market/merchantCatalogOperateLog.js
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
export default {
|
||||||
|
height:'auto',
|
||||||
|
calcHeight: 30,
|
||||||
|
tip: false,
|
||||||
|
searchShow: false,
|
||||||
|
searchMenuSpan: 6,
|
||||||
|
border: true,
|
||||||
|
index: true,
|
||||||
|
viewBtn: true,
|
||||||
|
addBtn: false,
|
||||||
|
menu: false,
|
||||||
|
selection: false,
|
||||||
|
dialogClickModal: false,
|
||||||
|
stripe: true,
|
||||||
|
column: [
|
||||||
|
{
|
||||||
|
label: "主键",
|
||||||
|
prop: "id",
|
||||||
|
type: "input",
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: false,
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "商家id",
|
||||||
|
prop: "merchantId",
|
||||||
|
type: "input",
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "商家账号",
|
||||||
|
prop: "merchantAccount",
|
||||||
|
type: "input",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "商品id",
|
||||||
|
prop: "productId",
|
||||||
|
type: "input",
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "商品名称",
|
||||||
|
prop: "productName",
|
||||||
|
type: "input",
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "操作类型",
|
||||||
|
prop: "type",
|
||||||
|
type: "select",
|
||||||
|
dicUrl: "/blade-system/dict/dictionary?code=merchant_catalog_operate_type",
|
||||||
|
dataType: "number",
|
||||||
|
addDisplay: false,
|
||||||
|
props: {
|
||||||
|
label: "dictValue",
|
||||||
|
value: "dictKey"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "数量",
|
||||||
|
prop: "affectedStock",
|
||||||
|
type: "input",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "备注",
|
||||||
|
prop: "remark",
|
||||||
|
type: "input",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "创建人",
|
||||||
|
prop: "createUser",
|
||||||
|
type: "input",
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: false,
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "创建部门",
|
||||||
|
prop: "createDept",
|
||||||
|
type: "input",
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: false,
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "操作时间",
|
||||||
|
prop: "createTime",
|
||||||
|
type: "input",
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: false,
|
||||||
|
overHidden: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "修改人",
|
||||||
|
prop: "updateUser",
|
||||||
|
type: "input",
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: false,
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "修改时间",
|
||||||
|
prop: "updateTime",
|
||||||
|
type: "input",
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: false,
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "状态",
|
||||||
|
prop: "status",
|
||||||
|
type: "input",
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: false,
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "是否已删除",
|
||||||
|
prop: "isDeleted",
|
||||||
|
type: "input",
|
||||||
|
addDisplay: false,
|
||||||
|
editDisplay: false,
|
||||||
|
viewDisplay: false,
|
||||||
|
hide: true,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -19,44 +19,105 @@
|
|||||||
@size-change="sizeChange"
|
@size-change="sizeChange"
|
||||||
@refresh-change="refreshChange"
|
@refresh-change="refreshChange"
|
||||||
@on-load="onLoad">
|
@on-load="onLoad">
|
||||||
<!-- <template #menu-left>-->
|
<template #menu="{ row }">
|
||||||
<!-- <el-button type="danger"-->
|
<el-button type="text"
|
||||||
<!-- icon="el-icon-delete"-->
|
icon="el-icon-tickets"
|
||||||
<!-- plain-->
|
v-if="row.type === 1"
|
||||||
<!-- v-if="permission.merchantproduct_delete"-->
|
@click.stop="handleLog(row)">操作日志
|
||||||
<!-- @click="handleDelete">删 除-->
|
</el-button>
|
||||||
<!-- </el-button>-->
|
<el-button type="text"
|
||||||
<!-- <el-button type="warning"-->
|
icon="el-icon-plus"
|
||||||
<!-- plain-->
|
v-if="row.type === 1"
|
||||||
<!-- icon="el-icon-download"-->
|
@click.stop="handleIncrease(row)">增加库存
|
||||||
<!-- @click="handleExport">导 出-->
|
</el-button>
|
||||||
<!-- </el-button>-->
|
<el-button type="text"
|
||||||
<!-- </template>-->
|
icon="el-icon-minus"
|
||||||
|
v-if="row.type === 1"
|
||||||
|
@click.stop="handleReduce(row)">减扣库存
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
<!-- <template #menu-left>-->
|
||||||
|
<!-- <el-button type="danger"-->
|
||||||
|
<!-- icon="el-icon-delete"-->
|
||||||
|
<!-- plain-->
|
||||||
|
<!-- v-if="permission.merchantproduct_delete"-->
|
||||||
|
<!-- @click="handleDelete">删 除-->
|
||||||
|
<!-- </el-button>-->
|
||||||
|
<!-- <el-button type="warning"-->
|
||||||
|
<!-- plain-->
|
||||||
|
<!-- icon="el-icon-download"-->
|
||||||
|
<!-- @click="handleExport">导 出-->
|
||||||
|
<!-- </el-button>-->
|
||||||
|
<!-- </template>-->
|
||||||
|
|
||||||
</avue-crud>
|
</avue-crud>
|
||||||
|
<el-drawer :title="`商品 [${productName}] 库存日志`" v-model=" logBox" :direction="direction"
|
||||||
|
append-to-body
|
||||||
|
size="40%"
|
||||||
|
:before-close="handleLogClose">
|
||||||
|
<basic-container>
|
||||||
|
<avue-crud :option="optionLog"
|
||||||
|
v-model:search="searchLog"
|
||||||
|
v-model:page="pageLog"
|
||||||
|
v-model="formLog"
|
||||||
|
:table-loading="loadingLog"
|
||||||
|
:data="logData"
|
||||||
|
ref="crudSub"
|
||||||
|
@current-change="currentChangeLog"
|
||||||
|
@size-change="sizeChangeLog"
|
||||||
|
@refresh-change="refreshChangeLog"
|
||||||
|
@on-load="onLoadLog">
|
||||||
|
</avue-crud>
|
||||||
|
</basic-container>
|
||||||
|
</el-drawer>
|
||||||
</basic-container>
|
</basic-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {getList, getDetail, add, update, remove} from "@/api/market/merchantCatalog";
|
import {
|
||||||
import option from "@/option/market/merchantCatalog";
|
getList,
|
||||||
import {mapGetters} from "vuex";
|
getDetail,
|
||||||
import 'nprogress/nprogress.css';
|
add,
|
||||||
|
update,
|
||||||
|
remove,
|
||||||
|
increaseStock,
|
||||||
|
reduceStock
|
||||||
|
} from "@/api/market/merchantCatalog";
|
||||||
|
import {getList as operateLogList} from "@/api/market/merchantCatalogOperateLog";
|
||||||
|
import option from "@/option/market/merchantCatalog";
|
||||||
|
import optionLog from "@/option/market/merchantCatalogOperateLog";
|
||||||
|
import {mapGetters} from "vuex";
|
||||||
|
import 'nprogress/nprogress.css';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
form: {},
|
form: {},
|
||||||
|
formLog: {},
|
||||||
query: {},
|
query: {},
|
||||||
search: {},
|
search: {},
|
||||||
|
searchLog: {},
|
||||||
loading: true,
|
loading: true,
|
||||||
|
loadingLog: true,
|
||||||
page: {
|
page: {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
total: 0
|
total: 0
|
||||||
},
|
},
|
||||||
|
pageLog: {
|
||||||
|
pageSize: 30,
|
||||||
|
currentPage: 1,
|
||||||
|
total: 0
|
||||||
|
},
|
||||||
selectionList: [],
|
selectionList: [],
|
||||||
option: option,
|
option: option,
|
||||||
data: []
|
optionLog: optionLog,
|
||||||
|
data: [],
|
||||||
|
logData: [],
|
||||||
|
logBox: false,
|
||||||
|
productName: "",
|
||||||
|
catalogId: 0,
|
||||||
|
direction: "rtl",
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -121,6 +182,60 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
handleIncrease(row) {
|
||||||
|
this.$prompt('请输入数量', '新增库存', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
inputPlaceholder: '数量不能为空',
|
||||||
|
inputValidator: (value) => {
|
||||||
|
const num = Number(value);
|
||||||
|
if (!Number.isInteger(num) || num <= 0) {
|
||||||
|
return '请填写正确数量';
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
inputErrorMessage: '请填写正确数量' // 这个其实会被 inputValidator 的返回值覆盖,可省略
|
||||||
|
}).then(({value}) => {
|
||||||
|
const num = Number(value.trim());
|
||||||
|
increaseStock(row.id, num)
|
||||||
|
.then(() => {
|
||||||
|
this.$message.success('操作成功');
|
||||||
|
this.onLoad(this.page, this.query);
|
||||||
|
});
|
||||||
|
console.log('用户输入:', value);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleReduce(row) {
|
||||||
|
this.$prompt('请输入数量', '减扣库存', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
inputPlaceholder: '数量不能为空',
|
||||||
|
inputValidator: (value) => {
|
||||||
|
const num = Number(value);
|
||||||
|
if (!Number.isInteger(num) || num <= 0 || num > row.stock) {
|
||||||
|
return '请填写正确数量';
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
inputErrorMessage: '请填写正确数量' // 这个其实会被 inputValidator 的返回值覆盖,可省略
|
||||||
|
}).then(({value}) => {
|
||||||
|
const num = Number(value.trim());
|
||||||
|
reduceStock(row.id, num)
|
||||||
|
.then(() => {
|
||||||
|
this.$message.success('操作成功');
|
||||||
|
this.onLoad(this.page, this.query);
|
||||||
|
});
|
||||||
|
console.log('用户输入:', value);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleLog(row) {
|
||||||
|
this.logBox = true;
|
||||||
|
this.catalogId = row.id;
|
||||||
|
this.productName = row.productName;
|
||||||
|
},
|
||||||
|
handleLogClose(hide) {
|
||||||
|
hide();
|
||||||
|
},
|
||||||
handleDelete() {
|
handleDelete() {
|
||||||
if (this.selectionList.length === 0) {
|
if (this.selectionList.length === 0) {
|
||||||
this.$message.warning("请选择至少一条数据");
|
this.$message.warning("请选择至少一条数据");
|
||||||
@@ -186,15 +301,27 @@
|
|||||||
this.selectionList = [];
|
this.selectionList = [];
|
||||||
this.$refs.crud.toggleSelection();
|
this.$refs.crud.toggleSelection();
|
||||||
},
|
},
|
||||||
currentChange(currentPage){
|
selectionClearLog() {
|
||||||
|
this.$refs.crudSub.toggleSelection();
|
||||||
|
},
|
||||||
|
currentChange(currentPage) {
|
||||||
this.page.currentPage = currentPage;
|
this.page.currentPage = currentPage;
|
||||||
},
|
},
|
||||||
sizeChange(pageSize){
|
currentChangeLog(currentPage) {
|
||||||
|
this.pageLog.currentPage = currentPage;
|
||||||
|
},
|
||||||
|
sizeChange(pageSize) {
|
||||||
this.page.pageSize = pageSize;
|
this.page.pageSize = pageSize;
|
||||||
},
|
},
|
||||||
|
sizeChangeLog(pageSize) {
|
||||||
|
this.pageLog.pageSize = pageSize;
|
||||||
|
},
|
||||||
refreshChange() {
|
refreshChange() {
|
||||||
this.onLoad(this.page, this.query);
|
this.onLoad(this.page, this.query);
|
||||||
},
|
},
|
||||||
|
refreshChangeLog() {
|
||||||
|
this.onLoad(this.page, this.query);
|
||||||
|
},
|
||||||
onLoad(page, params = {}) {
|
onLoad(page, params = {}) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
|
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
|
||||||
@@ -204,9 +331,19 @@
|
|||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.selectionClear();
|
this.selectionClear();
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
onLoadLog(page, params = {}) {
|
||||||
|
this.loadingLog = true;
|
||||||
|
operateLogList(page.currentPage, page.pageSize, Object.assign({ productId: this.catalogId },params, this.query)).then(res => {
|
||||||
|
const data = res.data.data;
|
||||||
|
this.pageLog.total = data.total;
|
||||||
|
this.logData = data.records;
|
||||||
|
this.loadingLog = false;
|
||||||
|
this.selectionClearLog();
|
||||||
|
});
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
Reference in New Issue
Block a user