shop-front-end/src/views/user/qy/index.vue

202 lines
5.0 KiB
Vue
Raw Normal View History

2025-03-31 09:41:56 +08:00
<script setup lang="ts">
import { ref, watch } from "vue";
import tree from "./tree.vue";
import { useHook } from "./hook";
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
2025-04-02 09:34:17 +08:00
import BalanceEditModal from "./BalanceEditModal.vue";
2025-03-31 09:41:56 +08:00
import Search from "@iconify-icons/ep/search";
import Refresh from "@iconify-icons/ep/refresh";
import View from "@iconify-icons/ep/view";
2025-03-31 09:41:56 +08:00
defineOptions({
name: "QyUser"
});
const formRef = ref();
const {
searchFormParams,
2025-04-02 09:34:17 +08:00
onSearch,
2025-03-31 09:41:56 +08:00
pageLoading,
dataList,
pagination,
getList,
2025-04-02 09:34:17 +08:00
resetForm,
handleViewDetail,
handleModifyBalance,
balanceVisible,
selectedUser
2025-03-31 09:41:56 +08:00
} = useHook();
watch(
() => searchFormParams.mainDepartment,
() => {
onSearch();
}
);
</script>
<template>
<div class="main">
<tree class="w-[17%] float-left" v-model="searchFormParams.mainDepartment" />
<div class="float-right w-[82%]">
2025-04-02 09:34:17 +08:00
<BalanceEditModal v-model:visible="balanceVisible" :row="selectedUser" @refresh="getList" />
2025-03-31 09:41:56 +08:00
<el-form ref="formRef" :inline="true" :model="searchFormParams"
class="search-form bg-bg_color w-[99/100] pl-8 pt-[12px]">
<el-form-item label="姓名:" prop="name">
<el-input v-model="searchFormParams.name" placeholder="请输入" clearable class="!w-[160px]" />
</el-form-item>
<el-form-item>
<el-button type="primary" :icon="useRenderIcon(Search)" :loading="pageLoading" @click="onSearch">
搜索
</el-button>
<el-button :icon="useRenderIcon(Refresh)" @click="resetForm(formRef)">
重置
</el-button>
</el-form-item>
</el-form>
<div class="grid-container">
<el-row :gutter="20">
<el-col v-for="(item, index) in dataList" :key="index" :xs="24" :sm="12" :md="8" :lg="6">
<el-card class="user-card" :body-style="{ padding: '8px 20px' }">
<div class="card-wrapper">
<div class="card-content">
<el-avatar :size="80" :src="item.avatar" fit="cover" shape="square" class="avatar">
<template v-if="!item.avatar">
<svg width="100" height="100" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
<circle cx="50" cy="50" r="48" fill="#f5f5f5" stroke="#e0e0e0" stroke-width="1" />
<circle cx="50" cy="40" r="12" fill="#9e9e9e" />
<rect x="40" y="52" width="20" height="30" rx="2" fill="#9e9e9e" />
</svg>
</template>
</el-avatar>
<div class="user-info">
<div class="name">姓名{{ item.name }}</div>
<div class="tel">电话{{ item.mobile }}</div>
<div class="balance">余额{{ item.balance }}</div>
</div>
</div>
<div class="card-gap"></div>
<div class="card-footer">
<el-divider class="divider" />
<el-button class="detail-btn" :icon="useRenderIcon(View)" @click="handleViewDetail(item)" />
2025-03-31 09:41:56 +08:00
</div>
</div>
</el-card>
</el-col>
</el-row>
<div class="pagination-wrapper">
<el-pagination background layout="prev, pager, next" :page-size="pagination.pageSize"
:total="pagination.total" v-model:current-page="pagination.currentPage" @current-change="getList"
@size-change="getList" />
</div>
</div>
</div>
</div>
</template>
<style scoped lang="scss">
:deep(.el-dropdown-menu__item i) {
margin: 0;
}
.search-form {
:deep(.el-form-item) {
margin-bottom: 12px;
}
}
.user-card {
margin-bottom: 20px;
min-height: 210px;
2025-03-31 09:41:56 +08:00
display: flex;
flex-direction: column;
justify-content: space-between;
.card-content {
flex: 1;
2025-03-31 09:41:56 +08:00
display: flex;
flex-direction: row;
margin: 15px 0px;
gap: 15px;
2025-03-31 09:41:56 +08:00
.avatar {
align-self: flex-start;
2025-03-31 09:41:56 +08:00
}
.user-info {
text-align: left;
flex: 1;
.name,
.tel,
.balance {
font-size: 14px;
color: #606266;
2025-03-31 09:41:56 +08:00
margin-bottom: 6px;
line-height: 1.5;
2025-03-31 09:41:56 +08:00
}
.name {
font-weight: 500;
color: #303133;
2025-03-31 09:41:56 +08:00
}
2025-04-02 09:34:17 +08:00
.balance {
font-family: monospace;
color: #67c23a;
}
2025-03-31 09:41:56 +08:00
}
}
.card-footer {
margin-top: auto;
.divider {
margin: 2px 0px;
}
.detail-btn {
width: 100%;
border: 0;
padding: 12px 0;
}
}
.card-gap {
flex-grow: 1;
min-height: 40px;
2025-03-31 09:41:56 +08:00
margin-top: auto;
}
}
.grid-container {
margin: 20px 0;
padding-bottom: 60px;
position: relative;
.el-row {
margin-bottom: -20px;
}
}
.pagination-wrapper {
2025-04-02 09:34:17 +08:00
position: relative;
2025-03-31 09:41:56 +08:00
background: var(--el-bg-color);
2025-04-02 09:34:17 +08:00
padding: 12px 12px;
margin-top: 20px;
text-align: center;
2025-03-31 09:41:56 +08:00
:deep(.el-pagination) {
margin: 0;
padding: 8px 0;
}
}
.card-wrapper {
display: flex;
flex-direction: column;
}
2025-03-31 09:41:56 +08:00
</style>