This commit is contained in:
gyq
2024-05-20 17:42:41 +08:00
parent d7dd3d3372
commit a683be3873
8 changed files with 207 additions and 18 deletions

View File

@@ -11,12 +11,12 @@
<el-form-item label="赠送数量">
<el-input-number v-model="form.handselNum" controls-position="right" :min="1"></el-input-number>
</el-form-item>
<el-form-item label="赠送类型">
<!-- <el-form-item label="赠送类型">
<el-select v-model="form.handselType">
<el-option :label="item.label" :value="item.value" v-for="item in handselTypes"
:key="item.value"></el-option>
</el-select>
</el-form-item>
</el-form-item> -->
<el-form-item label="状态">
<el-switch v-model="form.isDel" active-value="0" inactive-value="1"></el-switch>
</el-form-item>

View File

@@ -1,3 +1,140 @@
<template>
<div>用户列表</div>
</template>
<div class="app-container">
<div class="head-container">
<el-form :model="query" inline>
<el-form-item>
<el-input v-model="query.telephone" placeholder="请输入手机号"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="getTableData">查询</el-button>
<el-button @click="resetHandle">重置</el-button>
</el-form-item>
</el-form>
</div>
<!-- <div class="head-container">
<el-button type="primary" icon="el-icon-plus" @click="$refs.addActive.show()">
添加活动
</el-button>
</div> -->
<div class="head-container">
<el-table :data="tableData.data" v-loading="tableData.loading">
<el-table-column label="用户" prop="headImg">
<template v-slot="scope">
<div class="user_info">
<el-image :src="scope.row.headImg" style="width: 40px;height: 40px;" />
<span class="name">{{ scope.row.nickName }}</span>
</div>
</template>
</el-table-column>
<el-table-column label="性别" prop="sex"></el-table-column>
<el-table-column label="余额" prop="amount"></el-table-column>
<el-table-column label="积分" prop="totalScore"></el-table-column>
<el-table-column label="手机号" prop="telephone"></el-table-column>
<el-table-column label="生日" prop="birthDay"></el-table-column>
<el-table-column label="注册时间" prop="createAt">
<template v-slot="scope">
{{ scope.row.createAt | timeFilter }}
</template>
</el-table-column>
<el-table-column label="最近登录时间" prop="lastLoginAt">
<template v-slot="scope">
{{ scope.row.lastLoginAt | timeFilter }}
</template>
</el-table-column>
<el-table-column label="操作" width="120">
<template v-slot="scope">
<el-button type="text" icon="el-icon-edit"
@click="$refs.addActive.show(scope.row)">编辑</el-button>
<!-- <el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])">
<el-button type="text" icon="el-icon-delete" style="margin-left: 20px !important;"
slot="reference">删除</el-button>
</el-popconfirm> -->
</template>
</el-table-column>
</el-table>
</div>
<div class="head-container">
<el-pagination :total="tableData.total" :current-page="tableData.page + 1" :page-size="tableData.size"
@current-change="paginationChange" layout="total"></el-pagination>
</div>
</div>
</template>
<script>
import { queryAllShopUser } from '@/api/shop'
import dayjs from 'dayjs'
export default {
data() {
return {
query: {
telephone: ''
},
tableData: {
data: [],
page: 0,
size: 10,
loading: false,
total: 0
}
}
},
filters: {
timeFilter(s) {
return dayjs(s).format('YYYY-MM-DD HH:mm:ss')
}
},
mounted() {
this.getTableData()
},
methods: {
// 切换状态
async statusChange(e, row) {
try {
this.tableData.loading = true
const data = { ...row }
data.status = e
await modityActivate(data)
this.getTableData()
} catch (error) {
console.log(error)
this.tableData.loading = false
}
},
// 重置查询
resetHandle() {
this.query.telephone = ''
this.getTableData()
},
// 分页回调
paginationChange(e) {
this.tableData.page = e - 1
this.getTableData()
},
// 获取商品列表
async getTableData() {
this.tableData.loading = true
try {
const res = await queryAllShopUser({
telephone: this.query.telephone,
isVip: 0
})
this.tableData.loading = false
this.tableData.data = res.content
this.tableData.total = res.totalElements
} catch (error) {
console.log(error)
}
}
}
}
</script>
<style scoped lang="scss">
.user_info {
display: flex;
align-items: center;
.name {
margin-left: 10px;
}
}
</style>