代理商管理

This commit is contained in:
“wanyongkang”
2021-02-21 18:57:03 +08:00
parent b35041b141
commit bc24510cdc
4 changed files with 586 additions and 0 deletions

View File

@@ -0,0 +1,298 @@
<template>
<div v-loading="loading">
<div class="heior_box">
<el-button size="small" type="primary" icon="el-icon-plus" @click="add">添加代理商</el-button>
<div class="search-box">
<el-input v-model="searchModel.keyWord" placeholder="请输入代理商账号" clearable size="small">
<el-button slot="append" icon="el-icon-search" @click="search"></el-button>
</el-input>
</div>
</div>
<el-table :data="retData.Data" size="medium" :height="$getHeight(100)" row-key="Id" border>
<!-- <el-table-column prop="LoginCode" label="会员号" width="120px"></el-table-column> -->
<!-- <el-table-column prop="Name" label="名称"></el-table-column> -->
<el-table-column prop="username" label="代理商账号" width="120px">
</el-table-column>
<el-table-column prop="create_time" label="创建时间" width="160px"></el-table-column>
<!-- <el-table-column prop="ProductAccountCount" label="账号总数"></el-table-column>
<el-table-column prop="ExpiredProductAccountCount" label="过期数"></el-table-column>
<el-table-column prop="ExpiredProductAccountCount" label="未过期数"></el-table-column>-->
<!-- <el-table-column prop="ConsumeAmount" label="消费总额"></el-table-column> -->
<el-table-column prop="account" label="余额"></el-table-column>
<el-table-column prop="realname" label="姓名"></el-table-column>
<el-table-column prop="phone" label="电话号码"></el-table-column>
<el-table-column prop="user_num" label="用户数量"></el-table-column>
<el-table-column label="操作" width="400px">
<template slot-scope="scope">
<span class="handel cursor edit" @click="showAmount(scope.row,1)" v-if="IsRoot">充值</span>
<span class="handel cursor edit" @click="showAmount(scope.row,2)">扣款</span>
<router-link :to="{name:'agentprice',query:{id:scope.row.id}}">
<span class="handel cursor edit">代理价</span>
</router-link>
<span class="handel cursor edit" @click="edit(scope.row)">编辑</span>
<span class="handel cursor edit" @click="showAmountDetail(scope.row)">明细</span>
</template>
</el-table-column>
</el-table>
<div class="block">
<el-pagination
v-if="retData.Data.length>0"
@current-change="get"
:page-size="50"
:current-page.sync="searchModel.PageIndex"
layout="total,prev, pager, next"
:total="retData.TotalCount"
></el-pagination>
</div>
<el-dialog title="添加代理商" :visible.sync="showDialog" width="400px">
<el-form :model="userModel" :rules="rules" ref="inputUserForm" label-width="80px">
<el-form-item prop="username" label="用户名">
<el-input v-model="userModel.username" :disabled="optype==2" size="small"></el-input>
</el-form-item>
<el-form-item prop="password" label="密码">
<el-input v-model="userModel.password" show-password size="small"></el-input>
</el-form-item>
<el-form-item prop="phone" label="手机号">
<el-input v-model="userModel.phone" size="small"></el-input>
</el-form-item>
<el-form-item prop="realname" label="真实姓名">
<el-input v-model="userModel.realname" size="small"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="resetForm('inputUserForm')"> </el-button>
<el-button type="primary" @click="save('inputUserForm')">确定</el-button>
</span>
</el-dialog>
<el-dialog
:title="amountModel.opAmountType==1?'充值':'扣费'"
:visible.sync="amountModel.showAmountDialog"
width="300px"
>
<el-form :model="amountModel" :rules="amountRules" ref="inputAmountForm" label-width="80px">
<el-form-item prop="rest" label="当前余额">
<el-input v-model="amountModel.rest" size="small" disabled></el-input>
</el-form-item>
<el-form-item prop="amount" :label="amountModel.opAmountType==1?'充值金额':'扣费金额'">
<el-input v-model="amountModel.amount" size="small" type="number"></el-input>
</el-form-item>
<el-form-item prop="attchInfo" label="备注">
<el-input v-model="amountModel.attchInfo" size="small" ></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="resetForm('inputAmountForm')"> </el-button>
<el-button type="primary" @click="updateAmount('inputAmountForm')">确定</el-button>
</span>
</el-dialog>
<el-dialog title="测试限额设置" :visible.sync="showTestDialog" width="300px">
<el-form :model="testLimitModel" ref="inputTestForm" label-width="80px">
<el-form-item prop="limit" label="限制次数">
<el-input v-model="testLimitModel.limit" size="small" type="number"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="resetForm('inputTestForm')"> </el-button>
<el-button type="primary" @click="updateTestLimit()">确定</el-button>
</span>
</el-dialog>
<el-dialog title="资金明细" :visible.sync="showDetailDialog" width="500px">
<el-table
:data="detailAmountData"
size="medium"
:height="$getHeight(300)"
row-key="Id"
border
>
<el-table-column prop="remark" label="资金项目"></el-table-column>
<el-table-column prop="score_value" label="金额"></el-table-column>
</el-table>
</el-dialog>
</div>
</template>
<script>
export default {
name: "userIndex",
components: {
cutTip: () => import("@/components/common/cutTip"),
phoneHide: () => import("@/components/common/phonehide")
},
data() {
return {
isRoot:false,
loading: false,
showDialog: false,
showTestDialog: false,
showDetailDialog: false,
optype: 1, //1:添加 2编辑
userModel: {
username: "",
password: "",
phone: "",
realname: ""
},
amountModel: {
rest: 0,
amount: 0,
opAmountType: 1, ////1:充值 2扣款
showAmountDialog: false,
attchInfo:''
},
testLimitModel: {
userId: 0,
limit: 3
},
retData: { TotalCount: 0, Data: [] },
searchModel: {
PageIndex: 1,
keyWord: ""
},
rules: {
LoginCode: [this.$vaild.required("登录名称")],
Phone: [this.$vaild.required("手机号")],
// Password: [this.$vaild.required("密码")]
},
amountRules: {
// amount: [{ type: 'number', message: '金额必须为数字值'}],
},
detailAmountData: [],
};
},
created () {
this.$store.commit('setCurrentNav', '用户管理>>代理商管理')
var currentUser = this.$local.getUserByCache()
this.IsRoot = currentUser.Manager.IsRootUser
this.get()
// eslint-disable-next-line camelcase
let user_info = this.$local.getUserByCache().Manager.RealName
this.$api.post(this.$api.phpURL + 'logs/index/clickVipInfo', {
user: user_info,
operation: '点击客户管理',
record: '查询客户信息列表'
}).then(res => {})
},
methods: {
search(){
this.searchModel.PageIndex=1;
this.get();
},
get() {
this.$api.get(this.$api.phpURL + "agent/agent/getList", this.searchModel).then(res => {
this.retData = res;
});
},
del(item) {
var that = this;
this.$confirm("确定删除?", "", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(_ => {
this.$api.post("baseinfo/v1/user/Delete?id=" + item.Id).then(res => {
that.get();
});
});
},
add() {
this.showDialog = true;
this.optype = 1;
},
edit(item) {
this.showDialog = true;
this.optype = 2;
this.userModel = clone(item);
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.showDialog = false;
this.amountModel.showAmountDialog = false;
this.showTestDialog = false;
},
save(formName) {
this.userModel.username = this.userModel.username.trim()
this.$refs[formName].validate(valid => {
if (!valid) return;
if (this.optype == 1) {
this.$api.post(this.$api.phpURL + "agent/agent/addAgent", this.userModel).then(res => {
this.resetForm("inputUserForm");
this.get();
});
} else {
this.$api.post("baseinfo/v1/user/put", this.userModel).then(res => {
this.resetForm("inputUserForm");
this.get();
});
}
});
},
showAmount(item, type) {
this.amountModel.rest = item.account;
this.amountModel.opAmountType = type;
this.amountModel.showAmountDialog = true;
this.amountModel.id = item.id;
},
updateAmount(formName) {
this.$refs[formName].validate(valid => {
if (!valid) return;
this.$api
.post(this.$api.phpURL + "agent/agent/account", this.amountModel)
.then(res => {
this.resetForm("inputAmountForm");
this.get();
});
});
},
showUpdateTest(item) {
this.showTestDialog = true;
this.testLimitModel.UserId = item.Id;
this.testLimitModel.limit = item.TestCountLimit;
},
updateTestLimit() {
this.$api
.post(this.$api.phpURL + "user/user/testCount", this.testLimitModel)
.then(res => {
this.resetForm("inputTestForm");
this.get();
});
},
showAmountDetail(item) {
this.showDetailDialog = true;
this.$api
.get(this.$api.phpURL + "agent/score/getScoreList?id=" + item.id)
.then(res => {
this.detailAmountData = res.Data
});
},
showHandle (r) {
// eslint-disable-next-line camelcase
let user_info = this.$local.getUserByCache().Manager.RealName
},
day(r){
this.$api.post(this.$api.phpURL + "user/user/setDay", r).then(res => {
});
},
dataExport () {
this.$api.getDownloadFile('/baseinfo/v1/user/Export')
// eslint-disable-next-line camelcase
let user_info = this.$local.getUserByCache().Manager.RealName
this.$api.post(this.$api.phpURL + 'logs/index/export', {
user: user_info,
operation: '点击导出所有客户信息',
record: '导出所有客户信息列表',
info: '本次点击时间之前所有客户数据'
}).then(res => {})
}
}
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,198 @@
<template>
<div v-loading="loading">
<div class="heior_box">
<!-- <el-button size="small" type="primary" icon="el-icon-plus" @click="showDialogDiscount=true">折扣价格</el-button> -->
<!-- <div class="search-box">
<el-input v-model="searchModel.keyWord" placeholder="请输入套餐名称/标题" clearable size="small">
<el-button slot="append" icon="el-icon-search" @click="get"></el-button>
</el-input>
</div> -->
</div>
<div>
<el-tabs tab-position="left" :style="$getStyleHeight(100)">
<el-tab-pane :label="item.Product.Name" v-for="(item,index) in product" :key="index">
<el-table
:data="item.PackageUserPrices"
row-key="Id"
border
size="medium"
:height="$getHeight(100)"
>
<el-table-column prop="Package.Name" label="套餐名称"></el-table-column>
<el-table-column prop="Package.Price" label="原价格"></el-table-column>
<el-table-column prop="UserPrice.price" label="会员价格">
<template slot-scope="scope">
{{scope.row.UserPrice.price||'--'}}
</template></el-table-column>
<el-table-column prop="UserPrice.refund" label="退款单价"></el-table-column>
<!-- <el-table-column prop="UserPrice.Remark" label="说明"></el-table-column> -->
<el-table-column prop="UserPrice.status" label="启用状态" width="100">
<template slot-scope="scope">
<el-switch
v-model="scope.row.UserPrice.status"
active-value="1"
inactive-value="0"
active-color="#13ce66"
inactive-color="#dcdfe6"
@change="changeStatus(scope.row)"
></el-switch>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<span class="handel cursor edit" @click="goEdit(scope.row)">编辑</span>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
</el-tabs>
</div>
<el-dialog title="会员价格" :visible.sync="showDialog" width="400px">
<el-form
:model="current"
:rules="rules"
ref="inputPackageForm"
label-width="80px"
>
<el-form-item prop="Name" label="套餐名称">
<el-input v-model="current.Name" size="small" disabled=""></el-input>
</el-form-item>
<el-form-item prop="Price" label="原价格">
<el-input v-model="current.Price" type="number" size="small" disabled=""></el-input>
</el-form-item>
<el-form-item prop="MinPrice" label="会员价格">
<el-input v-model="current.UserPrice" type="number" size="small"></el-input>
</el-form-item>
<el-form-item prop="RefundDayPrice" label="退款单价">
<el-input v-model="current.RefundDayPrice" type="number" size="small"></el-input>
</el-form-item>
<!-- <el-form-item prop="Remark" label="说明">
<el-input v-model="current.Remark" size="small"></el-input>
</el-form-item> -->
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="resetForm"> </el-button>
<el-button type="primary" @click="save">确定</el-button>
</span>
</el-dialog>
<el-dialog title="价格折扣" :visible.sync="showDialogDiscount" width="300px">
<el-form
:model="current"
:rules="rules"
ref="inputPackageForm"
label-width="80px"
>
<el-form-item prop="Name" label="折扣方案">
<el-select size="small" v-model="currentDiscount.schemeId">
<el-option v-for="(item,index) in productDiscounts" :key="index" :label="item.Name" :value="item.Id"></el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="showDialogDiscount=false"> </el-button>
<el-button type="primary" @click="setDiscount">确定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
export default {
name: "treeTable",
components: {},
data() {
return {
loading: false,
showDialog:false,
showDialogDiscount:false,
retData: { TotalCount: 0, Data: [] },
searchModel: {
PageIndex: 1,
keyWord: ""
},
product:[],
current: {
Name:"",
Remark:'',
Price:0,
UserPrice:0,
UserId:0,
PackageId:0,
ProductId:0,
RefundDayPrice:0,
},
rules:{},
currentDiscount:{
schemeId:null,
userId:null,
},
productDiscounts:[]
};
},
created() {
this.$store.commit("setCurrentNav", "用户管理>>代理最低价");
this.current.UserId=this.$route.query.id;
this.currentDiscount.userId=this.$route.query.id;
this.get();
// this.getProductDiscounts();
},
methods: {
get() {
this.$api.get(this.$api.phpURL + "agent/agent/price",{'userId':this.current.UserId}).then(res => {
console.log(res)
this.product = res.Data;
});
},
getProductDiscounts(){
this.$api
.get("course/v1/scheme/page")
.then(res => {
this.productDiscounts= res.Data;
});
},
goEdit(item) {
console.log(item)
this.showDialog = true;
this.current.Name =item.Package.Name;
this.current.Price =item.Package.Price;
this.current.ProductId =item.Package.ProductId;
this.current.PackageId =item.Package.Id;
this.current.UserPrice =item.UserPrice.UserPrice;
this.current.RefundDayPrice =item.UserPrice.RefundDayPrice;
},
save() {
this.$api
.post(this.$api.phpURL + "agent/agent/setPrice", this.current)
.then(res => {
this.resetForm();
this.get();
});
},
changeStatus(item) {
this.$api
.post(this.$api.phpURL + "agent/agent/setPriceStatus",item.UserPrice)
.then(res => {
item.Status = res.Data;
});
},
setDiscount() {
if(!this.currentDiscount.schemeId){
this.$warn('请选择方案')
return ;
}
this.$api
.post("course/v1/scheme/SetUserDiscount",this.currentDiscount)
.then(res => {
this.showDialogDiscount=false;
this.get();
});
},
resetForm() {
this.$refs["inputPackageForm"].resetFields();
this.showDialog = false;
}
}
};
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,72 @@
<template>
<div v-loading="loading">
<div class="heior_box">
<div class="search-box">
<el-input v-model="searchModel.keyWord" placeholder="请输入会员号" clearable size="small">
<el-button slot="append" icon="el-icon-search" @click="search"></el-button>
</el-input>
</div>
</div>
<el-table :data="retData.Data" size="medium" :height="$getHeight(100)" row-key="Id" border>
<el-table-column prop="create_time" label="日期"></el-table-column>
<el-table-column prop="agent_name" label="代理商"></el-table-column>
<el-table-column prop="score_value" label="金额"></el-table-column>
<el-table-column prop="op_user" label="操作人"></el-table-column>
<el-table-column prop="rest_amount1" label="操做前余额"></el-table-column>
<el-table-column prop="rest_amount2" label="操做后余额"></el-table-column>
<el-table-column prop="remark" label="备注"></el-table-column>
</el-table>
<div class="block">
<el-pagination
v-if="retData.Data.length>0"
@current-change="getAmountDetail"
:page-size="50"
:current-page.sync="searchModel.PageIndex"
layout="total,prev, pager, next"
:total="retData.TotalCount"
></el-pagination>
</div>
</div>
</template>
<script>
export default {
name: 'userIndex',
components: {
cutTip: () => import('@/components/common/cutTip'),
phoneHide: () => import('@/components/common/phonehide')
},
data () {
return {
loading: false,
retData: { TotalCount: 0, Data: [] },
searchModel: {
PageIndex: 1,
keyWord: ''
},
detailAmountData: [],
}
},
created () {
this.$store.commit('setCurrentNav', '订单管理>>资金明细')
this.getAmountDetail()
},
methods: {
search () {
this.searchModel.PageIndex = 1
this.getAmountDetail()
},
getAmountDetail () {
this.loading = true
this.$api
.get(this.$api.phpURL + "agent/score/getScoreList", this.searchModel)
.then(res => {
this.retData = res
this.loading = false
})
},
}
}
</script>
<style scoped>
</style>

View File

@@ -95,6 +95,24 @@ let router = new Router({
path: 'user/editrole',
name: 'editrole',
component: resolve => require(['@/components/setting/editrole'], resolve)
},
// 代理商管理
{
path: 'user/agent',
name: 'agent',
component: resolve => require(['@/components/user/agent'], resolve)
},
// 代理商价格
{
path: 'agent/agentprice',
name: 'agentprice',
component: resolve => require(['@/components/user/agentprice'], resolve)
},
// 代理商明细
{
path: 'user/agentscore',
name: 'agentscore',
component: resolve => require(['@/components/user/agentscore'], resolve)
},
// 产品管理
{