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

@ -2,95 +2,103 @@ import request from "@/utils/request";
const baseURL = "account/admin/shopInfo"; const baseURL = "account/admin/shopInfo";
const ShopApi = { const ShopApi = {
/** 获取店铺列表*/ /** 获取店铺列表*/
getList(params: PageQuery) { getList(params : PageQuery) {
return request<any, ShopInfoEditDTO[]>({ return request<any, ShopInfoEditDTO[]>({
url: `${baseURL}`, url: `${baseURL}`,
method: "get", method: "get",
params: params, params: params,
}); });
}, },
getBranchList(params: PageQuery) { /** 获取店铺分店列表*/
return request<any, ShopInfoEditDTO[]>({ getOtherShopList(params : PageQuery) {
url: `${baseURL}/branchList`, return request<any, ShopInfoEditDTO[]>({
method: "get", url: `${baseURL}/otherShop`,
params: params, method: "get",
}); params: params,
}, });
getBranchChange(id: PageQuery) { },
return request<any, ShopInfoEditDTO[]>({ getBranchList(params : PageQuery) {
url: `${baseURL}/change/${id}`, return request<any, ShopInfoEditDTO[]>({
method: "post", url: `${baseURL}/branchList`,
}); method: "get",
}, params: params,
add(data: ShopInfoEditDTO) { });
return request<any, ShopInfoEditDTO>({ },
url: `${baseURL}`, getBranchChange(id : PageQuery) {
method: "post", return request<any, ShopInfoEditDTO[]>({
data, url: `${baseURL}/change/${id}`,
}); method: "post",
}, });
edit(data: ShopInfoEditDTO) { },
return request<any, ShopInfoEditDTO>({ add(data : ShopInfoEditDTO) {
url: `${baseURL}`, return request<any, ShopInfoEditDTO>({
method: "put", url: `${baseURL}`,
data, method: "post",
}); data,
}, });
get(params: getRequest) { },
return request<any, ShopInfo>({ edit(data : ShopInfoEditDTO) {
url: `${baseURL}/detail`, return request<any, ShopInfoEditDTO>({
method: "get", url: `${baseURL}`,
params method: "put",
}); data,
}, });
delete(params: any) { },
return request({ get(params : getRequest) {
url: `${baseURL}`, return request<any, ShopInfo>({
method: "delete", url: `${baseURL}/detail`,
params, method: "get",
}); params
}, });
},
delete(params : any) {
return request({
url: `${baseURL}`,
method: "delete",
params,
});
},
}; };
export default ShopApi; export default ShopApi;
export interface getRequest { export interface getRequest {
/** /**
* id * id
*/ */
id?: string | number; id ?: string | number;
[property: string]: any; [property : string] : any;
} }
/** /**
* ShopInfoEditDTO * ShopInfoEditDTO
*/ */
export interface ShopInfoEditDTO { export interface ShopInfoEditDTO {
accountName?: null | string; accountName ?: null | string;
accountPwd?: null | string; accountPwd ?: null | string;
activateCode?: null | string; activateCode ?: null | string;
address?: null | string; address ?: null | string;
chainName?: null | string; chainName ?: null | string;
detail?: null | string; detail ?: null | string;
frontImg?: null | string; frontImg ?: null | string;
id: number | null; id : number | null;
lat?: null | string; lat ?: null | string;
lng?: null | string; lng ?: null | string;
logo?: null | string; logo ?: null | string;
phone?: null | string; phone ?: null | string;
profiles?: null | string; profiles ?: null | string;
roleId?: number | null; roleId ?: number | null;
shopName?: null | string; shopName ?: null | string;
shopType?: null | string; shopType ?: null | string;
[property: string]: any; [property : string] : any;
} }
export interface PageQuery { export interface PageQuery {
page: number; page : number;
shopName?: string; shopName ?: string;
size: number; size : number;
status?: number; status ?: number;
[property: string]: any; [property : string] : any;
} }
@ -98,196 +106,196 @@ export interface PageQuery {
* ShopInfo * ShopInfo
*/ */
export interface ShopInfo { 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- * all- vip-
*/ */
consumeColony?: null | string; consumeColony ?: null | string;
/** /**
* *
*/ */
contactName?: null | string; contactName ?: null | string;
/** /**
* *
*/ */
coverImg?: null | string; coverImg ?: null | string;
createTime?: null | string; createTime ?: null | string;
/** /**
* *
*/ */
detail?: null | string; detail ?: null | string;
/** /**
* / * /
*/ */
districts?: null | string; districts ?: null | string;
/** /**
* dine-in take-out * 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 * 使 sys_user id
*/ */
id?: number | null; id ?: number | null;
/** /**
* *
*/ */
isAccountPay?: number | null; isAccountPay ?: number | null;
/** /**
* 1 0 * 1 0
*/ */
isCustomAmount?: number | null; isCustomAmount ?: number | null;
/** /**
* 1 0 * 1 0
*/ */
isMemberInPwd?: number | null; isMemberInPwd ?: number | null;
/** /**
* 01 * 01
*/ */
isMemberPrice?: number | null; isMemberPrice ?: number | null;
/** /**
* 退 1 0 * 退 1 0
*/ */
isMemberReturnPwd?: number | null; isMemberReturnPwd ?: number | null;
/** /**
* 退 1 0 * 退 1 0
*/ */
isReturnPwd?: number | null; isReturnPwd ?: number | null;
/** /**
* 01 * 01
*/ */
isTableFee?: number | null; isTableFee ?: number | null;
/** /**
* *
*/ */
lat?: null | string; lat ?: null | string;
/** /**
* *
*/ */
lng?: null | string; lng ?: null | string;
/** /**
* logo * logo
*/ */
logo?: null | string; logo ?: null | string;
/** /**
* id * id
*/ */
mainId?: number | null; mainId ?: number | null;
/** /**
* 0 1 2 * 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正式 * trial试用版release正式
*/ */
profiles?: null | string; profiles ?: null | string;
/** /**
* *
*/ */
provinces?: null | string; provinces ?: null | string;
registerType?: 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 * --only --chain--join type
*/ */
shopType?: null | string; shopType ?: null | string;
/** /**
* () * ()
*/ */
smallQrcode?: null | string; smallQrcode ?: null | string;
/** /**
* -1 0-1 * -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 * 0 1, 1 0
*/ */
tubeType?: number | null; tubeType ?: number | null;
updateTime?: null | string; updateTime ?: null | string;
[property: string]: any; [property : string] : any;
} }

