// pages/agent/detail/money-info/money-info.js const math = require('../../../../utils/math') Component({ options: { addGlobalClass: true, multipleSlots: true }, /** * 组件的属性列表 */ properties: { orderInfo: { type: Object, value: null }, item: { type: Object, value: null } }, /** * 组件的初始数据 */ data: { isShowtotalOtherAmount: true, firstMoneyStringTip: '', secondMoneyStringTip: '' }, //组件的生命周期 lifetimes: { attached: function () { // 在组件实例进入页面节点树时执行 if (this.data.item.otherAmountDtoList && this.data.item.otherAmountDtoList.length) { this.data.item.otherAmountDtoList.forEach(element => { if (element.amount != null && element.amount != 0) { this.setData({ isShowtotalOtherAmount: false }) } }) } //首笔货款金额tiptip提示 var firstFkbl = (this.data.item.activitySettleType == 0 ? '(×首付70%)' : (this.data.item.activitySettleType == 1 ? '(×首付85%)' : (this.data.item.activitySettleType == 2 ? '(×首付100%)' : ''))) var firstLeft = '预估总金额' + firstFkbl + '-代码费总额' var rightFkbl = (this.data.item.activitySettleType == 0 ? '70%' : (this.data.item.activitySettleType == 1 ? '85%' : '100%')) var rightJsdj = (math.times(this.data.item.unitPrice, 1000) + '元/吨') var rightJsjz = 0 if (this.data.item.weightnoteInfo && this.data.item.weightnoteInfo.netWeight) { rightJsjz = (math.divide(this.data.item.weightnoteInfo.netWeight, 1000) + '吨') } var rightDmf = this.data.item.unitSurcharge > 0 ? ('-' + math.times(this.data.item.unitSurcharge, 1000) + '元/吨') : (this.data.item.unitSurcharge < 0 ? math.times(this.data.item.unitSurcharge, 1000) + '元/吨' : '') if(this.data.item.unitSurcharge){ var rightJz = math.times(this.data.item.unitSurcharge, 1000) + '吨' this.setData({ firstMoneyStringTip: firstLeft + '=' + rightJsdj + '×' + rightJsjz + '×' + rightFkbl + rightDmf + '×' + rightJz }) } //尾款金额toptip提示 var secondLeft = '结算单价x结算重量-首笔货款金额' + firstFkbl + '+' + (this.data.isShowtotalOtherAmount == false ? '纸厂补贴与扣款' : '') + '+返还补贴+调节费' if (this.data.item.unitPrice) { var secondJsdj = (math.times(this.data.item.unitPrice, 1000) + '元/吨') } else { var secondJsdj = '0' } if (this.data.item.weightnoteInfo && this.data.item.weightnoteInfo.settleWeight) { var secondJszl = (math.divide(this.data.item.weightnoteInfo.settleWeight, 1000) + '吨') } else { var secondJszl = '0' } if (this.data.item.weightnoteInfo && this.data.item.weightnoteInfo.netWeight) { var secondJsjz = (math.divide(this.data.item.weightnoteInfo.netWeight, 1000) + '吨') } else { var secondJsjz = '0' } if (this.data.item.preSettleMoney) { var secondSbhkje = this.data.item.preSettleMoney > 0 ? '+' + this.data.item.preSettleMoney : this.data.item.preSettleMoney } else { var secondSbhkje = '+0元' } var secondzcbtykk = (this.data.isShowtotalOtherAmount == true ? '' : (this.data.item.totalOtherAmount > 0 ? '+' + this.data.item.totalOtherAmount : '' + this.data.item.totalOtherAmount)) + '元' if (this.data.item.unitRefundSubsidy) { var secondbtdj = (math.times(this.data.item.unitRefundSubsidy, 1000) + '元/吨') } else { var secondbtdj = '0元/吨' } var secondfhbt = (this.data.itemrefundSubsidy == 0 ? '' : (this.data.itemrefundSubsidy > 0 ? '+' + this.data.itemrefundSubsidy : (this.data.itemrefundSubsidy < 0 ? this.data.itemrefundSubsidy : '0'))) + '元' this.setData({ secondMoneyStringTip: secondLeft + '=' + secondJsdj + '×' + secondJszl + secondSbhkje + secondzcbtykk + '+' + secondbtdj + '×' + secondJsjz + '+' + secondfhbt }) } } })