|
|
@@ -1,76 +1,377 @@
|
|
|
<template>
|
|
|
-<view class="app-content">
|
|
|
- <block v-if="!$util.isEmpty(list.data)">
|
|
|
- <t-table :headerBackgroundColor="'#F0F2F6'">
|
|
|
- <t-tr header>
|
|
|
- <t-th>日期</t-th>
|
|
|
- <t-th><view style="width:230upx;">事项</view></t-th>
|
|
|
- <t-th>变动</t-th>
|
|
|
- <t-th>余额</t-th>
|
|
|
- </t-tr>
|
|
|
- <view v-for="(item, index) in list.data" :key="index" @click="goDetail(item)">
|
|
|
- <t-tr>
|
|
|
- <t-td align="center" color="info"><view >{{ item.addTime.substr(5,11) }}</view></t-td>
|
|
|
- <t-td align="center" color="info"><view style="width:230upx;">{{ item.event }}</view></t-td>
|
|
|
- <t-td align="center" color="info"><view >{{ item.amount }}</view></t-td>
|
|
|
- <t-td align="center" color="info"><view >{{ parseFloat(item.balance) }}</view></t-td>
|
|
|
- </t-tr>
|
|
|
+ <view class="bc-page">
|
|
|
+ <view v-if="hasList" class="bc-sheet">
|
|
|
+ <view class="bc-head">
|
|
|
+ <text class="bc-th bc-th--time">时间</text>
|
|
|
+ <text class="bc-th bc-th--event">事项</text>
|
|
|
+ <text class="bc-th bc-th--amt">变动</text>
|
|
|
+ <text class="bc-th bc-th--bal">余额</text>
|
|
|
+ </view>
|
|
|
+ <view class="bc-body">
|
|
|
+ <view
|
|
|
+ v-for="(item, index) in list.data"
|
|
|
+ :key="index"
|
|
|
+ class="bc-item"
|
|
|
+ :class="{ 'bc-item--alt': index % 2 === 1 }"
|
|
|
+ >
|
|
|
+ <view
|
|
|
+ class="bc-row-main"
|
|
|
+ :class="{ 'bc-row-main--with-extra': item.showExtraRow }"
|
|
|
+ @click="goDetail(item)"
|
|
|
+ >
|
|
|
+ <view class="bc-td bc-td--time">
|
|
|
+ <text class="bc-date">{{ item.dateText }}</text>
|
|
|
+ <text class="bc-clock">{{ item.timeLine }}</text>
|
|
|
+ </view>
|
|
|
+ <view class="bc-td bc-td--event">
|
|
|
+ <text class="bc-event">{{ item.event }}</text>
|
|
|
+ <text v-if="item.showStaff" class="bc-meta">{{ item.staffName }}</text>
|
|
|
+ <text v-if="item.showRemark" class="bc-meta bc-meta--remark">{{ item.remark }}</text>
|
|
|
+ </view>
|
|
|
+ <view class="bc-td bc-td--amt">
|
|
|
+ <text class="bc-amount" :class="item.amountClassName">{{ item.amount }}</text>
|
|
|
+ </view>
|
|
|
+ <view class="bc-td bc-td--bal">
|
|
|
+ <text class="bc-balance">{{ item.balanceText }}</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view v-if="item.showExtraRow" class="bc-row-extra" @click.stop>
|
|
|
+ <view class="bc-tags-row">
|
|
|
+ <text
|
|
|
+ v-if="item.showClearLink"
|
|
|
+ class="bc-tag bc-tag--link"
|
|
|
+ @click.stop="goClear(item)"
|
|
|
+ >{{ item.clearLinkText }}</text>
|
|
|
+ <text
|
|
|
+ v-if="item.showBecomeBalance"
|
|
|
+ class="bc-tag bc-tag--muted"
|
|
|
+ >{{ item.becomeHintText }}</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
- </t-table>
|
|
|
- </block>
|
|
|
- <block v-else>
|
|
|
- <AppWrapperEmpty title="暂无数据" :is-empty="$util.isEmpty(list.data)" />
|
|
|
- </block>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <AppWrapperEmpty v-else title="暂无数据" :is-empty="listEmpty" />
|
|
|
</view>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import AppWrapperEmpty from "@/components/app-wrapper-empty"
|
|
|
+import AppWrapperEmpty from '@/components/app-wrapper-empty'
|
|
|
import { balanceChangeList } from '@/api/ghs'
|
|
|
import list from '@/mixins/list'
|
|
|
+
|
|
|
export default {
|
|
|
- name: "debtChange",
|
|
|
+ name: 'ghsBalanceChange',
|
|
|
components: {
|
|
|
AppWrapperEmpty
|
|
|
},
|
|
|
- mixins:[list],
|
|
|
- data() {
|
|
|
- return {
|
|
|
- };
|
|
|
+ mixins: [list],
|
|
|
+ computed: {
|
|
|
+ hasList() {
|
|
|
+ return this.list.data && this.list.data.length > 0
|
|
|
+ },
|
|
|
+ listEmpty() {
|
|
|
+ return !this.hasList
|
|
|
+ }
|
|
|
},
|
|
|
methods: {
|
|
|
- async init(){
|
|
|
- const res = await balanceChangeList({ page:this.list.page,ghsId:this.option.ghsId })
|
|
|
- if (this.$util.isEmpty(res.data.list)){
|
|
|
+ formatMoney(val) {
|
|
|
+ const n = parseFloat(val)
|
|
|
+ return isNaN(n) ? '0' : String(n)
|
|
|
+ },
|
|
|
+ hasText(val) {
|
|
|
+ return val !== undefined && val !== null && String(val).trim() !== ''
|
|
|
+ },
|
|
|
+ mapListItem(item, amountDisplay) {
|
|
|
+ const row = Object.assign({}, item)
|
|
|
+ row.amount = amountDisplay
|
|
|
+ const text = String(amountDisplay || '')
|
|
|
+ row.amountClassName = (text.indexOf('+') === 0 || Number(row.io) === 1) ? 'bc-amount--in' : 'bc-amount--out'
|
|
|
+ const addTime = row.addTime || ''
|
|
|
+ if (addTime.length >= 16) {
|
|
|
+ row.dateText = addTime.substr(5, 5)
|
|
|
+ row.timeLine = addTime.substr(11, 5)
|
|
|
+ } else if (addTime.length >= 11) {
|
|
|
+ row.dateText = addTime.substr(0, 10)
|
|
|
+ row.timeLine = addTime.substr(11)
|
|
|
+ } else {
|
|
|
+ row.dateText = addTime
|
|
|
+ row.timeLine = ''
|
|
|
+ }
|
|
|
+ row.balanceText = this.formatMoney(row.balance)
|
|
|
+ const clearSn = row.clearSn || ''
|
|
|
+ const clearAmt = this.formatMoney(row.clearAmount)
|
|
|
+ row.showClearLink = Number(row.clearId) > 0 || this.hasText(clearSn)
|
|
|
+ row.clearLinkText = '结账单 ' + clearSn + ' · 本单销' + clearAmt + '元'
|
|
|
+ row.showBecomeBalance = Number(row.becomeBalance) > 0
|
|
|
+ row.becomeHintText = '剩余可用 ' + this.formatMoney(row.becomeBalance) + '元'
|
|
|
+ row.showStaff = this.hasText(row.staffName)
|
|
|
+ row.showRemark = this.hasText(row.remark)
|
|
|
+ row.showExtraRow = row.showClearLink || row.showBecomeBalance
|
|
|
+ return row
|
|
|
+ },
|
|
|
+ shouldHideRow(item) {
|
|
|
+ return item.io == 0 && item.event && String(item.event).indexOf('结账') === 0
|
|
|
+ },
|
|
|
+ async init() {
|
|
|
+ const res = await balanceChangeList({
|
|
|
+ page: this.list.page,
|
|
|
+ ghsId: this.option.ghsId
|
|
|
+ })
|
|
|
+ if (this.$util.isEmpty(res.data.list)) {
|
|
|
this.completes(res)
|
|
|
return
|
|
|
}
|
|
|
- let currentList = res.data.list
|
|
|
- currentList.forEach(function(item,index,array){
|
|
|
- array[index].amount = item.io == 0 ? '-'+parseFloat(item.amount) : '+'+parseFloat(item.amount)
|
|
|
- });
|
|
|
- res.data.list = currentList
|
|
|
+ const rows = []
|
|
|
+ res.data.list.forEach((item) => {
|
|
|
+ if (this.shouldHideRow(item)) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const amountDisplay = item.io == 0 ? '-' + parseFloat(item.amount) : '+' + parseFloat(item.amount)
|
|
|
+ rows.push(this.mapListItem(item, amountDisplay))
|
|
|
+ })
|
|
|
+ res.data.list = rows
|
|
|
this.completes(res)
|
|
|
},
|
|
|
- goDetail(item){
|
|
|
- if(item.capitalType == 65){
|
|
|
- this.$util.pageTo({url: "/admin/clear/info?id="+item.relateId})
|
|
|
+ goDetail(item) {
|
|
|
+ if (item.capitalType == 65) {
|
|
|
+ this.$util.pageTo({ url: '/admin/clear/info?id=' + item.relateId })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ goClear(item) {
|
|
|
+ if (Number(item.clearId) > 0) {
|
|
|
+ this.$util.pageTo({ url: '/admin/clear/info?id=' + item.clearId })
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
async onPullDownRefresh() {
|
|
|
- this.resetList();
|
|
|
+ this.resetList()
|
|
|
await this.init()
|
|
|
- uni.stopPullDownRefresh();
|
|
|
+ uni.stopPullDownRefresh()
|
|
|
},
|
|
|
async onReachBottom() {
|
|
|
if (!this.list.finished) {
|
|
|
await this.init()
|
|
|
- uni.stopPullDownRefresh();;
|
|
|
- } else {
|
|
|
- uni.stopPullDownRefresh();
|
|
|
}
|
|
|
- },
|
|
|
-
|
|
|
-};
|
|
|
+ uni.stopPullDownRefresh()
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
-<style lang="scss" scoped></style>
|
|
|
+<style lang="scss" scoped>
|
|
|
+.bc-page {
|
|
|
+ min-height: 100vh;
|
|
|
+ background: #fff;
|
|
|
+ box-sizing: border-box;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-sheet {
|
|
|
+ width: 100%;
|
|
|
+ background: #fff;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-head {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ padding: 22upx 0;
|
|
|
+ background: #f8f9fb;
|
|
|
+ border-bottom: 1upx solid #eceef2;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-th {
|
|
|
+ font-size: 28upx;
|
|
|
+ color: #8c8c8c;
|
|
|
+ font-weight: 500;
|
|
|
+ line-height: 1.2;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-th--time {
|
|
|
+ width: 100upx;
|
|
|
+ flex-shrink: 0;
|
|
|
+ padding-left: 8upx;
|
|
|
+ box-sizing: border-box;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-th--event {
|
|
|
+ flex: 1;
|
|
|
+ min-width: 0;
|
|
|
+ padding-right: 12upx;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-th--amt {
|
|
|
+ width: 118upx;
|
|
|
+ flex-shrink: 0;
|
|
|
+ text-align: right;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-th--bal {
|
|
|
+ width: 140upx;
|
|
|
+ flex-shrink: 0;
|
|
|
+ padding-right: 8upx;
|
|
|
+ text-align: right;
|
|
|
+ box-sizing: border-box;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-item {
|
|
|
+ border-bottom: 1upx solid #f2f3f5;
|
|
|
+ box-sizing: border-box;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-item:last-child {
|
|
|
+ border-bottom: none;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-item--alt {
|
|
|
+ background: #fafbfc;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-row-main {
|
|
|
+ display: flex;
|
|
|
+ align-items: flex-start;
|
|
|
+ padding: 24upx 0;
|
|
|
+ box-sizing: border-box;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-row-main--with-extra {
|
|
|
+ padding-bottom: 0;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-item:active .bc-row-main,
|
|
|
+.bc-item:active .bc-row-extra {
|
|
|
+ background: #f0f4ff;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-row-extra {
|
|
|
+ width: 100%;
|
|
|
+ padding: 12upx 0 20upx;
|
|
|
+ box-sizing: border-box;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-tags-row {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ align-items: flex-start;
|
|
|
+ width: 100%;
|
|
|
+ padding-left: 8upx;
|
|
|
+ padding-right: 8upx;
|
|
|
+ box-sizing: border-box;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-td--time {
|
|
|
+ width: 100upx;
|
|
|
+ flex-shrink: 0;
|
|
|
+ padding-left: 8upx;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: flex-start;
|
|
|
+ justify-content: center;
|
|
|
+ box-sizing: border-box;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-td--event {
|
|
|
+ flex: 1;
|
|
|
+ min-width: 0;
|
|
|
+ padding-right: 12upx;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-td--amt {
|
|
|
+ width: 118upx;
|
|
|
+ flex-shrink: 0;
|
|
|
+ padding-right: 8upx;
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-end;
|
|
|
+ box-sizing: border-box;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-td--bal {
|
|
|
+ width: 140upx;
|
|
|
+ flex-shrink: 0;
|
|
|
+ padding-right: 8upx;
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-end;
|
|
|
+ box-sizing: border-box;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-date {
|
|
|
+ font-size: 22upx;
|
|
|
+ color: #2c2c2c;
|
|
|
+ line-height: 1.35;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-clock {
|
|
|
+ margin-top: 4upx;
|
|
|
+ font-size: 22upx;
|
|
|
+ color: #2c2c2c;
|
|
|
+ line-height: 1.35;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-event {
|
|
|
+ display: block;
|
|
|
+ font-size: 28upx;
|
|
|
+ color: #1a1a1a;
|
|
|
+ font-weight: 500;
|
|
|
+ line-height: 1.45;
|
|
|
+ word-break: break-all;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-meta {
|
|
|
+ display: block;
|
|
|
+ margin-top: 8upx;
|
|
|
+ font-size: 22upx;
|
|
|
+ color: #999;
|
|
|
+ line-height: 1.4;
|
|
|
+ word-break: break-all;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-meta--remark {
|
|
|
+ color: #b3b3b3;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-tag {
|
|
|
+ display: block;
|
|
|
+ max-width: 100%;
|
|
|
+ padding: 6upx 14upx;
|
|
|
+ margin-top: 10upx;
|
|
|
+ margin-right: 12upx;
|
|
|
+ font-size: 22upx;
|
|
|
+ line-height: 1.4;
|
|
|
+ border-radius: 8upx;
|
|
|
+ word-break: break-all;
|
|
|
+ box-sizing: border-box;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-tags-row .bc-tag:first-child {
|
|
|
+ margin-top: 0;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-tag--link {
|
|
|
+ color: #85888d;
|
|
|
+ background: #eef4ff;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-tag--muted {
|
|
|
+ color: #666;
|
|
|
+ background: #f3f4f6;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-amount {
|
|
|
+ font-size: 28upx;
|
|
|
+ font-weight: 600;
|
|
|
+ line-height: 1.35;
|
|
|
+ font-variant-numeric: tabular-nums;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-amount--in {
|
|
|
+ color: #07a84c;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-amount--out {
|
|
|
+ color: #e62e45;
|
|
|
+}
|
|
|
+
|
|
|
+.bc-balance {
|
|
|
+ font-size: 26upx;
|
|
|
+ color: #131212;
|
|
|
+ line-height: 1.35;
|
|
|
+ font-variant-numeric: tabular-nums;
|
|
|
+}
|
|
|
+</style>
|