View File

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

File diff suppressed because it is too large Load Diff

View File

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

@ -1,74 +1,74 @@
<template> <template>
<div> <div>
<el-dialog title="优惠券" v-model="visible" width="80%"> <el-dialog title="优惠券" v-model="visible" width="80%">
<el-form :inline="true" :model="form"> <el-form :inline="true" :model="form">
<el-form-item label="券名称"> <el-form-item label="券名称">
<el-input v-model="form.name" placeholder="请输入券名称"></el-input> <el-input v-model="form.name" placeholder="请输入券名称"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="状态"> <el-form-item label="状态">
<el-select v-model="form.status" placeholder="请选择" style="width: 140px"> <el-select v-model="form.status" placeholder="请选择" style="width: 140px">
<el-option <el-option
v-for="item in status" v-for="item in status"
:key="item.value" :key="item.value"
:label="item.label" :label="item.label"
:value="item.value" :value="item.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="领取时间"> <el-form-item label="领取时间">
<el-date-picker <el-date-picker
v-model="form.date" v-model="form.date"
type="daterange" type="daterange"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
range-separator="至" range-separator="至"
start-placeholder="开始日期" start-placeholder="开始日期"
end-placeholder="结束日期" end-placeholder="结束日期"
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" @click="handleSearch">搜索</el-button> <el-button type="primary" @click="handleSearch">搜索</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table <el-table
style="width: 100%" style="width: 100%"
:data="tableData" :data="tableData"
:columns="columns" :columns="columns"
:pagination="pagination" :pagination="pagination"
:row-key="getRowKey" :row-key="getRowKey"
> >
<el-table-column prop="id" label="券ID" /> <el-table-column prop="id" label="券ID" />
<el-table-column prop="name" label="券名称" /> <el-table-column prop="name" label="券名称" />
<!-- <el-table-column prop="type" label="券类型" /> --> <!-- <el-table-column prop="type" label="券类型" /> -->
<el-table-column prop="createTime" label="领取时间" /> <el-table-column prop="createTime" label="领取时间" />
<el-table-column prop="useTime" label="使用时间" /> <el-table-column prop="useTime" label="使用时间" />
<el-table-column prop="source" label="领取来源" /> <el-table-column prop="source" label="领取来源" />
<el-table-column label="操作"> <el-table-column label="操作">
<template #default="scope"> <template #default="scope">
<el-link :underline="false" type="primary" size="mini">查看</el-link> <el-link :underline="false" type="primary" size="mini">查看</el-link>
<el-link <el-link
:underline="false" :underline="false"
type="danger" type="danger"
class="ml-4" class="ml-4"
@click="deleteCoupon(scope.row)" @click="deleteCoupon(scope.row)"
size="mini" size="mini"
> >
删除 删除
</el-link> </el-link>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<el-pagination <el-pagination
v-model:current-page="pagination.page" v-model:current-page="pagination.page"
v-model:page-size="pagination.size" v-model:page-size="pagination.size"
:total="pagination.total" :total="pagination.total"
layout="total, sizes, prev, pager, next, jumper" layout="total, sizes, prev, pager, next, jumper"
@current-change="getList" @current-change="getList"
@size-change="getList" @size-change="getList"
/> />
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script setup> <script setup>
@ -76,57 +76,57 @@ import couponApi from "@/api/market/coupon";
import { ref, reactive } from "vue"; import { ref, reactive } from "vue";
const status = [ const status = [
{ label: "全部", value: "" }, { label: "全部", value: "" },
{ label: "未使用", value: 0 }, { label: "未使用", value: 0 },
{ label: "已使用", value: 1 }, { label: "已使用", value: 1 },
{ label: "已过期", value: 2 }, { label: "已过期", value: 2 },
]; ];
const visible = ref(false); const visible = ref(false);
const form = reactive({ const form = reactive({
status: 0, status: 0,
name: "", name: "",
date: "", date: "",
userId: "", shopUserId: "",
page: 1, page: 1,
}); });
const tableData = ref([]); const tableData = ref([]);
const pagination = reactive({ const pagination = reactive({
total: 0, total: 0,
size: 10, size: 10,
page: 1, page: 1,
}); });
function open(data) { function open(data) {
console.log(data); console.log(data);
form.userId = data.userId; form.shopUserId = data.id;
pagination.page = 1; pagination.page = 1;
visible.value = true; visible.value = true;
getList(); getList();
} }
function close() { function close() {
visible.value = false; visible.value = false;
} }
function getList() { function getList() {
couponApi.getDetail({ ...form, ...pagination }).then((res) => { couponApi.getRecordByUser({ ...form, ...pagination }).then((res) => {
console.log(res); console.log(res);
tableData.value = res.records; tableData.value = res.records;
pagination.total = res.totalRow; pagination.total = res.totalRow;
}); });
} }
function deleteCoupon(row) { function deleteCoupon(row) {
couponApi couponApi
.delete({ .delete({
id: row.id, id: row.id,
}) })
.then((res) => { .then((res) => {
if (res.code === 200) { if (res.code === 200) {
ElMessage.success("删除成功"); ElMessage.success("删除成功");
getList(); getList();
} }
}); });
} }
defineExpose({ defineExpose({
open, open,
close, close,
}); });
</script> </script>

