You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
123 lines
4.2 KiB
123 lines
4.2 KiB
// 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: {
|
|
created: function () {
|
|
// 在组件实例刚刚被创建时执行
|
|
},
|
|
attached: function () {
|
|
// 在组件实例进入页面节点树时执行
|
|
console.log(this.data.item)
|
|
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%)' : '(×首付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 = (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) + '元/吨' : '')
|
|
var rightJz = math.times(this.data.item.unitSurcharge, 1000) + '吨'
|
|
this.setData({
|
|
firstMoneyStringTip: firstLeft + '=' + rightJsdj + '×' + rightJsjz + '×' + rightFkbl + rightDmf + '×' + rightJz
|
|
})
|
|
//尾款金额toptip提示
|
|
console.log(1)
|
|
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'
|
|
}
|
|
console.log(2)
|
|
if (this.data.item.weightnoteInfo.settleWeight) {
|
|
var secondJszl = (math.divide(this.data.item.weightnoteInfo.settleWeight, 1000) + '吨')
|
|
} else {
|
|
var secondJszl = '0'
|
|
}
|
|
console.log(3)
|
|
if (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
|
|
})
|
|
|
|
console.log(this.data.firstMoneyStringTip)
|
|
console.log(this.data.secondMoneyStringTip)
|
|
|
|
},
|
|
detached: function () {
|
|
// 在组件实例被从页面节点树移除时执行
|
|
},
|
|
},
|
|
|
|
|
|
/**
|
|
* 组件的方法列表
|
|
*/
|
|
methods: {
|
|
hide() {
|
|
this.setData({
|
|
visible: false,
|
|
})
|
|
},
|
|
onChange(e) {
|
|
console.log('onChange', e)
|
|
this.setData({
|
|
visible: e.detail.visible,
|
|
})
|
|
},
|
|
}
|
|
})
|