|
@@ -1,36 +1,41 @@
|
|
|
import { Component, OnInit } from '@angular/core';
|
|
|
-import { IonicModule } from '@ionic/angular';
|
|
|
+import { IonicModule, ModalController } from '@ionic/angular';
|
|
|
import { NavComponent } from '../../../app/components/nav/nav.component';
|
|
|
+import { FormsModule } from '@angular/forms';
|
|
|
import * as Parse from 'parse';
|
|
|
import { AuthService } from '../../../services/auth.service';
|
|
|
-import { DatePipe } from '@angular/common';
|
|
|
+import { DatePipe,CommonModule } from '@angular/common';
|
|
|
+import { AgreementComponent } from '../../login/agreement/agreement.component';
|
|
|
|
|
|
@Component({
|
|
|
selector: 'app-vip',
|
|
|
templateUrl: './vip.component.html',
|
|
|
styleUrls: ['./vip.component.scss'],
|
|
|
standalone: true,
|
|
|
- imports: [IonicModule, NavComponent],
|
|
|
+ imports: [IonicModule, NavComponent, CommonModule,FormsModule],
|
|
|
providers: [DatePipe],
|
|
|
})
|
|
|
export class VipComponent implements OnInit {
|
|
|
user: any = Parse.User.current();
|
|
|
- vips: Array<Parse.Object> = [];
|
|
|
profile?: Parse.Object;
|
|
|
- account?: Parse.Object;
|
|
|
+ goodsList: Array<Parse.Object> = [];
|
|
|
myVip: any;
|
|
|
+ registerAgreement: any;
|
|
|
+ isCheck:boolean = false;
|
|
|
currentGoods?: Parse.Object; //当前选择的会员
|
|
|
- tips: Array<string> = [
|
|
|
- ' :会员承诺书本人自愿参加“心上人”线上高端单身俱乐部活动。遵守言责自负、文责自负的原则,另本人自愿做出如下承诺:一、严格遵守国家法律法规,遵守社会公德,承诺本人无违法犯罪行为。若有隐瞒,后果自负。二、恪守诚信,保证我所提供的报名内容真实、准确、无欺诈成份。否则,愿意接受法律的制裁。',
|
|
|
- ];
|
|
|
- constructor(private authSer: AuthService, private datePipe: DatePipe) {}
|
|
|
+ constructor(
|
|
|
+ private modalController: ModalController,
|
|
|
+ private authSer: AuthService,
|
|
|
+ private datePipe: DatePipe
|
|
|
+ ) {}
|
|
|
|
|
|
ngOnInit() {
|
|
|
- this.refresh()
|
|
|
+ this.refresh();
|
|
|
}
|
|
|
refresh() {
|
|
|
this.getGoods();
|
|
|
this.getUserVip();
|
|
|
+ this.getAgreement();
|
|
|
}
|
|
|
//获取当前VIP等级
|
|
|
async getUserVip() {
|
|
@@ -58,18 +63,38 @@ export class VipComponent implements OnInit {
|
|
|
goods.equalTo('type', 'vip');
|
|
|
goods.equalTo('status', true);
|
|
|
goods.ascending('top');
|
|
|
- let res = await goods.find();
|
|
|
- this.vips = res;
|
|
|
- this.currentGoods = this.vips[0];
|
|
|
+ goods.notEqualTo('isDeleted', true);
|
|
|
+ goods.include('services');
|
|
|
+ this.goodsList = await goods.find();
|
|
|
+ this.currentGoods = this.goodsList[0];
|
|
|
}
|
|
|
- //获取用户账户信息
|
|
|
- async getAccount() {
|
|
|
- let queryAccount = new Parse.Query('Account');
|
|
|
- queryAccount.equalTo('user', Parse.User.current()?.id);
|
|
|
- let res = await queryAccount.first();
|
|
|
- this.account = res;
|
|
|
+ getAgreement() {
|
|
|
+ let Agreement = new Parse.Query('ContractAgreement');
|
|
|
+ Agreement.equalTo('company', this.authSer.company);
|
|
|
+ Agreement.equalTo('type', 'register');
|
|
|
+ Agreement.first().then((res) => {
|
|
|
+ console.log(res);
|
|
|
+ this.registerAgreement = res;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ async showAgreement() {
|
|
|
+ const modal = await this.modalController.create({
|
|
|
+ component: AgreementComponent,
|
|
|
+ cssClass: 'my-custom-class',
|
|
|
+ componentProps: {
|
|
|
+ agreement: this.registerAgreement,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ return await modal.present();
|
|
|
}
|
|
|
onchang(data: Parse.Object) {
|
|
|
this.currentGoods = data;
|
|
|
}
|
|
|
+ openpay(){
|
|
|
+ if(this.isCheck){
|
|
|
+ // this.authSer.openPay(this.currentGoods);
|
|
|
+ }else{
|
|
|
+ this.showAgreement();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|