mirror of
https://gitee.com/java110/WechatOwnerService.git
synced 2026-02-23 21:36:38 +08:00
新增业主空置房申请
This commit is contained in:
parent
9d29b0d01c
commit
3dd3d38a40
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
### NetBeans ###
|
||||
unpackage/
|
||||
unpackage/
|
||||
.idea
|
||||
65
api/applyRoom/applyRoomApi.js
Normal file
65
api/applyRoom/applyRoomApi.js
Normal file
@ -0,0 +1,65 @@
|
||||
/**
|
||||
* 申请房信息处理 api 接口类
|
||||
*
|
||||
* add by 吴学文 QQ 928255095
|
||||
*/
|
||||
|
||||
|
||||
import {
|
||||
request
|
||||
} from '../java110Request.js'
|
||||
import
|
||||
url
|
||||
from '../../constant/url.js'
|
||||
|
||||
/**
|
||||
* 查询优惠类型
|
||||
*/
|
||||
export function queryApplyRoomDiscountType(_data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
request({
|
||||
url: url.queryApplyRoomDiscountType,
|
||||
method: "GET",
|
||||
data: _data,
|
||||
success: function(res) {
|
||||
|
||||
let data = res.data;
|
||||
if (data.code == 0) {
|
||||
resolve(data.data);
|
||||
} else {
|
||||
reject(data.msg);
|
||||
}
|
||||
},
|
||||
fail: function(res) {
|
||||
reject(res);
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交申请
|
||||
* @param {Object} _data 查询 入参
|
||||
*/
|
||||
export function saveApplyRoomDiscount(_data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
request({
|
||||
url: url.saveApplyRoomDiscount,
|
||||
method: "POST",
|
||||
data: _data,
|
||||
success: function(res) {
|
||||
let data = res.data;
|
||||
if (data.code == 0) {
|
||||
resolve();
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: data.msg
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: function(res) {
|
||||
reject(res);
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
@ -89,6 +89,11 @@ export function getCategoryList() {
|
||||
name: "车位申请",
|
||||
src: "/static/images/index_parking.png",
|
||||
href: "/pages/applyparking/applyparking"
|
||||
},
|
||||
{
|
||||
name: "空置房",
|
||||
src: "/static/images/index_openDoor.png",
|
||||
href: "/pages/applyRoom/applyRoom"
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
@ -41,6 +41,18 @@
|
||||
cycles: {
|
||||
type: String,
|
||||
default: 1
|
||||
},
|
||||
payerObjType: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
payerObjId: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
endTime: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
@ -52,7 +64,10 @@
|
||||
row: 20,
|
||||
feeId: _feeId,
|
||||
communityId: _communityId,
|
||||
cycles: _feeMonth
|
||||
cycles: _feeMonth,
|
||||
payerObjType: this.payerObjType,
|
||||
payerObjId: this.payerObjId,
|
||||
endTime: this.endTime
|
||||
}).then((data) => {
|
||||
_that.discounts = data;
|
||||
|
||||
|
||||
@ -102,6 +102,9 @@ export default {
|
||||
goodsUnifieldOrder: baseUrl + 'goods/unifieldOrder',
|
||||
deleteOwner: baseUrl + "/app/owner.deleteOwner",
|
||||
computeFeeDiscount: baseUrl + "/app/feeDiscount/computeFeeDiscount",
|
||||
// 查询申请类型(空置房)
|
||||
queryApplyRoomDiscountType: baseUrl + "app/applyRoomDiscount/queryApplyRoomDiscountType",
|
||||
saveApplyRoomDiscount: baseUrl + "app/applyRoomDiscount/saveApplyRoomDiscount",
|
||||
openDoor:baseUrl + "/app/machine/openDoor",
|
||||
|
||||
NEED_NOT_LOGIN_PAGE: [
|
||||
|
||||
20
pages.json
20
pages.json
@ -398,7 +398,25 @@
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
"path" : "pages/applyRoom/applyRoom",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText": "选择房屋",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}
|
||||
,{
|
||||
"path" : "pages/applyRoomDetail/applyRoomDetail",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText": "空置房申请",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
}
|
||||
],
|
||||
"tabBar": {
|
||||
"color": "#272636",
|
||||
|
||||
128
pages/applyRoom/applyRoom.vue
Normal file
128
pages/applyRoom/applyRoom.vue
Normal file
@ -0,0 +1,128 @@
|
||||
<template>
|
||||
<view class="tab-container bg-white">
|
||||
<view class="cu-list menu">
|
||||
<view class="cu-item arrow" v-if="rooms.length > 0" v-for="(item, key) in rooms" :key="key" :data-item="item" @click="toApplyDetail(item)">
|
||||
<view class="content padding-tb-sm">
|
||||
<view>
|
||||
<text class="cuIcon-homefill text-green margin-right-xs"></text> {{item.floorNum}}号楼{{item.unitNum}}单元{{item.roomNum}}室</view>
|
||||
<view class="text-gray text-sm">
|
||||
<text class="cuIcon-right margin-right-xs"></text> {{item.roomId}}</view>
|
||||
</view>
|
||||
<view class="action">
|
||||
|
||||
</view>
|
||||
</view>
|
||||
<view class="cu-item" v-if="rooms.length === 0">
|
||||
<view class="content">
|
||||
<text class="cuIcon-warn text-green"></text>
|
||||
<text class="text-grey">暂无房屋信息</text>
|
||||
</view>
|
||||
<view class="action">
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const context = require("../../context/Java110Context.js");
|
||||
import noDataPage from '@/components/no-data-page/no-data-page.vue'
|
||||
|
||||
import {
|
||||
getRooms
|
||||
} from '../../api/room/roomApi.js'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
rooms: [],
|
||||
curRoom: {},
|
||||
moreRooms: [],
|
||||
noData: false
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
noDataPage
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function(options) {
|
||||
context.onLoad(options);
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function() {
|
||||
let _that = this;
|
||||
this.noData = false;
|
||||
getRooms().then(data => {
|
||||
let _rooms = data.rooms;
|
||||
this.rooms = _rooms;
|
||||
let _owner = data.owner;
|
||||
_that.moreRooms = [];
|
||||
if (_rooms.length == 0) {
|
||||
_that.noData = true;
|
||||
return;
|
||||
}
|
||||
_rooms.forEach(function(_room) {
|
||||
_room.communityId = _owner.communityId;
|
||||
_room.communityName = _owner.communityName;
|
||||
});
|
||||
_that.curRoom = _rooms[0];
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
toApplyDetail: function(_item) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/applyRoomDetail/applyRoomDetail?room=' + JSON.stringify(_item)
|
||||
});
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.tab-container {
|
||||
/*border: 1px solid black;*/
|
||||
|
||||
margin-top: 30rpx;
|
||||
}
|
||||
.tab-item {
|
||||
padding: 20rpx 30rpx;
|
||||
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.tab-item-hover {
|
||||
background-color: #e6e6e6;
|
||||
}
|
||||
.tab-icon {
|
||||
width: 30rpx;
|
||||
height: 30rpx;
|
||||
}
|
||||
.tab-text {
|
||||
display: inline-block;
|
||||
margin-left: 10rpx;
|
||||
color: #1e1e1e;
|
||||
}
|
||||
.tab-arrow {
|
||||
display: inline-block;
|
||||
width: 20rpx;
|
||||
height: 20rpx;
|
||||
border: 1px solid #cdcdcd;
|
||||
|
||||
border-left: none;
|
||||
border-bottom: none;
|
||||
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
.border-bottom .icon{
|
||||
font-size: 38rpx;
|
||||
line-height: 38rpx;
|
||||
}
|
||||
</style>
|
||||
293
pages/applyRoomDetail/applyRoomDetail.vue
Normal file
293
pages/applyRoomDetail/applyRoomDetail.vue
Normal file
@ -0,0 +1,293 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="block__title">业主信息</view>
|
||||
<!-- <view class="cu-form-group">
|
||||
<view class="title">业主ID</view>
|
||||
{{ownerInfo.memberId}}
|
||||
</view> -->
|
||||
<view class="cu-form-group">
|
||||
<view class="title">名称</view>
|
||||
{{ownerInfo.appUserName}}
|
||||
</view>
|
||||
<view class="cu-form-group">
|
||||
<view class="title">身份证</view>
|
||||
{{ownerInfo.idCard}}
|
||||
</view>
|
||||
<view class="cu-form-group">
|
||||
<view class="title">联系方式</view>
|
||||
{{ownerInfo.link}}
|
||||
</view>
|
||||
|
||||
<view class="block__title">房屋信息</view>
|
||||
<!-- <view class="cu-form-group">
|
||||
<view class="title">房屋ID</view>
|
||||
{{roomDetail.roomId}}
|
||||
</view> -->
|
||||
<view class="cu-form-group">
|
||||
<view class="title">楼栋</view>
|
||||
{{roomDetail.floorNum}}号楼
|
||||
</view>
|
||||
<view class="cu-form-group">
|
||||
<view class="title">单元</view>
|
||||
{{roomDetail.unitNum}}单元
|
||||
</view>
|
||||
<view class="cu-form-group">
|
||||
<view class="title">房屋编号</view>
|
||||
{{roomDetail.roomNum}}室
|
||||
</view>
|
||||
|
||||
<view class="cu-form-group">
|
||||
<view class="title">楼层</view>
|
||||
{{roomDetail.layer+'层'}}
|
||||
</view>
|
||||
<!-- <view class="cu-form-group">
|
||||
<view class="title">房间数</view>
|
||||
{{roomDetail.section}}个
|
||||
</view> -->
|
||||
<view class="cu-form-group">
|
||||
<view class="title">户型</view>
|
||||
{{roomDetail.apartment}}
|
||||
</view>
|
||||
<view class="cu-form-group">
|
||||
<view class="title">建筑面积</view>
|
||||
{{roomDetail.builtUpArea+'平方米'}}
|
||||
</view>
|
||||
<!-- <view class="cu-form-group">
|
||||
<view class="title">单价</view>
|
||||
{{roomDetail.unitPrice+'元/平方米'}}
|
||||
</view> -->
|
||||
|
||||
<view class="block__title">空置房申请信息填写</view>
|
||||
<view class="cu-form-group arrow">
|
||||
<view class="title">优惠类型</view>
|
||||
<picker mode="selector" :value="applyType" :range="applyTypes" range-key="typeName" @change="applyTypeChange">
|
||||
<view class="picker">
|
||||
{{applyTypeShow?applyTypeShow:"请选择"}}
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="cu-form-group arrow">
|
||||
<view class="title">开始日期</view>
|
||||
<picker mode="date" :value="bindStartDate" start="2020-09-01" end="2050-09-01" @change="dateStartChange">
|
||||
<view class="picker">
|
||||
{{bindStartDate}}
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="cu-form-group arrow">
|
||||
<view class="title">结束日期</view>
|
||||
<picker mode="date" :value="bindEndDate" start="2020-09-01" end="2050-09-01" @change="dateEndChange">
|
||||
<view class="picker">
|
||||
{{bindEndDate}}
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
<view class="btn-box">
|
||||
<button type="default" class="btn-sub" @click="subApply()">提交申请</button>
|
||||
</view>
|
||||
|
||||
<view class="button_up_blank"></view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// pages/my/myHouseDetail.js
|
||||
const context = require("../../context/Java110Context.js");
|
||||
const factory = context.factory;
|
||||
import {compareDate,addDay,date2String} from '../../utils/DateUtil.js'
|
||||
import {queryApplyRoomDiscountType,saveApplyRoomDiscount} from '../../api/applyRoom/applyRoomApi.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
ownerInfo: {},
|
||||
// 用户信息
|
||||
ownerFlag: false,
|
||||
// 是否有业主信息 标记 如果有为 true 没有为false
|
||||
roomDetail: {},
|
||||
bindStartDate: '请选择',
|
||||
bindEndDate: '请选择',
|
||||
createRemark: '空置房申请',
|
||||
applyType: '',
|
||||
applyTypeShow: '',
|
||||
applyTypes: [],
|
||||
};
|
||||
},
|
||||
|
||||
components: {},
|
||||
props: {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function(options) {
|
||||
let _that = this;
|
||||
context.onLoad(options);
|
||||
_that.roomDetail = JSON.parse(options.room);
|
||||
_that.loadApplyRoomDiscountType();
|
||||
_that.loadOwenrInfo();
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function() {},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function() {},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function() {},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function() {},
|
||||
methods: {
|
||||
loadApplyRoomDiscountType: function(){
|
||||
let _that = this;
|
||||
let params = {
|
||||
communityId: this.roomDetail.communityId,
|
||||
page: 1,
|
||||
row: 50
|
||||
}
|
||||
queryApplyRoomDiscountType(params).then(function(types){
|
||||
_that.applyTypes = types;
|
||||
})
|
||||
},
|
||||
|
||||
loadOwenrInfo: function() {
|
||||
let _that = this;
|
||||
|
||||
context.getOwner(function(_ownerInfo) {
|
||||
console.log(_ownerInfo);
|
||||
|
||||
if (_ownerInfo) {
|
||||
_that.ownerFlag = true;
|
||||
_that.ownerInfo = _ownerInfo;
|
||||
} else {
|
||||
_that.ownerFlag = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 类型修改
|
||||
* @param {Object} e
|
||||
*/
|
||||
applyTypeChange: function(e){
|
||||
this.applyType = this.applyTypes[e.detail.value].applyType;
|
||||
this.applyTypeShow = this.applyTypes[e.detail.value].typeName;
|
||||
},
|
||||
|
||||
/**
|
||||
* 修改开始时间
|
||||
* @param {Object} e
|
||||
*/
|
||||
dateStartChange: function(e) {
|
||||
this.bindStartDate = e.detail.value;
|
||||
},
|
||||
|
||||
/**
|
||||
* 修改结束时间
|
||||
* @param {Object} e
|
||||
*/
|
||||
dateEndChange: function(e) {
|
||||
this.bindEndDate = e.detail.value;
|
||||
},
|
||||
|
||||
/**
|
||||
* 提交申请
|
||||
*/
|
||||
subApply: function(){
|
||||
if(this.applyType == ''){
|
||||
uni.showToast({
|
||||
title: '请选择优惠类型'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if(this.bindStartDate == '请选择' || this.bindEndDate == '请选择'){
|
||||
uni.showToast({
|
||||
title: '请选择时间范围'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if(!compareDate(this.bindEndDate, this.bindStartDate)){
|
||||
uni.showToast({
|
||||
title: '时间范围有误'
|
||||
});
|
||||
return;
|
||||
}
|
||||
let params = {
|
||||
startTime: this.bindStartDate + ' 0:00:00',
|
||||
// endTime: this.bindEndDate + ' 23:59:59',
|
||||
endTime: date2String(addDay(new Date(this.bindEndDate.replace(/-/g, "/")), 1)),
|
||||
roomName: this.roomDetail.floorNum + '-' + this.roomDetail.unitNum + '-' + this.roomDetail.roomNum,
|
||||
roomId: this.roomDetail.roomId,
|
||||
communityId: this.ownerInfo.communityId,
|
||||
createUserName: this.ownerInfo.appUserName,
|
||||
createUserTel: this.ownerInfo.link,
|
||||
createRemark: this.createRemark,
|
||||
ardId: '',
|
||||
applyType: this.applyType
|
||||
}
|
||||
console.log(params);
|
||||
saveApplyRoomDiscount(params).then(function(_res){
|
||||
uni.showToast({
|
||||
title: '申请成功'
|
||||
});
|
||||
setTimeout(function(){
|
||||
uni.navigateBack({})
|
||||
}, 1000);
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.block__title {
|
||||
margin: 0;
|
||||
font-weight: 400;
|
||||
font-size: 14px;
|
||||
color: rgba(69, 90, 100, .6);
|
||||
padding: 40rpx 30rpx 20rpx;
|
||||
}
|
||||
|
||||
.button_up_blank {
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.block__bottom {
|
||||
height: 180rpx;
|
||||
}
|
||||
|
||||
.btn-box{
|
||||
padding: 30rpx 0;
|
||||
}
|
||||
.btn-sub{
|
||||
width: 80%;
|
||||
margin: 0 auto;
|
||||
background-color: #1F8DEE!important;
|
||||
color: #fff!important;
|
||||
}
|
||||
</style>
|
||||
@ -74,7 +74,7 @@
|
||||
<text class="text-grey text-sm">{{endTime }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<vc-discount ref="vcDiscountRef" @computeFeeDiscount="computeFeeDiscount" :feeId="feeId" :cycles="feeMonth" :communityId="communityId"></vc-discount>
|
||||
<vc-discount ref="vcDiscountRef" @computeFeeDiscount="computeFeeDiscount" payerObjType="3333" :payerObjId="roomId" :endTime="formatEndTime" :feeId="feeId" :cycles="feeMonth" :communityId="communityId"></vc-discount>
|
||||
</view>
|
||||
|
||||
</scroll-view>
|
||||
@ -117,7 +117,7 @@
|
||||
import {getPayInfo} from '../../factory/WexinAppPayFactory.js'
|
||||
// #endif
|
||||
|
||||
import {addMonth,formatDate} from '../../utils/DateUtil.js'
|
||||
import {addMonth,formatDate,date2String} from '../../utils/DateUtil.js'
|
||||
export default {
|
||||
components:{
|
||||
vcDiscount
|
||||
@ -136,11 +136,13 @@
|
||||
feeMonth: 1,
|
||||
endTime: '',
|
||||
ordEndTime: '',
|
||||
formatEndTime: '',
|
||||
amount: 0,
|
||||
receivableAmount: 0.00,
|
||||
communityId: '',
|
||||
communityName: '',
|
||||
feeId: '',
|
||||
roomId: '',
|
||||
floorNum: '',
|
||||
unitNum: '',
|
||||
roomNum: '',
|
||||
@ -177,12 +179,14 @@
|
||||
this.floorNum = _fee.floorNum;
|
||||
this.unitNum = _fee.unitNum;
|
||||
this.roomNum = _fee.roomNum;
|
||||
this.roomId = _fee.roomId;
|
||||
this.layer = _fee.layer;
|
||||
this.builtUpArea = _fee.builtUpArea;
|
||||
this.feeId = _fee.feeId;
|
||||
this.amount = _amount;
|
||||
this.additionalAmount = _fee.additionalAmount;
|
||||
this.ordEndTime = _fee.endTime;
|
||||
this.formatEndTime = date2String(_fee.endTime);
|
||||
this.feeFlag = _fee.feeFlag;
|
||||
if(this.feeFlag == '2006012'){
|
||||
return;
|
||||
@ -196,7 +200,10 @@
|
||||
let _endTime = addMonth(_lastDate, parseInt(this.feeMonth));
|
||||
this.endTime = formatDate(_endTime);
|
||||
|
||||
this.$refs.vcDiscountRef._loadFeeDiscount(this.feeId,this.communityId,this.feeMonth);
|
||||
// this.$refs.vcDiscountRef._loadFeeDiscount(this.feeId,this.communityId,this.feeMonth);
|
||||
this.$nextTick(() => {
|
||||
this.$refs.vcDiscountRef._loadFeeDiscount(this.feeId,this.communityId,this.feeMonth);
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
computeFeeDiscount:function(_price){
|
||||
@ -318,7 +325,11 @@
|
||||
feeName: '物业费',
|
||||
receivedAmount: _receivedAmount,
|
||||
tradeType: _tradeType,
|
||||
appId: this.appId
|
||||
appId: this.appId,
|
||||
payerObjId: this.roomId,
|
||||
payerObjType: 3333,
|
||||
endTime: this.formatEndTime
|
||||
|
||||
};
|
||||
context.request({
|
||||
url: constant.url.preOrder,
|
||||
|
||||
@ -114,6 +114,36 @@ export function getDateYYYYMMDDHHMISS() {
|
||||
return year + "" + month + "" + day + "" + hour + "" + minute + "" + second;
|
||||
};
|
||||
|
||||
/**
|
||||
* 日期转化为字符串‘Y-m-d H:i:s’
|
||||
* @param {Object} _date
|
||||
*/
|
||||
export function date2String(_date){
|
||||
let date = new Date(_date);
|
||||
let year = date.getFullYear();
|
||||
let month = date.getMonth() + 1;
|
||||
let day = date.getDate();
|
||||
let hour = date.getHours();
|
||||
let minute = date.getMinutes();
|
||||
let second = date.getSeconds();
|
||||
if (month < 10) {
|
||||
month = '0' + month;
|
||||
}
|
||||
if (day < 10) {
|
||||
day = '0' + day;
|
||||
}
|
||||
if (hour < 10) {
|
||||
hour = '0' + hour;
|
||||
}
|
||||
if (minute < 10) {
|
||||
minute = '0' + minute;
|
||||
}
|
||||
if (second < 10) {
|
||||
second = '0' + second;
|
||||
}
|
||||
return year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second;
|
||||
};
|
||||
|
||||
/**
|
||||
* @description 当前时间加 指定年
|
||||
* @param {Object} _date 指定时间
|
||||
@ -211,4 +241,19 @@ export function addSeconds(_date, _second) {
|
||||
let s = _date.getSeconds() + _second; //获取秒
|
||||
let newDate = new Date(year, mon, da, h, m, s);
|
||||
return newDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对比时间
|
||||
* @param {Object} date1
|
||||
* @param {Object} date2
|
||||
*/
|
||||
export function compareDate(date1,date2){
|
||||
var oDate1 = new Date(date1);
|
||||
var oDate2 = new Date(date2);
|
||||
if(oDate1.getTime() > oDate2.getTime()){
|
||||
return true; //第一个大
|
||||
} else {
|
||||
return false; //第二个大
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user