|
|
@@ -0,0 +1,167 @@
|
|
|
+<template>
|
|
|
+ <view class="app-content">
|
|
|
+ <block v-if="!$util.isEmpty(list.data)">
|
|
|
+ <view class="record-table">
|
|
|
+ <view class="table-header table-row">
|
|
|
+ <view class="table-cell cell-date">日期</view>
|
|
|
+ <view class="table-cell cell-event">事项</view>
|
|
|
+ <view class="table-cell cell-staff">操作</view>
|
|
|
+ <view class="table-cell cell-change">变动</view>
|
|
|
+ <view class="table-cell cell-balance">积分</view>
|
|
|
+ </view>
|
|
|
+ <view v-for="(item, index) in list.data" :key="index" class="table-body">
|
|
|
+ <view class="table-row table-row-data">
|
|
|
+ <view class="table-cell cell-date">{{ formatTime(item) }}</view>
|
|
|
+ <view class="table-cell cell-event">{{ getEvent(item) }}</view>
|
|
|
+ <view class="table-cell cell-staff">{{ getStaff(item) }}</view>
|
|
|
+ <view class="table-cell cell-change">{{ formatChange(item) }}</view>
|
|
|
+ <view class="table-cell cell-balance">{{ formatBalance(item) }}</view>
|
|
|
+ </view>
|
|
|
+ <view v-if="!$util.isEmpty(item.remark)" class="table-row table-row-extra">
|
|
|
+ <view class="table-cell cell-extra">{{ item.remark }}</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </block>
|
|
|
+ <block v-else>
|
|
|
+ <AppWrapperEmpty title="暂无数据" :is-empty="$util.isEmpty(list.data)" />
|
|
|
+ </block>
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import AppWrapperEmpty from "@/components/app-wrapper-empty";
|
|
|
+import { getIntegralList } from "@/api/user";
|
|
|
+import list from "@/mixins/list";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "integralList",
|
|
|
+ components: {
|
|
|
+ AppWrapperEmpty,
|
|
|
+ },
|
|
|
+ mixins: [list],
|
|
|
+ methods: {
|
|
|
+ formatTime(item) {
|
|
|
+ const time = item.createTime;
|
|
|
+ if (!time) {
|
|
|
+ return "-";
|
|
|
+ }
|
|
|
+ return String(time).length > 10 ? String(time).substr(5, 11) : time;
|
|
|
+ },
|
|
|
+ getEvent(item) {
|
|
|
+ return item.event || "-";
|
|
|
+ },
|
|
|
+ getStaff(item) {
|
|
|
+ return Number(item.operatorId) > 0 ? "人工" : "系统";
|
|
|
+ },
|
|
|
+ formatChange(item) {
|
|
|
+ const changeValue = Number(item.num || 0);
|
|
|
+ if (!changeValue) {
|
|
|
+ return "0";
|
|
|
+ }
|
|
|
+ return changeValue > 0 ? "+" + parseFloat(changeValue) : String(parseFloat(changeValue));
|
|
|
+ },
|
|
|
+ formatBalance(item) {
|
|
|
+ const num = Number(item.integral || 0);
|
|
|
+ return Number.isNaN(num) ? 0 : parseFloat(num);
|
|
|
+ },
|
|
|
+ async init() {
|
|
|
+ const params = {
|
|
|
+ page: this.list.page,
|
|
|
+ };
|
|
|
+ if (this.option.hdId) {
|
|
|
+ params.hdId = this.option.hdId;
|
|
|
+ }
|
|
|
+ const res = await getIntegralList(params);
|
|
|
+ this.completes(res);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ async onPullDownRefresh() {
|
|
|
+ this.resetList();
|
|
|
+ await this.init();
|
|
|
+ uni.stopPullDownRefresh();
|
|
|
+ },
|
|
|
+ async onReachBottom() {
|
|
|
+ if (!this.list.finished) {
|
|
|
+ await this.init();
|
|
|
+ }
|
|
|
+ uni.stopPullDownRefresh();
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.record-table {
|
|
|
+ width: 100%;
|
|
|
+ border-radius: 16upx;
|
|
|
+ overflow: hidden;
|
|
|
+ background: #fff;
|
|
|
+ box-shadow: 0 4upx 24upx rgba(0, 0, 0, 0.06);
|
|
|
+ margin: 20upx 0;
|
|
|
+
|
|
|
+ .table-row {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ min-height: 72upx;
|
|
|
+ border-bottom: 1px solid #f0f0f0;
|
|
|
+
|
|
|
+ &.table-header {
|
|
|
+ background: #f5f7fa;
|
|
|
+ font-weight: bold;
|
|
|
+ font-size: 30upx;
|
|
|
+ color: #333;
|
|
|
+ }
|
|
|
+
|
|
|
+ &.table-row-data {
|
|
|
+ font-size: 26upx;
|
|
|
+ color: #222;
|
|
|
+ }
|
|
|
+
|
|
|
+ &.table-row-extra {
|
|
|
+ background: #f8f8f8;
|
|
|
+ color: #989494;
|
|
|
+ font-size: 24upx;
|
|
|
+
|
|
|
+ .cell-extra {
|
|
|
+ padding: 16upx 20upx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .table-cell {
|
|
|
+ flex: 1;
|
|
|
+ padding: 18upx 8upx;
|
|
|
+
|
|
|
+ &.cell-date {
|
|
|
+ text-align: center;
|
|
|
+ min-width: 100upx;
|
|
|
+ flex: 1.2;
|
|
|
+ }
|
|
|
+
|
|
|
+ &.cell-event {
|
|
|
+ text-align: left;
|
|
|
+ min-width: 180upx;
|
|
|
+ flex: 2;
|
|
|
+ }
|
|
|
+
|
|
|
+ &.cell-staff {
|
|
|
+ text-align: center;
|
|
|
+ min-width: 90upx;
|
|
|
+ flex: 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ &.cell-change {
|
|
|
+ text-align: right;
|
|
|
+ min-width: 100upx;
|
|
|
+ flex: 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ &.cell-balance {
|
|
|
+ text-align: right;
|
|
|
+ min-width: 110upx;
|
|
|
+ padding-right: 24upx;
|
|
|
+ flex: 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|