|
|
|
@@ -41,30 +41,53 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="__r_p_table"> |
|
|
|
<div> |
|
|
|
<el-table :data="tableData" style="width: 100%" v-loading="loading" stripe> |
|
|
|
<el-table-column prop="sn" label="流水号" align="center" header-align="center" width="180"></el-table-column> |
|
|
|
<el-table-column prop="date" label="时间" align="center" header-align="center" width="180"></el-table-column> |
|
|
|
<el-table-column v-if="tabIndex === 1" prop="status" label="状态" align="center" header-align="center" |
|
|
|
width="120"> |
|
|
|
<div v-show="tabIndex === 0"> |
|
|
|
<el-table :data="tableData" row-key="sn" style="width: 100%" v-loading="loading" stripe> |
|
|
|
<el-table-column column-key="sn" prop="sn" label="流水号" align="center" header-align="center" width="180"> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column column-key="date" prop="date" label="时间" align="center" header-align="center" width="180"> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column column-key="sourceType" prop="sourceType" label="场景" align="center" header-align="center" |
|
|
|
width="180"></el-table-column> |
|
|
|
<el-table-column column-key="action" prop="action" label="积分行为" align="center" header-align="center" |
|
|
|
width="200"></el-table-column> |
|
|
|
<el-table-column column-key="remark" prop="remark" label="说明" align="left" header-align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span :style="{ color: scope.row.statusColor }">{{ scope.row.status }}</span> |
|
|
|
<span v-html="scope.row.remark"></span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="sourceType" label="场景" align="center" header-align="center" width="180"> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column v-if="tabIndex === 1" prop="duration" label="运行时长" align="center" header-align="center" |
|
|
|
width="150"> |
|
|
|
<el-table-column column-key="amount" prop="amount" label="积分" align="center" header-align="center" |
|
|
|
width="120"></el-table-column> |
|
|
|
<template slot="empty"> |
|
|
|
<span>{{ loading ? "加载加..." : "暂无数据" }}</span> |
|
|
|
</template> |
|
|
|
</el-table> |
|
|
|
</div> |
|
|
|
<div v-show="tabIndex === 1"> |
|
|
|
<el-table :data="tableData" row-key="sn" style="width: 100%" v-loading="loading" stripe> |
|
|
|
<el-table-column column-key="sn" prop="sn" label="流水号" align="center" header-align="center" width="180"> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column v-if="tabIndex === 0" prop="action" label="积分行为" align="center" header-align="center" |
|
|
|
width="200"> |
|
|
|
<el-table-column column-key="date" prop="date" label="时间" align="center" header-align="center" width="180"> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="remark" label="说明" align="left" header-align="center"> |
|
|
|
<el-table-column column-key="status" prop="status" label="状态" align="center" header-align="center" |
|
|
|
width="120"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span :style="{ color: scope.row.statusColor }">{{ scope.row.status }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column v-if="tabIndex === 1" prop="taskName" label="任务名称" align="center" header-align="center"> |
|
|
|
<el-table-column column-key="sourceType" prop="sourceType" label="场景" align="center" header-align="center" |
|
|
|
width="180"></el-table-column> |
|
|
|
<el-table-column column-key="duration" prop="duration" label="运行时长" align="center" header-align="center" |
|
|
|
width="150"></el-table-column> |
|
|
|
<el-table-column column-key="remark" prop="remark" label="说明" align="left" header-align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span v-html="scope.row.remark"></span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="amount" label="积分" align="center" header-align="center" width="120"> |
|
|
|
<el-table-column column-key="taskName" prop="taskName" label="任务名称" align="center" header-align="center"> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column column-key="amount" prop="amount" label="积分" align="center" header-align="center" |
|
|
|
width="120"></el-table-column> |
|
|
|
<template slot="empty"> |
|
|
|
<span>{{ loading ? "加载加..." : "暂无数据" }}</span> |
|
|
|
</template> |
|
|
|
@@ -88,7 +111,7 @@ |
|
|
|
<script> |
|
|
|
import { formatDate } from 'element-ui/lib/utils/date-util'; |
|
|
|
import { getPoint, getPointAccount, getPointList, setPointOperate } from "../../../apis/modules/point"; |
|
|
|
import { SOURCE_TYPE, CONSUME_STATUS, POINT_ACTIONS } from './const'; |
|
|
|
import { getRewardPointRecordInfo } from './utils'; |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
@@ -106,22 +129,11 @@ export default { |
|
|
|
pageSizes: [10], |
|
|
|
total: 100, |
|
|
|
}, |
|
|
|
eventSource: null, |
|
|
|
}; |
|
|
|
}, |
|
|
|
components: {}, |
|
|
|
methods: { |
|
|
|
getSourceType: function (key) { |
|
|
|
const find = SOURCE_TYPE.filter(item => item.k === key); |
|
|
|
return find.length ? find[0].v : key; |
|
|
|
}, |
|
|
|
getConsumeStatus: function (key) { |
|
|
|
const find = CONSUME_STATUS.filter(item => item.k === key); |
|
|
|
return find.length ? find[0].v : key; |
|
|
|
}, |
|
|
|
getPointAction: function (key) { |
|
|
|
const find = POINT_ACTIONS.filter(item => item.k === key); |
|
|
|
return find.length ? find[0].v : key; |
|
|
|
}, |
|
|
|
currentChange: function (val) { |
|
|
|
this.pageInfo.curpage = val; |
|
|
|
this.getTableData(); |
|
|
|
@@ -133,6 +145,18 @@ export default { |
|
|
|
this.pageInfo.total = 0; |
|
|
|
this.getTableData(); |
|
|
|
}, |
|
|
|
getSummaryInfo: function () { |
|
|
|
getPointAccount().then(res => { |
|
|
|
if (res.data && res.data.Code === 0) { |
|
|
|
const data = res.data.Data; |
|
|
|
this.summaryInfo.available = data.Balance; |
|
|
|
this.summaryInfo.gain = data.TotalEarned; |
|
|
|
this.summaryInfo.used = data.TotalConsumed; |
|
|
|
} |
|
|
|
}).catch(err => { |
|
|
|
console.log(err); |
|
|
|
}) |
|
|
|
}, |
|
|
|
getTableData: function () { |
|
|
|
this.loading = true; |
|
|
|
getPointList({ |
|
|
|
@@ -148,21 +172,7 @@ export default { |
|
|
|
const records = data.Records; |
|
|
|
for (let i = 0, iLen = records.length; i < iLen; i++) { |
|
|
|
const record = records[i]; |
|
|
|
tableData.push({ |
|
|
|
sn: record.SerialNo, |
|
|
|
date: formatDate(new Date(record.LastOperateDate * 1000), 'yyyy-MM-DD HH:mm:ss'), |
|
|
|
_status: record.Status, |
|
|
|
status: this.getConsumeStatus(record.Status) || '--', |
|
|
|
statusColor: record.Status === 'OPERATING' ? 'rgb(33, 186, 69)' : '', |
|
|
|
_sourceType: record.SourceType, |
|
|
|
sourceType: this.getSourceType(record.SourceType), |
|
|
|
duration: record?.Cloudbrain?.Duration || '--', |
|
|
|
taskName: record?.Cloudbrain?.DisplayJobName || '--', |
|
|
|
taskId: record?.Cloudbrain?.ID, |
|
|
|
action: record?.Action?.OpType ? this.getPointAction(record.Action.OpType) : '--', |
|
|
|
remark: record.Remark, |
|
|
|
amount: record.Amount, |
|
|
|
}); |
|
|
|
tableData.push(getRewardPointRecordInfo(record)); |
|
|
|
} |
|
|
|
this.tableData.splice(0, Infinity, ...tableData); |
|
|
|
this.pageInfo.total = data.Total; |
|
|
|
@@ -189,19 +199,25 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted: function () { |
|
|
|
getPointAccount().then(res => { |
|
|
|
if (res.data && res.data.Code === 0) { |
|
|
|
const data = res.data.Data; |
|
|
|
this.summaryInfo.available = data.Balance; |
|
|
|
this.summaryInfo.gain = data.TotalEarned; |
|
|
|
this.summaryInfo.used = data.TotalConsumed; |
|
|
|
} |
|
|
|
}).catch(err => { |
|
|
|
console.log(err); |
|
|
|
}) |
|
|
|
this.getSummaryInfo(); |
|
|
|
this.getTableData(); |
|
|
|
const { AppSubUrl, csrf, NotificationSettings } = window.config; |
|
|
|
if (NotificationSettings.EventSourceUpdateTime > 0 && !!window.EventSource) { |
|
|
|
const source = new EventSource(`${AppSubUrl}/user/events`); |
|
|
|
source.addEventListener('reward-operation', (e) => { |
|
|
|
try { |
|
|
|
this.getSummaryInfo(); |
|
|
|
this.getTableData(); |
|
|
|
} catch (err) { |
|
|
|
console.error(err); |
|
|
|
} |
|
|
|
}); |
|
|
|
this.eventSource = source; |
|
|
|
} |
|
|
|
}, |
|
|
|
beforeDestroy: function () { |
|
|
|
this.eventSource && this.eventSource.close(); |
|
|
|
}, |
|
|
|
computed: {}, |
|
|
|
}; |
|
|
|
</script> |
|
|
|
|
|
|
|
|