|
|
@@ -9,6 +9,13 @@
|
|
|
</view>
|
|
|
<DateSelect class="bar" top="0" @selectDateFn="selectDateFn" defaultShowName='时间' />
|
|
|
</view>
|
|
|
+ <view v-if="hasDebtList" class="debt-summary flex-row">
|
|
|
+ <text class="debt-summary__label">已清</text>
|
|
|
+ <text class="debt-summary__amount debt-summary__amount--cleared">¥{{ debtSummary.clearedText }}</text>
|
|
|
+ <text class="debt-summary__split">|</text>
|
|
|
+ <text class="debt-summary__label">剩余待结</text>
|
|
|
+ <text class="debt-summary__amount debt-summary__amount--remain">¥{{ debtSummary.remainText }}</text>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
<view scroll-y class="shop-list">
|
|
|
<block v-if="!$util.isEmpty(detailsList)">
|
|
|
@@ -63,6 +70,13 @@ export default {
|
|
|
startTime:'',
|
|
|
endTime:'',
|
|
|
ghsId:0,
|
|
|
+ summaryCleared: null,
|
|
|
+ summaryRemain: null,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onShow () {
|
|
|
+ if (this.ghsId) {
|
|
|
+ this.initData()
|
|
|
}
|
|
|
},
|
|
|
onPullDownRefresh() {
|
|
|
@@ -93,6 +107,36 @@ export default {
|
|
|
}
|
|
|
return amount.toFixed(2);
|
|
|
},
|
|
|
+ hasDebtList () {
|
|
|
+ return this.detailsList && this.detailsList.length > 0
|
|
|
+ },
|
|
|
+ debtSummary () {
|
|
|
+ if (this.summaryCleared !== null && this.summaryRemain !== null) {
|
|
|
+ return {
|
|
|
+ clearedText: this.formatMoney(this.summaryCleared),
|
|
|
+ remainText: this.formatMoney(this.summaryRemain)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let cleared = 0
|
|
|
+ let remain = 0
|
|
|
+ if (this.detailsList && this.detailsList.length) {
|
|
|
+ this.detailsList.forEach((item) => {
|
|
|
+ const debtPrice = Number(item.debtPrice) || 0
|
|
|
+ const remainDebtPrice = Number(item.remainDebtPrice) || 0
|
|
|
+ remain += remainDebtPrice
|
|
|
+ const paid = Number(item.hasPayDebt)
|
|
|
+ if (!isNaN(paid) && paid > 0) {
|
|
|
+ cleared += paid
|
|
|
+ } else if (debtPrice > remainDebtPrice) {
|
|
|
+ cleared += debtPrice - remainDebtPrice
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ clearedText: this.formatMoney(cleared),
|
|
|
+ remainText: this.formatMoney(remain)
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
watch: {
|
|
|
selectList () {
|
|
|
@@ -104,6 +148,24 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ formatMoney (val) {
|
|
|
+ const n = parseFloat(val)
|
|
|
+ return isNaN(n) ? '0' : String(n)
|
|
|
+ },
|
|
|
+ mapDebtItem (ele) {
|
|
|
+ const debtPrice = Number(ele.debtPrice) || 0
|
|
|
+ const remainDebtPrice = Number(ele.remainDebtPrice) || 0
|
|
|
+ let hasPayDebt = Number(ele.hasPayDebt)
|
|
|
+ if (isNaN(hasPayDebt)) {
|
|
|
+ hasPayDebt = debtPrice > remainDebtPrice ? debtPrice - remainDebtPrice : 0
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ ...ele,
|
|
|
+ checked: false,
|
|
|
+ hasPayDebt: this.formatMoney(hasPayDebt),
|
|
|
+ showPartialClear: hasPayDebt > 0
|
|
|
+ }
|
|
|
+ },
|
|
|
selectDateFn(val){
|
|
|
this.searchTime = val.searchTime
|
|
|
this.startTime = val.startTime
|
|
|
@@ -142,12 +204,15 @@ export default {
|
|
|
this.ghsId = id
|
|
|
this.getGhsInfo(id)
|
|
|
return purchaseDebtList({id:id,searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime}).then(res => {
|
|
|
- this.detailsList = res.data.list.map(ele => {
|
|
|
- return {
|
|
|
- ...ele,
|
|
|
- checked: false
|
|
|
- };
|
|
|
- });
|
|
|
+ const list = res.data.list || []
|
|
|
+ this.detailsList = list.map((ele) => this.mapDebtItem(ele))
|
|
|
+ if (res.data && res.data.clearedAmount !== undefined) {
|
|
|
+ this.summaryCleared = res.data.clearedAmount
|
|
|
+ this.summaryRemain = res.data.remainDebtAmount
|
|
|
+ } else {
|
|
|
+ this.summaryCleared = null
|
|
|
+ this.summaryRemain = null
|
|
|
+ }
|
|
|
}).catch(err => {
|
|
|
|
|
|
})
|
|
|
@@ -221,9 +286,10 @@ export default {
|
|
|
flex-direction: column;
|
|
|
background-color: #f9fbfc;
|
|
|
.top-view {
|
|
|
- padding: 30upx;
|
|
|
+ padding: 24upx 24upx 20upx;
|
|
|
position:fixed;
|
|
|
width:100%;
|
|
|
+ box-sizing: border-box;
|
|
|
background-color: #fff;
|
|
|
.top-row {
|
|
|
display: flex;
|
|
|
@@ -259,8 +325,40 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ .debt-summary {
|
|
|
+ margin-top: 16upx;
|
|
|
+ padding: 14upx 18upx;
|
|
|
+ border-radius: 10upx;
|
|
|
+ background: #fff7f7;
|
|
|
+ align-items: center;
|
|
|
+ flex-wrap: wrap;
|
|
|
+ box-sizing: border-box;
|
|
|
+ }
|
|
|
+ .debt-summary__label {
|
|
|
+ font-size: 24upx;
|
|
|
+ color: #666;
|
|
|
+ line-height: 32upx;
|
|
|
+ }
|
|
|
+ .debt-summary__amount {
|
|
|
+ margin-left: 6upx;
|
|
|
+ font-size: 28upx;
|
|
|
+ font-weight: 700;
|
|
|
+ line-height: 36upx;
|
|
|
+ }
|
|
|
+ .debt-summary__amount--cleared {
|
|
|
+ color: #07a84c;
|
|
|
+ }
|
|
|
+ .debt-summary__amount--remain {
|
|
|
+ color: #f50e24;
|
|
|
+ }
|
|
|
+ .debt-summary__split {
|
|
|
+ margin: 0 16upx;
|
|
|
+ font-size: 24upx;
|
|
|
+ color: #ddd;
|
|
|
+ line-height: 32upx;
|
|
|
+ }
|
|
|
.shop-list {
|
|
|
- margin-top:98upx;
|
|
|
+ margin-top: 168upx;
|
|
|
padding: 20upx 0;
|
|
|
flex: 1;
|
|
|
padding-bottom: 100upx;
|