Initial commit
This commit is contained in:
209
promo-ui2/src/views/subFlow/index.vue
Normal file
209
promo-ui2/src/views/subFlow/index.vue
Normal file
@@ -0,0 +1,209 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-page-header @back="goBack" v-if="userId = parentId" />
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
|
||||
<el-form-item label="时间">
|
||||
<el-form-item label="下级玩家ID">
|
||||
<el-input v-model="queryParams.playerId" clearable />
|
||||
</el-form-item>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="small" @click="handleQuery"
|
||||
>查询</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table
|
||||
:data="alltableData"
|
||||
style="width: 100%; margin-bottom: 20px; margin-top: 10px"
|
||||
row-key="userId"
|
||||
border
|
||||
default-expand-all
|
||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
||||
>
|
||||
<el-table-column prop="userId" label="用户ID" />
|
||||
<el-table-column prop="userName" label="用户名" />
|
||||
<el-table-column prop="nickName" label="昵称" />
|
||||
<el-table-column prop="userType" label="用户类型">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.userType === '01'">主播</span>
|
||||
<span v-else-if="scope.row.userType === '02'">玩家</span>
|
||||
<span v-else>未知类型</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间" />
|
||||
<el-table-column prop="totalRecharge" label="总充值" />
|
||||
<el-table-column prop="totalNormGameCost" label="普通游戏消费" />
|
||||
<el-table-column prop="totalSpecialGameCost" label="特殊游戏消费" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
v-if="scope.row.userType === '02'"
|
||||
size="small"
|
||||
type="primary"
|
||||
link
|
||||
icon="el-icon-money"
|
||||
@click="getPurchaseData(scope.row.userId)"
|
||||
>流水明细</el-button
|
||||
>
|
||||
<!-- <el-button
|
||||
v-if="scope.row.userType === '01'"
|
||||
size="small"
|
||||
type="primary"
|
||||
link
|
||||
icon="el-icon-data-line"
|
||||
@click="getCommissionRateData(scope.row.userId)"
|
||||
>佣金比例</el-button
|
||||
> -->
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column label="下级" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button size="small" link icon="el-icon-money" @click="getgengnduo(scope.row.userId)"
|
||||
>查看下级</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
<el-pagination
|
||||
layout="prev, pager, next"
|
||||
:page-size="10"
|
||||
:total="total"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
|
||||
<el-dialog title="流水明细" v-model="dialogTableVisible" align-center>
|
||||
<Transaction :user-id="subFlowUserId" />
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="佣金比例" v-model="dialogCommissionRateVisible">
|
||||
<span style="line-height: 30px">指定下级佣金比例,设置后将无法修改!</span>
|
||||
<el-input v-model="editCommissionRateBody.commissionRate" placeholder="请输入佣金比例" />
|
||||
<template v-slot:footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" size="default" @click="editCommissionRate">修改</el-button>
|
||||
<el-button size="default" @click="dialogCommissionRateVisible = false">取消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onMounted } from 'vue'
|
||||
import {
|
||||
ElPageHeader,
|
||||
ElDatePicker,
|
||||
ElTable,
|
||||
ElTableColumn,
|
||||
ElForm,
|
||||
ElFormItem,
|
||||
ElInput,
|
||||
ElButton,
|
||||
ElMessage,
|
||||
ElDialog,
|
||||
ElPagination
|
||||
} from 'element-plus'
|
||||
import {
|
||||
getSubBranches,
|
||||
getPurchaseByUserId,
|
||||
getCommissionRateByUserId,
|
||||
updateCommissionRate
|
||||
} from '@/api/subflow'
|
||||
|
||||
import Transaction from './transaction.vue'
|
||||
|
||||
import { getInfo } from '@/api/user'
|
||||
|
||||
// 定义响应式状态
|
||||
const tableData = ref([])
|
||||
const alltableData = ref([] as any)
|
||||
const dialogTableVisible = ref(false)
|
||||
const dialogCommissionRateVisible = ref(false)
|
||||
const userId = ref('')
|
||||
const parentId = ref('')
|
||||
const adddd = ref([])
|
||||
const subFlowUserId = ref('')
|
||||
const total = ref(0)
|
||||
const currentPage = ref(0)
|
||||
// 定义查询参数
|
||||
const queryParams = reactive({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
userId: undefined as number | undefined | string,
|
||||
playerId: undefined as number | undefined | string
|
||||
})
|
||||
|
||||
const editCommissionRateBody = reactive({
|
||||
userId: '',
|
||||
commissionRate: ''
|
||||
})
|
||||
|
||||
const handleCurrentChange = (val: number) => {
|
||||
currentPage.value = val
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 获取下级数据 */
|
||||
const getSubBranchesData = () => {
|
||||
queryParams.userId = userId.value
|
||||
getSubBranches(queryParams).then((response) => {
|
||||
tableData.value = response.data.rows
|
||||
total.value = response.data.total
|
||||
alltableData.value = tableData.value
|
||||
})
|
||||
}
|
||||
|
||||
/** 返回上一级 */
|
||||
const goBack = () => {
|
||||
/* console.log(alltableData.value) */
|
||||
if (alltableData.value.length == 0) {
|
||||
const a: any = tableData.value.filter((item: any) => item.userId === parentId.value)
|
||||
console.log(a)
|
||||
alltableData.value = tableData.value.filter((item: any) => item.parentId === a[0].parentId)
|
||||
} else {
|
||||
const a: any = tableData.value.filter(
|
||||
(item: any) => item.userId === alltableData.value[0].parentId
|
||||
)
|
||||
console.log(a)
|
||||
alltableData.value = tableData.value.filter((item: any) => item.parentId === a[0].parentId)
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取采购数据 */
|
||||
const getPurchaseData = (userId) => {
|
||||
dialogTableVisible.value = true
|
||||
subFlowUserId.value = userId
|
||||
}
|
||||
|
||||
/** 获取并准备编辑佣金比例 */
|
||||
const getCommissionRateData = (userId) => {
|
||||
editCommissionRateBody.userId = userId
|
||||
getCommissionRateByUserId(userId).then((response) => {
|
||||
editCommissionRateBody.commissionRate = response.data.commissionRate
|
||||
})
|
||||
dialogCommissionRateVisible.value = true
|
||||
}
|
||||
|
||||
/** 提交修改佣金比例 */
|
||||
const editCommissionRate = () => {
|
||||
updateCommissionRate(editCommissionRateBody).then((response) => {
|
||||
ElMessage({
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
})
|
||||
dialogCommissionRateVisible.value = false
|
||||
})
|
||||
}
|
||||
|
||||
const handleQuery = () => {
|
||||
getInfo().then((res) => {
|
||||
userId.value = res.data.userId
|
||||
getSubBranchesData()
|
||||
})
|
||||
}
|
||||
|
||||
// 组件挂载时初始化
|
||||
onMounted(() => {
|
||||
handleQuery()
|
||||
})
|
||||
</script>
|
||||
108
promo-ui2/src/views/subFlow/transaction.vue
Normal file
108
promo-ui2/src/views/subFlow/transaction.vue
Normal file
@@ -0,0 +1,108 @@
|
||||
<template>
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
|
||||
<el-form-item label="时间">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
style="width: 240px"
|
||||
value-format="YYYY-MM-DD"
|
||||
type="daterange"
|
||||
range-separator="-"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="small" @click="handleQuery"
|
||||
>查询</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table :data="gridData" style="width: 100%">
|
||||
<el-table-column property="date" label="日期" width="150" />
|
||||
<el-table-column property="dailyRecharge" label="日充值" width="200" />
|
||||
<el-table-column property="dailyNormGameCost" label="日普通游戏消费" />
|
||||
<el-table-column property="dailySpecialGameCost" label="日特殊游戏消费" />
|
||||
</el-table>
|
||||
<el-pagination
|
||||
layout="prev, pager, next"
|
||||
:page-size="10"
|
||||
:total="total"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
ElTable,
|
||||
ElTableColumn,
|
||||
ElForm,
|
||||
ElFormItem,
|
||||
ElButton,
|
||||
ElPagination,
|
||||
ElDatePicker
|
||||
} from 'element-plus'
|
||||
|
||||
import { getPurchaseByUserId } from '@/api/subflow/index'
|
||||
|
||||
import { onMounted, reactive, ref, watch } from 'vue'
|
||||
|
||||
// 接收父组件传递的数据
|
||||
const props = defineProps<{
|
||||
userId: string | number
|
||||
}>()
|
||||
|
||||
const gridData = ref([])
|
||||
// 定义查询参数
|
||||
const queryParams = reactive({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
beginTime: undefined as string | undefined,
|
||||
endTime: undefined as string | undefined,
|
||||
userId: undefined as number | undefined | string
|
||||
})
|
||||
// 日期范围
|
||||
const dateRange = ref([])
|
||||
const total = ref(0)
|
||||
const currentPage = ref(1)
|
||||
|
||||
watch(
|
||||
() => props.userId,
|
||||
(newVal) => {
|
||||
if (newVal) {
|
||||
handleQuery()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
const handleCurrentChange = (val: number) => {
|
||||
currentPage.value = val
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
const getPurchaseData = () => {
|
||||
getPurchaseByUserId(queryParams).then((response) => {
|
||||
gridData.value = response.rows
|
||||
total.value = response.total
|
||||
})
|
||||
}
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.userId = props.userId
|
||||
queryParams.pageSize = 10
|
||||
queryParams.pageNum = currentPage.value
|
||||
|
||||
if (dateRange.value !== null && dateRange.value.length === 2) {
|
||||
queryParams.beginTime = dateRange.value[0]
|
||||
queryParams.endTime = dateRange.value[1]
|
||||
} else {
|
||||
queryParams.beginTime = undefined
|
||||
queryParams.endTime = undefined
|
||||
}
|
||||
getPurchaseData()
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
handleQuery()
|
||||
})
|
||||
</script>
|
||||
Reference in New Issue
Block a user