子代理
This commit is contained in:
46
src/api/recharge/rechargeSubUser.js
Normal file
46
src/api/recharge/rechargeSubUser.js
Normal file
@@ -0,0 +1,46 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
// 分区接口
|
||||
export const listPartitionInfo = query => {
|
||||
return request({
|
||||
url: '/partition/listPartitionInfo',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
|
||||
export const listRegionType = () => {
|
||||
return request({
|
||||
url: '/admin/charge/region/list',
|
||||
method: 'get',
|
||||
});
|
||||
};
|
||||
|
||||
// 奖池拉框
|
||||
export const page = query => {
|
||||
return request({
|
||||
url: '/admin/recharge/user/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
|
||||
// 奖池拉框
|
||||
export const save = query => {
|
||||
return request({
|
||||
headers:{"Content-Type": 'application/x-www-form-urlencoded'},
|
||||
url: '/admin/recharge/user/save',
|
||||
method: 'post',
|
||||
data: query
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// 奖池拉框
|
||||
export const del = query => {
|
||||
return request({
|
||||
url: '/admin/recharge/user/del',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
300
src/views/recharge/RechargeSubUserView.vue
Normal file
300
src/views/recharge/RechargeSubUserView.vue
Normal file
@@ -0,0 +1,300 @@
|
||||
<template>
|
||||
<div class="box">
|
||||
<!-- ID -->
|
||||
<div class="condition">
|
||||
<!-- 分区 -->
|
||||
<div class="inquire">
|
||||
<span>分区</span>
|
||||
<el-select
|
||||
v-model="inquire.partitionId"
|
||||
placeholder="请选择"
|
||||
@change="handleChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in partitionOptions"
|
||||
:key="item.id"
|
||||
:label="item.desc"
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="inquire">
|
||||
<span>二级代理ID</span>
|
||||
<el-input v-model="inquire.erbanNo" placeholder="" class="input">
|
||||
</el-input>
|
||||
</div>
|
||||
<div class="inquire">
|
||||
<span>一级代理ID</span>
|
||||
<el-input v-model="inquire.manageErbanNo" placeholder="" class="input">
|
||||
</el-input>
|
||||
</div>
|
||||
<!-- 送出时间 -->
|
||||
<div class="inquire">
|
||||
<span>地区</span>
|
||||
<el-select v-model="inquire.regionType">
|
||||
<el-option label="全部" value=""/>
|
||||
<el-option
|
||||
v-for="item in regionOptions"
|
||||
:key="item.type"
|
||||
:label="`${item.desc}(${item.name})`"
|
||||
:value="item.type"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 按钮 -->
|
||||
<div class="but">
|
||||
<el-button class="primary" type="primary" @click="getData()">查询</el-button>
|
||||
</div>
|
||||
|
||||
<!-- 表格 -->
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="table.tableData"
|
||||
border
|
||||
style="width: 100%; margin-top: 25px"
|
||||
>
|
||||
<el-table-column prop="erbanNo" align="center" label="二级代理ID" />
|
||||
<el-table-column prop="nick" align="center" label="二级代理昵称" />
|
||||
<el-table-column prop="manageErbanNo" align="center" label="一级代理ID" />
|
||||
<el-table-column prop="manageNick" align="center" label="一级代理昵称" />
|
||||
<el-table-column prop="starLevel" align="center" label="信誉值" />
|
||||
<el-table-column prop="createTime" align="center" label="成为子代理时间" />
|
||||
<el-table-column prop="type" align="center" label="代理地区">
|
||||
<template v-slot="scope">
|
||||
{{
|
||||
regionOptions.filter(region => scope.row.type & region.type)
|
||||
.map(region => `${region.desc}(${region.name})`).join(',')
|
||||
}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="排序">
|
||||
<template v-slot="scope">
|
||||
<el-text v-for="item in scope.row.userRegions"
|
||||
:key="item.type">
|
||||
{{ regionOptions.filter(region => region.type === item.type).map(region => `${region.desc}(${region.name})`).join(',') }}:{{ item.seq }}
|
||||
</el-text>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="outDiamondNum" align="center" label="最近30天转出金币" />
|
||||
<el-table-column prop="operate" align="center" label="操作">
|
||||
<template v-slot="scope">
|
||||
<el-button
|
||||
@click="edit(scope.row)"
|
||||
class="primary"
|
||||
type="primary"
|
||||
size="small"
|
||||
>编辑</el-button
|
||||
>
|
||||
<el-button
|
||||
@click="del(scope.row)"
|
||||
class="danger"
|
||||
type="danger"
|
||||
size="small"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页 -->
|
||||
<el-pagination
|
||||
style="margin-top: 10px"
|
||||
class="paginationClass"
|
||||
v-model:current-page="currentPage"
|
||||
v-model:page-size="pageSize"
|
||||
:page-sizes="[10, 30, 40, 50, 100, 200, 300, 400, 500]"
|
||||
layout="sizes, prev, pager, next"
|
||||
:total="total"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
|
||||
<!-- 编辑弹窗 -->
|
||||
<el-dialog v-model="editDialog" width="36%" center>
|
||||
<el-form :model="obj" label-width="auto">
|
||||
<el-form-item label="id">
|
||||
<el-input
|
||||
v-model="obj.erbanNo"
|
||||
style="width: 75%"
|
||||
placeholder="用户ID"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="信誉值">
|
||||
<el-rate v-model="obj.starLevel"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="列表展示">
|
||||
<el-switch v-model="obj.hasCharge"
|
||||
active-text="是"
|
||||
inactive-text="否"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="地区">
|
||||
<el-checkbox v-for="item in obj.userRegions"
|
||||
:key="item.type"
|
||||
:label="item.name"
|
||||
:value="item.check"
|
||||
:checked="item.check"
|
||||
@change="handelRegionCheckboxChange(item)">
|
||||
{{item.name}}
|
||||
<el-input type="number" label="排序" v-model="item.seq" style="width: 50%">
|
||||
<template #prepend>排序</template>
|
||||
</el-input>
|
||||
</el-checkbox>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="editDialogCancel()">取消</el-button>
|
||||
<el-button type="primary" @click="editDialogSave()">保存</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { listPartitionInfo, listRegionType, page, save, del } from "@/api/recharge/rechargeSubUser";
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
|
||||
export default {
|
||||
name: "RechargeSubUserView",
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
partitionOptions: [],
|
||||
regionOptions: [],
|
||||
//查询所需条件对象
|
||||
inquire: {
|
||||
partitionId: undefined,
|
||||
erbanNo: undefined,
|
||||
manageErbanNo: undefined,
|
||||
regionType: undefined,
|
||||
},
|
||||
table: {
|
||||
tableData: [],
|
||||
total: 10, //总页数
|
||||
currentPage: 1, //页码
|
||||
pageSize: 10, //条数
|
||||
},
|
||||
editDialog: false,
|
||||
obj : {},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
listPartitionInfo().then((res) => {
|
||||
if (res.code !== 200) {
|
||||
throw new Error(res.msg);
|
||||
}
|
||||
this.partitionOptions = res.data;
|
||||
this.inquire.partitionId = res.data[0].id;
|
||||
}).then(() =>{
|
||||
this.getData();
|
||||
});
|
||||
|
||||
listRegionType().then((res) => {
|
||||
this.regionOptions = res.data;
|
||||
console.info(this.regionOptions)
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 查询接口
|
||||
getData() {
|
||||
this.loading = true;
|
||||
page({
|
||||
partitionId: this.inquire.partitionId,
|
||||
erbanNo: this.inquire.erbanNo,
|
||||
manageErbanNo: this.inquire.manageErbanNo,
|
||||
regionType: this.inquire.regionType,
|
||||
pageNo: this.table.currentPage,
|
||||
pageSize: this.table.pageSize,
|
||||
subChildren: 1,
|
||||
}).then((res) => {
|
||||
this.table.total = res.total;
|
||||
this.table.tableData = res.rows;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
edit(obj) {
|
||||
this.obj = Object.assign({}, obj);
|
||||
this.obj.hasCharge = obj.hasCharge === 1;
|
||||
this.obj.userRegions.forEach(item => {
|
||||
item.check = true;
|
||||
})
|
||||
console.info(obj)
|
||||
this.editDialog = true;
|
||||
},
|
||||
del(obj) {
|
||||
const params = {id: obj.id}
|
||||
del(params).then((res) => {
|
||||
if (res.code === 200) {
|
||||
this.editDialogCancel()
|
||||
ElMessageBox.alert('删除成功', '保存')
|
||||
this.getData();
|
||||
} else {
|
||||
ElMessageBox.alert('删除失败', '保存')
|
||||
}
|
||||
})
|
||||
},
|
||||
handelRegionCheckboxChange(item){
|
||||
item.check = !item.check;
|
||||
console.log(item);
|
||||
},
|
||||
editDialogCancel() {
|
||||
this.obj = {};
|
||||
this.editDialog = false;
|
||||
},
|
||||
// 确认保存
|
||||
editDialogSave() {
|
||||
const data = {
|
||||
id: this.obj.id,
|
||||
erbanNo: this.obj.erbanNo,
|
||||
type: this.obj.type,
|
||||
starLevel: this.obj.starLevel,
|
||||
hasCharge: this.obj.hasCharge? 1: 0,
|
||||
userRegions: JSON.stringify(this.obj.userRegions.filter(item=>item.check)),
|
||||
}
|
||||
save(data).then((res) => {
|
||||
if (res.code === 200) {
|
||||
this.editDialogCancel()
|
||||
ElMessageBox.alert('保存成功', '保存')
|
||||
this.getData();
|
||||
} else {
|
||||
ElMessageBox.alert('保存失败', '保存')
|
||||
}
|
||||
})
|
||||
},
|
||||
// 分页导航
|
||||
handleSizeChange() {
|
||||
this.getData();
|
||||
},
|
||||
handleCurrentChange() {
|
||||
this.getData();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.box {
|
||||
padding-top: 20px;
|
||||
background: #ecf0f5;
|
||||
.condition {
|
||||
margin-bottom: 20px;
|
||||
.inquire {
|
||||
display: inline-block;
|
||||
margin-right: 20px;
|
||||
span {
|
||||
margin-right: 10px;
|
||||
}
|
||||
.input {
|
||||
width: 180px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.but {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
@@ -97,7 +97,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">展示子代理</label>
|
||||
<label class="col-sm-3 control-label">展示在列表</label>
|
||||
<div class="col-sm-9">
|
||||
<select name="hasCharge" id="hasCharge" class="form-control">
|
||||
<option value="1">是</option>
|
||||
@@ -308,6 +308,15 @@ export default {
|
||||
align: "center",
|
||||
width: "5%",
|
||||
},
|
||||
{
|
||||
field: "outSubDiamondNum",
|
||||
title: "最近30天转赠普通金币数",
|
||||
align: "center",
|
||||
width: "5%",
|
||||
formatter: function (val, row, index) {
|
||||
return row.outDiamondNum - row.outSubDiamondNum;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: "id",
|
||||
title: "操作",
|
||||
|
Reference in New Issue
Block a user