Newer
Older
import {Component} from '@angular/core';
import {IonicPage, NavController, NavParams} from 'ionic-angular';
import {CalendarComponentOptions} from "ion2-calendar";
import {monthCh, weekDay} from "../../../app/main";
import {ServeService} from "../serve.service";
import {DatePipe} from "@angular/common";
import {RoomApplyPage} from "../meet-room/room-apply/room-apply";
import {AppGlobal} from "../../../service/http.service";
import {CommonService} from "../../../provide/common.service";
import {CarApplyPage} from "./car-apply/car-apply";
options: CalendarComponentOptions = {
from: new Date(2000, 0, 1),
monthFormat: 'YYYY 年 MM 月 ',
weekdays: weekDay,
monthPickerFormat: monthCh,
pickMode: 'single',
color: 'danger'
};
page = {
P_pageNumber: 1,
P_pageSize: AppGlobal.pageCount,
total: 0,
isLoad: false,
};
constructor(public navCtrl: NavController, public navParams: NavParams,
private serveSer: ServeService, public datePipe: DatePipe,
private commonSer: CommonService, private appMainSer: AppMainService) {
}
//获取权限
this.appMainSer.role.subscribe(value => {
this.role = value;
}
);
//获取个人信息
this.appMainSer.mineInfo.subscribe(value => {
this.mineInfo = value;
})
this.checkObj.checkedApplyList = res.data.checkedApplyList;
this.checkObj.uncheckApplyist = res.data.uncheckApplyist;
//我的预定
myApply() {
this.nowDate = new Date().getTime();
const data = {
P_pageNumber: 1,
P_pageSize: this.page.P_pageSize,
};
this.serveSer.myCarApply(data).subscribe(
(res) => {
this.applyList = res.data.list;
this.page.total = res.data.total;
}
)
}
};
this.serveSer.myCarApply(data).subscribe(
(res) => {
timer(800).subscribe(() => e.complete());
}
)
}
doInfinite(e) {
this.nowDate = new Date().getTime();
if (this.page.total == this.applyList.length) {
console.log("没有更多了");
e.enable(false);
return false;
}
this.page.P_pageNumber++;
P_pageNumber: this.page.P_pageNumber,
P_pageSize: this.page.P_pageSize,
this.page.total = res.total;
this.applyList = this.applyList.concat(res.list);
timer(800).subscribe(() => e.complete());
this.commonSer.alert('确定取消?', () => {
this.serveSer.cancelCarApply(item.id).subscribe(
(res) => {
if (res.errcode == 1000) {
this.commonSer.toast('取消预定成功');
this.myApply();
} else {
this.commonSer.toast(res.errmsg);
}
if (this.changeType == 1) this.getApply();
if (this.changeType == 2) this.myApply();
}
//新增申请
goApply() {
this.navCtrl.push(RoomApplyPage);
}