佣金设置;财务管理;提现管理

This commit is contained in:
axlrose2333 2023-03-22 15:50:42 +08:00
parent 35fc9df240
commit 2382fc3f9e
15 changed files with 554 additions and 4 deletions

12
src/api/finance.js Normal file
View File

@ -0,0 +1,12 @@
import service from '@/utils/request'
const api = {
/*助教*/
getFinanceInfo : data => { // 财务管理
return service({
url: '/finance',
method: 'get',
params:data
})
}
}
export default api

View File

@ -44,5 +44,18 @@ const api = {
data data
}) })
}, },
getBrokerage: data => { // 获取佣金信息
return service({
url: '/brokerage',
method: 'get'
})
},
brokerageFunc: data => { // 提交佣金设置
return service({
url: '/brokerage',
method: 'post',
data
})
},
} }
export default api export default api

View File

@ -48,6 +48,27 @@ const api = {
method: 'get', method: 'get',
params:data params:data
}) })
} },
getWithdrawList:data => { // 获取用户提现记录
return service({
url: '/withdraw',
method: 'get',
params:data
})
},
passWithdraw:data => { // 同意提现申请
return service({
url: '/withdraw',
method: 'post',
data
})
},
rejectWithdraw:data => { // 拒绝提现申请
return service({
url: '/withdraw/reject',
method: 'post',
data
})
},
} }
export default api export default api

BIN
src/assets/f_icon1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 KiB

BIN
src/assets/f_icon2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 KiB

BIN
src/assets/f_icon3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

BIN
src/assets/f_icon4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

BIN
src/assets/f_icon5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 KiB

View File

