Merge branch 'ymf' of https://newgitea.sxczgkj.cn/czg_team/cashier-web into gyq
This commit is contained in:
commit
23f0e549fa
|
|
@ -8,4 +8,4 @@ export const Account_BaseUrl = "account";
|
||||||
export const Order_BaseUrl = "order";
|
export const Order_BaseUrl = "order";
|
||||||
export const Product_BaseUrl = "product";
|
export const Product_BaseUrl = "product";
|
||||||
export const System_BaseUrl = "system";
|
export const System_BaseUrl = "system";
|
||||||
export const Market_BaseUrl = "market";
|
export const Market_BaseUrl = "market";
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
import request from "@/utils/request";
|
||||||
|
import { Market_BaseUrl } from "@/api/config";
|
||||||
|
const baseURL = Market_BaseUrl + "/admin/coupon";
|
||||||
|
const API = {
|
||||||
|
getList(params: any) {
|
||||||
|
return request<any>({
|
||||||
|
url: `${baseURL}/page`,
|
||||||
|
method: "get",
|
||||||
|
params
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}
|
||||||
|
export default API;
|
||||||
|
|
||||||
|
|
@ -0,0 +1,240 @@
|
||||||
|
import request from "@/utils/request";
|
||||||
|
import { Market_BaseUrl } from "@/api/config";
|
||||||
|
const baseURL = Market_BaseUrl + "/admin/member";
|
||||||
|
const API = {
|
||||||
|
getConfig(params: any) {
|
||||||
|
return request<any>({
|
||||||
|
url: `${baseURL}`,
|
||||||
|
method: "get",
|
||||||
|
params
|
||||||
|
});
|
||||||
|
},
|
||||||
|
editConfig(data: editRequest) {
|
||||||
|
return request({
|
||||||
|
url: `${baseURL}`,
|
||||||
|
method: "post",
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
levelAdd(data: levelAddRequest) {
|
||||||
|
return request({
|
||||||
|
url: `${baseURL}/level`,
|
||||||
|
method: "post",
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
levelEdit(data: levelEditRequest) {
|
||||||
|
return request({
|
||||||
|
url: `${baseURL}/level`,
|
||||||
|
method: "put",
|
||||||
|
data: data,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
levelDel(data: levelDelRequest) {
|
||||||
|
return request<any>({
|
||||||
|
url: `${baseURL}/level/${data.id}`,
|
||||||
|
method: "delete",
|
||||||
|
// data
|
||||||
|
});
|
||||||
|
},
|
||||||
|
levelList(params: any) {
|
||||||
|
return request<any>({
|
||||||
|
url: `${baseURL}/level/list`,
|
||||||
|
method: "get",
|
||||||
|
params
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}
|
||||||
|
export default API;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MemberConfigDTO
|
||||||
|
*/
|
||||||
|
export interface editRequest {
|
||||||
|
/**
|
||||||
|
* 条件开通条件项
|
||||||
|
*/
|
||||||
|
conditionList?: Condition[] | null;
|
||||||
|
/**
|
||||||
|
* 金额购买方案列表
|
||||||
|
*/
|
||||||
|
configList?: ConfigList[] | null;
|
||||||
|
/**
|
||||||
|
* 每消费一元经验值
|
||||||
|
*/
|
||||||
|
costReward?: number | null;
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
id: number | null;
|
||||||
|
/**
|
||||||
|
* 是否享受会员价
|
||||||
|
*/
|
||||||
|
isMemberPrice: number | null;
|
||||||
|
/**
|
||||||
|
* 是否开启
|
||||||
|
*/
|
||||||
|
isOpen: string;
|
||||||
|
/**
|
||||||
|
* 提交生日/姓名
|
||||||
|
*/
|
||||||
|
isSubmitInfo: number | null;
|
||||||
|
/**
|
||||||
|
* 参与会员价门店
|
||||||
|
*/
|
||||||
|
memberPriceShopIdList?: number[] | null;
|
||||||
|
/**
|
||||||
|
* 每充值一元经验值
|
||||||
|
*/
|
||||||
|
rechargeReward?: number | null;
|
||||||
|
/**
|
||||||
|
* 规则说明
|
||||||
|
*/
|
||||||
|
remark: null | string;
|
||||||
|
[property: string]: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* com.czg.account.dto.MemberConfigDTO.condition
|
||||||
|
*
|
||||||
|
* condition
|
||||||
|
*/
|
||||||
|
export interface Condition {
|
||||||
|
code?: null | string;
|
||||||
|
value?: null | string;
|
||||||
|
[property: string]: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* com.czg.account.dto.MemberConfigDTO.ConfigList
|
||||||
|
*
|
||||||
|
* ConfigList
|
||||||
|
*/
|
||||||
|
export interface ConfigList {
|
||||||
|
/**
|
||||||
|
* 会员周期 1月 1日
|
||||||
|
*/
|
||||||
|
circleTime: null | string;
|
||||||
|
/**
|
||||||
|
* 赠送优惠券
|
||||||
|
*/
|
||||||
|
couponIdList?: number[] | null;
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
name: null | string;
|
||||||
|
/**
|
||||||
|
* 价格
|
||||||
|
*/
|
||||||
|
price: number | null;
|
||||||
|
/**
|
||||||
|
* 赠送成长值
|
||||||
|
*/
|
||||||
|
reward?: number | null;
|
||||||
|
[property: string]: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MemberLevelDTO
|
||||||
|
*/
|
||||||
|
export interface levelAddRequest {
|
||||||
|
/**
|
||||||
|
* 消费送积分,消费n元送1积分, 0为禁用
|
||||||
|
*/
|
||||||
|
costRewardPoints?: number | null;
|
||||||
|
/**
|
||||||
|
* 优惠券列表
|
||||||
|
*/
|
||||||
|
cycleRewardCouponList?: number[] | null;
|
||||||
|
/**
|
||||||
|
* 赠送积分
|
||||||
|
*/
|
||||||
|
cycleRewardPoints?: number | null;
|
||||||
|
/**
|
||||||
|
* 周期时间包含周 月 年 日
|
||||||
|
*/
|
||||||
|
cycleTime?: null | string;
|
||||||
|
/**
|
||||||
|
* 会员折扣
|
||||||
|
*/
|
||||||
|
discount: number | null;
|
||||||
|
/**
|
||||||
|
* 所需成长值
|
||||||
|
*/
|
||||||
|
experienceValue: number | null;
|
||||||
|
/**
|
||||||
|
* ID
|
||||||
|
*/
|
||||||
|
id?: number | null;
|
||||||
|
/**
|
||||||
|
* 周期奖励状态 0禁用 1启用
|
||||||
|
*/
|
||||||
|
isCycleReward: number | null;
|
||||||
|
/**
|
||||||
|
* logo
|
||||||
|
*/
|
||||||
|
logo?: null | string;
|
||||||
|
/**
|
||||||
|
* 会员名称
|
||||||
|
*/
|
||||||
|
name: null | string;
|
||||||
|
/**
|
||||||
|
* 描述说明
|
||||||
|
*/
|
||||||
|
remark: string;
|
||||||
|
[property: string]: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MemberLevelDTOUpdateGroup
|
||||||
|
*/
|
||||||
|
export interface levelEditRequest {
|
||||||
|
/**
|
||||||
|
* 消费送积分,消费n元送1积分, 0为禁用
|
||||||
|
*/
|
||||||
|
costRewardPoints?: number | null;
|
||||||
|
/**
|
||||||
|
* 优惠券列表
|
||||||
|
*/
|
||||||
|
cycleRewardCouponList?: number[] | null;
|
||||||
|
/**
|
||||||
|
* 赠送积分
|
||||||
|
*/
|
||||||
|
cycleRewardPoints?: number | null;
|
||||||
|
/**
|
||||||
|
* 周期时间包含周 月 年 日
|
||||||
|
*/
|
||||||
|
cycleTime?: null | string;
|
||||||
|
/**
|
||||||
|
* 会员折扣
|
||||||
|
*/
|
||||||
|
discount?: number | null;
|
||||||
|
/**
|
||||||
|
* 所需成长值
|
||||||
|
*/
|
||||||
|
experienceValue?: number | null;
|
||||||
|
/**
|
||||||
|
* ID
|
||||||
|
*/
|
||||||
|
id: number | null;
|
||||||
|
/**
|
||||||
|
* 周期奖励状态 0禁用 1启用
|
||||||
|
*/
|
||||||
|
isCycleReward?: number | null;
|
||||||
|
/**
|
||||||
|
* logo
|
||||||
|
*/
|
||||||
|
logo?: null | string;
|
||||||
|
/**
|
||||||
|
* 会员名称
|
||||||
|
*/
|
||||||
|
name?: null | string;
|
||||||
|
[property: string]: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface levelDelRequest {
|
||||||
|
id: number;
|
||||||
|
[property: string]: any;
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
|
|
@ -1,7 +1,10 @@
|
||||||
<template>
|
<template>
|
||||||
<el-breadcrumb class="flex-y-center">
|
<el-breadcrumb class="flex-y-center">
|
||||||
<el-breadcrumb-item v-for="(item, index) in breadcrumbs" :key="item.path">
|
<el-breadcrumb-item v-for="(item, index) in breadcrumbs" :key="item.path">
|
||||||
<span v-if="item.redirect === 'noredirect' || index === breadcrumbs.length - 1" class="color-gray-400">
|
<span
|
||||||
|
v-if="item.redirect === 'noredirect' || index === breadcrumbs.length - 1"
|
||||||
|
class="color-gray-400"
|
||||||
|
>
|
||||||
{{ translateRouteTitle(item.meta.title) }}
|
{{ translateRouteTitle(item.meta.title) }}
|
||||||
</span>
|
</span>
|
||||||
<a v-else @click.prevent="handleLink(item)">
|
<a v-else @click.prevent="handleLink(item)">
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,23 @@ export const usePermissionStore = defineStore("permission", () => {
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
if (!isTest) {
|
if (!isTest) {
|
||||||
const dynamicRoutes = parseDynamicRoutes(data.filter(v => v.type == 0));
|
const dynamicRoutes = parseDynamicRoutes(data.filter(v => v.type == 0));
|
||||||
|
console.log('dynamicRoutes')
|
||||||
|
console.log(dynamicRoutes)
|
||||||
|
dynamicRoutes.forEach((route) => {
|
||||||
|
//过滤出可见子节点
|
||||||
|
let onlyOneChild = null
|
||||||
|
const showingChildren = route.children.filter((route) => {
|
||||||
|
if (!route.meta?.hidden) {
|
||||||
|
onlyOneChild = route;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
// 仅有一个节点
|
||||||
|
if (showingChildren.length === 1 && onlyOneChild) {
|
||||||
|
route.redirect = onlyOneChild.path;
|
||||||
|
}
|
||||||
|
})
|
||||||
routes.value = [...constantRoutes, ...dynamicRoutes];
|
routes.value = [...constantRoutes, ...dynamicRoutes];
|
||||||
isRoutesLoaded.value = true;
|
isRoutesLoaded.value = true;
|
||||||
resolve(dynamicRoutes);
|
resolve(dynamicRoutes);
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="login" :style="'background-image:url(' + Background + ');'">
|
<div class="login" :style="'background-image:url(' + Background + ');'">
|
||||||
<el-form ref="loginForm" :model="state.loginForm" :rules="state.loginRules" label-position="left" label-width="0px"
|
<el-form
|
||||||
class="login-form">
|
ref="loginForm"
|
||||||
|
:model="state.loginForm"
|
||||||
|
:rules="state.loginRules"
|
||||||
|
label-position="left"
|
||||||
|
label-width="0px"
|
||||||
|
class="login-form"
|
||||||
|
>
|
||||||
<h3 class="title">银收客后台管理</h3>
|
<h3 class="title">银收客后台管理</h3>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-radio-group v-model="state.loginForm.loginType">
|
<el-radio-group v-model="state.loginForm.loginType">
|
||||||
|
|
@ -10,19 +16,39 @@
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="username">
|
<el-form-item prop="username">
|
||||||
<el-input v-model="state.loginForm.username" type="text" auto-complete="off" placeholder="商户号"></el-input>
|
<el-input
|
||||||
|
v-model="state.loginForm.username"
|
||||||
|
type="text"
|
||||||
|
auto-complete="off"
|
||||||
|
placeholder="商户号"
|
||||||
|
></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="staffUserName" v-if="state.loginForm.loginType == 1">
|
<el-form-item prop="staffUserName" v-if="state.loginForm.loginType == 1">
|
||||||
<el-input v-model="state.loginForm.staffUserName" type="text" auto-complete="off" placeholder="账号"></el-input>
|
<el-input
|
||||||
|
v-model="state.loginForm.staffUserName"
|
||||||
|
type="text"
|
||||||
|
auto-complete="off"
|
||||||
|
placeholder="账号"
|
||||||
|
></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="password">
|
<el-form-item prop="password">
|
||||||
<el-input v-model="state.loginForm.password" type="password" auto-complete="off" placeholder="密码"
|
<el-input
|
||||||
@keyup.enter="handleLogin"></el-input>
|
v-model="state.loginForm.password"
|
||||||
|
type="password"
|
||||||
|
auto-complete="off"
|
||||||
|
placeholder="密码"
|
||||||
|
@keyup.enter="handleLogin"
|
||||||
|
></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item prop="code">
|
<el-form-item prop="code">
|
||||||
<div class="code_wrap">
|
<div class="code_wrap">
|
||||||
<el-input v-model="state.loginForm.code" auto-complete="off" placeholder="验证码" style="width: 63%"
|
<el-input
|
||||||
@keyup.enter="handleLogin"></el-input>
|
v-model="state.loginForm.code"
|
||||||
|
auto-complete="off"
|
||||||
|
placeholder="验证码"
|
||||||
|
style="width: 63%"
|
||||||
|
@keyup.enter="handleLogin"
|
||||||
|
></el-input>
|
||||||
<div class="login-code">
|
<div class="login-code">
|
||||||
<img :src="state.codeUrl" @click="getCode" />
|
<img :src="state.codeUrl" @click="getCode" />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -30,8 +56,13 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item style="width: 100%">
|
<el-form-item style="width: 100%">
|
||||||
<el-button :loading="state.loading" size="default" type="primary" style="width: 100%"
|
<el-button
|
||||||
@click.prevent="handleLogin">
|
:loading="state.loading"
|
||||||
|
size="default"
|
||||||
|
type="primary"
|
||||||
|
style="width: 100%"
|
||||||
|
@click.prevent="handleLogin"
|
||||||
|
>
|
||||||
<span v-if="!state.loading">登 录</span>
|
<span v-if="!state.loading">登 录</span>
|
||||||
<span v-else>登 录 中...</span>
|
<span v-else>登 录 中...</span>
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
@ -168,14 +199,16 @@ function handleLogin() {
|
||||||
token,
|
token,
|
||||||
}).then((checkInfo) => {
|
}).then((checkInfo) => {
|
||||||
console.log("checkInfo", checkInfo);
|
console.log("checkInfo", checkInfo);
|
||||||
userStore.meituan_douyin_info = checkInfo.userInfo;
|
if (checkInfo && checkInfo.userInfo) {
|
||||||
setDouyinToken(checkInfo.userInfo.token);
|
userStore.meituan_douyin_info = checkInfo.userInfo;
|
||||||
|
setDouyinToken(checkInfo.userInfo.token);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
localStorage.removeItem("shopName")
|
localStorage.removeItem("shopName");
|
||||||
let resData = await $API_login.getPermission()
|
let resData = await $API_login.getPermission();
|
||||||
localStorage.setItem("permission",JSON.stringify(resData))
|
localStorage.setItem("permission", JSON.stringify(resData));
|
||||||
localStorage.setItem("loginType",state.loginForm.loginType)
|
localStorage.setItem("loginType", state.loginForm.loginType);
|
||||||
|
|
||||||
const { path, queryParams } = parseRedirect();
|
const { path, queryParams } = parseRedirect();
|
||||||
console.log(path, queryParams);
|
console.log(path, queryParams);
|
||||||
// router.replace({ path: path, query: queryParams });
|
// router.replace({ path: path, query: queryParams });
|
||||||
|
|
|
||||||
|
|
@ -7,25 +7,37 @@
|
||||||
{{ props.intro }}
|
{{ props.intro }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="ml-30">
|
||||||
|
<el-switch v-model="isOpen" v-if="props.showSwitch" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import defaultIcon from '@/assets/logo.png';
|
import defaultIcon from "@/assets/logo.png";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
icon: {
|
icon: {
|
||||||
type: String,
|
type: String,
|
||||||
defautl: ''
|
defautl: "",
|
||||||
},
|
},
|
||||||
name: {
|
name: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: "",
|
||||||
},
|
},
|
||||||
intro: {
|
intro: {
|
||||||
type: String,
|
type: String,
|
||||||
default: ''
|
default: "",
|
||||||
}
|
},
|
||||||
|
showSwitch: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const isOpen = defineModel("isOpen", {
|
||||||
|
type: Boolean,
|
||||||
|
default: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
// 动态获取PNG图标路径
|
// 动态获取PNG图标路径
|
||||||
|
|
@ -45,7 +57,7 @@ const getIconPath = (iconName) => {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
background-color: #F8F8F8;
|
background-color: #f8f8f8;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
transition: all 0.1s ease-in-out;
|
transition: all 0.1s ease-in-out;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="menus_wrap">
|
<div class="menus_wrap">
|
||||||
<div class="item" v-for="(val, i) in item.list" :key="i" @click="to(val)">
|
<div class="item" v-for="(val, i) in item.list" :key="i" @click="to(val)">
|
||||||
<img
|
<img :src="getIconPath(val.icon)" class="icon" @error="handleImageError(val)" />
|
||||||
:src="getIconPath(val.icon)"
|
|
||||||
class="icon"
|
|
||||||
@error="handleImageError(val)"
|
|
||||||
/>
|
|
||||||
<div class="info">
|
<div class="info">
|
||||||
<div class="name">{{ val.name }}</div>
|
<div class="name">{{ val.name }}</div>
|
||||||
<div class="intro">
|
<div class="intro">
|
||||||
|
|
@ -58,7 +54,7 @@ const menus = ref([
|
||||||
},
|
},
|
||||||
{ name: "充值活动", icon: "czhd", pathName: "", intro: "允许客户充值并使用余额支付" },
|
{ name: "充值活动", icon: "czhd", pathName: "", intro: "允许客户充值并使用余额支付" },
|
||||||
{ name: "弹窗广告", icon: "tcgg", pathName: "", intro: "设置弹窗广告" },
|
{ name: "弹窗广告", icon: "tcgg", pathName: "", intro: "设置弹窗广告" },
|
||||||
{ name: "超级会员", icon: "cjhy", pathName: "", intro: "用户会员管理设置" },
|
{ name: "超级会员", icon: "cjhy", pathName: "superVip", intro: "用户会员管理设置" },
|
||||||
{ name: "新客立减", icon: "xklj", pathName: "", intro: "首单下单减免金额" },
|
{ name: "新客立减", icon: "xklj", pathName: "", intro: "首单下单减免金额" },
|
||||||
{ name: "智慧充值", icon: "zhcz", pathName: "", intro: "允许客户充值并使用余额支付" },
|
{ name: "智慧充值", icon: "zhcz", pathName: "", intro: "允许客户充值并使用余额支付" },
|
||||||
{ name: "分销", icon: "zhcz", pathName: "", intro: "允许客户充值并使用余额支付" },
|
{ name: "分销", icon: "zhcz", pathName: "", intro: "允许客户充值并使用余额支付" },
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,85 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<div v-for="(item, index) in modelValue" :key="index" class="flex gap-4 mb-2">
|
||||||
|
<el-select
|
||||||
|
v-model="item.coupon.id"
|
||||||
|
placeholder="请选择优惠券"
|
||||||
|
@change="changeCoupon($event, index)"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="coupon in couponList"
|
||||||
|
:key="coupon.id"
|
||||||
|
:label="coupon.title"
|
||||||
|
:value="coupon.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
<el-input v-model="item.num" placeholder="请输入数量">
|
||||||
|
<template #append>数量</template>
|
||||||
|
</el-input>
|
||||||
|
<div>
|
||||||
|
<el-link
|
||||||
|
:underline="false"
|
||||||
|
type="danger"
|
||||||
|
class="no-wrap"
|
||||||
|
@click="modelValue.splice(index, 1)"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex">
|
||||||
|
<div class="flex gap-1 cursor-pointer" @click="addCoupon()">
|
||||||
|
<el-icon color="#3F9EFF">
|
||||||
|
<CirclePlus />
|
||||||
|
</el-icon>
|
||||||
|
<el-link :underline="false" type="primary" class="no-wrap">新增券</el-link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script setup>
|
||||||
|
import couponApi from "@/api/market/coupon";
|
||||||
|
|
||||||
|
import { ref, reactive, onMounted } from "vue";
|
||||||
|
const modelValue = defineModel({
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
});
|
||||||
|
|
||||||
|
// 优惠券列表
|
||||||
|
const couponList = ref([]);
|
||||||
|
function addCoupon() {
|
||||||
|
if (!modelValue.value) {
|
||||||
|
modelValue.value = [
|
||||||
|
{
|
||||||
|
num: 1,
|
||||||
|
coupon: {
|
||||||
|
id: null,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
modelValue.value.push({
|
||||||
|
num: 1,
|
||||||
|
coupon: {
|
||||||
|
id: null,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
console.log(modelValue.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
couponApi.getList({ size: 999 }).then((res) => {
|
||||||
|
if (res) {
|
||||||
|
couponList.value = res.records || [];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function changeCoupon(e, index) {
|
||||||
|
const coupon = couponList.value.find((item) => item.id === e);
|
||||||
|
console.log(coupon);
|
||||||
|
modelValue.value[index].coupon = coupon;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,153 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-dialog title="购买会员方案" v-model="show" @close="reset" width="60%">
|
||||||
|
<el-form :model="form" label-width="120px">
|
||||||
|
<el-form-item label="周期名称" required>
|
||||||
|
<el-input v-model="form.name" placeholder="周期名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="周期价格" required>
|
||||||
|
<el-input v-model="form.price" placeholder="周期价格" type="number" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="赠送成长值" required>
|
||||||
|
<el-input v-model="form.reward" placeholder="开通后立刻获得经验" type="number" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="赠送优惠券">
|
||||||
|
<CouponLists v-model="form.couponList" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="周期时间" required>
|
||||||
|
<div class="flex">
|
||||||
|
<el-input-number
|
||||||
|
style="width: 300px"
|
||||||
|
v-model="form.circleTime"
|
||||||
|
placeholder="周期时间"
|
||||||
|
type="number"
|
||||||
|
/>
|
||||||
|
<el-select class="ml-2" v-model="form.circleUnit" placeholder="">
|
||||||
|
<el-option label="年" value="年" />
|
||||||
|
<el-option label="月" value="月" />
|
||||||
|
<el-option label="周" value="周" />
|
||||||
|
<el-option label="天" value="天" />
|
||||||
|
</el-select>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div style="text-align: right; margin-top: 20px">
|
||||||
|
<el-button @click="close">取消</el-button>
|
||||||
|
<el-button type="primary" @click="submit">{{ isedit ? "更新" : "提交" }}</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import CouponLists from "./coup-lists.vue";
|
||||||
|
|
||||||
|
import { ref, toRaw } from "vue";
|
||||||
|
import { ElMessage } from "element-plus";
|
||||||
|
// 控制主弹窗显示
|
||||||
|
const show = ref(false);
|
||||||
|
|
||||||
|
// 控制优惠券选择弹窗显示
|
||||||
|
const couponDialogVisible = ref(false);
|
||||||
|
|
||||||
|
// 表单数据
|
||||||
|
const form = ref({
|
||||||
|
name: "",
|
||||||
|
price: 0,
|
||||||
|
reward: 0,
|
||||||
|
couponList: [], // 存储已选择的优惠券
|
||||||
|
circleTime: 1, // 会员周期
|
||||||
|
circleUnit: "月", // 会员周期单位
|
||||||
|
});
|
||||||
|
|
||||||
|
// 优惠券列表数据
|
||||||
|
const couponList = ref([
|
||||||
|
{ id: 1, name: "满100减10", value: "10元" },
|
||||||
|
{ id: 2, name: "满200减30", value: "30元" },
|
||||||
|
{ id: 3, name: "满500减100", value: "100元" },
|
||||||
|
]);
|
||||||
|
|
||||||
|
// 已选择的优惠券
|
||||||
|
const selectedCoupons = ref([]);
|
||||||
|
|
||||||
|
// 打开优惠券选择弹窗
|
||||||
|
function openCouponDialog() {
|
||||||
|
couponDialogVisible.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 关闭优惠券选择弹窗
|
||||||
|
function closeCouponDialog() {
|
||||||
|
couponDialogVisible.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 确认选择优惠券
|
||||||
|
function confirmCouponSelection() {
|
||||||
|
form.value.couponList = [...selectedCoupons.value];
|
||||||
|
closeCouponDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理优惠券选择
|
||||||
|
function handleCouponSelection(selection) {
|
||||||
|
selectedCoupons.value = selection;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 重置表单
|
||||||
|
function reset() {
|
||||||
|
form.value = {
|
||||||
|
name: "",
|
||||||
|
price: 0,
|
||||||
|
reward: 0,
|
||||||
|
couponList: [],
|
||||||
|
circleTime: "",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const emits = defineEmits(["submitSuccess"]);
|
||||||
|
// 提交表单
|
||||||
|
function submit() {
|
||||||
|
if (!form.value.name) {
|
||||||
|
ElMessage.error("请输入方案名称");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (form.value.price <= 0) {
|
||||||
|
ElMessage.error("请输入有效的价格");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!form.value.circleTime) {
|
||||||
|
ElMessage.error("请选择会员周期");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const ispass = form.value.couponList.every((item) => item.num && item.coupon.id);
|
||||||
|
if (!ispass) {
|
||||||
|
ElMessage.error("请选择优惠券并输入数量");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log("提交表单数据:", form.value);
|
||||||
|
emits("submitSuccess", form.value, dataIndex);
|
||||||
|
// 在此处可以添加表单提交逻辑,例如调用 API
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
let isedit = ref(false);
|
||||||
|
let dataIndex = null;
|
||||||
|
function open(data, index) {
|
||||||
|
data = toRaw(data);
|
||||||
|
console.log("data", data);
|
||||||
|
console.log("index", index);
|
||||||
|
if (data) {
|
||||||
|
form.value = data;
|
||||||
|
isedit.value = true;
|
||||||
|
dataIndex = index;
|
||||||
|
} else {
|
||||||
|
isedit.value = false;
|
||||||
|
dataIndex = null;
|
||||||
|
}
|
||||||
|
console.log(data);
|
||||||
|
show.value = true;
|
||||||
|
}
|
||||||
|
function close() {
|
||||||
|
show.value = false;
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
defineExpose({ open, close, reset, submit });
|
||||||
|
</script>
|
||||||
|
|
@ -1,3 +1,552 @@
|
||||||
<template>
|
<template>
|
||||||
<div>超级会员管理</div>
|
<div class="m-4 bg-white p-4">
|
||||||
</template>
|
<HeaderCard
|
||||||
|
name="超级会员"
|
||||||
|
intro="用户会员管理设置"
|
||||||
|
icon="super_vip"
|
||||||
|
showSwitch
|
||||||
|
v-model:isOpen="isOpenSuperVip"
|
||||||
|
></HeaderCard>
|
||||||
|
<el-tabs class="mt-4" v-model="activeTab" type="border-card">
|
||||||
|
<el-tab-pane :label="item.label" v-for="item in configs" :key="item.name" :name="item.name">
|
||||||
|
<template v-if="item.name == 'basic'">
|
||||||
|
<h3>基础设置</h3>
|
||||||
|
<el-form ref="form" :model="basicForm">
|
||||||
|
<el-form-item label="提交生日/姓名">
|
||||||
|
<el-radio-group v-model="basicForm.isSubmitInfo">
|
||||||
|
<el-radio :value="1">是</el-radio>
|
||||||
|
<el-radio :value="0">否</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
<small class="color-999 m-l-6">*成为会员前需提交生日、姓名、性别信息。</small>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="会员开通方式">
|
||||||
|
<el-radio-group v-model="basicForm.openType">
|
||||||
|
<el-radio value="PAY">购买开通</el-radio>
|
||||||
|
<el-radio value="CONDITION">条件开通</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<!-- 购买开通 -->
|
||||||
|
<div v-if="basicForm.openType == 'PAY'">
|
||||||
|
<el-form-item label="会员周期列表">
|
||||||
|
<el-button type="primary" @click="refDialogPlans.open()">添加方案</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="">
|
||||||
|
<el-table :data="basicForm.configList" border style="width: 60%">
|
||||||
|
<el-table-column prop="name" label="名称" align="center" />
|
||||||
|
<el-table-column prop="price" label="价格" align="center" />
|
||||||
|
<el-table-column prop="reward" label="赠送成长值" align="center" />
|
||||||
|
<el-table-column label="赠送优惠券" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ totalCount(scope.row.couponList) }}张优惠券
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column prop="is_auto_renew" label="会员周期" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ scope.row.circleTime }} {{ scope.row.circleUnit }}
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button type="text" @click="refDialogPlans.open(scope.row, scope.$index)">
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button type="text" style="color: red" @click="deletePlan(scope.row)">
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
<!-- 条件开通 -->
|
||||||
|
<div v-if="basicForm.openType == 'CONDITION'">
|
||||||
|
<el-form-item label="成为会员条件">
|
||||||
|
<div>
|
||||||
|
<div class="m-b-2" v-for="(item, index) in conditionLists" :key="index">
|
||||||
|
<el-checkbox v-model="item.checked">{{ item.label }}</el-checkbox>
|
||||||
|
<el-input-number
|
||||||
|
style="margin-left: 20px"
|
||||||
|
v-if="item.label != '绑定手机号' && item.checked"
|
||||||
|
v-model="item.value"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
</div>
|
||||||
|
<el-form-item label="参与会员价门店">
|
||||||
|
<el-radio-group v-model="basicForm.memberPriceShopType">
|
||||||
|
<el-radio value="ALL">全部门店</el-radio>
|
||||||
|
<el-radio value="PART">指定门店</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="选择门店" v-if="basicForm.memberPriceShopType == 'PART'">
|
||||||
|
<el-select
|
||||||
|
style="max-width: 600px"
|
||||||
|
v-model="basicForm.memberPriceShopIdList"
|
||||||
|
multiple
|
||||||
|
placeholder="请选择门店"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in shops"
|
||||||
|
:key="item.shopId"
|
||||||
|
:label="item.shopName"
|
||||||
|
:value="item.shopId"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="享受会员价">
|
||||||
|
<el-radio-group v-model="basicForm.isMemberPrice">
|
||||||
|
<el-radio :value="1">所有支付方式</el-radio>
|
||||||
|
<el-radio :value="0">仅余额支付</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="规则说明">
|
||||||
|
<el-input
|
||||||
|
v-model="basicForm.remark"
|
||||||
|
style="width: 400px"
|
||||||
|
:autosize="{ minRows: 4, maxRows: 5 }"
|
||||||
|
type="textarea"
|
||||||
|
placeholder="请输入内容"
|
||||||
|
></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<h3>升级规则</h3>
|
||||||
|
<el-form-item label="获取成长值升级">
|
||||||
|
<div class="color-666">
|
||||||
|
<div class="m-b-4">
|
||||||
|
<span>每消费1元获得</span>
|
||||||
|
<el-input-number
|
||||||
|
class="m-x-2"
|
||||||
|
v-model="basicForm.costReward"
|
||||||
|
placeholder="请输入内容"
|
||||||
|
/>
|
||||||
|
<span>成长值</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span>每充值1元获得</span>
|
||||||
|
<el-input-number
|
||||||
|
class="m-x-2"
|
||||||
|
v-model="basicForm.rechargeReward"
|
||||||
|
placeholder="请输入内容"
|
||||||
|
/>
|
||||||
|
<span>成长值</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
<div class="flex mt-10 justify-center gap-10">
|
||||||
|
<el-button style="width: 100px" type="primary" @click="basicSubmit" size="large">
|
||||||
|
保存
|
||||||
|
</el-button>
|
||||||
|
<el-button @click="close" style="width: 100px" size="large">取消</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<!-- 会员等级设置 -->
|
||||||
|
<template v-if="item.name == 'lv'">
|
||||||
|
<h3>会员等级设置</h3>
|
||||||
|
<div>
|
||||||
|
<el-button type="primary" @click="addLevel">添加会员等级</el-button>
|
||||||
|
</div>
|
||||||
|
<el-tabs
|
||||||
|
v-model="activeLevelId"
|
||||||
|
type="card"
|
||||||
|
style="margin-top: 20px"
|
||||||
|
@tab-remove="removeLevel"
|
||||||
|
@tab-add="addLevel"
|
||||||
|
editable
|
||||||
|
>
|
||||||
|
<el-tab-pane
|
||||||
|
v-for="(level, index) in levels"
|
||||||
|
:key="level.id"
|
||||||
|
:label="index + 1 + '级:' + level.name || '未命名等级'"
|
||||||
|
:name="index"
|
||||||
|
>
|
||||||
|
<!-- 编辑会员等级参数 -->
|
||||||
|
<el-form :model="level" label-width="150px">
|
||||||
|
<el-form-item label="会员标题">
|
||||||
|
<el-input
|
||||||
|
v-model="level.name"
|
||||||
|
:style="inputStyle"
|
||||||
|
maxlength="30"
|
||||||
|
placeholder="请输入会员标题"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="所需成长值">
|
||||||
|
<el-input
|
||||||
|
v-model="level.experienceValue"
|
||||||
|
type="number"
|
||||||
|
placeholder="请输入所需成长值"
|
||||||
|
:style="inputStyle"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="会员折扣">
|
||||||
|
<el-input
|
||||||
|
v-model="level.discount"
|
||||||
|
:style="inputStyle"
|
||||||
|
type="number"
|
||||||
|
placeholder="请输入会员折扣"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="等级标识">
|
||||||
|
<div>
|
||||||
|
<!-- <small class="color-666">建议优先选择 jpg 格式,大小控制在 500k 以内</small> -->
|
||||||
|
<div class="flex">
|
||||||
|
<SingleImageUpload v-model="level.logo" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="消费送积分">
|
||||||
|
<div>
|
||||||
|
<el-switch
|
||||||
|
v-model="level.isCostRewardPoints"
|
||||||
|
:inactive-value="0"
|
||||||
|
:active-value="1"
|
||||||
|
/>
|
||||||
|
<!-- <el-radio-group v-model="level.isPointsEnabled">
|
||||||
|
<el-radio :value="true">已启用</el-radio>
|
||||||
|
<el-radio :value="false">已禁用</el-radio>
|
||||||
|
</el-radio-group> -->
|
||||||
|
<div
|
||||||
|
v-if="level.isCostRewardPoints"
|
||||||
|
style="margin-top: 10px"
|
||||||
|
class="color-666 flex"
|
||||||
|
>
|
||||||
|
<span class="no-wrap">每消耗</span>
|
||||||
|
<el-input
|
||||||
|
class="m-x-2"
|
||||||
|
v-model="level.costRewardPoints"
|
||||||
|
type="number"
|
||||||
|
placeholder="请输入内容"
|
||||||
|
/>
|
||||||
|
<span class="no-wrap">元赠送1积分</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="等级说明">
|
||||||
|
<el-input
|
||||||
|
v-model="level.remark"
|
||||||
|
style="width: 400px"
|
||||||
|
:autosize="{ minRows: 4, maxRows: 5 }"
|
||||||
|
type="textarea"
|
||||||
|
placeholder="请输入等级说明,最多 250 字"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="周期时间">
|
||||||
|
<div class="flex w-full gap-2">
|
||||||
|
<el-input
|
||||||
|
style="width: 140px"
|
||||||
|
v-model="level.cycleTime"
|
||||||
|
type="number"
|
||||||
|
placeholder="请输入周期时间"
|
||||||
|
/>
|
||||||
|
<el-select style="width: 80px" v-model="level.cycleUnit" placeholder="单位">
|
||||||
|
<el-option label="周" value="周" />
|
||||||
|
<el-option label="月" value="月" />
|
||||||
|
<el-option label="年" value="年" />
|
||||||
|
</el-select>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="自动发放">
|
||||||
|
<div>
|
||||||
|
<el-switch
|
||||||
|
v-model="level.isCycleReward"
|
||||||
|
:inactive-value="0"
|
||||||
|
:active-value="1"
|
||||||
|
/>
|
||||||
|
<!-- <el-radio-group v-model="level.isCycleReward">
|
||||||
|
<el-radio :value="true">已启用</el-radio>
|
||||||
|
<el-radio :value="false">已禁用</el-radio>
|
||||||
|
</el-radio-group> -->
|
||||||
|
<div v-if="level.isCycleReward" style="margin-top: 10px">
|
||||||
|
<!-- <div class="flex">
|
||||||
|
<span class="color-666 no-wrap mr-4">周期时间</span>
|
||||||
|
<el-input
|
||||||
|
v-model="level.cycleTime"
|
||||||
|
type="number"
|
||||||
|
placeholder="请输入周期时间"
|
||||||
|
/>
|
||||||
|
<el-select v-model="level.cycleUnit" placeholder="选择单位">
|
||||||
|
<el-option label="周" value="周" />
|
||||||
|
<el-option label="月" value="月" />
|
||||||
|
<el-option label="年" value="年" />
|
||||||
|
</el-select>
|
||||||
|
</div> -->
|
||||||
|
<div class="flex mt-4">
|
||||||
|
<span class="color-666 no-wrap mr-4">赠送积分</span>
|
||||||
|
<el-input
|
||||||
|
v-model="level.cycleRewardPoints"
|
||||||
|
type="number"
|
||||||
|
placeholder="赠送积分"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="flex mt-4" style="align-items: flex-start">
|
||||||
|
<span class="color-666 no-wrap mr-4">送优惠券</span>
|
||||||
|
<CouponLists v-model="level.cycleRewardCouponList" />
|
||||||
|
<!-- <el-select v-model="level.autoSendCoupon" placeholder="选择赠送优惠券">
|
||||||
|
<el-option
|
||||||
|
v-for="coupon in couponList"
|
||||||
|
:key="coupon.id"
|
||||||
|
:label="coupon.name"
|
||||||
|
:value="coupon.id"
|
||||||
|
/>
|
||||||
|
</el-select> -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div class="flex mt-10 justify-center gap-10">
|
||||||
|
<el-button
|
||||||
|
style="width: 100px"
|
||||||
|
type="primary"
|
||||||
|
@click="saveLevel(level)"
|
||||||
|
size="large"
|
||||||
|
>
|
||||||
|
保存
|
||||||
|
</el-button>
|
||||||
|
<el-button @click="close" style="width: 100px" size="large">取消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</template>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
|
||||||
|
<DialogPlans ref="refDialogPlans" @submitSuccess="submitSuccess"></DialogPlans>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import shopApi from "@/api/account/shop";
|
||||||
|
import memberApi from "@/api/market/member";
|
||||||
|
import HeaderCard from "../components/headerCard.vue";
|
||||||
|
import DialogPlans from "./components/dialog-plans.vue";
|
||||||
|
import CouponLists from "./components/coup-lists.vue";
|
||||||
|
import { ref, reactive, watch, toRaw, getCurrentInstance, onMounted } from "vue";
|
||||||
|
import { ElMessage } from "element-plus";
|
||||||
|
import { useRouter } from "vue-router";
|
||||||
|
|
||||||
|
const inputStyle = {
|
||||||
|
width: "340px",
|
||||||
|
};
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
//是否开启超级会员
|
||||||
|
const isOpenSuperVip = ref(false);
|
||||||
|
|
||||||
|
const refDialogPlans = ref();
|
||||||
|
const configs = [
|
||||||
|
{ name: "basic", label: "会员基础设置" },
|
||||||
|
{ name: "lv", label: "会员等级设置" },
|
||||||
|
{ name: "order", label: "购买会员订单" },
|
||||||
|
];
|
||||||
|
const activeTab = ref("basic");
|
||||||
|
const conditionLists = ref([
|
||||||
|
{ label: "绑定手机号", checked: false, code: "BIND_PHONE" },
|
||||||
|
{ label: "订单达成指定次数", checked: false, value: "", code: "ORDER" },
|
||||||
|
{ label: "消费达到指定金额", checked: false, value: "", cpde: "COST_AMOUNT" },
|
||||||
|
{ label: "充值达到指定金额", checked: false, value: "", code: "RECHARGE_AMOUNT" },
|
||||||
|
]);
|
||||||
|
const basicForm = reactive({
|
||||||
|
isSubmitInfo: 1,
|
||||||
|
openType: 0,
|
||||||
|
configList: [],
|
||||||
|
memberPriceShopType: "ALL",
|
||||||
|
remark: "",
|
||||||
|
costReward: 0,
|
||||||
|
rechargeReward: 0,
|
||||||
|
memberPriceShopIdList: [],
|
||||||
|
isMemberPrice: 1,
|
||||||
|
});
|
||||||
|
function deletePlan(row) {
|
||||||
|
const index = basicForm.configList.indexOf(row);
|
||||||
|
if (index > -1) {
|
||||||
|
basicForm.configList.splice(index, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function submitSuccess(plans, index) {
|
||||||
|
if (!basicForm.configList) {
|
||||||
|
basicForm.configList = [];
|
||||||
|
}
|
||||||
|
if (index !== null && index !== undefined) {
|
||||||
|
basicForm.configList[index] = plans;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
basicForm.configList.push(plans);
|
||||||
|
}
|
||||||
|
// 会员基础设置提交
|
||||||
|
function basicSubmit() {
|
||||||
|
const data = toRaw(basicForm);
|
||||||
|
// if (data.openType == "PAY") {
|
||||||
|
// data.conditionList = null;
|
||||||
|
// }
|
||||||
|
// if (data.openType == "CONDITION") {
|
||||||
|
// data.configList = null;
|
||||||
|
// }
|
||||||
|
memberApi.editConfig(data).then((res) => {
|
||||||
|
ElMessage.success("保存成功");
|
||||||
|
});
|
||||||
|
// ElMessage.success("保存成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 会员等级列表
|
||||||
|
const levels = ref([]);
|
||||||
|
|
||||||
|
// 当前选中的会员等级
|
||||||
|
const selectedLevel = ref(null);
|
||||||
|
|
||||||
|
// 优惠券列表
|
||||||
|
const couponList = ref([
|
||||||
|
{ id: 1, name: "满100减10" },
|
||||||
|
{ id: 2, name: "满200减30" },
|
||||||
|
]);
|
||||||
|
let activeLevelId = ref(null);
|
||||||
|
// 添加会员等级
|
||||||
|
function addLevel() {
|
||||||
|
const nowLastVip = levels.value[levels.value.length - 1];
|
||||||
|
let name = "VIP1";
|
||||||
|
if (levels.value.length) {
|
||||||
|
name = "VIP" + (levels.value.length + 1);
|
||||||
|
}
|
||||||
|
if (nowLastVip && !nowLastVip.id) {
|
||||||
|
ElMessage.error("请先保存当前等级");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const newLevel = {
|
||||||
|
name,
|
||||||
|
experienceValue: 0,
|
||||||
|
discount: 1,
|
||||||
|
logo: "",
|
||||||
|
costRewardPoints: 1,
|
||||||
|
isCostRewardPoints: 1,
|
||||||
|
isCycleReward: 0,
|
||||||
|
cycleTime: 1,
|
||||||
|
cycleUnit: "月",
|
||||||
|
cycleRewardPoints: 1,
|
||||||
|
cycleRewardCouponList: [],
|
||||||
|
};
|
||||||
|
console.log(newLevel);
|
||||||
|
levels.value.push(newLevel);
|
||||||
|
selectedLevel.value = newLevel;
|
||||||
|
activeLevelId.value = levels.value.length - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑会员等级
|
||||||
|
function editLevel(level) {
|
||||||
|
selectedLevel.value = level;
|
||||||
|
}
|
||||||
|
// 删除会员等级
|
||||||
|
async function removeLevel(index) {
|
||||||
|
const item = levels.value[index];
|
||||||
|
const { id } = item;
|
||||||
|
if (!id) {
|
||||||
|
// 本地删除
|
||||||
|
levels.value.splice(index, 1);
|
||||||
|
const newLevel = levels.value[index - 1];
|
||||||
|
selectedLevel.value = newLevel;
|
||||||
|
activeLevelId.value = index - 1;
|
||||||
|
ElMessage.success("删除成功");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ElMessageBox.confirm("确定要删除吗?", "提示", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning",
|
||||||
|
}).then(async () => {
|
||||||
|
const res = await memberApi.levelDel({ id: id });
|
||||||
|
if (res) {
|
||||||
|
levels.value.splice(index, 1);
|
||||||
|
ElMessage.success("删除成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
const newLevel = levels.value[index - 1];
|
||||||
|
selectedLevel.value = newLevel;
|
||||||
|
activeLevelId.value = index - 1;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 保存会员等级
|
||||||
|
async function saveLevel(level) {
|
||||||
|
const isPass = level.cycleRewardCouponList.every((item) => item.num && item.coupon.id);
|
||||||
|
if (!isPass) {
|
||||||
|
ElMessage.error("请选择优惠券并输入数量");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const res = level.id ? await memberApi.levelEdit(level) : await memberApi.levelAdd(level);
|
||||||
|
if (res) {
|
||||||
|
ElMessage.success("保存成功");
|
||||||
|
}
|
||||||
|
levelRefresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
const shops = ref([]);
|
||||||
|
|
||||||
|
async function levelRefresh() {
|
||||||
|
memberApi.levelList().then((res) => {
|
||||||
|
if (res && res.length) {
|
||||||
|
levels.value = res;
|
||||||
|
if (res.length != 0) {
|
||||||
|
selectedLevel.value = res[activeLevelId.value];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
async function init() {
|
||||||
|
shopApi.getBranchList().then((res) => {
|
||||||
|
console.log(res);
|
||||||
|
if (res) {
|
||||||
|
shops.value = res;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
memberApi.getConfig().then((res) => {
|
||||||
|
Object.assign(basicForm, res);
|
||||||
|
conditionLists.value = conditionLists.value.map((v) => {
|
||||||
|
const findItem = res.conditionList.find((cond) => cond.code == v.code);
|
||||||
|
if (findItem) {
|
||||||
|
v.value = findItem.value;
|
||||||
|
v.checked = true;
|
||||||
|
} else {
|
||||||
|
v.checked = false;
|
||||||
|
}
|
||||||
|
return v;
|
||||||
|
});
|
||||||
|
console.log(conditionLists.value);
|
||||||
|
});
|
||||||
|
memberApi.levelList().then((res) => {
|
||||||
|
if (res && res.length) {
|
||||||
|
levels.value = res;
|
||||||
|
activeLevelId.value = 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
init();
|
||||||
|
});
|
||||||
|
//计算总优惠券数量
|
||||||
|
function totalCount(arr) {
|
||||||
|
return arr.reduce((total, item) => {
|
||||||
|
return total + item.num * 1;
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
//返回
|
||||||
|
function close() {
|
||||||
|
router.back();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
:deep(.el-tabs--border-card) {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
:deep(.el-tabs--border-card > .el-tabs__header) {
|
||||||
|
border: none;
|
||||||
|
padding: 4px;
|
||||||
|
}
|
||||||
|
:deep(.el-tabs--border-card > .el-tabs__header .el-tabs__item) {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
:deep(.el-tabs--border-card > .el-tabs__header .el-tabs__item.is-active) {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue