整理商品管理模块
This commit is contained in:
@@ -10,6 +10,8 @@ export interface Mp {
|
||||
appId?: string;
|
||||
// 小程序密钥
|
||||
appSecret?: string;
|
||||
// 是否主账号
|
||||
type?: number;
|
||||
// 小程序名称
|
||||
mpName?: string;
|
||||
// 小程序简称
|
||||
|
||||
@@ -17,13 +17,16 @@ export interface Website {
|
||||
address?: string;
|
||||
phone?: string;
|
||||
email?: string;
|
||||
version?: number;
|
||||
websiteType?: string;
|
||||
expirationTime?: string;
|
||||
templateId?: string;
|
||||
industryParent?: string;
|
||||
industryChild?: string;
|
||||
companyId?: number;
|
||||
prefix?: string;
|
||||
domain?: string;
|
||||
adminUrl?: string;
|
||||
icpNo?: string;
|
||||
policeNo?: string;
|
||||
comments?: string;
|
||||
@@ -36,7 +39,7 @@ export interface Website {
|
||||
region?: string;
|
||||
appId?: number;
|
||||
fields?: WebsiteField[];
|
||||
status?: boolean;
|
||||
status?: number;
|
||||
tenantId?: number;
|
||||
tenantName?: string;
|
||||
navigations?: Navigation[];
|
||||
|
||||
@@ -3,6 +3,14 @@ import type { ApiResult, PageResult } from '@/api';
|
||||
import type { Goods, GoodsParam } from './model';
|
||||
import { MODULES_API_URL } from '@/config/setting';
|
||||
|
||||
export async function getCount() {
|
||||
const res = await request.get(MODULES_API_URL + '/shop/goods/data');
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询商品记录表
|
||||
*/
|
||||
|
||||
@@ -2,6 +2,12 @@ import type { PageParam } from '@/api';
|
||||
import { GoodsSpec } from '@/api/shop/goodsSpec/model';
|
||||
import { GoodsSku } from '@/api/shop/goodsSku/model';
|
||||
|
||||
export interface GoodsCount {
|
||||
totalNum: number;
|
||||
totalNum2: number;
|
||||
totalNum3: number;
|
||||
totalNum4: number;
|
||||
}
|
||||
/**
|
||||
* 商品记录表
|
||||
*/
|
||||
@@ -45,6 +51,7 @@ export interface Goods {
|
||||
// 推荐
|
||||
recommend?: number;
|
||||
// 状态, 0正常, 1待修,2异常已修,3异常未修
|
||||
isShow?: number;
|
||||
status?: number;
|
||||
// 备注
|
||||
comments?: string;
|
||||
@@ -58,6 +65,8 @@ export interface Goods {
|
||||
tenantId?: number;
|
||||
// 商户ID
|
||||
merchantId?: number;
|
||||
// 店铺名称
|
||||
merchantName?: string;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
// 修改时间
|
||||
@@ -80,5 +89,8 @@ export interface BathSet {
|
||||
*/
|
||||
export interface GoodsParam extends PageParam {
|
||||
goodsId?: number;
|
||||
status?: number;
|
||||
isShow?: number;
|
||||
stock?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { MerchantAccount, MerchantAccountParam } from './model';
|
||||
import { SERVER_API_URL } from '@/config/setting';
|
||||
import { MODULES_API_URL } from '@/config/setting';
|
||||
|
||||
/**
|
||||
* 分页查询商户账号
|
||||
*/
|
||||
export async function pageMerchantAccount(params: MerchantAccountParam) {
|
||||
const res = await request.get<ApiResult<PageResult<MerchantAccount>>>(
|
||||
SERVER_API_URL + '/system/merchant-account/page',
|
||||
MODULES_API_URL + '/shop/merchant-account/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
@@ -24,7 +24,7 @@ export async function pageMerchantAccount(params: MerchantAccountParam) {
|
||||
*/
|
||||
export async function listMerchantAccount(params?: MerchantAccountParam) {
|
||||
const res = await request.get<ApiResult<MerchantAccount[]>>(
|
||||
SERVER_API_URL + '/system/merchant-account',
|
||||
MODULES_API_URL + '/shop/merchant-account',
|
||||
{
|
||||
params
|
||||
}
|
||||
@@ -40,7 +40,7 @@ export async function listMerchantAccount(params?: MerchantAccountParam) {
|
||||
*/
|
||||
export async function addMerchantAccount(data: MerchantAccount) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/merchant-account',
|
||||
MODULES_API_URL + '/shop/merchant-account',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
@@ -54,7 +54,7 @@ export async function addMerchantAccount(data: MerchantAccount) {
|
||||
*/
|
||||
export async function updateMerchantAccount(data: MerchantAccount) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/merchant-account',
|
||||
MODULES_API_URL + '/shop/merchant-account',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
@@ -68,7 +68,7 @@ export async function updateMerchantAccount(data: MerchantAccount) {
|
||||
*/
|
||||
export async function removeMerchantAccount(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/merchant-account/' + id
|
||||
MODULES_API_URL + '/shop/merchant-account/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
@@ -81,7 +81,7 @@ export async function removeMerchantAccount(id?: number) {
|
||||
*/
|
||||
export async function removeBatchMerchantAccount(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/merchant-account/batch',
|
||||
MODULES_API_URL + '/shop/merchant-account/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
@@ -97,7 +97,7 @@ export async function removeBatchMerchantAccount(data: (number | undefined)[]) {
|
||||
*/
|
||||
export async function getMerchantAccount(id: number) {
|
||||
const res = await request.get<ApiResult<MerchantAccount>>(
|
||||
SERVER_API_URL + '/system/merchant-account/' + id
|
||||
MODULES_API_URL + '/shop/merchant-account/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
@@ -107,7 +107,7 @@ export async function getMerchantAccount(id: number) {
|
||||
|
||||
export async function getMerchantAccountByPhone(params?: MerchantAccountParam) {
|
||||
const res = await request.get<ApiResult<MerchantAccount>>(
|
||||
SERVER_API_URL + '/system/merchant-account/getMerchantAccountByPhone',
|
||||
MODULES_API_URL + '/shop/merchant-account/getMerchantAccountByPhone',
|
||||
{
|
||||
params
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ export interface MerchantAccount {
|
||||
roleName?: string;
|
||||
// 用户ID
|
||||
userId?: number;
|
||||
nickname?: string;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 状态
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { MerchantApply, MerchantApplyParam } from './model';
|
||||
import { SERVER_API_URL } from '@/config/setting';
|
||||
import { MODULES_API_URL } from '@/config/setting';
|
||||
|
||||
/**
|
||||
* 分页查询商户入驻申请
|
||||
*/
|
||||
export async function pageMerchantApply(params: MerchantApplyParam) {
|
||||
const res = await request.get<ApiResult<PageResult<MerchantApply>>>(
|
||||
SERVER_API_URL + '/system/merchant-apply/page',
|
||||
MODULES_API_URL + '/shop/merchant-apply/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
@@ -24,7 +24,7 @@ export async function pageMerchantApply(params: MerchantApplyParam) {
|
||||
*/
|
||||
export async function listMerchantApply(params?: MerchantApplyParam) {
|
||||
const res = await request.get<ApiResult<MerchantApply[]>>(
|
||||
SERVER_API_URL + '/system/merchant-apply',
|
||||
MODULES_API_URL + '/shop/merchant-apply',
|
||||
{
|
||||
params
|
||||
}
|
||||
@@ -40,7 +40,7 @@ export async function listMerchantApply(params?: MerchantApplyParam) {
|
||||
*/
|
||||
export async function addMerchantApply(data: MerchantApply) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/merchant-apply',
|
||||
MODULES_API_URL + '/shop/merchant-apply',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
@@ -54,7 +54,7 @@ export async function addMerchantApply(data: MerchantApply) {
|
||||
*/
|
||||
export async function updateMerchantApply(data: MerchantApply) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/merchant-apply',
|
||||
MODULES_API_URL + '/shop/merchant-apply',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
@@ -68,7 +68,7 @@ export async function updateMerchantApply(data: MerchantApply) {
|
||||
*/
|
||||
export async function removeMerchantApply(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/merchant-apply/' + id
|
||||
MODULES_API_URL + '/shop/merchant-apply/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
@@ -81,7 +81,7 @@ export async function removeMerchantApply(id?: number) {
|
||||
*/
|
||||
export async function removeBatchMerchantApply(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/merchant-apply/batch',
|
||||
MODULES_API_URL + '/shop/merchant-apply/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
@@ -97,7 +97,7 @@ export async function removeBatchMerchantApply(data: (number | undefined)[]) {
|
||||
*/
|
||||
export async function getMerchantApply(id: number) {
|
||||
const res = await request.get<ApiResult<MerchantApply>>(
|
||||
SERVER_API_URL + '/system/merchant-apply/' + id
|
||||
MODULES_API_URL + '/shop/merchant-apply/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { MerchantType, MerchantTypeParam } from './model';
|
||||
import { SERVER_API_URL } from '@/config/setting';
|
||||
import { MODULES_API_URL } from '@/config/setting';
|
||||
|
||||
/**
|
||||
* 分页查询商户类型
|
||||
*/
|
||||
export async function pageMerchantType(params: MerchantTypeParam) {
|
||||
const res = await request.get<ApiResult<PageResult<MerchantType>>>(
|
||||
SERVER_API_URL + '/system/merchant-type/page',
|
||||
MODULES_API_URL + '/shop/merchant-type/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
@@ -24,7 +24,7 @@ export async function pageMerchantType(params: MerchantTypeParam) {
|
||||
*/
|
||||
export async function listMerchantType(params?: MerchantTypeParam) {
|
||||
const res = await request.get<ApiResult<MerchantType[]>>(
|
||||
SERVER_API_URL + '/system/merchant-type',
|
||||
MODULES_API_URL + '/shop/merchant-type',
|
||||
{
|
||||
params
|
||||
}
|
||||
@@ -40,7 +40,7 @@ export async function listMerchantType(params?: MerchantTypeParam) {
|
||||
*/
|
||||
export async function addMerchantType(data: MerchantType) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/merchant-type',
|
||||
MODULES_API_URL + '/shop/merchant-type',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
@@ -54,7 +54,7 @@ export async function addMerchantType(data: MerchantType) {
|
||||
*/
|
||||
export async function updateMerchantType(data: MerchantType) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/merchant-type',
|
||||
MODULES_API_URL + '/shop/merchant-type',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
@@ -68,7 +68,7 @@ export async function updateMerchantType(data: MerchantType) {
|
||||
*/
|
||||
export async function removeMerchantType(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/merchant-type/' + id
|
||||
MODULES_API_URL + '/shop/merchant-type/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
@@ -81,7 +81,7 @@ export async function removeMerchantType(id?: number) {
|
||||
*/
|
||||
export async function removeBatchMerchantType(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/merchant-type/batch',
|
||||
MODULES_API_URL + '/shop/merchant-type/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
@@ -97,7 +97,7 @@ export async function removeBatchMerchantType(data: (number | undefined)[]) {
|
||||
*/
|
||||
export async function getMerchantType(id: number) {
|
||||
const res = await request.get<ApiResult<MerchantType>>(
|
||||
SERVER_API_URL + '/system/merchant-type/' + id
|
||||
MODULES_API_URL + '/shop/merchant-type/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { Spec, SpecParam } from './model';
|
||||
import { MODULES_API_URL } from '@/config/setting';
|
||||
|
||||
/**
|
||||
* 分页查询商品规格组记录表
|
||||
* 分页查询规格
|
||||
*/
|
||||
export async function pageSpec(params: SpecParam) {
|
||||
const res = await request.get<ApiResult<PageResult<Spec>>>(
|
||||
@@ -20,7 +20,7 @@ export async function pageSpec(params: SpecParam) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商品规格组记录表列表
|
||||
* 查询规格列表
|
||||
*/
|
||||
export async function listSpec(params?: SpecParam) {
|
||||
const res = await request.get<ApiResult<Spec[]>>(
|
||||
@@ -36,7 +36,7 @@ export async function listSpec(params?: SpecParam) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加商品规格组记录表
|
||||
* 添加规格
|
||||
*/
|
||||
export async function addSpec(data: Spec) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
@@ -50,7 +50,7 @@ export async function addSpec(data: Spec) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品规格组记录表
|
||||
* 修改规格
|
||||
*/
|
||||
export async function updateSpec(data: Spec) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
@@ -64,7 +64,7 @@ export async function updateSpec(data: Spec) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品规格组记录表
|
||||
* 删除规格
|
||||
*/
|
||||
export async function removeSpec(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
@@ -77,7 +77,7 @@ export async function removeSpec(id?: number) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除商品规格组记录表
|
||||
* 批量删除规格
|
||||
*/
|
||||
export async function removeBatchSpec(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
@@ -93,7 +93,7 @@ export async function removeBatchSpec(data: (number | undefined)[]) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询商品规格组记录表
|
||||
* 根据id查询规格
|
||||
*/
|
||||
export async function getSpec(id: number) {
|
||||
const res = await request.get<ApiResult<Spec>>(
|
||||
|
||||
@@ -1,31 +1,33 @@
|
||||
import type { PageParam } from '@/api';
|
||||
import { SpecValue } from '@/api/shop/specValue/model';
|
||||
|
||||
/**
|
||||
* 商品规格组记录表
|
||||
* 规格
|
||||
*/
|
||||
export interface Spec {
|
||||
// 规格组ID
|
||||
// 规格ID
|
||||
specId?: number;
|
||||
// 规格组名称
|
||||
// 规格名称
|
||||
specName?: string;
|
||||
// 描述
|
||||
// 规格值
|
||||
specValue?: string;
|
||||
// 创建用户
|
||||
userId?: number;
|
||||
// 更新者
|
||||
updater?: number;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 状态
|
||||
// 状态, 0正常, 1待修,2异常已修,3异常未修
|
||||
status?: number;
|
||||
// 排序
|
||||
// 排序号
|
||||
sortNumber?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 规格值
|
||||
specValues?: SpecValue[];
|
||||
key?: string;
|
||||
label?: string;
|
||||
value?: string;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品规格组记录表搜索条件
|
||||
* 规格搜索条件
|
||||
*/
|
||||
export interface SpecParam extends PageParam {
|
||||
specId?: number;
|
||||
|
||||
@@ -19,6 +19,7 @@ export interface SpecValue {
|
||||
key?: string;
|
||||
label?: string;
|
||||
value?: string;
|
||||
detail?: [string];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
<div class="phone-header-black ele-fluid">
|
||||
<div class="title ele-fluid">
|
||||
<div class="title-bar">
|
||||
<a class="back" @click="openUrl(`/mp-weixin/home`)"></a>
|
||||
<span>{{ form.pageName || '商品详情' }}</span>
|
||||
<span class="back"></span>
|
||||
<span>{{ form.title || '首页' }}</span>
|
||||
<a class="share" @click="onShare"></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<template v-if="form.showUserCard">
|
||||
<!-- 会员信息卡片 -->
|
||||
<template v-if="form.title == '我的'">
|
||||
<a-popover>
|
||||
<template #content> 点击更换背景 </template>
|
||||
<div
|
||||
@@ -41,229 +42,162 @@
|
||||
@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">
|
||||
<template #prevArrow>
|
||||
<div class="custom-slick-arrow" style="left: 20px; z-index: 1">
|
||||
<LeftCircleOutlined />
|
||||
</div>
|
||||
</template>
|
||||
<template #nextArrow>
|
||||
<div class="custom-slick-arrow" style="right: 40px">
|
||||
<RightCircleOutlined />
|
||||
</div>
|
||||
</template>
|
||||
<template v-if="form.fields">
|
||||
<template
|
||||
v-for="(img, index) in JSON.parse(form.fields)"
|
||||
<!-- 幻灯片轮播 -->
|
||||
<template v-if="form.showCarousel">
|
||||
<div
|
||||
class="ad-bar"
|
||||
:style="{
|
||||
backgroundImage: 'url(' + param.mp_user_top + ')'
|
||||
}"
|
||||
@click="onCarousel"
|
||||
>
|
||||
<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>
|
||||
</div>
|
||||
</template>
|
||||
<!-- 导航菜单 -->
|
||||
<template v-if="mpMenus">
|
||||
<!-- 单排 -->
|
||||
<div class="order-card ele-cell">
|
||||
<div
|
||||
v-for="(item, index) in mpMenus"
|
||||
:key="index"
|
||||
class="ele-cell-content ele-text-center btn-center"
|
||||
@click="openMpMenuEdit(item)"
|
||||
>
|
||||
<div class="ad-item">
|
||||
<a-image :preview="false" :src="img" width="100%" />
|
||||
<a-image :src="item.avatar" :width="40" :preview="false" />
|
||||
<span style="white-space: nowrap">{{ 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>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="ad-item">
|
||||
<a-image :preview="false" :src="form.image" width="100%" />
|
||||
</div>
|
||||
</template>
|
||||
</a-carousel>
|
||||
<a-card
|
||||
v-if="form.title"
|
||||
class="goods"
|
||||
:bordered="false"
|
||||
:body-style="{ padding: '16px' }"
|
||||
>
|
||||
<div class="ele-cell price ele-text-danger">
|
||||
<div class="ele-cell-content ele-cell">
|
||||
<span class="ele-text-danger"><sub>¥</sub></span>
|
||||
<a-statistic
|
||||
:precision="2"
|
||||
:value="`${form.price ? form.price : 0}`"
|
||||
:valueStyle="{ color: 'var(--error-color)' }"
|
||||
/>
|
||||
</div>
|
||||
<div class="ele-cell-desc">已售 {{ formatNumber(form.sales) }}</div>
|
||||
<!-- <div class="">-->
|
||||
<!-- <a-button>我要去</a-button>-->
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
<div class="ele-cell-title">{{ form.title }}</div>
|
||||
<div class="ele-cell goods-attr">
|
||||
<div class="ele-cell-content">
|
||||
<a-tag color="orange">交通银行满减</a-tag>
|
||||
<a-tag color="orange">满30减10</a-tag>
|
||||
</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>
|
||||
</a-card>
|
||||
<a-divider class="goods-divider" />
|
||||
<a-card
|
||||
class="goods"
|
||||
:bordered="false"
|
||||
:body-style="{ padding: '8px 16px' }"
|
||||
>
|
||||
<div class="ele-cell goods-attr">
|
||||
<div class="ele-text-secondary">已选择:</div>
|
||||
<div class="ele-cell-content">颜色</div>
|
||||
<div class="ele-cell-desc"><RightOutlined /></div>
|
||||
</div>
|
||||
</a-card>
|
||||
<a-divider class="goods-divider" />
|
||||
<a-card
|
||||
class="goods"
|
||||
:bordered="false"
|
||||
:body-style="{ padding: '8px 16px' }"
|
||||
>
|
||||
<div class="ele-cell goods-attr">
|
||||
<div class="ele-text-secondary">用户评价(0)</div>
|
||||
<div class="ele-cell-content"></div>
|
||||
</div>
|
||||
</a-card>
|
||||
<a-divider style="padding: 0 30px">商品详情</a-divider>
|
||||
<a-card
|
||||
class="goods"
|
||||
:bordered="false"
|
||||
:body-style="{ padding: '16px' }"
|
||||
>
|
||||
<!-- 文档内容 -->
|
||||
<tinymce-editor
|
||||
id="content"
|
||||
v-model:value="form.content"
|
||||
:disabled="true"
|
||||
:init="config"
|
||||
/>
|
||||
</a-card>
|
||||
<div class="goods-content" v-if="form.files">
|
||||
<template v-for="(img, index) in JSON.parse(form.files)" :key="index">
|
||||
<div class="ad-item">
|
||||
<a-image :preview="false" :src="img" width="100%" />
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<a-card
|
||||
class="buy-bar"
|
||||
:bordered="false"
|
||||
:body-style="{ padding: '12px 16px' }"
|
||||
>
|
||||
<div class="ele-cell">
|
||||
<div class="shop-btn ele-text-secondary">
|
||||
<ShopOutlined class="icon ele-text-danger" />
|
||||
店铺
|
||||
</div>
|
||||
<div class="kefu-btn ele-text-secondary">
|
||||
<CustomerServiceOutlined class="icon ele-text-warning" />
|
||||
客服
|
||||
</div>
|
||||
<div class="star-btn ele-text-secondary">
|
||||
<StarOutlined class="icon" />
|
||||
收藏
|
||||
</div>
|
||||
<div class="ele-cell-content buy-btn">
|
||||
<a-space :size="0">
|
||||
<a-button class="add-cart">加入购物车</a-button
|
||||
><a-button class="buy-now">立即购买</a-button>
|
||||
</a-space>
|
||||
</div>
|
||||
</div>
|
||||
</a-card>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
<a-card
|
||||
class="buy-bar"
|
||||
:bordered="false"
|
||||
v-if="form"
|
||||
:body-style="{ padding: '12px 16px' }"
|
||||
>
|
||||
<div class="ele-cell">
|
||||
<template v-for="(item, index) in tabBar" :key="index">
|
||||
<a
|
||||
class="home-btn ele-cell-content ele-text-secondary"
|
||||
@click="openUrl(`/mp-design/${item.id}`)"
|
||||
>
|
||||
<component
|
||||
v-if="item.icon"
|
||||
class="icon"
|
||||
:class="form.id === item.id ? 'ele-text-danger' : ''"
|
||||
:is="item.icon"
|
||||
/>
|
||||
<span :class="form.id === item.id ? 'ele-text-danger' : ''">{{
|
||||
item.title
|
||||
}}</span>
|
||||
</a>
|
||||
</template>
|
||||
</div>
|
||||
</a-card>
|
||||
<AdEdit v-model:visible="showAdEdit" :data="ad" @done="reload" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import {
|
||||
LeftCircleOutlined,
|
||||
RightCircleOutlined,
|
||||
RightOutlined,
|
||||
ShopOutlined,
|
||||
CustomerServiceOutlined,
|
||||
StarOutlined
|
||||
} from '@ant-design/icons-vue';
|
||||
import { formatNumber } from 'ele-admin-pro/es';
|
||||
import { ref } from 'vue';
|
||||
import { ref, watch } 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/mpDesign/components/mpMenuEdit.vue';
|
||||
import { MpMenu } from '@/api/cms/mp-menu/model';
|
||||
import { listMpMenu } from '@/api/cms/mp-menu';
|
||||
import type { MpPages } from '@/api/cms/mpPages/model';
|
||||
import { openUrl } from '@/utils/common';
|
||||
|
||||
withDefaults(
|
||||
// import MpMenuEdit from './mpMenuEdit.vue';
|
||||
import { Ad } from '@/api/cms/ad/model';
|
||||
import AdEdit from '@/views/cms/ad/components/ad-edit.vue';
|
||||
import UserCardEdit from '@/views/cms/field/components/website-field-edit.vue';
|
||||
|
||||
const prpos = withDefaults(
|
||||
defineProps<{
|
||||
value?: string;
|
||||
placeholder?: string;
|
||||
form?: any | null;
|
||||
form?: MpPages;
|
||||
tabBar?: MpPages[];
|
||||
type?: number;
|
||||
list?: any[] | null;
|
||||
mpMenus?: 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 showAdEdit = ref(false);
|
||||
const ad = ref<Ad>();
|
||||
// 当前编辑数据
|
||||
const current = ref<WebsiteField | null>(null);
|
||||
|
||||
// 订单图标
|
||||
const order = ref<any[]>();
|
||||
// 服务图标
|
||||
const server = ref<any[]>();
|
||||
|
||||
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;
|
||||
@@ -276,29 +210,41 @@
|
||||
showMpMenuEdit.value = true;
|
||||
};
|
||||
|
||||
const onShare = () => {
|
||||
const onShare = () => {};
|
||||
|
||||
}
|
||||
const onCarousel = (row?: Ad) => {
|
||||
showAdEdit.value = true;
|
||||
};
|
||||
|
||||
const reload = () => {};
|
||||
const reload = () => {
|
||||
emit('done');
|
||||
};
|
||||
|
||||
listWebsiteField({}).then((list) => {
|
||||
list.map((d) => {
|
||||
const key = String(d.name);
|
||||
param.value[key] = d.value;
|
||||
});
|
||||
});
|
||||
reload();
|
||||
|
||||
listMpMenu({}).then((list) => {
|
||||
server.value = list.filter((d) => d.type == 0);
|
||||
order.value = list.filter((d) => d.type == 1);
|
||||
});
|
||||
watch(
|
||||
() => prpos.refresh,
|
||||
(refresh) => {
|
||||
if (refresh) {
|
||||
reload();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import * as MenuIcons from '@/layout/menu-icons';
|
||||
export default {
|
||||
name: 'Simulator',
|
||||
components: MenuIcons
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.phone-layout {
|
||||
position: fixed;
|
||||
right: 16px;
|
||||
right: 26px;
|
||||
width: 390px;
|
||||
height: 844px;
|
||||
background: url('@/assets/img/app-ui.png');
|
||||
@@ -318,6 +264,7 @@
|
||||
justify-content: center;
|
||||
align-items: end;
|
||||
padding-bottom: 13px;
|
||||
|
||||
.title-bar {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
@@ -325,7 +272,8 @@
|
||||
.back {
|
||||
display: block;
|
||||
width: 50px;
|
||||
cursor: pointer;
|
||||
margin-left: 3px;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
.share {
|
||||
display: block;
|
||||
@@ -335,6 +283,11 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.ad-bar {
|
||||
background-color: var(--grey-10);
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
}
|
||||
.phone-body-bg {
|
||||
padding: 0 16px;
|
||||
height: 680px;
|
||||
@@ -389,9 +342,10 @@
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.home-btn,
|
||||
.shop-btn,
|
||||
.kefu-btn,
|
||||
.star-btn {
|
||||
.order-btn,
|
||||
.user-btn {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
font-size: 13px;
|
||||
@@ -474,20 +428,43 @@
|
||||
}
|
||||
}
|
||||
|
||||
.order-card {
|
||||
width: 340px;
|
||||
height: 80px;
|
||||
margin: 0 1px;
|
||||
background: #ffffff;
|
||||
.menu-card {
|
||||
width: 330px;
|
||||
margin: 6px auto;
|
||||
border-radius: 5px;
|
||||
border-color: slategrey;
|
||||
position: absolute;
|
||||
top: 230px;
|
||||
left: 24px;
|
||||
.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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -511,4 +488,23 @@
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
.order-card {
|
||||
width: 330px;
|
||||
height: 80px;
|
||||
margin: 0 auto;
|
||||
padding: 8px;
|
||||
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;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -128,7 +128,7 @@ export const copyText = (text) => {
|
||||
// 执行浏览器复制命令
|
||||
// 复制命令会将当前选中的内容复制到剪切板中(这里就是创建的input标签)
|
||||
// Input要在正常的编辑状态下原生复制方法才会生效
|
||||
message.success('复制成功');
|
||||
message.success(`复制成功 ${text}`);
|
||||
document.execCommand('copy');
|
||||
|
||||
// 复制成功后再将构造的标签 移除
|
||||
|
||||
@@ -44,6 +44,20 @@
|
||||
v-model:value="form.mpName"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="小程序ID" name="appId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入小程序ID"
|
||||
v-model:value="form.appId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="小程序密钥" name="appSecret">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入小程序密钥"
|
||||
v-model:value="form.appSecret"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="主体信息" name="companyName">
|
||||
<a-input
|
||||
allow-clear
|
||||
@@ -65,20 +79,6 @@
|
||||
v-model:value="form.email"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="小程序ID" name="appId">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入小程序ID"
|
||||
v-model:value="form.appId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="小程序密钥" name="appSecret">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入小程序密钥"
|
||||
v-model:value="form.appSecret"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="原始ID" name="ghId">
|
||||
<a-input
|
||||
allow-clear
|
||||
@@ -109,12 +109,6 @@
|
||||
<a-radio :value="1">未认证</a-radio>
|
||||
</a-radio-group>
|
||||
</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>
|
||||
@@ -164,11 +158,12 @@
|
||||
mpId: undefined,
|
||||
appId: undefined,
|
||||
appSecret: undefined,
|
||||
type: undefined,
|
||||
mpName: undefined,
|
||||
shortName: undefined,
|
||||
avatar: undefined,
|
||||
mpQrcode: undefined,
|
||||
authentication: undefined,
|
||||
authentication: 1,
|
||||
companyName: undefined,
|
||||
icpNo: undefined,
|
||||
email: undefined,
|
||||
@@ -189,6 +184,22 @@
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
appId: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写小程序ID',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
appSecret: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写小程序秘钥',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
mpName: [
|
||||
{
|
||||
required: true,
|
||||
|
||||
@@ -1,19 +1,34 @@
|
||||
<!-- 搜索表单 -->
|
||||
<template>
|
||||
<a-space :size="10" style="flex-wrap: wrap" v-if="count === 0">
|
||||
<a-button type="primary" class="ele-btn-icon" @click="add">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
<span>创建</span>
|
||||
</a-button>
|
||||
<a-space style="flex-wrap: wrap">
|
||||
<!-- <a-button type="primary" class="ele-btn-icon" @click="add">-->
|
||||
<!-- <template #icon>-->
|
||||
<!-- <PlusOutlined />-->
|
||||
<!-- </template>-->
|
||||
<!-- <span>添加</span>-->
|
||||
<!-- </a-button>-->
|
||||
<!-- <a-button class="ele-btn-icon" @click="openUrl(`/mp-pages`)">-->
|
||||
<!-- <span>页面管理</span>-->
|
||||
<!-- </a-button>-->
|
||||
<!-- <a-button class="ele-btn-icon" @click="openUrl(`/mp-field/0`)">-->
|
||||
<!-- <span>参数配置</span>-->
|
||||
<!-- </a-button>-->
|
||||
<!-- <a-button class="ele-btn-icon" @click="openUrl(`/mp-ad`)">-->
|
||||
<!-- <span>广告管理</span>-->
|
||||
<!-- </a-button>-->
|
||||
<!-- <a-button class="ele-btn-icon" @click="openUrl(`/mp-group`)">-->
|
||||
<!-- <span>卡片管理</span>-->
|
||||
<!-- </a-button>-->
|
||||
<!-- <a-button class="ele-btn-icon" @click="openUrl(`/mp-package`)">-->
|
||||
<!-- <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';
|
||||
import { openUrl } from '@/utils/common';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -25,13 +40,9 @@
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: GradeParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
(e: 'batchMove'): void;
|
||||
}>();
|
||||
|
||||
// 新增
|
||||
const add = () => {
|
||||
emit('add');
|
||||
};
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
:customRow="customRow"
|
||||
:need-page="false"
|
||||
tool-class="ele-toolbar-form"
|
||||
class="sys-org-table"
|
||||
>
|
||||
@@ -15,7 +16,6 @@
|
||||
<search
|
||||
@search="reload"
|
||||
:selection="selection"
|
||||
:count="count"
|
||||
@add="openEdit"
|
||||
@remove="removeBatch"
|
||||
@batchMove="openMove"
|
||||
@@ -28,13 +28,22 @@
|
||||
<template v-if="column.key === 'mpQrcode'">
|
||||
<a-image :src="record.mpQrcode" :width="50" />
|
||||
</template>
|
||||
<template v-if="column.key === 'type'">
|
||||
<a-tag v-if="record.type === 1" color="green">是</a-tag>
|
||||
<a-tag
|
||||
v-if="record.type === 0"
|
||||
@click="updateType(record)"
|
||||
class="cursor-pointer"
|
||||
>否</a-tag
|
||||
>
|
||||
</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 @click="openEdit(record)">编辑</a>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
@@ -59,7 +68,7 @@
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import Search from './components/search.vue';
|
||||
import MpEdit from './components/mpEdit.vue';
|
||||
import { pageMp, removeMp, removeBatchMp } from '@/api/cms/mp';
|
||||
import { pageMp, removeMp, removeBatchMp, updateMp } from '@/api/cms/mp';
|
||||
import type { Mp, MpParam } from '@/api/cms/mp/model';
|
||||
|
||||
// 表格实例
|
||||
@@ -67,7 +76,6 @@
|
||||
|
||||
// 表格选中数据
|
||||
const selection = ref<Mp[]>([]);
|
||||
const count = ref<number>(0);
|
||||
// 当前编辑数据
|
||||
const current = ref<Mp | null>(null);
|
||||
// 是否显示编辑弹窗
|
||||
@@ -128,11 +136,18 @@
|
||||
key: 'comments',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '主账号',
|
||||
dataIndex: 'type',
|
||||
key: 'type',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
hideInTable: true
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
@@ -146,7 +161,7 @@
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 180,
|
||||
width: 120,
|
||||
fixed: 'right',
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
@@ -170,6 +185,14 @@
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
const updateType = (row: Mp) => {
|
||||
row.type = 1;
|
||||
updateMp(row).then((msg) => {
|
||||
message.success(msg);
|
||||
reload();
|
||||
});
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: Mp) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
@@ -215,10 +238,6 @@
|
||||
/* 查询 */
|
||||
const query = () => {
|
||||
loading.value = true;
|
||||
pageMp({}).then((res) => {
|
||||
console.log(res?.count);
|
||||
count.value = res?.count;
|
||||
});
|
||||
};
|
||||
|
||||
/* 自定义行属性 */
|
||||
|
||||
@@ -132,12 +132,12 @@
|
||||
width: 280,
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: '位置',
|
||||
dataIndex: 'pageName',
|
||||
key: 'pageName',
|
||||
width: 120
|
||||
},
|
||||
// {
|
||||
// title: '位置',
|
||||
// dataIndex: 'pageName',
|
||||
// key: 'pageName',
|
||||
// width: 120
|
||||
// },
|
||||
{
|
||||
title: '描述',
|
||||
dataIndex: 'comments',
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
:customRow="customRow"
|
||||
:need-page="false"
|
||||
tool-class="ele-toolbar-form"
|
||||
class="sys-org-table"
|
||||
>
|
||||
|
||||
@@ -27,16 +27,10 @@
|
||||
<a-form-item label="值" name="value">
|
||||
<a-input allow-clear placeholder="淘宝网" v-model:value="form.value" />
|
||||
</a-form-item>
|
||||
<a-form-item label="描述" name="comments">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="网站名称"
|
||||
v-model:value="form.comments"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
label="位置"
|
||||
name="pageId"
|
||||
v-if="!pageId"
|
||||
extra="页面参数,留空视为全局参数"
|
||||
>
|
||||
<SelectMpAd
|
||||
@@ -62,6 +56,13 @@
|
||||
v-model:value="form.sortNumber"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="描述" name="comments">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="网站名称"
|
||||
v-model:value="form.comments"
|
||||
/>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</ele-modal>
|
||||
</template>
|
||||
@@ -87,6 +88,7 @@
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
mpFieldId: number | null | undefined;
|
||||
pageId: number | null | undefined;
|
||||
// 修改回显的数据
|
||||
data?: MpField | null;
|
||||
}>();
|
||||
|
||||
256
src/views/cms/mpField/index.bak.vue
Normal file
256
src/views/cms/mpField/index.bak.vue
Normal file
@@ -0,0 +1,256 @@
|
||||
<template>
|
||||
<a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
|
||||
<a-card :bordered="false">
|
||||
<div class="mp-field">
|
||||
<!-- 表格 -->
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="mpId"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
:customRow="customRow"
|
||||
tool-class="ele-toolbar-form"
|
||||
class="sys-org-table"
|
||||
>
|
||||
<template #toolbar>
|
||||
<MpFieldSearch @add="openEdit" />
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'name'">
|
||||
<div class="ele-text-heading">{{ record.name }}</div>
|
||||
<span class="ele-text-placeholder">{{ record.comments }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'pageId'">
|
||||
<span v-if="record.pageId === 0" class="ele-text-placeholder"
|
||||
>全局</span
|
||||
>
|
||||
<span v-else class="ele-text-placeholder">{{
|
||||
record.pageName
|
||||
}}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'value'">
|
||||
<a-image
|
||||
v-if="record.type === 1"
|
||||
:src="record.value"
|
||||
:width="120"
|
||||
/>
|
||||
<span v-else>{{ record.value }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a @click="copyText('{{ config.' + record.name + ' }}')">调用</a>
|
||||
<a-divider type="vertical" />
|
||||
<a @click="openEdit(record)">编辑</a>
|
||||
<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>
|
||||
<template #footer>
|
||||
<div class="ele-text-secondary"
|
||||
>温馨提示:跟随程序自动加载,通过<span v-pre
|
||||
>{{ config.mpLogo }}可以方便调用,文本内容不加密。</span
|
||||
><a
|
||||
href="https://websoft.top"
|
||||
class="ele-text-secondary"
|
||||
target="_blank"
|
||||
>查看帮助文档</a
|
||||
></div
|
||||
>
|
||||
</template>
|
||||
</ele-pro-table>
|
||||
<!-- 编辑弹窗 -->
|
||||
<MpFieldEdit
|
||||
v-model:visible="showEdit"
|
||||
:data="current"
|
||||
:pageId="pageId"
|
||||
@done="reload"
|
||||
/>
|
||||
</div>
|
||||
</a-card>
|
||||
</a-page-header>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, watch } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import type { EleProTable } from 'ele-admin-pro';
|
||||
import type { DatasourceFunction } from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import MpFieldSearch from './components/mp-field-search.vue';
|
||||
import { Mp } from '@/api/cms/mp/model';
|
||||
import MpFieldEdit from './components/mp-field-edit.vue';
|
||||
import { MpField, MpFieldParam } from '@/api/cms/mpField/model';
|
||||
import {
|
||||
pageMpField,
|
||||
removeMpField,
|
||||
undeleteMpField,
|
||||
updateMpField
|
||||
} from '@/api/cms/mpField';
|
||||
import { copyText, getPageTitle } from '@/utils/common';
|
||||
import router from '@/router';
|
||||
|
||||
const props = defineProps<{
|
||||
mpId: any;
|
||||
data: Mp;
|
||||
}>();
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
const selection = ref<any[]>();
|
||||
// 当前编辑数据
|
||||
const current = ref<MpField | null>(null);
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
const pageId = ref(0);
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
|
||||
// 搜索条件
|
||||
if (pageId.value > 0) {
|
||||
where.pageId = pageId.value;
|
||||
}
|
||||
// where.pageId = router.currentRoute.value.params.id;
|
||||
return pageMpField({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
});
|
||||
};
|
||||
|
||||
// 表格列配置
|
||||
const columns = ref<any[]>([
|
||||
{
|
||||
title: '键',
|
||||
dataIndex: 'name',
|
||||
key: 'name'
|
||||
},
|
||||
{
|
||||
title: '值',
|
||||
dataIndex: 'value',
|
||||
key: 'value'
|
||||
},
|
||||
// {
|
||||
// title: '位置',
|
||||
// dataIndex: 'pageId',
|
||||
// key: 'pageId',
|
||||
// width: 180,
|
||||
// align: 'center'
|
||||
// },
|
||||
{
|
||||
title: '排序',
|
||||
dataIndex: 'sortNumber',
|
||||
width: 120,
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 180,
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
}
|
||||
]);
|
||||
|
||||
const moveUp = (row?: MpField) => {
|
||||
updateMpField({
|
||||
id: row?.id,
|
||||
sortNumber: Number(row?.sortNumber) + 1
|
||||
}).then((msg) => {
|
||||
message.success(msg);
|
||||
reload();
|
||||
});
|
||||
};
|
||||
|
||||
/* 打开编辑弹窗 */
|
||||
const openEdit = (row?: MpField) => {
|
||||
current.value = row ?? null;
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: MpFieldParam) => {
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: MpField) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeMpField(row.id)
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
// 从回收站放回原处
|
||||
const recovery = (row: MpField) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
undeleteMpField(row.id)
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
reload();
|
||||
})
|
||||
.catch((e) => {
|
||||
hide();
|
||||
message.error(e.message);
|
||||
});
|
||||
};
|
||||
|
||||
/* 自定义行属性 */
|
||||
const customRow = (record: MpField) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
watch(
|
||||
() => router.currentRoute.value.params.id,
|
||||
(id) => {
|
||||
if (id) {
|
||||
console.log(router.currentRoute);
|
||||
if (id == ':id') {
|
||||
pageId.value = 0;
|
||||
} else {
|
||||
pageId.value = Number(id);
|
||||
}
|
||||
}
|
||||
reload();
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'MpFieldIndex'
|
||||
};
|
||||
</script>
|
||||
@@ -77,6 +77,7 @@
|
||||
<MpFieldEdit
|
||||
v-model:visible="showEdit"
|
||||
:data="current"
|
||||
:pageId="pageId"
|
||||
@done="reload"
|
||||
/>
|
||||
</div>
|
||||
@@ -100,6 +101,7 @@
|
||||
updateMpField
|
||||
} from '@/api/cms/mpField';
|
||||
import { copyText, getPageTitle } from '@/utils/common';
|
||||
import router from '@/router';
|
||||
|
||||
const props = defineProps<{
|
||||
mpId: any;
|
||||
@@ -113,10 +115,15 @@
|
||||
const current = ref<MpField | null>(null);
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
const pageId = ref(0);
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
|
||||
// 搜索条件
|
||||
if (pageId.value > 0) {
|
||||
where.pageId = pageId.value;
|
||||
}
|
||||
// where.pageId = router.currentRoute.value.params.id;
|
||||
return pageMpField({
|
||||
...where,
|
||||
...orders,
|
||||
@@ -137,13 +144,13 @@
|
||||
dataIndex: 'value',
|
||||
key: 'value'
|
||||
},
|
||||
{
|
||||
title: '位置',
|
||||
dataIndex: 'pageId',
|
||||
key: 'pageId',
|
||||
width: 180,
|
||||
align: 'center'
|
||||
},
|
||||
// {
|
||||
// title: '位置',
|
||||
// dataIndex: 'pageId',
|
||||
// key: 'pageId',
|
||||
// width: 180,
|
||||
// align: 'center'
|
||||
// },
|
||||
{
|
||||
title: '排序',
|
||||
dataIndex: 'sortNumber',
|
||||
@@ -226,11 +233,17 @@
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.mpId,
|
||||
(mpId) => {
|
||||
if (mpId) {
|
||||
reload();
|
||||
() => router.currentRoute.value.params.id,
|
||||
(id) => {
|
||||
if (id) {
|
||||
console.log(router.currentRoute);
|
||||
if (id == ':id') {
|
||||
pageId.value = 0;
|
||||
} else {
|
||||
pageId.value = Number(id);
|
||||
}
|
||||
}
|
||||
reload();
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
@@ -17,18 +17,7 @@
|
||||
<template #icon>
|
||||
<plus-outlined />
|
||||
</template>
|
||||
<span>新建</span>
|
||||
</a-button>
|
||||
<a-button
|
||||
danger
|
||||
type="primary"
|
||||
class="ele-btn-icon"
|
||||
@click="removeBatch"
|
||||
>
|
||||
<template #icon>
|
||||
<delete-outlined />
|
||||
</template>
|
||||
<span>删除</span>
|
||||
<span>添加</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
@@ -60,7 +49,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref } from 'vue';
|
||||
import { createVNode, ref, watch } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue/es';
|
||||
import {
|
||||
PlusOutlined,
|
||||
@@ -83,10 +72,12 @@
|
||||
import { DictData } from '@/api/system/dict-data/model';
|
||||
import { addDict, listDictionaries } from '@/api/system/dict';
|
||||
import { Dictionary } from '@/api/system/dictionary/model';
|
||||
import router from '@/router';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
const dictId = ref(0);
|
||||
const pageId = ref(0);
|
||||
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
@@ -214,6 +205,21 @@
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
watch(
|
||||
() => router.currentRoute.value.params.id,
|
||||
(id) => {
|
||||
if (id) {
|
||||
if (id == ':id') {
|
||||
pageId.value = 0;
|
||||
} else {
|
||||
pageId.value = Number(id);
|
||||
}
|
||||
}
|
||||
reload();
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
||||
@@ -17,24 +17,13 @@
|
||||
<template #icon>
|
||||
<plus-outlined />
|
||||
</template>
|
||||
<span>新建</span>
|
||||
</a-button>
|
||||
<a-button
|
||||
danger
|
||||
type="primary"
|
||||
class="ele-btn-icon"
|
||||
@click="removeBatch"
|
||||
>
|
||||
<template #icon>
|
||||
<delete-outlined />
|
||||
</template>
|
||||
<span>删除</span>
|
||||
<span>添加</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a-space v-if="record.dictDataName === 'package'">
|
||||
<a @click="openEdit(record)">修改</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm
|
||||
@@ -109,7 +98,6 @@
|
||||
{
|
||||
title: '备注',
|
||||
dataIndex: 'comments',
|
||||
sorter: true,
|
||||
showSorterTooltip: false
|
||||
},
|
||||
{
|
||||
@@ -215,7 +203,9 @@
|
||||
const customRow = (record: DictData) => {
|
||||
return {
|
||||
onDblclick: () => {
|
||||
openEdit(record);
|
||||
if (record.dictDataName === 'package') {
|
||||
openEdit(record);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
:customRow="customRow"
|
||||
:need-page="false"
|
||||
tool-class="ele-toolbar-form"
|
||||
class="sys-org-table"
|
||||
>
|
||||
@@ -44,6 +45,10 @@
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<!-- <a @click="openUrl(`/mp-field/${record.id}`)">配置</a>-->
|
||||
<!-- <a-divider type="vertical" />-->
|
||||
<!-- <a @click="openUrl(`/mp-group/${record.id}`)">组件</a>-->
|
||||
<!-- <a-divider type="vertical" />-->
|
||||
<a @click="openUrl(`/mp-design/${record.id}`)">设计</a>
|
||||
<a-divider type="vertical" />
|
||||
<a @click="openEdit(record)">修改</a>
|
||||
@@ -91,7 +96,8 @@
|
||||
import {
|
||||
pageMpPages,
|
||||
removeMpPages,
|
||||
removeBatchMpPages
|
||||
removeBatchMpPages,
|
||||
listMpPages
|
||||
} from '@/api/cms/mpPages';
|
||||
import type { MpPages, MpPagesParam } from '@/api/cms/mpPages/model';
|
||||
import { copyText, openUrl } from '@/utils/common';
|
||||
@@ -113,21 +119,9 @@
|
||||
const loading = ref(true);
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({
|
||||
page,
|
||||
limit,
|
||||
where,
|
||||
orders,
|
||||
filters
|
||||
}) => {
|
||||
if (filters) {
|
||||
where.status = filters.status;
|
||||
}
|
||||
return pageMpPages({
|
||||
...where,
|
||||
...orders,
|
||||
page,
|
||||
limit
|
||||
const datasource: DatasourceFunction = ({ where }) => {
|
||||
return listMpPages({
|
||||
...where
|
||||
});
|
||||
};
|
||||
|
||||
@@ -158,6 +152,7 @@
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
sorter: true,
|
||||
hideInTable: true,
|
||||
ellipsis: true,
|
||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
|
||||
},
|
||||
@@ -243,7 +238,7 @@
|
||||
onClick: () => {},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
openUrl(`/mp-design/${record.id}`);
|
||||
openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,227 +0,0 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="isUpdate ? 880 : 500"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:title="isUpdate ? '域名DNS解析验证' : '添加域名'"
|
||||
:body-style="{ paddingBottom: '28px' }"
|
||||
@update:visible="updateVisible"
|
||||
:confirmLoading="loading"
|
||||
@ok="save"
|
||||
>
|
||||
<a-form
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:label-col="styleResponsive ? { md: 5, sm: 7, xs: 24 } : { flex: '90px' }"
|
||||
:wrapper-col="
|
||||
styleResponsive ? { md: 18, sm: 19, xs: 24 } : { flex: '1' }
|
||||
"
|
||||
>
|
||||
<a-form-item label="https://" name="domain">
|
||||
<a-input
|
||||
allow-clear
|
||||
:maxlength="100"
|
||||
placeholder="example.com"
|
||||
:disabled="isUpdate"
|
||||
v-model:value="form.domain"
|
||||
@pressEnter="save"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="添加DNS解析" name="check" v-if="isUpdate">
|
||||
<a-space direction="vertical">
|
||||
<div class="ele-text-placeholder" style="line-height: 2.2em"
|
||||
>请按以下提示,在您的域名控制台添加DNS解析配置</div
|
||||
>
|
||||
<table
|
||||
class="ele-table ele-table-border ele-table-stripe ele-table-medium"
|
||||
>
|
||||
<colgroup>
|
||||
<col width="180" />
|
||||
<col width="120" />
|
||||
<col />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>主机记录</th>
|
||||
<th>记录类型</th>
|
||||
<th>记录值</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{{ form.hostName }}</td>
|
||||
<td>CNAME</td>
|
||||
<td>{{ form.hostValue }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<a-form-item label="排序" name="sortNumber">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:max="99999"
|
||||
placeholder="请输入排序号"
|
||||
v-model:value="form.sortNumber"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="操作" v-if="isUpdate && form.status == 0">
|
||||
<a-button type="primary" @click="save">验证域名</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</ele-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { message } from 'ant-design-vue';
|
||||
import { addDomain, resolvable } from '@/api/cms/domain';
|
||||
import { Domain } from '@/api/cms/domain/model';
|
||||
import { useThemeStore } from '@/store/modules/theme';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { FormInstance, type Rule } from 'ant-design-vue/es/form';
|
||||
import useFormData from '@/utils/use-form-data';
|
||||
import { isUrl } from 'ele-admin-pro';
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
// 是否开启响应式布局
|
||||
const themeStore = useThemeStore();
|
||||
const { styleResponsive } = storeToRefs(themeStore);
|
||||
|
||||
const props = defineProps<{
|
||||
// 弹窗是否打开
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: Domain | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done'): void;
|
||||
(e: 'update:visible', visible: boolean): void;
|
||||
}>();
|
||||
|
||||
// 提交状态
|
||||
const loading = ref(false);
|
||||
const disabled = ref(false);
|
||||
// 表格选中数据
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
|
||||
// 表单数据
|
||||
const { form, resetFields, assignFields } = useFormData<Domain>({
|
||||
id: undefined,
|
||||
domain: '',
|
||||
hostName: '',
|
||||
hostValue: '',
|
||||
status: 0,
|
||||
comments: '',
|
||||
sortNumber: 100
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
domain: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请输入合法域名',
|
||||
trigger: 'blur',
|
||||
validator: (_rule: Rule, value: string) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
if (!isUrl(`https://${value}`)) {
|
||||
if (value.includes('http')) {
|
||||
return reject('不含http开头');
|
||||
}
|
||||
return reject('请输入合法域名');
|
||||
}
|
||||
disabled.value = true;
|
||||
return resolve();
|
||||
});
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
/* 保存编辑 */
|
||||
const save = () => {
|
||||
if (!formRef.value) {
|
||||
return;
|
||||
}
|
||||
formRef.value
|
||||
.validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
if (form.domain) {
|
||||
form.domain = form.domain.trim();
|
||||
form.domain = form.domain.replace('https://', '');
|
||||
form.domain = form.domain.replace('http://', '');
|
||||
const split = form.domain.split('.');
|
||||
if (split.length == 2) {
|
||||
form.hostName = '@';
|
||||
}
|
||||
if (split.length > 2) {
|
||||
const suffix = split[split.length - 1];
|
||||
const name = split[split.length - 2];
|
||||
form.hostName = form.domain.replace(`.${name}.${suffix}`, '');
|
||||
}
|
||||
}
|
||||
const formData = {
|
||||
...form
|
||||
};
|
||||
if (isUpdate.value) {
|
||||
setTimeout(() => {
|
||||
resolvable(Number(form.id))
|
||||
.then((data) => {
|
||||
loading.value = false;
|
||||
message.success(data.message);
|
||||
updateVisible(false);
|
||||
emit('done');
|
||||
})
|
||||
.catch((res) => {
|
||||
loading.value = false;
|
||||
message.error(res.message);
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
if (!isUpdate.value) {
|
||||
addDomain(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) {
|
||||
if (props.data) {
|
||||
assignFields(props.data);
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
formRef.value?.clearValidate();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
@@ -1,36 +1,48 @@
|
||||
<!-- 搜索表单 -->
|
||||
<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 style="flex-wrap: wrap">
|
||||
<!-- <a-button type="primary" class="ele-btn-icon" @click="add">-->
|
||||
<!-- <template #icon>-->
|
||||
<!-- <PlusOutlined />-->
|
||||
<!-- </template>-->
|
||||
<!-- <span>添加</span>-->
|
||||
<!-- </a-button>-->
|
||||
<!-- <a-button class="ele-btn-icon" @click="openUrl(`/mp-pages`)">-->
|
||||
<!-- <span>页面管理</span>-->
|
||||
<!-- </a-button>-->
|
||||
<!-- <a-button class="ele-btn-icon" @click="openUrl(`/mp-field/0`)">-->
|
||||
<!-- <span>参数配置</span>-->
|
||||
<!-- </a-button>-->
|
||||
<!-- <a-button class="ele-btn-icon" @click="openUrl(`/mp-ad`)">-->
|
||||
<!-- <span>广告管理</span>-->
|
||||
<!-- </a-button>-->
|
||||
<!-- <a-button class="ele-btn-icon" @click="openUrl(`/mp-group`)">-->
|
||||
<!-- <span>卡片管理</span>-->
|
||||
<!-- </a-button>-->
|
||||
<!-- <a-button class="ele-btn-icon" @click="openUrl(`/mp-package`)">-->
|
||||
<!-- <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';
|
||||
import { openUrl } from '@/utils/common';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
selection?: [];
|
||||
count?: 0;
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: GradeParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
(e: 'batchMove'): void;
|
||||
}>();
|
||||
|
||||
// 新增
|
||||
const add = () => {
|
||||
emit('add');
|
||||
};
|
||||
|
||||
325
src/views/cms/website/components/websiteEdit.vue
Normal file
325
src/views/cms/website/components/websiteEdit.vue
Normal file
@@ -0,0 +1,325 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<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="Logo" name="avatar">
|
||||
<SelectFile
|
||||
:placeholder="`请选择图片`"
|
||||
:limit="1"
|
||||
:data="images"
|
||||
@done="chooseImage"
|
||||
@del="onDeleteItem"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="网站名称" name="websiteName">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入网站名称"
|
||||
v-model:value="form.websiteName"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="网站描述" name="comments">
|
||||
<a-textarea
|
||||
:rows="4"
|
||||
:maxlength="200"
|
||||
placeholder="请输入网站描述"
|
||||
v-model:value="form.comments"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="SEO关键词" name="keywords">
|
||||
<a-textarea
|
||||
:rows="4"
|
||||
:maxlength="200"
|
||||
placeholder="请输入SEO关键词"
|
||||
v-model:value="form.keywords"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="网站域名" name="domain">
|
||||
<a-input v-model:value="form.domain" placeholder="domain.com">
|
||||
<template #addonBefore>
|
||||
<a-select v-model:value="form.prefix" style="width: 90px">
|
||||
<a-select-option value="http://">http://</a-select-option>
|
||||
<a-select-option value="https://">https://</a-select-option>
|
||||
</a-select>
|
||||
</template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
<a-form-item label="后台管理" name="adminUrl">
|
||||
<a-input v-model:value="form.adminUrl" placeholder="admin.domain.com">
|
||||
<template #addonBefore>
|
||||
<a-select v-model:value="form.prefix" style="width: 90px">
|
||||
<a-select-option value="http://">http://</a-select-option>
|
||||
<a-select-option value="https://">https://</a-select-option>
|
||||
</a-select>
|
||||
</template>
|
||||
</a-input>
|
||||
</a-form-item>
|
||||
<a-form-item label="ICP备案号" name="icpNo">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入网站备案"
|
||||
v-model:value="form.icpNo"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="网站类型" name="websiteType">
|
||||
<a-select
|
||||
:options="websiteType"
|
||||
:value="form.websiteType"
|
||||
placeholder="请选择主体类型"
|
||||
@change="onWebsiteType"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="当前版本" name="version">
|
||||
<span v-if="form.version === 10">免费版</span>
|
||||
<span v-if="form.version === 20">授权版</span>
|
||||
<span v-if="form.version === 30">永久授权</span>
|
||||
</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, SelectProps } from 'ele-admin-pro';
|
||||
import { addWebsite, updateWebsite } from '@/api/cms/website';
|
||||
import { Website } from '@/api/cms/website/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?: Website | 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 websiteQrcode = ref<ItemType[]>([]);
|
||||
|
||||
// 用户信息
|
||||
const form = reactive<Website>({
|
||||
websiteId: undefined,
|
||||
websiteLogo: undefined,
|
||||
websiteName: undefined,
|
||||
keywords: '',
|
||||
prefix: '',
|
||||
domain: '',
|
||||
adminUrl: '',
|
||||
icpNo: undefined,
|
||||
email: undefined,
|
||||
version: undefined,
|
||||
websiteType: '',
|
||||
expirationTime: undefined,
|
||||
sortNumber: undefined,
|
||||
comments: undefined,
|
||||
status: undefined
|
||||
});
|
||||
|
||||
const websiteType = ref<SelectProps['options']>([
|
||||
{
|
||||
value: '企业官网',
|
||||
label: '企业官网'
|
||||
},
|
||||
{
|
||||
value: '门户网站',
|
||||
label: '门户网站'
|
||||
},
|
||||
{
|
||||
value: '电子商城',
|
||||
label: '电子商城'
|
||||
}
|
||||
]);
|
||||
|
||||
/* 更新visible */
|
||||
const updateVisible = (value: boolean) => {
|
||||
emit('update:visible', value);
|
||||
};
|
||||
|
||||
// 表单验证规则
|
||||
const rules = reactive({
|
||||
comments: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写网站描述',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
keywords: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写SEO关键词',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
domain: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写网站域名',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
adminUrl: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写网站后台管理地址',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
icpNo: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写ICP备案号',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
appSecret: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写网站秘钥',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
websiteName: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写网站信息名称',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
const chooseImage = (data: FileRecord) => {
|
||||
images.value.push({
|
||||
uid: data.id,
|
||||
url: data.path,
|
||||
status: 'done'
|
||||
});
|
||||
form.websiteLogo = data.downloadUrl;
|
||||
};
|
||||
|
||||
const onDeleteItem = (index: number) => {
|
||||
images.value.splice(index, 1);
|
||||
form.websiteLogo = '';
|
||||
};
|
||||
|
||||
const onWebsiteType = (text: string) => {
|
||||
form.websiteType = text;
|
||||
};
|
||||
|
||||
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 ? updateWebsite : addWebsite;
|
||||
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 = [];
|
||||
websiteQrcode.value = [];
|
||||
if (props.data) {
|
||||
assignObject(form, props.data);
|
||||
if (props.data.websiteLogo) {
|
||||
images.value.push({
|
||||
uid: uuid(),
|
||||
url: props.data.websiteLogo,
|
||||
status: 'done'
|
||||
});
|
||||
}
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
resetFields();
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
@@ -4,51 +4,55 @@
|
||||
<a-card :bordered="false" :body-style="{ padding: '16px' }">
|
||||
<ele-pro-table
|
||||
ref="tableRef"
|
||||
row-key="id"
|
||||
row-key="websiteId"
|
||||
:columns="columns"
|
||||
:datasource="datasource"
|
||||
:customRow="customRow"
|
||||
:need-page="false"
|
||||
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 === 'websiteName'">
|
||||
<a-space class="ele-cell">
|
||||
<a-avatar
|
||||
:src="record.websiteLogo"
|
||||
size="small"
|
||||
shape="square"
|
||||
/>
|
||||
<span class="ele-text-secondary">{{ record.websiteName }}</span>
|
||||
</a-space>
|
||||
<template v-if="column.key === 'websiteLogo'">
|
||||
<a-image :src="record.websiteLogo" :width="50" />
|
||||
</template>
|
||||
<template v-if="column.key === 'hostName'">
|
||||
<span class="ele-text-placeholder">{{ record.hostName }}</span>
|
||||
<template v-if="column.key === 'domain'">
|
||||
<a-button
|
||||
type="link"
|
||||
@click="openUrl(`${record.prefix}${record.domain}`)"
|
||||
>{{ record.domain }}</a-button
|
||||
>
|
||||
</template>
|
||||
<template v-if="column.key === 'hostType'">
|
||||
<span class="ele-text-placeholder">CNAME</span>
|
||||
<template v-if="column.key === 'type'">
|
||||
<a-tag v-if="record.type === 1" color="green">是</a-tag>
|
||||
<a-tag
|
||||
v-if="record.type === 0"
|
||||
@click="updateType(record)"
|
||||
class="cursor-pointer"
|
||||
>否</a-tag
|
||||
>
|
||||
</template>
|
||||
<template v-if="column.key === 'hostValue'">
|
||||
<span class="ele-text-placeholder">{{ record.hostValue }}</span>
|
||||
</template>
|
||||
<template v-if="column.key === 'photo'">
|
||||
<a-image :src="record.photo" />
|
||||
<template v-if="column.key === 'version'">
|
||||
<a-tag v-if="record.version === 10">免费版</a-tag>
|
||||
<a-tag v-if="record.version === 20">授权版</a-tag>
|
||||
<a-tag v-if="record.version === 30">永久授权</a-tag>
|
||||
</template>
|
||||
<template v-if="column.key === 'status'">
|
||||
<a-switch
|
||||
v-model:checked="record.status"
|
||||
@change="updateStatus(record)"
|
||||
/>
|
||||
<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-button @click="openEdit(record)" size="small">管理</a-button>
|
||||
<a-popconfirm
|
||||
title="确定要删除此域名吗?"
|
||||
:disabled="record.home == 1"
|
||||
@confirm="remove(record)"
|
||||
>
|
||||
<a-button size="small">删除</a-button>
|
||||
</a-popconfirm>
|
||||
<a-button type="primary" ghost @click="openUrl(`${record.prefix}${record.adminUrl}`)">进入后台</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</template>
|
||||
@@ -56,7 +60,7 @@
|
||||
</a-card>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<Edit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
<WebsiteEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -66,12 +70,13 @@
|
||||
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 Edit from './components/edit.vue';
|
||||
import Search from './components/search.vue';
|
||||
import WebsiteEdit from './components/websiteEdit.vue';
|
||||
import {
|
||||
pageWebsite,
|
||||
removeWebsite,
|
||||
@@ -79,9 +84,7 @@
|
||||
updateWebsite
|
||||
} from '@/api/cms/website';
|
||||
import type { Website, WebsiteParam } from '@/api/cms/website/model';
|
||||
import { openPreview } from '@/utils/common';
|
||||
import type { Payment } from '@/api/system/payment/model';
|
||||
import { updatePayment } from '@/api/system/payment';
|
||||
import { openUrl } from '@/utils/common';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
@@ -94,6 +97,8 @@
|
||||
const showEdit = ref(false);
|
||||
// 是否显示批量移动弹窗
|
||||
const showMove = ref(false);
|
||||
// 加载状态
|
||||
const loading = ref(true);
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({
|
||||
@@ -103,6 +108,9 @@
|
||||
orders,
|
||||
filters
|
||||
}) => {
|
||||
if (filters) {
|
||||
where.status = filters.status;
|
||||
}
|
||||
return pageWebsite({
|
||||
...where,
|
||||
...orders,
|
||||
@@ -116,26 +124,53 @@
|
||||
{
|
||||
title: '网站名称',
|
||||
dataIndex: 'websiteName',
|
||||
width: 240,
|
||||
key: 'websiteName'
|
||||
key: 'websiteName',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '主机类型',
|
||||
dataIndex: 'websiteType',
|
||||
align: 'center',
|
||||
key: 'websiteType'
|
||||
title: 'Logo',
|
||||
dataIndex: 'websiteLogo',
|
||||
key: 'websiteLogo',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '是否启用',
|
||||
title: '主域名',
|
||||
dataIndex: 'domain',
|
||||
key: 'domain',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '网站描述',
|
||||
dataIndex: 'comments',
|
||||
key: 'comments',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '当前版本',
|
||||
dataIndex: 'version',
|
||||
key: 'version',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
width: 120,
|
||||
key: 'status',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
align: 'center',
|
||||
key: 'status'
|
||||
sorter: true,
|
||||
ellipsis: true,
|
||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 120,
|
||||
fixed: 'right',
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
}
|
||||
@@ -158,20 +193,17 @@
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
const updateStatus = (item: Website) => {
|
||||
updateWebsite(item)
|
||||
.then((msg) => {
|
||||
message.success(msg);
|
||||
})
|
||||
.catch((msg) => {
|
||||
message.error(msg);
|
||||
});
|
||||
const updateType = (row: Website) => {
|
||||
updateWebsite(row).then((msg) => {
|
||||
message.success(msg);
|
||||
reload();
|
||||
});
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: Website) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeWebsite(row.id)
|
||||
removeWebsite(row.websiteId)
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
@@ -196,7 +228,7 @@
|
||||
maskClosable: true,
|
||||
onOk: () => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
removeBatchWebsite(selection.value.map((d) => d.id))
|
||||
removeBatchWebsite(selection.value.map((d) => d.websiteId))
|
||||
.then((msg) => {
|
||||
hide();
|
||||
message.success(msg);
|
||||
@@ -209,9 +241,32 @@
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/* 查询 */
|
||||
const query = () => {
|
||||
loading.value = true;
|
||||
};
|
||||
|
||||
/* 自定义行属性 */
|
||||
const customRow = (record: Website) => {
|
||||
return {
|
||||
// 行点击事件
|
||||
onClick: () => {
|
||||
// console.log(record);
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
query();
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export default {
|
||||
name: 'Website'
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
||||
|
||||
@@ -105,37 +105,40 @@
|
||||
dataIndex: 'brandId',
|
||||
key: 'brandId',
|
||||
align: 'center',
|
||||
width: 90,
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '品牌名称',
|
||||
dataIndex: 'brandName',
|
||||
key: 'brandName',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '图标',
|
||||
dataIndex: 'image',
|
||||
key: 'image',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
dataIndex: 'comments',
|
||||
key: 'comments',
|
||||
align: 'center',
|
||||
hideInTable: true
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
align: 'center',
|
||||
hideInTable: true
|
||||
},
|
||||
{
|
||||
title: '排序号',
|
||||
dataIndex: 'sortNumber',
|
||||
key: 'sortNumber',
|
||||
align: 'center',
|
||||
hideInTable: true
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
|
||||
@@ -23,6 +23,14 @@
|
||||
styleResponsive ? { md: 24, sm: 24, xs: 24 } : { span: 8 }
|
||||
"
|
||||
>
|
||||
<a-form-item label="选择店铺" name="merchantId" v-if="!form.merchantId">
|
||||
<SelectMerchant
|
||||
:placeholder="`选择商户`"
|
||||
class="input-item"
|
||||
v-model:value="form.merchantName"
|
||||
@done="chooseMerchantId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
label="商品类型"
|
||||
name="type"
|
||||
@@ -252,29 +260,32 @@
|
||||
<a-card title="商品参数" :bordered="false" class="goods-form" />
|
||||
|
||||
<a-card title="更多设置" :bordered="false" class="goods-form" />
|
||||
<a-card :bordered="false" class="goods-form">
|
||||
<a-button type="primary" block size="large" @click="save">保存</a-button>
|
||||
</a-card>
|
||||
|
||||
|
||||
<div class="body-bottom"></div>
|
||||
|
||||
|
||||
<a-card
|
||||
:bordered="false"
|
||||
class="goods-form"
|
||||
style="position: fixed; bottom: 0; opacity: 0.9"
|
||||
>
|
||||
<a-space :size="20">
|
||||
<!-- <div style="width: 100px">-->
|
||||
<!-- <a-button block danger size="large" @click="save"-->
|
||||
<!-- >删除</a-button-->
|
||||
<!-- >-->
|
||||
<!-- </div>-->
|
||||
<div style="width: 100px">
|
||||
<a-button block danger size="large" @click="save"
|
||||
>删除</a-button
|
||||
>
|
||||
<a-button type="primary" block size="large" @click="save">保存</a-button>
|
||||
</div>
|
||||
<div style="width: 100px">
|
||||
<a-button block size="large" @click="save">保存草稿</a-button>
|
||||
</div>
|
||||
<div style="width: 100px">
|
||||
<a-button type="primary" block size="large" @click="save"
|
||||
>上架</a-button
|
||||
>
|
||||
</div>
|
||||
</a-space>
|
||||
<!-- <div style="width: 100px">-->
|
||||
<!-- <a-button type="primary" block size="large" @click="save"-->
|
||||
<!-- >上架</a-button-->
|
||||
<!-- >-->
|
||||
<!-- </div>-->
|
||||
</a-card>
|
||||
</a-form>
|
||||
</div>
|
||||
@@ -309,6 +320,8 @@
|
||||
import {listSpec} from '@/api/shop/spec';
|
||||
import {Spec} from "@/api/shop/spec/model";
|
||||
import { getMerchantName } from "@/utils/merchant";
|
||||
import router from "@/router";
|
||||
import { Merchant } from "@/api/shop/merchant/model";
|
||||
|
||||
const { currentRoute } = useRouter();
|
||||
// 是否开启响应式布局
|
||||
@@ -368,6 +381,7 @@
|
||||
recommend: 0,
|
||||
sortNumber: undefined,
|
||||
status: undefined,
|
||||
merchantName: '',
|
||||
merchantId: getMerchantId()
|
||||
});
|
||||
const skuColumns = ref<ColumnItem[]>([
|
||||
@@ -450,6 +464,14 @@
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
merchantId: [
|
||||
{
|
||||
required: true,
|
||||
message: '请选择店铺',
|
||||
type: 'number',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
categoryId: [
|
||||
{
|
||||
required: true,
|
||||
@@ -689,6 +711,12 @@
|
||||
form.categoryChildren = value[1].label;
|
||||
}
|
||||
|
||||
/* 搜索 */
|
||||
const chooseMerchantId = (item: Merchant) => {
|
||||
form.merchantName = item.merchantName;
|
||||
form.merchantId = item.merchantId;
|
||||
};
|
||||
|
||||
const onBathSet = () => {
|
||||
skuList.value.map(d => {
|
||||
console.log(d);
|
||||
@@ -880,11 +908,13 @@
|
||||
skuList.value.map(d => {
|
||||
d.images = undefined
|
||||
})
|
||||
if(getMerchantId()){
|
||||
form.merchantId = getMerchantId();
|
||||
form.merchantName = getMerchantName();
|
||||
}
|
||||
const formData = {
|
||||
...form,
|
||||
content: content.value,
|
||||
merchantId: getMerchantId(),
|
||||
merchantName: getMerchantName(),
|
||||
image: JSON.stringify(imgList.value),
|
||||
files: JSON.stringify(fileList.value),
|
||||
goodsSpecs: specList.value,
|
||||
@@ -899,6 +929,9 @@
|
||||
category.value = []
|
||||
resetFields();
|
||||
message.success(msg);
|
||||
setTimeout(() => {
|
||||
router.go(-1)
|
||||
},1000)
|
||||
})
|
||||
.catch((e) => {
|
||||
loading.value = false;
|
||||
115
src/views/shop/goods.bak/components/search.vue
Normal file
115
src/views/shop/goods.bak/components/search.vue
Normal file
@@ -0,0 +1,115 @@
|
||||
<!-- 搜索表单 -->
|
||||
<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-radio-group v-model:value="type" @change="handleSearch">
|
||||
<a-radio-button value="出售中"
|
||||
>出售中({{ goodsCount?.totalNum }})</a-radio-button
|
||||
>
|
||||
<a-radio-button value="待上架"
|
||||
>待上架({{ goodsCount?.totalNum2 }})</a-radio-button
|
||||
>
|
||||
<a-radio-button value="已售罄"
|
||||
>已售罄({{ goodsCount?.totalNum3 }})</a-radio-button
|
||||
>
|
||||
</a-radio-group>
|
||||
<a-input-search
|
||||
allow-clear
|
||||
placeholder="请输入关键词"
|
||||
v-model:value="where.keywords"
|
||||
@pressEnter="reload"
|
||||
@search="reload"
|
||||
/>
|
||||
<a-button @click="reset">重置</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 { ref, watch } from 'vue';
|
||||
import { getCount } from '@/api/shop/goods';
|
||||
import type { GoodsCount, GoodsParam } from '@/api/shop/goods/model';
|
||||
import useSearch from '@/utils/use-search';
|
||||
import { useRouter } from 'vue-router';
|
||||
const { currentRoute } = useRouter();
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
// 选中的角色
|
||||
selection?: [];
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
|
||||
const type = ref<string>();
|
||||
// 统计数据
|
||||
const goodsCount = ref<GoodsCount>();
|
||||
|
||||
// 表单数据
|
||||
const { where, resetFields } = useSearch<GoodsParam>({
|
||||
goodsId: undefined,
|
||||
status: undefined,
|
||||
isShow: undefined,
|
||||
stock: undefined,
|
||||
keywords: ''
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: GradeParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
(e: 'batchMove'): void;
|
||||
}>();
|
||||
|
||||
// 新增
|
||||
const add = () => {
|
||||
emit('add');
|
||||
};
|
||||
|
||||
const handleSearch = (e) => {
|
||||
const text = e.target.value;
|
||||
resetFields();
|
||||
if (text === '出售中') {
|
||||
where.isShow = 1;
|
||||
}
|
||||
if (text === '待上架') {
|
||||
where.isShow = 0;
|
||||
}
|
||||
if (text === '已售罄') {
|
||||
where.stock = 0;
|
||||
}
|
||||
emit('search', where);
|
||||
};
|
||||
|
||||
const reload = () => {
|
||||
getCount().then((data: any) => {
|
||||
goodsCount.value = data;
|
||||
});
|
||||
emit('search', where);
|
||||
};
|
||||
|
||||
/* 重置 */
|
||||
const reset = () => {
|
||||
resetFields();
|
||||
type.value = '';
|
||||
reload();
|
||||
};
|
||||
|
||||
// watch(
|
||||
// () => props.selection,
|
||||
// () => {}
|
||||
// );
|
||||
watch(
|
||||
currentRoute,
|
||||
() => {
|
||||
reload();
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
@@ -32,9 +32,25 @@
|
||||
<a-image v-if="index == 0" :src="img" :width="80" />
|
||||
</template>
|
||||
</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 v-if="column.key === 'salePrice'">
|
||||
¥{{ formatNumber(record.salePrice) }}
|
||||
</template>
|
||||
<template v-if="column.key === 'isShow'">
|
||||
<a-tag
|
||||
v-if="record.isShow === 1"
|
||||
color="green"
|
||||
class="cursor-pointer"
|
||||
@click="onUpdate(record)"
|
||||
>出售中</a-tag
|
||||
>
|
||||
<a-tag
|
||||
v-if="record.isShow === 0"
|
||||
color="red"
|
||||
class="cursor-pointer"
|
||||
@click="onUpdate(record)"
|
||||
>已下架</a-tag
|
||||
>
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
@@ -69,9 +85,15 @@
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import Search from './components/search.vue';
|
||||
import GoodsEdit from './components/goodsEdit.vue';
|
||||
import { pageGoods, removeGoods, removeBatchGoods } from '@/api/shop/goods';
|
||||
import {
|
||||
pageGoods,
|
||||
removeGoods,
|
||||
removeBatchGoods,
|
||||
updateGoods
|
||||
} from '@/api/shop/goods';
|
||||
import type { Goods, GoodsParam } from '@/api/shop/goods/model';
|
||||
import { getMerchantId, openPreview, openUrl } from "@/utils/common";
|
||||
import { getMerchantId, openUrl } from '@/utils/common';
|
||||
import { formatNumber } from 'ele-admin-pro/es';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
@@ -88,16 +110,7 @@
|
||||
const loading = ref(true);
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({
|
||||
page,
|
||||
limit,
|
||||
where,
|
||||
orders,
|
||||
filters
|
||||
}) => {
|
||||
if (filters) {
|
||||
where.status = filters.status;
|
||||
}
|
||||
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
|
||||
where.merchantId = getMerchantId();
|
||||
return pageGoods({
|
||||
...where,
|
||||
@@ -114,6 +127,10 @@
|
||||
width: 90,
|
||||
dataIndex: 'goodsId'
|
||||
},
|
||||
{
|
||||
title: '店铺名称',
|
||||
dataIndex: 'merchantName'
|
||||
},
|
||||
{
|
||||
title: '封面图',
|
||||
dataIndex: 'image',
|
||||
@@ -152,10 +169,10 @@
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
dataIndex: 'isShow',
|
||||
width: 120,
|
||||
align: 'center',
|
||||
key: 'status'
|
||||
key: 'isShow'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
@@ -169,6 +186,7 @@
|
||||
|
||||
/* 搜索 */
|
||||
const reload = (where?: GoodsParam) => {
|
||||
console.log(where);
|
||||
selection.value = [];
|
||||
tableRef?.value?.reload({ where: where });
|
||||
};
|
||||
@@ -184,6 +202,14 @@
|
||||
showMove.value = true;
|
||||
};
|
||||
|
||||
const onUpdate = (row?: Goods) => {
|
||||
const isShow = row?.isShow == 0 ? 1 : 0;
|
||||
updateGoods({ ...row, isShow }).then((msg) => {
|
||||
message.success(msg);
|
||||
reload();
|
||||
});
|
||||
};
|
||||
|
||||
/* 删除单个 */
|
||||
const remove = (row: Goods) => {
|
||||
const hide = message.loading('请求中..', 0);
|
||||
@@ -1,42 +0,0 @@
|
||||
<!-- 搜索表单 -->
|
||||
<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>
|
||||
@@ -5,7 +5,19 @@
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
</template>
|
||||
<span>添加商户</span>
|
||||
<span>添加</span>
|
||||
</a-button>
|
||||
<a-button class="ele-btn-icon" @click="openUrl(`/shop/index`)">
|
||||
<span>店铺管理</span>
|
||||
</a-button>
|
||||
<a-button class="ele-btn-icon" @click="openUrl(`/shop/apply`)">
|
||||
<span>入驻申请</span>
|
||||
</a-button>
|
||||
<a-button class="ele-btn-icon" @click="openUrl(`/shop/desk`)">
|
||||
<span>桌号管理</span>
|
||||
</a-button>
|
||||
<a-button class="ele-btn-icon" @click="openUrl(`/shop/type`)">
|
||||
<span>店铺类型</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
@@ -14,6 +26,8 @@
|
||||
import { PlusOutlined } from '@ant-design/icons-vue';
|
||||
import type { GradeParam } from '@/api/user/grade/model';
|
||||
import { watch } from 'vue';
|
||||
import { openUrl } from '@/utils/common';
|
||||
import router from '@/router';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -36,7 +50,9 @@
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
() => router.currentRoute,
|
||||
(route) => {
|
||||
console.log(route,'route');
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
@@ -30,7 +30,9 @@
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a @click="openNew(record.adminUrl)">商家后台</a>
|
||||
<a @click="openUrl(`/shop/account/${record.merchantId}`)"
|
||||
>门店用户</a
|
||||
>
|
||||
<a-divider type="vertical" />
|
||||
<a @click="openEdit(record)">修改</a>
|
||||
<a-divider type="vertical" />
|
||||
@@ -64,9 +66,13 @@
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import Search from './components/search.vue';
|
||||
import MerchantEdit from './components/merchantEdit.vue';
|
||||
import { pageMerchant, removeMerchant, removeBatchMerchant } from '@/api/shop/merchant';
|
||||
import {
|
||||
pageMerchant,
|
||||
removeMerchant,
|
||||
removeBatchMerchant
|
||||
} from '@/api/shop/merchant';
|
||||
import type { Merchant, MerchantParam } from '@/api/shop/merchant/model';
|
||||
import {openNew, openPreview} from "@/utils/common";
|
||||
import { openNew, openPreview, openUrl } from '@/utils/common';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
@@ -107,49 +113,49 @@
|
||||
title: 'ID',
|
||||
dataIndex: 'merchantId',
|
||||
key: 'merchantId',
|
||||
width: 90,
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '商户名称',
|
||||
title: '店铺名称',
|
||||
dataIndex: 'merchantName',
|
||||
key: 'merchantName',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '商户图标',
|
||||
dataIndex: 'image',
|
||||
key: 'image',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '商户姓名',
|
||||
dataIndex: 'realName',
|
||||
key: 'realName',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '商户手机号',
|
||||
dataIndex: 'phone',
|
||||
key: 'phone',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '店铺类型',
|
||||
dataIndex: 'shopType',
|
||||
key: 'shopType',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '排序号',
|
||||
dataIndex: 'sortNumber',
|
||||
key: 'sortNumber',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||
"
|
||||
>
|
||||
<a-form-item label="选择商户" name="merchantId">
|
||||
<a-form-item label="选择商户" name="merchantId" v-if="!merchantId">
|
||||
<SelectMerchant
|
||||
:placeholder="`选择商户`"
|
||||
class="input-item"
|
||||
@@ -26,11 +26,18 @@
|
||||
@done="chooseMerchantId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="选择用户" name="userId" v-if="!isUpdate">
|
||||
<SelectUser
|
||||
:placeholder="`选择用户`"
|
||||
class="input-item"
|
||||
v-model:value="form.nickname"
|
||||
@done="chooseUserId"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="选择角色" name="roleId">
|
||||
<SelectRole
|
||||
:placeholder="`选择角色`"
|
||||
class="input-item"
|
||||
:type="`merchant`"
|
||||
v-model:value="form.roleName"
|
||||
@done="chooseRoleId"
|
||||
/>
|
||||
@@ -40,7 +47,7 @@
|
||||
allow-clear
|
||||
placeholder="请输入手机号码"
|
||||
maxlength="11"
|
||||
:disabled="isUpdate"
|
||||
:disabled="true"
|
||||
v-model:value="form.phone"
|
||||
/>
|
||||
</a-form-item>
|
||||
@@ -75,16 +82,20 @@
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { Form, message } from 'ant-design-vue';
|
||||
import { assignObject, uuid } from 'ele-admin-pro';
|
||||
import { addMerchantAccount, updateMerchantAccount } from '@/api/shop/merchantAccount';
|
||||
import {
|
||||
addMerchantAccount,
|
||||
updateMerchantAccount
|
||||
} from '@/api/shop/merchantAccount';
|
||||
import { MerchantAccount } from '@/api/shop/merchantAccount/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';
|
||||
import {DictData} from "@/api/system/dict-data/model";
|
||||
import {Merchant} from "@/api/shop/merchant/model";
|
||||
import {Role} from "@/api/system/role/model";
|
||||
import { DictData } from '@/api/system/dict-data/model';
|
||||
import { Merchant } from '@/api/shop/merchant/model';
|
||||
import { Role } from '@/api/system/role/model';
|
||||
import { User } from '@/api/system/user/model';
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
@@ -98,6 +109,8 @@
|
||||
visible: boolean;
|
||||
// 修改回显的数据
|
||||
data?: MerchantAccount | null;
|
||||
// 商户ID
|
||||
merchantId?: number | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -121,6 +134,7 @@
|
||||
merchantId: undefined,
|
||||
merchantName: '',
|
||||
userId: undefined,
|
||||
nickname: '',
|
||||
roleId: undefined,
|
||||
roleName: '',
|
||||
comments: undefined,
|
||||
@@ -153,11 +167,11 @@
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
roleId: [
|
||||
userId: [
|
||||
{
|
||||
required: true,
|
||||
type: 'number',
|
||||
message: '请选择角色',
|
||||
message: '请选择用户',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
@@ -184,6 +198,14 @@
|
||||
message: '请填写真实姓名',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
roleId: [
|
||||
{
|
||||
required: true,
|
||||
type: 'number',
|
||||
message: '请选择角色权限',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
@@ -193,10 +215,17 @@
|
||||
form.merchantId = item.merchantId;
|
||||
};
|
||||
|
||||
const chooseUserId = (item: User) => {
|
||||
form.userId = item.userId;
|
||||
form.nickname = item.realName ? item.realName : item.nickname;
|
||||
form.phone = item.phone;
|
||||
form.realName = item.realName;
|
||||
};
|
||||
|
||||
const chooseRoleId = (item: Role) => {
|
||||
form.roleId = item.roleId;
|
||||
form.roleName = item.roleName;
|
||||
}
|
||||
};
|
||||
|
||||
const { resetFields } = useForm(form, rules);
|
||||
|
||||
@@ -210,9 +239,14 @@
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
const formData = {
|
||||
...form
|
||||
...form,
|
||||
merchantId: Number(props.merchantId)
|
||||
? props.merchantId
|
||||
: form.merchantId
|
||||
};
|
||||
const saveOrUpdate = isUpdate.value ? updateMerchantAccount : addMerchantAccount;
|
||||
const saveOrUpdate = isUpdate.value
|
||||
? updateMerchantAccount
|
||||
: addMerchantAccount;
|
||||
saveOrUpdate(formData)
|
||||
.then((msg) => {
|
||||
loading.value = false;
|
||||
|
||||
@@ -7,13 +7,21 @@
|
||||
</template>
|
||||
<span>添加</span>
|
||||
</a-button>
|
||||
<a-input-search
|
||||
allow-clear
|
||||
placeholder="请输入关键词"
|
||||
v-model:value="where.keywords"
|
||||
@pressEnter="reload"
|
||||
@search="reload"
|
||||
/>
|
||||
</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';
|
||||
import { UserParam } from '@/api/system/user/model';
|
||||
import useSearch from '@/utils/use-search';
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
@@ -23,8 +31,15 @@
|
||||
{}
|
||||
);
|
||||
|
||||
// 表单数据
|
||||
const { where } = useSearch<UserParam>({
|
||||
userId: undefined,
|
||||
phone: undefined,
|
||||
keywords: ''
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'search', where?: GradeParam): void;
|
||||
(e: 'search', where?: UserParam): void;
|
||||
(e: 'add'): void;
|
||||
(e: 'remove'): void;
|
||||
(e: 'batchMove'): void;
|
||||
@@ -35,6 +50,10 @@
|
||||
emit('add');
|
||||
};
|
||||
|
||||
const reload = () => {
|
||||
emit('search', where);
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.selection,
|
||||
() => {}
|
||||
|
||||
@@ -30,13 +30,11 @@
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a @click="openEdit(record)">修改</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm
|
||||
title="确定要删除此记录吗?"
|
||||
title="确定要移除该门店用户吗?"
|
||||
@confirm="remove(record)"
|
||||
>
|
||||
<a class="ele-text-danger">删除</a>
|
||||
<a class="ele-text-danger">移除</a>
|
||||
</a-popconfirm>
|
||||
</a-space>
|
||||
</template>
|
||||
@@ -45,13 +43,18 @@
|
||||
</a-card>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<MerchantAccountEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
<MerchantAccountEdit
|
||||
v-model:visible="showEdit"
|
||||
:data="current"
|
||||
:merchantId="merchantId"
|
||||
@done="reload"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref } from 'vue';
|
||||
import { createVNode, ref, watch } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
|
||||
import type { EleProTable } from 'ele-admin-pro';
|
||||
@@ -62,8 +65,16 @@
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import Search from './components/search.vue';
|
||||
import MerchantAccountEdit from './components/merchantAccountEdit.vue';
|
||||
import { pageMerchantAccount, removeMerchantAccount, removeBatchMerchantAccount } from '@/api/shop/merchantAccount';
|
||||
import type { MerchantAccount, MerchantAccountParam } from '@/api/shop/merchantAccount/model';
|
||||
import {
|
||||
pageMerchantAccount,
|
||||
removeMerchantAccount,
|
||||
removeBatchMerchantAccount
|
||||
} from '@/api/shop/merchantAccount';
|
||||
import type {
|
||||
MerchantAccount,
|
||||
MerchantAccountParam
|
||||
} from '@/api/shop/merchantAccount/model';
|
||||
import router from '@/router';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
@@ -78,6 +89,8 @@
|
||||
const showMove = ref(false);
|
||||
// 加载状态
|
||||
const loading = ref(true);
|
||||
// 门店ID
|
||||
const merchantId = ref(0);
|
||||
|
||||
// 表格数据源
|
||||
const datasource: DatasourceFunction = ({
|
||||
@@ -90,6 +103,10 @@
|
||||
if (filters) {
|
||||
where.status = filters.status;
|
||||
}
|
||||
if (merchantId.value > 0) {
|
||||
where.merchantId = merchantId.value;
|
||||
}
|
||||
console.log('>>>>>>>>', merchantId.value);
|
||||
return pageMerchantAccount({
|
||||
...where,
|
||||
...orders,
|
||||
@@ -101,35 +118,41 @@
|
||||
// 表格列配置
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: 'ID',
|
||||
dataIndex: 'id',
|
||||
key: 'id',
|
||||
title: '用户ID',
|
||||
dataIndex: 'userId',
|
||||
key: 'userId',
|
||||
align: 'center',
|
||||
width: 90,
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '店铺名称',
|
||||
dataIndex: 'merchantName',
|
||||
key: 'merchantName',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '账号',
|
||||
dataIndex: 'phone',
|
||||
key: 'phone',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '真实姓名',
|
||||
dataIndex: 'realName',
|
||||
key: 'realName',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '角色',
|
||||
dataIndex: 'roleName',
|
||||
key: 'roleName',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
dataIndex: 'comments',
|
||||
key: 'comments',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
@@ -202,7 +225,9 @@
|
||||
|
||||
/* 查询 */
|
||||
const query = () => {
|
||||
console.log('query()', merchantId.value);
|
||||
loading.value = true;
|
||||
reload();
|
||||
};
|
||||
|
||||
/* 自定义行属性 */
|
||||
@@ -218,7 +243,21 @@
|
||||
}
|
||||
};
|
||||
};
|
||||
query();
|
||||
|
||||
watch(
|
||||
() => router.currentRoute.value.params.id,
|
||||
(id) => {
|
||||
if (id) {
|
||||
if (id == ':id') {
|
||||
merchantId.value = 0;
|
||||
} else {
|
||||
merchantId.value = Number(id);
|
||||
}
|
||||
}
|
||||
query();
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
|
||||
@@ -11,6 +11,15 @@
|
||||
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" />
|
||||
@@ -21,8 +30,11 @@
|
||||
</template>
|
||||
<template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
<a-button :size="`small`" @click="openEdit(record)">详情</a-button>
|
||||
<a-button :size="`small`"
|
||||
<a-button :size="`small`" @click="openEdit(record)"
|
||||
>详情</a-button
|
||||
>
|
||||
<a-button
|
||||
:size="`small`"
|
||||
title="确定要删除此记录吗?"
|
||||
:disabled="record.status === 1"
|
||||
@confirm="remove(record)"
|
||||
@@ -36,7 +48,11 @@
|
||||
</a-card>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<MerchantApplyEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
<MerchantApplyEdit
|
||||
v-model:visible="showEdit"
|
||||
:data="current"
|
||||
@done="reload"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -51,10 +67,17 @@
|
||||
DatasourceFunction,
|
||||
ColumnItem
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import Search from './components/search.vue';
|
||||
import Search from '../merchant/components/search.vue';
|
||||
import MerchantApplyEdit from './components/merchantApplyEdit.vue';
|
||||
import { pageMerchantApply, removeMerchantApply, removeBatchMerchantApply } from '@/api/shop/merchantApply';
|
||||
import type { MerchantApply, MerchantApplyParam } from '@/api/shop/merchantApply/model';
|
||||
import {
|
||||
pageMerchantApply,
|
||||
removeMerchantApply,
|
||||
removeBatchMerchantApply
|
||||
} from '@/api/shop/merchantApply';
|
||||
import type {
|
||||
MerchantApply,
|
||||
MerchantApplyParam
|
||||
} from '@/api/shop/merchantApply/model';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
@@ -95,25 +118,25 @@
|
||||
title: 'ID',
|
||||
dataIndex: 'applyId',
|
||||
key: 'applyId',
|
||||
width: 90,
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '商户名称',
|
||||
dataIndex: 'merchantName',
|
||||
key: 'merchantName',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '商户姓名',
|
||||
dataIndex: 'realName',
|
||||
key: 'realName',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '商户手机号',
|
||||
dataIndex: 'phone',
|
||||
key: 'phone',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '申请时间',
|
||||
@@ -128,13 +151,13 @@
|
||||
title: '店铺类型',
|
||||
dataIndex: 'shopType',
|
||||
key: 'shopType',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
|
||||
@@ -45,7 +45,11 @@
|
||||
</a-card>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<MerchantTypeEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
<MerchantTypeEdit
|
||||
v-model:visible="showEdit"
|
||||
:data="current"
|
||||
@done="reload"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -60,10 +64,17 @@
|
||||
DatasourceFunction,
|
||||
ColumnItem
|
||||
} from 'ele-admin-pro/es/ele-pro-table/types';
|
||||
import Search from './components/search.vue';
|
||||
import Search from '../merchant/components/search.vue';
|
||||
import MerchantTypeEdit from './components/merchantTypeEdit.vue';
|
||||
import { pageMerchantType, removeMerchantType, removeBatchMerchantType } from '@/api/shop/merchantType';
|
||||
import type { MerchantType, MerchantTypeParam } from '@/api/shop/merchantType/model';
|
||||
import {
|
||||
pageMerchantType,
|
||||
removeMerchantType,
|
||||
removeBatchMerchantType
|
||||
} from '@/api/shop/merchantType';
|
||||
import type {
|
||||
MerchantType,
|
||||
MerchantTypeParam
|
||||
} from '@/api/shop/merchantType/model';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
@@ -105,31 +116,31 @@
|
||||
dataIndex: 'id',
|
||||
key: 'id',
|
||||
align: 'center',
|
||||
width: 90,
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '店铺类型',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '店铺入驻条件',
|
||||
dataIndex: 'comments',
|
||||
key: 'comments',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '排序号',
|
||||
dataIndex: 'sortNumber',
|
||||
key: 'sortNumber',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<template>
|
||||
<a-space :size="10" style="flex-wrap: wrap">
|
||||
<SelectMerchantDown
|
||||
:placeholder="`选择场馆`"
|
||||
:placeholder="`选择店铺`"
|
||||
class="input-item"
|
||||
v-model:value="where.merchantCode"
|
||||
@change="search"
|
||||
@@ -14,7 +14,7 @@
|
||||
@search="search"
|
||||
@pressEnter="search"
|
||||
/>
|
||||
<!-- <a-button @click="getCode">生成支付二维码</a-button>-->
|
||||
<!-- <a-button @click="getCode">生成支付二维码</a-button>-->
|
||||
<a-button @click="reset">重置</a-button>
|
||||
</a-space>
|
||||
<ele-modal
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<!-- 编辑弹窗 -->
|
||||
<template>
|
||||
<ele-modal
|
||||
:width="500"
|
||||
:width="800"
|
||||
:visible="visible"
|
||||
:maskClosable="false"
|
||||
:title="isUpdate ? '编辑商品规格' : '添加商品规格'"
|
||||
:maxable="maxable"
|
||||
:title="isUpdate ? '编辑规格' : '添加规格'"
|
||||
:body-style="{ paddingBottom: '28px' }"
|
||||
@update:visible="updateVisible"
|
||||
@ok="save"
|
||||
@@ -13,48 +14,65 @@
|
||||
ref="formRef"
|
||||
:model="form"
|
||||
:rules="rules"
|
||||
:label-col="styleResponsive ? { md: 5, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
|
||||
:wrapper-col="
|
||||
styleResponsive ? { md: 18, sm: 19, xs: 24 } : { flex: '1' }
|
||||
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
|
||||
"
|
||||
>
|
||||
<a-form-item label="规格名称" name="specName">
|
||||
<a-input
|
||||
allow-clear
|
||||
:maxlength="100"
|
||||
placeholder="机型"
|
||||
placeholder="请输入规格名称"
|
||||
v-model:value="form.specName"
|
||||
@pressEnter="save"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item label="排序号" name="sortNumber" v-if="isUpdate">
|
||||
<a-input-number
|
||||
:min="0"
|
||||
:max="9999"
|
||||
class="ele-fluid"
|
||||
placeholder="请输入排序号"
|
||||
v-model:value="form.sortNumber"
|
||||
/>
|
||||
<a-form-item name="specValue">
|
||||
<a-space direction="vertical" class="ml-[124px]">
|
||||
<template v-for="(item, index) in spec" :key="index">
|
||||
<div class="text-left flex items-center leading-10 text-gray-400">
|
||||
<div class="mr-2">{{ item.value }} :</div>
|
||||
<CloseCircleOutlined
|
||||
class="cursor-pointer"
|
||||
@click="onClose(index)"
|
||||
/>
|
||||
</div>
|
||||
<ele-edit-tag
|
||||
v-model:data="item.detail"
|
||||
size="middle"
|
||||
shape="round"
|
||||
/>
|
||||
</template>
|
||||
<a-card class="ml-[124px]" v-if="showSpecForm">
|
||||
<a-form-item name="name">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入规格"
|
||||
v-model:value="name"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item name="value">
|
||||
<a-input
|
||||
allow-clear
|
||||
placeholder="请输入规格值"
|
||||
v-model:value="value"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-space>
|
||||
<a-button type="primary" @click="addSpecValue">确定</a-button>
|
||||
<a-button @click="openSpecForm">取消</a-button>
|
||||
</a-space>
|
||||
</a-card>
|
||||
<a-button type="primary" class="mt-5" v-else @click="openSpecForm"
|
||||
>添加新规格</a-button
|
||||
>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<a-form-item label="描述" name="comments">
|
||||
<a-textarea
|
||||
:rows="4"
|
||||
:maxlength="200"
|
||||
placeholder="iphone15"
|
||||
v-model:value="form.comments"
|
||||
/>
|
||||
</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 { CloseCircleOutlined } from '@ant-design/icons-vue';
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { Form, message } from 'ant-design-vue';
|
||||
import { assignObject } from 'ele-admin-pro';
|
||||
@@ -62,7 +80,9 @@
|
||||
import { Spec } from '@/api/shop/spec/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 { SpecValue } from '@/api/shop/specValue/model';
|
||||
|
||||
// 是否是修改
|
||||
const isUpdate = ref(false);
|
||||
@@ -85,16 +105,24 @@
|
||||
|
||||
// 提交状态
|
||||
const loading = ref(false);
|
||||
// 是否显示最大化切换按钮
|
||||
const maxable = ref(true);
|
||||
const showSpecForm = ref(false);
|
||||
// 表格选中数据
|
||||
const formRef = ref<FormInstance | null>(null);
|
||||
const images = ref<ItemType[]>([]);
|
||||
const spec = ref<SpecValue[]>([]);
|
||||
const name = ref();
|
||||
const value = ref();
|
||||
|
||||
// 用户信息
|
||||
const form = reactive<Spec>({
|
||||
specId: undefined,
|
||||
specName: '',
|
||||
specName: undefined,
|
||||
specValue: undefined,
|
||||
status: 0,
|
||||
comments: '',
|
||||
sortNumber: 100,
|
||||
status: 0
|
||||
sortNumber: 100
|
||||
});
|
||||
|
||||
/* 更新visible */
|
||||
@@ -108,12 +136,48 @@
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写商品规格名称',
|
||||
message: '请填写规格名称',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
// const validator = (value: string) => {
|
||||
// return new Promise<void>((_resolve, reject) => {
|
||||
// setTimeout(() => {
|
||||
// reject(new Error(value + '不合法, 请重新输入'));
|
||||
// }, 1000);
|
||||
// });
|
||||
// };
|
||||
|
||||
// 新增规格
|
||||
const addSpecValue = () => {
|
||||
if (!name.value || !value.value) {
|
||||
message.error(`请输入规格和规格值)`);
|
||||
return false;
|
||||
}
|
||||
const findIndex = spec.value.findIndex((d) => d.value == name.value);
|
||||
if (findIndex == 0) {
|
||||
message.error(`${name.value}已存在)`);
|
||||
return false;
|
||||
}
|
||||
spec.value.push({
|
||||
value: name.value,
|
||||
detail: [value.value]
|
||||
});
|
||||
name.value = '';
|
||||
value.value = '';
|
||||
openSpecForm();
|
||||
};
|
||||
|
||||
const openSpecForm = () => {
|
||||
showSpecForm.value = !showSpecForm.value;
|
||||
};
|
||||
|
||||
const onClose = (index) => {
|
||||
spec.value.splice(index, 1);
|
||||
};
|
||||
|
||||
const { resetFields } = useForm(form, rules);
|
||||
|
||||
/* 保存编辑 */
|
||||
@@ -125,8 +189,13 @@
|
||||
.validate()
|
||||
.then(() => {
|
||||
loading.value = true;
|
||||
if (spec.value.length === 0) {
|
||||
message.error('请添加规格');
|
||||
return;
|
||||
}
|
||||
const formData = {
|
||||
...form
|
||||
...form,
|
||||
specValue: JSON.stringify(spec.value)
|
||||
};
|
||||
const saveOrUpdate = isUpdate.value ? updateSpec : addSpec;
|
||||
saveOrUpdate(formData)
|
||||
@@ -148,10 +217,15 @@
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
images.value = [];
|
||||
if (props.data) {
|
||||
assignObject(form, props.data);
|
||||
if (props.data.specValue) {
|
||||
spec.value = JSON.parse(props.data.specValue);
|
||||
}
|
||||
isUpdate.value = true;
|
||||
} else {
|
||||
spec.value = [];
|
||||
isUpdate.value = false;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -21,16 +21,32 @@
|
||||
/>
|
||||
</template>
|
||||
<template #bodyCell="{ column, record }">
|
||||
<template v-if="column.key === 'specValue'">
|
||||
<a-space direction="vertical">
|
||||
<template
|
||||
v-for="(item, index) in JSON.parse(record.specValue)"
|
||||
:key="index"
|
||||
>
|
||||
<div class="text-left">
|
||||
<span class="text-gray-400 mr-2">{{ item.value }} :</span>
|
||||
<ele-tag
|
||||
shape="round"
|
||||
size="small"
|
||||
v-for="(sub, subIndex) in item.detail"
|
||||
:key="subIndex"
|
||||
>
|
||||
{{ sub }}
|
||||
</ele-tag>
|
||||
</div>
|
||||
</template>
|
||||
</a-space>
|
||||
</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>
|
||||
<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="openSpecValue(record)">规格值</a>
|
||||
<a-divider type="vertical" />
|
||||
<a @click="moveUp(record)">上移<ArrowUpOutlined /></a>
|
||||
<a-divider type="vertical" />
|
||||
<a @click="openEdit(record)">修改</a>
|
||||
<a-divider type="vertical" />
|
||||
<a-popconfirm
|
||||
@@ -47,13 +63,6 @@
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<SpecEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
|
||||
<!-- 规则值弹窗 -->
|
||||
<SpecValueEdit
|
||||
v-model:visible="showSpecValueEdit"
|
||||
:data="current"
|
||||
@done="reload"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -61,25 +70,17 @@
|
||||
<script lang="ts" setup>
|
||||
import { createVNode, ref } from 'vue';
|
||||
import { message, Modal } from 'ant-design-vue';
|
||||
import {
|
||||
ArrowUpOutlined,
|
||||
ExclamationCircleOutlined
|
||||
} from '@ant-design/icons-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 SpecEdit from './components/specEdit.vue';
|
||||
import {
|
||||
pageSpec,
|
||||
removeSpec,
|
||||
removeBatchSpec,
|
||||
updateSpec
|
||||
} from '@/api/shop/spec';
|
||||
import { pageSpec, removeSpec, removeBatchSpec } from '@/api/shop/spec';
|
||||
import type { Spec, SpecParam } from '@/api/shop/spec/model';
|
||||
import SpecValueEdit from '../specValue/index.vue';
|
||||
|
||||
// 表格实例
|
||||
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
|
||||
@@ -90,8 +91,6 @@
|
||||
const current = ref<Spec | null>(null);
|
||||
// 是否显示编辑弹窗
|
||||
const showEdit = ref(false);
|
||||
// 是否显示规格值弹窗
|
||||
const showSpecValueEdit = ref(false);
|
||||
// 是否显示批量移动弹窗
|
||||
const showMove = ref(false);
|
||||
// 加载状态
|
||||
@@ -120,24 +119,49 @@
|
||||
const columns = ref<ColumnItem[]>([
|
||||
{
|
||||
title: 'ID',
|
||||
width: 90,
|
||||
dataIndex: 'specId'
|
||||
dataIndex: 'specId',
|
||||
key: 'specId',
|
||||
align: 'center',
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '规格名称',
|
||||
dataIndex: 'specName',
|
||||
width: 240,
|
||||
key: 'specName'
|
||||
key: 'specName',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '规格值',
|
||||
dataIndex: 'specValue',
|
||||
key: 'specValue'
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
dataIndex: 'comments',
|
||||
key: 'comments'
|
||||
key: 'comments',
|
||||
align: 'center',
|
||||
hideInTable: true
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
align: 'center',
|
||||
hideInTable: true
|
||||
},
|
||||
{
|
||||
title: '创建时间',
|
||||
dataIndex: 'createTime',
|
||||
key: 'createTime',
|
||||
align: 'center',
|
||||
sorter: true,
|
||||
ellipsis: true,
|
||||
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: 280,
|
||||
width: 180,
|
||||
fixed: 'right',
|
||||
align: 'center',
|
||||
hideInSetting: true
|
||||
@@ -156,11 +180,6 @@
|
||||
showEdit.value = true;
|
||||
};
|
||||
|
||||
const openSpecValue = (row?: Spec) => {
|
||||
current.value = row ?? null;
|
||||
showSpecValueEdit.value = true;
|
||||
};
|
||||
|
||||
/* 打开批量移动弹窗 */
|
||||
const openMove = () => {
|
||||
showMove.value = true;
|
||||
@@ -208,17 +227,6 @@
|
||||
});
|
||||
};
|
||||
|
||||
// 上移
|
||||
const moveUp = (row?: Spec) => {
|
||||
updateSpec({
|
||||
specId: row?.specId,
|
||||
sortNumber: Number(row?.sortNumber) - 1
|
||||
}).then((msg) => {
|
||||
message.success(msg);
|
||||
reload();
|
||||
});
|
||||
};
|
||||
|
||||
/* 查询 */
|
||||
const query = () => {
|
||||
loading.value = true;
|
||||
@@ -233,11 +241,10 @@
|
||||
},
|
||||
// 行双击事件
|
||||
onDblclick: () => {
|
||||
openSpecValue(record);
|
||||
openEdit(record);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
query();
|
||||
</script>
|
||||
|
||||
|
||||
@@ -45,7 +45,11 @@
|
||||
</a-card>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<WechatDepositEdit v-model:visible="showEdit" :data="current" @done="reload" />
|
||||
<WechatDepositEdit
|
||||
v-model:visible="showEdit"
|
||||
:data="current"
|
||||
@done="reload"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -62,8 +66,15 @@
|
||||
} 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';
|
||||
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);
|
||||
@@ -105,73 +116,73 @@
|
||||
dataIndex: 'id',
|
||||
key: 'id',
|
||||
align: 'center',
|
||||
width: 90,
|
||||
width: 90
|
||||
},
|
||||
{
|
||||
title: '订单id',
|
||||
dataIndex: 'oid',
|
||||
key: 'oid',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '用户id',
|
||||
dataIndex: 'uid',
|
||||
key: 'uid',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '场地订单号',
|
||||
dataIndex: 'orderNum',
|
||||
key: 'orderNum',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '付款订单号',
|
||||
dataIndex: 'wechatOrder',
|
||||
key: 'wechatOrder',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '退款订单号 ',
|
||||
dataIndex: 'wechatReturn',
|
||||
key: 'wechatReturn',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '场馆名称',
|
||||
dataIndex: 'siteName',
|
||||
key: 'siteName',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '微信昵称',
|
||||
dataIndex: 'username',
|
||||
key: 'username',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '手机号码',
|
||||
dataIndex: 'phone',
|
||||
key: 'phone',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '物品名称',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '押金金额',
|
||||
dataIndex: 'price',
|
||||
key: 'price',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '押金状态,1已付款,2未付款,已退押金',
|
||||
dataIndex: 'status',
|
||||
key: 'status',
|
||||
align: 'center',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
title: '',
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
class="monitor-card-tabs"
|
||||
@change="onSaleTypeChange"
|
||||
>
|
||||
<a-tab-pane tab="销售额" key="saleroom" />
|
||||
<a-tab-pane tab="商品销售排行(全门店)" key="saleroom" />
|
||||
<a-tab-pane tab="用户消费排行(全门店)" />
|
||||
<template #rightExtra>
|
||||
<a-space
|
||||
size="middle"
|
||||
|
||||
@@ -8,22 +8,15 @@
|
||||
<div class="ele-text-secondary ele-cell">
|
||||
<div class="ele-cell-content">总销售额</div>
|
||||
<a-tooltip title="指标说明">
|
||||
<question-circle-outlined />
|
||||
<ele-tag color="green">全门店</ele-tag>
|
||||
</a-tooltip>
|
||||
</div>
|
||||
<h1 class="analysis-chart-card-num">¥ 126,560</h1>
|
||||
<div class="analysis-chart-card-content" style="padding-top: 16px">
|
||||
<a-space size="middle">
|
||||
<span class="analysis-trend-text">
|
||||
周同比12% <caret-up-outlined class="ele-text-danger" />
|
||||
</span>
|
||||
<span class="analysis-trend-text">
|
||||
日同比11% <caret-down-outlined class="ele-text-success" />
|
||||
</span>
|
||||
</a-space>
|
||||
</div>
|
||||
<a-divider />
|
||||
<div>日销售额 ¥12,423</div>
|
||||
<div class="flex justify-between">
|
||||
<span>本月订单数</span>
|
||||
<span>6,234单</span>
|
||||
</div>
|
||||
</a-card>
|
||||
</a-col>
|
||||
<a-col
|
||||
@@ -31,17 +24,15 @@
|
||||
>
|
||||
<a-card class="analysis-chart-card" :bordered="false">
|
||||
<div class="ele-text-secondary ele-cell">
|
||||
<div class="ele-cell-content">访问量</div>
|
||||
<ele-tag color="red">日</ele-tag>
|
||||
<div class="ele-cell-content">订单总数</div>
|
||||
<ele-tag color="green">全门店</ele-tag>
|
||||
</div>
|
||||
<h1 class="analysis-chart-card-num">8,846</h1>
|
||||
<v-chart
|
||||
ref="visitChartRef"
|
||||
:option="visitChartOption"
|
||||
style="height: 40px"
|
||||
/>
|
||||
<a-divider />
|
||||
<div>日访问量 1,234</div>
|
||||
<div class="flex justify-between">
|
||||
<span>昨日订单数</span>
|
||||
<span>634单</span>
|
||||
</div>
|
||||
</a-card>
|
||||
</a-col>
|
||||
<a-col
|
||||
@@ -49,17 +40,15 @@
|
||||
>
|
||||
<a-card class="analysis-chart-card" :bordered="false">
|
||||
<div class="ele-text-secondary ele-cell">
|
||||
<div class="ele-cell-content">支付笔数</div>
|
||||
<ele-tag color="blue">月</ele-tag>
|
||||
<div class="ele-cell-content">会员总数</div>
|
||||
<ele-tag color="blue">全门店</ele-tag>
|
||||
</div>
|
||||
<h1 class="analysis-chart-card-num">6,560</h1>
|
||||
<v-chart
|
||||
ref="payNumChartRef"
|
||||
:option="payNumChartOption"
|
||||
style="height: 40px"
|
||||
/>
|
||||
<h1 class="analysis-chart-card-num">16,560</h1>
|
||||
<a-divider />
|
||||
<div>转化率 60%</div>
|
||||
<div class="flex justify-between">
|
||||
<span>今日订单数</span>
|
||||
<span>1单</span>
|
||||
</div>
|
||||
</a-card>
|
||||
</a-col>
|
||||
<a-col
|
||||
@@ -67,27 +56,17 @@
|
||||
>
|
||||
<a-card class="analysis-chart-card" :bordered="false">
|
||||
<div class="ele-text-secondary ele-cell">
|
||||
<div class="ele-cell-content">活动运营效果</div>
|
||||
<ele-tag color="green">周</ele-tag>
|
||||
</div>
|
||||
<h1 class="analysis-chart-card-num">78%</h1>
|
||||
<div class="analysis-chart-card-content" style="padding-top: 16px">
|
||||
<a-progress
|
||||
:percent="78"
|
||||
:show-info="false"
|
||||
stroke-color="#13c2c2"
|
||||
status="active"
|
||||
/>
|
||||
<div class="ele-cell-content">商品总数</div>
|
||||
<ele-tag color="green">全门店</ele-tag>
|
||||
</div>
|
||||
<h1 class="analysis-chart-card-num">78</h1>
|
||||
<!-- <div class="analysis-chart-card-content" style="padding-top: 16px">-->
|
||||
<!-- </div>-->
|
||||
<a-divider />
|
||||
<a-space size="middle">
|
||||
<span class="analysis-trend-text">
|
||||
周同比12% <caret-up-outlined class="ele-text-danger" />
|
||||
</span>
|
||||
<span class="analysis-trend-text">
|
||||
日同比11% <caret-down-outlined class="ele-text-success" />
|
||||
</span>
|
||||
</a-space>
|
||||
<div class="flex justify-between">
|
||||
<span>今日订单数</span>
|
||||
<span>1单</span>
|
||||
</div>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
@@ -393,7 +393,7 @@
|
||||
}
|
||||
|
||||
&:hover:after {
|
||||
background-color: rgba(0, 0, 0, 0.4);
|
||||
background-color: rgb(228, 255, 215);
|
||||
}
|
||||
|
||||
& + h1 {
|
||||
|
||||
Reference in New Issue
Block a user