优化小程序端配置功能
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
VITE_APP_NAME=后台管理系统
|
||||
VITE_SOCKET_URL=wss://server.gxwebsoft.com
|
||||
VITE_SERVER_URL=https://server.gxwebsoft.com/api
|
||||
#VITE_API_URL=https://modules.gxwebsoft.com/api
|
||||
VITE_API_URL=https://modules.gxwebsoft.com/api
|
||||
|
||||
VITE_API_URL=http://127.0.0.1:9099/api
|
||||
#VITE_API_URL=http://127.0.0.1:9099/api
|
||||
#VITE_SERVER_URL=http://127.0.0.1:9091/api
|
||||
#VITE_SOCKET_URL=ws://localhost:9191
|
||||
#VITE_API_URL=https://server.gxwebsoft.com/api
|
||||
|
||||
@@ -27,5 +27,6 @@ export interface AdParam extends PageParam {
|
||||
adId?: string;
|
||||
name?: number;
|
||||
type?: number;
|
||||
adType?: string;
|
||||
userId?: number;
|
||||
}
|
||||
|
||||
106
src/api/cms/mp-menu/index.ts
Normal file
106
src/api/cms/mp-menu/index.ts
Normal file
@@ -0,0 +1,106 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { MpMenu, MpMenuParam } from './model';
|
||||
import { MODULES_API_URL } from '@/config/setting';
|
||||
|
||||
/**
|
||||
* 分页查询小程序端菜单
|
||||
*/
|
||||
export async function pageMpMenu(params: MpMenuParam) {
|
||||
const res = await request.get<ApiResult<PageResult<MpMenu>>>(
|
||||
MODULES_API_URL + '/cms/mp-menu/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询小程序端菜单列表
|
||||
*/
|
||||
export async function listMpMenu(params?: MpMenuParam) {
|
||||
const res = await request.get<ApiResult<MpMenu[]>>(
|
||||
MODULES_API_URL + '/cms/mp-menu',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加小程序端菜单
|
||||
*/
|
||||
export async function addMpMenu(data: MpMenu) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/cms/mp-menu',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改小程序端菜单
|
||||
*/
|
||||
export async function updateMpMenu(data: MpMenu) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/cms/mp-menu',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除小程序端菜单
|
||||
*/
|
||||
export async function removeMpMenu(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/cms/mp-menu/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除小程序端菜单
|
||||
*/
|
||||
export async function removeBatchMpMenu(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/cms/mp-menu/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询小程序端菜单
|
||||
*/
|
||||
export async function getMpMenu(id: number) {
|
||||
const res = await request.get<ApiResult<MpMenu>>(
|
||||
MODULES_API_URL + '/cms/mp-menu/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
77
src/api/cms/mp-menu/model/index.ts
Normal file
77
src/api/cms/mp-menu/model/index.ts
Normal file
@@ -0,0 +1,77 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 小程序端菜单
|
||||
*/
|
||||
export interface MpMenu {
|
||||
// ID
|
||||
menuId?: number;
|
||||
// 上级id, 0是顶级
|
||||
parentId?: number;
|
||||
// 菜单名称
|
||||
title?: string;
|
||||
// 类型 0自定义 1单页内容2外部链接
|
||||
type?: number;
|
||||
// 是否微信小程序菜单
|
||||
isMpWeixin?: boolean;
|
||||
// 菜单路由地址
|
||||
path?: string;
|
||||
// 菜单组件地址, 目录可为空
|
||||
component?: string;
|
||||
// 打开位置
|
||||
target?: string;
|
||||
// 菜单图标
|
||||
icon?: string;
|
||||
// 图标颜色
|
||||
color?: string;
|
||||
// 所在行
|
||||
rows?: number;
|
||||
// 是否隐藏, 0否, 1是(仅注册路由不显示在左侧菜单)
|
||||
hide?: number;
|
||||
// 位置 0不限 1顶部 2底部
|
||||
position?: number;
|
||||
// 菜单侧栏选中的path
|
||||
active?: string;
|
||||
// 其它路由元信息
|
||||
meta?: string;
|
||||
// 绑定的页面
|
||||
pageId?: number;
|
||||
// 绑定的文章分类ID
|
||||
articleCategoryId?: number;
|
||||
// 绑定的文章ID
|
||||
articleId?: number;
|
||||
// 绑定的表单ID
|
||||
formId?: number;
|
||||
// 绑定的书籍标识
|
||||
bookCode?: string;
|
||||
// 绑定的商品分类ID
|
||||
goodsCategoryId?: number;
|
||||
// 绑定的商品ID
|
||||
goodsId?: number;
|
||||
// 用户ID
|
||||
userId?: number;
|
||||
// 设为首页
|
||||
home?: number;
|
||||
// 排序(数字越小越靠前)
|
||||
sortNumber?: number;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 状态, 0正常, 1冻结
|
||||
status?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 注册时间
|
||||
createTime?: string;
|
||||
// 子菜单
|
||||
children?: MpMenu[];
|
||||
pageName?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序端菜单搜索条件
|
||||
*/
|
||||
export interface MpMenuParam extends PageParam {
|
||||
menuId?: number;
|
||||
type?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
@@ -28,6 +28,7 @@ export interface Navigation {
|
||||
formId?: number;
|
||||
pageName?: string;
|
||||
createTime?: string;
|
||||
isMpWeixin?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,6 +26,14 @@ export interface WebsiteParam {
|
||||
login_bg_img?: string;
|
||||
}
|
||||
|
||||
// 约定的小程序参数名称
|
||||
export interface MpWeixinParam {
|
||||
// 小程序LOGO
|
||||
site_logo?: string;
|
||||
// 我的页面顶部背景图片
|
||||
mp_user_top?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 网站参数搜索条件
|
||||
*/
|
||||
|
||||
106
src/api/shop/wechatDeposit/index.ts
Normal file
106
src/api/shop/wechatDeposit/index.ts
Normal file
@@ -0,0 +1,106 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { WechatDeposit, WechatDepositParam } from './model';
|
||||
import { MODULES_API_URL } from '@/config/setting';
|
||||
|
||||
/**
|
||||
* 分页查询押金
|
||||
*/
|
||||
export async function pageWechatDeposit(params: WechatDepositParam) {
|
||||
const res = await request.get<ApiResult<PageResult<WechatDeposit>>>(
|
||||
MODULES_API_URL + '/shop/wechat-deposit/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询押金列表
|
||||
*/
|
||||
export async function listWechatDeposit(params?: WechatDepositParam) {
|
||||
const res = await request.get<ApiResult<WechatDeposit[]>>(
|
||||
MODULES_API_URL + '/shop/wechat-deposit',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加押金
|
||||
*/
|
||||
export async function addWechatDeposit(data: WechatDeposit) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/wechat-deposit',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改押金
|
||||
*/
|
||||
export async function updateWechatDeposit(data: WechatDeposit) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/wechat-deposit',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除押金
|
||||
*/
|
||||
export async function removeWechatDeposit(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/wechat-deposit/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除押金
|
||||
*/
|
||||
export async function removeBatchWechatDeposit(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/wechat-deposit/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询押金
|
||||
*/
|
||||
export async function getWechatDeposit(id: number) {
|
||||
const res = await request.get<ApiResult<WechatDeposit>>(
|
||||
MODULES_API_URL + '/shop/wechat-deposit/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
43
src/api/shop/wechatDeposit/model/index.ts
Normal file
43
src/api/shop/wechatDeposit/model/index.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 押金
|
||||
*/
|
||||
export interface WechatDeposit {
|
||||
//
|
||||
id?: number;
|
||||
// 订单id
|
||||
oid?: number;
|
||||
// 用户id
|
||||
uid?: number;
|
||||
// 场地订单号
|
||||
orderNum?: string;
|
||||
// 付款订单号
|
||||
wechatOrder?: string;
|
||||
// 退款订单号
|
||||
wechatReturn?: string;
|
||||
// 场馆名称
|
||||
siteName?: string;
|
||||
// 微信昵称
|
||||
username?: string;
|
||||
// 手机号码
|
||||
phone?: string;
|
||||
// 物品名称
|
||||
name?: string;
|
||||
// 押金金额
|
||||
price?: string;
|
||||
// 押金状态,1已付款,2未付款,已退押金
|
||||
status?: string;
|
||||
//
|
||||
createTime?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 押金搜索条件
|
||||
*/
|
||||
export interface WechatDepositParam extends PageParam {
|
||||
id?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
@@ -103,7 +103,7 @@ export interface User {
|
||||
//
|
||||
truename?: string;
|
||||
// 是否管理员:1是;2否
|
||||
isAdmin?: boolean;
|
||||
isAdmin?: number;
|
||||
// 客户端ID
|
||||
clientId?: string;
|
||||
// 注册来源客户端 (APP、H5、小程序等)
|
||||
|
||||
@@ -1,8 +1,82 @@
|
||||
<template>
|
||||
<div class="phone-layout" v-if="form">
|
||||
<div class="phone-header-black ele-fluid">
|
||||
<div class="title ele-fluid"> 商品详情 </div>
|
||||
<div class="title ele-fluid">
|
||||
<div class="title-bar">
|
||||
<a class="back" @click="openUrl(`/mp-weixin/home`)"></a>
|
||||
<span>{{ form.pageName || '商品详情' }}</span>
|
||||
<a class="share" @click="onShare"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<template v-if="form.showUserCard">
|
||||
<a-popover>
|
||||
<template #content> 点击更换背景 </template>
|
||||
<div
|
||||
class="user-card"
|
||||
:style="{
|
||||
backgroundImage: 'url(' + param.mp_user_top + ')'
|
||||
}"
|
||||
@click="
|
||||
openUserCard({
|
||||
name: 'mp_user_top',
|
||||
value: param.mp_user_top,
|
||||
comments: '小程序我的顶部背景图片',
|
||||
sortNumber: 100
|
||||
})
|
||||
"
|
||||
>
|
||||
<div class="user-avatar">
|
||||
<a-avatar :src="param.site_logo" :size="60" />
|
||||
<div class="user-info">
|
||||
<div class="nickname">昵称</div>
|
||||
<div class="phone">手机号码</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a-popover>
|
||||
<UserCardEdit
|
||||
v-model:visible="showUserCardEdit"
|
||||
:data="current"
|
||||
@done="reload"
|
||||
/>
|
||||
</template>
|
||||
<template v-if="form.showOrderCard">
|
||||
<div class="order-card ele-cell">
|
||||
<div
|
||||
v-for="(item, index) in order"
|
||||
:key="index"
|
||||
class="ele-cell-content ele-text-center btn-center"
|
||||
@click="openMpMenuEdit(item)"
|
||||
>
|
||||
<a-image :src="item.icon" :width="30" :preview="false" />
|
||||
<span>{{ item.title }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="form.showToolsCard">
|
||||
<div class="tools-card">
|
||||
<div
|
||||
v-for="(item, index) in server"
|
||||
:key="index"
|
||||
class="ele-cell"
|
||||
@click="openMpMenuEdit(item)"
|
||||
>
|
||||
<a-avatar :src="item.icon" :size="24" />
|
||||
<div
|
||||
class="title ele-cell-content"
|
||||
:style="{ color: item.color || '#333333' }"
|
||||
>{{ item.title }}</div
|
||||
>
|
||||
<RightOutlined class="ele-text-secondary" />
|
||||
</div>
|
||||
</div>
|
||||
<MpMenuEdit
|
||||
v-model:visible="showMpMenuEdit"
|
||||
:data="current"
|
||||
@done="reload"
|
||||
/>
|
||||
</template>
|
||||
<template v-if="form.title">
|
||||
<div class="phone-body" style="overflow-y: auto; overflow-x: hidden">
|
||||
<a-carousel arrows autoplay :dots="true">
|
||||
@@ -143,18 +217,38 @@
|
||||
} from '@ant-design/icons-vue';
|
||||
import { formatNumber } from 'ele-admin-pro/es';
|
||||
import { ref } from 'vue';
|
||||
import { MpWeixinParam, WebsiteField } from '@/api/cms/website/field/model';
|
||||
import { listWebsiteField } from '@/api/system/website/field';
|
||||
import UserCardEdit from '@/views/cms/field/components/website-field-edit.vue';
|
||||
import MpMenuEdit from '@/views/cms/mp-weixin/menu/components/mpMenuEdit.vue';
|
||||
import { MpMenu } from '@/api/cms/mp-menu/model';
|
||||
import { listMpMenu } from '@/api/cms/mp-menu';
|
||||
import { openUrl } from '@/utils/common';
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
value?: string;
|
||||
placeholder?: string;
|
||||
form?: any | null;
|
||||
type?: number;
|
||||
list?: any[] | null;
|
||||
}>(),
|
||||
{
|
||||
placeholder: undefined
|
||||
}
|
||||
);
|
||||
|
||||
const param = ref<MpWeixinParam>({});
|
||||
const showUserCardEdit = ref(false);
|
||||
const showMpMenuEdit = ref(false);
|
||||
// 当前编辑数据
|
||||
const current = ref<WebsiteField | null>(null);
|
||||
|
||||
// 订单图标
|
||||
const order = ref<any[]>();
|
||||
// 服务图标
|
||||
const server = ref<any[]>();
|
||||
|
||||
const config = ref({
|
||||
selector: '#content', //容器,可使用css选择器
|
||||
branding: false,
|
||||
@@ -169,6 +263,36 @@
|
||||
// editor.setContent('这里是你的内容字符串');
|
||||
// }
|
||||
});
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openUserCard = (row?: WebsiteField) => {
|
||||
current.value = row ?? null;
|
||||
showUserCardEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openMpMenuEdit = (row?: MpMenu) => {
|
||||
current.value = row ?? null;
|
||||
showMpMenuEdit.value = true;
|
||||
};
|
||||
|
||||
const onShare = () => {
|
||||
|
||||
}
|
||||
|
||||
const reload = () => {};
|
||||
|
||||
listWebsiteField({}).then((list) => {
|
||||
list.map((d) => {
|
||||
const key = String(d.name);
|
||||
param.value[key] = d.value;
|
||||
});
|
||||
});
|
||||
|
||||
listMpMenu({}).then((list) => {
|
||||
server.value = list.filter((d) => d.type == 0);
|
||||
order.value = list.filter((d) => d.type == 1);
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
@@ -194,6 +318,21 @@
|
||||
justify-content: center;
|
||||
align-items: end;
|
||||
padding-bottom: 13px;
|
||||
.title-bar {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.back {
|
||||
display: block;
|
||||
width: 50px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.share {
|
||||
display: block;
|
||||
width: 50px;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.phone-body-bg {
|
||||
@@ -307,4 +446,69 @@
|
||||
:deep(.slick-slide h3) {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.user-card {
|
||||
height: 170px;
|
||||
margin: 0 1px;
|
||||
background-color: var(--grey-10);
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
display: flex;
|
||||
.user-avatar {
|
||||
margin-left: 16px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.user-info {
|
||||
margin-left: 10px;
|
||||
.nickname {
|
||||
color: var(--grey-3);
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
}
|
||||
.phone {
|
||||
color: var(--grey-5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.order-card {
|
||||
width: 340px;
|
||||
height: 80px;
|
||||
margin: 0 1px;
|
||||
background: #ffffff;
|
||||
border-radius: 5px;
|
||||
border-color: slategrey;
|
||||
position: absolute;
|
||||
top: 230px;
|
||||
left: 24px;
|
||||
.btn-center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
.tools-card {
|
||||
width: 340px;
|
||||
margin: 0 1px;
|
||||
padding: 6px 16px;
|
||||
background: #ffffff;
|
||||
border-radius: 5px;
|
||||
border-color: slategrey;
|
||||
position: absolute;
|
||||
top: 324px;
|
||||
left: 24px;
|
||||
.ele-cell {
|
||||
padding: 4px 0;
|
||||
border-bottom: 1px solid var(--grey-9);
|
||||
}
|
||||
.btn-center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -115,6 +115,12 @@
|
||||
key: 'merchantId',
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '场馆图片',
|
||||
dataIndex: 'image',
|
||||
key: 'image',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '场馆名称',
|
||||
dataIndex: 'merchantName',
|
||||
|
||||
48
src/views/booking/wechatDeposit/components/search.vue
Normal file
48
src/views/booking/wechatDeposit/components/search.vue
Normal file
@@ -0,0 +1,48 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<a-space :size="10" style="flex-wrap: wrap">
|
||||
<a-input-search
|
||||
allow-clear
|
||||
v-model:value="where.keywords"
|
||||
placeholder="请输入关键词"
|
||||
@search="search"
|
||||
@pressEnter="search"
|
||||
/>
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { watch } from 'vue';
|
||||
import useSearch from '@/utils/use-search';
|
||||
import { WechatDepositParam } from '@/api/shop/wechatDeposit/model';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
selection?: [];
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: WechatDepositParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
(e: 'batchMove'): void;
|
||||
}>();
|
||||
|
||||
// 表单数据
|
||||
const { where } = useSearch<WechatDepositParam>({
|
||||
keywords: ''
|
||||
});
|
||||
|
||||
/* 搜索 */
|
||||
const search = () => {
|
||||
emit('search', where);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
);
|
||||
</script>
|
||||
249
src/views/booking/wechatDeposit/components/wechatDepositEdit.vue
Normal file
249
src/views/booking/wechatDeposit/components/wechatDepositEdit.vue
Normal file
@@ -0,0 +1,249 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="800"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:maxable="maxable"
|
||||
:title="isUpdate ? '编辑押金' : '添加押金'"
|
||||
:body-style="{ paddingBottom: '28px' }"
|
||||
@update:visible="updateVisible"
|
||||
@ok="save"
|
||||
>
|
||||
<a-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||
:wrapper-col="
|
||||
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||
"
|
||||
>
|
||||
<a-form-item label="订单id" name="oid">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入订单id"
|
||||
v-model:value="form.oid"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="用户id" name="uid">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入用户id"
|
||||
v-model:value="form.uid"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="场地订单号" name="orderNum">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入场地订单号"
|
||||
v-model:value="form.orderNum"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="付款订单号" name="wechatOrder">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入付款订单号"
|
||||
v-model:value="form.wechatOrder"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="退款订单号 " name="wechatReturn">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入退款订单号 "
|
||||
v-model:value="form.wechatReturn"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="场馆名称" name="siteName">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入场馆名称"
|
||||
v-model:value="form.siteName"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="微信昵称" name="username">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入微信昵称"
|
||||
v-model:value="form.username"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="手机号码" name="phone">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入手机号码"
|
||||
v-model:value="form.phone"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="物品名称" name="name">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入物品名称"
|
||||
v-model:value="form.name"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="押金金额" name="price">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入押金金额"
|
||||
v-model:value="form.price"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="押金状态,1已付款,2未付款,已退押金" name="status">
|
||||
<a-radio-group v-model:value="form.status">
|
||||
<a-radio :value="0">显示</a-radio>
|
||||
<a-radio :value="1">隐藏</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { Form, message } from 'ant-design-vue';
|
||||
import { assignObject, uuid } from 'ele-admin-pro';
|
||||
import { addWechatDeposit, updateWechatDeposit } from '@/api/shop/wechatDeposit';
|
||||
import { WechatDeposit } from '@/api/shop/wechatDeposit/model';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||
import { FormInstance } from 'ant-design-vue/es/form';
|
||||
import { FileRecord } from '@/api/system/file/model';
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
const useForm = Form.useForm;
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: WechatDeposit | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
// 提交状态
|
||||
const loading = ref(false);
|
||||
// 是否显示最大化切换按钮
|
||||
const maxable = ref(true);
|
||||
// 表格选中数据
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
const images = ref<ItemType[]>([]);
|
||||
|
||||
// 用户信息
|
||||
const form = reactive<WechatDeposit>({
|
||||
id: undefined,
|
||||
oid: undefined,
|
||||
uid: undefined,
|
||||
orderNum: undefined,
|
||||
wechatOrder: undefined,
|
||||
wechatReturn: undefined,
|
||||
siteName: undefined,
|
||||
username: undefined,
|
||||
phone: undefined,
|
||||
name: undefined,
|
||||
price: undefined,
|
||||
status: undefined,
|
||||
createTime: undefined,
|
||||
tenantId: undefined,
|
||||
wechatDepositId: undefined,
|
||||
wechatDepositName: '',
|
||||
status: 0,
|
||||
comments: '',
|
||||
sortNumber: 100
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
wechatDepositName: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写押金名称',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const chooseImage = (data: FileRecord) => {
|
||||
images.value.push({
|
||||
uid: data.id,
|
||||
url: data.path,
|
||||
status: 'done'
|
||||
});
|
||||
form.image = data.path;
|
||||
};
|
||||
|
||||
const onDeleteItem = (index: number) => {
|
||||
images.value.splice(index, 1);
|
||||
form.image = '';
|
||||
};
|
||||
|
||||
const { resetFields } = useForm(form, rules);
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
if (!formRef.value) {
|
||||
return;
|
||||
}
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
const formData = {
|
||||
...form
|
||||
};
|
||||
const saveOrUpdate = isUpdate.value ? updateWechatDeposit : addWechatDeposit;
|
||||
saveOrUpdate(formData)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
images.value = [];
|
||||
if (props.data) {
|
||||
assignObject(form, props.data);
|
||||
if(props.data.image){
|
||||
images.value.push({
|
||||
uid: uuid(),
|
||||
url: props.data.image,
|
||||
status: 'done'
|
||||
})
|
||||
}
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
251
src/views/booking/wechatDeposit/index.vue
Normal file
251
src/views/booking/wechatDeposit/index.vue
Normal file
@@ -0,0 +1,251 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<div class="ele-body">
|
||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="wechatDepositId"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
:customRow="customRow"
|
||||
tool-class="ele-toolbar-form"
|
||||
class="sys-org-table"
|
||||
>
|
||||
<template #toolbar>
|
||||
<search
|
||||
@search="reload"
|
||||
:selection="selection"
|
||||
@add="openEdit"
|
||||
@remove="removeBatch"
|
||||
@batchMove="openMove"
|
||||
/>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'image'">
|
||||
<a-image :src="record.image" :width="50" />
|
||||
</template>
|
||||
<template v-if="column.key === 'status'">
|
||||
<a-tag v-if="record.status === 1" color="green">已付款</a-tag>
|
||||
<a-tag v-if="record.status === 2" color="red">未付款</a-tag>
|
||||
<a-tag v-if="record.status === 3" color="cyan">已退押金</a-tag>
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a @click="openEdit(record)">修改</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm
|
||||
title="确定要删除此记录吗?"
|
||||
@confirm="remove(record)"
|
||||
>
|
||||
<a class="ele-text-danger">删除</a>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</a-card>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<WechatDepositEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import type { EleProTable } from 'ele-admin-pro';
|
||||
import { toDateString } from 'ele-admin-pro';
|
||||
import type {
|
||||
DatasourceFunction,
|
||||
ColumnItem
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import Search from './components/search.vue';
|
||||
import WechatDepositEdit from './components/wechatDepositEdit.vue';
|
||||
import { pageWechatDeposit, removeWechatDeposit, removeBatchWechatDeposit } from '@/api/shop/wechatDeposit';
|
||||
import type { WechatDeposit, WechatDepositParam } from '@/api/shop/wechatDeposit/model';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<WechatDeposit[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<WechatDeposit | null>(null);
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
// 是否显示批量移动弹窗
|
||||
const showMove = ref(false);
|
||||
// 加载状态
|
||||
const loading = ref(true);
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({
|
||||
page,
|
||||
limit,
|
||||
where,
|
||||
orders,
|
||||
filters
|
||||
}) => {
|
||||
if (filters) {
|
||||
where.status = filters.status;
|
||||
}
|
||||
return pageWechatDeposit({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '订单号',
|
||||
dataIndex: 'orderNum',
|
||||
key: 'orderNum',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '场馆名称',
|
||||
dataIndex: 'siteName',
|
||||
key: 'siteName',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '微信昵称',
|
||||
dataIndex: 'username',
|
||||
key: 'username',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '手机号码',
|
||||
dataIndex: 'phone',
|
||||
key: 'phone',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '物品名称',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '押金金额',
|
||||
dataIndex: 'price',
|
||||
key: 'price',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '押金状态',
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
ellipsis: true,
|
||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 180,
|
||||
fixed: 'right',
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
}
|
||||
]);
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: WechatDepositParam) => {
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: WechatDeposit) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开批量移动弹窗 */
|
||||
const openMove = () => {
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: WechatDeposit) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeWechatDeposit(row.wechatDepositId)
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
/* 批量删除 */
|
||||
const removeBatch = () => {
|
||||
if (!selection.value.length) {
|
||||
message.error('请至少选择一条数据');
|
||||
return;
|
||||
}
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要删除选中的记录吗?',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
maskClosable: true,
|
||||
onOk: () => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeBatchWechatDeposit(selection.value.map((d) => d.wechatDepositId))
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* 查询 */
|
||||
const query = () => {
|
||||
loading.value = true;
|
||||
};
|
||||
|
||||
/* 自定义行属性 */
|
||||
const customRow = (record: WechatDeposit) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
query();
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'WechatDeposit'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
@@ -20,6 +20,7 @@
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="site_name"
|
||||
:disabled="isUpdate"
|
||||
v-model:value="form.name"
|
||||
/>
|
||||
</a-form-item>
|
||||
|
||||
@@ -32,20 +32,24 @@
|
||||
<a @click="moveUp(record)">上移<ArrowUpOutlined /></a>
|
||||
<a-divider type="vertical" />
|
||||
<a @click="openEdit(record)">编辑</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm
|
||||
title="确定要删除此记录吗?"
|
||||
@confirm="remove(record)"
|
||||
>
|
||||
<a class="ele-text-danger">删除</a>
|
||||
</a-popconfirm>
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm
|
||||
title="确定要放回原处吗?"
|
||||
@confirm="recovery(record)"
|
||||
>
|
||||
<a class="ele-text-danger">恢复</a>
|
||||
</a-popconfirm>
|
||||
<template v-if="record.deleted == 0">
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm
|
||||
title="确定要删除此记录吗?"
|
||||
@confirm="remove(record)"
|
||||
>
|
||||
<a class="ele-text-danger">删除</a>
|
||||
</a-popconfirm>
|
||||
</template>
|
||||
<template v-if="record.deleted == 1">
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm
|
||||
title="确定要放回原处吗?"
|
||||
@confirm="recovery(record)"
|
||||
>
|
||||
<a class="ele-text-danger">恢复</a>
|
||||
</a-popconfirm>
|
||||
</template>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
@@ -97,7 +101,6 @@
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
|
||||
// 搜索条件
|
||||
where.deleted = 1;
|
||||
return pageWebsiteField({
|
||||
...where,
|
||||
...orders,
|
||||
|
||||
178
src/views/cms/mp-weixin/dict/components/dict-edit.vue
Normal file
178
src/views/cms/mp-weixin/dict/components/dict-edit.vue
Normal file
@@ -0,0 +1,178 @@
|
||||
<!-- 分类编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="460"
|
||||
:visible="visible"
|
||||
:confirm-loading="loading"
|
||||
:title="isUpdate ? '修改位置' : '添加位置'"
|
||||
:body-style="{ paddingBottom: '8px' }"
|
||||
@update:visible="updateVisible"
|
||||
@ok="save"
|
||||
>
|
||||
<a-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:label-col="styleResponsive ? { md: 5, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||
:wrapper-col="
|
||||
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||
"
|
||||
>
|
||||
<a-form-item label="分类标识" name="dictCode">
|
||||
<a-input
|
||||
allow-clear
|
||||
:maxlength="20"
|
||||
disabled
|
||||
placeholder="请输入分类标识"
|
||||
v-model:value="form.dictCode"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="分类名称" name="dictDataName">
|
||||
<a-input
|
||||
allow-clear
|
||||
:maxlength="20"
|
||||
placeholder="请输入分类名称"
|
||||
v-model:value="form.dictDataName"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="排序" name="sortNumber">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:max="99999"
|
||||
class="ele-fluid"
|
||||
placeholder="请输入排序号"
|
||||
v-model:value="form.sortNumber"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="备注">
|
||||
<a-textarea
|
||||
:rows="4"
|
||||
:maxlength="200"
|
||||
placeholder="请输入备注"
|
||||
v-model:value="form.comments"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { message } from 'ant-design-vue/es';
|
||||
import type { FormInstance, Rule } from 'ant-design-vue/es/form';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import useFormData from '@/utils/use-form-data';
|
||||
import { addDictData, updateDictData } from '@/api/system/dict-data';
|
||||
import { DictData } from '@/api/system/dict-data/model';
|
||||
import { removeSiteInfoCache } from "@/api/cms/website";
|
||||
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: DictData | null;
|
||||
// 字典ID
|
||||
dictId?: number | 0;
|
||||
}>();
|
||||
|
||||
//
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
|
||||
// 提交状态
|
||||
const loading = ref(false);
|
||||
|
||||
// 表单数据
|
||||
const { form, resetFields, assignFields } = useFormData<DictData>({
|
||||
dictId: undefined,
|
||||
dictDataId: undefined,
|
||||
dictDataName: '',
|
||||
dictCode: 'mpPosition',
|
||||
dictDataCode: '',
|
||||
sortNumber: 100,
|
||||
comments: ''
|
||||
});
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive<Record<string, Rule[]>>({
|
||||
dictDataCode: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入分类名称',
|
||||
type: 'string',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
dictCode: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入分类标识',
|
||||
type: 'string',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
if (!formRef.value) {
|
||||
return;
|
||||
}
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
const saveOrUpdate = isUpdate.value ? updateDictData : addDictData;
|
||||
form.dictDataCode = form.dictDataName;
|
||||
form.dictId = props.dictId;
|
||||
saveOrUpdate(form)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
// 清除字典缓存
|
||||
removeSiteInfoCache(form.dictCode + ':' + form.tenantId);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
if (props.data) {
|
||||
assignFields(props.data);
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
formRef.value?.clearValidate();
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
211
src/views/cms/mp-weixin/dict/index.vue
Normal file
211
src/views/cms/mp-weixin/dict/index.vue
Normal file
@@ -0,0 +1,211 @@
|
||||
<template>
|
||||
<div class="ele-body">
|
||||
<a-card :bordered="false">
|
||||
<!-- 表格 -->
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="dictDataId"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
:customRow="customRow"
|
||||
:scroll="{ x: 800 }"
|
||||
cache-key="proSystemRoleTable"
|
||||
>
|
||||
<template #toolbar>
|
||||
<a-space>
|
||||
<a-button type="primary" class="ele-btn-icon" @click="openEdit()">
|
||||
<template #icon>
|
||||
<plus-outlined />
|
||||
</template>
|
||||
<span>新建</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a @click="openEdit(record)">修改</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm
|
||||
placement="topRight"
|
||||
title="确定要删除此分类吗?"
|
||||
@confirm="remove(record)"
|
||||
>
|
||||
<a class="ele-text-danger">删除</a>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</a-card>
|
||||
<!-- 编辑弹窗 -->
|
||||
<dict-edit
|
||||
v-model:visible="showEdit"
|
||||
:dictId="dictId"
|
||||
:data="current"
|
||||
@done="reload"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue/es';
|
||||
import {
|
||||
PlusOutlined,
|
||||
DeleteOutlined,
|
||||
ExclamationCircleOutlined
|
||||
} from '@ant-design/icons-vue';
|
||||
import type { EleProTable } from 'ele-admin-pro/es';
|
||||
import type {
|
||||
DatasourceFunction,
|
||||
ColumnItem
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import { messageLoading } from 'ele-admin-pro/es';
|
||||
import DictEdit from './components/dict-edit.vue';
|
||||
import {
|
||||
pageDictData,
|
||||
removeDictData,
|
||||
removeDictDataBatch
|
||||
} from '@/api/system/dict-data';
|
||||
import { DictParam } from '@/api/system/dict/model';
|
||||
import { DictData } from '@/api/system/dict-data/model';
|
||||
import { addDict, listDictionaries } from '@/api/system/dict';
|
||||
import { Dictionary } from '@/api/system/dictionary/model';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
const dictId = ref(0);
|
||||
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: 'ID',
|
||||
dataIndex: 'dictDataId',
|
||||
width: 80
|
||||
},
|
||||
{
|
||||
title: '名称',
|
||||
dataIndex: 'dictDataName',
|
||||
showSorterTooltip: false
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
dataIndex: 'comments',
|
||||
sorter: true,
|
||||
showSorterTooltip: false
|
||||
},
|
||||
{
|
||||
title: '排序号',
|
||||
width: 180,
|
||||
align: 'center',
|
||||
dataIndex: 'sortNumber'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 180,
|
||||
align: 'center'
|
||||
}
|
||||
]);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<DictData[]>([]);
|
||||
|
||||
// 当前编辑数据
|
||||
const current = ref<Dictionary | null>(null);
|
||||
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
|
||||
where.dictCode = 'mpPosition';
|
||||
return pageDictData({ ...where, ...orders, page, limit });
|
||||
};
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: DictParam) => {
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ page: 1, where });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: DictData) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: DictData) => {
|
||||
const hide = messageLoading('请求中..', 0);
|
||||
removeDictData(row.dictDataId)
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
/* 批量删除 */
|
||||
const removeBatch = () => {
|
||||
if (!selection.value.length) {
|
||||
message.error('请至少选择一条数据');
|
||||
return;
|
||||
}
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要删除选中的分类吗?',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
maskClosable: true,
|
||||
onOk: () => {
|
||||
const hide = messageLoading('请求中..', 0);
|
||||
removeDictDataBatch(selection.value.map((d) => d.dictDataId))
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 初始化字典
|
||||
const loadDict = () => {
|
||||
listDictionaries({ dictCode: 'mpPosition' }).then(async (data) => {
|
||||
if (data?.length == 0) {
|
||||
await addDict({ dictCode: 'mpPosition', dictName: '菜单位置' });
|
||||
}
|
||||
await listDictionaries({ dictCode: 'mpPosition' }).then((list) => {
|
||||
list?.map((d) => {
|
||||
dictId.value = Number(d.dictId);
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
loadDict();
|
||||
|
||||
/* 自定义行属性 */
|
||||
const customRow = (record: DictData) => {
|
||||
return {
|
||||
onDblclick: () => {
|
||||
openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'GroupIdDict'
|
||||
};
|
||||
</script>
|
||||
258
src/views/cms/mp-weixin/home/components/mpMenuEdit.vue
Normal file
258
src/views/cms/mp-weixin/home/components/mpMenuEdit.vue
Normal file
@@ -0,0 +1,258 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="800"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:maxable="maxable"
|
||||
:title="isUpdate ? '编辑菜单' : '添加菜单'"
|
||||
:body-style="{ paddingBottom: '28px' }"
|
||||
@update:visible="updateVisible"
|
||||
@ok="save"
|
||||
>
|
||||
<a-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||
:wrapper-col="
|
||||
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||
"
|
||||
>
|
||||
<a-form-item label="菜单名称" name="title">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入菜单名称"
|
||||
v-model:value="form.title"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="路由地址" name="path">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入路由地址"
|
||||
v-model:value="form.path"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="菜单图标" name="icon">
|
||||
<SelectFile
|
||||
:placeholder="`请选择图片`"
|
||||
:limit="1"
|
||||
:data="images"
|
||||
@done="chooseFile"
|
||||
@del="onDeleteItem"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="图标颜色" name="color">
|
||||
<ele-color-picker
|
||||
:show-alpha="true"
|
||||
v-model:value="form.color"
|
||||
:predefine="predefineColors"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="所在行" name="rows">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:max="3"
|
||||
class="ele-fluid"
|
||||
placeholder="请输入所在行"
|
||||
v-model:value="form.rows"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="排序" name="sortNumber">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:max="9999"
|
||||
class="ele-fluid"
|
||||
placeholder="请输入排序号"
|
||||
v-model:value="form.sortNumber"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { Form, message } from 'ant-design-vue';
|
||||
import { assignObject, uuid } from 'ele-admin-pro';
|
||||
import { addMpMenu, updateMpMenu } from '@/api/cms/mp-menu';
|
||||
import { MpMenu } from '@/api/cms/mp-menu/model';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||
import { FormInstance } from 'ant-design-vue/es/form';
|
||||
import { FileRecord } from '@/api/system/file/model';
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
const useForm = Form.useForm;
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 类型 0服务 1订单
|
||||
type?: number;
|
||||
// 修改回显的数据
|
||||
data?: MpMenu | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
// 提交状态
|
||||
const loading = ref(false);
|
||||
// 是否显示最大化切换按钮
|
||||
const maxable = ref(true);
|
||||
// 表格选中数据
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
const images = ref<ItemType[]>([]);
|
||||
|
||||
// 用户信息
|
||||
const form = reactive<MpMenu>({
|
||||
menuId: undefined,
|
||||
parentId: 0,
|
||||
title: '',
|
||||
type: 2,
|
||||
rows: 0,
|
||||
isMpWeixin: true,
|
||||
path: undefined,
|
||||
component: undefined,
|
||||
target: undefined,
|
||||
icon: '',
|
||||
color: undefined,
|
||||
hide: undefined,
|
||||
position: undefined,
|
||||
active: undefined,
|
||||
userId: 0,
|
||||
home: undefined,
|
||||
sortNumber: 100,
|
||||
comments: '',
|
||||
status: 0
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
title: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写菜单名称',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
path: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写路由地址',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const chooseFile = (data: FileRecord) => {
|
||||
images.value.push({
|
||||
uid: data.id,
|
||||
url: data.thumbnail,
|
||||
status: 'done'
|
||||
});
|
||||
form.icon = data.thumbnail;
|
||||
};
|
||||
|
||||
const onDeleteItem = (index: number) => {
|
||||
images.value.splice(index, 1);
|
||||
form.icon = '';
|
||||
};
|
||||
|
||||
// 预设颜色
|
||||
const predefineColors = ref([
|
||||
'#40a9ff',
|
||||
'#9254de',
|
||||
'#36cfc9',
|
||||
'#73d13d',
|
||||
'#f759ab',
|
||||
'#cf1313',
|
||||
'#ff4d4f',
|
||||
'#ffa940',
|
||||
'#ffc53d',
|
||||
'#f3d3d3',
|
||||
'#1b1b1b',
|
||||
'#363636',
|
||||
'#4d4d4d',
|
||||
'#737373',
|
||||
'#a6a6a6',
|
||||
'#d9d9d9',
|
||||
'#e6e6e6',
|
||||
'#f2f2f2',
|
||||
'#f7f7f7',
|
||||
'#fafafa'
|
||||
]);
|
||||
|
||||
const { resetFields } = useForm(form, rules);
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
if (!formRef.value) {
|
||||
return;
|
||||
}
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
const formData = {
|
||||
...form
|
||||
};
|
||||
const saveOrUpdate = isUpdate.value ? updateMpMenu : addMpMenu;
|
||||
saveOrUpdate(formData)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
images.value = [];
|
||||
if (props.type) {
|
||||
form.type = props.type;
|
||||
}
|
||||
if (props.data) {
|
||||
assignObject(form, props.data);
|
||||
if (props.data.icon) {
|
||||
images.value.push({
|
||||
uid: uuid(),
|
||||
url: props.data.icon,
|
||||
status: 'done'
|
||||
});
|
||||
}
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
52
src/views/cms/mp-weixin/home/components/search.vue
Normal file
52
src/views/cms/mp-weixin/home/components/search.vue
Normal file
@@ -0,0 +1,52 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<a-space :size="10" style="flex-wrap: wrap">
|
||||
<a-button type="primary" class="ele-btn-icon" @click="add">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
<span>添加</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||
import { watch } from 'vue';
|
||||
import useSearch from '@/utils/use-search';
|
||||
import { MpMenu, MpMenuParam } from '@/api/cms/mp-menu/model';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
selection?: [];
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: MpMenuParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
(e: 'batchMove'): void;
|
||||
}>();
|
||||
|
||||
// 表单数据
|
||||
const { where } = useSearch<MpMenu>({
|
||||
type: 2
|
||||
});
|
||||
|
||||
const handleSearch = () => {
|
||||
emit('search', where);
|
||||
};
|
||||
|
||||
// 新增
|
||||
const add = () => {
|
||||
emit('add');
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
);
|
||||
</script>
|
||||
521
src/views/cms/mp-weixin/home/components/simulator.vue
Normal file
521
src/views/cms/mp-weixin/home/components/simulator.vue
Normal file
@@ -0,0 +1,521 @@
|
||||
<template>
|
||||
<div class="phone-layout" v-if="form">
|
||||
<div class="phone-header-black ele-fluid">
|
||||
<div class="title ele-fluid">
|
||||
<div class="title-bar">
|
||||
<span class="back"></span>
|
||||
<span>{{ form.pageName || '首页' }}</span>
|
||||
<a class="share" @click="onShare"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<template v-if="form.showMenuCard">
|
||||
<div class="phone-body" style="overflow-y: auto; overflow-x: hidden">
|
||||
<!-- 幻灯片轮播 -->
|
||||
<template v-if="form.showCarousel">
|
||||
<a-carousel arrows autoplay :dots="true">
|
||||
<template v-if="adImageList">
|
||||
<template v-for="(img, index) in adImageList" :key="index">
|
||||
<div class="ad-item">
|
||||
<a-image
|
||||
:preview="false"
|
||||
:src="img.url"
|
||||
width="100%"
|
||||
height="200px"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</a-carousel>
|
||||
</template>
|
||||
<!-- 导航菜单 -->
|
||||
<template v-if="form.showMenuCard">
|
||||
<div class="menu-card ele-cell">
|
||||
<template
|
||||
v-for="(item, index) in navigation1"
|
||||
:key="index"
|
||||
>
|
||||
<div
|
||||
v-if="index < 4"
|
||||
class="ele-cell-content ele-text-center btn-center"
|
||||
@click="openMpMenuEdit(item)"
|
||||
>
|
||||
<a-image :src="item.icon" :width="30" :preview="false" />
|
||||
<span>{{ item.title }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<template
|
||||
v-for="(item, index) in navigation2"
|
||||
:key="index"
|
||||
>
|
||||
<div
|
||||
v-if="index < 4"
|
||||
class="ele-cell-content ele-text-center btn-center"
|
||||
@click="openMpMenuEdit(item)"
|
||||
>
|
||||
<a-image :src="item.icon" :width="30" :preview="false" />
|
||||
<span>{{ item.title }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<MpMenuEdit
|
||||
v-model:visible="showMpMenuEdit"
|
||||
:data="current"
|
||||
@done="reload"
|
||||
/>
|
||||
</template>
|
||||
<!-- 商户列表 -->
|
||||
<template v-if="form.showShopCard">
|
||||
<div class="merchant-card-title">场地预定</div>
|
||||
<div
|
||||
class="merchant-card ele-cell"
|
||||
v-for="(item, index) in shopList"
|
||||
:key="index"
|
||||
>
|
||||
<a-image :src="item.image" :width="96" :preview="false" />
|
||||
<div class="merchant-info ele-cell-content">
|
||||
<div class="merchant-name">{{ item.merchantName }}</div>
|
||||
<div class="merchant-desc ele-cell-desc">
|
||||
{{ item.comments }}
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="">-->
|
||||
<!-- <a-button>我要去</a-button>-->
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
</template>
|
||||
<!-- 培训课程 -->
|
||||
<template v-if="form.showTtrainCard">
|
||||
<div class="merchant-card-title">培训课程</div>
|
||||
<div
|
||||
class="merchant-card ele-cell"
|
||||
v-for="(item, index) in shopList"
|
||||
:key="index"
|
||||
@click="openMpMenuEdit(item)"
|
||||
>
|
||||
<a-image :src="item.image" :width="96" :preview="false" />
|
||||
<div class="merchant-info ele-cell-content">
|
||||
<div class="merchant-name">{{ item.merchantName }}</div>
|
||||
<div class="merchant-desc ele-cell-desc">
|
||||
{{ item.comments }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
<a-card
|
||||
class="buy-bar"
|
||||
:bordered="false"
|
||||
:body-style="{ padding: '12px 16px' }"
|
||||
>
|
||||
<div class="ele-cell">
|
||||
<a
|
||||
class="home-btn ele-cell-content ele-text-secondary"
|
||||
@click="openUrl(`/mp-weixin/home`)"
|
||||
>
|
||||
<HomeOutlined class="icon ele-text-danger" />
|
||||
<span class="ele-text-danger">首页</span>
|
||||
</a>
|
||||
<a
|
||||
class="shop-btn ele-cell-content ele-text-secondary"
|
||||
@click="openUrl(`/mp-weixin/shop`)"
|
||||
>
|
||||
<ShopOutlined class="icon" />
|
||||
商城
|
||||
</a>
|
||||
<a
|
||||
class="order-btn ele-cell-content ele-text-secondary"
|
||||
@click="openUrl(`/mp-weixin/order`)"
|
||||
>
|
||||
<ProfileOutlined class="icon" />
|
||||
订单
|
||||
</a>
|
||||
<a
|
||||
class="user-btn ele-cell-content ele-text-secondary"
|
||||
@click="openUrl(`/mp-weixin/user`)"
|
||||
>
|
||||
<UserOutlined class="icon" />
|
||||
我的
|
||||
</a>
|
||||
</div>
|
||||
</a-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {
|
||||
ProfileOutlined,
|
||||
ShopOutlined,
|
||||
HomeOutlined,
|
||||
UserOutlined
|
||||
} from '@ant-design/icons-vue';
|
||||
import { ref, unref, watch } from 'vue';
|
||||
import { MpWeixinParam, WebsiteField } from '@/api/cms/website/field/model';
|
||||
import { listWebsiteField } from '@/api/system/website/field';
|
||||
import { MpMenu } from '@/api/cms/mp-menu/model';
|
||||
import { listMpMenu } from '@/api/cms/mp-menu';
|
||||
import { listAd } from '@/api/cms/ad';
|
||||
import { listMerchant } from '@/api/shop/merchant';
|
||||
import { Merchant } from '@/api/shop/merchant/model';
|
||||
import { openUrl } from '@/utils/common';
|
||||
import { useRouter } from 'vue-router';
|
||||
const { currentRoute } = useRouter();
|
||||
const { query } = unref(currentRoute);
|
||||
|
||||
import MpMenuEdit from '@/views/cms/mp-weixin/menu/components/mpMenuEdit.vue';
|
||||
|
||||
const prpos = withDefaults(
|
||||
defineProps<{
|
||||
value?: string;
|
||||
placeholder?: string;
|
||||
form?: any | null;
|
||||
type?: number;
|
||||
list?: any[] | null;
|
||||
refresh?: boolean;
|
||||
}>(),
|
||||
{
|
||||
placeholder: undefined
|
||||
}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
const param = ref<MpWeixinParam>({});
|
||||
const showUserCardEdit = ref(false);
|
||||
const showMpMenuEdit = ref(false);
|
||||
// 当前编辑数据
|
||||
const current = ref<WebsiteField | null>(null);
|
||||
|
||||
// 幻灯片广告
|
||||
const adImageList = ref<any[]>();
|
||||
// 首页导航图标
|
||||
const scrollList = ref<any>();
|
||||
// 第一排
|
||||
const navigation1 = ref<any[]>();
|
||||
// 第二排
|
||||
const navigation2 = ref<any[]>();
|
||||
// 订单图标
|
||||
const order = ref<any[]>();
|
||||
// 服务图标
|
||||
const server = ref<any[]>();
|
||||
// 商户列表
|
||||
const shopList = ref<Merchant[]>();
|
||||
|
||||
const config = ref({
|
||||
selector: '#content', //容器,可使用css选择器
|
||||
branding: false,
|
||||
language: 'zh_CN', //调用放在langs文件夹内的语言包
|
||||
toolbar: false, //隐藏工具栏
|
||||
menubar: false, //隐藏菜单栏
|
||||
inline: true, //开启内联模式
|
||||
plugins: [] //选择需加载的插件
|
||||
//选中时出现的快捷工具,与插件有依赖关系
|
||||
// quickbars_selection_toolbar: 'bold italic forecolor | link blockquote quickimage',
|
||||
// init_instance_callback: function (editor) {
|
||||
// editor.setContent('这里是你的内容字符串');
|
||||
// }
|
||||
});
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openUserCard = (row?: WebsiteField) => {
|
||||
current.value = row ?? null;
|
||||
showUserCardEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openMpMenuEdit = (row?: MpMenu) => {
|
||||
current.value = row ?? null;
|
||||
showMpMenuEdit.value = true;
|
||||
};
|
||||
|
||||
const onShare = () => {};
|
||||
|
||||
const reload = () => {
|
||||
listWebsiteField({}).then((list) => {
|
||||
list.map((d) => {
|
||||
const key = String(d.name);
|
||||
param.value[key] = d.value;
|
||||
});
|
||||
});
|
||||
|
||||
listMpMenu({}).then((list) => {
|
||||
server.value = list.filter((d) => d.type == 0);
|
||||
order.value = list.filter((d) => d.type == 1);
|
||||
navigation1.value = list.filter((d) => d.type == 2 && d.rows == 0);
|
||||
navigation2.value = list.filter((d) => d.type == 2 && d.rows == 1);
|
||||
});
|
||||
|
||||
listAd({ adType: '幻灯片' }).then((res) => {
|
||||
const carouselImages = res[0].images;
|
||||
if (carouselImages) {
|
||||
adImageList.value = JSON.parse(carouselImages);
|
||||
}
|
||||
});
|
||||
|
||||
listMerchant({}).then((list) => {
|
||||
shopList.value = list;
|
||||
});
|
||||
emit('done');
|
||||
};
|
||||
|
||||
reload();
|
||||
|
||||
watch(
|
||||
() => prpos.refresh,
|
||||
(refresh) => {
|
||||
if (refresh) {
|
||||
reload();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.phone-layout {
|
||||
position: fixed;
|
||||
right: 26px;
|
||||
width: 390px;
|
||||
height: 844px;
|
||||
background: url('@/assets/img/app-ui.png');
|
||||
background-repeat: no-repeat;
|
||||
background-position: top;
|
||||
background-size: 100%;
|
||||
//position: relative;
|
||||
padding: 0 16px;
|
||||
.phone-header-black {
|
||||
height: 99px;
|
||||
border-radius: 20px 20px 0 0;
|
||||
background-size: 100%;
|
||||
.title {
|
||||
height: 99px;
|
||||
font-size: 16px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: end;
|
||||
padding-bottom: 13px;
|
||||
|
||||
.title-bar {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.back {
|
||||
display: block;
|
||||
width: 50px;
|
||||
margin-left: 3px;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
.share {
|
||||
display: block;
|
||||
width: 50px;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.phone-body-bg {
|
||||
padding: 0 16px;
|
||||
height: 680px;
|
||||
border-radius: 0 0 44px 44px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.phone-body {
|
||||
width: 356px;
|
||||
margin-left: 17px;
|
||||
height: 630px;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
top: 98px;
|
||||
left: 0;
|
||||
z-index: 999;
|
||||
.comments {
|
||||
padding: 20px;
|
||||
word-break: break-all;
|
||||
}
|
||||
.form-data {
|
||||
padding: 10px 20px;
|
||||
.submit-btn {
|
||||
padding: 30px 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
.goods {
|
||||
.price {
|
||||
font-size: 18px;
|
||||
}
|
||||
.ele-cell-title {
|
||||
font-weight: 600;
|
||||
font-size: 16px;
|
||||
}
|
||||
.goods-attr {
|
||||
}
|
||||
}
|
||||
.goods-divider {
|
||||
height: 6px;
|
||||
}
|
||||
.buy-bar {
|
||||
position: fixed;
|
||||
width: 356px;
|
||||
bottom: 70px;
|
||||
//top: 881px;
|
||||
background-color: #ffffff;
|
||||
border-radius: 0 0 44px 44px;
|
||||
border-top: 1px solid var(--grey-8);
|
||||
.ele-cell-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.home-btn,
|
||||
.shop-btn,
|
||||
.order-btn,
|
||||
.user-btn {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
font-size: 13px;
|
||||
padding: 0 9px;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.icon {
|
||||
font-size: 19px;
|
||||
}
|
||||
.buy-btn {
|
||||
display: flex;
|
||||
.add-cart {
|
||||
border-radius: 100px 0 0 100px;
|
||||
border: none;
|
||||
background-color: var(--orange-5);
|
||||
color: #ffffff;
|
||||
height: 40px;
|
||||
width: 95px;
|
||||
}
|
||||
.buy-now {
|
||||
border-radius: 0 100px 100px 0;
|
||||
border: none;
|
||||
background-color: var(--red-6);
|
||||
color: #ffffff;
|
||||
height: 40px;
|
||||
width: 95px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
:deep(.slick-slide) {
|
||||
overflow: hidden;
|
||||
}
|
||||
:deep(.slick-arrow.custom-slick-arrow) {
|
||||
font-size: 38px;
|
||||
}
|
||||
:deep(.slick-arrow.custom-slick-arrow) {
|
||||
color: #fff;
|
||||
background-color: rgba(31, 45, 61, 0.11);
|
||||
transition: ease all 0.3s;
|
||||
opacity: 0.3;
|
||||
z-index: 1;
|
||||
}
|
||||
:deep(.slick-arrow.custom-slick-arrow:before) {
|
||||
display: none;
|
||||
}
|
||||
:deep(.slick-arrow.custom-slick-arrow:hover) {
|
||||
color: #fff;
|
||||
opacity: 0.5;
|
||||
}
|
||||
:deep(.slick-slide h3) {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.user-card {
|
||||
height: 170px;
|
||||
margin: 0 1px;
|
||||
background-color: var(--grey-10);
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
display: flex;
|
||||
.user-avatar {
|
||||
margin-left: 16px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.user-info {
|
||||
margin-left: 10px;
|
||||
.nickname {
|
||||
color: var(--grey-3);
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
}
|
||||
.phone {
|
||||
color: var(--grey-5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.menu-card {
|
||||
width: 340px;
|
||||
margin: 6px auto;
|
||||
background: #ffffff;
|
||||
border-radius: 5px;
|
||||
border-color: slategrey;
|
||||
.btn-center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
.merchant-card-title {
|
||||
width: 340px;
|
||||
margin: 6px auto;
|
||||
font-size: 20px;
|
||||
font-weight: 500;
|
||||
margin-top: 16px;
|
||||
}
|
||||
.merchant-card {
|
||||
width: 340px;
|
||||
max-height: 80px;
|
||||
margin: 6px auto;
|
||||
margin-bottom: 16px;
|
||||
padding: 8px;
|
||||
background: #ffffff;
|
||||
border-radius: 5px;
|
||||
border-color: slategrey;
|
||||
.merchant-name {
|
||||
font-weight: 500;
|
||||
font-size: 15px;
|
||||
}
|
||||
.merchant-desc {
|
||||
width: 200px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
.tools-card {
|
||||
width: 340px;
|
||||
margin: 0 1px;
|
||||
padding: 6px 16px;
|
||||
background: #ffffff;
|
||||
border-radius: 5px;
|
||||
border-color: slategrey;
|
||||
position: absolute;
|
||||
top: 324px;
|
||||
left: 24px;
|
||||
.ele-cell {
|
||||
padding: 4px 0;
|
||||
border-bottom: 1px solid var(--grey-9);
|
||||
}
|
||||
.btn-center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
280
src/views/cms/mp-weixin/home/index.vue
Normal file
280
src/views/cms/mp-weixin/home/index.vue
Normal file
@@ -0,0 +1,280 @@
|
||||
<template>
|
||||
<a-page-header :title="title" @back="() => $router.go(-1)">
|
||||
<div class="ele-cell ele-cell-align-top">
|
||||
<!-- 设计画布 -->
|
||||
<div class="body ele-cell-content ele-bg-white" style="display: ">
|
||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="menuId"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
:customRow="customRow"
|
||||
tool-class="ele-toolbar-form"
|
||||
class="sys-org-table"
|
||||
>
|
||||
<template #toolbar>
|
||||
<search
|
||||
@search="reload"
|
||||
:selection="selection"
|
||||
@add="openEdit"
|
||||
@remove="removeBatch"
|
||||
@batchMove="openMove"
|
||||
/>
|
||||
</template>
|
||||
<template #footer>
|
||||
<div class="ele-text-secondary"
|
||||
>温馨提示:选图标可以上<a
|
||||
href="https://www.iconfont.cn"
|
||||
target="_blank"
|
||||
>阿里巴巴矢量图标库</a
|
||||
>,修改完后需要<a @click="openUrl(`/website/clear-cache`)"
|
||||
>清除缓存</a
|
||||
>才会生效</div
|
||||
>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'icon'">
|
||||
<a-avatar :src="record.icon" :width="50" />
|
||||
</template>
|
||||
<template v-if="column.key === 'path'">
|
||||
<span class="ele-text-placeholder">{{ record.path }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'component'">
|
||||
<span class="ele-text-placeholder">{{ record.component }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'status'">
|
||||
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
||||
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a @click="openEdit(record)">修改</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm
|
||||
title="确定要删除此记录吗?"
|
||||
@confirm="remove(record)"
|
||||
>
|
||||
<a class="ele-text-danger">删除</a>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</a-card>
|
||||
</div>
|
||||
<!-- 载入模拟器 -->
|
||||
<Simulator :form="form" :type="type" :refresh="refresh" @done="reload" />
|
||||
<!-- 中间间隙 -->
|
||||
<div style="width: 500px"></div>
|
||||
<!-- 编辑弹窗 -->
|
||||
<MpMenuEdit
|
||||
v-model:visible="showEdit"
|
||||
:type="type"
|
||||
:data="current"
|
||||
@done="reload"
|
||||
/>
|
||||
</div>
|
||||
</a-page-header>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref, unref, watch } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import type { EleProTable } from 'ele-admin-pro';
|
||||
import type {
|
||||
DatasourceFunction,
|
||||
ColumnItem
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import Search from './components/search.vue';
|
||||
import MpMenuEdit from './components/mpMenuEdit.vue';
|
||||
import Simulator from './components/simulator.vue';
|
||||
import {
|
||||
pageMpMenu,
|
||||
removeMpMenu,
|
||||
removeBatchMpMenu
|
||||
} from '@/api/cms/mp-menu';
|
||||
import type { MpMenu, MpMenuParam } from '@/api/cms/mp-menu/model';
|
||||
import { getPageTitle, openUrl } from '@/utils/common';
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<MpMenu[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<MpMenu | null>(null);
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
// 是否显示批量移动弹窗
|
||||
const showMove = ref(false);
|
||||
// 加载状态
|
||||
const loading = ref(true);
|
||||
// 页面标题
|
||||
const title = getPageTitle();
|
||||
const type = ref<number>(2);
|
||||
const refresh = ref(false);
|
||||
// 模拟器的字段
|
||||
const form = ref<any>({
|
||||
pageName: '广西体育中心',
|
||||
showOrderCard: true,
|
||||
showCarousel: true,
|
||||
showMenuCard: true,
|
||||
showShopCard: true,
|
||||
showTtrainCard: false
|
||||
});
|
||||
// 菜单列表
|
||||
const list = ref<any[]>();
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({
|
||||
page,
|
||||
limit,
|
||||
where,
|
||||
orders,
|
||||
filters
|
||||
}) => {
|
||||
if (filters) {
|
||||
where.status = filters.status;
|
||||
}
|
||||
where.type = 2;
|
||||
return pageMpMenu({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: 'ID',
|
||||
dataIndex: 'menuId',
|
||||
key: 'menuId',
|
||||
align: 'center',
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '菜单图标',
|
||||
dataIndex: 'icon',
|
||||
key: 'icon',
|
||||
align: 'center',
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '菜单名称',
|
||||
dataIndex: 'title',
|
||||
key: 'title',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '路由地址',
|
||||
dataIndex: 'path',
|
||||
key: 'path'
|
||||
},
|
||||
{
|
||||
title: '所在行',
|
||||
dataIndex: 'rows',
|
||||
key: 'rows',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '排序',
|
||||
dataIndex: 'sortNumber',
|
||||
key: 'sortNumber',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 180,
|
||||
fixed: 'right',
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
}
|
||||
]);
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: MpMenuParam) => {
|
||||
type.value = Number(where?.type) || 0;
|
||||
refresh.value = !refresh.value;
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: MpMenu) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开批量移动弹窗 */
|
||||
const openMove = () => {
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: MpMenu) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeMpMenu(row.menuId)
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
/* 批量删除 */
|
||||
const removeBatch = () => {
|
||||
if (!selection.value.length) {
|
||||
message.error('请至少选择一条数据');
|
||||
return;
|
||||
}
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要删除选中的记录吗?',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
maskClosable: true,
|
||||
onOk: () => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeBatchMpMenu(selection.value.map((d) => d.menuId))
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* 自定义行属性 */
|
||||
const customRow = (record: MpMenu) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'MpMenuHome'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
261
src/views/cms/mp-weixin/menu/components/mpMenuEdit.vue
Normal file
261
src/views/cms/mp-weixin/menu/components/mpMenuEdit.vue
Normal file
@@ -0,0 +1,261 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="800"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:maxable="maxable"
|
||||
:title="isUpdate ? '编辑菜单' : '添加菜单'"
|
||||
:body-style="{ paddingBottom: '28px' }"
|
||||
@update:visible="updateVisible"
|
||||
@ok="save"
|
||||
>
|
||||
<a-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||
:wrapper-col="
|
||||
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||
"
|
||||
>
|
||||
<a-form-item label="菜单名称" name="title">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入菜单名称"
|
||||
v-model:value="form.title"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="路由地址" name="path">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入路由地址"
|
||||
v-model:value="form.path"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="菜单图标" name="icon">
|
||||
<SelectFile
|
||||
:placeholder="`请选择图片`"
|
||||
:limit="1"
|
||||
:data="images"
|
||||
@done="chooseFile"
|
||||
@del="onDeleteItem"
|
||||
/>
|
||||
</a-form-item>
|
||||
<!-- <a-form-item label="组件地址" name="component">-->
|
||||
<!-- <a-input-->
|
||||
<!-- allow-clear-->
|
||||
<!-- placeholder="请输入菜单组件地址"-->
|
||||
<!-- v-model:value="form.component"-->
|
||||
<!-- />-->
|
||||
<!-- </a-form-item>-->
|
||||
<a-form-item label="图标颜色" name="color">
|
||||
<ele-color-picker
|
||||
:show-alpha="true"
|
||||
v-model:value="form.color"
|
||||
:predefine="predefineColors"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="排序" name="sortNumber">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:max="9999"
|
||||
class="ele-fluid"
|
||||
placeholder="请输入排序号"
|
||||
v-model:value="form.sortNumber"
|
||||
/>
|
||||
</a-form-item>
|
||||
<!-- <a-form-item label="状态" name="status">-->
|
||||
<!-- <a-radio-group v-model:value="form.status">-->
|
||||
<!-- <a-radio :value="0">显示</a-radio>-->
|
||||
<!-- <a-radio :value="1">隐藏</a-radio>-->
|
||||
<!-- </a-radio-group>-->
|
||||
<!-- </a-form-item>-->
|
||||
</a-form>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { Form, message } from 'ant-design-vue';
|
||||
import { assignObject, uuid } from 'ele-admin-pro';
|
||||
import { addMpMenu, updateMpMenu } from '@/api/cms/mp-menu';
|
||||
import { MpMenu } from '@/api/cms/mp-menu/model';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||
import { FormInstance } from 'ant-design-vue/es/form';
|
||||
import { FileRecord } from '@/api/system/file/model';
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
const useForm = Form.useForm;
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 类型 0服务 1订单
|
||||
type?: number;
|
||||
// 修改回显的数据
|
||||
data?: MpMenu | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
// 提交状态
|
||||
const loading = ref(false);
|
||||
// 是否显示最大化切换按钮
|
||||
const maxable = ref(true);
|
||||
// 表格选中数据
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
const images = ref<ItemType[]>([]);
|
||||
|
||||
// 用户信息
|
||||
const form = reactive<MpMenu>({
|
||||
menuId: undefined,
|
||||
parentId: 0,
|
||||
title: '',
|
||||
type: 0,
|
||||
isMpWeixin: true,
|
||||
path: undefined,
|
||||
component: undefined,
|
||||
target: undefined,
|
||||
icon: '',
|
||||
color: undefined,
|
||||
hide: undefined,
|
||||
position: undefined,
|
||||
active: undefined,
|
||||
userId: 0,
|
||||
home: undefined,
|
||||
sortNumber: 100,
|
||||
comments: '',
|
||||
status: 0
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
title: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写菜单名称',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
path: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写路由地址',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const chooseFile = (data: FileRecord) => {
|
||||
images.value.push({
|
||||
uid: data.id,
|
||||
url: data.thumbnail,
|
||||
status: 'done'
|
||||
});
|
||||
form.icon = data.thumbnail;
|
||||
};
|
||||
|
||||
const onDeleteItem = (index: number) => {
|
||||
images.value.splice(index, 1);
|
||||
form.icon = '';
|
||||
};
|
||||
|
||||
// 预设颜色
|
||||
const predefineColors = ref([
|
||||
'#40a9ff',
|
||||
'#9254de',
|
||||
'#36cfc9',
|
||||
'#73d13d',
|
||||
'#f759ab',
|
||||
'#cf1313',
|
||||
'#ff4d4f',
|
||||
'#ffa940',
|
||||
'#ffc53d',
|
||||
'#f3d3d3',
|
||||
'#1b1b1b',
|
||||
'#363636',
|
||||
'#4d4d4d',
|
||||
'#737373',
|
||||
'#a6a6a6',
|
||||
'#d9d9d9',
|
||||
'#e6e6e6',
|
||||
'#f2f2f2',
|
||||
'#f7f7f7',
|
||||
'#fafafa'
|
||||
]);
|
||||
|
||||
const { resetFields } = useForm(form, rules);
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
if (!formRef.value) {
|
||||
return;
|
||||
}
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
const formData = {
|
||||
...form
|
||||
};
|
||||
const saveOrUpdate = isUpdate.value ? updateMpMenu : addMpMenu;
|
||||
saveOrUpdate(formData)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
images.value = [];
|
||||
if (props.type) {
|
||||
form.type = props.type;
|
||||
}
|
||||
if (props.data) {
|
||||
assignObject(form, props.data);
|
||||
if (props.data.icon) {
|
||||
images.value.push({
|
||||
uid: uuid(),
|
||||
url: props.data.icon,
|
||||
status: 'done'
|
||||
});
|
||||
}
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
61
src/views/cms/mp-weixin/menu/components/search.vue
Normal file
61
src/views/cms/mp-weixin/menu/components/search.vue
Normal file
@@ -0,0 +1,61 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<a-space :size="10" style="flex-wrap: wrap">
|
||||
<a-button type="primary" class="ele-btn-icon" @click="add">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
<span>添加</span>
|
||||
</a-button>
|
||||
<a-space>
|
||||
<span class="ele-text-placeholder" style="margin-left: 20px"
|
||||
>菜单类型</span
|
||||
>
|
||||
<a-radio-group v-model:value="where.type" @change="handleSearch">
|
||||
<a-radio-button :value="1">订单图标</a-radio-button>
|
||||
<a-radio-button :value="0">功能图标</a-radio-button>
|
||||
</a-radio-group>
|
||||
</a-space>
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||
import { watch } from 'vue';
|
||||
import useSearch from '@/utils/use-search';
|
||||
import { MpMenu, MpMenuParam } from '@/api/cms/mp-menu/model';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
selection?: [];
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: MpMenuParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
(e: 'batchMove'): void;
|
||||
}>();
|
||||
|
||||
// 表单数据
|
||||
const { where } = useSearch<MpMenu>({
|
||||
type: 0
|
||||
});
|
||||
|
||||
const handleSearch = () => {
|
||||
emit('search', where);
|
||||
};
|
||||
|
||||
// 新增
|
||||
const add = () => {
|
||||
emit('add');
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
);
|
||||
</script>
|
||||
284
src/views/cms/mp-weixin/menu/index.vue
Normal file
284
src/views/cms/mp-weixin/menu/index.vue
Normal file
@@ -0,0 +1,284 @@
|
||||
<template>
|
||||
<a-page-header :title="title" @back="() => $router.go(-1)">
|
||||
<div class="ele-cell ele-cell-align-top">
|
||||
<!-- 设计画布 -->
|
||||
<div class="body ele-cell-content ele-bg-white">
|
||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="menuId"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
:customRow="customRow"
|
||||
tool-class="ele-toolbar-form"
|
||||
class="sys-org-table"
|
||||
>
|
||||
<template #toolbar>
|
||||
<search
|
||||
@search="reload"
|
||||
:selection="selection"
|
||||
@add="openEdit"
|
||||
@remove="removeBatch"
|
||||
@batchMove="openMove"
|
||||
/>
|
||||
</template>
|
||||
<template #footer>
|
||||
<div class="ele-text-secondary"
|
||||
>温馨提示:选图标可以上<a
|
||||
href="https://www.iconfont.cn"
|
||||
target="_blank"
|
||||
>阿里巴巴矢量图标库</a
|
||||
>(https://www.iconfont.cn)</div
|
||||
>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'icon'">
|
||||
<a-avatar :src="record.icon" :width="50" />
|
||||
</template>
|
||||
<template v-if="column.key === 'path'">
|
||||
<span class="ele-text-placeholder">{{ record.path }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'component'">
|
||||
<span class="ele-text-placeholder">{{ record.component }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'status'">
|
||||
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
||||
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a @click="openEdit(record)">修改</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm
|
||||
title="确定要删除此记录吗?"
|
||||
@confirm="remove(record)"
|
||||
>
|
||||
<a class="ele-text-danger">删除</a>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</a-card>
|
||||
</div>
|
||||
<!-- 中间间隙 -->
|
||||
<div style="width: 500px"></div>
|
||||
<!-- 载入模拟器 -->
|
||||
<Simulator :form="form" :type="type" />
|
||||
</div>
|
||||
</a-page-header>
|
||||
<div class="page">
|
||||
<div class="ele-body">
|
||||
<!-- 编辑弹窗 -->
|
||||
<MpMenuEdit
|
||||
v-model:visible="showEdit"
|
||||
:type="type"
|
||||
:data="current"
|
||||
@done="reload"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import type { EleProTable } from 'ele-admin-pro';
|
||||
import type {
|
||||
DatasourceFunction,
|
||||
ColumnItem
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import Search from './components/search.vue';
|
||||
import MpMenuEdit from './components/mpMenuEdit.vue';
|
||||
import {
|
||||
pageMpMenu,
|
||||
removeMpMenu,
|
||||
removeBatchMpMenu
|
||||
} from '@/api/cms/mp-menu';
|
||||
import type { MpMenu, MpMenuParam } from '@/api/cms/mp-menu/model';
|
||||
import { getPageTitle } from '@/utils/common';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<MpMenu[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<MpMenu | null>(null);
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
// 是否显示批量移动弹窗
|
||||
const showMove = ref(false);
|
||||
// 加载状态
|
||||
const loading = ref(true);
|
||||
// 页面标题
|
||||
const title = getPageTitle();
|
||||
const type = ref<number>(0);
|
||||
// 模拟器的字段
|
||||
const form = ref<any>({
|
||||
pageName: '个人中心',
|
||||
showUserCard: true,
|
||||
showOrderCard: true,
|
||||
showToolsCard: true
|
||||
});
|
||||
// 菜单列表
|
||||
const list = ref<any[]>();
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({
|
||||
page,
|
||||
limit,
|
||||
where,
|
||||
orders,
|
||||
filters
|
||||
}) => {
|
||||
if (filters) {
|
||||
where.status = filters.status;
|
||||
}
|
||||
return pageMpMenu({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: 'ID',
|
||||
dataIndex: 'menuId',
|
||||
key: 'menuId',
|
||||
align: 'center',
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '菜单图标',
|
||||
dataIndex: 'icon',
|
||||
key: 'icon',
|
||||
align: 'center',
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '菜单名称',
|
||||
dataIndex: 'title',
|
||||
key: 'title',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '路由地址',
|
||||
dataIndex: 'path',
|
||||
key: 'path',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '组件地址',
|
||||
dataIndex: 'component',
|
||||
key: 'component',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '排序',
|
||||
dataIndex: 'sortNumber',
|
||||
key: 'sortNumber',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 180,
|
||||
fixed: 'right',
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
}
|
||||
]);
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: MpMenuParam) => {
|
||||
type.value = Number(where?.type) || 0;
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: MpMenu) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开批量移动弹窗 */
|
||||
const openMove = () => {
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: MpMenu) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeMpMenu(row.menuId)
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
/* 批量删除 */
|
||||
const removeBatch = () => {
|
||||
if (!selection.value.length) {
|
||||
message.error('请至少选择一条数据');
|
||||
return;
|
||||
}
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要删除选中的记录吗?',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
maskClosable: true,
|
||||
onOk: () => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeBatchMpMenu(selection.value.map((d) => d.menuId))
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* 查询 */
|
||||
const query = () => {
|
||||
loading.value = true;
|
||||
};
|
||||
|
||||
/* 自定义行属性 */
|
||||
const customRow = (record: MpMenu) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
query();
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'MpMenuIndex'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
248
src/views/cms/mp-weixin/order/components/mpMenuEdit.vue
Normal file
248
src/views/cms/mp-weixin/order/components/mpMenuEdit.vue
Normal file
@@ -0,0 +1,248 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="800"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:maxable="maxable"
|
||||
:title="isUpdate ? '编辑菜单' : '添加菜单'"
|
||||
:body-style="{ paddingBottom: '28px' }"
|
||||
@update:visible="updateVisible"
|
||||
@ok="save"
|
||||
>
|
||||
<a-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||
:wrapper-col="
|
||||
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||
"
|
||||
>
|
||||
<a-form-item label="菜单名称" name="title">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入菜单名称"
|
||||
v-model:value="form.title"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="路由地址" name="path">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入路由地址"
|
||||
v-model:value="form.path"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="菜单图标" name="icon">
|
||||
<SelectFile
|
||||
:placeholder="`请选择图片`"
|
||||
:limit="1"
|
||||
:data="images"
|
||||
@done="chooseFile"
|
||||
@del="onDeleteItem"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="图标颜色" name="color">
|
||||
<ele-color-picker
|
||||
:show-alpha="true"
|
||||
v-model:value="form.color"
|
||||
:predefine="predefineColors"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="排序" name="sortNumber">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:max="9999"
|
||||
class="ele-fluid"
|
||||
placeholder="请输入排序号"
|
||||
v-model:value="form.sortNumber"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { Form, message } from 'ant-design-vue';
|
||||
import { assignObject, uuid } from 'ele-admin-pro';
|
||||
import { addMpMenu, updateMpMenu } from '@/api/cms/mp-menu';
|
||||
import { MpMenu } from '@/api/cms/mp-menu/model';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||
import { FormInstance } from 'ant-design-vue/es/form';
|
||||
import { FileRecord } from '@/api/system/file/model';
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
const useForm = Form.useForm;
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 类型 0服务 1订单
|
||||
type?: number;
|
||||
// 修改回显的数据
|
||||
data?: MpMenu | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
// 提交状态
|
||||
const loading = ref(false);
|
||||
// 是否显示最大化切换按钮
|
||||
const maxable = ref(true);
|
||||
// 表格选中数据
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
const images = ref<ItemType[]>([]);
|
||||
|
||||
// 用户信息
|
||||
const form = reactive<MpMenu>({
|
||||
menuId: undefined,
|
||||
parentId: 0,
|
||||
title: '',
|
||||
type: 2,
|
||||
isMpWeixin: true,
|
||||
path: undefined,
|
||||
component: undefined,
|
||||
target: undefined,
|
||||
icon: '',
|
||||
color: undefined,
|
||||
hide: undefined,
|
||||
position: undefined,
|
||||
active: undefined,
|
||||
userId: 0,
|
||||
home: undefined,
|
||||
sortNumber: 100,
|
||||
comments: '',
|
||||
status: 0
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
title: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写菜单名称',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
path: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写路由地址',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const chooseFile = (data: FileRecord) => {
|
||||
images.value.push({
|
||||
uid: data.id,
|
||||
url: data.thumbnail,
|
||||
status: 'done'
|
||||
});
|
||||
form.icon = data.thumbnail;
|
||||
};
|
||||
|
||||
const onDeleteItem = (index: number) => {
|
||||
images.value.splice(index, 1);
|
||||
form.icon = '';
|
||||
};
|
||||
|
||||
// 预设颜色
|
||||
const predefineColors = ref([
|
||||
'#40a9ff',
|
||||
'#9254de',
|
||||
'#36cfc9',
|
||||
'#73d13d',
|
||||
'#f759ab',
|
||||
'#cf1313',
|
||||
'#ff4d4f',
|
||||
'#ffa940',
|
||||
'#ffc53d',
|
||||
'#f3d3d3',
|
||||
'#1b1b1b',
|
||||
'#363636',
|
||||
'#4d4d4d',
|
||||
'#737373',
|
||||
'#a6a6a6',
|
||||
'#d9d9d9',
|
||||
'#e6e6e6',
|
||||
'#f2f2f2',
|
||||
'#f7f7f7',
|
||||
'#fafafa'
|
||||
]);
|
||||
|
||||
const { resetFields } = useForm(form, rules);
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
if (!formRef.value) {
|
||||
return;
|
||||
}
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
const formData = {
|
||||
...form
|
||||
};
|
||||
const saveOrUpdate = isUpdate.value ? updateMpMenu : addMpMenu;
|
||||
saveOrUpdate(formData)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
images.value = [];
|
||||
if (props.type) {
|
||||
form.type = props.type;
|
||||
}
|
||||
if (props.data) {
|
||||
assignObject(form, props.data);
|
||||
if (props.data.icon) {
|
||||
images.value.push({
|
||||
uid: uuid(),
|
||||
url: props.data.icon,
|
||||
status: 'done'
|
||||
});
|
||||
}
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
52
src/views/cms/mp-weixin/order/components/search.vue
Normal file
52
src/views/cms/mp-weixin/order/components/search.vue
Normal file
@@ -0,0 +1,52 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<a-space :size="10" style="flex-wrap: wrap">
|
||||
<!-- <a-button type="primary" class="ele-btn-icon" @click="add">-->
|
||||
<!-- <template #icon>-->
|
||||
<!-- <PlusOutlined />-->
|
||||
<!-- </template>-->
|
||||
<!-- <span>添加</span>-->
|
||||
<!-- </a-button>-->
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||
import { watch } from 'vue';
|
||||
import useSearch from '@/utils/use-search';
|
||||
import { MpMenu, MpMenuParam } from '@/api/cms/mp-menu/model';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
selection?: [];
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: MpMenuParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
(e: 'batchMove'): void;
|
||||
}>();
|
||||
|
||||
// 表单数据
|
||||
const { where } = useSearch<MpMenu>({
|
||||
type: 2
|
||||
});
|
||||
|
||||
const handleSearch = () => {
|
||||
emit('search', where);
|
||||
};
|
||||
|
||||
// 新增
|
||||
const add = () => {
|
||||
emit('add');
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
);
|
||||
</script>
|
||||
534
src/views/cms/mp-weixin/order/components/simulator.vue
Normal file
534
src/views/cms/mp-weixin/order/components/simulator.vue
Normal file
@@ -0,0 +1,534 @@
|
||||
<template>
|
||||
<div class="phone-layout" v-if="form">
|
||||
<div class="phone-header-black ele-fluid">
|
||||
<div class="title ele-fluid">
|
||||
<div class="title-bar">
|
||||
<span class="back"></span>
|
||||
<span>{{ form.pageName || '订单' }}</span>
|
||||
<a class="share" @click="onShare"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tabs-card">
|
||||
<a-tabs v-model:activeKey="activeKey">
|
||||
<a-tab-pane key="1" tab="全部订单">
|
||||
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="2" tab="未支付" force-render>
|
||||
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="3" tab="已支付">
|
||||
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="4" tab="已完成">
|
||||
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="5" tab="押金">
|
||||
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
<div class="order-list">
|
||||
<span class="ele-text-placeholder">订单列表</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template v-if="form.showMenuCard">
|
||||
<div class="phone-body" style="overflow-y: auto; overflow-x: hidden">
|
||||
<!-- 幻灯片轮播 -->
|
||||
<template v-if="form.showCarousel">
|
||||
<a-carousel arrows autoplay :dots="true">
|
||||
<template v-if="adImageList">
|
||||
<template v-for="(img, index) in adImageList" :key="index">
|
||||
<div class="ad-item">
|
||||
<a-image
|
||||
:preview="false"
|
||||
:src="img.url"
|
||||
width="100%"
|
||||
height="200px"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</a-carousel>
|
||||
</template>
|
||||
<!-- 导航菜单 -->
|
||||
<template v-if="form.showMenuCard">
|
||||
<div class="menu-card ele-cell">
|
||||
<div
|
||||
v-for="(item, index) in scrollList"
|
||||
:key="index"
|
||||
class="ele-cell-content ele-text-center btn-center"
|
||||
@click="openMpMenuEdit(item)"
|
||||
>
|
||||
<a-image :src="item.icon" :width="30" :preview="false" />
|
||||
<span>{{ item.title }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<MpMenuEdit
|
||||
v-model:visible="showMpMenuEdit"
|
||||
:data="current"
|
||||
@done="reload"
|
||||
/>
|
||||
</template>
|
||||
<!-- 商户列表 -->
|
||||
<template v-if="form.showShopCard">
|
||||
<div class="merchant-card-title">场地预定</div>
|
||||
<div
|
||||
class="merchant-card ele-cell"
|
||||
v-for="(item, index) in shopList"
|
||||
:key="index"
|
||||
>
|
||||
<a-image :src="item.image" :width="96" :preview="false" />
|
||||
<div class="merchant-info ele-cell-content">
|
||||
<div class="merchant-name">{{ item.merchantName }}</div>
|
||||
<div class="merchant-desc ele-cell-desc">
|
||||
{{ item.comments }}
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="">-->
|
||||
<!-- <a-button>我要去</a-button>-->
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
</template>
|
||||
<!-- 培训课程 -->
|
||||
<template v-if="form.showTtrainCard">
|
||||
<div class="merchant-card-title">培训课程</div>
|
||||
<div
|
||||
class="merchant-card ele-cell"
|
||||
v-for="(item, index) in shopList"
|
||||
:key="index"
|
||||
@click="openMpMenuEdit(item)"
|
||||
>
|
||||
<a-image :src="item.image" :width="96" :preview="false" />
|
||||
<div class="merchant-info ele-cell-content">
|
||||
<div class="merchant-name">{{ item.merchantName }}</div>
|
||||
<div class="merchant-desc ele-cell-desc">
|
||||
{{ item.comments }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
<a-card
|
||||
class="buy-bar"
|
||||
:bordered="false"
|
||||
:body-style="{ padding: '12px 16px' }"
|
||||
>
|
||||
<div class="ele-cell">
|
||||
<a
|
||||
class="home-btn ele-cell-content ele-text-secondary"
|
||||
@click="openUrl(`/mp-weixin/home`)"
|
||||
>
|
||||
<HomeOutlined class="icon" />
|
||||
<span>首页</span>
|
||||
</a>
|
||||
<a
|
||||
class="shop-btn ele-cell-content ele-text-secondary"
|
||||
@click="openUrl(`/mp-weixin/shop`)"
|
||||
>
|
||||
<ShopOutlined class="icon" />
|
||||
<span>商城</span>
|
||||
</a>
|
||||
<a
|
||||
class="order-btn ele-cell-content ele-text-secondary"
|
||||
@click="openUrl(`/mp-weixin/order`)"
|
||||
>
|
||||
<ProfileOutlined class="icon ele-text-danger" />
|
||||
<span class="ele-text-danger">订单</span>
|
||||
</a>
|
||||
<a
|
||||
class="user-btn ele-cell-content ele-text-secondary"
|
||||
@click="openUrl(`/mp-weixin/user`)"
|
||||
>
|
||||
<UserOutlined class="icon" />
|
||||
我的
|
||||
</a>
|
||||
</div>
|
||||
</a-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {
|
||||
ProfileOutlined,
|
||||
ShopOutlined,
|
||||
HomeOutlined,
|
||||
UserOutlined
|
||||
} from '@ant-design/icons-vue';
|
||||
import { ref, unref, watch } from 'vue';
|
||||
import { MpWeixinParam, WebsiteField } from '@/api/cms/website/field/model';
|
||||
import { listWebsiteField } from '@/api/system/website/field';
|
||||
import { MpMenu } from '@/api/cms/mp-menu/model';
|
||||
import { listMpMenu } from '@/api/cms/mp-menu';
|
||||
import { listAd } from '@/api/cms/ad';
|
||||
import { listMerchant } from '@/api/shop/merchant';
|
||||
import { Merchant } from '@/api/shop/merchant/model';
|
||||
import { openUrl } from '@/utils/common';
|
||||
import { useRouter } from 'vue-router';
|
||||
const { currentRoute } = useRouter();
|
||||
const { query } = unref(currentRoute);
|
||||
|
||||
import MpMenuEdit from '@/views/cms/mp-weixin/menu/components/mpMenuEdit.vue';
|
||||
|
||||
const prpos = withDefaults(
|
||||
defineProps<{
|
||||
value?: string;
|
||||
placeholder?: string;
|
||||
form?: any | null;
|
||||
type?: number;
|
||||
list?: any[] | null;
|
||||
refresh?: boolean;
|
||||
}>(),
|
||||
{
|
||||
placeholder: undefined
|
||||
}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
const param = ref<MpWeixinParam>({});
|
||||
const showUserCardEdit = ref(false);
|
||||
const showMpMenuEdit = ref(false);
|
||||
// 当前编辑数据
|
||||
const current = ref<WebsiteField | null>(null);
|
||||
|
||||
// 幻灯片广告
|
||||
const adImageList = ref<any[]>();
|
||||
// 首页导航图标
|
||||
const scrollList = ref<any[]>();
|
||||
// 订单图标
|
||||
const order = ref<any[]>();
|
||||
// 服务图标
|
||||
const server = ref<any[]>();
|
||||
// 商户列表
|
||||
const shopList = ref<Merchant[]>();
|
||||
|
||||
const config = ref({
|
||||
selector: '#content', //容器,可使用css选择器
|
||||
branding: false,
|
||||
language: 'zh_CN', //调用放在langs文件夹内的语言包
|
||||
toolbar: false, //隐藏工具栏
|
||||
menubar: false, //隐藏菜单栏
|
||||
inline: true, //开启内联模式
|
||||
plugins: [] //选择需加载的插件
|
||||
//选中时出现的快捷工具,与插件有依赖关系
|
||||
// quickbars_selection_toolbar: 'bold italic forecolor | link blockquote quickimage',
|
||||
// init_instance_callback: function (editor) {
|
||||
// editor.setContent('这里是你的内容字符串');
|
||||
// }
|
||||
});
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openUserCard = (row?: WebsiteField) => {
|
||||
current.value = row ?? null;
|
||||
showUserCardEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openMpMenuEdit = (row?: MpMenu) => {
|
||||
current.value = row ?? null;
|
||||
showMpMenuEdit.value = true;
|
||||
};
|
||||
|
||||
const onShare = () => {};
|
||||
|
||||
const activeKey = ref('1');
|
||||
|
||||
const reload = () => {
|
||||
listWebsiteField({}).then((list) => {
|
||||
list.map((d) => {
|
||||
const key = String(d.name);
|
||||
param.value[key] = d.value;
|
||||
});
|
||||
});
|
||||
|
||||
listMpMenu({}).then((list) => {
|
||||
server.value = list.filter((d) => d.type == 0);
|
||||
order.value = list.filter((d) => d.type == 1);
|
||||
scrollList.value = list.filter((d) => d.type == 2);
|
||||
});
|
||||
|
||||
listAd({ adType: '幻灯片' }).then((res) => {
|
||||
const carouselImages = res[0].images;
|
||||
if (carouselImages) {
|
||||
adImageList.value = JSON.parse(carouselImages);
|
||||
}
|
||||
});
|
||||
|
||||
listMerchant({}).then((list) => {
|
||||
shopList.value = list;
|
||||
});
|
||||
emit('done');
|
||||
};
|
||||
|
||||
reload();
|
||||
|
||||
watch(
|
||||
() => prpos.refresh,
|
||||
(refresh) => {
|
||||
if (refresh) {
|
||||
reload();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.phone-layout {
|
||||
position: fixed;
|
||||
right: 26px;
|
||||
width: 390px;
|
||||
height: 844px;
|
||||
background: url('@/assets/img/app-ui.png');
|
||||
background-repeat: no-repeat;
|
||||
background-position: top;
|
||||
background-size: 100%;
|
||||
//position: relative;
|
||||
padding: 0 16px;
|
||||
.phone-header-black {
|
||||
height: 99px;
|
||||
border-radius: 20px 20px 0 0;
|
||||
background-size: 100%;
|
||||
.title {
|
||||
height: 99px;
|
||||
font-size: 16px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: end;
|
||||
padding-bottom: 13px;
|
||||
|
||||
.title-bar {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.back {
|
||||
display: block;
|
||||
width: 50px;
|
||||
margin-left: 3px;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
.share {
|
||||
display: block;
|
||||
width: 50px;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.phone-body-bg {
|
||||
padding: 0 16px;
|
||||
height: 680px;
|
||||
border-radius: 0 0 44px 44px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.phone-body {
|
||||
width: 356px;
|
||||
margin-left: 17px;
|
||||
height: 630px;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
top: 98px;
|
||||
left: 0;
|
||||
z-index: 999;
|
||||
.comments {
|
||||
padding: 20px;
|
||||
word-break: break-all;
|
||||
}
|
||||
.form-data {
|
||||
padding: 10px 20px;
|
||||
.submit-btn {
|
||||
padding: 30px 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
.goods {
|
||||
.price {
|
||||
font-size: 18px;
|
||||
}
|
||||
.ele-cell-title {
|
||||
font-weight: 600;
|
||||
font-size: 16px;
|
||||
}
|
||||
.goods-attr {
|
||||
}
|
||||
}
|
||||
.goods-divider {
|
||||
height: 6px;
|
||||
}
|
||||
.buy-bar {
|
||||
position: fixed;
|
||||
width: 356px;
|
||||
bottom: 70px;
|
||||
//top: 881px;
|
||||
background-color: #ffffff;
|
||||
border-radius: 0 0 44px 44px;
|
||||
border-top: 1px solid var(--grey-8);
|
||||
.ele-cell-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.home-btn,
|
||||
.shop-btn,
|
||||
.order-btn,
|
||||
.user-btn {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
font-size: 13px;
|
||||
padding: 0 9px;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.icon {
|
||||
font-size: 19px;
|
||||
}
|
||||
.buy-btn {
|
||||
display: flex;
|
||||
.add-cart {
|
||||
border-radius: 100px 0 0 100px;
|
||||
border: none;
|
||||
background-color: var(--orange-5);
|
||||
color: #ffffff;
|
||||
height: 40px;
|
||||
width: 95px;
|
||||
}
|
||||
.buy-now {
|
||||
border-radius: 0 100px 100px 0;
|
||||
border: none;
|
||||
background-color: var(--red-6);
|
||||
color: #ffffff;
|
||||
height: 40px;
|
||||
width: 95px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
:deep(.slick-slide) {
|
||||
overflow: hidden;
|
||||
}
|
||||
:deep(.slick-arrow.custom-slick-arrow) {
|
||||
font-size: 38px;
|
||||
}
|
||||
:deep(.slick-arrow.custom-slick-arrow) {
|
||||
color: #fff;
|
||||
background-color: rgba(31, 45, 61, 0.11);
|
||||
transition: ease all 0.3s;
|
||||
opacity: 0.3;
|
||||
z-index: 1;
|
||||
}
|
||||
:deep(.slick-arrow.custom-slick-arrow:before) {
|
||||
display: none;
|
||||
}
|
||||
:deep(.slick-arrow.custom-slick-arrow:hover) {
|
||||
color: #fff;
|
||||
opacity: 0.5;
|
||||
}
|
||||
:deep(.slick-slide h3) {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.user-card {
|
||||
height: 170px;
|
||||
margin: 0 1px;
|
||||
background-color: var(--grey-10);
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
display: flex;
|
||||
.user-avatar {
|
||||
margin-left: 16px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.user-info {
|
||||
margin-left: 10px;
|
||||
.nickname {
|
||||
color: var(--grey-3);
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
}
|
||||
.phone {
|
||||
color: var(--grey-5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.menu-card {
|
||||
width: 340px;
|
||||
height: 80px;
|
||||
margin: 6px auto;
|
||||
background: #ffffff;
|
||||
border-radius: 5px;
|
||||
border-color: slategrey;
|
||||
.btn-center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
.merchant-card-title {
|
||||
width: 340px;
|
||||
margin: 6px auto;
|
||||
font-size: 20px;
|
||||
font-weight: 500;
|
||||
margin-top: 16px;
|
||||
}
|
||||
.merchant-card {
|
||||
width: 340px;
|
||||
max-height: 80px;
|
||||
margin: 6px auto;
|
||||
margin-bottom: 16px;
|
||||
padding: 8px;
|
||||
background: #ffffff;
|
||||
border-radius: 5px;
|
||||
border-color: slategrey;
|
||||
.merchant-name {
|
||||
font-weight: 500;
|
||||
font-size: 15px;
|
||||
}
|
||||
.merchant-desc {
|
||||
width: 200px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
.tools-card {
|
||||
width: 340px;
|
||||
margin: 0 1px;
|
||||
padding: 6px 16px;
|
||||
background: #ffffff;
|
||||
border-radius: 5px;
|
||||
border-color: slategrey;
|
||||
position: absolute;
|
||||
top: 324px;
|
||||
left: 24px;
|
||||
.ele-cell {
|
||||
padding: 4px 0;
|
||||
border-bottom: 1px solid var(--grey-9);
|
||||
}
|
||||
.btn-center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
.tabs-card{
|
||||
padding: 0 10px;
|
||||
.order-list{
|
||||
background-color: #ffffff;
|
||||
padding: 10px;
|
||||
min-height: 200px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
280
src/views/cms/mp-weixin/order/index.vue
Normal file
280
src/views/cms/mp-weixin/order/index.vue
Normal file
@@ -0,0 +1,280 @@
|
||||
<template>
|
||||
<a-page-header :title="title" @back="() => $router.go(-1)">
|
||||
<div class="ele-cell ele-cell-align-top">
|
||||
<!-- 设计画布 -->
|
||||
<div class="body ele-cell-content ele-bg-white" style="display: ">
|
||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="menuId"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
:customRow="customRow"
|
||||
tool-class="ele-toolbar-form"
|
||||
class="sys-org-table"
|
||||
>
|
||||
<template #toolbar>
|
||||
<search
|
||||
@search="reload"
|
||||
:selection="selection"
|
||||
@add="openEdit"
|
||||
@remove="removeBatch"
|
||||
@batchMove="openMove"
|
||||
/>
|
||||
</template>
|
||||
<template #footer>
|
||||
<div class="ele-text-secondary"
|
||||
>温馨提示:选图标可以上<a
|
||||
href="https://www.iconfont.cn"
|
||||
target="_blank"
|
||||
>阿里巴巴矢量图标库</a
|
||||
>,修改完后需要<a @click="openUrl(`/website/clear-cache`)"
|
||||
>清除缓存</a
|
||||
>才会生效</div
|
||||
>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'icon'">
|
||||
<a-avatar :src="record.icon" :width="50" />
|
||||
</template>
|
||||
<template v-if="column.key === 'path'">
|
||||
<span class="ele-text-placeholder">{{ record.path }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'component'">
|
||||
<span class="ele-text-placeholder">{{ record.component }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'status'">
|
||||
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
||||
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a @click="openEdit(record)">修改</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm
|
||||
title="确定要删除此记录吗?"
|
||||
@confirm="remove(record)"
|
||||
>
|
||||
<a class="ele-text-danger">删除</a>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</a-card>
|
||||
</div>
|
||||
<!-- 载入模拟器 -->
|
||||
<Simulator :form="form" :type="type" :refresh="refresh" @done="reload" />
|
||||
<!-- 中间间隙 -->
|
||||
<div style="width: 500px"></div>
|
||||
<!-- 编辑弹窗 -->
|
||||
<MpMenuEdit
|
||||
v-model:visible="showEdit"
|
||||
:type="type"
|
||||
:data="current"
|
||||
@done="reload"
|
||||
/>
|
||||
</div>
|
||||
</a-page-header>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref, unref, watch } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import type { EleProTable } from 'ele-admin-pro';
|
||||
import type {
|
||||
DatasourceFunction,
|
||||
ColumnItem
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import Search from './components/search.vue';
|
||||
import MpMenuEdit from './components/mpMenuEdit.vue';
|
||||
import Simulator from './components/simulator.vue';
|
||||
import {
|
||||
pageMpMenu,
|
||||
removeMpMenu,
|
||||
removeBatchMpMenu
|
||||
} from '@/api/cms/mp-menu';
|
||||
import type { MpMenu, MpMenuParam } from '@/api/cms/mp-menu/model';
|
||||
import { getPageTitle, openUrl } from '@/utils/common';
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<MpMenu[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<MpMenu | null>(null);
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
// 是否显示批量移动弹窗
|
||||
const showMove = ref(false);
|
||||
// 加载状态
|
||||
const loading = ref(true);
|
||||
// 页面标题
|
||||
const title = getPageTitle();
|
||||
const type = ref<number>(2);
|
||||
const refresh = ref(false);
|
||||
// 模拟器的字段
|
||||
const form = ref<any>({
|
||||
pageName: '场馆预定订单',
|
||||
showOrderCard: false,
|
||||
showCarousel: false,
|
||||
showMenuCard: false,
|
||||
showShopCard: false,
|
||||
showTtrainCard: false
|
||||
});
|
||||
// 菜单列表
|
||||
const list = ref<any[]>();
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({
|
||||
page,
|
||||
limit,
|
||||
where,
|
||||
orders,
|
||||
filters
|
||||
}) => {
|
||||
if (filters) {
|
||||
where.status = filters.status;
|
||||
}
|
||||
where.type = 5;
|
||||
return pageMpMenu({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: 'ID',
|
||||
dataIndex: 'menuId',
|
||||
key: 'menuId',
|
||||
align: 'center',
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '菜单图标',
|
||||
dataIndex: 'icon',
|
||||
key: 'icon',
|
||||
align: 'center',
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '菜单名称',
|
||||
dataIndex: 'title',
|
||||
key: 'title',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '路由地址',
|
||||
dataIndex: 'path',
|
||||
key: 'path'
|
||||
},
|
||||
{
|
||||
title: '分类ID',
|
||||
dataIndex: 'type',
|
||||
key: 'type',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '排序',
|
||||
dataIndex: 'sortNumber',
|
||||
key: 'sortNumber',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 180,
|
||||
fixed: 'right',
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
}
|
||||
]);
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: MpMenuParam) => {
|
||||
type.value = Number(where?.type) || 0;
|
||||
refresh.value = !refresh.value;
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: MpMenu) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开批量移动弹窗 */
|
||||
const openMove = () => {
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: MpMenu) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeMpMenu(row.menuId)
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
/* 批量删除 */
|
||||
const removeBatch = () => {
|
||||
if (!selection.value.length) {
|
||||
message.error('请至少选择一条数据');
|
||||
return;
|
||||
}
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要删除选中的记录吗?',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
maskClosable: true,
|
||||
onOk: () => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeBatchMpMenu(selection.value.map((d) => d.menuId))
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* 自定义行属性 */
|
||||
const customRow = (record: MpMenu) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'MpMenuOrder'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
248
src/views/cms/mp-weixin/shop/components/mpMenuEdit.vue
Normal file
248
src/views/cms/mp-weixin/shop/components/mpMenuEdit.vue
Normal file
@@ -0,0 +1,248 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="800"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:maxable="maxable"
|
||||
:title="isUpdate ? '编辑菜单' : '添加菜单'"
|
||||
:body-style="{ paddingBottom: '28px' }"
|
||||
@update:visible="updateVisible"
|
||||
@ok="save"
|
||||
>
|
||||
<a-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||
:wrapper-col="
|
||||
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||
"
|
||||
>
|
||||
<a-form-item label="菜单名称" name="title">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入菜单名称"
|
||||
v-model:value="form.title"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="路由地址" name="path">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入路由地址"
|
||||
v-model:value="form.path"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="菜单图标" name="icon">
|
||||
<SelectFile
|
||||
:placeholder="`请选择图片`"
|
||||
:limit="1"
|
||||
:data="images"
|
||||
@done="chooseFile"
|
||||
@del="onDeleteItem"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="图标颜色" name="color">
|
||||
<ele-color-picker
|
||||
:show-alpha="true"
|
||||
v-model:value="form.color"
|
||||
:predefine="predefineColors"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="排序" name="sortNumber">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:max="9999"
|
||||
class="ele-fluid"
|
||||
placeholder="请输入排序号"
|
||||
v-model:value="form.sortNumber"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { Form, message } from 'ant-design-vue';
|
||||
import { assignObject, uuid } from 'ele-admin-pro';
|
||||
import { addMpMenu, updateMpMenu } from '@/api/cms/mp-menu';
|
||||
import { MpMenu } from '@/api/cms/mp-menu/model';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||
import { FormInstance } from 'ant-design-vue/es/form';
|
||||
import { FileRecord } from '@/api/system/file/model';
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
const useForm = Form.useForm;
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 类型 0服务 1订单
|
||||
type?: number;
|
||||
// 修改回显的数据
|
||||
data?: MpMenu | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
// 提交状态
|
||||
const loading = ref(false);
|
||||
// 是否显示最大化切换按钮
|
||||
const maxable = ref(true);
|
||||
// 表格选中数据
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
const images = ref<ItemType[]>([]);
|
||||
|
||||
// 用户信息
|
||||
const form = reactive<MpMenu>({
|
||||
menuId: undefined,
|
||||
parentId: 0,
|
||||
title: '',
|
||||
type: 2,
|
||||
isMpWeixin: true,
|
||||
path: undefined,
|
||||
component: undefined,
|
||||
target: undefined,
|
||||
icon: '',
|
||||
color: undefined,
|
||||
hide: undefined,
|
||||
position: undefined,
|
||||
active: undefined,
|
||||
userId: 0,
|
||||
home: undefined,
|
||||
sortNumber: 100,
|
||||
comments: '',
|
||||
status: 0
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
title: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写菜单名称',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
path: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写路由地址',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const chooseFile = (data: FileRecord) => {
|
||||
images.value.push({
|
||||
uid: data.id,
|
||||
url: data.thumbnail,
|
||||
status: 'done'
|
||||
});
|
||||
form.icon = data.thumbnail;
|
||||
};
|
||||
|
||||
const onDeleteItem = (index: number) => {
|
||||
images.value.splice(index, 1);
|
||||
form.icon = '';
|
||||
};
|
||||
|
||||
// 预设颜色
|
||||
const predefineColors = ref([
|
||||
'#40a9ff',
|
||||
'#9254de',
|
||||
'#36cfc9',
|
||||
'#73d13d',
|
||||
'#f759ab',
|
||||
'#cf1313',
|
||||
'#ff4d4f',
|
||||
'#ffa940',
|
||||
'#ffc53d',
|
||||
'#f3d3d3',
|
||||
'#1b1b1b',
|
||||
'#363636',
|
||||
'#4d4d4d',
|
||||
'#737373',
|
||||
'#a6a6a6',
|
||||
'#d9d9d9',
|
||||
'#e6e6e6',
|
||||
'#f2f2f2',
|
||||
'#f7f7f7',
|
||||
'#fafafa'
|
||||
]);
|
||||
|
||||
const { resetFields } = useForm(form, rules);
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
if (!formRef.value) {
|
||||
return;
|
||||
}
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
const formData = {
|
||||
...form
|
||||
};
|
||||
const saveOrUpdate = isUpdate.value ? updateMpMenu : addMpMenu;
|
||||
saveOrUpdate(formData)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
images.value = [];
|
||||
if (props.type) {
|
||||
form.type = props.type;
|
||||
}
|
||||
if (props.data) {
|
||||
assignObject(form, props.data);
|
||||
if (props.data.icon) {
|
||||
images.value.push({
|
||||
uid: uuid(),
|
||||
url: props.data.icon,
|
||||
status: 'done'
|
||||
});
|
||||
}
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
52
src/views/cms/mp-weixin/shop/components/search.vue
Normal file
52
src/views/cms/mp-weixin/shop/components/search.vue
Normal file
@@ -0,0 +1,52 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<a-space :size="10" style="flex-wrap: wrap">
|
||||
<a-button type="primary" class="ele-btn-icon" @click="add">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
<span>添加</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||
import { watch } from 'vue';
|
||||
import useSearch from '@/utils/use-search';
|
||||
import { MpMenu, MpMenuParam } from '@/api/cms/mp-menu/model';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
selection?: [];
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: MpMenuParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
(e: 'batchMove'): void;
|
||||
}>();
|
||||
|
||||
// 表单数据
|
||||
const { where } = useSearch<MpMenu>({
|
||||
type: 2
|
||||
});
|
||||
|
||||
const handleSearch = () => {
|
||||
emit('search', where);
|
||||
};
|
||||
|
||||
// 新增
|
||||
const add = () => {
|
||||
emit('add');
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
);
|
||||
</script>
|
||||
497
src/views/cms/mp-weixin/shop/components/simulator.vue
Normal file
497
src/views/cms/mp-weixin/shop/components/simulator.vue
Normal file
@@ -0,0 +1,497 @@
|
||||
<template>
|
||||
<div class="phone-layout" v-if="form">
|
||||
<div class="phone-header-black ele-fluid">
|
||||
<div class="title ele-fluid">
|
||||
<div class="title-bar">
|
||||
<span class="back"></span>
|
||||
<span>{{ form.pageName || '商城' }}</span>
|
||||
<a class="share" @click="onShare"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="phone-body" style="overflow-y: auto; overflow-x: hidden">
|
||||
<!-- 幻灯片轮播 -->
|
||||
<template v-if="form.showCarousel">
|
||||
<a-carousel arrows autoplay :dots="true">
|
||||
<template v-if="adImageList">
|
||||
<template v-for="(img, index) in adImageList" :key="index">
|
||||
<div class="ad-item">
|
||||
<a-image
|
||||
:preview="false"
|
||||
:src="img.url"
|
||||
width="100%"
|
||||
height="120px"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</a-carousel>
|
||||
</template>
|
||||
<!-- 导航菜单 -->
|
||||
<template v-if="form.showMenuCard">
|
||||
<div class="menu-card ele-cell">
|
||||
<div
|
||||
v-for="(item, index) in shopIcon"
|
||||
:key="index"
|
||||
class="ele-cell-content ele-text-center btn-center"
|
||||
@click="openMpMenuEdit(item)"
|
||||
>
|
||||
<a-image :src="item.icon" :width="30" :preview="false" />
|
||||
<span>{{ item.title }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<MpMenuEdit
|
||||
v-model:visible="showMpMenuEdit"
|
||||
:data="current"
|
||||
@done="reload"
|
||||
/>
|
||||
</template>
|
||||
<!-- 商品列表 -->
|
||||
<template v-if="form.showGoodsCard">
|
||||
<div class="goods-card-title">商品列表</div>
|
||||
<div
|
||||
class="goods-card ele-cell"
|
||||
v-for="(item, index) in goodsList"
|
||||
:key="index"
|
||||
>
|
||||
<a-image
|
||||
:src="item.image ? JSON.parse(item.image)[0] : []"
|
||||
:width="60"
|
||||
:preview="false"
|
||||
/>
|
||||
<div class="goods-info ele-cell-content">
|
||||
<div class="goods-name">{{ item.title }}</div>
|
||||
<div class="goods-price ele-text-danger ele-cell">
|
||||
<div class="ele-cell-content">¥{{ item.price }}</div>
|
||||
<a-button size="mini">去购买</a-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<a-card
|
||||
class="buy-bar"
|
||||
:bordered="false"
|
||||
:body-style="{ padding: '12px 16px' }"
|
||||
>
|
||||
<div class="ele-cell">
|
||||
<a
|
||||
class="home-btn ele-cell-content ele-text-secondary"
|
||||
@click="openUrl(`/mp-weixin/home`)"
|
||||
>
|
||||
<HomeOutlined class="icon" />
|
||||
<span>首页</span>
|
||||
</a>
|
||||
<a
|
||||
class="shop-btn ele-cell-content ele-text-secondary"
|
||||
@click="openUrl(`/mp-weixin/shop`)"
|
||||
>
|
||||
<ShopOutlined class="icon ele-text-danger" />
|
||||
<span class="ele-text-danger">商城</span>
|
||||
</a>
|
||||
<a
|
||||
class="order-btn ele-cell-content ele-text-secondary"
|
||||
@click="openUrl(`/mp-weixin/order`)"
|
||||
>
|
||||
<ProfileOutlined class="icon" />
|
||||
订单
|
||||
</a>
|
||||
<a
|
||||
class="user-btn ele-cell-content ele-text-secondary"
|
||||
@click="openUrl(`/mp-weixin/user`)"
|
||||
>
|
||||
<UserOutlined class="icon" />
|
||||
我的
|
||||
</a>
|
||||
</div>
|
||||
</a-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {
|
||||
ProfileOutlined,
|
||||
ShopOutlined,
|
||||
HomeOutlined,
|
||||
UserOutlined
|
||||
} from '@ant-design/icons-vue';
|
||||
import { ref, unref, watch } from 'vue';
|
||||
import { MpWeixinParam, WebsiteField } from '@/api/cms/website/field/model';
|
||||
import { listWebsiteField } from '@/api/system/website/field';
|
||||
import { MpMenu } from '@/api/cms/mp-menu/model';
|
||||
import { listMpMenu } from '@/api/cms/mp-menu';
|
||||
import { listAd } from '@/api/cms/ad';
|
||||
import { listMerchant } from '@/api/shop/merchant';
|
||||
import { Merchant } from '@/api/shop/merchant/model';
|
||||
import { openUrl } from '@/utils/common';
|
||||
import { useRouter } from 'vue-router';
|
||||
const { currentRoute } = useRouter();
|
||||
const { query } = unref(currentRoute);
|
||||
|
||||
import MpMenuEdit from '@/views/cms/mp-weixin/menu/components/mpMenuEdit.vue';
|
||||
import { pageGoods } from '@/api/shop/goods';
|
||||
import { Goods } from '@/api/shop/goods/model';
|
||||
|
||||
const prpos = withDefaults(
|
||||
defineProps<{
|
||||
value?: string;
|
||||
placeholder?: string;
|
||||
form?: any | null;
|
||||
type?: number;
|
||||
list?: any[] | null;
|
||||
refresh?: boolean;
|
||||
}>(),
|
||||
{
|
||||
placeholder: undefined
|
||||
}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
const param = ref<MpWeixinParam>({});
|
||||
const showUserCardEdit = ref(false);
|
||||
const showMpMenuEdit = ref(false);
|
||||
// 当前编辑数据
|
||||
const current = ref<WebsiteField | null>(null);
|
||||
|
||||
// 幻灯片广告
|
||||
const adImageList = ref<any[]>();
|
||||
// 首页导航图标
|
||||
const scrollList = ref<any[]>();
|
||||
// 订单图标
|
||||
const order = ref<any[]>();
|
||||
// 服务图标
|
||||
const server = ref<any[]>();
|
||||
// 商城导航图标
|
||||
const shopIcon = ref<any[]>();
|
||||
// 商户列表
|
||||
const shopList = ref<Merchant[]>();
|
||||
// 商品列表
|
||||
const goodsList = ref<Goods[]>();
|
||||
|
||||
const config = ref({
|
||||
selector: '#content', //容器,可使用css选择器
|
||||
branding: false,
|
||||
language: 'zh_CN', //调用放在langs文件夹内的语言包
|
||||
toolbar: false, //隐藏工具栏
|
||||
menubar: false, //隐藏菜单栏
|
||||
inline: true, //开启内联模式
|
||||
plugins: [] //选择需加载的插件
|
||||
//选中时出现的快捷工具,与插件有依赖关系
|
||||
// quickbars_selection_toolbar: 'bold italic forecolor | link blockquote quickimage',
|
||||
// init_instance_callback: function (editor) {
|
||||
// editor.setContent('这里是你的内容字符串');
|
||||
// }
|
||||
});
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openUserCard = (row?: WebsiteField) => {
|
||||
current.value = row ?? null;
|
||||
showUserCardEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openMpMenuEdit = (row?: MpMenu) => {
|
||||
current.value = row ?? null;
|
||||
showMpMenuEdit.value = true;
|
||||
};
|
||||
|
||||
const onShare = () => {};
|
||||
|
||||
const reload = () => {
|
||||
listWebsiteField({}).then((list) => {
|
||||
list.map((d) => {
|
||||
const key = String(d.name);
|
||||
param.value[key] = d.value;
|
||||
});
|
||||
});
|
||||
|
||||
listMpMenu({}).then((list) => {
|
||||
server.value = list.filter((d) => d.type == 0);
|
||||
order.value = list.filter((d) => d.type == 1);
|
||||
scrollList.value = list.filter((d) => d.type == 2);
|
||||
shopIcon.value = list.filter((d) => d.type == 3);
|
||||
});
|
||||
|
||||
listAd({ adType: '幻灯片' }).then((res) => {
|
||||
const carouselImages = res[0].images;
|
||||
if (carouselImages) {
|
||||
adImageList.value = JSON.parse(carouselImages);
|
||||
}
|
||||
});
|
||||
|
||||
listMerchant({}).then((list) => {
|
||||
shopList.value = list;
|
||||
});
|
||||
|
||||
pageGoods({}).then((res) => {
|
||||
goodsList.value = res?.list;
|
||||
});
|
||||
emit('done');
|
||||
};
|
||||
|
||||
reload();
|
||||
|
||||
watch(
|
||||
() => prpos.refresh,
|
||||
(refresh) => {
|
||||
if (refresh) {
|
||||
reload();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.phone-layout {
|
||||
position: fixed;
|
||||
right: 26px;
|
||||
width: 390px;
|
||||
height: 844px;
|
||||
background: url('@/assets/img/app-ui.png');
|
||||
background-repeat: no-repeat;
|
||||
background-position: top;
|
||||
background-size: 100%;
|
||||
//position: relative;
|
||||
padding: 0 16px;
|
||||
.phone-header-black {
|
||||
height: 99px;
|
||||
border-radius: 20px 20px 0 0;
|
||||
background-size: 100%;
|
||||
.title {
|
||||
height: 99px;
|
||||
font-size: 16px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: end;
|
||||
padding-bottom: 13px;
|
||||
|
||||
.title-bar {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.back {
|
||||
display: block;
|
||||
width: 50px;
|
||||
margin-left: 3px;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
.share {
|
||||
display: block;
|
||||
width: 50px;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.phone-body-bg {
|
||||
padding: 0 16px;
|
||||
height: 680px;
|
||||
border-radius: 0 0 44px 44px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.phone-body {
|
||||
width: 356px;
|
||||
margin-left: 17px;
|
||||
height: 630px;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
top: 98px;
|
||||
left: 0;
|
||||
z-index: 999;
|
||||
.comments {
|
||||
padding: 20px;
|
||||
word-break: break-all;
|
||||
}
|
||||
.form-data {
|
||||
padding: 10px 20px;
|
||||
.submit-btn {
|
||||
padding: 30px 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
.goods {
|
||||
.price {
|
||||
font-size: 18px;
|
||||
}
|
||||
.ele-cell-title {
|
||||
font-weight: 600;
|
||||
font-size: 16px;
|
||||
}
|
||||
.goods-attr {
|
||||
}
|
||||
}
|
||||
.goods-divider {
|
||||
height: 6px;
|
||||
}
|
||||
.buy-bar {
|
||||
position: fixed;
|
||||
width: 356px;
|
||||
bottom: 70px;
|
||||
//top: 881px;
|
||||
background-color: #ffffff;
|
||||
border-radius: 0 0 44px 44px;
|
||||
border-top: 1px solid var(--grey-8);
|
||||
.ele-cell-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.home-btn,
|
||||
.shop-btn,
|
||||
.order-btn,
|
||||
.user-btn {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
font-size: 13px;
|
||||
padding: 0 9px;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.icon {
|
||||
font-size: 19px;
|
||||
}
|
||||
.buy-btn {
|
||||
display: flex;
|
||||
.add-cart {
|
||||
border-radius: 100px 0 0 100px;
|
||||
border: none;
|
||||
background-color: var(--orange-5);
|
||||
color: #ffffff;
|
||||
height: 40px;
|
||||
width: 95px;
|
||||
}
|
||||
.buy-now {
|
||||
border-radius: 0 100px 100px 0;
|
||||
border: none;
|
||||
background-color: var(--red-6);
|
||||
color: #ffffff;
|
||||
height: 40px;
|
||||
width: 95px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
:deep(.slick-slide) {
|
||||
overflow: hidden;
|
||||
}
|
||||
:deep(.slick-arrow.custom-slick-arrow) {
|
||||
font-size: 38px;
|
||||
}
|
||||
:deep(.slick-arrow.custom-slick-arrow) {
|
||||
color: #fff;
|
||||
background-color: rgba(31, 45, 61, 0.11);
|
||||
transition: ease all 0.3s;
|
||||
opacity: 0.3;
|
||||
z-index: 1;
|
||||
}
|
||||
:deep(.slick-arrow.custom-slick-arrow:before) {
|
||||
display: none;
|
||||
}
|
||||
:deep(.slick-arrow.custom-slick-arrow:hover) {
|
||||
color: #fff;
|
||||
opacity: 0.5;
|
||||
}
|
||||
:deep(.slick-slide h3) {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.user-card {
|
||||
height: 170px;
|
||||
margin: 0 1px;
|
||||
background-color: var(--grey-10);
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
display: flex;
|
||||
.user-avatar {
|
||||
margin-left: 16px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.user-info {
|
||||
margin-left: 10px;
|
||||
.nickname {
|
||||
color: var(--grey-3);
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
}
|
||||
.phone {
|
||||
color: var(--grey-5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.menu-card {
|
||||
width: 340px;
|
||||
height: 80px;
|
||||
margin: 6px auto;
|
||||
background: #ffffff;
|
||||
border-radius: 5px;
|
||||
border-color: slategrey;
|
||||
.btn-center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
.goods-card-title {
|
||||
width: 340px;
|
||||
margin: 6px auto;
|
||||
font-size: 20px;
|
||||
font-weight: 500;
|
||||
margin-top: 16px;
|
||||
}
|
||||
.goods-card {
|
||||
width: 340px;
|
||||
max-height: 80px;
|
||||
margin: 6px auto;
|
||||
margin-bottom: 16px;
|
||||
padding: 8px;
|
||||
background: #ffffff;
|
||||
border-radius: 5px;
|
||||
border-color: slategrey;
|
||||
.goods-name {
|
||||
font-weight: 500;
|
||||
font-size: 15px;
|
||||
}
|
||||
.goods-desc {
|
||||
width: 200px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.goods-price {
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.tools-card {
|
||||
width: 340px;
|
||||
margin: 0 1px;
|
||||
padding: 6px 16px;
|
||||
background: #ffffff;
|
||||
border-radius: 5px;
|
||||
border-color: slategrey;
|
||||
position: absolute;
|
||||
top: 324px;
|
||||
left: 24px;
|
||||
.ele-cell {
|
||||
padding: 4px 0;
|
||||
border-bottom: 1px solid var(--grey-9);
|
||||
}
|
||||
.btn-center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
278
src/views/cms/mp-weixin/shop/index.vue
Normal file
278
src/views/cms/mp-weixin/shop/index.vue
Normal file
@@ -0,0 +1,278 @@
|
||||
<template>
|
||||
<a-page-header :title="title" @back="() => $router.go(-1)">
|
||||
<div class="ele-cell ele-cell-align-top">
|
||||
<!-- 设计画布 -->
|
||||
<div class="body ele-cell-content ele-bg-white" style="display: ">
|
||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="menuId"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
:customRow="customRow"
|
||||
tool-class="ele-toolbar-form"
|
||||
class="sys-org-table"
|
||||
>
|
||||
<template #toolbar>
|
||||
<search
|
||||
@search="reload"
|
||||
:selection="selection"
|
||||
@add="openEdit"
|
||||
@remove="removeBatch"
|
||||
@batchMove="openMove"
|
||||
/>
|
||||
</template>
|
||||
<template #footer>
|
||||
<div class="ele-text-secondary"
|
||||
>温馨提示:选图标可以上<a
|
||||
href="https://www.iconfont.cn"
|
||||
target="_blank"
|
||||
>阿里巴巴矢量图标库</a
|
||||
>,修改完后需要<a @click="openUrl(`/website/clear-cache`)"
|
||||
>清除缓存</a
|
||||
>才会生效</div
|
||||
>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'icon'">
|
||||
<a-avatar :src="record.icon" :width="50" />
|
||||
</template>
|
||||
<template v-if="column.key === 'path'">
|
||||
<span class="ele-text-placeholder">{{ record.path }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'component'">
|
||||
<span class="ele-text-placeholder">{{ record.component }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'status'">
|
||||
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
||||
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a @click="openEdit(record)">修改</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm
|
||||
title="确定要删除此记录吗?"
|
||||
@confirm="remove(record)"
|
||||
>
|
||||
<a class="ele-text-danger">删除</a>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</a-card>
|
||||
</div>
|
||||
<!-- 载入模拟器 -->
|
||||
<Simulator :form="form" :type="type" :refresh="refresh" @done="reload" />
|
||||
<!-- 中间间隙 -->
|
||||
<div style="width: 500px"></div>
|
||||
<!-- 编辑弹窗 -->
|
||||
<MpMenuEdit
|
||||
v-model:visible="showEdit"
|
||||
:type="type"
|
||||
:data="current"
|
||||
@done="reload"
|
||||
/>
|
||||
</div>
|
||||
</a-page-header>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref, unref, watch } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import type { EleProTable } from 'ele-admin-pro';
|
||||
import type {
|
||||
DatasourceFunction,
|
||||
ColumnItem
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import Search from './components/search.vue';
|
||||
import MpMenuEdit from './components/mpMenuEdit.vue';
|
||||
import Simulator from './components/simulator.vue';
|
||||
import {
|
||||
pageMpMenu,
|
||||
removeMpMenu,
|
||||
removeBatchMpMenu
|
||||
} from '@/api/cms/mp-menu';
|
||||
import type { MpMenu, MpMenuParam } from '@/api/cms/mp-menu/model';
|
||||
import { getPageTitle, openUrl } from '@/utils/common';
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<MpMenu[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<MpMenu | null>(null);
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
// 是否显示批量移动弹窗
|
||||
const showMove = ref(false);
|
||||
// 加载状态
|
||||
const loading = ref(true);
|
||||
// 页面标题
|
||||
const title = getPageTitle();
|
||||
const type = ref<number>(2);
|
||||
const refresh = ref(false);
|
||||
// 模拟器的字段
|
||||
const form = ref<any>({
|
||||
pageName: '商城',
|
||||
showCarousel: true,
|
||||
showMenuCard: true,
|
||||
showGoodsCard: true
|
||||
});
|
||||
// 菜单列表
|
||||
const list = ref<any[]>();
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({
|
||||
page,
|
||||
limit,
|
||||
where,
|
||||
orders,
|
||||
filters
|
||||
}) => {
|
||||
if (filters) {
|
||||
where.status = filters.status;
|
||||
}
|
||||
where.type = 3;
|
||||
return pageMpMenu({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: 'ID',
|
||||
dataIndex: 'menuId',
|
||||
key: 'menuId',
|
||||
align: 'center',
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '菜单图标',
|
||||
dataIndex: 'icon',
|
||||
key: 'icon',
|
||||
align: 'center',
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '菜单名称',
|
||||
dataIndex: 'title',
|
||||
key: 'title',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '路由地址',
|
||||
dataIndex: 'path',
|
||||
key: 'path'
|
||||
},
|
||||
{
|
||||
title: '分类ID',
|
||||
dataIndex: 'type',
|
||||
key: 'type',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '排序',
|
||||
dataIndex: 'sortNumber',
|
||||
key: 'sortNumber',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 180,
|
||||
fixed: 'right',
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
}
|
||||
]);
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: MpMenuParam) => {
|
||||
type.value = Number(where?.type) || 0;
|
||||
refresh.value = !refresh.value;
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: MpMenu) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开批量移动弹窗 */
|
||||
const openMove = () => {
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: MpMenu) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeMpMenu(row.menuId)
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
/* 批量删除 */
|
||||
const removeBatch = () => {
|
||||
if (!selection.value.length) {
|
||||
message.error('请至少选择一条数据');
|
||||
return;
|
||||
}
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要删除选中的记录吗?',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
maskClosable: true,
|
||||
onOk: () => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeBatchMpMenu(selection.value.map((d) => d.menuId))
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* 自定义行属性 */
|
||||
const customRow = (record: MpMenu) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'MpMenuShop'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
248
src/views/cms/mp-weixin/user/components/mpMenuEdit.vue
Normal file
248
src/views/cms/mp-weixin/user/components/mpMenuEdit.vue
Normal file
@@ -0,0 +1,248 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="800"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:maxable="maxable"
|
||||
:title="isUpdate ? '编辑菜单' : '添加菜单'"
|
||||
:body-style="{ paddingBottom: '28px' }"
|
||||
@update:visible="updateVisible"
|
||||
@ok="save"
|
||||
>
|
||||
<a-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||
:wrapper-col="
|
||||
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||
"
|
||||
>
|
||||
<a-form-item label="菜单名称" name="title">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入菜单名称"
|
||||
v-model:value="form.title"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="路由地址" name="path">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入路由地址"
|
||||
v-model:value="form.path"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="菜单图标" name="icon">
|
||||
<SelectFile
|
||||
:placeholder="`请选择图片`"
|
||||
:limit="1"
|
||||
:data="images"
|
||||
@done="chooseFile"
|
||||
@del="onDeleteItem"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="图标颜色" name="color">
|
||||
<ele-color-picker
|
||||
:show-alpha="true"
|
||||
v-model:value="form.color"
|
||||
:predefine="predefineColors"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="排序" name="sortNumber">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:max="9999"
|
||||
class="ele-fluid"
|
||||
placeholder="请输入排序号"
|
||||
v-model:value="form.sortNumber"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { Form, message } from 'ant-design-vue';
|
||||
import { assignObject, uuid } from 'ele-admin-pro';
|
||||
import { addMpMenu, updateMpMenu } from '@/api/cms/mp-menu';
|
||||
import { MpMenu } from '@/api/cms/mp-menu/model';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||
import { FormInstance } from 'ant-design-vue/es/form';
|
||||
import { FileRecord } from '@/api/system/file/model';
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
const useForm = Form.useForm;
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 类型 0服务 1订单
|
||||
type?: number;
|
||||
// 修改回显的数据
|
||||
data?: MpMenu | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
// 提交状态
|
||||
const loading = ref(false);
|
||||
// 是否显示最大化切换按钮
|
||||
const maxable = ref(true);
|
||||
// 表格选中数据
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
const images = ref<ItemType[]>([]);
|
||||
|
||||
// 用户信息
|
||||
const form = reactive<MpMenu>({
|
||||
menuId: undefined,
|
||||
parentId: 0,
|
||||
title: '',
|
||||
type: 2,
|
||||
isMpWeixin: true,
|
||||
path: undefined,
|
||||
component: undefined,
|
||||
target: undefined,
|
||||
icon: '',
|
||||
color: undefined,
|
||||
hide: undefined,
|
||||
position: undefined,
|
||||
active: undefined,
|
||||
userId: 0,
|
||||
home: undefined,
|
||||
sortNumber: 100,
|
||||
comments: '',
|
||||
status: 0
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
title: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写菜单名称',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
path: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写路由地址',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const chooseFile = (data: FileRecord) => {
|
||||
images.value.push({
|
||||
uid: data.id,
|
||||
url: data.thumbnail,
|
||||
status: 'done'
|
||||
});
|
||||
form.icon = data.thumbnail;
|
||||
};
|
||||
|
||||
const onDeleteItem = (index: number) => {
|
||||
images.value.splice(index, 1);
|
||||
form.icon = '';
|
||||
};
|
||||
|
||||
// 预设颜色
|
||||
const predefineColors = ref([
|
||||
'#40a9ff',
|
||||
'#9254de',
|
||||
'#36cfc9',
|
||||
'#73d13d',
|
||||
'#f759ab',
|
||||
'#cf1313',
|
||||
'#ff4d4f',
|
||||
'#ffa940',
|
||||
'#ffc53d',
|
||||
'#f3d3d3',
|
||||
'#1b1b1b',
|
||||
'#363636',
|
||||
'#4d4d4d',
|
||||
'#737373',
|
||||
'#a6a6a6',
|
||||
'#d9d9d9',
|
||||
'#e6e6e6',
|
||||
'#f2f2f2',
|
||||
'#f7f7f7',
|
||||
'#fafafa'
|
||||
]);
|
||||
|
||||
const { resetFields } = useForm(form, rules);
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
if (!formRef.value) {
|
||||
return;
|
||||
}
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
const formData = {
|
||||
...form
|
||||
};
|
||||
const saveOrUpdate = isUpdate.value ? updateMpMenu : addMpMenu;
|
||||
saveOrUpdate(formData)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
images.value = [];
|
||||
if (props.type) {
|
||||
form.type = props.type;
|
||||
}
|
||||
if (props.data) {
|
||||
assignObject(form, props.data);
|
||||
if (props.data.icon) {
|
||||
images.value.push({
|
||||
uid: uuid(),
|
||||
url: props.data.icon,
|
||||
status: 'done'
|
||||
});
|
||||
}
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
61
src/views/cms/mp-weixin/user/components/search.vue
Normal file
61
src/views/cms/mp-weixin/user/components/search.vue
Normal file
@@ -0,0 +1,61 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<a-space :size="10" style="flex-wrap: wrap">
|
||||
<a-button type="primary" class="ele-btn-icon" @click="add">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
<span>添加</span>
|
||||
</a-button>
|
||||
<a-space>
|
||||
<span class="ele-text-placeholder" style="margin-left: 20px"
|
||||
>菜单类型</span
|
||||
>
|
||||
<a-radio-group v-model:value="where.type" @change="handleSearch">
|
||||
<a-radio-button :value="0">功能图标</a-radio-button>
|
||||
<a-radio-button :value="1">订单图标</a-radio-button>
|
||||
</a-radio-group>
|
||||
</a-space>
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||
import { watch } from 'vue';
|
||||
import useSearch from '@/utils/use-search';
|
||||
import { MpMenu, MpMenuParam } from '@/api/cms/mp-menu/model';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
selection?: [];
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: MpMenuParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
(e: 'batchMove'): void;
|
||||
}>();
|
||||
|
||||
// 表单数据
|
||||
const { where } = useSearch<MpMenu>({
|
||||
type: 0
|
||||
});
|
||||
|
||||
const handleSearch = () => {
|
||||
emit('search', where);
|
||||
};
|
||||
|
||||
// 新增
|
||||
const add = () => {
|
||||
emit('add');
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
);
|
||||
</script>
|
||||
549
src/views/cms/mp-weixin/user/components/simulator.vue
Normal file
549
src/views/cms/mp-weixin/user/components/simulator.vue
Normal file
@@ -0,0 +1,549 @@
|
||||
<template>
|
||||
<div class="phone-layout" v-if="form">
|
||||
<div class="phone-header-black ele-fluid">
|
||||
<div class="title ele-fluid">
|
||||
<div class="title-bar">
|
||||
<span class="back"></span>
|
||||
<span>{{ form.pageName || '个人中心' }}</span>
|
||||
<a class="share" @click="onShare"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 会员信息卡片 -->
|
||||
<template v-if="form.showUserCard">
|
||||
<a-popover>
|
||||
<template #content> 点击更换背景 </template>
|
||||
<div
|
||||
class="user-card"
|
||||
:style="{
|
||||
backgroundImage: 'url(' + param.mp_user_top + ')'
|
||||
}"
|
||||
@click="
|
||||
openUserCard({
|
||||
name: 'mp_user_top',
|
||||
value: param.mp_user_top,
|
||||
comments: '小程序我的顶部背景图片',
|
||||
sortNumber: 100
|
||||
})
|
||||
"
|
||||
>
|
||||
<div class="user-avatar">
|
||||
<a-avatar :src="param.site_logo" :size="60" />
|
||||
<div class="user-info">
|
||||
<div class="nickname">昵称</div>
|
||||
<div class="phone">手机号码</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a-popover>
|
||||
<UserCardEdit
|
||||
v-model:visible="showUserCardEdit"
|
||||
:data="current"
|
||||
@done="reload"
|
||||
/>
|
||||
</template>
|
||||
<!-- 订单卡片 -->
|
||||
<template v-if="form.showOrderCard">
|
||||
<div class="order-card ele-cell">
|
||||
<div
|
||||
v-for="(item, index) in order"
|
||||
:key="index"
|
||||
class="ele-cell-content ele-text-center btn-center"
|
||||
@click="openMpMenuEdit(item)"
|
||||
>
|
||||
<a-image :src="item.icon" :width="30" :preview="false" />
|
||||
<span>{{ item.title }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="form.showToolsCard">
|
||||
<div class="tools-card">
|
||||
<div
|
||||
v-for="(item, index) in server"
|
||||
:key="index"
|
||||
class="ele-cell"
|
||||
@click="openMpMenuEdit(item)"
|
||||
>
|
||||
<a-avatar :src="item.icon" :size="24" />
|
||||
<div
|
||||
class="title ele-cell-content"
|
||||
:style="{ color: item.color || '#333333' }"
|
||||
>{{ item.title }}</div
|
||||
>
|
||||
<RightOutlined class="ele-text-secondary" />
|
||||
</div>
|
||||
</div>
|
||||
<MpMenuEdit
|
||||
v-model:visible="showMpMenuEdit"
|
||||
:data="current"
|
||||
@done="reload"
|
||||
/>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
<template v-if="form.showMenuCard">
|
||||
<div class="phone-body" style="overflow-y: auto; overflow-x: hidden">
|
||||
<!-- 幻灯片轮播 -->
|
||||
<template v-if="form.showCarousel">
|
||||
<a-carousel arrows autoplay :dots="true">
|
||||
<template v-if="adImageList">
|
||||
<template v-for="(img, index) in adImageList" :key="index">
|
||||
<div class="ad-item">
|
||||
<a-image
|
||||
:preview="false"
|
||||
:src="img.url"
|
||||
width="100%"
|
||||
height="200px"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</a-carousel>
|
||||
</template>
|
||||
<!-- 导航菜单 -->
|
||||
<template v-if="form.showMenuCard">
|
||||
<div class="menu-card ele-cell">
|
||||
<div
|
||||
v-for="(item, index) in scrollList"
|
||||
:key="index"
|
||||
class="ele-cell-content ele-text-center btn-center"
|
||||
@click="openMpMenuEdit(item)"
|
||||
>
|
||||
<a-image :src="item.icon" :width="30" :preview="false" />
|
||||
<span>{{ item.title }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<MpMenuEdit
|
||||
v-model:visible="showMpMenuEdit"
|
||||
:data="current"
|
||||
@done="reload"
|
||||
/>
|
||||
</template>
|
||||
<!-- 商户列表 -->
|
||||
<template v-if="form.showShopCard">
|
||||
<div class="merchant-card-title">场地预定</div>
|
||||
<div
|
||||
class="merchant-card ele-cell"
|
||||
v-for="(item, index) in shopList"
|
||||
:key="index"
|
||||
>
|
||||
<a-image :src="item.image" :width="96" :preview="false" />
|
||||
<div class="merchant-info ele-cell-content">
|
||||
<div class="merchant-name">{{ item.merchantName }}</div>
|
||||
<div class="merchant-desc ele-cell-desc">
|
||||
{{ item.comments }}
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="">-->
|
||||
<!-- <a-button>我要去</a-button>-->
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
</template>
|
||||
<!-- 培训课程 -->
|
||||
<template v-if="form.showTtrainCard">
|
||||
<div class="merchant-card-title">培训课程</div>
|
||||
<div
|
||||
class="merchant-card ele-cell"
|
||||
v-for="(item, index) in shopList"
|
||||
:key="index"
|
||||
@click="openMpMenuEdit(item)"
|
||||
>
|
||||
<a-image :src="item.image" :width="96" :preview="false" />
|
||||
<div class="merchant-info ele-cell-content">
|
||||
<div class="merchant-name">{{ item.merchantName }}</div>
|
||||
<div class="merchant-desc ele-cell-desc">
|
||||
{{ item.comments }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
<a-card
|
||||
class="buy-bar"
|
||||
:bordered="false"
|
||||
:body-style="{ padding: '12px 16px' }"
|
||||
>
|
||||
<div class="ele-cell">
|
||||
<a
|
||||
class="home-btn ele-cell-content ele-text-secondary"
|
||||
@click="openUrl(`/mp-weixin/home`)"
|
||||
>
|
||||
<HomeOutlined class="icon" />
|
||||
<span>首页</span>
|
||||
</a>
|
||||
<a
|
||||
class="shop-btn ele-cell-content ele-text-secondary"
|
||||
@click="openUrl(`/mp-weixin/shop`)"
|
||||
>
|
||||
<ShopOutlined class="icon" />
|
||||
<span>商城</span>
|
||||
</a>
|
||||
<a
|
||||
class="order-btn ele-cell-content ele-text-secondary"
|
||||
@click="openUrl(`/mp-weixin/order`)"
|
||||
>
|
||||
<ProfileOutlined class="icon" />
|
||||
<span>订单</span>
|
||||
</a>
|
||||
<a
|
||||
class="user-btn ele-cell-content ele-text-secondary"
|
||||
@click="openUrl(`/mp-weixin/user`)"
|
||||
>
|
||||
<UserOutlined class="icon ele-text-danger" />
|
||||
<span class="ele-text-danger">我的</span>
|
||||
</a>
|
||||
</div>
|
||||
</a-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {
|
||||
ProfileOutlined,
|
||||
ShopOutlined,
|
||||
HomeOutlined,
|
||||
UserOutlined, RightOutlined
|
||||
} from "@ant-design/icons-vue";
|
||||
import { ref, unref, watch } from 'vue';
|
||||
import { MpWeixinParam, WebsiteField } from '@/api/cms/website/field/model';
|
||||
import { listWebsiteField } from '@/api/system/website/field';
|
||||
import { MpMenu } from '@/api/cms/mp-menu/model';
|
||||
import { listMpMenu } from '@/api/cms/mp-menu';
|
||||
import { listAd } from '@/api/cms/ad';
|
||||
import { listMerchant } from '@/api/shop/merchant';
|
||||
import { Merchant } from '@/api/shop/merchant/model';
|
||||
import { openUrl } from '@/utils/common';
|
||||
import { useRouter } from 'vue-router';
|
||||
const { currentRoute } = useRouter();
|
||||
const { query } = unref(currentRoute);
|
||||
|
||||
import MpMenuEdit from '@/views/cms/mp-weixin/menu/components/mpMenuEdit.vue';
|
||||
import UserCardEdit from "@/views/cms/field/components/website-field-edit.vue";
|
||||
|
||||
const prpos = withDefaults(
|
||||
defineProps<{
|
||||
value?: string;
|
||||
placeholder?: string;
|
||||
form?: any | null;
|
||||
type?: number;
|
||||
list?: any[] | null;
|
||||
refresh?: boolean;
|
||||
}>(),
|
||||
{
|
||||
placeholder: undefined
|
||||
}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
const param = ref<MpWeixinParam>({});
|
||||
const showUserCardEdit = ref(false);
|
||||
const showMpMenuEdit = ref(false);
|
||||
// 当前编辑数据
|
||||
const current = ref<WebsiteField | null>(null);
|
||||
|
||||
// 幻灯片广告
|
||||
const adImageList = ref<any[]>();
|
||||
// 首页导航图标
|
||||
const scrollList = ref<any[]>();
|
||||
// 订单图标
|
||||
const order = ref<any[]>();
|
||||
// 服务图标
|
||||
const server = ref<any[]>();
|
||||
// 商户列表
|
||||
const shopList = ref<Merchant[]>();
|
||||
|
||||
const config = ref({
|
||||
selector: '#content', //容器,可使用css选择器
|
||||
branding: false,
|
||||
language: 'zh_CN', //调用放在langs文件夹内的语言包
|
||||
toolbar: false, //隐藏工具栏
|
||||
menubar: false, //隐藏菜单栏
|
||||
inline: true, //开启内联模式
|
||||
plugins: [] //选择需加载的插件
|
||||
//选中时出现的快捷工具,与插件有依赖关系
|
||||
// quickbars_selection_toolbar: 'bold italic forecolor | link blockquote quickimage',
|
||||
// init_instance_callback: function (editor) {
|
||||
// editor.setContent('这里是你的内容字符串');
|
||||
// }
|
||||
});
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openUserCard = (row?: WebsiteField) => {
|
||||
current.value = row ?? null;
|
||||
showUserCardEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openMpMenuEdit = (row?: MpMenu) => {
|
||||
current.value = row ?? null;
|
||||
showMpMenuEdit.value = true;
|
||||
};
|
||||
|
||||
const onShare = () => {};
|
||||
|
||||
const reload = () => {
|
||||
listWebsiteField({}).then((list) => {
|
||||
list.map((d) => {
|
||||
const key = String(d.name);
|
||||
param.value[key] = d.value;
|
||||
});
|
||||
});
|
||||
|
||||
listMpMenu({}).then((list) => {
|
||||
server.value = list.filter((d) => d.type == 0);
|
||||
order.value = list.filter((d) => d.type == 1);
|
||||
scrollList.value = list.filter((d) => d.type == 2);
|
||||
});
|
||||
|
||||
listAd({ adType: '幻灯片' }).then((res) => {
|
||||
const carouselImages = res[0].images;
|
||||
if (carouselImages) {
|
||||
adImageList.value = JSON.parse(carouselImages);
|
||||
}
|
||||
});
|
||||
|
||||
listMerchant({}).then((list) => {
|
||||
shopList.value = list;
|
||||
});
|
||||
emit('done');
|
||||
};
|
||||
|
||||
reload();
|
||||
|
||||
watch(
|
||||
() => prpos.refresh,
|
||||
(refresh) => {
|
||||
if (refresh) {
|
||||
reload();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.phone-layout {
|
||||
position: fixed;
|
||||
right: 16px;
|
||||
width: 390px;
|
||||
height: 844px;
|
||||
background: url('@/assets/img/app-ui.png');
|
||||
background-repeat: no-repeat;
|
||||
background-position: top;
|
||||
background-size: 100%;
|
||||
//position: relative;
|
||||
padding: 0 16px;
|
||||
.phone-header-black {
|
||||
height: 99px;
|
||||
border-radius: 20px 20px 0 0;
|
||||
background-size: 100%;
|
||||
.title {
|
||||
height: 99px;
|
||||
font-size: 16px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: end;
|
||||
padding-bottom: 13px;
|
||||
.title-bar {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.back {
|
||||
display: block;
|
||||
width: 50px;
|
||||
margin-left: 3px;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
.share {
|
||||
display: block;
|
||||
width: 50px;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.phone-body-bg {
|
||||
padding: 0 16px;
|
||||
height: 680px;
|
||||
border-radius: 0 0 44px 44px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.phone-body {
|
||||
width: 356px;
|
||||
margin-left: 17px;
|
||||
height: 630px;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
top: 98px;
|
||||
left: 0;
|
||||
z-index: 999;
|
||||
.comments {
|
||||
padding: 20px;
|
||||
word-break: break-all;
|
||||
}
|
||||
.form-data {
|
||||
padding: 10px 20px;
|
||||
.submit-btn {
|
||||
padding: 30px 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
.goods {
|
||||
.price {
|
||||
font-size: 18px;
|
||||
}
|
||||
.ele-cell-title {
|
||||
font-weight: 600;
|
||||
font-size: 16px;
|
||||
}
|
||||
.goods-attr {
|
||||
}
|
||||
}
|
||||
.goods-divider {
|
||||
height: 6px;
|
||||
}
|
||||
.buy-bar {
|
||||
position: fixed;
|
||||
width: 356px;
|
||||
bottom: 70px;
|
||||
//top: 881px;
|
||||
background-color: #ffffff;
|
||||
border-radius: 0 0 44px 44px;
|
||||
border-top: 1px solid var(--grey-8);
|
||||
.ele-cell-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.shop-btn,
|
||||
.kefu-btn,
|
||||
.star-btn {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
font-size: 13px;
|
||||
padding: 0 9px;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.icon {
|
||||
font-size: 19px;
|
||||
}
|
||||
.buy-btn {
|
||||
display: flex;
|
||||
.add-cart {
|
||||
border-radius: 100px 0 0 100px;
|
||||
border: none;
|
||||
background-color: var(--orange-5);
|
||||
color: #ffffff;
|
||||
height: 40px;
|
||||
width: 95px;
|
||||
}
|
||||
.buy-now {
|
||||
border-radius: 0 100px 100px 0;
|
||||
border: none;
|
||||
background-color: var(--red-6);
|
||||
color: #ffffff;
|
||||
height: 40px;
|
||||
width: 95px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
:deep(.slick-slide) {
|
||||
overflow: hidden;
|
||||
}
|
||||
:deep(.slick-arrow.custom-slick-arrow) {
|
||||
font-size: 38px;
|
||||
}
|
||||
:deep(.slick-arrow.custom-slick-arrow) {
|
||||
color: #fff;
|
||||
background-color: rgba(31, 45, 61, 0.11);
|
||||
transition: ease all 0.3s;
|
||||
opacity: 0.3;
|
||||
z-index: 1;
|
||||
}
|
||||
:deep(.slick-arrow.custom-slick-arrow:before) {
|
||||
display: none;
|
||||
}
|
||||
:deep(.slick-arrow.custom-slick-arrow:hover) {
|
||||
color: #fff;
|
||||
opacity: 0.5;
|
||||
}
|
||||
:deep(.slick-slide h3) {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.user-card {
|
||||
height: 170px;
|
||||
margin: 0 1px;
|
||||
background-color: var(--grey-10);
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
display: flex;
|
||||
.user-avatar {
|
||||
margin-left: 16px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
.user-info {
|
||||
margin-left: 10px;
|
||||
.nickname {
|
||||
color: var(--grey-3);
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
}
|
||||
.phone {
|
||||
color: var(--grey-5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.order-card {
|
||||
width: 340px;
|
||||
height: 80px;
|
||||
margin: 0 1px;
|
||||
background: #ffffff;
|
||||
border-radius: 5px;
|
||||
border-color: slategrey;
|
||||
position: absolute;
|
||||
top: 230px;
|
||||
left: 24px;
|
||||
.btn-center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.tools-card {
|
||||
width: 340px;
|
||||
margin: 0 1px;
|
||||
padding: 6px 16px;
|
||||
background: #ffffff;
|
||||
border-radius: 5px;
|
||||
border-color: slategrey;
|
||||
position: absolute;
|
||||
top: 324px;
|
||||
left: 24px;
|
||||
.ele-cell {
|
||||
padding: 4px 0;
|
||||
border-bottom: 1px solid var(--grey-9);
|
||||
cursor: pointer;
|
||||
}
|
||||
.btn-center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
278
src/views/cms/mp-weixin/user/index.vue
Normal file
278
src/views/cms/mp-weixin/user/index.vue
Normal file
@@ -0,0 +1,278 @@
|
||||
<template>
|
||||
<a-page-header :title="title" @back="() => $router.go(-1)">
|
||||
<div class="ele-cell ele-cell-align-top">
|
||||
<!-- 设计画布 -->
|
||||
<div class="body ele-cell-content ele-bg-white" style="display: ">
|
||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="menuId"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
:customRow="customRow"
|
||||
tool-class="ele-toolbar-form"
|
||||
class="sys-org-table"
|
||||
>
|
||||
<template #toolbar>
|
||||
<search
|
||||
@search="reload"
|
||||
:selection="selection"
|
||||
@add="openEdit"
|
||||
@remove="removeBatch"
|
||||
@batchMove="openMove"
|
||||
/>
|
||||
</template>
|
||||
<template #footer>
|
||||
<div class="ele-text-secondary"
|
||||
>温馨提示:选图标可以上<a
|
||||
href="https://www.iconfont.cn"
|
||||
target="_blank"
|
||||
>阿里巴巴矢量图标库</a
|
||||
>,修改完后需要<a @click="openUrl(`/website/clear-cache`)"
|
||||
>清除缓存</a
|
||||
>才会生效</div
|
||||
>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'icon'">
|
||||
<a-avatar :src="record.icon" :width="50" />
|
||||
</template>
|
||||
<template v-if="column.key === 'path'">
|
||||
<span class="ele-text-placeholder">{{ record.path }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'component'">
|
||||
<span class="ele-text-placeholder">{{ record.component }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'status'">
|
||||
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
||||
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a @click="openEdit(record)">修改</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm
|
||||
title="确定要删除此记录吗?"
|
||||
@confirm="remove(record)"
|
||||
>
|
||||
<a class="ele-text-danger">删除</a>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</a-card>
|
||||
</div>
|
||||
<!-- 载入模拟器 -->
|
||||
<Simulator :form="form" :type="type" :refresh="refresh" @done="reload" />
|
||||
<!-- 中间间隙 -->
|
||||
<div style="width: 500px"></div>
|
||||
<!-- 编辑弹窗 -->
|
||||
<MpMenuEdit
|
||||
v-model:visible="showEdit"
|
||||
:type="type"
|
||||
:data="current"
|
||||
@done="reload"
|
||||
/>
|
||||
</div>
|
||||
</a-page-header>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref, unref, watch } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import type { EleProTable } from 'ele-admin-pro';
|
||||
import type {
|
||||
DatasourceFunction,
|
||||
ColumnItem
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import Search from './components/search.vue';
|
||||
import MpMenuEdit from './components/mpMenuEdit.vue';
|
||||
import Simulator from './components/simulator.vue';
|
||||
import {
|
||||
pageMpMenu,
|
||||
removeMpMenu,
|
||||
removeBatchMpMenu
|
||||
} from '@/api/cms/mp-menu';
|
||||
import type { MpMenu, MpMenuParam } from '@/api/cms/mp-menu/model';
|
||||
import { getPageTitle, openUrl } from '@/utils/common';
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<MpMenu[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<MpMenu | null>(null);
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
// 是否显示批量移动弹窗
|
||||
const showMove = ref(false);
|
||||
// 加载状态
|
||||
const loading = ref(true);
|
||||
// 页面标题
|
||||
const title = getPageTitle();
|
||||
const type = ref<number>(2);
|
||||
const refresh = ref(false);
|
||||
// 模拟器的字段
|
||||
const form = ref<any>({
|
||||
pageName: '个人中心',
|
||||
showUserCard: true,
|
||||
showOrderCard: true,
|
||||
showToolsCard: true
|
||||
});
|
||||
// 菜单列表
|
||||
const list = ref<any[]>();
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({
|
||||
page,
|
||||
limit,
|
||||
where,
|
||||
orders,
|
||||
filters
|
||||
}) => {
|
||||
if (filters) {
|
||||
where.status = filters.status;
|
||||
}
|
||||
where.type = type.value;
|
||||
return pageMpMenu({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: 'ID',
|
||||
dataIndex: 'menuId',
|
||||
key: 'menuId',
|
||||
align: 'center',
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '菜单图标',
|
||||
dataIndex: 'icon',
|
||||
key: 'icon',
|
||||
align: 'center',
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '菜单名称',
|
||||
dataIndex: 'title',
|
||||
key: 'title',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '路由地址',
|
||||
dataIndex: 'path',
|
||||
key: 'path'
|
||||
},
|
||||
{
|
||||
title: '分类ID',
|
||||
dataIndex: 'type',
|
||||
key: 'type',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '排序',
|
||||
dataIndex: 'sortNumber',
|
||||
key: 'sortNumber',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 180,
|
||||
fixed: 'right',
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
}
|
||||
]);
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: MpMenuParam) => {
|
||||
type.value = Number(where?.type) || 0;
|
||||
refresh.value = !refresh.value;
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: MpMenu) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开批量移动弹窗 */
|
||||
const openMove = () => {
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: MpMenu) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeMpMenu(row.menuId)
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
/* 批量删除 */
|
||||
const removeBatch = () => {
|
||||
if (!selection.value.length) {
|
||||
message.error('请至少选择一条数据');
|
||||
return;
|
||||
}
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要删除选中的记录吗?',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
maskClosable: true,
|
||||
onOk: () => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeBatchMpMenu(selection.value.map((d) => d.menuId))
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* 自定义行属性 */
|
||||
const customRow = (record: MpMenu) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'MpMenuUser'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
@@ -273,7 +273,8 @@
|
||||
pageId: 0,
|
||||
articleCategoryId: 0,
|
||||
articleId: 0,
|
||||
pageName: ''
|
||||
pageName: '',
|
||||
isMpWeixin: false
|
||||
});
|
||||
|
||||
// 表单验证规则
|
||||
|
||||
@@ -263,6 +263,7 @@
|
||||
where = {};
|
||||
where.title = searchText.value;
|
||||
where.position = position.value;
|
||||
where.isMpWeixin = false;
|
||||
return listNavigation({ ...where });
|
||||
};
|
||||
|
||||
|
||||
@@ -556,6 +556,7 @@
|
||||
.login-input-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-repeat: no-repeat;
|
||||
|
||||
:deep(.ant-input-affix-wrapper) {
|
||||
flex: 1;
|
||||
|
||||
42
src/views/shop/wechatDeposit/components/search.vue
Normal file
42
src/views/shop/wechatDeposit/components/search.vue
Normal file
@@ -0,0 +1,42 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<a-space :size="10" style="flex-wrap: wrap">
|
||||
<a-button type="primary" class="ele-btn-icon" @click="add">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
<span>添加</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||
import type { GradeParam } from '@/api/user/grade/model';
|
||||
import { watch } from 'vue';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
selection?: [];
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: GradeParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
(e: 'batchMove'): void;
|
||||
}>();
|
||||
|
||||
// 新增
|
||||
const add = () => {
|
||||
emit('add');
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
);
|
||||
</script>
|
||||
249
src/views/shop/wechatDeposit/components/wechatDepositEdit.vue
Normal file
249
src/views/shop/wechatDeposit/components/wechatDepositEdit.vue
Normal file
@@ -0,0 +1,249 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="800"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:maxable="maxable"
|
||||
:title="isUpdate ? '编辑押金' : '添加押金'"
|
||||
:body-style="{ paddingBottom: '28px' }"
|
||||
@update:visible="updateVisible"
|
||||
@ok="save"
|
||||
>
|
||||
<a-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||
:wrapper-col="
|
||||
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||
"
|
||||
>
|
||||
<a-form-item label="订单id" name="oid">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入订单id"
|
||||
v-model:value="form.oid"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="用户id" name="uid">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入用户id"
|
||||
v-model:value="form.uid"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="场地订单号" name="orderNum">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入场地订单号"
|
||||
v-model:value="form.orderNum"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="付款订单号" name="wechatOrder">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入付款订单号"
|
||||
v-model:value="form.wechatOrder"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="退款订单号 " name="wechatReturn">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入退款订单号 "
|
||||
v-model:value="form.wechatReturn"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="场馆名称" name="siteName">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入场馆名称"
|
||||
v-model:value="form.siteName"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="微信昵称" name="username">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入微信昵称"
|
||||
v-model:value="form.username"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="手机号码" name="phone">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入手机号码"
|
||||
v-model:value="form.phone"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="物品名称" name="name">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入物品名称"
|
||||
v-model:value="form.name"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="押金金额" name="price">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入押金金额"
|
||||
v-model:value="form.price"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="押金状态,1已付款,2未付款,已退押金" name="status">
|
||||
<a-radio-group v-model:value="form.status">
|
||||
<a-radio :value="0">显示</a-radio>
|
||||
<a-radio :value="1">隐藏</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { Form, message } from 'ant-design-vue';
|
||||
import { assignObject, uuid } from 'ele-admin-pro';
|
||||
import { addWechatDeposit, updateWechatDeposit } from '@/api/shop/wechatDeposit';
|
||||
import { WechatDeposit } from '@/api/shop/wechatDeposit/model';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
|
||||
import { FormInstance } from 'ant-design-vue/es/form';
|
||||
import { FileRecord } from '@/api/system/file/model';
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
const useForm = Form.useForm;
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: WechatDeposit | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
// 提交状态
|
||||
const loading = ref(false);
|
||||
// 是否显示最大化切换按钮
|
||||
const maxable = ref(true);
|
||||
// 表格选中数据
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
const images = ref<ItemType[]>([]);
|
||||
|
||||
// 用户信息
|
||||
const form = reactive<WechatDeposit>({
|
||||
id: undefined,
|
||||
oid: undefined,
|
||||
uid: undefined,
|
||||
orderNum: undefined,
|
||||
wechatOrder: undefined,
|
||||
wechatReturn: undefined,
|
||||
siteName: undefined,
|
||||
username: undefined,
|
||||
phone: undefined,
|
||||
name: undefined,
|
||||
price: undefined,
|
||||
status: undefined,
|
||||
createTime: undefined,
|
||||
tenantId: undefined,
|
||||
wechatDepositId: undefined,
|
||||
wechatDepositName: '',
|
||||
status: 0,
|
||||
comments: '',
|
||||
sortNumber: 100
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
wechatDepositName: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写押金名称',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const chooseImage = (data: FileRecord) => {
|
||||
images.value.push({
|
||||
uid: data.id,
|
||||
url: data.path,
|
||||
status: 'done'
|
||||
});
|
||||
form.image = data.path;
|
||||
};
|
||||
|
||||
const onDeleteItem = (index: number) => {
|
||||
images.value.splice(index, 1);
|
||||
form.image = '';
|
||||
};
|
||||
|
||||
const { resetFields } = useForm(form, rules);
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
if (!formRef.value) {
|
||||
return;
|
||||
}
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
const formData = {
|
||||
...form
|
||||
};
|
||||
const saveOrUpdate = isUpdate.value ? updateWechatDeposit : addWechatDeposit;
|
||||
saveOrUpdate(formData)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
message.success(msg);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
message.error(e.message);
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
images.value = [];
|
||||
if (props.data) {
|
||||
assignObject(form, props.data);
|
||||
if(props.data.image){
|
||||
images.value.push({
|
||||
uid: uuid(),
|
||||
url: props.data.image,
|
||||
status: 'done'
|
||||
})
|
||||
}
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
281
src/views/shop/wechatDeposit/index.vue
Normal file
281
src/views/shop/wechatDeposit/index.vue
Normal file
@@ -0,0 +1,281 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<div class="ele-body">
|
||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="wechatDepositId"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
:customRow="customRow"
|
||||
tool-class="ele-toolbar-form"
|
||||
class="sys-org-table"
|
||||
>
|
||||
<template #toolbar>
|
||||
<search
|
||||
@search="reload"
|
||||
:selection="selection"
|
||||
@add="openEdit"
|
||||
@remove="removeBatch"
|
||||
@batchMove="openMove"
|
||||
/>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'image'">
|
||||
<a-image :src="record.image" :width="50" />
|
||||
</template>
|
||||
<template v-if="column.key === 'status'">
|
||||
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
|
||||
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a @click="openEdit(record)">修改</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm
|
||||
title="确定要删除此记录吗?"
|
||||
@confirm="remove(record)"
|
||||
>
|
||||
<a class="ele-text-danger">删除</a>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
</a-card>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<WechatDepositEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import type { EleProTable } from 'ele-admin-pro';
|
||||
import { toDateString } from 'ele-admin-pro';
|
||||
import type {
|
||||
DatasourceFunction,
|
||||
ColumnItem
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import Search from './components/search.vue';
|
||||
import WechatDepositEdit from './components/wechatDepositEdit.vue';
|
||||
import { pageWechatDeposit, removeWechatDeposit, removeBatchWechatDeposit } from '@/api/shop/wechatDeposit';
|
||||
import type { WechatDeposit, WechatDepositParam } from '@/api/shop/wechatDeposit/model';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<WechatDeposit[]>([]);
|
||||
// 当前编辑数据
|
||||
const current = ref<WechatDeposit | null>(null);
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
// 是否显示批量移动弹窗
|
||||
const showMove = ref(false);
|
||||
// 加载状态
|
||||
const loading = ref(true);
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({
|
||||
page,
|
||||
limit,
|
||||
where,
|
||||
orders,
|
||||
filters
|
||||
}) => {
|
||||
if (filters) {
|
||||
where.status = filters.status;
|
||||
}
|
||||
return pageWechatDeposit({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: '',
|
||||
dataIndex: 'id',
|
||||
key: 'id',
|
||||
align: 'center',
|
||||
width: 90,
|
||||
},
|
||||
{
|
||||
title: '订单id',
|
||||
dataIndex: 'oid',
|
||||
key: 'oid',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '用户id',
|
||||
dataIndex: 'uid',
|
||||
key: 'uid',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '场地订单号',
|
||||
dataIndex: 'orderNum',
|
||||
key: 'orderNum',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '付款订单号',
|
||||
dataIndex: 'wechatOrder',
|
||||
key: 'wechatOrder',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '退款订单号 ',
|
||||
dataIndex: 'wechatReturn',
|
||||
key: 'wechatReturn',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '场馆名称',
|
||||
dataIndex: 'siteName',
|
||||
key: 'siteName',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '微信昵称',
|
||||
dataIndex: 'username',
|
||||
key: 'username',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '手机号码',
|
||||
dataIndex: 'phone',
|
||||
key: 'phone',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '物品名称',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '押金金额',
|
||||
dataIndex: 'price',
|
||||
key: 'price',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '押金状态,1已付款,2未付款,已退押金',
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
ellipsis: true,
|
||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 180,
|
||||
fixed: 'right',
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
}
|
||||
]);
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: WechatDepositParam) => {
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: WechatDeposit) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开批量移动弹窗 */
|
||||
const openMove = () => {
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: WechatDeposit) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeWechatDeposit(row.wechatDepositId)
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
/* 批量删除 */
|
||||
const removeBatch = () => {
|
||||
if (!selection.value.length) {
|
||||
message.error('请至少选择一条数据');
|
||||
return;
|
||||
}
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
content: '确定要删除选中的记录吗?',
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
maskClosable: true,
|
||||
onOk: () => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeBatchWechatDeposit(selection.value.map((d) => d.wechatDepositId))
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* 查询 */
|
||||
const query = () => {
|
||||
loading.value = true;
|
||||
};
|
||||
|
||||
/* 自定义行属性 */
|
||||
const customRow = (record: WechatDeposit) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
query();
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'WechatDeposit'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
@@ -120,6 +120,14 @@
|
||||
v-model:value="form.introduction"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="管理员">
|
||||
<a-switch
|
||||
checked-children="是"
|
||||
un-checked-children="否"
|
||||
:checked="form.isAdmin == 1"
|
||||
@update:checked="updateIsAdmin"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form>
|
||||
@@ -191,6 +199,7 @@
|
||||
idCard: '',
|
||||
comments: '',
|
||||
gradeName: '',
|
||||
isAdmin: undefined,
|
||||
gradeId: undefined
|
||||
});
|
||||
|
||||
@@ -286,6 +295,10 @@
|
||||
form.gradeId = data.gradeId;
|
||||
};
|
||||
|
||||
const updateIsAdmin = (value: boolean) => {
|
||||
form.isAdmin = value ? 1 : 0;
|
||||
};
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
if (!formRef.value) {
|
||||
@@ -66,22 +66,19 @@
|
||||
</a-space>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'avatar'">
|
||||
<a-avatar
|
||||
:size="30"
|
||||
:src="`${record.avatar}`"
|
||||
style="margin-right: 4px"
|
||||
>
|
||||
<template #icon>
|
||||
<UserOutlined />
|
||||
</template>
|
||||
</a-avatar>
|
||||
</template>
|
||||
<template v-if="column.key === 'nickname'">
|
||||
<div class="user-box">
|
||||
<a-avatar
|
||||
:size="30"
|
||||
:src="`${record.avatar}`"
|
||||
style="margin-right: 4px"
|
||||
>
|
||||
<template #icon>
|
||||
<UserOutlined />
|
||||
</template>
|
||||
</a-avatar>
|
||||
<div class="user-info" @click="openEdit(record)">
|
||||
<span>{{ record.nickname }}</span>
|
||||
<!-- <span class="ele-text-placeholder">{{ record.nickname }}</span>-->
|
||||
</div>
|
||||
</div>
|
||||
<span>{{ record.nickname }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'mobile'">
|
||||
<span v-if="hasRole('superAdmin')">{{ record.phone }}</span>
|
||||
@@ -102,10 +99,10 @@
|
||||
¥{{ formatNumber(record.expendMoney) }}
|
||||
</span>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'status'">
|
||||
<template v-else-if="column.key === 'isAdmin'">
|
||||
<a-switch
|
||||
:checked="record.status === 0"
|
||||
@change="(checked: boolean) => editStatus(checked, record)"
|
||||
:checked="record.isAdmin == 1"
|
||||
@change="updateIsAdmin(record)"
|
||||
/>
|
||||
</template>
|
||||
<template v-else-if="column.key === 'action'">
|
||||
@@ -166,8 +163,8 @@
|
||||
removeUser,
|
||||
removeUsers,
|
||||
updateUserStatus,
|
||||
updateUserPassword
|
||||
} from '@/api/system/user';
|
||||
updateUserPassword, updateUser
|
||||
} from "@/api/system/user";
|
||||
import type { User, UserParam } from '@/api/system/user/model';
|
||||
import { toTreeData, uuid } from 'ele-admin-pro';
|
||||
import { listRoles } from '@/api/system/role';
|
||||
@@ -250,26 +247,33 @@
|
||||
{
|
||||
title: 'ID',
|
||||
dataIndex: 'userId',
|
||||
width: 80,
|
||||
width: 90,
|
||||
showSorterTooltip: false
|
||||
},
|
||||
{
|
||||
title: '头像',
|
||||
key: 'avatar',
|
||||
dataIndex: 'avatar',
|
||||
align: 'center',
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '用户名',
|
||||
dataIndex: 'username',
|
||||
showSorterTooltip: false
|
||||
},
|
||||
{
|
||||
title: '昵称',
|
||||
key: 'nickname',
|
||||
dataIndex: 'nickname',
|
||||
width: 240,
|
||||
title: '手机号码',
|
||||
dataIndex: 'mobile',
|
||||
align: 'center',
|
||||
key: 'mobile',
|
||||
showSorterTooltip: false
|
||||
},
|
||||
{
|
||||
title: '手机号码',
|
||||
dataIndex: 'mobile',
|
||||
key: 'mobile',
|
||||
showSorterTooltip: false
|
||||
title: '昵称',
|
||||
key: 'nickname',
|
||||
align: 'center',
|
||||
dataIndex: 'nickname'
|
||||
},
|
||||
// {
|
||||
// title: '客户分组',
|
||||
@@ -291,13 +295,6 @@
|
||||
hideInTable: true,
|
||||
showSorterTooltip: false
|
||||
},
|
||||
{
|
||||
title: '可用余额',
|
||||
dataIndex: 'balance',
|
||||
key: 'balance',
|
||||
sorter: true,
|
||||
showSorterTooltip: false
|
||||
},
|
||||
{
|
||||
title: '实际消费金额',
|
||||
dataIndex: 'expendMoney',
|
||||
@@ -316,7 +313,7 @@
|
||||
title: '注册来源',
|
||||
key: 'platform',
|
||||
dataIndex: 'platform',
|
||||
hideInTable: true,
|
||||
width: 120,
|
||||
customRender: ({ text }) => ['未知', '网站', '小程序', 'APP'][text]
|
||||
},
|
||||
{
|
||||
@@ -350,13 +347,6 @@
|
||||
hideInTable: true,
|
||||
showSorterTooltip: false
|
||||
},
|
||||
{
|
||||
title: '个人简介',
|
||||
dataIndex: 'introduction',
|
||||
key: 'introduction',
|
||||
hideInTable: true,
|
||||
showSorterTooltip: false
|
||||
},
|
||||
{
|
||||
title: '邮箱认证',
|
||||
dataIndex: 'emailVerified',
|
||||
@@ -380,9 +370,9 @@
|
||||
filters: roles.value
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
key: 'status',
|
||||
dataIndex: 'status',
|
||||
title: '管理员',
|
||||
key: 'isAdmin',
|
||||
dataIndex: 'isAdmin',
|
||||
sorter: true,
|
||||
showSorterTooltip: false,
|
||||
align: 'center'
|
||||
@@ -421,6 +411,7 @@
|
||||
where = {};
|
||||
where.roleId = filters.roles;
|
||||
where.keywords = searchText.value;
|
||||
where.isAdmin = 1;
|
||||
return pageUsers({ page, limit, ...where, ...orders });
|
||||
};
|
||||
|
||||
@@ -518,11 +509,10 @@
|
||||
};
|
||||
|
||||
/* 修改用户状态 */
|
||||
const editStatus = (checked: boolean, row: User) => {
|
||||
const status = checked ? 0 : 1;
|
||||
updateUserStatus(row.userId, status)
|
||||
const updateIsAdmin = (row: User) => {
|
||||
row.isAdmin = row.isAdmin ? 0 : 1;
|
||||
updateUser(row)
|
||||
.then((msg) => {
|
||||
row.status = status;
|
||||
message.success(msg);
|
||||
})
|
||||
.catch((e) => {
|
||||
@@ -107,8 +107,8 @@
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import useFormData from '@/utils/use-form-data';
|
||||
import OrgSelect from './org-select.vue';
|
||||
import RoleSelect from '../../user/components/role-select.vue';
|
||||
import SexSelect from '../../user/components/sex-select.vue';
|
||||
import RoleSelect from './role-select.vue';
|
||||
import SexSelect from './sex-select.vue';
|
||||
import { addUser, updateUser, checkExistence } from '@/api/system/user';
|
||||
import type { User } from '@/api/system/user/model';
|
||||
import type { Organization } from '@/api/system/organization/model';
|
||||
|
||||
Reference in New Issue
Block a user