diff --git a/pages/payParkingFee/payParkingFee.js b/pages/payParkingFee/payParkingFee.js index 4cb1727..40ac4c2 100644 --- a/pages/payParkingFee/payParkingFee.js +++ b/pages/payParkingFee/payParkingFee.js @@ -11,9 +11,9 @@ Page({ */ data: { showFeeMonth:false, - feeMonthList:['一个月','半年','一年','两年'], - feeMonthName:'一个月', - feeMonth:1, + feeMonthList:[], + feeMonthName:'', + feeMonth:0, endTime:'', ordEndTime:'', amount:0, @@ -22,7 +22,8 @@ Page({ communityId:'', communityName:'', - feeId:'' + feeId:'', + paymentCycles: [] }, @@ -32,11 +33,19 @@ Page({ onLoad: function (options) { let _fee = JSON.parse(options.fee); console.log('_fee',_fee); - let _receivableAmount = this.data.feeMonth * _fee.feePrice * 100; + let _communityInfo = context.getCurrentCommunity(); let _lastDate = new Date(_fee.endTime); - let _endTime = util.date.addMonth(_lastDate, this.data.feeMonth); - + let _paymentCycle = _fee.paymentCycle; + let _paymentCycles = []; + let _feeMonthList = []; + let _receivableAmount = _paymentCycle * _fee.feePrice * 100; + let _endTime = util.date.addMonth(_lastDate, _paymentCycle); + + for (let _index = 1; _index < 6; _index++) { + _paymentCycles.push(_index * parseInt(_paymentCycle)); + _feeMonthList.push((_index * parseInt(_paymentCycle)) + "个月"); + } this.setData({ receivableAmount: _receivableAmount, communityId: _communityInfo.communityId, @@ -47,7 +56,11 @@ Page({ feeId:_fee.feeId, feePrice: _fee.feePrice, endTime: util.date.formatDate(_endTime), - ordEndTime: _fee.endTime + ordEndTime: _fee.endTime, + feeMonth: _paymentCycle, + feeMonthName: _paymentCycle + '个月', + paymentCycles: _paymentCycles, + feeMonthList: _feeMonthList, }); var pages = getCurrentPages(); @@ -115,18 +128,18 @@ Page({ console.log("onConfirm", e); let _feeMonthName = null; _feeMonthName = e.detail.value; - let _feeMonth = 1; - if (_feeMonthName == '一个月'){ - _feeMonth = 1; - } else if (_feeMonthName == '半年'){ - _feeMonth = 6; - } else if (_feeMonthName == '一年') { - _feeMonth = 12; - } else if (_feeMonthName == '两年') { - _feeMonth = 24; - }else{ - return ; - } + let _feeMonth = this.data.paymentCycles[e.detail.index]; + // if (_feeMonthName == '一个月'){ + // _feeMonth = 1; + // } else if (_feeMonthName == '半年'){ + // _feeMonth = 6; + // } else if (_feeMonthName == '一年') { + // _feeMonth = 12; + // } else if (_feeMonthName == '两年') { + // _feeMonth = 24; + // }else{ + // return ; + // } let _receivableAmount = _feeMonth * this.data.feePrice * 100; @@ -159,7 +172,8 @@ Page({ communityId: this.data.communityId, feeId: this.data.feeId, feeName: '停车费', - receivedAmount: _receivedAmount + receivedAmount: _receivedAmount, + tradeType: 'JSAPI' } context.request({ diff --git a/pages/payParkingFeeList/payParkingFeeList.js b/pages/payParkingFeeList/payParkingFeeList.js index cb0e327..2985c95 100644 --- a/pages/payParkingFeeList/payParkingFeeList.js +++ b/pages/payParkingFeeList/payParkingFeeList.js @@ -138,6 +138,7 @@ Page({ _tmpParkingSpace.feeTypeCdName = _fee.feeTypeCdName; _tmpParkingSpace.feeName = _fee.feeName; _tmpParkingSpace.feeId = _fee.feeId; + _tmpParkingSpace.paymentCycle = _fee.paymentCycle; _that.data.moreParkingSpaces.push(_tmpParkingSpace); }); _that.setData({ diff --git a/pages/roomFee/roomFee.js b/pages/roomFee/roomFee.js index 052e016..e11c31f 100644 --- a/pages/roomFee/roomFee.js +++ b/pages/roomFee/roomFee.js @@ -11,7 +11,7 @@ Page({ */ data: { showFeeMonth: false, - feeMonthList: ['一个月', '半年', '一年', '两年'], + feeMonthList: [], feeMonthName: '一个月', feeMonth: 1, endTime: '', @@ -26,7 +26,8 @@ Page({ unitNum: '', roomNum: '', layer: '', - builtUpArea: '' + builtUpArea: '', + paymentCycles: [] }, @@ -37,10 +38,21 @@ Page({ let _fee = JSON.parse(options.fee); console.log('_fee', _fee); let _amount = _fee.amount; - let _receivableAmount = _amount* 100; + let _communityInfo = context.getCurrentCommunity(); + + let _paymentCycle = _fee.paymentCycle; + let _paymentCycles = []; + let _feeMonthList = []; + let _receivableAmount = _paymentCycle * _amount * 100; let _lastDate = new Date(_fee.endTime); - let _endTime = util.date.addMonth(_lastDate, this.data.feeMonth); + let _endTime = util.date.addMonth(_lastDate, _paymentCycle); + console.log(_paymentCycle) + + for(let _index = 1;_index < 6 ;_index++){ + _paymentCycles.push(_index * parseInt(_paymentCycle)); + _feeMonthList.push((_index * parseInt(_paymentCycle))+"个月"); + } this.setData({ receivableAmount: _receivableAmount, @@ -56,7 +68,11 @@ Page({ amount: _amount, additionalAmount: _fee.additionalAmount, endTime: util.date.formatDate(_endTime), - ordEndTime: _fee.endTime + ordEndTime: _fee.endTime, + paymentCycles: _paymentCycles, + feeMonthList: _feeMonthList, + feeMonth: _paymentCycle, + feeMonthName: _paymentCycle +'个月' }); var pages = getCurrentPages(); var prevPage = pages[pages.length - 2]; //上一个页面 @@ -123,18 +139,18 @@ Page({ console.log("onConfirm", e); let _feeMonthName = null; _feeMonthName = e.detail.value; - let _feeMonth = 1; - if (_feeMonthName == '一个月') { - _feeMonth = 1; - } else if (_feeMonthName == '半年') { - _feeMonth = 6; - } else if (_feeMonthName == '一年') { - _feeMonth = 12; - } else if (_feeMonthName == '两年') { - _feeMonth = 24; - } else { - return; - } + let _feeMonth = this.data.paymentCycles[e.detail.index]; + // if (_feeMonthName == '一个月') { + // _feeMonth = 1; + // } else if (_feeMonthName == '半年') { + // _feeMonth = 6; + // } else if (_feeMonthName == '一年') { + // _feeMonth = 12; + // } else if (_feeMonthName == '两年') { + // _feeMonth = 24; + // } else { + // return; + // } let _receivableAmount = _feeMonth * this.data.amount * 100; diff --git a/pages/roomFeeList/roomFeeList.js b/pages/roomFeeList/roomFeeList.js index 5acfcf0..fb2b049 100644 --- a/pages/roomFeeList/roomFeeList.js +++ b/pages/roomFeeList/roomFeeList.js @@ -133,6 +133,7 @@ Page({ _tmpRoom.amount = _roomFee.feePrice; _tmpRoom.feeId = _roomFee.feeId; _tmpRoom.feeName = _roomFee.feeName; + _tmpRoom.paymentCycle = _roomFee.paymentCycle; _that.data.moreRooms.push(_tmpRoom); }); _that.setData({