feat:
1. add merchant purchase module
This commit is contained in:
68
src/api/market/marketMerchantApplication.js
Normal file
68
src/api/market/marketMerchantApplication.js
Normal file
@@ -0,0 +1,68 @@
|
||||
import request from '@/axios';
|
||||
|
||||
export const getList = (current, size, params) => {
|
||||
return request({
|
||||
url: '/merchant-application/page',
|
||||
method: 'get',
|
||||
params: {
|
||||
...params,
|
||||
current,
|
||||
size,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const getDetail = (id) => {
|
||||
return request({
|
||||
url: '/merchant-application/detail',
|
||||
method: 'get',
|
||||
params: {
|
||||
id
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const remove = (ids) => {
|
||||
return request({
|
||||
url: '/merchant-application/remove',
|
||||
method: 'post',
|
||||
params: {
|
||||
ids,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const add = (row) => {
|
||||
return request({
|
||||
url: '/merchant-application/submit',
|
||||
method: 'post',
|
||||
data: row
|
||||
})
|
||||
}
|
||||
|
||||
export const update = (row) => {
|
||||
return request({
|
||||
url: '/merchant-application/submit',
|
||||
method: 'post',
|
||||
data: row
|
||||
})
|
||||
}
|
||||
|
||||
export const approveAudit = (id)=>{
|
||||
return request({
|
||||
url: '/merchant-application/approve',
|
||||
method: 'post',
|
||||
params: {
|
||||
id,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const rejectAudit = (id, reason) => {
|
||||
return request({
|
||||
url: '/merchant-application/reject',
|
||||
method: 'post',
|
||||
params: {id, reason}
|
||||
})
|
||||
}
|
||||
|
||||
50
src/api/market/merchantInventory.js
Normal file
50
src/api/market/merchantInventory.js
Normal file
@@ -0,0 +1,50 @@
|
||||
import request from '@/axios';
|
||||
|
||||
export const getList = (current, size, params) => {
|
||||
return request({
|
||||
url: '/blade-productinventory/productInventory/list',
|
||||
method: 'get',
|
||||
params: {
|
||||
...params,
|
||||
current,
|
||||
size,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const getDetail = (id) => {
|
||||
return request({
|
||||
url: '/blade-productinventory/productInventory/detail',
|
||||
method: 'get',
|
||||
params: {
|
||||
id
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const remove = (ids) => {
|
||||
return request({
|
||||
url: '/blade-productinventory/productInventory/remove',
|
||||
method: 'post',
|
||||
params: {
|
||||
ids,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const add = (row) => {
|
||||
return request({
|
||||
url: '/blade-productinventory/productInventory/submit',
|
||||
method: 'post',
|
||||
data: row
|
||||
})
|
||||
}
|
||||
|
||||
export const update = (row) => {
|
||||
return request({
|
||||
url: '/blade-productinventory/productInventory/submit',
|
||||
method: 'post',
|
||||
data: row
|
||||
})
|
||||
}
|
||||
|
||||
50
src/api/market/merchantProduct.js
Normal file
50
src/api/market/merchantProduct.js
Normal file
@@ -0,0 +1,50 @@
|
||||
import request from '@/axios';
|
||||
|
||||
export const getList = (current, size, params) => {
|
||||
return request({
|
||||
url: '/market/merchant-product/page',
|
||||
method: 'get',
|
||||
params: {
|
||||
...params,
|
||||
current,
|
||||
size,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const getDetail = (id) => {
|
||||
return request({
|
||||
url: '/market/merchant-product/detail',
|
||||
method: 'get',
|
||||
params: {
|
||||
id
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const remove = (ids) => {
|
||||
return request({
|
||||
url: '/market/merchant-product/remove',
|
||||
method: 'post',
|
||||
params: {
|
||||
ids,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const add = (row) => {
|
||||
return request({
|
||||
url: '/market/merchant-product/submit-self-product',
|
||||
method: 'post',
|
||||
data: row
|
||||
})
|
||||
}
|
||||
|
||||
export const update = (row) => {
|
||||
return request({
|
||||
url: '/market/merchant-product/submit',
|
||||
method: 'post',
|
||||
data: row
|
||||
})
|
||||
}
|
||||
|
||||
151
src/option/market/marketMerchantApplication.js
Normal file
151
src/option/market/marketMerchantApplication.js
Normal file
@@ -0,0 +1,151 @@
|
||||
export default {
|
||||
height:'auto',
|
||||
calcHeight: 30,
|
||||
tip: false,
|
||||
searchShow: true,
|
||||
searchMenuSpan: 6,
|
||||
border: true,
|
||||
index: true,
|
||||
addBtn: false,
|
||||
viewBtn: false,
|
||||
editBtn: false,
|
||||
delBtn: false,
|
||||
dialogClickModal: false,
|
||||
column: [
|
||||
{
|
||||
label: "主键",
|
||||
prop: "id",
|
||||
type: "input",
|
||||
addDisplay: false,
|
||||
editDisplay: false,
|
||||
viewDisplay: false,
|
||||
hide: true,
|
||||
},
|
||||
{
|
||||
label: "用户id",
|
||||
prop: "userId",
|
||||
type: "input",
|
||||
addDisplay: false,
|
||||
editDisplay: false,
|
||||
viewDisplay: false,
|
||||
hide: true,
|
||||
},
|
||||
{
|
||||
label: "用户账号",
|
||||
prop: "userAccount",
|
||||
type: "input",
|
||||
editDisplay: false,
|
||||
search: true,
|
||||
overHidden: true,
|
||||
},
|
||||
{
|
||||
label: "商家类型",
|
||||
prop: "type",
|
||||
type: "select",
|
||||
dicUrl: "/blade-system/dict/dictionary?code=merchant_type",
|
||||
dataType: "number",
|
||||
props: {
|
||||
label: "dictValue",
|
||||
value: "dictKey"
|
||||
},
|
||||
editDisplay: false,
|
||||
search: true,
|
||||
},
|
||||
{
|
||||
label: "公司名称",
|
||||
prop: "companyName",
|
||||
type: "input",
|
||||
editDisplay: false,
|
||||
},
|
||||
{
|
||||
label: "营业执照注册号",
|
||||
prop: "businessLicense",
|
||||
type: "input",
|
||||
editDisplay: false,
|
||||
},
|
||||
{
|
||||
label: "营业执照图片",
|
||||
prop: "businessLicenseUrl",
|
||||
type: "upload",
|
||||
listType: 'picture-img',
|
||||
editDisplay: false,
|
||||
},
|
||||
{
|
||||
label: "法人姓名",
|
||||
prop: "legalPerson",
|
||||
type: "input",
|
||||
editDisplay: false,
|
||||
},
|
||||
{
|
||||
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: "select",
|
||||
dicUrl: "/blade-system/dict/dictionary?code=merchant_audit_status",
|
||||
dataType: "number",
|
||||
props: {
|
||||
label: "dictValue",
|
||||
value: "dictKey"
|
||||
},
|
||||
search: true,
|
||||
},
|
||||
{
|
||||
label: "是否已删除",
|
||||
prop: "isDeleted",
|
||||
type: "input",
|
||||
addDisplay: false,
|
||||
editDisplay: false,
|
||||
viewDisplay: false,
|
||||
hide: true,
|
||||
},
|
||||
]
|
||||
}
|
||||
121
src/option/market/merchantInventory.js
Normal file
121
src/option/market/merchantInventory.js
Normal file
@@ -0,0 +1,121 @@
|
||||
export default {
|
||||
height:'auto',
|
||||
calcHeight: 30,
|
||||
tip: false,
|
||||
searchShow: true,
|
||||
searchMenuSpan: 6,
|
||||
border: true,
|
||||
index: true,
|
||||
viewBtn: true,
|
||||
selection: true,
|
||||
dialogClickModal: false,
|
||||
column: [
|
||||
{
|
||||
label: "主键",
|
||||
prop: "id",
|
||||
type: "input",
|
||||
addDisplay: false,
|
||||
editDisplay: false,
|
||||
viewDisplay: false,
|
||||
hide: true,
|
||||
},
|
||||
{
|
||||
label: "用户id",
|
||||
prop: "userId",
|
||||
type: "input",
|
||||
},
|
||||
{
|
||||
label: "用户账号",
|
||||
prop: "userAccount",
|
||||
type: "input",
|
||||
},
|
||||
{
|
||||
label: "商品类型: 1-自营商品, 2-企业商品",
|
||||
prop: "type",
|
||||
type: "input",
|
||||
},
|
||||
{
|
||||
label: "商品名称",
|
||||
prop: "productName",
|
||||
type: "input",
|
||||
},
|
||||
{
|
||||
label: "商品id",
|
||||
prop: "productId",
|
||||
type: "input",
|
||||
},
|
||||
{
|
||||
label: "库存数量",
|
||||
prop: "quantity",
|
||||
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,
|
||||
hide: 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,
|
||||
},
|
||||
]
|
||||
}
|
||||
199
src/option/market/merchantProduct.js
Normal file
199
src/option/market/merchantProduct.js
Normal file
@@ -0,0 +1,199 @@
|
||||
export default {
|
||||
height: 'auto',
|
||||
calcHeight: 30,
|
||||
tip: false,
|
||||
searchShow: true,
|
||||
searchMenuSpan: 6,
|
||||
border: true,
|
||||
index: true,
|
||||
viewBtn: false,
|
||||
editBtn: true,
|
||||
delBtn: false,
|
||||
selection: false,
|
||||
dialogClickModal: false,
|
||||
column: [
|
||||
{
|
||||
label: "主键",
|
||||
prop: "id",
|
||||
type: "input",
|
||||
addDisplay: false,
|
||||
editDisplay: false,
|
||||
viewDisplay: false,
|
||||
hide: true,
|
||||
},
|
||||
{
|
||||
label: "用户id",
|
||||
prop: "userId",
|
||||
type: "input",
|
||||
addDisplay: false,
|
||||
editDisplay: false,
|
||||
viewDisplay: false,
|
||||
hide: true,
|
||||
},
|
||||
{
|
||||
label: "类型",
|
||||
prop: "type",
|
||||
type: "select",
|
||||
dicUrl: "/blade-system/dict/dictionary?code=merchant_product_type",
|
||||
dataType: "number",
|
||||
addDisplay: false,
|
||||
props: {
|
||||
label: "dictValue",
|
||||
value: "dictKey"
|
||||
}, search: true,
|
||||
},
|
||||
{
|
||||
label: "名称",
|
||||
prop: "productName",
|
||||
type: "input",
|
||||
overHidden: true,
|
||||
},
|
||||
{
|
||||
label: "进货价",
|
||||
prop: "costPrice",
|
||||
type: "number",
|
||||
},
|
||||
{
|
||||
label: "所属用户",
|
||||
prop: "userAccount",
|
||||
type: "input",
|
||||
addDisplay: false,
|
||||
editDisplay: false,
|
||||
viewDisplay: false,
|
||||
search: true,
|
||||
},
|
||||
{
|
||||
label: "商品缩略图",
|
||||
prop: "thumbImageUrl",
|
||||
type: "upload",
|
||||
listType: 'picture-img',
|
||||
dataType: 'string',
|
||||
action: '/blade-resource/oss/endpoint/put-file',
|
||||
propsHttp: {
|
||||
res: 'data',
|
||||
url: 'link'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "商品主图",
|
||||
prop: "mainImageUrls",
|
||||
type: "upload",
|
||||
listType: 'picture-card',
|
||||
multiple: true,
|
||||
action: '/blade-resource/oss/endpoint/put-file',
|
||||
propsHttp: {
|
||||
res: 'data',
|
||||
url: 'link'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "商品详情图",
|
||||
prop: "detailImageUrls",
|
||||
type: "upload",
|
||||
listType: 'picture-card',
|
||||
multiple: true,
|
||||
action: '/blade-resource/oss/endpoint/put-file',
|
||||
propsHttp: {
|
||||
res: 'data',
|
||||
url: 'link'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "规格",
|
||||
prop: "specs",
|
||||
type: "dynamic",
|
||||
span: 24,
|
||||
children:{
|
||||
rowAdd: (done)=>{
|
||||
done();
|
||||
},
|
||||
rowDel: (row, done) => {
|
||||
done();
|
||||
},
|
||||
column: [
|
||||
{
|
||||
label: "名称",
|
||||
prop: "attr",
|
||||
},
|
||||
{
|
||||
label: "值",
|
||||
prop: "value",
|
||||
}
|
||||
],
|
||||
},
|
||||
formatter: (row, value, cellValue) => {
|
||||
if (!Array.isArray(value)) return '';
|
||||
return value.map(s => `${s.attr} : ${s.value}`).join('; ');
|
||||
},
|
||||
overHidden: true,
|
||||
},
|
||||
{
|
||||
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,
|
||||
hide: 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,
|
||||
},
|
||||
]
|
||||
}
|
||||
211
src/views/market/marketMerchantApplication.vue
Normal file
211
src/views/market/marketMerchantApplication.vue
Normal file
@@ -0,0 +1,211 @@
|
||||
<template>
|
||||
<basic-container>
|
||||
<avue-crud :option="option"
|
||||
v-model:search="search"
|
||||
v-model:page="page"
|
||||
v-model="form"
|
||||
:table-loading="loading"
|
||||
:data="data"
|
||||
:permission="permissionList"
|
||||
:before-open="beforeOpen"
|
||||
ref="crud"
|
||||
@row-update="rowUpdate"
|
||||
@row-save="rowSave"
|
||||
@row-del="rowDel"
|
||||
@search-change="searchChange"
|
||||
@search-reset="searchReset"
|
||||
@selection-change="selectionChange"
|
||||
@current-change="currentChange"
|
||||
@size-change="sizeChange"
|
||||
@refresh-change="refreshChange"
|
||||
@on-load="onLoad">
|
||||
<template #menu="{ row }">
|
||||
<el-button type="text"
|
||||
icon="el-icon-circle-check"
|
||||
v-if="row.status === 1"
|
||||
@click.stop="handleApprove(row)">通过
|
||||
</el-button>
|
||||
<el-button type="text"
|
||||
style="color: #cd5c5c;"
|
||||
icon="el-icon-circle-close"
|
||||
v-if="row.status === 1"
|
||||
@click.stop="handleReject(row)">拒绝
|
||||
</el-button>
|
||||
</template>
|
||||
</avue-crud>
|
||||
</basic-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getList, getDetail, add, update, remove, approveAudit, rejectAudit} from "@/api/market/marketMerchantApplication";
|
||||
import option from "@/option/market/marketMerchantApplication";
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
form: {},
|
||||
query: {},
|
||||
search: {},
|
||||
loading: true,
|
||||
page: {
|
||||
pageSize: 10,
|
||||
currentPage: 1,
|
||||
total: 0
|
||||
},
|
||||
selectionList: [],
|
||||
option: option,
|
||||
data: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(["permission"]),
|
||||
permissionList() {
|
||||
return {
|
||||
addBtn: this.validData(this.permission.application_add, false),
|
||||
viewBtn: this.validData(this.permission.application_view, false),
|
||||
delBtn: this.validData(this.permission.application_delete, false),
|
||||
editBtn: this.validData(this.permission.application_edit, false)
|
||||
};
|
||||
},
|
||||
ids() {
|
||||
let ids = [];
|
||||
this.selectionList.forEach(ele => {
|
||||
ids.push(ele.id);
|
||||
});
|
||||
return ids.join(",");
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
rowSave(row, done, loading) {
|
||||
add(row).then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
done();
|
||||
}, error => {
|
||||
loading();
|
||||
window.console.log(error);
|
||||
});
|
||||
},
|
||||
rowUpdate(row, index, done, loading) {
|
||||
update(row).then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
done();
|
||||
}, error => {
|
||||
loading();
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
rowDel(row) {
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(row.id);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
});
|
||||
},
|
||||
beforeOpen(done, type) {
|
||||
if (["edit", "view"].includes(type)) {
|
||||
getDetail(this.form.id).then(res => {
|
||||
this.form = res.data.data;
|
||||
});
|
||||
}
|
||||
done();
|
||||
},
|
||||
handleApprove(row) {
|
||||
this.$confirm('确认通过审核吗?', {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(() => {
|
||||
return approveAudit(row.id);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: '操作成功!'
|
||||
});
|
||||
});
|
||||
},
|
||||
handleReject(row) {
|
||||
this.$prompt('请输入拒绝原因','拒绝申请', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
inputPlaceholder: '拒绝原因不能为空',
|
||||
inputValidator: (value) => {
|
||||
if (!value || value.trim() === '') {
|
||||
return '拒绝原因不能为空';
|
||||
}
|
||||
return true;
|
||||
},
|
||||
inputErrorMessage: '拒绝原因不能为空' // 这个其实会被 inputValidator 的返回值覆盖,可省略
|
||||
}).then(({ value }) => {
|
||||
const reason = value.trim();
|
||||
rejectAudit(row.id, reason)
|
||||
.then(()=>{
|
||||
this.$message.success('操作成功');
|
||||
this.onLoad(this.page, this.query);
|
||||
});
|
||||
console.log('用户输入:', value);
|
||||
});
|
||||
},
|
||||
searchReset() {
|
||||
this.query = {};
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
searchChange(params, done) {
|
||||
this.query = params;
|
||||
this.page.currentPage = 1;
|
||||
this.onLoad(this.page, params);
|
||||
done();
|
||||
},
|
||||
selectionChange(list) {
|
||||
this.selectionList = list;
|
||||
},
|
||||
selectionClear() {
|
||||
this.selectionList = [];
|
||||
this.$refs.crud.toggleSelection();
|
||||
},
|
||||
currentChange(currentPage){
|
||||
this.page.currentPage = currentPage;
|
||||
},
|
||||
sizeChange(pageSize){
|
||||
this.page.pageSize = pageSize;
|
||||
},
|
||||
refreshChange() {
|
||||
this.onLoad(this.page, this.query);
|
||||
},
|
||||
onLoad(page, params = {}) {
|
||||
this.loading = true;
|
||||
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
|
||||
const data = res.data.data;
|
||||
this.page.total = data.total;
|
||||
this.data = data.records;
|
||||
this.loading = false;
|
||||
this.selectionClear();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
225
src/views/market/merchantInventory.vue
Normal file
225
src/views/market/merchantInventory.vue
Normal file
@@ -0,0 +1,225 @@
|
||||
<template>
|
||||
<basic-container>
|
||||
<avue-crud :option="option"
|
||||
v-model:search="search"
|
||||
v-model:page="page"
|
||||
v-model="form"
|
||||
:table-loading="loading"
|
||||
:data="data"
|
||||
:permission="permissionList"
|
||||
:before-open="beforeOpen"
|
||||
ref="crud"
|
||||
@row-update="rowUpdate"
|
||||
@row-save="rowSave"
|
||||
@row-del="rowDel"
|
||||
@search-change="searchChange"
|
||||
@search-reset="searchReset"
|
||||
@selection-change="selectionChange"
|
||||
@current-change="currentChange"
|
||||
@size-change="sizeChange"
|
||||
@refresh-change="refreshChange"
|
||||
@on-load="onLoad">
|
||||
<template #menu-left>
|
||||
<el-button type="danger"
|
||||
icon="el-icon-delete"
|
||||
plain
|
||||
v-if="permission.productInventory_delete"
|
||||
@click="handleDelete">删 除
|
||||
</el-button>
|
||||
<el-button type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
@click="handleExport">导 出
|
||||
</el-button>
|
||||
</template>
|
||||
</avue-crud>
|
||||
</basic-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getList, getDetail, add, update, remove} from "@/api/market/merchantInventory";
|
||||
import option from "@/option/market/merchantInventory";
|
||||
import {mapGetters} from "vuex";
|
||||
import {exportBlob} from "@/api/common";
|
||||
import {getToken} from '@/utils/auth';
|
||||
import {downloadXls} from "@/utils/util";
|
||||
import {dateNow} from "@/utils/date";
|
||||
import NProgress from 'nprogress';
|
||||
import 'nprogress/nprogress.css';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
form: {},
|
||||
query: {},
|
||||
search: {},
|
||||
loading: true,
|
||||
page: {
|
||||
pageSize: 10,
|
||||
currentPage: 1,
|
||||
total: 0
|
||||
},
|
||||
selectionList: [],
|
||||
option: option,
|
||||
data: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(["permission"]),
|
||||
permissionList() {
|
||||
return {
|
||||
addBtn: this.validData(this.permission.productInventory_add, false),
|
||||
viewBtn: this.validData(this.permission.productInventory_view, false),
|
||||
delBtn: this.validData(this.permission.productInventory_delete, false),
|
||||
editBtn: this.validData(this.permission.productInventory_edit, false)
|
||||
};
|
||||
},
|
||||
ids() {
|
||||
let ids = [];
|
||||
this.selectionList.forEach(ele => {
|
||||
ids.push(ele.id);
|
||||
});
|
||||
return ids.join(",");
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
rowSave(row, done, loading) {
|
||||
add(row).then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
done();
|
||||
}, error => {
|
||||
loading();
|
||||
window.console.log(error);
|
||||
});
|
||||
},
|
||||
rowUpdate(row, index, done, loading) {
|
||||
update(row).then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
done();
|
||||
}, error => {
|
||||
loading();
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
rowDel(row) {
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(row.id);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
});
|
||||
},
|
||||
handleDelete() {
|
||||
if (this.selectionList.length === 0) {
|
||||
this.$message.warning("请选择至少一条数据");
|
||||
return;
|
||||
}
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(this.ids);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
this.$refs.crud.toggleSelection();
|
||||
});
|
||||
},
|
||||
handleExport() {
|
||||
let downloadUrl = `/blade-productinventory/productInventory/export-productInventory?${this.website.tokenHeader}=${getToken()}`;
|
||||
const {
|
||||
} = this.query;
|
||||
let values = {
|
||||
};
|
||||
this.$confirm("是否导出数据?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(() => {
|
||||
NProgress.start();
|
||||
exportBlob(downloadUrl, values).then(res => {
|
||||
downloadXls(res.data, `自营商家库存表${dateNow()}.xlsx`);
|
||||
NProgress.done();
|
||||
})
|
||||
});
|
||||
},
|
||||
beforeOpen(done, type) {
|
||||
if (["edit", "view"].includes(type)) {
|
||||
getDetail(this.form.id).then(res => {
|
||||
this.form = res.data.data;
|
||||
});
|
||||
}
|
||||
done();
|
||||
},
|
||||
searchReset() {
|
||||
this.query = {};
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
searchChange(params, done) {
|
||||
this.query = params;
|
||||
this.page.currentPage = 1;
|
||||
this.onLoad(this.page, params);
|
||||
done();
|
||||
},
|
||||
selectionChange(list) {
|
||||
this.selectionList = list;
|
||||
},
|
||||
selectionClear() {
|
||||
this.selectionList = [];
|
||||
this.$refs.crud.toggleSelection();
|
||||
},
|
||||
currentChange(currentPage){
|
||||
this.page.currentPage = currentPage;
|
||||
},
|
||||
sizeChange(pageSize){
|
||||
this.page.pageSize = pageSize;
|
||||
},
|
||||
refreshChange() {
|
||||
this.onLoad(this.page, this.query);
|
||||
},
|
||||
onLoad(page, params = {}) {
|
||||
this.loading = true;
|
||||
|
||||
const {
|
||||
} = this.query;
|
||||
|
||||
let values = {
|
||||
};
|
||||
|
||||
getList(page.currentPage, page.pageSize, values).then(res => {
|
||||
const data = res.data.data;
|
||||
this.page.total = data.total;
|
||||
this.data = data.records;
|
||||
this.loading = false;
|
||||
this.selectionClear();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
218
src/views/market/merchantProduct.vue
Normal file
218
src/views/market/merchantProduct.vue
Normal file
@@ -0,0 +1,218 @@
|
||||
<template>
|
||||
<basic-container>
|
||||
<avue-crud :option="option"
|
||||
v-model:search="search"
|
||||
v-model:page="page"
|
||||
v-model="form"
|
||||
:table-loading="loading"
|
||||
:data="data"
|
||||
:permission="permissionList"
|
||||
:before-open="beforeOpen"
|
||||
ref="crud"
|
||||
@row-update="rowUpdate"
|
||||
@row-save="rowSave"
|
||||
@row-del="rowDel"
|
||||
@search-change="searchChange"
|
||||
@search-reset="searchReset"
|
||||
@selection-change="selectionChange"
|
||||
@current-change="currentChange"
|
||||
@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>-->
|
||||
</avue-crud>
|
||||
</basic-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getList, getDetail, add, update, remove} from "@/api/market/merchantProduct";
|
||||
import option from "@/option/market/merchantProduct";
|
||||
import {mapGetters} from "vuex";
|
||||
import {exportBlob} from "@/api/common";
|
||||
import {getToken} from '@/utils/auth';
|
||||
import {downloadXls} from "@/utils/util";
|
||||
import {dateNow} from "@/utils/date";
|
||||
import NProgress from 'nprogress';
|
||||
import 'nprogress/nprogress.css';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
form: {},
|
||||
query: {},
|
||||
search: {},
|
||||
loading: true,
|
||||
page: {
|
||||
pageSize: 10,
|
||||
currentPage: 1,
|
||||
total: 0
|
||||
},
|
||||
selectionList: [],
|
||||
option: option,
|
||||
data: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(["permission"]),
|
||||
permissionList() {
|
||||
return {
|
||||
addBtn: this.validData(this.permission.merchantproduct_add, false),
|
||||
viewBtn: this.validData(this.permission.merchantproduct_view, false),
|
||||
delBtn: this.validData(this.permission.merchantproduct_delete, false),
|
||||
editBtn: this.validData(this.permission.merchantproduct_edit, false)
|
||||
};
|
||||
},
|
||||
ids() {
|
||||
let ids = [];
|
||||
this.selectionList.forEach(ele => {
|
||||
ids.push(ele.id);
|
||||
});
|
||||
return ids.join(",");
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
rowSave(row, done, loading) {
|
||||
add(row).then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
done();
|
||||
}, error => {
|
||||
loading();
|
||||
window.console.log(error);
|
||||
});
|
||||
},
|
||||
rowUpdate(row, index, done, loading) {
|
||||
update(row).then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
done();
|
||||
}, error => {
|
||||
loading();
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
rowDel(row) {
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(row.id);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
});
|
||||
},
|
||||
handleDelete() {
|
||||
if (this.selectionList.length === 0) {
|
||||
this.$message.warning("请选择至少一条数据");
|
||||
return;
|
||||
}
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(this.ids);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
this.$refs.crud.toggleSelection();
|
||||
});
|
||||
},
|
||||
// handleExport() {
|
||||
// let downloadUrl = `/blade-merchantproduct/merchantproduct/export-merchantproduct?${this.website.tokenHeader}=${getToken()}`;
|
||||
// const {
|
||||
// } = this.query;
|
||||
// let values = {
|
||||
// };
|
||||
// this.$confirm("是否导出数据?", "提示", {
|
||||
// confirmButtonText: "确定",
|
||||
// cancelButtonText: "取消",
|
||||
// type: "warning"
|
||||
// }).then(() => {
|
||||
// NProgress.start();
|
||||
// exportBlob(downloadUrl, values).then(res => {
|
||||
// downloadXls(res.data, `自营商家商品表${dateNow()}.xlsx`);
|
||||
// NProgress.done();
|
||||
// })
|
||||
// });
|
||||
// },
|
||||
beforeOpen(done, type) {
|
||||
if (["edit", "view"].includes(type)) {
|
||||
getDetail(this.form.id).then(res => {
|
||||
this.form = res.data.data;
|
||||
});
|
||||
}
|
||||
done();
|
||||
},
|
||||
searchReset() {
|
||||
this.query = {};
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
searchChange(params, done) {
|
||||
this.query = params;
|
||||
this.page.currentPage = 1;
|
||||
this.onLoad(this.page, params);
|
||||
done();
|
||||
},
|
||||
selectionChange(list) {
|
||||
this.selectionList = list;
|
||||
},
|
||||
selectionClear() {
|
||||
this.selectionList = [];
|
||||
this.$refs.crud.toggleSelection();
|
||||
},
|
||||
currentChange(currentPage){
|
||||
this.page.currentPage = currentPage;
|
||||
},
|
||||
sizeChange(pageSize){
|
||||
this.page.pageSize = pageSize;
|
||||
},
|
||||
refreshChange() {
|
||||
this.onLoad(this.page, this.query);
|
||||
},
|
||||
onLoad(page, params = {}) {
|
||||
this.loading = true;
|
||||
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
|
||||
const data = res.data.data;
|
||||
this.page.total = data.total;
|
||||
this.data = data.records;
|
||||
this.loading = false;
|
||||
this.selectionClear();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
Reference in New Issue
Block a user