@ -58,7 +58,7 @@ function stepChangeFunc(type) {
break; break;
case 2: // case 2: //
if(active.value == 0) { // if(active.value == 0) { //
console.log(isChange.value) // console.log(isChange.value)
if(isChange.value){ if(isChange.value){
submitForm(ruleFormRef.value) submitForm(ruleFormRef.value)
} }
@ -88,6 +88,12 @@ async function saveStep1() {
return item.name === form.value.subject return item.name === form.value.subject
})[0].id })[0].id
form.value.price = parseFloat(form.value.price)<0?0:form.value.price form.value.price = parseFloat(form.value.price)<0?0:form.value.price
if(!checkFreeTestFromPrice()) {
ElMessage({
type: 'warning',
message: '赠送价格不能超过课程价格!'
})
}
let params = { let params = {
step1:{ step1:{
...form.value ...form.value
@ -180,6 +186,25 @@ function handlerChange(e) {
// console.log(e) // console.log(e)
isChange.value = true isChange.value = true
} }
function freeTestFunc() { //
if(!checkFreeTestFromPrice()) {
ElMessage({
type: 'warning',
message: '赠送价格不能超过课程价格!'
})
}
handlerChange()
}
const STD_TEST_PRICE = 4.9
function checkFreeTestFromPrice() { //
let flag = true
if(form.value.free_test && form.value.price) {
if(parseInt(form.value.free_test) * STD_TEST_PRICE > parseFloat(form.value.price)) {
flag = false
}
}
return flag
}
</script> </script>
<template> <template>
<div> <div>
@ -240,6 +265,10 @@ function handlerChange(e) {
<!-- <el-form-item label="包含试听">--> <!-- <el-form-item label="包含试听">-->
<!-- <el-switch @change="handlerChange" v-model="form.is_audition" active-text="" inactive-text="" :active-value="1" :inactive-value="-1" />--> <!-- <el-switch @change="handlerChange" v-model="form.is_audition" active-text="" inactive-text="" :active-value="1" :inactive-value="-1" />-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<el-form-item label="赠送试卷">
<el-input @change="freeTestFunc" placeholder="请输入需要赠送的试卷份数1" v-model="form.free_test" />
<div style="color:gray;font-size: 12px" v-if="form.free_test">总计{{(STD_TEST_PRICE*form.free_test).toFixed(2)}} </div>
</el-form-item>
<el-form-item label="设置精品"> <el-form-item label="设置精品">
<el-switch @change="handlerChange" v-model="form.is_boutique" active-text="" inactive-text="" :active-value="1" :inactive-value="-1" /> <el-switch @change="handlerChange" v-model="form.is_boutique" active-text="" inactive-text="" :active-value="1" :inactive-value="-1" />
</el-form-item> </el-form-item>

View File

@ -154,6 +154,7 @@ async function enterChapterChildDialog() { // 提交小章节
// return // return
if(chapterChildForm.value.course_subsection_id){ // if(chapterChildForm.value.course_subsection_id){ //
func_name = 'editChapter' func_name = 'editChapter'
params.course_id = parseInt(props.course_id)
} }
else{ // else{ //
func_name = 'addChapter' func_name = 'addChapter'

View File

@ -236,6 +236,9 @@ function handleChooseChange(row) {
</div> </div>
</template> </template>
<style scoped> <style scoped>
.el-table th, .el-table tr{
cursor: pointer;
}
.drawer-section{ .drawer-section{
padding: 10px; padding: 10px;
} }

View File

@ -120,9 +120,9 @@ async function getCourseName(course_id) {
</el-table-column> </el-table-column>
<el-table-column align="left" label="科目" min-width="150" prop="subject"></el-table-column> <el-table-column align="left" label="科目" min-width="150" prop="subject"></el-table-column>
<el-table-column align="left" label="课程" min-width="150" prop="name"></el-table-column> <el-table-column align="left" label="课程" min-width="150" prop="name"></el-table-column>
<el-table-column align="left" label="测试用时/限时" min-width="150"> <el-table-column align="left" label="测试用时/限时(分钟)" min-width="150">
<template #default="scope"> <template #default="scope">
{{scope.row.duration/scope.row.duration}} {{scope.row.duration+'/'+scope.row.time_limit}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="left" label="测试状态" min-width="150" prop="status"> <el-table-column align="left" label="测试状态" min-width="150" prop="status">

View File

@ -0,0 +1,111 @@
<script setup>
//
import api from '@/api/finance'
import custom from '@/utils/custom'
import {formatDate} from '@/utils/format'
import _ from 'lodash'
import {ref,onMounted } from 'vue'
//
import icon1 from '@/assets/f_icon1.png'
import icon2 from '@/assets/f_icon2.png'
import icon3 from '@/assets/f_icon3.png'
import icon4 from '@/assets/f_icon4.png'
import icon5 from '@/assets/f_icon5.png'
//
onMounted(() => {
getFinanceInfo()
})
//
const financeInfo = ref({})
//
async function getFinanceInfo() {
const res = await api.getFinanceInfo()
if(res.code === 0) {
financeInfo.value = res.data
}
}
</script>
<template>
<div class="gva-table-box fiance-box">
<div class="card-box">
<div class="card-item">
<div class="ci-icon">
<img :src="icon1" alt="">
</div>
<div class="ci-title">学生总数</div>
<div class="ci-value">{{financeInfo.student_num}}</div>
</div>
<div class="card-item">
<div class="ci-icon">
<img :src="icon2" alt="">
</div>
<div class="ci-title">助教总数</div>
<div class="ci-value">{{financeInfo.assistant_num}}</div>
</div>
<div class="card-item">
<div class="ci-icon">
<img :src="icon3" alt="">
</div>
<div class="ci-title">老师总数</div>
<div class="ci-value">{{financeInfo.teacher_num}}</div>
</div>
<div class="card-item">
<div class="ci-icon">
<img :src="icon4" alt="">
</div>
<div class="ci-title">课程订单</div>
<div class="ci-value">{{financeInfo.course_order_num}}</div>
</div>
<div class="card-item">
<div class="ci-icon">
<img :src="icon5" alt="">
</div>
<div class="ci-title">测试订单</div>
<div class="ci-value">{{financeInfo.exam_order_num}}</div>
</div>
</div>
<div class="total-box">
<div class="tb-item">
今日收益{{financeInfo.today_income}}
</div>
<div class="tb-item">
累计总收益{{financeInfo.total_income}}
</div>
</div>
</div>
</template>
<style scoped lang="scss">
.fiance-box{
.card-box{
margin-bottom: 30px;
.card-item{
.ci-title{
margin-bottom: 10px;
}
.ci-icon{
img{
width: 80px;
height: 80px;
}
position: absolute;top: 5px;
right: 5px;
}
position: relative;
display: inline-block;
width: 300px;
height: 150px;
margin-right: 10px;
margin-bottom: 10px;
box-shadow: 5px 5px 5px #f0f2f5;
padding: 10px;
background: linear-gradient(#4fadc9,white);
color: white;
}
}
.total-box{
.tb-item{
margin-bottom: 10px;
}
}
}
</style>

View File

@ -0,0 +1,98 @@
<script setup>
//
import api from '@/api/market'
import custom from '@/utils/custom'
import {formatDate} from '@/utils/format'
import _ from 'lodash'
import {ref,onMounted } from 'vue'
//
onMounted(() => {
// console.log(brokerageForm.value)
getBrokerage()
})
//
const brokerageForm = ref({})
const brokerageFormRules = ref({
exam_assistant: [{ required: true, message: '请输入助教佣金', trigger: 'blur' }],
exam_manage:[{ required: true, message: '请输入主管佣金', trigger: 'blur'},
{ type: 'number', message: '请输入正确的格式',trigger: 'blur' }],
exam_assistant_assistant:[{ required: true, message: '请输入助教推荐助教佣金', trigger: 'blur'},
{ type: 'number', message: '请输入正确的格式' }],
exam_assistant_teacher:[{ required: true, message: '请输入助教推荐老师佣金', trigger: 'blur'},
{ type: 'number', message: '请输入正确的格式' }],
course_assistant:[{ required: true, message: '请输入助教佣金占比', trigger: 'blur' }],
course_manage:[{ required: true, message: '请输入主管佣金占比', trigger: 'blur' }],
course_assistant_assistant:[{ required: true, message: '请输入助教推荐助教佣金占比', trigger: 'blur' }],
course_assistant_teacher:[{ required: true, message: '请输入助教推荐老师佣金占比', trigger: 'blur' }],
})
const brokerageFormRef = ref(null)
//
async function getBrokerage() {
const res = await api.getBrokerage()
if(res.code === 0) {
brokerageForm.value = res.data
}
}
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() {
const params = {
...brokerageForm.value
}
const res = await api.brokerageFunc(params)
if(res.code === 0) {
ElMessage({
type: 'success',
message: res.msg
})
getBrokerage()
}
}
</script>
<template>
<div class="brokerage-box gva-table-box">
<el-form ref="brokerageFormRef" class="form-box" :model="brokerageForm" :rules="brokerageFormRules" label-width="180px" style="width:50%">
<el-form-item>测试题佣金设置</el-form-item>
<el-form-item label="助教(元/份)" prop="exam_assistant">
<el-input v-model.number="brokerageForm.exam_assistant" placeholder="请输入助教佣金" autocomplete="off" />
</el-form-item>
<el-form-item label="主管(元/份)" prop="exam_manage">
<el-input v-model.number="brokerageForm.exam_manage" placeholder="请输入主管佣金" autocomplete="off" />
</el-form-item>
<el-form-item label="助教推荐助教(元/份)" prop="exam_assistant_assistant">
<el-input v-model.number="brokerageForm.exam_assistant_assistant" placeholder="请输入助教推荐助教佣金" autocomplete="off" />
</el-form-item>
<el-form-item label="助教推荐老师(元/份)" prop="exam_assistant_teacher">
<el-input v-model.number="brokerageForm.exam_assistant_teacher" placeholder="请输入助教推荐老师佣金" autocomplete="off" />
</el-form-item>
<el-form-item>课程佣金设置</el-form-item>
<el-form-item label="助教(%)" prop="course_assistant">
<el-input v-model.number="brokerageForm.course_assistant" placeholder="请输入助教佣金占比" autocomplete="off" />
</el-form-item>
<el-form-item label="主管(%)" prop="course_manage">
<el-input v-model.number="brokerageForm.course_manage" placeholder="请输入主管佣金占比" autocomplete="off" />
</el-form-item>
<el-form-item label="助教推荐助教(%)" prop="course_assistant_assistant">
<el-input v-model.number="brokerageForm.course_assistant_assistant" placeholder="请输入助教推荐助教佣金占比" autocomplete="off" />
</el-form-item>
<el-form-item label="助教推荐老师(%)" prop="course_assistant_teacher">
<el-input v-model.number="brokerageForm.course_assistant_teacher" placeholder="请输入助教推荐老师佣金占比" autocomplete="off" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm(brokerageFormRef)">保存</el-button>
</el-form-item>
</el-form>
</div>
</template>
<style lang="scss" scoped>
</style>

View File

@ -0,0 +1,262 @@
<script setup>
//
import api from '@/api/userManage'
import capi from '@/api/course'
import custom from '@/utils/custom'
import {formatDate} from '@/utils/format'
// import { toSQLLine } from '@/utils/stringFun'
// import WarningBar from '@/components/warningBar/warningBar.vue'
// import coursePool from './components/coursePool.vue'
// import exercisesPool from '@/view/course/components/exercisesPool.vue'
import {ref,onMounted,provide } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { useRouter, useRoute } from 'vue-router'
const router = useRouter()
const route = useRoute()
import cityList from '@/utils/city.json';
// store
import { useUserStore } from '@/pinia/modules/user'
const userStore = useUserStore()
//
// const path = ref(import.meta.env.VITE_BASE_API)
const queryParams = ref({
page:1,
pageSize:10,
status:'',
userId:'',
userType:'',
name:'',
province:''
})
const tableData = ref([])
const total = ref(0)
const status_list = ref([
{
name:'审核中',
value:1
},
{
name:'同意',
value:2
},
{
name:'拒绝',
value:3
}
])
//
onMounted(() => {
getWithdrawList()
})
//
async function getWithdrawList() {
const res = await api.getWithdrawList(queryParams.value)
if(res.code === 0) {
tableData.value = res.data.records
total.value = res.data.total
}
}
function onSubmit() {
getWithdrawList()
}
const onReset = () => {
queryParams.value = {
page:1,
pageSize:10,
status:'',
userId:'',
userType:'',
name:'',
province:''
}
}
function handleCurrentChange(val) {
queryParams.value.pageIndex = val
getWithdrawList()
}
function handleSizeChange(val) {
queryParams.value.pageSize = val
getWithdrawList()
}
function viewUserFunc(row) { //
router.push({name:'viewUserManage',params:{id:row.user_id}})
}
function getStateName(state) {
return status_list.value.filter((item,i) => {
return item.value === state
})[0].name
}
function getProvinceName(province) {
if(province < 0) return ''
return cityList[province].name
}
async function passFunc(row) { //
ElMessageBox.confirm('是否通过该提现申请?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(async() => {
const res = await api.passWithdraw({
withdraw_id:row.id
})
if (res.code === 0) {
ElMessage({
type: 'success',
message: '操作成功!'
})
getWithdrawList()
}
},() => {
})
}
async function rejectFunc(row) { //
ElMessageBox.confirm('是否拒绝该提现申请?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(async() => {
const res = await api.rejectWithdraw({
withdraw_id:row.id
})
if (res.code === 0) {
ElMessage({
type: 'success',
message: '操作成功!'
})
getWithdrawList()
}
},() => {
})
}
</script>
<template>
<div>
<!-- 搜索框-->
<div class="gva-search-box">
<el-form ref="searchForm" :inline="true" :model="queryParams">
<el-form-item label="提现状态">
<el-select v-model="queryParams.status" clearable placeholder="请选择">
<el-option
v-for="(item,i) in status_list"
:key="item.value"
:label="item.name"
:value="item.value"
/>
</el-select>
</el-form-item>
<el-form-item label="区域">
<el-select v-model="queryParams.province" clearable placeholder="请选择">
<el-option
v-for="(item,i) in cityList"
:key="item.ProID"
:label="item.name"
:value="i"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button size="small" type="primary" icon="search" @click="onSubmit">查询</el-button>
<el-button size="small" icon="refresh" @click="onReset">重置</el-button>
</el-form-item>
</el-form>
</div>
<!-- 表格数据-->
<div class="gva-table-box">
<!-- 批量操作-->
<div class="gva-btn-list">
</div>
<!-- 数据列表-->
<el-table :data="tableData">
<el-table-column align="center" label="ID" prop="user_id" sortable="custom" />
<el-table-column align="center" label="头像" min-width="150">
<template #default="scope">
<img class="avatar-css" :src="scope.row.avatar" alt="">
</template>
</el-table-column>
<el-table-column align="center" label="姓名" prop="name" />
<el-table-column align="center" label="手机号" min-width="150" prop="phone" />
<el-table-column align="center" label="余额" min-width="150" prop="balance" />
<el-table-column align="center" label="提现金额" min-width="150" prop="count" />
<el-table-column align="center" label="提现时间" min-width="150" >
<template #default="scope">
{{formatDate(scope.row.CreatedAt)}}
</template>
</el-table-column>
<el-table-column align="center" label="所属省份" min-width="150">
<template #default="scope">
{{getProvinceName(scope.row.province)}}
</template>
</el-table-column>
<el-table-column align="center" label="状态" min-width="150">
<template #default="scope">
{{getStateName(scope.row.status)}}
</template>
</el-table-column>
<el-table-column align="center" fixed="right" label="操作" width="200">
<template #default="scope">
<el-button
icon="view"
size="small"
type="primary"
link
@click="viewUserFunc(scope.row)"
>查看</el-button>
<el-button
icon="check"
size="small"
type="primary"
link
@click="passFunc(scope.row)"
>通过</el-button>
<el-button
icon="close"
size="small"
type="primary"
link
@click="rejectFunc(scope.row)"
>拒绝</el-button>
</template>
</el-table-column>
</el-table>
<div class="gva-pagination">
<el-pagination
:current-page="queryParams.page"
:page-size="queryParams.pageSize"
:page-sizes="[10, 30, 50, 100]"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
/>
</div>
</div>
</div>
</template>
<style scoped lang="scss">
.avatar-css{
height: 100px;
width: 150px;
}
.e-img{
width: 150px;
height: 100px;
}
.option-item{
display: flex;
align-items: center;
margin-bottom: 10px;
}
.button-box {
padding: 10px 20px;
.el-button {
float: right;
}
}
.warning {
color: #dc143c;
}
</style>