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

@ -6,8 +6,8 @@ export const password = (password, newPassword) => {
url: '/sys/user/password', url: '/sys/user/password',
method: 'post', method: 'post',
data: $http.adornData({ data: $http.adornData({
'password': password, password: password,
'newPassword': newPassword newPassword: newPassword
}) })
}) })
} }
@ -22,7 +22,7 @@ export const logout = () => {
} }
// 获取用户信息 // 获取用户信息
export const getUserInfo=()=>{ export const getUserInfo = () => {
return $http({ return $http({
url: '/merchant-api/auth/info', url: '/merchant-api/auth/info',
method: 'get', method: 'get',
@ -31,16 +31,76 @@ export const getUserInfo=()=>{
} }
//登录接口 //登录接口
export const login=(username,password,uuid,captcha)=>{ export const login = (username, password, uuid, captcha) => {
return $http({ return $http({
url: '/auth/login', url: '/auth/login',
method: 'post', method: 'post',
data: $http.adornData({ data: $http.adornData({
'username': username, username: username,
'password': password, password: password,
'code':captcha, code: captcha,
'uuid': uuid, uuid: uuid
// 'captcha': captcha // '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, open: null,
list: [], 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(), menuId: getUUID(),
parentId: 0, parentId: 0,

View File

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

View File

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