feat: 增加购物须知配置模块

This commit is contained in:
lzhizhao 2025-05-20 21:58:14 +08:00
parent 5ab6d86bd9
commit e451cc6544
5 changed files with 473 additions and 199 deletions

View File

@ -2,45 +2,105 @@ import $http from '../../utils/httpRequest'
// 修改密码
export const password = (password, newPassword) => {
return $http({
url: '/sys/user/password',
method: 'post',
data: $http.adornData({
'password': password,
'newPassword': newPassword
})
return $http({
url: '/sys/user/password',
method: 'post',
data: $http.adornData({
password: password,
newPassword: newPassword
})
})
}
// 退出登录
export const logout = () => {
return $http({
url: '/merchant-api/auth/logout',
method: 'post',
data: $http.adornData()
})
return $http({
url: '/merchant-api/auth/logout',
method: 'post',
data: $http.adornData()
})
}
// 获取用户信息
export const getUserInfo=()=>{
return $http({
url: '/merchant-api/auth/info',
method: 'get',
params: $http.adornParams()
})
export const getUserInfo = () => {
return $http({
url: '/merchant-api/auth/info',
method: 'get',
params: $http.adornParams()
})
}
//登录接口
export const login=(username,password,uuid,captcha)=>{
return $http({
url: '/auth/login',
method: 'post',
data: $http.adornData({
'username': username,
'password': password,
'code':captcha,
'uuid': uuid,
// 'captcha': captcha
})
})
export const login = (username, password, uuid, captcha) => {
return $http({
url: '/auth/login',
method: 'post',
data: $http.adornData({
username: username,
password: password,
code: captcha,
uuid: uuid
// 'captcha': captcha
})
})
}
// 获取市场购物须知
export const getMarketPayNotice = marketId => {
return $http({
url: '/merchant-api/pay-notice/market/' + marketId,
method: 'get'
})
}
// 获取店铺购物须知
export const getShopPayNotice = shopId => {
return $http({
url: '/merchant-api/pay-notice/shop/' + shopId,
method: 'get'
})
}
// 修改菜市场须知
export const updateMarketPayNotice = data => {
return $http({
url: '/merchant-api/pay-notice/market',
method: 'put',
data: $http.adornData({
...data
})
})
}
// 创建菜市场须知
export const createMarketPayNotice = data => {
return $http({
url: '/merchant-api/pay-notice/market',
method: 'post',
data: $http.adornData({
...data
})
})
}
// 修改店铺须知
export const updateShopPayNotice = data => {
return $http({
url: '/merchant-api/pay-notice/shop',
method: 'put',
data: $http.adornData({
...data
})
})
}
// 创建店铺须知
export const createShopPayNotice = data => {
return $http({
url: '/merchant-api/pay-notice/shop',
method: 'post',
data: $http.adornData({
...data
})
})
}

View File

@ -169,6 +169,19 @@ export default {
open: null,
list: [],
},
{
menuId: getUUID(),
parentId: 0,
parentName: null,
name: "购物须知管理",
url: "operation-management/paynotice/index",
perms: "",
type: 1,
elIcon: "el-icon-menu",
orderNum: 0,
open: null,
list: [],
},
{
menuId: getUUID(),
parentId: 0,

View File

@ -149,6 +149,7 @@ export function getMenu(role) {
"operation-management/order/index",
"operation-management/banner/index",
"operation-management/notice/index",
"operation-management/paynotice/index",
"operation-management/role/index",
"datacenter",
"datacenter/customer-analysis/index",

View File

@ -149,43 +149,43 @@
</template>
<script>
import { mapState } from "vuex";
import AddDiscount from "./popup/add-discount.vue";
import AddPrice from "./popup/add-price.vue";
import AddOrUpdate from "./popup/add-or-update.vue";
import addStock from "./popup/add-stock.vue";
import { mapState } from 'vuex'
import AddDiscount from './popup/add-discount.vue'
import AddPrice from './popup/add-price.vue'
import AddOrUpdate from './popup/add-or-update.vue'
import addStock from './popup/add-stock.vue'
export default {
components: { AddOrUpdate, AddPrice, addStock, AddDiscount },
data() {
return {
activeName: "在售",
activeName: '在售',
dataList: [],
formInline: {
name: "",
marketId: "",
shopId: "",
name: '',
marketId: '',
shopId: ''
},
tableProp: {
"auto-resize": true,
'auto-resize': true,
border: true,
height: "auto",
"row-id": "id",
"show-overflow": false,
height: 'auto',
'row-id': 'id',
'show-overflow': false
},
productFilterType: "SALE",
productFilterType: 'SALE',
selectList: [],
overview: {},
};
overview: {}
}
},
created() {
this.formInline = {
name: "",
name: '',
marketId: this.marketId,
shopId: this.shopId,
};
shopId: this.shopId
}
this.$nextTick(() => {
this.$refs.oTable.reload();
});
this.$refs.oTable.reload()
})
},
methods: {
//
@ -200,194 +200,194 @@ export default {
// });
},
addProduct() {
this.$refs.addOrUpdate.toggle().add(this.formInline.shopId);
this.$refs.addOrUpdate.toggle().add(this.formInline.shopId)
},
deleteProduct() {
console.log(this.selectList);
let integers = this.selectList.map((item) => {
return item.id;
});
this.$confirm("此操作将删除该商品, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
console.log(this.selectList)
let integers = this.selectList.map(item => {
return item.id
})
this.$confirm('此操作将删除该商品, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
console.log("111");
this.$api.mer_admin.BatchDeleteProducts(integers).then((res) => {
this.$refs.oTable.reload();
});
console.log('111')
this.$api.mer_admin.BatchDeleteProducts(integers).then(res => {
this.$refs.oTable.reload()
})
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除",
});
});
type: 'info',
message: '已取消删除'
})
})
},
queryList(pageNo, pageSize) {
console.log(this.formInline);
console.log(this.formInline)
this.$api.mer_admin
.getProductPage({
p: {
pageNumber: pageNo,
pageSize: pageSize,
pageSize: pageSize
},
...this.formInline,
productFilterType: this.productFilterType,
merchantId: JSON.parse(sessionStorage.getItem("userInfo")).merchantId,
productQuerySortParam: [],
merchantId: JSON.parse(sessionStorage.getItem('userInfo')).merchantId,
productQuerySortParam: []
})
.then((res) => {
console.log(res);
.then(res => {
console.log(res)
this.$refs.oTable.complete(
res.data.data.data,
Number(res.data.data.total)
);
)
})
.catch((err) => {
this.$refs.oTable.complete(false);
});
this.$api.mer_admin.getProductOverview(this.formInline).then((res) => {
console.log(res, "概况");
this.overview = res.data.data;
});
.catch(err => {
this.$refs.oTable.complete(false)
})
this.$api.mer_admin.getProductOverview(this.formInline).then(res => {
console.log(res, '概况')
this.overview = res.data.data
})
},
Reset() {
this.formInline = {
name: "",
name: '',
marketId: this.marketId,
shopId: this.shopId,
};
this.$refs.oTable.reload();
shopId: this.shopId
}
this.$refs.oTable.reload()
},
handleClick() {
switch (this.activeName) {
case "在售":
this.productFilterType = "SALE";
break;
case "仓库中":
this.productFilterType = "WAREHOUSE";
break;
case "折扣":
this.productFilterType = "DISCOUNT";
break;
case '在售':
this.productFilterType = 'SALE'
break
case '仓库中':
this.productFilterType = 'WAREHOUSE'
break
case '折扣':
this.productFilterType = 'DISCOUNT'
break
}
this.$refs.oTable.reload();
},
this.$refs.oTable.reload()
}
},
computed: {
tableCols() {
return [
{ type: "checkbox", width: "60px", fixed: "left" },
{ type: 'checkbox', width: '60px', fixed: 'left' },
// { type: "seq", width: "60px", align: "center", title: "" },
{
title: "商品图",
field: "productPhotoList",
align: "center",
width: "80px",
type: "jsx",
title: '商品图',
field: 'productPhotoList',
align: 'center',
width: '80px',
type: 'jsx',
render: ({ row }) => {
if (row.productPhotoList.length > 0) {
return (
<el-image
preview-src-list={row.productPhotoList.map((item) => {
return item.url;
preview-src-list={row.productPhotoList.map(item => {
return item.url
})}
src={row.productPhotoList[0].url}
></el-image>
);
)
} else {
return <span>暂无商品图</span>;
return <span>暂无商品图</span>
}
},
}
},
{
title: "商品名称",
align: "center",
field: "name",
title: '商品名称',
align: 'center',
field: 'name'
},
{
title: "商品售价",
align: "center",
field: "minSalePrice",
type: "jsx",
title: '商品售价',
align: 'center',
field: 'minSalePrice',
type: 'jsx',
render: ({ row }) => {
if (row.minSalePrice == row.maxSalePrice) {
return <span>{row.minSalePrice}</span>;
return <span>{row.minSalePrice}</span>
} else {
return (
<span>
{row.minSalePrice}~{row.maxSalePrice}
</span>
);
)
}
},
}
},
{
title: "折扣",
align: "center",
field: "discountActivity",
type: "jsx",
title: '折扣',
align: 'center',
field: 'discountActivity',
type: 'jsx',
render: ({ row }) => {
if (row.discountActivity) {
return <span>{row.discountActivity.ruleObject.discount}</span>;
return <span>{row.discountActivity.ruleObject.discount}</span>
}
},
}
},
{
title: "销量",
align: "center",
field: "saleNum",
title: '销量',
align: 'center',
field: 'saleNum'
},
{
title: "库存",
align: "center",
field: "stockNum",
title: '库存',
align: 'center',
field: 'stockNum'
},
{
title: "是否为预售商品",
align: "center",
field: "isAdvanceSell",
type: "jsx",
title: '是否为预售商品',
align: 'center',
field: 'isAdvanceSell',
type: 'jsx',
render: ({ row }) => {
return <span>{row.isAdvanceSell == 1 ? "是" : "否"}</span>;
},
return <span>{row.isAdvanceSell == 1 ? '是' : '否'}</span>
}
},
{
title: "状态",
title: '状态',
// fixed: "right",
type: "jsx",
align: "center",
"title-suffix": {
message: "点击上架/下架切换责任书状态",
icon: "vxe-icon-question-circle-fill",
type: 'jsx',
align: 'center',
'title-suffix': {
message: '点击上架/下架切换责任书状态',
icon: 'vxe-icon-question-circle-fill'
},
render: ({ row }) => {
let Enable = () => {
let data = {
ids: [row.id],
status: "UP",
};
if (row.status == "UP") {
data.status = "DOWN";
} else {
data.status = "UP";
status: 'UP'
}
this.$api.mer_admin.putOnShelvesProducts(data).then((res) => {
console.log(res);
this.$refs.oTable.reload();
});
};
if (row.status == 'UP') {
data.status = 'DOWN'
} else {
data.status = 'UP'
}
this.$api.mer_admin.putOnShelvesProducts(data).then(res => {
console.log(res)
this.$refs.oTable.reload()
})
}
return (
<el-popconfirm
title={
row.status == "DOWN"
? "当前为下架状态,是否更改为上架状态?"
: "当前为上架状态,是否更改为下架状态?"
row.status == 'DOWN'
? '当前为下架状态,是否更改为上架状态?'
: '当前为上架状态,是否更改为下架状态?'
}
confirmButtonText={
row.status == "DOWN" ? "确认上架" : "确认下架"
row.status == 'DOWN' ? '确认上架' : '确认下架'
}
onConfirm={Enable}
>
@ -395,39 +395,39 @@ export default {
slot="reference"
size="mini"
plain
type={row.status == "DOWN" ? "info" : "success"}
type={row.status == 'DOWN' ? 'info' : 'success'}
>
{row.status == "DOWN" ? "已下架" : "上架中"}
{row.status == 'DOWN' ? '已下架' : '上架中'}
</el-button>
</el-popconfirm>
);
},
)
}
},
{
title: "操作 (提示:下架后可进行操作)",
fixed: "right",
type: "jsx",
align: "center",
width: "340px",
title: '操作 (提示:下架后可进行操作)',
fixed: 'right',
type: 'jsx',
align: 'center',
width: '340px',
render: ({ row }) => {
let edit = () => {
this.$refs.addOrUpdate.toggle(row).update();
};
this.$refs.addOrUpdate.toggle(row).update()
}
let priceAdjustment = () => {
console.log(row);
this.$refs.AddPrice.toggle(row).update();
};
console.log(row)
this.$refs.AddPrice.toggle(row).update()
}
let changeInventory = () => {
this.$refs.addStock.toggle(row).update();
};
this.$refs.addStock.toggle(row).update()
}
let setDiscounts = () => {
this.$refs.AddDiscount.toggle(row).update();
};
this.$refs.AddDiscount.toggle(row).update()
}
return (
<div>
<el-button
size="mini"
disabled={row.status != "DOWN"}
disabled={row.status != 'DOWN'}
type="primary"
onClick={edit}
>
@ -435,7 +435,7 @@ export default {
</el-button>
<el-button
size="mini"
disabled={row.status != "DOWN"}
disabled={row.status != 'DOWN'}
type="primary"
onClick={priceAdjustment}
>
@ -443,7 +443,7 @@ export default {
</el-button>
<el-button
size="mini"
disabled={row.status != "DOWN"}
disabled={row.status != 'DOWN'}
type="primary"
onClick={changeInventory}
>
@ -451,37 +451,37 @@ export default {
</el-button>
<el-button
size="mini"
disabled={row.status != "DOWN"}
disabled={row.status != 'DOWN'}
type="primary"
onClick={setDiscounts}
>
设置折扣
</el-button>
</div>
);
},
},
];
)
}
}
]
},
tableEvent() {
return {
"checkbox-all": ({ records, reserves }) => {
this.selectList = [...records, ...reserves];
'checkbox-all': ({ records, reserves }) => {
this.selectList = [...records, ...reserves]
},
"checkbox-change": ({ records, reserves }) => {
this.selectList = [...records, ...reserves];
},
};
'checkbox-change': ({ records, reserves }) => {
this.selectList = [...records, ...reserves]
}
}
},
...mapState("userData", [
"isMerchant",
"marketList",
"storeList",
"marketId",
"shopId",
]),
},
};
...mapState('userData', [
'isMerchant',
'marketList',
'storeList',
'marketId',
'shopId'
])
}
}
</script>
<style lang="scss" scoped>
@ -507,4 +507,5 @@ export default {
.stat-title {
margin-bottom: 5px;
}
</style>
</style>

View File

@ -0,0 +1,199 @@
<template>
<div>
<div class="paynotice-tinymce" style="height: calc(100vh - 200px)">
<el-form
label-width="150px"
:rules="rules"
:model="modalData"
ref="modalForm"
>
<el-form-item
v-if="marketList.length > 0"
prop="marketId"
label="菜市场:"
>
<el-select v-model="modalData.marketId" placeholder="请选择菜市场">
<el-option
v-for="item in marketList"
:key="item.marketId"
:label="item.marketName"
:value="item.marketId"
></el-option>
</el-select>
</el-form-item>
<el-form-item
v-if="configType === 1 && storeList.length > 0"
prop="shopId"
label="店铺:"
>
<el-select v-model="modalData.shopId" placeholder="请选择店铺">
<el-option
v-for="item in storeList"
:key="item.shopId"
:label="item.shopName"
:value="item.shopId"
></el-option>
</el-select>
</el-form-item>
<el-form-item prop="title" label="标题:">
<el-input
style="width: 200px"
v-model="modalData.title"
placeholder="请输入购物须知标题"
></el-input>
</el-form-item>
<el-form-item prop="content" label="内容:">
<Tinymce
:key="keyFlag"
:height="300"
v-model="modalData.content"
placeholder="请输入购物须知内容"
/>
</el-form-item>
</el-form>
<div style="margin-left: 160px">
<el-button type="primary" @click="handelConfirm">
确定
</el-button>
</div>
</div>
</div>
</template>
<script>
import $api from '@/api/index.js'
import { mapState } from 'vuex'
import Tinymce from '../../../../components/tinymce/index.vue'
export default {
components: {
Tinymce
},
data() {
const that = this
return {
keyFlag: 1,
formInline: {
type: 0,
targetId: '',
position: '3'
},
// 0 1
configType: 0,
modalData: {},
rules: {
marketId: [
{
required: true,
message: '请选择菜市场',
trigger: ['blur', 'change']
}
],
title: [
{
required: true,
message: '请输入标题',
trigger: ['blur', 'change']
}
],
content: [
{
required: true,
message: '请输入购物须知',
trigger: ['blur', 'change']
}
]
}
}
},
created() {},
activated() {
console.log(this.marketId, this.shopId)
this.keyFlag++
if (
JSON.parse(sessionStorage.getItem('userInfo')).role === 'ROLE_MANAGER'
) {
this.formInline = {
type: 0,
targetId: this.marketId,
position: '2',
app: 1
}
this.modalData.marketId = this.marketId
this.configType = 0
$api.getMarketPayNotice(this.marketId).then(res => {
console.log('菜市场须知', res)
if (res.data.data) {
this.modalData = { ...res.data.data }
}
})
console.lo
} else {
this.formInline = {
type: 0,
ownerId: this.shopId,
position: '3',
app: 1
}
this.modalData.shopId = this.shopId
this.configType = 1
$api.getShopPayNotice(this.shopId).then(res => {
console.log('店铺须知', res)
if (res.data.data) {
this.modalData = { ...res.data.data }
}
})
}
},
methods: {
handelConfirm() {
this.$refs.modalForm.validate(val => {
if (val) {
console.log(this.modalData)
if (this.configType === 0) {
if (this.modalData.id) {
$api
.updateMarketPayNotice({
...this.modalData
})
.then(res => {
console.log(res)
})
} else {
$api.createMarketPayNotice({ ...this.modalData }).then(res => {
console.log(res)
})
}
} else {
if (this.modalData.id) {
$api.updateShopPayNotice({ ...this.modalData }).then(res => {
console.log(res)
})
} else {
$api.createShopPayNotice({ ...this.modalData }).then(res => {
console.log(res)
})
}
}
}
})
}
},
computed: {
...mapState('userData', [
'isMerchant',
'marketList',
'storeList',
'marketId',
'shopId'
])
}
}
</script>
<style lang="scss" scoped>
// .paynotice-tinymce {
// ::v-deep .tox-tinymce {
// height: 300px !important;
// }
// }
</style>