<template> <div class="user"> <div class="header"> <div class="clear-both" style="margin-top: 20px" v-if="detail"> <el-button size="mini" plain type="success" v-if="!$store.state.readonly" @click="bindTeacher" style="float: right"> 绑定老师 </el-button> </div> <el-row> <el-col :span="6"> <label>昵称:</label> <a :href="detail.qr"> <img class="avatar" :src="detail.avatar"/> </a> {{detail.nickname}} </el-col> <el-col :span="6"> <label>手机号:</label> {{detail.mobile}} </el-col> <el-col :span="6"> <label>生日:</label>{{detail.birthday}} </el-col> <el-col :span="6"> <label>等级:</label>{{detail.level}} </el-col> </el-row> <el-row> <el-col :span="6"> <label>邀请类型:</label>{{detail.invite_type | inviteType}} </el-col> <el-col :span="6"> <label>邀请人ID:</label>{{detail.invite_user_id ? detail.invite_user_id : ''}} </el-col> <el-col :span="6"> <label>已绑定老师:</label>{{detail.teacher_name}} </el-col> <el-col :span="6"> <label>注册时间:</label>{{detail.created_at}} </el-col> </el-row> <el-row> <el-col :span="6"> <label>最后登录:</label>{{detail.last_login_at}} </el-col> </el-row> </div> <div class="b-title">期数列表</div> <el-table :data="periodList" style="width: 100%"> <el-table-column prop="periods_title" label="期数名称"> </el-table-column> <el-table-column label="开课权限"> <template slot-scope="scope"> {{scope.row.is_view_course === 1 ? '开' : '关'}} </template> </el-table-column> <el-table-column className="f-c" label="老师"> <template slot-scope="scope"> <img class="avatar" :src="scope.row.teacher_qr"> {{scope.row.teacher_name}} </template> </el-table-column> <el-table-column prop="join_num" label="加入人数"> </el-table-column> <el-table-column prop="max_join_num" label="最大加入人数"> </el-table-column> <el-table-column prop="start_at" label="开课时间"> </el-table-column> <el-table-column prop="created_at" label="创建时间"> </el-table-column> </el-table> <div class="b-title">订单列表</div> <el-table :data="userList" style="width: 100%"> <el-table-column prop="out_trade_no" label="订单号"> </el-table-column> <el-table-column className="f-c" label="用户"> <template slot-scope="scope"> <img class="avatar" :src="scope.row.user_avatar"> {{scope.row.user_nickname}} </template> </el-table-column> <el-table-column prop="goods_name" label="商品名称"> </el-table-column> <el-table-column prop="periods_id" label="期数ID"> </el-table-column> <el-table-column label="实付金额" > <template slot-scope="scope"> {{scope.row.money|moneytFilter}} </template> </el-table-column> <el-table-column label="推广人" width="150"> <template slot-scope="scope"> 类型:{{scope.row.invite_type | inviteType}}<br> {{scope.row.invite_id ? `ID:${scope.row.invite_id}` : ''}} </template> </el-table-column> <el-table-column label="购买方式"> <template slot-scope="scope"> {{scope.row.buy_type === 1 ? '团购' : '单买'}} </template> </el-table-column> <el-table-column label="是否是团长"> <template slot-scope="scope"> {{scope.row.is_captain === 1 ? '是' : '否'}} </template> </el-table-column> <el-table-column label="付款状态"> <template slot-scope="scope"> {{scope.row.status|status}} </template> </el-table-column> <el-table-column prop="pay_at" label="支付时间"> </el-table-column> <el-table-column prop="created_at" label="创建时间"> </el-table-column> </el-table> <page :total="total" :limit="limit" @pageChange="onPageChange"/> <teacher-dialog :dialogObj="dialogObj" @reflash="getDetail"></teacher-dialog> </div> </template> <script> import {getOrderListApi,getUserDetailApi} from "../../service/api"; import page from '../framework/page' import {INVITETYPE,ORDERSTATUS,BUYTYPE} from "../../util/wordbook"; import teacherDialog from './dialog' export default { name: "index", data(){ return { userList:[], total:0, nowPage:1, limit: 3, id: '', detail: {}, periodList: [], dialogObj:{ show:false, title:'绑定老师', id:0, teacher_id: 0 } } }, components:{ page, teacherDialog }, mounted(){ this.id = this.$route.params.id; this.getDetail() this.getUser() }, methods:{ onPageChange(val){ this.nowPage = val; this.getUser(); }, getUser(){ let json = { user_id: this.id, limit: this.limit, page: this.nowPage, status: 1 } getOrderListApi(json).then(res=>{ this.userList = res.list; this.total = res.total }) }, getDetail(){ if(!this.id) return; getUserDetailApi(this.id).then(res=>{ this.detail = res if (res.periods_list) { this.periodList = res.periods_list } }) }, bindTeacher(){ let data = this.detail this.dialogObj = { show:true, title:'绑定老师', id:data.user_id, teacher_id: data.teacher_id } } }, filters:{ payMentFilter(val){ return val=='1'?'已付款':'未付款' }, courseTypeFilter(val){ return val.type=='1'?`正式课(${val.duration}个月)`:`试听课(${val.duration}天)` }, inviteType(value){ return INVITETYPE[value] }, status(value){ return ORDERSTATUS[value] }, buyType(value){ return BUYTYPE[value] }, moneytFilter(val){ return val = val / 100 + '元' } } } </script> <style scoped lang="less"> @import "../../util/public"; .avatar { width: 50px; border-radius: 50%; } .user{ height: 100%; overflow: auto; /*padding: 20px 0;*/ .btn-content{ text-align: center; } } .header { padding: 0 20px; margin-bottom: 20px; } .header { .el-row { display: flex; justify-content: flex-start; align-items: center; color: #666; font-size: 16px; margin: 25px 0; label{ margin-right: 10px; } } .avatar { margin-right: 10px; } } .el-col{ /*height: 50px;*/ display: flex; justify-content: flex-start; align-items: center; img{ width: 50px; border-radius: 100px; } label{ color: #5982e6; } } .b-title { padding: 20px; color: #666; } </style> <style> .f-c > div { display: flex !important; flex-flow: row; justify-content: flex-start; align-items: center; } </style>