优化代码

This commit is contained in:
java110 2020-10-18 18:46:29 +08:00
parent e15bcdfb40
commit 27edc8e081
2 changed files with 51 additions and 47 deletions

View File

@ -109,7 +109,10 @@
// pages/payParkingFee/payParkingFee.js // pages/payParkingFee/payParkingFee.js
const context = require("../../context/Java110Context.js"); const context = require("../../context/Java110Context.js");
const constant = context.constant; const constant = context.constant;
import {addMonth,formatDate} from '../../utils/DateUtil.js' import {
addMonth,
formatDate
} from '../../utils/DateUtil.js'
// #ifdef H5 // #ifdef H5
@ -161,7 +164,7 @@
let _communityInfo = context.getCurrentCommunity(); let _communityInfo = context.getCurrentCommunity();
let _lastDate = new Date(_fee.endTime); let _lastDate = new Date(_fee.endTime);
let _endTime = addMonth(_lastDate, this.feeMonth);
this.receivableAmount = _receivableAmount; this.receivableAmount = _receivableAmount;
this.communityId = _communityInfo.communityId; this.communityId = _communityInfo.communityId;
@ -171,7 +174,7 @@
this.carNum = _fee.carNum; this.carNum = _fee.carNum;
this.feeId = _fee.feeId; this.feeId = _fee.feeId;
this.feePrice = _fee.feePrice; this.feePrice = _fee.feePrice;
this.endTime = formatDate(_endTime);
this.ordEndTime = _fee.endTime; this.ordEndTime = _fee.endTime;
this.feeFlag = _fee.feeFlag; this.feeFlag = _fee.feeFlag;
if (this.feeFlag == '2006012') { if (this.feeFlag == '2006012') {
@ -183,7 +186,8 @@
this.feeMonthList.push(_index * this.paymentCycle + '个月') this.feeMonthList.push(_index * this.paymentCycle + '个月')
} }
this.feeMonthName = this.paymentCycle + '个月'; this.feeMonthName = this.paymentCycle + '个月';
let _endTime = addMonth(_lastDate, this.feeMonth);
this.endTime = formatDate(_endTime);
var pages = getCurrentPages(); var pages = getCurrentPages();
var prevPage = pages[pages.length - 2]; // var prevPage = pages[pages.length - 2]; //
//setData() //setData()

View File

@ -184,7 +184,6 @@
let _receivableAmount = (_fee.paymentCycle * _amount).toFixed(2); let _receivableAmount = (_fee.paymentCycle * _amount).toFixed(2);
let _communityInfo = context.getCurrentCommunity(); let _communityInfo = context.getCurrentCommunity();
let _lastDate = new Date(_fee.endTime); let _lastDate = new Date(_fee.endTime);
let _endTime = addMonth(_lastDate, this.feeMonth);
this.receivableAmount = _receivableAmount; this.receivableAmount = _receivableAmount;
this.communityId = _communityInfo.communityId; this.communityId = _communityInfo.communityId;
this.communityName = _communityInfo.communityName; this.communityName = _communityInfo.communityName;
@ -196,7 +195,6 @@
this.feeId = _fee.feeId; this.feeId = _fee.feeId;
this.amount = _amount; this.amount = _amount;
this.additionalAmount = _fee.additionalAmount; this.additionalAmount = _fee.additionalAmount;
this.endTime = formatDate(_endTime);
this.ordEndTime = _fee.endTime; this.ordEndTime = _fee.endTime;
this.feeFlag = _fee.feeFlag; this.feeFlag = _fee.feeFlag;
if(this.feeFlag == '2006012'){ if(this.feeFlag == '2006012'){
@ -208,6 +206,8 @@
} }
this.feeMonthName = this.paymentCycle + '个月'; this.feeMonthName = this.paymentCycle + '个月';
this.feeMonth = this.paymentCycle; this.feeMonth = this.paymentCycle;
let _endTime = addMonth(_lastDate, this.feeMonth);
this.endTime = formatDate(_endTime);
}, },
methods: { methods: {
dateChange: function(e) { dateChange: function(e) {