wanghousheng 10 months ago
parent 716b0ac3f7
commit 8984ceabfc
  1. 89
      src/views/user/Index.vue

@ -11,11 +11,9 @@
<a-form-item v-if="$module('user-grade')" label="会员等级">
<a-select v-decorator="['gradeId', { initialValue: 0 }]">
<a-select-option :value="0">全部</a-select-option>
<a-select-option
v-for="(item, index) in gradeList"
:key="index"
:value="item.grade_id"
>{{ item.name }}</a-select-option>
<a-select-option v-for="(item, index) in gradeList" :key="index" :value="item.grade_id">{{
item.name
}}</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="注册时间">
@ -27,14 +25,7 @@
</a-form>
</a-row>
</div>
<s-table
ref="table"
rowKey="user_id"
:loading="isLoading"
:columns="columns"
:data="loadData"
:pageSize="15"
>
<s-table ref="table" rowKey="user_id" :loading="isLoading" :columns="columns" :data="loadData" :pageSize="15">
<!-- 会员头像 -->
<span slot="avatar_url" slot-scope="text">
<div class="avatar">
@ -72,12 +63,7 @@
</span>
<!-- 操作 -->
<span class="actions" slot="action" slot-scope="item">
<a
v-if="$module('market-recharge')"
v-action:recharge
@click="handleRecharge(item)"
title="会员充值"
>充值</a>
<a v-if="$module('market-recharge')" v-action:recharge @click="handleRecharge(item)" title="会员充值">充值</a>
<a v-if="$module('user-grade')" v-action:grade @click="handleGrade(item)" title="会员等级">等级</a>
<a v-action:delete @click="handleDelete(item)">删除</a>
</span>
@ -99,48 +85,52 @@ import { GradeForm, RechargeForm } from './modules'
const columns = filterModules([
{
title: '会员ID',
dataIndex: 'user_id'
dataIndex: 'user_id',
},
{
title: '会员头像',
dataIndex: 'avatar_url',
scopedSlots: { customRender: 'avatar_url' }
scopedSlots: { customRender: 'avatar_url' },
},
{
title: '昵称/手机号',
scopedSlots: { customRender: 'main_info' }
scopedSlots: { customRender: 'main_info' },
},
{
title: '会员身份',
dataIndex: 'user_type_text',
},
{
title: '会员等级',
moduleKey: 'user-grade',
dataIndex: 'grade',
scopedSlots: { customRender: 'grade' }
scopedSlots: { customRender: 'grade' },
},
{
title: '余额/积分',
dataIndex: 'balance',
scopedSlots: { customRender: 'balance' }
scopedSlots: { customRender: 'balance' },
},
{
title: '实际消费金额',
dataIndex: 'expend_money',
scopedSlots: { customRender: 'expend_money' }
scopedSlots: { customRender: 'expend_money' },
},
{
title: '注册来源',
dataIndex: 'platform',
scopedSlots: { customRender: 'platform' }
scopedSlots: { customRender: 'platform' },
},
{
title: '注册时间',
dataIndex: 'create_time'
dataIndex: 'create_time',
},
{
title: '操作',
// dataIndex: 'action',
width: '180px',
scopedSlots: { customRender: 'action' }
}
scopedSlots: { customRender: 'action' },
},
])
export default {
@ -149,9 +139,9 @@ export default {
STable,
GradeForm,
RechargeForm,
PlatformIcon
PlatformIcon,
},
data () {
data() {
return {
//
searchForm: this.$form.createForm(this),
@ -162,56 +152,54 @@ export default {
// table
columns,
// Promise
loadData: param => {
return Api.list({ ...param, ...this.queryParam })
.then(response => response.data.list)
loadData: (param) => {
return Api.list({ ...param, ...this.queryParam }).then((response) => response.data.list)
},
//
gradeList: []
gradeList: [],
}
},
created () {
created() {
//
this.getGradeList()
},
methods: {
//
getGradeList () {
GradeApi.all().then(result => {
getGradeList() {
GradeApi.all().then((result) => {
this.gradeList = result.data.list
})
},
//
handleGrade (item) {
handleGrade(item) {
this.$refs.GradeForm.handle(item)
},
//
handleRecharge (item) {
handleRecharge(item) {
this.$refs.RechargeForm.handle(item)
},
//
handleDelete (item) {
handleDelete(item) {
const app = this
const modal = this.$confirm({
title: '您确定要删除该记录吗?',
content: '删除后不可恢复',
onOk () {
onOk() {
return Api.deleted({ userId: item.user_id })
.then(result => {
.then((result) => {
app.$message.success(result.message, 1.5)
app.handleRefresh()
})
.finally(result => modal.destroy())
}
.finally((result) => modal.destroy())
},
})
},
//
handleSearch (e) {
handleSearch(e) {
e.preventDefault()
this.searchForm.validateFields((error, values) => {
if (!error) {
@ -225,11 +213,10 @@ export default {
* 刷新列表
* @param Boolean bool 强制刷新到第一页
*/
handleRefresh (bool = false) {
handleRefresh(bool = false) {
this.$refs.table.refresh(bool)
}
}
},
},
}
</script>

Loading…
Cancel
Save