|
@@ -12,9 +12,9 @@
|
|
maxlength="11"
|
|
maxlength="11"
|
|
placeholder="输入手机号 / 用户昵称搜索"
|
|
placeholder="输入手机号 / 用户昵称搜索"
|
|
prefix-icon="el-icon-search"
|
|
prefix-icon="el-icon-search"
|
|
- @keyup.enter.native="handleSearch()"
|
|
|
|
|
|
+ @keyup.enter.native="switchRequests()"
|
|
/>
|
|
/>
|
|
- <el-button type="primary" icon="el-icon-search" :loading="loading" @click="handleSearch()">搜索/刷新</el-button>
|
|
|
|
|
|
+ <el-button type="primary" icon="el-icon-search" :loading="loading" @click="switchRequest()">搜索/刷新</el-button>
|
|
</div>
|
|
</div>
|
|
<el-table
|
|
<el-table
|
|
v-loading="loading"
|
|
v-loading="loading"
|
|
@@ -64,11 +64,19 @@
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column
|
|
<el-table-column
|
|
- :label="rankType === 3 ? '总套数' : '上级名称'"
|
|
|
|
|
|
+ v-if="rankType === 1 || rankType === 2 || rankType === 4"
|
|
|
|
+ label="上级名称"
|
|
prop="up_name"
|
|
prop="up_name"
|
|
label-class-name="label"
|
|
label-class-name="label"
|
|
/>
|
|
/>
|
|
<el-table-column
|
|
<el-table-column
|
|
|
|
+ prop="total"
|
|
|
|
+ label="总套数"
|
|
|
|
+ label-class-name="label"
|
|
|
|
+ >
|
|
|
|
+ <span slot-scope="{ row }">{{ row.total || 0 }}</span>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
v-if="rankType !== 3"
|
|
v-if="rankType !== 3"
|
|
label="上级手机"
|
|
label="上级手机"
|
|
prop="up_phone"
|
|
prop="up_phone"
|
|
@@ -97,7 +105,7 @@ export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
season_list_index: 0,
|
|
season_list_index: 0,
|
|
- rankType: 1,
|
|
|
|
|
|
+ rankType: 2,
|
|
page: 1,
|
|
page: 1,
|
|
loading: false,
|
|
loading: false,
|
|
list: [],
|
|
list: [],
|
|
@@ -137,12 +145,16 @@ export default {
|
|
},
|
|
},
|
|
typeList: [
|
|
typeList: [
|
|
{
|
|
{
|
|
- name: '个人榜',
|
|
|
|
|
|
+ name: '销售主管榜',
|
|
|
|
+ value: 2
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ name: '销售经理榜',
|
|
value: 1
|
|
value: 1
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- name: '皇冠榜',
|
|
|
|
- value: 2
|
|
|
|
|
|
+ name: '代理公司榜',
|
|
|
|
+ value: 4
|
|
},
|
|
},
|
|
{
|
|
{
|
|
name: '战区榜',
|
|
name: '战区榜',
|
|
@@ -169,16 +181,17 @@ export default {
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
this.loading = true
|
|
this.loading = true
|
|
- ranking_user({ season: this.season, type: this.rankType }).then(res => {
|
|
|
|
- res.data.list.forEach((e, i) => {
|
|
|
|
- e.rank = 15 * (this.page - 1) + i + 1
|
|
|
|
- })
|
|
|
|
- this.loading = false
|
|
|
|
- this.list = res.data.list
|
|
|
|
- this.total = res.data.total
|
|
|
|
- }).catch(e => {
|
|
|
|
- this.loading = false
|
|
|
|
- })
|
|
|
|
|
|
+ this.switchRequest()
|
|
|
|
+ // ranking_user({ season: this.season, type: this.rankType }).then(res => {
|
|
|
|
+ // res.data.list.forEach((e, i) => {
|
|
|
|
+ // e.rank = 15 * (this.page - 1) + i + 1
|
|
|
|
+ // })
|
|
|
|
+ // this.loading = false
|
|
|
|
+ // this.list = res.data.list
|
|
|
|
+ // this.total = res.data.total
|
|
|
|
+ // }).catch(e => {
|
|
|
|
+ // this.loading = false
|
|
|
|
+ // })
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
switchseason(index) { // 切换赛季
|
|
switchseason(index) { // 切换赛季
|
|
@@ -187,9 +200,9 @@ export default {
|
|
},
|
|
},
|
|
switchRequest(page) {
|
|
switchRequest(page) {
|
|
this.loading = true
|
|
this.loading = true
|
|
- this.search = ''
|
|
|
|
|
|
+ // this.search = ''
|
|
page ? '' : this.page = 1
|
|
page ? '' : this.page = 1
|
|
- ranking_user({ season: this.season, type: this.rankType, page: this.page }).then(res => {
|
|
|
|
|
|
+ ranking_user({ season: this.season, type: this.rankType, page: this.page, search_name: this.search }).then(res => {
|
|
res.data.list.forEach((e, i) => {
|
|
res.data.list.forEach((e, i) => {
|
|
e.rank = 15 * (this.page - 1) + i + 1
|
|
e.rank = 15 * (this.page - 1) + i + 1
|
|
})
|
|
})
|
|
@@ -202,28 +215,28 @@ export default {
|
|
})
|
|
})
|
|
},
|
|
},
|
|
handleSearch(page) {
|
|
handleSearch(page) {
|
|
- if (this.search.trim().length) {
|
|
|
|
- this.loading = true
|
|
|
|
- page ? '' : this.page = 1
|
|
|
|
- ranking_search({ page: this.page, type: this.rankType, phone: this.search }).then(res => {
|
|
|
|
- res.data.list.sort((a, b) => +a.rank - +b.rank)
|
|
|
|
- this.list = res.data.list
|
|
|
|
- this.total = res.data.total
|
|
|
|
- this.loading = false
|
|
|
|
- }).catch(e => {
|
|
|
|
- this.loading = false
|
|
|
|
- })
|
|
|
|
- } else {
|
|
|
|
- this.page = 1
|
|
|
|
- this.switchRequest()
|
|
|
|
- }
|
|
|
|
|
|
+ // if (this.search.trim().length) {
|
|
|
|
+ this.loading = true
|
|
|
|
+ page ? '' : this.page = 1
|
|
|
|
+ ranking_search({ page: this.page, type: this.rankType, search_name: this.search, season: this.season }).then(res => {
|
|
|
|
+ res.data.list.sort((a, b) => +a.rank - +b.rank)
|
|
|
|
+ this.list = res.data.list
|
|
|
|
+ this.total = res.data.total
|
|
|
|
+ this.loading = false
|
|
|
|
+ }).catch(e => {
|
|
|
|
+ this.loading = false
|
|
|
|
+ })
|
|
|
|
+ // } else {
|
|
|
|
+ // this.page = 1
|
|
|
|
+ // this.switchRequest()
|
|
|
|
+ // }
|
|
},
|
|
},
|
|
handleCurrentChange(page) { // 换页
|
|
handleCurrentChange(page) { // 换页
|
|
this.page = page
|
|
this.page = page
|
|
- if (this.search.trim().length) {
|
|
|
|
- this.handleSearch(page)
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
|
|
+ // if (this.search.trim().length) {
|
|
|
|
+ // this.handleSearch(page)
|
|
|
|
+ // return
|
|
|
|
+ // }
|
|
this.switchRequest(page)
|
|
this.switchRequest(page)
|
|
},
|
|
},
|
|
out() {
|
|
out() {
|
|
@@ -243,13 +256,13 @@ export default {
|
|
},
|
|
},
|
|
handleDownload() { // 下载Excel
|
|
handleDownload() { // 下载Excel
|
|
import('@/vendor/Export2Excel').then(excel => {
|
|
import('@/vendor/Export2Excel').then(excel => {
|
|
- const header = ['排名', '用户昵称', '学分', '用户手机号', '用户销售级别', '上级名称', '上级手机', '所属战区']
|
|
|
|
- const filterVal = ['rank', 'nickname', 'score', 'phone', 'level_name', 'up_name', 'up_phone', 'war_name']
|
|
|
|
|
|
+ const header = ['排名', '用户昵称', '学分', '用户手机号', '用户销售级别', '上级名称', '上级手机', '所属战区', '总套数']
|
|
|
|
+ const filterVal = ['rank', 'nickname', 'score', 'phone', 'level_name', 'up_name', 'up_phone', 'war_name', 'total']
|
|
const data = this.DOWNLOADEXCELDATA.map(v => filterVal.map(j => v[j]))
|
|
const data = this.DOWNLOADEXCELDATA.map(v => filterVal.map(j => v[j]))
|
|
excel.export_json_to_excel({
|
|
excel.export_json_to_excel({
|
|
header,
|
|
header,
|
|
data,
|
|
data,
|
|
- filename: `${+this.rankType === 1 ? '个人' : '皇冠'}榜-${(new Date()).toLocaleString()}`,
|
|
|
|
|
|
+ filename: `${this.typeList.find(i => i.value === this.rankType).name}-${(new Date()).toLocaleString()}`,
|
|
autoWidth: true,
|
|
autoWidth: true,
|
|
bookType: 'xlsx'
|
|
bookType: 'xlsx'
|
|
})
|
|
})
|