'接口联调'
This commit is contained in:
@@ -16,6 +16,7 @@ export function getStoreAccountList(data: any): AxiosPromise<any> {
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
//添加门店账号
|
||||
export function addStoreAccount(data: any): AxiosPromise<any> {
|
||||
return request({
|
||||
|
||||
+41
-16
@@ -1,27 +1,52 @@
|
||||
|
||||
import request from '@/utils/request';
|
||||
import { AxiosPromise } from 'axios';
|
||||
//获取用户列表
|
||||
export function getUserList(data): AxiosPromise<any> {
|
||||
return request({
|
||||
url: '/admin/v1/user/list',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
return request({
|
||||
url: '/admin/v1/user/list',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
}
|
||||
//获取用户档案接口
|
||||
export function getUserarchive(data): AxiosPromise<any> {
|
||||
return request({
|
||||
url: '/admin/v1/user/archive',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
return request({
|
||||
url: '/admin/v1/user/archive',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
}
|
||||
//获取用户档案详情接口
|
||||
export function getUserarchiveDetail(data): AxiosPromise<any> {
|
||||
return request({
|
||||
url: '/admin/v1/user/detail',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
return request({
|
||||
url: '/admin/v1/user/detail',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
//获取用户授权门店列表
|
||||
export function getUserAuthStoreList(data: any): AxiosPromise<any> {
|
||||
return request({
|
||||
url: '/admin/v1/bind/store',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
//获取用户检测列表
|
||||
export function getUserDetectionList(data: any): AxiosPromise<any> {
|
||||
return request({
|
||||
url: '/admin/v1/scan/list',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
}
|
||||
//用户检测-操作
|
||||
export function userDetectionOperation(data: any): AxiosPromise<any> {
|
||||
return request({
|
||||
url: '/admin/v1/scan/state',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
}
|
||||
+17
-25
@@ -3,8 +3,10 @@
|
||||
<el-card class="box-card">
|
||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||
<el-form-item label="关键词" prop="keyword">
|
||||
<el-input v-model="queryParams.keyword" placeholder="用户名/昵称" clearable style="width: 200px"
|
||||
@keyup.enter="handleQuery" />
|
||||
<el-select v-model="queryParams.store_id" placeholder="请选择门店" style="width: 100%">
|
||||
<el-option v-for="item in storeLists" :key="item.store_id" :label="`${item.account}`"
|
||||
:value="item.store_id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" :icon="Search" @click="handleQuery">
|
||||
@@ -17,6 +19,7 @@
|
||||
</el-form>
|
||||
|
||||
<el-table v-loading="loading" :data="userList" border stripe style="width: 100%">
|
||||
<el-table-column prop="account" label="用户账号" align="center" />
|
||||
<el-table-column prop="username" label="用户名" align="center" />
|
||||
<el-table-column prop="nickname" label="昵称" align="center" />
|
||||
<!--头像可点击查看大图-->
|
||||
@@ -27,25 +30,12 @@
|
||||
<span v-else>--</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="mobile" label="手机号" align="center" />
|
||||
<el-table-column prop="district_text" label="地区" align="center" />
|
||||
<el-table-column prop="gender_text" label="性别" align="center" />
|
||||
<el-table-column prop="mobile" label="手机号" align="center" />
|
||||
<el-table-column prop="birthday" label="生日" align="center" />
|
||||
<el-table-column prop="age" label="年龄" align="center" />
|
||||
<el-table-column prop="status" label="状态" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag>
|
||||
{{ statusData[row.status] }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="detection_number" label="总检测次数" align="center" />
|
||||
<el-table-column prop="created_at" label="创建时间" align="center" />
|
||||
<el-table-column label="操作" align="center" width="150">
|
||||
<template #default="{ row }">
|
||||
<el-button text @click="openArchiveDialog(row)">用户档案</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="validity_time" label="授权到期时间" align="center" />
|
||||
</el-table>
|
||||
|
||||
<pagination v-if="total > 0" :total="total" v-model:page="queryParams.page" v-model:limit="queryParams.size"
|
||||
@@ -78,15 +68,17 @@
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref, onMounted } from 'vue';
|
||||
import { getUserList, getUserarchive, getUserarchiveDetail } from '@/api/user';
|
||||
import { getStoreUserList } from '@/api/store/index'
|
||||
import { getStoreAccountList, getStoreUserList } from '@/api/store/index';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { Search, Refresh } from '@element-plus/icons-vue';
|
||||
const statusData = {
|
||||
1: '未注册',
|
||||
2: '未进行人脸识别',
|
||||
3: '未完善信息',
|
||||
4: '正常'
|
||||
}
|
||||
const storeLists = ref<any[]>([]);
|
||||
const getStoreLists = async () => {
|
||||
const { data } = await getStoreAccountList({});
|
||||
storeLists.value = data || [];
|
||||
console.log(data, '门店账号列表')
|
||||
};
|
||||
getStoreLists();
|
||||
|
||||
const loading = ref(false);
|
||||
const total = ref(0);
|
||||
const userList = ref<any[]>([]);
|
||||
@@ -134,7 +126,7 @@ function loadArchive() {
|
||||
const queryParams = reactive({
|
||||
page: 1,
|
||||
size: 10,
|
||||
keyword: ''
|
||||
store_id: 128
|
||||
});
|
||||
|
||||
function handleQuery() {
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
<el-table-column label="操作" align="center" width="150">
|
||||
<template #default="{ row }">
|
||||
<el-button text @click="openArchiveDialog(row)">用户档案</el-button>
|
||||
<el-button text @click="authStoreUserList(row)">授权门店列表</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -72,12 +73,28 @@
|
||||
<pagination v-if="archiveTotal > 0" :total="archiveTotal" v-model:page="archiveParams.page"
|
||||
v-model:limit="archiveParams.size" @pagination="loadArchive" />
|
||||
</el-dialog>
|
||||
<!-- 用户授权门店列表弹窗 -->
|
||||
<el-dialog v-model="authStoreUserListDialogVisible" title="用户授权门店列表" width="940px">
|
||||
<el-table v-loading="authStoreUserListLoading" :data="authStorelists" border stripe style="width: 100%">
|
||||
<el-table-column prop="name" label="门店名称" align="center" />
|
||||
<el-table-column prop="user_name" label="管理门店的用户名" align="center" />
|
||||
<el-table-column prop="user_mobile" label="电话" align="center" />
|
||||
<el-table-column prop="district_text" label="地区" align="center" />
|
||||
<el-table-column prop="validity_time" label="授权到期时间" align="center" />
|
||||
<el-table-column prop="status" label="状态" align="center"><template #default="{ row }">
|
||||
<el-tag>
|
||||
{{ authStatusData[row.status] }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref, onMounted } from 'vue';
|
||||
import { getUserList, getUserarchive, getUserarchiveDetail } from '@/api/user';
|
||||
import { getUserList, getUserarchive, getUserarchiveDetail, getUserAuthStoreList } from '@/api/user';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { Search, Refresh } from '@element-plus/icons-vue';
|
||||
const statusData = {
|
||||
@@ -86,11 +103,17 @@ const statusData = {
|
||||
3: '未完善信息',
|
||||
4: '正常'
|
||||
}
|
||||
const authStatusData = {
|
||||
1: '授权中',
|
||||
2: '已过期'
|
||||
}
|
||||
const loading = ref(false);
|
||||
const total = ref(0);
|
||||
const userList = ref<any[]>([]);
|
||||
const queryFormRef = ref();
|
||||
|
||||
const authStoreUserListDialogVisible = ref(false)
|
||||
const authStoreUserListLoading = ref(false)
|
||||
const authStorelists = ref<any[]>([])
|
||||
// 档案弹窗相关
|
||||
const archiveDialogVisible = ref(false);
|
||||
const archiveLoading = ref(false);
|
||||
@@ -101,7 +124,20 @@ const archiveParams = reactive({
|
||||
page: 1,
|
||||
size: 10
|
||||
});
|
||||
|
||||
const authStoreUserList = (row: any) => {
|
||||
authStoreUserListDialogVisible.value = true;
|
||||
authStoreUserListLoading.value = true;
|
||||
getUserAuthStoreList({ user_id: row.id }).then(({ data }: any) => {
|
||||
console.log(data, 'data授权门店列表')
|
||||
authStorelists.value = data;
|
||||
})
|
||||
.catch((err: any) => {
|
||||
ElMessage.error(err.message || '获取用户授权门店列表失败');
|
||||
})
|
||||
.finally(() => {
|
||||
authStoreUserListLoading.value = false;
|
||||
});
|
||||
}
|
||||
// 打开档案弹窗
|
||||
function openArchiveDialog(row: any) {
|
||||
currentUserId.value = row.id;
|
||||
@@ -152,7 +188,7 @@ function handleQuery() {
|
||||
//用户档案详情
|
||||
const archiveDetail = async (row) => {
|
||||
const res = await getUserarchiveDetail({ id: row.id });
|
||||
console.log(res,'res用户档案详情')
|
||||
console.log(res, 'res用户档案详情')
|
||||
}
|
||||
function resetQuery() {
|
||||
queryFormRef.value?.resetFields();
|
||||
|
||||
@@ -0,0 +1,261 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-card class="box-card">
|
||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||
<el-form-item label="关键词" prop="keyword">
|
||||
<el-input v-model="queryParams.keyword" placeholder="用户名/昵称" clearable style="width: 200px"
|
||||
@keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="state">
|
||||
<el-select v-model="queryParams.state" placeholder="状态" clearable style="width: 200px"
|
||||
@keyup.enter="handleQuery">
|
||||
<el-option value="2" label="分析列表"></el-option>
|
||||
<el-option value="3" label="问题列表"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" :icon="Search" @click="handleQuery">
|
||||
搜索
|
||||
</el-button>
|
||||
<el-button :icon="Refresh" @click="resetQuery">
|
||||
重置
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table v-loading="loading" :data="userList" border stripe style="width: 100%">
|
||||
<el-table-column prop="username" label="用户名" align="center" />
|
||||
<el-table-column prop="nickname" label="昵称" align="center" />
|
||||
<el-table-column prop="mobile" label="手机号" align="center" />
|
||||
<el-table-column prop="district" label="地区" align="center" />
|
||||
<el-table-column prop="gender_text" label="性别" align="center" />
|
||||
<el-table-column prop="birthday_text" label="年龄" align="center" />
|
||||
|
||||
<el-table-column prop="created_at" label="创建时间" align="center" />
|
||||
<el-table-column prop="status" label="状态" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag>
|
||||
{{ statusData[row.state] }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="detection_number" label="总检测次数" align="center" />
|
||||
<el-table-column label="操作" align="center" width="150">
|
||||
<template #default="{ row }">
|
||||
<el-button text @click="archiveDetail(row)">详情</el-button>
|
||||
<el-button text @click="handleOperation(row)">操作</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-if="total > 0" :total="total" v-model:page="queryParams.page" v-model:limit="queryParams.size"
|
||||
@pagination="handleQuery" />
|
||||
</el-card>
|
||||
|
||||
|
||||
<!-- 用户授权门店列表弹窗 -->
|
||||
<el-dialog v-model="authStoreUserListDialogVisible" title="用户授权门店列表" width="940px">
|
||||
<el-table v-loading="authStoreUserListLoading" :data="authStorelists" border stripe style="width: 100%">
|
||||
<el-table-column prop="name" label="门店名称" align="center" />
|
||||
<el-table-column prop="user_name" label="管理门店的用户名" align="center" />
|
||||
<el-table-column prop="user_mobile" label="电话" align="center" />
|
||||
<el-table-column prop="district_text" label="地区" align="center" />
|
||||
<el-table-column prop="validity_time" label="授权到期时间" align="center" />
|
||||
<el-table-column prop="status" label="状态" align="center"><template #default="{ row }">
|
||||
<el-tag>
|
||||
{{ authStatusData[row.status] }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-dialog>
|
||||
<!-- 用户操作弹窗 -->
|
||||
<el-dialog v-model="userOperationDialogVisible" title="用户操作" width="640px">
|
||||
<el-form ref="userOperationFormRef" :model="userOperationForm" :rules="userOperationFormRules"
|
||||
label-width="120px">
|
||||
<el-form-item label="操作" prop="operation">
|
||||
<el-select v-model="userOperationForm.state" placeholder="请选择操作" style="width: 100%">
|
||||
<el-option value="3" label="有问题"></el-option>
|
||||
<el-option value="4" label="已退款"></el-option>
|
||||
<el-option value="5" label="正常"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="userOperationDialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="userOperationSubmit">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref, onMounted } from 'vue';
|
||||
import { getUserList, getUserarchive, getUserarchiveDetail, getUserAuthStoreList, getUserDetectionList, userDetectionOperation } from '@/api/user';
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { Search, Refresh } from '@element-plus/icons-vue';
|
||||
const statusData = {
|
||||
1: '检测过一次',
|
||||
2: '分析中',
|
||||
3: '已退款',
|
||||
4: '正常'
|
||||
}
|
||||
const authStatusData = {
|
||||
1: '授权中',
|
||||
2: '已过期'
|
||||
}
|
||||
const loading = ref(false);
|
||||
const userOperationDialogVisible = ref(false);
|
||||
const userOperationFormRef = ref();
|
||||
const userOperationForm = reactive({
|
||||
state: null
|
||||
})
|
||||
const userOperationFormRules = reactive({
|
||||
state: [{ required: true, message: '请选择操作', trigger: 'change' }]
|
||||
})
|
||||
|
||||
const total = ref(0);
|
||||
const userList = ref<any[]>([]);
|
||||
const queryFormRef = ref();
|
||||
const authStoreUserListDialogVisible = ref(false)
|
||||
const authStoreUserListLoading = ref(false)
|
||||
const authStorelists = ref<any[]>([])
|
||||
// 档案弹窗相关
|
||||
const archiveDialogVisible = ref(false);
|
||||
const archiveLoading = ref(false);
|
||||
const archiveTotal = ref(0);
|
||||
const archiveList = ref<any[]>([]);
|
||||
const currentUserId = ref<number | null>(null);
|
||||
const archiveParams = reactive({
|
||||
page: 1,
|
||||
size: 10
|
||||
});
|
||||
const handleOperation = (row: any) => {
|
||||
userOperationDialogVisible.value = true;
|
||||
userOperationForm.id = row.id;
|
||||
userOperationForm.state = null;
|
||||
userOperationFormRef.value?.resetFields();
|
||||
}
|
||||
const userOperationSubmit = () => {
|
||||
userOperationFormRef.value?.validate((valid) => {
|
||||
if (valid) {
|
||||
userDetectionOperation(userOperationForm).then(({ data }: any) => {
|
||||
console.log(data, 'data用户检测操作')
|
||||
ElMessage.success('操作成功');
|
||||
userOperationDialogVisible.value = false;
|
||||
handleQuery();
|
||||
})
|
||||
.catch((err: any) => {
|
||||
ElMessage.error(err.message || '操作失败');
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
const authStoreUserList = (row: any) => {
|
||||
authStoreUserListDialogVisible.value = true;
|
||||
authStoreUserListLoading.value = true;
|
||||
getUserAuthStoreList({ user_id: row.id }).then(({ data }: any) => {
|
||||
console.log(data, 'data授权门店列表')
|
||||
authStorelists.value = data;
|
||||
})
|
||||
.catch((err: any) => {
|
||||
ElMessage.error(err.message || '获取用户授权门店列表失败');
|
||||
})
|
||||
.finally(() => {
|
||||
authStoreUserListLoading.value = false;
|
||||
});
|
||||
}
|
||||
// 打开档案弹窗
|
||||
function openArchiveDialog(row: any) {
|
||||
currentUserId.value = row.id;
|
||||
archiveDialogVisible.value = true;
|
||||
archiveParams.page = 1;
|
||||
archiveParams.size = 10;
|
||||
loadArchive();
|
||||
}
|
||||
|
||||
// 加载档案列表
|
||||
function loadArchive() {
|
||||
if (!currentUserId.value) return;
|
||||
archiveLoading.value = true;
|
||||
getUserarchive({ user_id: currentUserId.value, ...archiveParams })
|
||||
.then(({ data }: any) => {
|
||||
const list = Array.isArray(data) ? data : data?.data ?? data?.list ?? [];
|
||||
archiveList.value = list;
|
||||
archiveTotal.value =
|
||||
typeof data?.total === 'number' ? data.total : Array.isArray(data) ? data.length : list.length;
|
||||
})
|
||||
.catch((err: any) => {
|
||||
ElMessage.error(err.message || '获取用户档案失败');
|
||||
})
|
||||
.finally(() => {
|
||||
archiveLoading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
const queryParams = reactive({
|
||||
page: 1,
|
||||
size: 10,
|
||||
keyword: '',
|
||||
state: null,
|
||||
});
|
||||
|
||||
function handleQuery() {
|
||||
loading.value = true;
|
||||
getUserDetectionList(queryParams)
|
||||
.then(({ data }: any) => {
|
||||
userList.value = data;
|
||||
})
|
||||
.catch((err: any) => {
|
||||
ElMessage.error(err.message || '获取用户列表失败');
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
//用户档案详情
|
||||
const archiveDetail = async (row) => {
|
||||
const res = await getUserarchiveDetail({ id: row.id });
|
||||
console.log(res, 'res用户档案详情')
|
||||
}
|
||||
function resetQuery() {
|
||||
queryFormRef.value?.resetFields();
|
||||
queryParams.page = 1;
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
function handleSizeChange(size: number) {
|
||||
queryParams.size = size;
|
||||
queryParams.page = 1;
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
function handleCurrentChange(page: number) {
|
||||
queryParams.page = page;
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
handleQuery();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.app-container {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.avatar-thumb {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.archive-cover {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user