View File

@ -1,131 +1,137 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 列表 --> <!-- 列表 -->
<!-- 搜索 --> <!-- 搜索 -->
<page-search <page-search
ref="searchRef" ref="searchRef"
:search-config="searchConfig" :search-config="searchConfig"
@query-click="searchQueryClick" @query-click="searchQueryClick"
@reset-click="handleResetClick" @reset-click="handleResetClick"
/> />
<div class="head-container"> <div class="head-container">
<div class="card"> <div class="card">
<!-- <div class="title">统计数据</div> --> <!-- <div class="title">统计数据</div> -->
<div class="row"> <div class="row">
<div class="item"> <div class="item">
<div class="t">用户数量</div> <div class="t">用户数量</div>
<div class="n">{{ summary.userTotal || 0 }}</div> <div class="n">{{ summary.userTotal || 0 }}</div>
</div> </div>
<div class="item"> <div class="item">
<div class="t">用户总余额</div> <div class="t">用户总余额</div>
<div class="n">{{ summary.balanceTotal || 0 }}</div> <div class="n">{{ summary.balanceTotal || 0 }}</div>
</div> </div>
<div class="item"> <div class="item">
<div class="t">充值金额</div> <div class="t">充值金额</div>
<div class="n">{{ summary.chargeTotal || 0 }}</div> <div class="n">{{ summary.chargeTotal || 0 }}</div>
</div> </div>
<div class="item u-flex u-col-center"> <div class="item u-flex u-col-center">
<el-button type="success" @click="toCharge()">充值记录</el-button> <el-button type="success" @click="toCharge()">充值记录</el-button>
<!-- <el-button type="danger" @click="toCharge('cost')">消费记录</el-button> --> <!-- <el-button type="danger" @click="toCharge('cost')">消费记录</el-button> -->
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- 列表 --> <!-- 列表 -->
<page-content <page-content
ref="contentRef" ref="contentRef"
:content-config="contentConfig" :content-config="contentConfig"
@add-click="handleAddClick" @add-click="handleAddClick"
@edit-click="handleEditClick" @edit-click="handleEditClick"
@export-click="handleExportClick" @export-click="handleExportClick"
@search-click="handleSearchClick" @search-click="handleSearchClick"
@toolbar-click="handleToolbarClick" @toolbar-click="handleToolbarClick"
@operat-click="handleOperatClick" @operat-click="handleOperatClick"
@filter-change="handleFilterChange" @filter-change="handleFilterChange"
> >
<template #status="scope"> <template #status="scope">
<el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'"> <el-tag :type="scope.row[scope.prop] == 1 ? 'success' : 'info'">
{{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }} {{ scope.row[scope.prop] == 1 ? "启用" : "禁用" }}
</el-tag> </el-tag>
</template> </template>
<template #options="scope"> <template #options="scope">
{{ returnOptionsLabel(scope.prop, scope.row[scope.prop]) }} {{ returnOptionsLabel(scope.prop, scope.row[scope.prop]) }}
</template> </template>
<template #bol="scope"> <template #bol="scope">
{{ scope.row[scope.prop] ? "是" : "否" }} {{ scope.row[scope.prop] ? "是" : "否" }}
</template> </template>
<template #gender="scope"> <template #gender="scope">
<el-tag <el-tag
:type=" :type="
scope.row[scope.prop] == null scope.row[scope.prop] == null
? 'info' ? 'info'
: scope.row[scope.prop] == 1 : scope.row[scope.prop] == 1
? 'success' ? 'success'
: 'warning' : 'warning'
" "
> >
{{ scope.row[scope.prop] === null ? "未知" : scope.row[scope.prop] == 1 ? "男" : "女" }} {{
</el-tag> scope.row[scope.prop] === null
</template> ? "未知"
<template #user="scope"> : scope.row[scope.prop] == 1
<div class="flex align-center"> ? "男"
<el-avatar :src="scope.row.headImg" /> : "女"
<span class="u-line-1 u-m-l-6" style="max-width: 90px"> }}
{{ scope.row.nickName }} </el-tag>
</span> </template>
</div> <template #user="scope">
</template> <div class="flex align-center">
<template #link="scope"> <el-avatar :src="scope.row.headImg" />
<el-link>{{ scope.row[scope.prop] }}</el-link> <span class="u-line-1 u-m-l-6" style="max-width: 90px">
</template> {{ scope.row.nickName }}
<template #mobile="scope"> </span>
<el-text>{{ scope.row[scope.prop] }}</el-text> </div>
<copy-button </template>
v-if="scope.row[scope.prop]" <template #link="scope">
:text="scope.row[scope.prop]" <el-link>{{ scope.row[scope.prop] }}</el-link>
style="margin-left: 2px" </template>
/> <template #mobile="scope">
</template> <el-text>{{ scope.row[scope.prop] }}</el-text>
<copy-button
v-if="scope.row[scope.prop]"
:text="scope.row[scope.prop]"
style="margin-left: 2px"
/>
</template>
<template #coupon="scope"> <template #coupon="scope">
<div> <div>
1 {{ scope.row.couponNum }}
<el-link :underline="false" type="primary" @click="handleViewCoupon(scope.row)"> <el-link :underline="false" type="primary" @click="handleViewCoupon(scope.row)">
查看详情 查看详情
</el-link> </el-link>
</div> </div>
</template> </template>
</page-content> </page-content>
<!-- 新增 --> <!-- 新增 -->
<page-modal <page-modal
ref="addModalRef" ref="addModalRef"
:modal-config="addModalConfig" :modal-config="addModalConfig"
@submit-click="handleSubmitClick" @submit-click="handleSubmitClick"
></page-modal> ></page-modal>
<!-- 编辑 --> <!-- 编辑 -->
<page-modal <page-modal
ref="editModalRef" ref="editModalRef"
:modal-config="editModalConfig" :modal-config="editModalConfig"
@submit-click="handleSubmitClick" @submit-click="handleSubmitClick"
></page-modal> ></page-modal>
<!-- 用户余额修改 --> <!-- 用户余额修改 -->
<page-modal <page-modal
ref="editMoneyModalRef" ref="editMoneyModalRef"
:modal-config="editMoneyModalConfig" :modal-config="editMoneyModalConfig"
@formDataChange="formDataChange" @formDataChange="formDataChange"
@submit-click="handleSubmitClick" @submit-click="handleSubmitClick"
></page-modal> ></page-modal>
<!-- 用户优惠券详情 --> <!-- 用户优惠券详情 -->
<UserCouponDialog ref="userCouponDialogRef"></UserCouponDialog> <UserCouponDialog ref="userCouponDialogRef"></UserCouponDialog>
<!-- 赠送券 --> <!-- 赠送券 -->
<GiveCoupon ref="GiveCouponRef"></GiveCoupon> <GiveCoupon ref="GiveCouponRef"></GiveCoupon>
</div> </div>
</template> </template>
<script setup > <script setup>
import UserCouponDialog from "./components/user-coupon-dialog.vue"; import UserCouponDialog from "./components/user-coupon-dialog.vue";
import GiveCoupon from "./components/give-coupon.vue"; import GiveCoupon from "./components/give-coupon.vue";
import usePage from "@/components/CURD/usePage"; import usePage from "@/components/CURD/usePage";
@ -141,143 +147,146 @@ const userCouponDialogRef = ref(null);
const GiveCouponRef = ref(null); const GiveCouponRef = ref(null);
// //
function handleViewCoupon(row) { function handleViewCoupon(row) {
userCouponDialogRef.value.open(row); userCouponDialogRef.value.open(row);
} }
const { const {
searchRef, searchRef,
contentRef, contentRef,
addModalRef, addModalRef,
editModalRef, editModalRef,
handleQueryClick, handleQueryClick,
handleResetClick, handleResetClick,
// handleAddClick, // handleAddClick,
// handleEditClick, // handleEditClick,
handleSubmitClick, handleSubmitClick,
handleExportClick, handleExportClick,
handleSearchClick, handleSearchClick,
handleFilterChange, handleFilterChange,
} = usePage(); } = usePage();
function searchQueryClick(e) { function searchQueryClick(e) {
handleQueryClick(e); handleQueryClick(e);
// //
getSummary(); getSummary();
} }
const summary = reactive({ const summary = reactive({
userTotal: 0, userTotal: 0,
chargeTotal: 0, chargeTotal: 0,
balanceTotal: 0.0, balanceTotal: 0.0,
}); });
const router = useRouter(); const router = useRouter();
// //
function toCharge(params) { function toCharge(params) {
console.log(params); console.log(params);
router.push({ path: "/user/charge-list", query: { ...params } }); router.push({ path: "/user/charge-list", query: { ...params } });
} }
async function getSummary(e) { async function getSummary(e) {
// //
const res = await shopUserApi.getSummary(e); const res = await shopUserApi.getSummary(e);
console.log(res); console.log(res);
Object.assign(summary, res); Object.assign(summary, res);
} }
// //
function formDataChange(type, val) { function formDataChange(type, val) {
if (type == "type") { if (type == "type") {
if (val == 1) { if (val == 1) {
editMoneyModalConfig.formItems[4].options = addOptions; editMoneyModalConfig.formItems[4].options = addOptions;
} else { } else {
editMoneyModalConfig.formItems[4].options = reduceOptions; editMoneyModalConfig.formItems[4].options = reduceOptions;
} }
} }
} }
// //
async function handleAddClick() { async function handleAddClick() {
addModalRef.value?.setModalVisible(); addModalRef.value?.setModalVisible();
// //
// addModalConfig.formItems[2]!.attrs!.data = await DeptAPI.getOptions(); // addModalConfig.formItems[2]!.attrs!.data = await DeptAPI.getOptions();
// //
// addModalConfig.formItems[4]!.options = await RoleAPI.getOptions(); // addModalConfig.formItems[4]!.options = await RoleAPI.getOptions();
} }
// //
async function handleEditClick(row) { async function handleEditClick(row) {
editModalRef.value?.handleDisabled(false); editModalRef.value?.handleDisabled(false);
editModalRef.value?.setModalVisible(); editModalRef.value?.setModalVisible();
// id // id
// const data = await VersionApi.getFormData(row.id); // const data = await VersionApi.getFormData(row.id);
editModalRef.value?.setFormData({ ...row, headImg: row.headImg ? [row.headImg] : "" }); editModalRef.value?.setFormData({ ...row, headImg: row.headImg ? [row.headImg] : "" });
} }
// //
function handleToolbarClick(name) { function handleToolbarClick(name) {
console.log(name); console.log(name);
if (name === "custom1") { if (name === "custom1") {
ElMessage.success("点击了自定义1按钮"); ElMessage.success("点击了自定义1按钮");
} }
} }
// //
function toGiveCoupon() {} function toGiveCoupon() {}
// //
async function handleOperatClick(data) { async function handleOperatClick(data) {
const row = data.row; const row = data.row;
if (data.name == "more") { if (data.name == "more") {
if (data.command === "change-money") { if (data.command === "change-money") {
editMoneyModalRef.value.setModalVisible(); editMoneyModalRef.value.setModalVisible();
editMoneyModalRef.value.setFormData({ ...row, headImg: row.headImg ? [row.headImg] : "" }); editMoneyModalRef.value.setFormData({
return; ...row,
} headImg: row.headImg ? [row.headImg] : "",
if (data.command === "charge-list") { });
console.log(data); return;
toCharge({ userId: data.row.userId }); }
return; if (data.command === "charge-list") {
} console.log(data);
if (data.command === "give-coupon") { toCharge({ userId: data.row.userId });
GiveCouponRef.value.open(row); return;
return; }
} if (data.command === "give-coupon") {
return; GiveCouponRef.value.open(row);
} return;
}
return;
}
} }
onMounted(() => { onMounted(() => {
getSummary(searchRef.value.getQueryParams()); getSummary(searchRef.value.getQueryParams());
}); });
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.align-center { .align-center {
align-items: center; align-items: center;
} }
.card { .card {
background-color: #f5f5f5; background-color: #f5f5f5;
padding: 0 14px; padding: 0 14px;
.title { .title {
font-size: 22px; font-size: 22px;
padding-top: 14px; padding-top: 14px;
} }
.row { .row {
display: flex; display: flex;
padding: 20px 0; padding: 20px 0;
.item { .item {
flex: 1; flex: 1;
.t { .t {
text-align: center; text-align: center;
color: #555; color: #555;
} }
.n { .n {
color: #000; color: #000;
font-size: 20px; font-size: 20px;
font-weight: bold; font-weight: bold;
padding-top: 6px; padding-top: 6px;
text-align: center; text-align: center;
} }
} }
} }
} }
</style> </style>