Commit c30415d5 authored by wangqinghua's avatar wangqinghua

初始化参数

parent 86e07602
......@@ -18,7 +18,7 @@
</ion-item>
<ion-item>
<ion-label class="item-left"><span class="color-red">*</span>时间段:</ion-label>
<ion-label class="choose" (click)="chooseTime()">{{obj.timeText}}</ion-label>
<ion-label class="choose" style="color:#333333" (click)="chooseTime()">{{obj.timeText}}</ion-label>
<ion-label class="right-arrow">
<ion-icon name="arrow-forward"></ion-icon>
</ion-label>
......
......@@ -17,9 +17,9 @@ export class HairApplyPage {
appointmentDate: '',
service: '',
remark: '',
startEnd: null,
startEnd: '1',
serviceStr: [],
timeText: '请选择'
timeText: '9:00-10:00'
};
check = {
......@@ -35,6 +35,15 @@ export class HairApplyPage {
{id: '4', name: '染发'}
];
timeList = [
{id: '1', name: '9:00-10:00'},
{id: '2', name: '10:00-11:00'},
{id: '3', name: '11:00-12:00'},
{id: '4', name: '14:00-15:00'},
{id: '5', name: '15:00-16:00'},
{id: '6', name: '16:00-17:00'},
];
applyId; //是否编辑
constructor(public navCtrl: NavController, public navParams: NavParams, private actionSheetCtrl: ActionSheetController,
......@@ -43,12 +52,26 @@ export class HairApplyPage {
}
ionViewDidLoad() {
this.initParams();
this.applyId = this.navParams.get('id');
if (this.applyId) {
this.meetDetail();
}
}
//初始化参数
initParams() {
const data = this.navParams.get('data');
console.log(data);
if (data) {
this.obj.timeText = this.timeList.filter(e => data.startEnd == e.id)[0].name;
this.obj.startEnd = data.startEnd;
this.obj.appointmentDate = data.date;
} else {
this.obj.appointmentDate = this.datePipe.transform(new Date(), 'yyyy-MM-dd');
}
}
//申请详情
meetDetail() {
this.serveSer.hairApplyDetail(this.applyId).subscribe(
......@@ -76,59 +99,28 @@ export class HairApplyPage {
//选择时间段
chooseTime() {
const buttonsArr = [
{
text: '9:00-10:00',
handler: () => {
this.obj.startEnd = 1;
this.obj.timeText = '9:00-10:00';
}
},
{
text: '10:00-11:00',
handler: () => {
this.obj.startEnd = 2;
this.obj.timeText = '10:00-11:00';
}
},
{
text: '11:00-12:00',
const btnArr = this.timeList.map(e => {
const data = {
text: e.name,
role: e.id,
handler: () => {
this.obj.startEnd = 3;
this.obj.timeText = '11:00-12:00';
}
},
{
text: '14:00-15:00',
handler: () => {
this.obj.startEnd = 4;
this.obj.timeText = '14:00-15:00';
}
},
{
text: '15:00-16:00',
handler: () => {
this.obj.startEnd = 5;
this.obj.timeText = '15:00-16:00';
}
},
{
text: '16:00-17:00',
handler: () => {
this.obj.startEnd = 6;
this.obj.timeText = '16:00-17:00';
}
}, {
text: '取消',
role: 'cancel',
handler: () => {
console.log('Cancel clicked');
this.obj.startEnd = e.id;
this.obj.timeText = e.name;
}
};
return data;
});
btnArr.push({
text: '取消',
role: 'cancel',
handler: () => {
console.log('Cancel clicked');
}
];
});
const actionSheet = this.actionSheetCtrl.create({
cssClass: 'cameraAction',
buttons: buttonsArr
buttons: btnArr
});
actionSheet.present();
}
......
......@@ -3,7 +3,7 @@
<ion-navbar>
<ion-title>理发</ion-title>
<ion-buttons end>
<button ion-button (click)="addOrder()">
<button ion-button (click)="goApply(null)">
<ion-icon class="top-right-icon icon-fabu iconfont"></ion-icon>
</button>
</ion-buttons>
......@@ -23,7 +23,7 @@
<ion-content direction="y" scrollbar-y="true" class="bgc-e7e8ed">
<ng-container *ngIf="changeType == 1">
<ion-calendar [(ngModel)]="date"
(onChange)="getDate(e)"
(onChange)="getDate($event)"
[options]="options"
type="string"
format="YYYY-MM-DD">
......@@ -71,7 +71,7 @@
上午
</div>
<div class="morning-room">
<span (click)="goApply()" *ngFor="let item3 of room?.morningNotUse">
<span *ngFor="let item3 of room?.morningNotUse" (click)="goApply(item3)">
<span *ngIf="item3.startEnd == 1">9:00-10:00</span>
<span *ngIf="item3.startEnd == 2">10:00-11:00</span>
<span *ngIf="item3.startEnd == 3">11:00-12:00</span>(可预定)
......@@ -83,7 +83,7 @@
下午
</div>
<div class="morning-room">
<span (click)="goApply()" *ngFor="let item4 of room?.afternoonNotUse">
<span *ngFor="let item4 of room?.afternoonNotUse" (click)="goApply(item4)">
<span *ngIf="item4.startEnd == 4">14:00-15:00</span>
<span *ngIf="item4.startEnd == 5">15:00-16:00</span>
<span *ngIf="item4.startEnd == 6">16:00-17:00</span>(可预定)
......
......@@ -104,11 +104,6 @@ export class HairCutPage {
)
}
//新增预定
addOrder() {
this.navCtrl.push(HairApplyPage);
}
//改变
change(type) {
this.changeType = type;
......@@ -128,8 +123,15 @@ export class HairCutPage {
}
//新增申请
goApply() {
this.navCtrl.push(HairApplyPage);
goApply(item) {
let data;
if(item){
data = {
date:this.selectDate,
startEnd:item.startEnd
}
}
this.navCtrl.push(HairApplyPage,{data:data});
}
}
......@@ -91,6 +91,9 @@ export class RoomApplyPage {
this.obj.startTime = this.datePipe.transform(data.startTime, 'yyyy-MM-ddTHH:mm');
this.obj.roomId = data.roomId;
this.obj.roomText = data.roomName;
} else {
const now = this.datePipe.transform(new Date(), 'yyyy-MM-dd') + ' 9:00';
this.obj.startTime = this.datePipe.transform(now, 'yyyy-MM-ddTHH:mm');
}
}
......@@ -285,12 +288,7 @@ export class RoomApplyPage {
if (checkBool) return false;
let orgName;
this.orgList.forEach(e => {
if (this.obj.orgId == e.id) {
orgName = e.name;
}
});
let orgName = this.orgList.filter(e => this.obj.orgId == e.id)[0].name;
const data = {
meetingType: this.obj.meetingType,
roomId: this.obj.roomId,
......
......@@ -17,7 +17,7 @@
<ion-label class="right-arrow">
<ion-icon name="arrow-forward"></ion-icon>
</ion-label>
<ion-label *ngIf="checkObj.startTime" class="check-tips">请选择开始时间</ion-label>
<ion-label *ngIf="checkObj.startTime" class="check-tips">请选择用车时间</ion-label>
</ion-item>
<ion-item>
<ion-label class="item-left"><span class="color-red">*</span>还车时间:</ion-label>
......@@ -39,7 +39,9 @@
<div class="left"><span class="color-red">*</span>使用人:
</div>
<div class="right">
<button *ngIf="type != 'deal' " style="margin-bottom: 10px" color="danger" ion-button small (click)="choose()">选择</button>
<button *ngIf="type != 'deal' " style="margin-bottom: 10px" color="danger" ion-button small
(click)="choose()">选择
</button>
<div class="div-tag">
<span *ngFor="let item of personList;let i = index">
{{item.userName}}
......@@ -51,7 +53,8 @@
</div>
<ion-item>
<ion-label class="item-left"><span class="color-red">*</span>用车事由:</ion-label>
<ion-label (click)="chooseReason()" class="choose" >{{obj.useText}}</ion-label>
<ion-label (click)="chooseReason()" [ngStyle]="{'color':obj.useText == '请选择'?'#999':'#333'}"
class="choose">{{obj.useText}}</ion-label>
<ion-label *ngIf="type != 'deal' " class="right-arrow" (click)="chooseReason()">
<ion-icon name="arrow-forward"></ion-icon>
</ion-label>
......
......@@ -42,6 +42,7 @@ export class CarApplyPage {
}
ionViewDidLoad() {
this.initParams();
this.applyId = this.navParams.get('id');
this.type = this.navParams.get('type');
console.log(this.type);
......@@ -50,6 +51,17 @@ export class CarApplyPage {
}
}
//初始化参数
initParams() {
const data = this.navParams.get('data');
console.log(data);
if (data) {
} else {
this.obj.startTime = this.datePipe.transform(new Date(), 'yyyy-MM-ddTHH:mm');
}
}
//用车详情
meetDetail() {
this.serveSer.carDetail(this.applyId).subscribe(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment