mirror of
https://gitee.com/java110/WechatOwnerService.git
synced 2026-02-23 21:36:38 +08:00
优化停车费
This commit is contained in:
parent
c20f71a55e
commit
a6a95c57e3
@ -108,9 +108,18 @@ Page({
|
||||
for (let _psIndex = 0; _psIndex < _parkingSpaces.length; _psIndex++){
|
||||
_that._loadParkingSpaceFee(_parkingSpaces[_psIndex],function(_fee){
|
||||
|
||||
_parkingSpaces[_psIndex].endTime = _fee.endTime;
|
||||
let _endTime = new Date(_fee.endTime);
|
||||
|
||||
_parkingSpaces[_psIndex].endTime = util.date.formatDate(_endTime);
|
||||
|
||||
|
||||
_parkingSpaces[_psIndex].stateName = '欠费'
|
||||
let _now = new Date();
|
||||
|
||||
if (_endTime > _now){
|
||||
_parkingSpaces[_psIndex].feeStateName = '正常'
|
||||
}else{
|
||||
_parkingSpaces[_psIndex].feeStateName = '欠费'
|
||||
}
|
||||
_that.setData({
|
||||
parkingSpaces: _parkingSpaces
|
||||
});
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
<view class="block__title">停车费信息</view>
|
||||
<view class="ppfl_c" wx:for="{{parkingSpaces}}" wx:for-index="idx" wx:for-item="item" >
|
||||
<van-panel title="{{item.num}}号停车位" desc="" status="{{item.stateName}}状态" use-footer-slot>
|
||||
<van-panel title="{{item.num}}号停车位" desc="" status="{{item.feeStateName}}状态" use-footer-slot>
|
||||
<view class="ppfl_context">
|
||||
<van-row >
|
||||
<van-col span="5">车牌号码:</van-col>
|
||||
|
||||
@ -22,6 +22,20 @@ const formatTime = date => {
|
||||
return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map(formatNumber).join(':')
|
||||
}
|
||||
|
||||
/**
|
||||
* @desc: 格式化日期
|
||||
* @return: eg: '2018/04/09 21:31:00'
|
||||
* @param {Date对象} date
|
||||
*/
|
||||
const formatDate = date => {
|
||||
|
||||
const year = date.getFullYear()
|
||||
const month = date.getMonth() + 1
|
||||
const day = date.getDate()
|
||||
|
||||
return [year, month, day].map(formatNumber).join('-')
|
||||
}
|
||||
|
||||
//字符串转日期格式,strDate要转为日期格式的字符串
|
||||
const getDate = function getDate(strDate) {
|
||||
var st = strDate;
|
||||
@ -152,5 +166,6 @@ module.exports = {
|
||||
addHour: addHour,
|
||||
addMinutes: addMinutes,
|
||||
addSeconds: addSeconds,
|
||||
getDate: getDate
|
||||
getDate: getDate,
|
||||
formatDate: formatDate
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user