Newer
Older
import {Component} from '@angular/core';
import {ActionSheetController, IonicPage, ModalController, NavController, NavParams} from 'ionic-angular';
import {ServeService} from "../../serve.service";
import {CommonService} from "../../../../provide/common.service";
import {DatePipe} from "@angular/common";
import {PersonMulComponent} from "../../../../components/person-mul/person-mul";
appointmentDate: false,
startEnd: false,
serviceStr: false,
{id: '1', name: '理发'},
{id: '2', name: '剪发'},
{id: '3', name: '烫发'},
{id: '4', name: '染发'}
applyId; //是否编辑
constructor(public navCtrl: NavController, public navParams: NavParams, private actionSheetCtrl: ActionSheetController,
private serveSer: ServeService, public modalCtrl: ModalController,
private commonSer: CommonService, private datePipe: DatePipe) {
}
ionViewDidLoad() {
this.applyId = this.navParams.get('id');
if (this.applyId) {
this.meetDetail();
}
}
this.obj.appointmentDate = res.data.appointmentDate;
this.obj.serviceStr = res.data.service.split(',');
this.obj.startEnd = res.data.startEnd;
this.obj.remark = res.data.remark;
chooseService(item) {
const index = this.obj.serviceStr.indexOf(item.id);
}
}
//选择时间段
chooseTime() {
const buttonsArr = [
{
text: '9:00-10:00',
handler: () => {
this.obj.timeText = '9:00-10:00';
}
},
{
text: '10:00-11:00',
handler: () => {
this.obj.timeText = '10:00-11:00';
}
},
{
text: '11:00-12:00',
handler: () => {
this.obj.timeText = '11:00-12:00';
}
},
{
text: '14:00-15:00',
handler: () => {
this.obj.timeText = '14:00-15:00';
}
},
{
text: '15:00-16:00',
handler: () => {
this.obj.timeText = '15:00-16:00';
}
},
{
text: '16:00-17:00',
handler: () => {
this.obj.timeText = '16:00-17:00';
}
}, {
text: '取消',
role: 'cancel',
handler: () => {
console.log('Cancel clicked');
}
}
];
const actionSheet = this.actionSheetCtrl.create({
cssClass: 'cameraAction',
buttons: buttonsArr
});
actionSheet.present();
}
submit() {
//校验
let checkBool = false;
for (let i in this.check) {
if (!this.obj[i] || this.obj.serviceStr.length == 0) {
console.log(this.obj[i]);
checkBool = true;
this.check[i] = true;
} else {
this.check[i] = false;
}
}
if (checkBool) return false;
appointmentDate: this.obj.appointmentDate,
service: this.obj.serviceStr.join(','),
};
if (this.applyId) data['id'] = this.applyId;
console.log(data);
this.commonSer.alert('确定提交申请?', () => {
} else {
this.commonSer.toast(res.errmsg);
}
}
)
});
}