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 {AppGlobal} from "../../../service/http.service";
import {ServeService} from "../serve.service";
import {DatePipe} from "@angular/common";
import {CommonService} from "../../../provide/common.service";
import {HairApplyPage} from "./hair-apply/hair-apply";
import {AppMainService} from "../../../app/app.service";
options: CalendarComponentOptions = {
from: new Date(2000, 0, 1),
monthFormat: 'YYYY 年 MM 月 ',
weekdays: weekDay,
monthPickerFormat: monthCh,
pickMode: 'single',
color: 'danger'
};
room;
applyList = [];
role = [];
pageNumber = 1;
pageSize = AppGlobal.pageCount;
total;
isLoad = true;
constructor(public navCtrl: NavController, public navParams: NavParams,
private serveSer: ServeService, public datePipe: DatePipe, private tabSer: TabsService,
private commonSer: CommonService, private appMainSer: AppMainService) {
//获取权限
this.appMainSer.role.subscribe(value => {
this.role = value;
}
);
//获取个人信息
this.appMainSer.mineInfo.subscribe(value => {
this.mineInfo = value;
})
(res) => {
this.room = res.data;
}
)
}
//我的预定
myApply() {
const data = {
P_pageNumber: this.pageNumber,
P_pageSize: this.pageSize,
(res) => {
if (res.errcode == 1000) {
this.commonSer.toast('取消预定成功');
this.myApply();
} else {
this.commonSer.toast(res.errmsg);
}
}
)
}
//改变
change(type) {
this.changeType = type;
if (this.changeType == 1) this.myApply();
if (this.changeType == 2) this.getApply();
if (this.role.includes(9) || this.mineInfo.username != item.userName) return false;