积分竞拍,市场管理

This commit is contained in:
axlrose2333 2023-03-17 16:47:30 +08:00
parent f560a8a431
commit 31bd50111e
9 changed files with 258 additions and 24 deletions

View File

@ -10,6 +10,13 @@ const api = {
method: 'POST', method: 'POST',
headers headers
}) })
} },
getUserList: data => { // 用户列表
return service({
url: '/user',
method: 'get',
params:data
})
},
} }
export default api export default api

View File

@ -65,5 +65,19 @@ const api = {
data data
}) })
}, },
auctionStateFunc: data => { // 竞拍 上级、下架
return service({
url: '/auction/push',
method: 'put',
data
})
},
drawStateFunc: data => { // 抽奖 上级、下架
return service({
url: '/lottery/push',
method: 'put',
data
})
},
} }
export default api export default api

View File

@ -30,5 +30,19 @@ const api = {
params:data params:data
}) })
}, },
addManager: data => { // 添加主管
return service({
url: '/manager',
method: 'post',
data
})
},
delManager: data => { // 删除主管
return service({
url: '/manager',
method: 'delete',
data
})
},
} }
export default api export default api

View File

@ -110,6 +110,18 @@ const custom = {
// console.log(date) // console.log(date)
return date return date
}, },
timestampToDate2(stamp) { // 时间戳转日期 精确到秒
var time = new Date(stamp);
var y = time.getFullYear();
var m = time.getMonth()+1;
var d = time.getDate();
var h = time.getHours();
var min = time.getMinutes();
var s = time.getSeconds();
const date = `${y}-${m}-${d} ${h}:${min}:${s}`
// console.log(date)
return date
},
getSTdPerson(num) { getSTdPerson(num) {
const flag = 10000 const flag = 10000
if(num<flag) { if(num<flag) {

View File

@ -105,6 +105,7 @@ function getStateName(row) {
// //
if(row.end_time < (Date.parse(new Date()))) { // if(row.end_time < (Date.parse(new Date()))) { //
name = '已结束'; name = '已结束';
row.status = 3
} }
else{ else{
name = '报名中'; name = '报名中';
@ -232,6 +233,29 @@ function fileChange(index) {
console.log(index) console.log(index)
file_type_index = index file_type_index = index
} }
async function auctionStateFunc(row,type) { //
let title = '确定要上架该竞拍吗?'
if(type === 2) {
title = '确定要下架该竞拍吗?'
}
ElMessageBox.alert(title, {
confirmButtonText: '确定',
cancelButtonText: '取消',
callback:async (action) => {
console.log(action)
if(action === 'confirm') {
const res = await api.auctionStateFunc({id:row.id,status:type})
if(res.code === 0) {
ElMessage({
type: 'success',
message: `修改成功`,
})
getAuctionList()
}
}
},
})
}
</script> </script>
<template> <template>
<div> <div>
@ -291,12 +315,12 @@ function fileChange(index) {
<el-table-column align="center" label="满员人数" prop="full_member" /> <el-table-column align="center" label="满员人数" prop="full_member" />
<el-table-column align="center" label="发布日期" min-width="150" > <el-table-column align="center" label="发布日期" min-width="150" >
<template #default="scope"> <template #default="scope">
{{custom.timestampToDate(scope.row.begin_time)}} {{custom.timestampToDate2(scope.row.begin_time)}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="截止日期" min-width="150" > <el-table-column align="center" label="截止日期" min-width="150" >
<template #default="scope"> <template #default="scope">
{{custom.timestampToDate(scope.row.end_time)}} {{custom.timestampToDate2(scope.row.end_time)}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="已参与人数" min-width="150" prop="in_member" /> <el-table-column align="center" label="已参与人数" min-width="150" prop="in_member" />
@ -322,6 +346,22 @@ function fileChange(index) {
link link
@click="delFunc(scope.row)" @click="delFunc(scope.row)"
>删除</el-button> >删除</el-button>
<el-button
icon="top"
size="small"
type="primary"
link
@click="auctionStateFunc(scope.row,1)"
v-if="scope.row.status!=3"
>上架</el-button>
<el-button
icon="bottom"
size="small"
type="danger"
link
@click="auctionStateFunc(scope.row,2)"
v-if="scope.row.status!=3"
>下架</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -403,9 +443,9 @@ function fileChange(index) {
<el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon> <el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item label="启用状态" prop="status"> <!-- <el-form-item label="启用状态" prop="status">-->
<el-switch v-model="auctionForm.status" :active-value="1" :inactive-value="2" active-text="启用" inactive-text="禁用" /> <!-- <el-switch v-model="auctionForm.status" :active-value="1" :inactive-value="2" active-text="启用" inactive-text="禁用" />-->
</el-form-item> <!-- </el-form-item>-->
</el-form> </el-form>
<template #footer> <template #footer>

View File

@ -236,6 +236,29 @@ function fileChange(index) {
function loadingEggChange() { function loadingEggChange() {
console.log(drawForm.value) console.log(drawForm.value)
} }
async function drawStateFunc(row,type) { //
let title = '确定要上架该抽奖吗?'
if(type === 2) {
title = '确定要下架该抽奖吗?'
}
ElMessageBox.alert(title, {
confirmButtonText: '确定',
cancelButtonText: '取消',
callback:async (action) => {
console.log(action)
if(action === 'confirm') {
const res = await api.drawStateFunc({id:row.id,status:type})
if(res.code === 0) {
ElMessage({
type: 'success',
message: `修改成功`,
})
getDrawList()
}
}
},
})
}
</script> </script>
<template> <template>
<div> <div>
@ -332,6 +355,22 @@ function loadingEggChange() {
link link
@click="delFunc(scope.row)" @click="delFunc(scope.row)"
>删除</el-button> >删除</el-button>
<el-button
icon="top"
size="small"
type="primary"
link
@click="drawStateFunc(scope.row,1)"
v-if="scope.row.status!=3"
>上架</el-button>
<el-button
icon="bottom"
size="small"
type="danger"
link
@click="drawStateFunc(scope.row,2)"
v-if="scope.row.status!=3"
>下架</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -416,9 +455,9 @@ function loadingEggChange() {
<el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon> <el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item label="启用状态" prop="status"> <!-- <el-form-item label="启用状态" prop="status">-->
<el-switch v-model="drawForm.status" :active-value="1" :inactive-value="2" active-text="启用" inactive-text="禁用" /> <!-- <el-switch v-model="drawForm.status" :active-value="1" :inactive-value="2" active-text="启用" inactive-text="禁用" />-->
</el-form-item> <!-- </el-form-item>-->
</el-form> </el-form>
<template #footer> <template #footer>

View File

@ -3,6 +3,7 @@
// //
import api from '@/api/market' import api from '@/api/market'
import custom from '@/utils/custom' import custom from '@/utils/custom'
import capi from '@/api/common'
import {formatDate} from '@/utils/format' import {formatDate} from '@/utils/format'
import {ref,onMounted,provide } from 'vue' import {ref,onMounted,provide } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
@ -51,14 +52,25 @@ const total = ref(0)
// }) // })
const question_id = ref(0) const question_id = ref(0)
const content = ref(null) const content = ref(null)
const teacher_ids = ref([]) const manager_ids = ref([])
const user_list = ref([])
// //
onMounted(() => { onMounted(() => {
getManagerList() getManagerList()
getUserList()
}) })
// provide('subjectList', subjectList) // provide('subjectList', subjectList)
// provide('current_subject', current_subject) // provide('current_subject', current_subject)
// //
async function getUserList() {
const res = await capi.getUserList({
page:1,
pageSize:1000
})
if(res.code === 0) {
user_list.value = res.data.records
}
}
async function getManagerList() { async function getManagerList() {
const res = await api.getManagerList(queryParams.value) const res = await api.getManagerList(queryParams.value)
if(res.code === 0) { if(res.code === 0) {
@ -85,8 +97,8 @@ const onReset = () => {
} }
} }
async function onDelete() { async function onDelete() {
const ids = teacher_ids.value const ids = manager_ids.value
const res = await api.delExamination({ teacher_ids:ids }) const res = await api.delManager({ manager_ids:ids })
if (res.code === 0) { if (res.code === 0) {
ElMessage({ ElMessage({
type: 'success', type: 'success',
@ -97,8 +109,8 @@ async function onDelete() {
} }
} }
const handleSelectionChange = (val) => { const handleSelectionChange = (val) => {
teacher_ids.value = val.map((item) => { manager_ids.value = val.map((item) => {
return item.teacher_info_id return item.user_id
}) })
} }
function handleCurrentChange(val) { function handleCurrentChange(val) {
@ -112,7 +124,64 @@ function handleSizeChange(val) {
function viewManagerFunc(row) { // function viewManagerFunc(row) { //
router.push({name:'managerDetail',params:{id:row.user_id}}) router.push({name:'managerDetail',params:{id:row.user_id}})
} }
async function delFunc(row) {
ElMessageBox.confirm('此操作将永久删除该数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(async() => {
const res = await api.delManager({
ids:[row.user_id]
})
if (res.code === 0) {
ElMessage({
type: 'success',
message: '删除成功!'
})
getManagerList()
}
},() => {
})
}
// &
const dialogVisible = ref(false)
const mForm = ref({})
const mFormRef = ref(null)
const mFormRules = ref({
province: [{ required: true, message: '请选择管辖区域', trigger: 'blur' }],
user_id: [{ required: true, message: '请选择用户', trigger: 'blur' }]
})
function openDialog() {
mForm.value = {}
dialogVisible.value = true
}
function addOk() { //
submitForm(mFormRef.value)
}
async function submitForm(formEl) {
if (!formEl) return
await formEl.validate((valid, fields) => {
if (valid) { //
// console.log('submit!')
saveData()
} else {
// console.log('!', fields)
}
})
}
async function saveData() {
// console.log(mForm.value);return
const res = await api.addManager(mForm.value)
if(res.code === 0) {
ElMessage({
type: 'success',
message: res.msg
})
getManagerList()
dialogVisible.value = false
}
}
</script> </script>
<template> <template>
<div> <div>
@ -142,20 +211,26 @@ function viewManagerFunc(row) { // 查看详情
<div class="gva-table-box"> <div class="gva-table-box">
<!-- 批量操作--> <!-- 批量操作-->
<div class="gva-btn-list"> <div class="gva-btn-list">
<el-button size="small" type="primary" icon="plus" @click="openDialog('add')">新增</el-button> <el-button size="small" type="primary" icon="plus" @click="openDialog()">新增</el-button>
<el-popover v-model="deleteVisible" placement="top" width="160"> <el-popover v-model="deleteVisible" placement="top" width="160">
<p>确定要删除吗</p> <p>确定要删除吗</p>
<div style="text-align: right; margin-top: 8px;"> <div style="text-align: right; margin-top: 8px;">
<el-button size="small" type="primary" link @click="deleteVisible = false">取消</el-button> <el-button size="small" type="primary" link @click="deleteVisible = false">取消</el-button>
<el-button size="small" type="primary" @click="onDelete">确定</el-button> <el-button size="small" type="primary" @click="onDelete">确定</el-button>
</div> </div>
<template #reference>
<el-button icon="delete" size="small" type="danger" :disabled="!manager_ids.length" style="margin-left: 10px;" @click="deleteVisible = true">删除</el-button>
</template>
</el-popover> </el-popover>
</div> </div>
<!-- 数据列表--> <!-- 数据列表-->
<el-table :data="tableData" @selection-change="handleSelectionChange"> <el-table :data="tableData" @selection-change="handleSelectionChange">
<el-table-column
type="selection"
width="55"
/>
<el-table-column align="center" label="ID" prop="user_id" sortable="custom" /> <el-table-column align="center" label="ID" prop="user_id" sortable="custom" />
<el-table-column align="center" min-width="150" label="姓名" prop="nickname" /> <el-table-column align="center" min-width="150" label="姓名" prop="nickname" />
<el-table-column align="center" label="开通时间" min-width="150" > <el-table-column align="center" label="开通时间" min-width="150" >
<template #default="scope"> <template #default="scope">
{{formatDate(scope.row.CreatedAt)}} {{formatDate(scope.row.CreatedAt)}}
@ -188,7 +263,7 @@ function viewManagerFunc(row) { // 查看详情
size="small" size="small"
type="danger" type="danger"
link link
@click="processFunc(scope.row,3)" @click="delFunc(scope.row)"
>关闭</el-button> >关闭</el-button>
</template> </template>
</el-table-column> </el-table-column>
@ -205,8 +280,41 @@ function viewManagerFunc(row) { // 查看详情
/> />
</div> </div>
</div> </div>
<!-- 新增&编辑 窗口-->git <!-- 新增&编辑 窗口-->
<el-dialog
v-model="dialogVisible"
title="添加主管"
width="30%"
>
<el-form ref="mFormRef" class="form-box" :model="mForm" :rules="mFormRules" label-width="80px">
<el-form-item label="选择区域" prop="province">
<el-select v-model="mForm.province" clearable placeholder="请选择">
<el-option
v-for="(item,index) in cityList"
:key="item.ProID"
:label="item.name"
:value="index"
/>
</el-select>
</el-form-item>
<el-form-item label="用户ID" prop="user_id">
<el-select v-model="mForm.user_id" clearable placeholder="请选择">
<el-option
v-for="(item,index) in user_list"
:key="item.user_id"
:label="item.nickname"
:value="item.user_id"
/>
</el-select>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="addOk">添加</el-button>
</span>
</template>
</el-dialog>
</div> </div>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@ -133,7 +133,7 @@ function getStateName(state) {
</div> </div>
<div class="dib-item"> <div class="dib-item">
<div class="di-left">课程总学费</div> <div class="di-left">课程总学费</div>
<div class="di-right">{{managerInfo.course_income}}</div> <div class="di-right">{{managerInfo.course_total}}</div>
</div> </div>
<div class="dib-item"> <div class="dib-item">
<div class="di-left">课程总佣金</div> <div class="di-left">课程总佣金</div>
@ -147,7 +147,7 @@ function getStateName(state) {
</div> </div>
<div class="dib-item"> <div class="dib-item">
<div class="di-left">测试总学费</div> <div class="di-left">测试总学费</div>
<div class="di-right">{{managerInfo.exam_income}}</div> <div class="di-right">{{managerInfo.exam_total}}</div>
</div> </div>
<div class="dib-item"> <div class="dib-item">
<div class="di-left">测试总佣金</div> <div class="di-left">测试总佣金</div>

View File

@ -32,7 +32,7 @@ onMounted(() => {
async function getUserDetail() { async function getUserDetail() {
const res = await api.viewUser({id:route.params.id}) const res = await api.viewUser({id:route.params.id})
if(res.code === 0) { if(res.code === 0) {
userManageInfo.value = res.data.user userManageInfo.value = res.data
// let teacher_cert = JSON.parse(res.data.teacher_cert) // let teacher_cert = JSON.parse(res.data.teacher_cert)
// let skill_cert = JSON.parse(res.data.skill_cert) // let skill_cert = JSON.parse(res.data.skill_cert)
// imgs.value = [...skill_cert,...teacher_cert] // imgs.value = [...skill_cert,...teacher_cert]
@ -58,7 +58,7 @@ function toDealDetail(type) {
<div class="gva-search-box"> <div class="gva-search-box">
<div class="baseInfo-box"> <div class="baseInfo-box">
<div class="bb-item"> <div class="bb-item">
<img class="avatar" :src="userManageInfo.avatar" alt=""> <img class="avatar" :src="userManageInfo?.avatar" alt="">
</div> </div>
<div class="bb-item"> <div class="bb-item">
昵称{{userManageInfo.nickname}} 昵称{{userManageInfo.nickname}}