Commit 3025e2b6 authored by wangqinghua's avatar wangqinghua

color

parent ca5ad94d
...@@ -29,5 +29,5 @@ ...@@ -29,5 +29,5 @@
<ion-textarea [(ngModel)]="order.Orderbz" class="content-textarea"></ion-textarea> <ion-textarea [(ngModel)]="order.Orderbz" class="content-textarea"></ion-textarea>
</ion-item> </ion-item>
<button class="submit-btn submit" (click)="submitOrder()">提交订单</button> <button class="submit-btn submit" (click)="confirmOrder()">提交订单</button>
</ion-content> </ion-content>
...@@ -53,15 +53,6 @@ export class ReplaceApplyPage { ...@@ -53,15 +53,6 @@ export class ReplaceApplyPage {
.subscribe((res :Response) => { .subscribe((res :Response) => {
this.activity = res.json(); this.activity = res.json();
this.batchList = this.activity.batchList; this.batchList = this.activity.batchList;
// for( let i = 0;i<this.batchList.length;i++ ){
// let endDate = this.batchList[i].batchEndDate + " 24:00:00";
// endDate = new Date(endDate).getTime() +''; //判断是否过截止日期
// if( now > Number(endDate) ){ //已截止
// this.batchList[i].signUp = false;
// }else{ //
// this.batchList[i].signUp = true;
// }
// }
}, (error) => { }, (error) => {
this.appService.alert('网络异常!'); this.appService.alert('网络异常!');
} }
...@@ -92,12 +83,55 @@ export class ReplaceApplyPage { ...@@ -92,12 +83,55 @@ export class ReplaceApplyPage {
selectblock(){ selectblock(){
let modal = this.modalCtrl.create(BlockModalPage,{blockList: this.batchList}); let modal = this.modalCtrl.create(BlockModalPage,{blockList: this.batchList});
modal.onDidDismiss(res=>{ modal.onDidDismiss(res=>{
if(res){
this.item = res; this.item = res;
this.itemName = res.batchName; this.itemName = res.batchName;
}
}); });
modal.present(); modal.present();
} }
//报名
confirmOrder(orderId) {
//验证信息:
/**0.对于暂未有批次的。
1.判断携带人数是否超过限额人数。
leaveNum: 剩余人数
applyNum:报名批次数量
**/
if(!this.item){
this.appService.popToastView("请选择报名批次",'middle',1000);
return false;
}
if( new Date().getTime() > new Date(this.item.batchEndDate).getTime() ){
this.appService.popToastView("该批次已过截止时间",'middle',1000);
return false;
}
let leaveNum = this.item.batchLimitNumber - this.item.hasSignUpCount;
let applyNum = 0;
this.activity.batchList.forEach((res)=>{
if(res.order){
console.log(res.order);
applyNum ++;
}
});
//报名次数 applyCount 1,2,3,4,5,0-> 不限
if(this.activity.applyCount > 0){
if(applyNum >= this.activity.applyCount){
this.appService.popToastView("提交失败,报名批次达到上限",'middle',1000);
return false;
}else if (Number(this.order.Personnumber +1) > Number(leaveNum)) {
this.appService.popToastView("报名人数超过了该批次的剩余人数",'middle',1000);
return false;
}else{
this.submitOrder();
}
} else { //报名(新增)
this.submitOrder();
}
}
// 提交订单 // 提交订单
submitOrder(){ submitOrder(){
const order = { const order = {
......
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