diff --git a/src/components/team/dialog.vue b/src/components/team/dialog.vue index f1b0b8f60ad0ea80ad3488782d23e0c19c478ee4..73e8fe4109dca190a26700d760e9bcd390e532ac 100644 --- a/src/components/team/dialog.vue +++ b/src/components/team/dialog.vue @@ -2,7 +2,7 @@ <el-dialog :title="title" append-to-body :visible.sync="show" width="800px"> <div v-loading="loading"> - <div>销售顾问:{{dialogObj.staff_name}}</div> + <div></div> <el-table :data="list"> <el-table-column prop="month_order_rate"> @@ -18,7 +18,7 @@ </template> <script> - import { getVisitedApi,getClassOpenedApi } from "@service/api"; + import { getVisitedApi,getClassOpenedApi,getAchievementApi } from "@service/api"; import page from '@framework/page' export default { @@ -52,11 +52,28 @@ this.show = this.dialogObj.show; if (this.dialogObj.type == 'callback') { this.getVisited(); + this.title = `销售顾问:${this.dialogObj.staff_name} T${this.dialogObj.team}` } else if (this.dialogObj.type == 'class') { this.getClass(); + this.title = `销售顾问:${this.dialogObj.staff_name} T${this.dialogObj.team}` + } else if (this.dialogObj.type == 'achievement') { + this.getAchievement(); + this.title = `业绩详情:${this.dialogObj.staff_name} T${this.dialogObj.team}` } } }, + getAchievement() { + let json = { + teacher_id: this.dialogObj.teacher_id, + start_at: this.dialogObj.start_at, + page: this.nowPage, + limit: this.limit + } + getAchievementApi(json).then(res => { + this.loading = false; + console.log(res) + }) + }, getVisited() { let json = { teacher_id: this.dialogObj.teacher_id, diff --git a/src/components/team/index.vue b/src/components/team/index.vue index 707d1b20903edb0c05c9f900bd6a27a11791527f..fd99431ae78bf9203e4dfa96213cfdb19c7848b7 100644 --- a/src/components/team/index.vue +++ b/src/components/team/index.vue @@ -15,11 +15,11 @@ <el-table class="team-table" border size="small" :data="list" v-loading="loading" :row-class-name="tableRowClassName"> <el-table-column label="组别" width="50px"> - <template slot-scope="scope">{{`T${scope.row.squad}`}}</template> + <template slot-scope="scope">{{(String(scope.row.squad).indexOf(',') > -1 && scope.row.total) ? 'åˆè®¡' : `T${scope.row.squad}`}}</template> </el-table-column> <el-table-column label="销售顾问"> <template slot-scope="scope"> - {{scope.row.total ? 'åˆè®¡' : scope.row.staff_name}} + <span v-html="transStaff(scope.row)"></span> </template> </el-table-column> <el-table-column prop="reach_class_num"> @@ -149,7 +149,9 @@ </el-tooltip> </template> <template slot-scope="scope"> - <el-link @click="dialogToggle">{{scope.row.month_order_rate}}</el-link> + <el-link @click="dialogToggle"> + {{transRate(scope.row.month_trans_order_num, scope.row.month_trans_user_num)}} + </el-link> </template> </el-table-column> @@ -247,6 +249,22 @@ this.getData(); }, methods: { + transStaff(row) { + if (row.total) { + return 'åˆè®¡' + } else if (row.staff_name.indexOf(',')>-1){ + return row.staff_name.split(',').join('<br>') + } else { + return row.staff_name + } + }, + transRate(child, mother) { + if (mother) { + return `${Math.floor(child * 100) / mother}%` + } else { + return '-' + } + }, tableRowClassName({row, rowIndex}) { if (rowIndex === 0) { return 'primary-row'; @@ -256,6 +274,7 @@ dialogToggle(row, type) { console.log('row', row); this.dialogObj = { + team: this.search.team, show: true, type: type, teacher_id: row.teacher_id, @@ -269,15 +288,17 @@ team: this.search.team } getTeamApi(json).then(res => { - if (Object.keys(res).length) { - if (res.team_total[1]) { - res.team_total[1].total = true; // 方便"åˆè®¡" å¯ä»¥è¿™æ ·å†™ï¼Œä¹Ÿå¯ä»¥ç”¨scope.$index - res.team_list.page_data.unshift(res.team_total[1]); + if (Object.keys(res).length && res.team_list && res.team_list.page_data) { + if (Object.keys(res.team_total).length ) { + res.team_total.total = true; // 方便"åˆè®¡" å¯ä»¥è¿™æ ·å†™ï¼Œä¹Ÿå¯ä»¥ç”¨scope.$index + res.team_list.page_data.unshift(res.team_total); } this.list = res.team_list.page_data; this.total = res.team_list.total; this.loading = false; } else { + this.list = []; + this.total = 0; this.loading = false; } }) diff --git a/src/service/api.js b/src/service/api.js index 701780971a92d704c25e101452bcf98139b72dab..740be3473c5f73075948f28bcf32476c8a2af5df 100644 --- a/src/service/api.js +++ b/src/service/api.js @@ -1481,3 +1481,7 @@ export const getVisitedApi = function (json) { export const getClassOpenedApi = function (json) { return Vue.prototype.$fetch(`${_baseUrl}api/admin/teacher/reachstartclasslist`, json) }; +// 获å–业绩详情 +export const getAchievementApi = function (json) { + return Vue.prototype.$fetch(`${_baseUrl}api/admin/teacher/teamachievement`, json) +};