|
|
@ -8,7 +8,8 @@ import {CommonsService} from '../../../services/commons.service'; |
|
|
|
import {AgentService} from '../../../services/agent.service'; |
|
|
|
import {AgentService} from '../../../services/agent.service'; |
|
|
|
import {DiscountService} from '../../../services/discount.service'; |
|
|
|
import {DiscountService} from '../../../services/discount.service'; |
|
|
|
import {CouponService} from '../../../services/coupon.service'; |
|
|
|
import {CouponService} from '../../../services/coupon.service'; |
|
|
|
import {ClipboardService} from "ngx-clipboard"; |
|
|
|
import {ClipboardService} from 'ngx-clipboard'; |
|
|
|
|
|
|
|
import {AuditService} from '../../../services/audit.service'; |
|
|
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
@Component({ |
|
|
|
selector: 'app-agent-list', |
|
|
|
selector: 'app-agent-list', |
|
|
@ -24,6 +25,7 @@ export class AgentListComponent implements OnInit { |
|
|
|
validateFormDistribute: FormGroup; // 搜索框
|
|
|
|
validateFormDistribute: FormGroup; // 搜索框
|
|
|
|
requestData = []; // 列表数据
|
|
|
|
requestData = []; // 列表数据
|
|
|
|
discountList = []; // 列表数据
|
|
|
|
discountList = []; // 列表数据
|
|
|
|
|
|
|
|
couponList = []; // 列表数据
|
|
|
|
distributeList = []; // 列表数据
|
|
|
|
distributeList = []; // 列表数据
|
|
|
|
total: number; // 页码
|
|
|
|
total: number; // 页码
|
|
|
|
pageNum = 1; // 页码
|
|
|
|
pageNum = 1; // 页码
|
|
|
@ -53,6 +55,7 @@ export class AgentListComponent implements OnInit { |
|
|
|
constructor( |
|
|
|
constructor( |
|
|
|
private form: FormBuilder, |
|
|
|
private form: FormBuilder, |
|
|
|
private agent: AgentService, |
|
|
|
private agent: AgentService, |
|
|
|
|
|
|
|
private audit: AuditService, |
|
|
|
private discount: DiscountService, |
|
|
|
private discount: DiscountService, |
|
|
|
private coupon: CouponService, |
|
|
|
private coupon: CouponService, |
|
|
|
private iconService: IconService, |
|
|
|
private iconService: IconService, |
|
|
@ -84,6 +87,14 @@ export class AgentListComponent implements OnInit { |
|
|
|
stockCount: [null, [Validators.required]], |
|
|
|
stockCount: [null, [Validators.required]], |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.getRequest(true, this.searchForm.value); |
|
|
|
this.getRequest(true, this.searchForm.value); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.coupon.getCouponListByAll({} , data => { |
|
|
|
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
|
|
|
this.couponList = data['return_data']; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.message.error(data['return_msg']); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 查询列表
|
|
|
|
// 查询列表
|
|
|
@ -226,6 +237,42 @@ export class AgentListComponent implements OnInit { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 提交分发审批
|
|
|
|
|
|
|
|
public addApprove(): void { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// tslint:disable-next-line:forin
|
|
|
|
|
|
|
|
for (const i in this.validateFormDistribute.controls) { |
|
|
|
|
|
|
|
this.validateFormDistribute.controls[i].markAsDirty(); |
|
|
|
|
|
|
|
this.validateFormDistribute.controls[i].updateValueAndValidity(); |
|
|
|
|
|
|
|
if (this.validateFormDistribute.controls[i].errors != null) { |
|
|
|
|
|
|
|
this.message.error('必填项不能为空'); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.isOkLoading = true; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.validateFormDistribute.value['agentName'] = this.requestData.find(data => data.id = this.agentId).agentName; |
|
|
|
|
|
|
|
this.validateFormDistribute.value['couponName'] = this.couponList.find(data => data.id = this.validateFormDistribute.value['couponId']).couponName; |
|
|
|
|
|
|
|
this.validateFormDistribute.value['agentId'] = this.agentId; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const whereObject = { |
|
|
|
|
|
|
|
objectType: 3, |
|
|
|
|
|
|
|
approveObject: this.validateFormDistribute.value, |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.audit.addApprove(whereObject , data => { |
|
|
|
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
|
|
|
this.validateFormDistribute.reset(); |
|
|
|
|
|
|
|
this.message.success('提交成功'); |
|
|
|
|
|
|
|
this.isVisibleDistribute = false; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.message.error(data['return_msg']); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.isOkLoading = false; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 分发卡券
|
|
|
|
// 分发卡券
|
|
|
|
public getDistribution(id: number): void { |
|
|
|
public getDistribution(id: number): void { |
|
|
|
this.isSpinningDistribute = true; |
|
|
|
this.isSpinningDistribute = true; |
|
|
|