mirror of
https://gitee.com/java110/WechatOwnerService.git
synced 2026-06-11 06:07:24 +08:00
优化停车费
This commit is contained in:
parent
c20f71a55e
commit
a6a95c57e3
@ -108,9 +108,18 @@ Page({
|
|||||||
for (let _psIndex = 0; _psIndex < _parkingSpaces.length; _psIndex++){
|
for (let _psIndex = 0; _psIndex < _parkingSpaces.length; _psIndex++){
|
||||||
_that._loadParkingSpaceFee(_parkingSpaces[_psIndex],function(_fee){
|
_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({
|
_that.setData({
|
||||||
parkingSpaces: _parkingSpaces
|
parkingSpaces: _parkingSpaces
|
||||||
});
|
});
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<view class="block__title">停车费信息</view>
|
<view class="block__title">停车费信息</view>
|
||||||
<view class="ppfl_c" wx:for="{{parkingSpaces}}" wx:for-index="idx" wx:for-item="item" >
|
<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">
|
<view class="ppfl_context">
|
||||||
<van-row >
|
<van-row >
|
||||||
<van-col span="5">车牌号码:</van-col>
|
<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(':')
|
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要转为日期格式的字符串
|
//字符串转日期格式,strDate要转为日期格式的字符串
|
||||||
const getDate = function getDate(strDate) {
|
const getDate = function getDate(strDate) {
|
||||||
var st = strDate;
|
var st = strDate;
|
||||||
@ -152,5 +166,6 @@ module.exports = {
|
|||||||
addHour: addHour,
|
addHour: addHour,
|
||||||
addMinutes: addMinutes,
|
addMinutes: addMinutes,
|
||||||
addSeconds: addSeconds,
|
addSeconds: addSeconds,
|
||||||
getDate: getDate
|
getDate: getDate,
|
||||||
|
formatDate: formatDate
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user