add: 优化

This commit is contained in:
gyq 2025-09-29 09:01:52 +08:00
parent 205aeb1320
commit 312fd8d1bc
7 changed files with 1563 additions and 1162 deletions

View File

@ -3,48 +3,56 @@ const baseURL = "account/admin/shopInfo";
const ShopApi = {
/** 获取店铺列表*/
getList(params: PageQuery) {
getList(params : PageQuery) {
return request<any, ShopInfoEditDTO[]>({
url: `${baseURL}`,
method: "get",
params: params,
});
},
getBranchList(params: PageQuery) {
/** 获取店铺分店列表*/
getOtherShopList(params : PageQuery) {
return request<any, ShopInfoEditDTO[]>({
url: `${baseURL}/otherShop`,
method: "get",
params: params,
});
},
getBranchList(params : PageQuery) {
return request<any, ShopInfoEditDTO[]>({
url: `${baseURL}/branchList`,
method: "get",
params: params,
});
},
getBranchChange(id: PageQuery) {
getBranchChange(id : PageQuery) {
return request<any, ShopInfoEditDTO[]>({
url: `${baseURL}/change/${id}`,
method: "post",
});
},
add(data: ShopInfoEditDTO) {
add(data : ShopInfoEditDTO) {
return request<any, ShopInfoEditDTO>({
url: `${baseURL}`,
method: "post",
data,
});
},
edit(data: ShopInfoEditDTO) {
edit(data : ShopInfoEditDTO) {
return request<any, ShopInfoEditDTO>({
url: `${baseURL}`,
method: "put",
data,
});
},
get(params: getRequest) {
get(params : getRequest) {
return request<any, ShopInfo>({
url: `${baseURL}/detail`,
method: "get",
params
});
},
delete(params: any) {
delete(params : any) {
return request({
url: `${baseURL}`,
method: "delete",
@ -58,39 +66,39 @@ export interface getRequest {
/**
* id
*/
id?: string | number;
[property: string]: any;
id ?: string | number;
[property : string] : any;
}
/**
* ShopInfoEditDTO
*/
export interface ShopInfoEditDTO {
accountName?: null | string;
accountPwd?: null | string;
activateCode?: null | string;
address?: null | string;
chainName?: null | string;
detail?: null | string;
frontImg?: null | string;
id: number | null;
lat?: null | string;
lng?: null | string;
logo?: null | string;
phone?: null | string;
profiles?: null | string;
roleId?: number | null;
shopName?: null | string;
shopType?: null | string;
[property: string]: any;
accountName ?: null | string;
accountPwd ?: null | string;
activateCode ?: null | string;
address ?: null | string;
chainName ?: null | string;
detail ?: null | string;
frontImg ?: null | string;
id : number | null;
lat ?: null | string;
lng ?: null | string;
logo ?: null | string;
phone ?: null | string;
profiles ?: null | string;
roleId ?: number | null;
shopName ?: null | string;
shopType ?: null | string;
[property : string] : any;
}
export interface PageQuery {
page: number;
shopName?: string;
size: number;
status?: number;
[property: string]: any;
page : number;
shopName ?: string;
size : number;
status ?: number;
[property : string] : any;
}
@ -101,193 +109,193 @@ export interface ShopInfo {
/**
*
*/
address?: null | string;
address ?: null | string;
/**
*
*/
article?: null | string;
article ?: null | string;
/**
*
*/
backImg?: null | string;
backImg ?: null | string;
/**
*
*/
bindAccount?: null | string;
bindAccount ?: null | string;
/**
*
*/
bookingSms?: null | string;
bookingSms ?: null | string;
/**
* ()
*/
businessEndDay?: null | string;
businessEndDay ?: null | string;
/**
* ()
*/
businessStartDay?: null | string;
businessStartDay ?: null | string;
/**
*
*/
businessTime?: null | string;
businessTime ?: null | string;
/**
*
*/
chainName?: null | string;
chainName ?: null | string;
/**
*
*/
cities?: null | string;
cities ?: null | string;
/**
* all- vip-
*/
consumeColony?: null | string;
consumeColony ?: null | string;
/**
*
*/
contactName?: null | string;
contactName ?: null | string;
/**
*
*/
coverImg?: null | string;
createTime?: null | string;
coverImg ?: null | string;
createTime ?: null | string;
/**
*
*/
detail?: null | string;
detail ?: null | string;
/**
* /
*/
districts?: null | string;
districts ?: null | string;
/**
* dine-in take-out
*/
eatModel?: null | string;
eatModel ?: null | string;
/**
*
*/
expireTime?: null | string;
expireTime ?: null | string;
/**
*
*/
frontImg?: null | string;
frontImg ?: null | string;
/**
* 使 sys_user id
*/
id?: number | null;
id ?: number | null;
/**
*
*/
isAccountPay?: number | null;
isAccountPay ?: number | null;
/**
* 1 0
*/
isCustomAmount?: number | null;
isCustomAmount ?: number | null;
/**
* 1 0
*/
isMemberInPwd?: number | null;
isMemberInPwd ?: number | null;
/**
* 01
*/
isMemberPrice?: number | null;
isMemberPrice ?: number | null;
/**
* 退 1 0
*/
isMemberReturnPwd?: number | null;
isMemberReturnPwd ?: number | null;
/**
* 退 1 0
*/
isReturnPwd?: number | null;
isReturnPwd ?: number | null;
/**
* 01
*/
isTableFee?: number | null;
isTableFee ?: number | null;
/**
*
*/
lat?: null | string;
lat ?: null | string;
/**
*
*/
lng?: null | string;
lng ?: null | string;
/**
* logo
*/
logo?: null | string;
logo ?: null | string;
/**
* id
*/
mainId?: number | null;
mainId ?: number | null;
/**
* 0 1 2
*/
onSale?: number | null;
onSale ?: number | null;
/**
*
*/
operationPwd?: null | string;
operationPwd ?: null | string;
/**
*
*/
paymentQrcode?: null | string;
paymentQrcode ?: null | string;
/**
*
*/
phone?: null | string;
phone ?: null | string;
/**
* trial试用版release正式
*/
profiles?: null | string;
profiles ?: null | string;
/**
*
*/
provinces?: null | string;
registerType?: null | string;
provinces ?: null | string;
registerType ?: null | string;
/**
*
*/
sdType?: null | string;
sdType ?: null | string;
/**
*
*/
shopName?: null | string;
shopName ?: null | string;
/**
*
*/
shopQrcode?: null | string;
shopQrcode ?: null | string;
/**
* --only --chain--join type
*/
shopType?: null | string;
shopType ?: null | string;
/**
* ()
*/
smallQrcode?: null | string;
smallQrcode ?: null | string;
/**
* -1 0-1
*/
status?: number | null;
status ?: number | null;
/**
*
*/
subTitle?: null | string;
subTitle ?: null | string;
/**
*
*/
tableFee?: number | null;
tableFee ?: number | null;
/**
*
*/
tag?: null | string;
tag ?: null | string;
/**
*
*/
taxAmount?: null | string;
taxAmount ?: null | string;
/**
* 0 1, 1 0
*/
tubeType?: number | null;
updateTime?: null | string;
[property: string]: any;
tubeType ?: number | null;
updateTime ?: null | string;
[property : string] : any;
}

View File

@ -2,7 +2,7 @@ import request from "@/utils/request";
import { Market_BaseUrl } from "@/api/config";
const baseURL = Market_BaseUrl + "/admin/coupon";
const API = {
getList(params: any) {
getList(params : any) {
return request<any>({
url: `${baseURL}/page`,
method: "get",
@ -10,7 +10,7 @@ const API = {
});
},
//优惠券列表/已领取详情
getDetail(params: any) {
getDetail(params : any) {
return request<any>({
url: `${baseURL}/record`,
method: "get",
@ -18,7 +18,7 @@ const API = {
});
},
// 删除用户优惠券
delete(params: any) {
delete(params : any) {
return request({
url: `${baseURL}/deleteRecord`,
method: "delete",
@ -26,13 +26,20 @@ const API = {
});
},
//优惠券发放
giveCoupon(data: any) {
giveCoupon(data : any) {
return request<any>({
url: `${baseURL}/grant`,
method: "post",
data
});
},
//优惠券发放
getRecordByUser(params : any) {
return request<any>({
url: `${baseURL}/getRecordByUser`,
method: "get",
params
});
},
}
export default API;

View File

@ -8,7 +8,12 @@
v-model:isOpen="basicForm.isOpen"
></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">
<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">
@ -17,7 +22,9 @@
<el-radio :value="1"></el-radio>
<el-radio :value="0"></el-radio>
</el-radio-group>
<small class="color-999 m-l-6">*成为会员前需提交生日姓名性别信息</small>
<small class="color-999 m-l-6">
*成为会员前需提交生日姓名性别信息
</small>
</el-form-item>
<el-form-item label="会员开通方式">
<el-radio-group v-model="basicForm.openType">
@ -28,29 +35,48 @@
<!-- 购买开通 -->
<div v-if="basicForm.openType == 'PAY'">
<el-form-item label="会员周期列表">
<el-button type="primary" @click="refDialogPlans.open()">添加方案</el-button>
<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
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">
<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
type="text"
@click="
refDialogPlans.open(scope.row, scope.$index)
"
>
编辑
</el-button>
<el-button type="text" style="color: red" @click="deletePlan(scope.row)">
<el-button
type="text"
style="color: red"
@click="deletePlan(scope.row)"
>
删除
</el-button>
</template>
@ -62,8 +88,14 @@
<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>
<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"
@ -83,7 +115,10 @@
<el-radio value="PART">指定门店</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="选择门店" v-if="basicForm.memberPriceShopType == 'PART'">
<el-form-item
label="选择门店"
v-if="basicForm.memberPriceShopType == 'PART'"
>
<el-select
style="max-width: 600px"
v-model="basicForm.memberPriceShopIdList"
@ -146,7 +181,12 @@
</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
style="width: 100px"
type="primary"
@click="basicSubmit"
size="large"
>
保存
</el-button>
<el-button @click="close" style="width: 100px" size="large">取消</el-button>
@ -287,7 +327,10 @@
type="number"
placeholder="请输入周期时间"
/>
<el-select v-model="level.cycleUnit" placeholder="选择单位">
<el-select
v-model="level.cycleUnit"
placeholder="选择单位"
>
<el-option label="周" value="周" />
<el-option label="月" value="月" />
<el-option label="年" value="年" />
@ -306,7 +349,9 @@
</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" />
<CouponLists
v-model="level.cycleRewardCouponList"
/>
<!-- <el-select v-model="level.autoSendCoupon" placeholder="选择赠送优惠券">
<el-option
v-for="coupon in couponList"
@ -329,7 +374,9 @@
>
保存
</el-button>
<el-button @click="close" style="width: 100px" size="large">取消</el-button>
<el-button @click="close" style="width: 100px" size="large">
取消
</el-button>
</div>
</el-tab-pane>
</el-tabs>
@ -431,7 +478,10 @@ function basicSubmit() {
// data.configList = null;
// }
console.log(data);
if (basicForm.openType == "PAY" && (!basicForm.configList || basicForm.configList.length <= 0)) {
if (
basicForm.openType == "PAY" &&
(!basicForm.configList || basicForm.configList.length <= 0)
) {
return ElMessage.error("请添加会员方案");
}
data.conditionList = conditionLists.value
@ -598,6 +648,7 @@ async function init() {
});
memberApi.getConfig().then((res) => {
Object.assign(basicForm, res);
basicForm.isOpen = +basicForm.isOpen;
res.conditionList = res.conditionList || [];
res.configList = res.configList || [];
conditionLists.value = conditionLists.value.map((v) => {

View File

@ -1,6 +1,6 @@
<template>
<div class="container">
<div class="content">
<div class="gyq_container">
<div class="gyq_content">
<HeaderCard
name="智慧充值"
intro="允许客户充值并使用余额支付"
@ -294,9 +294,9 @@ onMounted(async () => {
</script>
<style scoped lang="scss">
.container {
.gyq_container {
padding: 14px;
.content {
.gyq_content {
padding: 14px;
background-color: #fff;
border-radius: 8px;

View File

@ -0,0 +1,326 @@
<template>
<div class="app-container">
<div class="head-container">
<el-row :gutter="20">
<el-col :span="3">
<el-input
v-model="state.query.name"
clearable
placeholder="请输入店铺名称"
style="width: 100%"
class="filter-item"
@keyup.enter="getTableData"
/>
</el-col>
<el-col :span="3">
<el-input
v-model="state.query.account"
clearable
placeholder="请输入商户号"
style="width: 100%"
class="filter-item"
@keyup.enter="getTableData"
/>
</el-col>
<el-col :span="3">
<el-select
v-model="state.query.status"
placeholder="请选择店铺状态"
style="width: 100%"
>
<el-option
v-for="item in state.status"
:key="item.type"
:label="item.label"
:value="item.type"
/>
</el-select>
</el-col>
<el-col :span="6">
<el-button type="primary" @click="getTableData">查询</el-button>
<el-button @click="resetHandle">重置</el-button>
</el-col>
</el-row>
</div>
<div class="head-container">
<el-button type="primary" icon="plus" @click="addShopShow">添加店铺</el-button>
</div>
<div class="head-container">
<el-table v-loading="state.tableData.loading" :data="state.tableData.list">
<el-table-column label="店铺信息" width="200">
<template v-slot="scope">
<div class="shop_info">
<el-image
:src="scope.row.logo"
style="
width: 50px;
height: 50px;
border-radius: 4px;
background-color: #efefef;
"
>
<template #error>
<div class="img_error">
<i class="icon el-icon-document-delete" />
</div>
</template>
</el-image>
<div class="info">
<span>{{ scope.row.shopName }}</span>
<div class="tag_wrap">
<el-tag
v-if="scope.row.profiles == 'no'"
type="info"
effect="dark"
>
未激活
</el-tag>
<el-tag
v-if="scope.row.profiles == 'probation'"
type="warning"
effect="dark"
>
试用
</el-tag>
<el-tag
v-if="scope.row.profiles == 'release'"
type="success"
effect="dark"
>
正式
</el-tag>
<el-tag
v-if="scope.row.isWxMaIndependent"
type="primary"
effect="dark"
>
独立小程序
</el-tag>
</div>
</div>
</div>
</template>
</el-table-column>
<el-table-column prop="registerType" label="经营模式">
<template v-slot="scope">
<span v-if="scope.row.registerType == 'before'">快餐版</span>
<span v-if="scope.row.registerType == 'after'">餐饮版</span>
</template>
</el-table-column>
<el-table-column prop="address" label="商户号" />
<el-table-column prop="status" label="店铺类型" align="center">
<template v-slot="scope">
<div>
<span v-if="scope.row.shopType == 'only'">单店</span>
<span v-if="scope.row.shopType == 'chain'">连锁店</span>
<span v-if="scope.row.shopType == 'join'">加盟店</span>
<div v-if="scope.row.shopType != 'only' && scope.row.isHeadShop == 0">
(主店{{ scope.row.headShopName }})
</div>
</div>
</template>
</el-table-column>
<el-table-column prop="status" label="店铺状态">
<template v-slot="scope">
<el-switch
v-model="scope.row.status"
:active-value="1"
:inactive-value="0"
disabled
/>
</template>
</el-table-column>
<el-table-column prop="createdAt" label="到期时间">
<template v-slot="scope">
<span v-if="scope.row.expireTime">
{{ dayjs(scope.row.expireTime).format("YYYY-MM-DD HH:mm:ss") }}
</span>
</template>
</el-table-column>
<el-table-column label="操作" width="200">
<template v-slot="scope">
<el-link @click="addShopShow(scope.row)">
<el-icon>
<Edit />
</el-icon>
编辑
</el-link>
<el-link @click="activateCodeShow(scope.row)">
<el-icon>
<Edit />
</el-icon>
激活
</el-link>
<el-dropdown @command="dropdownClick($event, scope.row)">
<el-link>
更多
<el-icon>
<ArrowDown />
</el-icon>
</el-link>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item v-if="scope.row.isHeadShop == 1" :command="0">
添加分店
</el-dropdown-item>
<el-dropdown-item :command="{ row: scope.row, command: 1 }">
三方配置
</el-dropdown-item>
<el-dropdown-item :command="2">续费记录</el-dropdown-item>
<el-dropdown-item :command="3">前往店铺</el-dropdown-item>
<el-dropdown-item :command="4">重置密码</el-dropdown-item>
<el-dropdown-item divided :command="5">删除</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</template>
</el-table-column>
</el-table>
</div>
<div class="head-container">
<el-pagination
v-model:current-page="state.tableData.page"
v-model:page-size="state.tableData.size"
:total="state.tableData.total"
:page-sizes="[10, 20, 30, 50, 100]"
layout="total, sizes , prev, pager ,next, jumper "
@current-change="paginationChange"
/>
</div>
<addShop ref="refAddShop" @success="getTableData" />
<detailModal ref="refDetailModal" />
<!-- 激活码 -->
<activateCode ref="refActivateCode" @success="getTableData" />
</div>
</template>
<script setup>
import activateCode from "./components/activateCode.vue";
import dayjs from "dayjs";
import ShopApi from "@/api/account/shop";
import { ElNotification, ElMessageBox } from "element-plus";
import addShop from "./components/addShop.vue";
import detailModal from "./components/detailModal.vue";
const refActivateCode = ref(null);
function activateCodeShow(row) {
refActivateCode.value.open(row);
}
const refAddShop = ref(null);
function addShopShow(row) {
refAddShop.value.show(row);
}
const state = reactive({
query: {
name: "",
account: "",
status: "",
},
status: [
{
type: 1,
label: "开启",
},
{
type: 0,
label: "关闭",
},
],
tableData: {
list: [],
page: 1,
size: 10,
loading: false,
total: 0,
},
});
onMounted(() => {
getTableData();
});
const refDetailModal = ref(null);
function dropdownClick(e, row) {
console.log(e);
console.log(row);
if (e == 0) {
refAddShop.value.show(
{ mainId: row.id, shopType: row.shopType, isHeadShop: 0 },
"addBranch"
);
return;
}
if (e.command == 1) {
refDetailModal.value.show(e.row);
return;
}
if (e == 5) {
ElMessageBox.confirm("是否确认删除该店铺?", "提示", {
confirmButtonText: "确认",
cancelButtonText: "取消",
type: "warning",
})
.then(async () => {
const res = await ShopApi.delete({ id: row.id });
ElMessage({
type: "success",
message: "删除成功",
});
getTableData();
})
.catch(() => {});
return;
}
}
//
function resetHandle() {
state.query.name = "";
state.query.account = "";
state.query.status = "";
getTableData();
}
//
function paginationChange(e) {
state.tableData.page = e;
getTableData();
}
//
async function getTableData() {
state.tableData.loading = true;
try {
const res = await ShopApi.getOtherShopList({
page: state.tableData.page,
size: state.tableData.size,
shopName: state.query.name,
account: state.query.account,
status: state.query.status,
});
state.tableData.loading = false;
state.tableData.list = res.records;
state.tableData.total = res.totalRow * 1;
} catch (error) {
console.log(error);
}
}
</script>
<style scoped lang="scss">
.head-container {
margin-bottom: 20px;
}
.shop_info {
display: flex;
.info {
flex: 1;
padding-left: 4px;
}
}
.el-link {
min-height: 23px;
margin: 0 5px;
}
</style>

View File

@ -86,7 +86,7 @@ const form = reactive({
status: 0,
name: "",
date: "",
userId: "",
shopUserId: "",
page: 1,
});
const tableData = ref([]);
@ -97,7 +97,7 @@ const pagination = reactive({
});
function open(data) {
console.log(data);
form.userId = data.userId;
form.shopUserId = data.id;
pagination.page = 1;
visible.value = true;
getList();
@ -106,7 +106,7 @@ function close() {
visible.value = false;
}
function getList() {
couponApi.getDetail({ ...form, ...pagination }).then((res) => {
couponApi.getRecordByUser({ ...form, ...pagination }).then((res) => {
console.log(res);
tableData.value = res.records;
pagination.total = res.totalRow;

View File

@ -64,7 +64,13 @@
: 'warning'
"
>
{{ scope.row[scope.prop] === null ? "未知" : scope.row[scope.prop] == 1 ? "男" : "女" }}
{{
scope.row[scope.prop] === null
? "未知"
: scope.row[scope.prop] == 1
? "男"
: "女"
}}
</el-tag>
</template>
<template #user="scope">
@ -89,7 +95,7 @@
<template #coupon="scope">
<div>
1
{{ scope.row.couponNum }}
<el-link :underline="false" type="primary" @click="handleViewCoupon(scope.row)">
查看详情
</el-link>
@ -125,7 +131,7 @@
</div>
</template>
<script setup >
<script setup>
import UserCouponDialog from "./components/user-coupon-dialog.vue";
import GiveCoupon from "./components/give-coupon.vue";
import usePage from "@/components/CURD/usePage";
@ -225,7 +231,10 @@ async function handleOperatClick(data) {
if (data.name == "more") {
if (data.command === "change-money") {
editMoneyModalRef.value.setModalVisible();
editMoneyModalRef.value.setFormData({ ...row, headImg: row.headImg ? [row.headImg] : "" });
editMoneyModalRef.value.setFormData({
...row,
headImg: row.headImg ? [row.headImg] : "",
});
return;
}
if (data.command === "charge-list") {