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";
@IonicPage()
@Component({
selector: 'page-use-car',
templateUrl: 'use-car.html',
})
export class UseCarPage {
changeType = 1;
date = new Date();
options: CalendarComponentOptions = {
from: new Date(2000, 0, 1),
monthFormat: 'YYYY 年 MM 月 ',
weekdays: weekDay,
monthPickerFormat: monthCh,
pickMode: 'single',
color: 'danger'
};
room;
applyList = [];
pageNumber = 1;
pageSize = AppGlobal.pageCount;
total;
isLoad = true;
constructor(public navCtrl: NavController, public navParams: NavParams,
private serveSer: ServeService, public datePipe: DatePipe,
private commonSer: CommonService) {
}
ionViewDidEnter() {
const date = this.datePipe.transform(new Date(), 'yyyy-MM-dd');
this.getApply(date);
this.serveSer.queryMeetingRoomByDate(data).subscribe(
(res) => {
this.room = res.data;
}
)
}
//我的预定
myApply() {
const data = {
P_pageNumber: this.pageNumber,
P_pageSize: this.pageSize,
}
this.serveSer.queryMyApply(data).subscribe(
(res) => {
this.isLoad = false;
this.applyList = res.list;
this.total = res.total;
}
)
}
//取消预定
removeItem(item) {
this.serveSer.cancelApply(item.id).subscribe(
(res) => {
if (res.errcode == 1000) {
this.commonSer.toast('取消预定成功');
this.myApply();
} else {
this.commonSer.toast(res.errmsg);
}
}
)
}
//新增预定
addApply() {
this.navCtrl.push(CarApplyPage);
goApplyEdit(item) {
this.navCtrl.push(RoomApplyPage, {id: item.applyId});