|
|
|
@ -1,6 +1,6 @@ |
|
|
|
|
import { Component, OnInit } from '@angular/core'; |
|
|
|
|
import {environment} from '../../../../environments/environment'; |
|
|
|
|
import {FormBuilder, FormGroup} from '@angular/forms'; |
|
|
|
|
import {FormBuilder, FormGroup, Validators} from '@angular/forms'; |
|
|
|
|
import {IconService} from '../../../services/icon.service'; |
|
|
|
|
import {NzMessageService} from 'ng-zorro-antd'; |
|
|
|
|
import {AgentService} from '../../../services/agent.service'; |
|
|
|
@ -15,6 +15,7 @@ import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; |
|
|
|
|
export class OrderCouponsComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
searchForm: FormGroup; // 搜索框
|
|
|
|
|
validateFormPost: FormGroup; // 搜索框
|
|
|
|
|
requestData = []; // 列表数据
|
|
|
|
|
total: number; // 页码
|
|
|
|
|
pageNum = 1; // 页码
|
|
|
|
@ -27,7 +28,9 @@ export class OrderCouponsComponent implements OnInit { |
|
|
|
|
pageSizeCode = 10; // 条码
|
|
|
|
|
loadingCode = true; |
|
|
|
|
isVisible = false; |
|
|
|
|
isVisibleS = false; |
|
|
|
|
id: number; |
|
|
|
|
loadingS = false; |
|
|
|
|
constructor( |
|
|
|
|
private form: FormBuilder, |
|
|
|
|
private agent: AgentService, |
|
|
|
@ -45,6 +48,11 @@ export class OrderCouponsComponent implements OnInit { |
|
|
|
|
this.searchForm = this.form.group({ |
|
|
|
|
status: [null], |
|
|
|
|
}); |
|
|
|
|
this.validateFormPost = this.form.group({ |
|
|
|
|
status: [null, [Validators.required]], |
|
|
|
|
minNumber: [null, [Validators.required]], |
|
|
|
|
maxNumber: [null, [Validators.required]], |
|
|
|
|
}); |
|
|
|
|
this.getRequest(true, {}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -99,12 +107,44 @@ export class OrderCouponsComponent implements OnInit { |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
handleOk(): void { |
|
|
|
|
this.isVisible = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
handleCancel(): void { |
|
|
|
|
this.searchForm.reset(); |
|
|
|
|
this.isVisible = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
handleCancelS(): void { |
|
|
|
|
this.isVisibleS = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getEditStatus() { |
|
|
|
|
this.isVisibleS = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
handleOk(): void { |
|
|
|
|
// tslint:disable-next-line:forin
|
|
|
|
|
for (const i in this.validateFormPost.controls) { |
|
|
|
|
this.validateFormPost.controls[i].markAsDirty(); |
|
|
|
|
this.validateFormPost.controls[i].updateValueAndValidity(); |
|
|
|
|
if (this.validateFormPost.controls[i].errors != null) { |
|
|
|
|
this.message.error('必填项不能为空'); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
const id = this.message.loading('正在提交中', { nzDuration: 0 }).messageId; |
|
|
|
|
this.loadingS = true; |
|
|
|
|
this.agent.getDiscountStatus(this.validateFormPost.value , data => { |
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
this.isVisibleS = false; |
|
|
|
|
this.loadingS = false; |
|
|
|
|
this.getRequestCode(false , this.searchForm.value); |
|
|
|
|
this.message.remove(id); |
|
|
|
|
this.message.success('成功'); |
|
|
|
|
} else { |
|
|
|
|
this.message.error(data['return_msg']); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|