Commit d424bf24 authored by wangqinghua's avatar wangqinghua

活动

parent e8c6d36b
...@@ -9,28 +9,20 @@ ...@@ -9,28 +9,20 @@
<span float-right>{{activity.activityName}}</span> <span float-right>{{activity.activityName}}</span>
</ion-item> </ion-item>
<ion-item> <ion-item>
<ion-label>选择批次</ion-label> <span>选择批次</span>
<ion-select [(ngModel)]="order.Batchid" cancelText="取消" okText="确定"> <span float-right>{{item.batchName}}</span>
<ion-option value="{{item.id}}" *ngFor="let item of activity.batchList">{{item.batchName}}</ion-option>
</ion-select>
</ion-item> </ion-item>
<ion-item class="margin-top-10"> <ion-item class="margin-top-10">
<ion-label>报名用户</ion-label> <ion-label>报名用户</ion-label>
<span class="lettr-space-1" item-right></span> <span class="lettr-space-1" item-right>{{role.loginName}}</span>
</ion-item> </ion-item>
<ion-item class="margin-top-10"> <ion-item class="margin-top-10">
<span>携带人数</span> <span>携带人数</span>
<span> <span class="com" float-right>
<span>
<button type="button" class="input_left" (tap)="next()">-</button> <button type="button" class="input_left" (tap)="next()">-</button>
</span>
<span>
<input type="text" readonly="readonly" [(ngModel)]='order.Personnumber' name="num" /> <input type="text" readonly="readonly" [(ngModel)]='order.Personnumber' name="num" />
</span>
<span>
<button type="button" style="margin-left: -2px" class="input_right" (tap)="add()">+</button> <button type="button" style="margin-left: -2px" class="input_right" (tap)="add()">+</button>
</span> </span>
</span>
</ion-item> </ion-item>
<ion-item class="margin-top-10"> <ion-item class="margin-top-10">
<ion-label>报名备注</ion-label> <ion-label>报名备注</ion-label>
...@@ -39,37 +31,3 @@ ...@@ -39,37 +31,3 @@
<button class="submit-btn submit" (click)="submitOrder()">提交订单</button> <button class="submit-btn submit" (click)="submitOrder()">提交订单</button>
</ion-content> </ion-content>
<!--<div class="cover" *ngIf="isCover">-->
<!--<div class="cover-content">-->
<!--<div class="cover-content-box">-->
<!--<h4 class="cover-content-title">具体介绍</h4>-->
<!--<div class="cover-content-info">-->
<!--<p>-->
<!--{{activity.activityIntro}}-->
<!--</p>-->
<!--</div>-->
<!--<button ion-button block (click)="hidden()">-->
<!--关闭-->
<!--</button>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--<div class="cover" *ngIf="isSuccess">-->
<!--<div class="cover-content cover-content-result">-->
<!--<div class="cover-content-box">-->
<!--<img class="result-img" src="./assets/imgs/success.png">-->
<!--<h4 class="result-msg">报名成功</h4>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--<div class="cover" *ngIf="isError">-->
<!--<div class="cover-content cover-content-result">-->
<!--<div class="cover-content-box">-->
<!--<img class="result-img" src="./assets/imgs/error.png">-->
<!--<h4 class="result-msg">报名失败</h4>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
\ No newline at end of file
...@@ -344,6 +344,7 @@ page-activityApply { ...@@ -344,6 +344,7 @@ page-activityApply {
.item-ios.item-block .item-inner{ .item-ios.item-block .item-inner{
margin-right: 16px; margin-right: 16px;
border: none; border: none;
padding-left: 16px;
} }
.content .item-ios.item-block:nth-child(5) .item-inner{ .content .item-ios.item-block:nth-child(5) .item-inner{
border: none; border: none;
...@@ -366,4 +367,18 @@ page-activityApply { ...@@ -366,4 +367,18 @@ page-activityApply {
border: 1px solid #34b4fc; border: 1px solid #34b4fc;
background-color: #34b4fc; background-color: #34b4fc;
} }
.com{
font-size: 0;
}
.com input{
font-size: 1.5rem;
height: 2rem;
width: 20px;
vertical-align: bottom;
border: 1px solid #ddd;
text-align: center;
}
.com button{
height: 2rem;
}
} }
...@@ -3,7 +3,7 @@ import { IonicPage, NavController, NavParams, AlertController, ToastController, ...@@ -3,7 +3,7 @@ import { IonicPage, NavController, NavParams, AlertController, ToastController,
import { MyActivityListPage } from '../../myActivityList/myActivityList'; import { MyActivityListPage } from '../../myActivityList/myActivityList';
import { Http, Response } from '@angular/http'; import { Http, Response } from '@angular/http';
import { Storage } from '@ionic/storage';
import { AppService, AppGlobal } from '../../../service/appHttpService'; import { AppService, AppGlobal } from '../../../service/appHttpService';
import {ActivityConfirmPage} from "../activityConfirm/activityConfirm"; import {ActivityConfirmPage} from "../activityConfirm/activityConfirm";
...@@ -18,7 +18,19 @@ export class ActivityApplyPage { ...@@ -18,7 +18,19 @@ export class ActivityApplyPage {
isLoad:boolean = false; isLoad:boolean = false;
//batches: object[]; //所有批次信息 //batches: object[]; //所有批次信息
batches: Array<String>[]; batches: Array<String>[];
activity: any; //活动信息 activity = {
activityName:'',
id:''
}; //活动信息
item = {
batchName:'',
batchPerNumber:null,
activityId:'',
id:''
};
role = {
loginName:''
}; //角色信息
onebatch:Array<String>; onebatch:Array<String>;
onebatchSurplusQuota: number; //某批次剩余报名名额 onebatchSurplusQuota: number; //某批次剩余报名名额
...@@ -49,7 +61,7 @@ export class ActivityApplyPage { ...@@ -49,7 +61,7 @@ export class ActivityApplyPage {
pageflag: boolean = false; pageflag: boolean = false;
constructor(public navCtrl: NavController, constructor(public navCtrl: NavController,
public navParams: NavParams, public navParams: NavParams,public storage: Storage,
public alertCtrl: AlertController, public alertCtrl: AlertController,
public http: Http, public http: Http,
public appService: AppService, public appService: AppService,
...@@ -69,112 +81,17 @@ export class ActivityApplyPage { ...@@ -69,112 +81,17 @@ export class ActivityApplyPage {
} }
//初始化显示活动列表 //初始化显示活动列表
ngOnInit(): void { ionViewDidEnter(): void {
this.activity = this.navParams.get("activity"); this.activity = this.navParams.get("activity");
this.item = this.navParams.get('item');
this.order.Activityid = this.activity.id; this.order.Activityid = this.activity.id;
console.log(this.activity); // //获取角色
// this.storage.get("user").then((value) => {
// if (this.activity.activityIMG) { this.role = value;
// this.picture = AppGlobal.picture + this.activity.activityIMG; console.log(this.role);
// this.isLoad = true;
// }
//
// this.subIntroduce(this.activity.activityIntro); //处理活动详情字数显示问题
// //订单的活动id
// this.initBatchList(this.navParams.get("changeOrderInfo"));
}
//报名:初始化批次信息
initBatchList(changBatchOrder) {
this.appService.ObserverHttpGet("/wisdomgroup/modules/batch/findBatchForApp", { id: this.activity.id })
.subscribe((res: Response) => {
let data = res.json();
this.batches = data;
console.log("batches::" + this.batches);
//增加属性:报名剩余名额,不可报名标识
if (this.batches.length > 0) {
this.batches.forEach(element => {
element["onebatchSurplusQuota"] = Number(element["batchLimitNumber"]) - Number(element["hasSignUpCount"]);
element["noRegistrationFalg"] = false; //可报名
element["hasOverdueflag"] = false; //未逾期(报名已截止)
//报名截止日期小于当前时间不可报名
let signflag = Date.parse(element["batchEndDate"].toString()) < Date.parse(new Date().toString());
if (signflag || element["onebatchSurplusQuota"] <= 0) {
element["noRegistrationFalg"] = true; //不可报名标识
}
if(signflag){
element["hasOverdueflag"] = true; //逾期标识
}
}); });
} else {
this.onebatch = null;
}
if (changBatchOrder != null) { //重选批次
this.pageflag = true;
this.order.Orderid = changBatchOrder.orderid;
this.order.Orderbz = changBatchOrder.orderbz;
this.order.orderbz_end = changBatchOrder.orderbz;
this.order.Activityid = changBatchOrder.activityid;
this.order.Batchid = changBatchOrder.batchid;
this.order.Personnumber = changBatchOrder.personnumber;
this.isSelected = this.order.Batchid; //进入页面默认显示已选择的批次
this.onebatch = changBatchOrder.batch; //某个批次
//某个批次
this.onebatch["onebatchSurplusQuota"] = Number(this.onebatch["batchLimitNumber"]) - Number(this.onebatch["hasSignUpCount"]);
this.onebatch["noRegistrationFalg"] = false; //默认可报名
let signflag = Date.parse(this.onebatch["batchEndDate"].toString()) < Date.parse(new Date().toString());
if (signflag || this.onebatch["onebatchSurplusQuota"] <= 0) {
this.onebatch["noRegistrationFalg"] = true; //不可报名标识
}
if(signflag){
this.onebatch["hasOverdueflag"] = true; //逾期标识
} }
console.log(this.onebatch);
this.noticeArry = this.strSplit(this.onebatch["batchNotice"]);
} else { //报名
if (this.batches.length > 0) {
for (let index = 0; index < this.batches.length; index++) {
if (!this.batches[index]["noRegistrationFalg"]) {
this.onebatch = this.batches[index]; //初始化显示 活动说明
this.noticeArry = this.strSplit(this.onebatch["batchNotice"]);
break;
}
}
//选择第一可操作的批次
if (this.onebatch != null) {
this.order.Batchid = this.onebatch["id"]; //初始设置订单批次id
this.isSelected = this.onebatch["id"]; //初始设置选中批次的id
}else{ //默认选择第一个显示
this.onebatch = this.batches[0];
}
}else {
this.onebatch = null;
}
}
}, error => {
this.appService.alert('网络异常!');
}
);
}
//分隔字符串
strSplit(str):object[]{
let temp = str.split(/[\n]/g);
for(let i =0;i<temp.length;i++){
if(temp[i] == ""){
temp.splice(i, 1);
//删除数组索引位置应保持不变
i--;
}
}
return temp;
}
//切换批次其对应活动说明也发生改变 //切换批次其对应活动说明也发生改变
...@@ -191,9 +108,9 @@ export class ActivityApplyPage { ...@@ -191,9 +108,9 @@ export class ActivityApplyPage {
//携带人数 数字加减 //携带人数 数字加减
add() { add() {
console.log("1:"+this.order.Personnumber); console.log("1:"+this.order.Personnumber);
// if(this.order.Personnumber < this.onebatch["batchPerNumber"]){ if(this.order.Personnumber < this.item.batchPerNumber){
this.order.Personnumber++; this.order.Personnumber++;
// } }
} }
next() { next() {
...@@ -236,7 +153,7 @@ export class ActivityApplyPage { ...@@ -236,7 +153,7 @@ export class ActivityApplyPage {
return; return;
} }
if (orderId.length > 0) { //我的活动:重选批次(修改) if (orderId.length > 0) { //我的活动:重选批次(修改)
this.changeOrderInfo(orderId); // this.changeOrderInfo(orderId);
} else { //报名(新增) } else { //报名(新增)
this.commitSignUpOrder(); this.commitSignUpOrder();
} }
...@@ -244,10 +161,6 @@ export class ActivityApplyPage { ...@@ -244,10 +161,6 @@ export class ActivityApplyPage {
//报名操作 //报名操作
commitSignUpOrder() { commitSignUpOrder() {
console.log('报名操作');
this.order.Orderbz = this.order.orderbz_end;
let temp_Orderbz = encodeURIComponent(this.order.Orderbz) ;
this.order.Orderbz = temp_Orderbz;
this.appService.ObserverHttpPost("/wisdomgroup/modules/order/create", this.order) this.appService.ObserverHttpPost("/wisdomgroup/modules/order/create", this.order)
.subscribe((res: Response) => { .subscribe((res: Response) => {
...@@ -269,36 +182,12 @@ export class ActivityApplyPage { ...@@ -269,36 +182,12 @@ export class ActivityApplyPage {
); );
} }
//重选批次
changeOrderInfo(orderId) {
console.log('更新操作');
this.order.Orderbz = this.order.orderbz_end;
let temp_Orderbz = encodeURIComponent(this.order.Orderbz) ;
this.order.Orderbz = temp_Orderbz;
this.appService.ObserverHttpPost("/wisdomgroup/modules/order/reelectBatchForOrder", this.order)
.subscribe((res: Response) => {
if (true) {
this.isSuccess = true;
setTimeout(() => {
console.log("修改订单信息成功");
this.isSuccess = false;
this.navCtrl.push("MyActivityListPage");
}, 1000);
} else {
}
}, error => {
this.appService.alert('网络异常!');
}
);
}
doRefresh(refresher) { doRefresh(refresher) {
console.log('Begin async operation', refresher); console.log('Begin async operation', refresher);
setTimeout(() => { setTimeout(() => {
this.ngOnInit(); this.ionViewDidEnter();
console.log('Async operation has ended'); console.log('Async operation has ended');
refresher.complete(); refresher.complete();
}, 2000); }, 2000);
...@@ -306,19 +195,17 @@ export class ActivityApplyPage { ...@@ -306,19 +195,17 @@ export class ActivityApplyPage {
submitOrder(){ submitOrder(){
console.log('报名操作'); console.log('报名操作');
this.order.Orderbz = this.order.orderbz_end; // this.order.Orderbz = this.order.orderbz_end;
this.order.Batchid = this.item.id;
this.order.Activityid = this.item.activityId;
let temp_Orderbz = encodeURIComponent(this.order.Orderbz) ; let temp_Orderbz = encodeURIComponent(this.order.Orderbz) ;
this.order.Orderbz = temp_Orderbz; this.order.Orderbz = temp_Orderbz;
this.appService.ObserverHttpPost("/wisdomgroup/modules/order/create", this.order) this.appService.ObserverHttpPost("/wisdomgroup/modules/order/create", this.order)
.subscribe((res: Response) => { .subscribe((res: Response) => {
if (true) { if (true) {
this.isSuccess = true; this.isSuccess = true;
setTimeout(() => { setTimeout(() => {
console.log("报名成功"); this.navCtrl.setRoot("MyActivityListPage");
this.isSuccess = false;
//this.navCtrl.setRoot("MyActivityListPage");
this.navCtrl.push("MyActivityListPage"); this.navCtrl.push("MyActivityListPage");
}, 1000); }, 1000);
} else { } else {
...@@ -328,10 +215,6 @@ export class ActivityApplyPage { ...@@ -328,10 +215,6 @@ export class ActivityApplyPage {
this.appService.alert('网络异常!'); this.appService.alert('网络异常!');
} }
); );
// this.navCtrl.push('ActivityConfirmPage',{
// order:this.order,
// activity:this.activity
// });
} }
} }
...@@ -67,6 +67,7 @@ export class ActivityDetailPage { ...@@ -67,6 +67,7 @@ export class ActivityDetailPage {
//批次详情 //批次详情
goBatchDetail(item){ goBatchDetail(item){
console.log(this.activity);
this.navCtrl.push('BatchDetailPage',{batch:item,activity:this.activity}); this.navCtrl.push('BatchDetailPage',{batch:item,activity:this.activity});
} }
......
...@@ -80,7 +80,11 @@ export class BatchDetailPage { ...@@ -80,7 +80,11 @@ export class BatchDetailPage {
} }
goApply(){ goApply(){
this.navCtrl.push('ActivityApplyPage',{activity:this.activity}); console.log(this.activity);
this.navCtrl.push('ActivityApplyPage',{
activity:this.activity,
item:this.batch
});
} }
//取消报名(订单) //取消报名(订单)
......
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