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

Loading…
Cancel
Save