Files
dvcp_v2_webapp/project/lulong/AppResidentIntegrating/components/Detail.vue
2023-10-17 11:25:18 +08:00

182 lines
4.6 KiB
Vue

<template>
<ai-detail>
<template slot="title">
<ai-title title="详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<el-row style="margin-bottom: 16px;">
<div class="card_list">
<div class="card">
<h2>姓名</h2>
<p class="color1">{{ info.userName }}</p>
</div>
<div class="card">
<h2>积分余额</h2>
<p class="color2">{{ info.integral || 0 }}</p>
</div>
<div class="card">
<h2>已用积分</h2>
<p class="color3">{{ info.usedIntegral || 0 }}</p>
</div>
</div>
</el-row>
<ai-card>
<ai-title slot="title" title="余额变动明细"/>
<template #content>
<ai-search-bar>
<template #left>
<ai-select v-model="search.type" placeholder="请选择类型" @change="search.current = 1, getList()" :selectList="dict.getDict('integralType')"/>
</template>
<template #right>
<ai-download
:instance="instance"
:url="`/app/appintegraluser/changeIntegralExport?id=${params.id}`"
:params="search"
fileName="余额变动明细"
:disabled="tableData.length == 0">
<el-button size="small">导出</el-button>
</ai-download>
</template>
</ai-search-bar>
<ai-table :tableData="tableData" :total="total" :current.sync="search.current" :size.sync="search.size"
@getList="getList" :col-configs="colConfigs" :dict="dict">
<el-table-column slot="changeIntegral" label="变动积分" align="center">
<template slot-scope="{ row }">
<span>{{ row.integralCalcType == 0 ? '-' : '+' }}{{ row.changeIntegral }}</span>
</template>
</el-table-column>
<el-table-column slot="eventDesc" label='事件' align="center" show-overflow-tooltip>
<template slot-scope="{ row }">
<span>{{ row.eventDesc || row.eventName }}</span>
</template>
</el-table-column>
</ai-table>
</template>
</ai-card>
</template>
</ai-detail>
</template>
<script>
export default {
name: 'Detail',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
info: {},
id: '',
search: {
current: 1,
size: 10,
type: ''
},
total: 0,
tableData: []
}
},
computed: {
colConfigs() {
return [
{prop: "doTime", label: '时间', align: "left", width: "200px"},
{prop: "integralType", label: '类型', align: "center", dict: "integralType"},
{slot: "changeIntegral"},
{prop: "nowIntegral", label: '剩余积分', align: "center" },
{slot: "eventDesc"},
]
}
},
created () {
console.log(this.params)
this.dict.load('integralType').then(() => {
this.getInfo()
this.getList()
})
},
methods: {
getInfo (id) {
this.instance.post(`/app/appintegraluser/girdDetail?id=${this.params.id}`).then(res => {
if (res.code === 0) {
this.info = res.data
}
})
},
getList () {
this.instance.post(`/app/appintegraluser/getChangeDetail`, null, {
params: {
...this.search,
id: this.params.id
}
}).then(res => {
if (res.code === 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'List',
isRefresh: !!isRefresh
})
}
}
}
</script>
<style scoped lang="scss">
.card_list {
display: flex;
.card {
flex: 1;
height: 96px;
background: #FFFFFF;
box-shadow: 0px 4px 6px -2px rgba(15, 15, 21, 0.1500);
border-radius: 4px;
margin-right: 20px;
padding: 16px 24px;
box-sizing: border-box;
h2 {
color: #888888;
font-weight: 600;
font-size: 16px;
}
p {
margin-top: 8px;
font-size: 24px;
font-weight: 600;
}
.color1 {
color: #2891FF;
}
.color2 {
color: #22AA99;
}
.color3 {
color: #F8B425;
}
}
.card:last-child {
margin-right: 0;
}
}
</style>