充值记录加合计
This commit is contained in:
@@ -34,7 +34,13 @@
|
|||||||
<el-button @click="searchList">查询</el-button>
|
<el-button @click="searchList">查询</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<el-table v-loading="loading" :data="tableList" height="calc(100vh - 260px)">
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
:data="tableList"
|
||||||
|
height="calc(100vh - 260px)"
|
||||||
|
show-summary
|
||||||
|
:summary-method="getSummaries"
|
||||||
|
>
|
||||||
<el-table-column type="index" width="55" align="center" />
|
<el-table-column type="index" width="55" align="center" />
|
||||||
<el-table-column label="手机号" align="left" prop="phone" width="140" />
|
<el-table-column label="手机号" align="left" prop="phone" width="140" />
|
||||||
<el-table-column label="会员名" align="left" prop="memberName" min-width="140" />
|
<el-table-column label="会员名" align="left" prop="memberName" min-width="140" />
|
||||||
@@ -104,6 +110,32 @@ function getList() {
|
|||||||
loading.value = false
|
loading.value = false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getSummaries(param) {
|
||||||
|
const { columns, data } = param
|
||||||
|
const sums = []
|
||||||
|
columns.forEach((column, index) => {
|
||||||
|
if (index === 0) {
|
||||||
|
sums[index] = '合计'
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const values = data.map((item) => Number(item[column.property]))
|
||||||
|
if (column.property === 'money') {
|
||||||
|
sums[index] = values.reduce((prev, curr) => {
|
||||||
|
const value = Number(curr)
|
||||||
|
if (!isNaN(value)) {
|
||||||
|
return prev + curr
|
||||||
|
} else {
|
||||||
|
return prev
|
||||||
|
}
|
||||||
|
}, 0)
|
||||||
|
sums[index] = sums[index].toFixed(2)
|
||||||
|
} else {
|
||||||
|
sums[index] = ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return sums
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped></style>
|
<style lang="scss" scoped></style>
|
||||||
|
|||||||
Reference in New Issue
Block a user