积分竞拍,市场管理
This commit is contained in:
parent
f560a8a431
commit
31bd50111e
@ -10,6 +10,13 @@ const api = {
|
||||
method: 'POST',
|
||||
headers
|
||||
})
|
||||
}
|
||||
},
|
||||
getUserList: data => { // 用户列表
|
||||
return service({
|
||||
url: '/user',
|
||||
method: 'get',
|
||||
params:data
|
||||
})
|
||||
},
|
||||
}
|
||||
export default api
|
||||
|
@ -65,5 +65,19 @@ const api = {
|
||||
data
|
||||
})
|
||||
},
|
||||
auctionStateFunc: data => { // 竞拍 上级、下架
|
||||
return service({
|
||||
url: '/auction/push',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
},
|
||||
drawStateFunc: data => { // 抽奖 上级、下架
|
||||
return service({
|
||||
url: '/lottery/push',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
},
|
||||
}
|
||||
export default api
|
||||
|
@ -30,5 +30,19 @@ const api = {
|
||||
params:data
|
||||
})
|
||||
},
|
||||
addManager: data => { // 添加主管
|
||||
return service({
|
||||
url: '/manager',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
},
|
||||
delManager: data => { // 删除主管
|
||||
return service({
|
||||
url: '/manager',
|
||||
method: 'delete',
|
||||
data
|
||||
})
|
||||
},
|
||||
}
|
||||
export default api
|
||||
|
@ -110,6 +110,18 @@ const custom = {
|
||||
// console.log(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) {
|
||||
const flag = 10000
|
||||
if(num<flag) {
|
||||
|
@ -105,6 +105,7 @@ function getStateName(row) {
|
||||
// 检查是否过期
|
||||
if(row.end_time < (Date.parse(new Date()))) { // 已过期
|
||||
name = '已结束';
|
||||
row.status = 3
|
||||
}
|
||||
else{
|
||||
name = '报名中';
|
||||
@ -232,6 +233,29 @@ function fileChange(index) {
|
||||
console.log(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>
|
||||
<template>
|
||||
<div>
|
||||
@ -291,12 +315,12 @@ function fileChange(index) {
|
||||
<el-table-column align="center" label="满员人数" prop="full_member" />
|
||||
<el-table-column align="center" label="发布日期" min-width="150" >
|
||||
<template #default="scope">
|
||||
{{custom.timestampToDate(scope.row.begin_time)}}
|
||||
{{custom.timestampToDate2(scope.row.begin_time)}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="截止日期" min-width="150" >
|
||||
<template #default="scope">
|
||||
{{custom.timestampToDate(scope.row.end_time)}}
|
||||
{{custom.timestampToDate2(scope.row.end_time)}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="已参与人数" min-width="150" prop="in_member" />
|
||||
@ -322,6 +346,22 @@ function fileChange(index) {
|
||||
link
|
||||
@click="delFunc(scope.row)"
|
||||
>删除</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>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -403,9 +443,9 @@ function fileChange(index) {
|
||||
<el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item label="启用状态" prop="status">
|
||||
<el-switch v-model="auctionForm.status" :active-value="1" :inactive-value="2" active-text="启用" inactive-text="禁用" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="启用状态" prop="status">-->
|
||||
<!-- <el-switch v-model="auctionForm.status" :active-value="1" :inactive-value="2" active-text="启用" inactive-text="禁用" />-->
|
||||
<!-- </el-form-item>-->
|
||||
|
||||
</el-form>
|
||||
<template #footer>
|
||||
|
@ -236,6 +236,29 @@ function fileChange(index) {
|
||||
function loadingEggChange() {
|
||||
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>
|
||||
<template>
|
||||
<div>
|
||||
@ -332,6 +355,22 @@ function loadingEggChange() {
|
||||
link
|
||||
@click="delFunc(scope.row)"
|
||||
>删除</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>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -416,9 +455,9 @@ function loadingEggChange() {
|
||||
<el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
<el-form-item label="启用状态" prop="status">
|
||||
<el-switch v-model="drawForm.status" :active-value="1" :inactive-value="2" active-text="启用" inactive-text="禁用" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="启用状态" prop="status">-->
|
||||
<!-- <el-switch v-model="drawForm.status" :active-value="1" :inactive-value="2" active-text="启用" inactive-text="禁用" />-->
|
||||
<!-- </el-form-item>-->
|
||||
|
||||
</el-form>
|
||||
<template #footer>
|
||||
|
@ -3,6 +3,7 @@
|
||||
// 引入依赖
|
||||
import api from '@/api/market'
|
||||
import custom from '@/utils/custom'
|
||||
import capi from '@/api/common'
|
||||
import {formatDate} from '@/utils/format'
|
||||
import {ref,onMounted,provide } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
@ -51,14 +52,25 @@ const total = ref(0)
|
||||
// })
|
||||
const question_id = ref(0)
|
||||
const content = ref(null)
|
||||
const teacher_ids = ref([])
|
||||
const manager_ids = ref([])
|
||||
const user_list = ref([])
|
||||
// 生命周期
|
||||
onMounted(() => {
|
||||
getManagerList()
|
||||
getUserList()
|
||||
})
|
||||
// provide('subjectList', subjectList)
|
||||
// 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() {
|
||||
const res = await api.getManagerList(queryParams.value)
|
||||
if(res.code === 0) {
|
||||
@ -85,8 +97,8 @@ const onReset = () => {
|
||||
}
|
||||
}
|
||||
async function onDelete() {
|
||||
const ids = teacher_ids.value
|
||||
const res = await api.delExamination({ teacher_ids:ids })
|
||||
const ids = manager_ids.value
|
||||
const res = await api.delManager({ manager_ids:ids })
|
||||
if (res.code === 0) {
|
||||
ElMessage({
|
||||
type: 'success',
|
||||
@ -97,8 +109,8 @@ async function onDelete() {
|
||||
}
|
||||
}
|
||||
const handleSelectionChange = (val) => {
|
||||
teacher_ids.value = val.map((item) => {
|
||||
return item.teacher_info_id
|
||||
manager_ids.value = val.map((item) => {
|
||||
return item.user_id
|
||||
})
|
||||
}
|
||||
function handleCurrentChange(val) {
|
||||
@ -112,7 +124,64 @@ function handleSizeChange(val) {
|
||||
function viewManagerFunc(row) { // 查看详情
|
||||
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>
|
||||
<template>
|
||||
<div>
|
||||
@ -142,20 +211,26 @@ function viewManagerFunc(row) { // 查看详情
|
||||
<div class="gva-table-box">
|
||||
<!-- 批量操作-->
|
||||
<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">
|
||||
<p>确定要删除吗?</p>
|
||||
<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" @click="onDelete">确定</el-button>
|
||||
</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>
|
||||
</div>
|
||||
<!-- 数据列表-->
|
||||
<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" min-width="150" label="姓名" prop="nickname" />
|
||||
|
||||
<el-table-column align="center" label="开通时间" min-width="150" >
|
||||
<template #default="scope">
|
||||
{{formatDate(scope.row.CreatedAt)}}
|
||||
@ -188,7 +263,7 @@ function viewManagerFunc(row) { // 查看详情
|
||||
size="small"
|
||||
type="danger"
|
||||
link
|
||||
@click="processFunc(scope.row,3)"
|
||||
@click="delFunc(scope.row)"
|
||||
>关闭</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -205,8 +280,41 @@ function viewManagerFunc(row) { // 查看详情
|
||||
/>
|
||||
</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>
|
||||
</template>
|
||||
<style scoped lang="scss">
|
||||
|
@ -133,7 +133,7 @@ function getStateName(state) {
|
||||
</div>
|
||||
<div class="dib-item">
|
||||
<div class="di-left">课程总学费:</div>
|
||||
<div class="di-right">{{managerInfo.course_income}}</div>
|
||||
<div class="di-right">{{managerInfo.course_total}}</div>
|
||||
</div>
|
||||
<div class="dib-item">
|
||||
<div class="di-left">课程总佣金:</div>
|
||||
@ -147,7 +147,7 @@ function getStateName(state) {
|
||||
</div>
|
||||
<div class="dib-item">
|
||||
<div class="di-left">测试总学费:</div>
|
||||
<div class="di-right">{{managerInfo.exam_income}}</div>
|
||||
<div class="di-right">{{managerInfo.exam_total}}</div>
|
||||
</div>
|
||||
<div class="dib-item">
|
||||
<div class="di-left">测试总佣金:</div>
|
||||
|
@ -32,7 +32,7 @@ onMounted(() => {
|
||||
async function getUserDetail() {
|
||||
const res = await api.viewUser({id:route.params.id})
|
||||
if(res.code === 0) {
|
||||
userManageInfo.value = res.data.user
|
||||
userManageInfo.value = res.data
|
||||
// let teacher_cert = JSON.parse(res.data.teacher_cert)
|
||||
// let skill_cert = JSON.parse(res.data.skill_cert)
|
||||
// imgs.value = [...skill_cert,...teacher_cert]
|
||||
@ -58,7 +58,7 @@ function toDealDetail(type) {
|
||||
<div class="gva-search-box">
|
||||
<div class="baseInfo-box">
|
||||
<div class="bb-item">
|
||||
<img class="avatar" :src="userManageInfo.avatar" alt="">
|
||||
<img class="avatar" :src="userManageInfo?.avatar" alt="">
|
||||
</div>
|
||||
<div class="bb-item">
|
||||
昵称:{{userManageInfo.nickname}}
|
||||
|
Loading…
Reference in New Issue
Block a user