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",
|
||||
type: "input",
|
||||
overHidden: true,
|
||||
span:24
|
||||
span:24,
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入商品名称',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "进货价",
|
||||
prop: "costPrice",
|
||||
type: "number",
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请填写进货价格',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "销售价",
|
||||
prop: "salePrice",
|
||||
type: "number",
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请填写销售价格',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "库存",
|
||||
prop: "stock",
|
||||
type: "number",
|
||||
editDisplay: false,
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请填写库存',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "所属用户",
|
||||
@@ -80,7 +114,14 @@ export default {
|
||||
res: 'data',
|
||||
url: 'link'
|
||||
},
|
||||
span:24
|
||||
span:24,
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请上传缩略图',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "商品主图",
|
||||
@@ -93,7 +134,14 @@ export default {
|
||||
res: 'data',
|
||||
url: 'link'
|
||||
},
|
||||
span:24
|
||||
span:24,
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请上传商品主图',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "商品详情图",
|
||||
@@ -106,7 +154,14 @@ export default {
|
||||
res: 'data',
|
||||
url: 'link'
|
||||
},
|
||||
span:24
|
||||
span:24,
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: '请上传商品主图',
|
||||
trigger: 'blur',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
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"
|
||||
@refresh-change="refreshChange"
|
||||
@on-load="onLoad">
|
||||
<!-- <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>-->
|
||||
<template #menu="{ row }">
|
||||
<el-button type="text"
|
||||
icon="el-icon-tickets"
|
||||
v-if="row.type === 1"
|
||||
@click.stop="handleLog(row)">操作日志
|
||||
</el-button>
|
||||
<el-button type="text"
|
||||
icon="el-icon-plus"
|
||||
v-if="row.type === 1"
|
||||
@click.stop="handleIncrease(row)">增加库存
|
||||
</el-button>
|
||||
<el-button type="text"
|
||||
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>
|
||||
<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>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getList, getDetail, add, update, remove} from "@/api/market/merchantCatalog";
|
||||
import option from "@/option/market/merchantCatalog";
|
||||
import {mapGetters} from "vuex";
|
||||
import 'nprogress/nprogress.css';
|
||||
import {
|
||||
getList,
|
||||
getDetail,
|
||||
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() {
|
||||
return {
|
||||
form: {},
|
||||
formLog: {},
|
||||
query: {},
|
||||
search: {},
|
||||
searchLog: {},
|
||||
loading: true,
|
||||
loadingLog: true,
|
||||
page: {
|
||||
pageSize: 10,
|
||||
currentPage: 1,
|
||||
total: 0
|
||||
},
|
||||
pageLog: {
|
||||
pageSize: 30,
|
||||
currentPage: 1,
|
||||
total: 0
|
||||
},
|
||||
selectionList: [],
|
||||
option: option,
|
||||
data: []
|
||||
optionLog: optionLog,
|
||||
data: [],
|
||||
logData: [],
|
||||
logBox: false,
|
||||
productName: "",
|
||||
catalogId: 0,
|
||||
direction: "rtl",
|
||||
};
|
||||
},
|
||||
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() {
|
||||
if (this.selectionList.length === 0) {
|
||||
this.$message.warning("请选择至少一条数据");
|
||||
@@ -186,15 +301,27 @@
|
||||
this.selectionList = [];
|
||||
this.$refs.crud.toggleSelection();
|
||||
},
|
||||
currentChange(currentPage){
|
||||
selectionClearLog() {
|
||||
this.$refs.crudSub.toggleSelection();
|
||||
},
|
||||
currentChange(currentPage) {
|
||||
this.page.currentPage = currentPage;
|
||||
},
|
||||
sizeChange(pageSize){
|
||||
currentChangeLog(currentPage) {
|
||||
this.pageLog.currentPage = currentPage;
|
||||
},
|
||||
sizeChange(pageSize) {
|
||||
this.page.pageSize = pageSize;
|
||||
},
|
||||
sizeChangeLog(pageSize) {
|
||||
this.pageLog.pageSize = pageSize;
|
||||
},
|
||||
refreshChange() {
|
||||
this.onLoad(this.page, this.query);
|
||||
},
|
||||
refreshChangeLog() {
|
||||
this.onLoad(this.page, this.query);
|
||||
},
|
||||
onLoad(page, params = {}) {
|
||||
this.loading = true;
|
||||
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
|
||||
@@ -204,9 +331,19 @@
|
||||
this.loading = false;
|
||||
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>
|
||||
|
||||
<style>
|
||||
|
||||
Reference in New Issue
Block a user