From 5315c6f9f4d32f073abfeb3162412135fcf3e942 Mon Sep 17 00:00:00 2001 From: yuanye Date: Thu, 30 Sep 2021 15:27:42 +0800 Subject: [PATCH] 1 --- .../activate-edit.component.html | 117 ++++++++++- .../activate-edit.component.scss | 66 ++++++- .../activate-edit/activate-edit.component.ts | 185 +++++++++++++++++- src/assets/images/post.png | Bin 0 -> 4937 bytes 4 files changed, 349 insertions(+), 19 deletions(-) create mode 100644 src/assets/images/post.png diff --git a/src/app/admin/activate/activate-edit/activate-edit.component.html b/src/app/admin/activate/activate-edit/activate-edit.component.html index 255950f..72c2b5d 100644 --- a/src/app/admin/activate/activate-edit/activate-edit.component.html +++ b/src/app/admin/activate/activate-edit/activate-edit.component.html @@ -34,7 +34,7 @@ formControlName="productIdArray" nzPlaceHolder="请选择有抽奖资格的产品" > - + @@ -67,10 +67,38 @@ -
-
+ +
+ 共计 {{11}} 条数据 +
+
- + + + + 奖励名称 + 数量 + 图片 + 操作 + + + + + {{ data.name }} + {{ data.num }} + + + + + Action 一 {{ data.name }} + + Delete + + + + + +
@@ -79,3 +107,84 @@
+ + + + +
基本信息
+ +
奖品信息
+
+
+
+ + 代理商 + + + + + {{control.agentName}} + + +
+
+ + 优惠券 + + + + + {{control.discountName}} + + +
+
+ + 奖励数量 + + + {{control.prizeNum}} + + +
+
+
+ +
+ +
+
+
diff --git a/src/app/admin/activate/activate-edit/activate-edit.component.scss b/src/app/admin/activate/activate-edit/activate-edit.component.scss index 60ffd9a..dd309eb 100644 --- a/src/app/admin/activate/activate-edit/activate-edit.component.scss +++ b/src/app/admin/activate/activate-edit/activate-edit.component.scss @@ -1,14 +1,62 @@ .main { width: 90%; margin-left: 5%; - .title { - width: 100%; - height: 46px; - line-height: 46px; - font-size: 16px; - text-align: center; - color: #1890ff; - background-color: #f3f9ff; - margin-bottom: 20px; + .idCard { + img { + width: 200px; + } + .userImg { + width: 90px; + } } + .post_p_l { + margin-left: 5% ; + } + .main_post_p { + font-size: 12px; + color: #999999; + margin-top: -10px; + } + .btn { + margin-top: 20px; + } + .bottom_solid { + border-bottom: 1px solid #e4e4e4; + } + .btn-post { + width: 20%; + margin-left: 40%; + margin-top: 40px; + } + +} +.pics{ + display: flex; + align-items: center; + +} +.pic{ + width:10rem; + height:8rem; + margin-right: 1rem; + position: relative; +} +.delPic{ + width:1rem !important; + height:1rem; + position: absolute; + right: -10px;top:-10px; +} +.btn { + margin-top: 20px; +} +.title { + width: 100%; + height: 46px; + line-height: 46px; + font-size: 16px; + text-align: center; + color: #1890ff; + background-color: #f3f9ff; + margin-bottom: 20px; } diff --git a/src/app/admin/activate/activate-edit/activate-edit.component.ts b/src/app/admin/activate/activate-edit/activate-edit.component.ts index cbb0809..7f0a115 100644 --- a/src/app/admin/activate/activate-edit/activate-edit.component.ts +++ b/src/app/admin/activate/activate-edit/activate-edit.component.ts @@ -4,6 +4,20 @@ import {NzMessageService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; import {ActivatedRoute} from '_@angular_router@9.0.7@@angular/router'; import {CouponService} from '../../../services/coupon.service'; import {ActivateService} from '../../../services/activate.service'; +import {NzUploadFile} from 'ng-zorro-antd'; +import {environment} from '../../../../environments/environment'; +import {Observable, Observer} from 'rxjs'; +import {AgentService} from "../../../services/agent.service"; +import {DiscountService} from "../../../services/discount.service"; + +function getBase64(file: File): Promise { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.readAsDataURL(file); + reader.onload = () => resolve(reader.result); + reader.onerror = error => reject(error); + }); +} @Component({ selector: 'app-activate-edit', @@ -17,14 +31,36 @@ export class ActivateEditComponent implements OnInit { data: any; editFlag = false; id: number; + agentId: number; listOfOption: string[] = []; - current = 0; + listOfData = []; + agentData = []; + current = 1; + listOfControl = [{ + isEdit: true, + agentId: null, + agentName: null, + prizeNum: null, + prizeId: null, + discountName: null, + loading : false + }]; + FILE_URL = environment.imageUrl; + POST_URL = environment.baseUrl; + isVisible = false; + logoFile = []; + previewImage: string | undefined = ''; + previewVisible = false; + discountList = []; // 列表数据 constructor( private fb: FormBuilder, private coupon: CouponService, private activate: ActivateService, private message: NzMessageService, // 信息提示 private activatedRoute: ActivatedRoute, + private agent: AgentService, + private discount: DiscountService, + private msg: NzMessageService, ) { } ngOnInit(): void { @@ -44,17 +80,31 @@ export class ActivateEditComponent implements OnInit { }); this.validateFormAward = this.fb.group({ - activityInfoId: [null, [Validators.required]], - img: [null, [Validators.required]], name: [null, [Validators.required]], + img: [null, [Validators.required]], num: [null, [Validators.required]], }); const whereObject = { pageNum: 1 , - pageSize: 200 , - status: 2 , + pageSize: 800 , + status: 2 }; + + const whereObjectA = { + pageNum: 1 , + pageSize: 800 , + type: 1 + }; + + this.getCouponList(whereObject); + this.getListAgent(whereObjectA); + + + } + + public getCouponList(whereObject) { + whereObject.status = 2; this.coupon.getCouponList(whereObject, data => { if (data['return_code'] === '000000') { this.listOfOption = data['return_data'].list; @@ -64,6 +114,52 @@ export class ActivateEditComponent implements OnInit { }); } + // 绑定优惠券 + public getDiscount(id: number , i ): void { + this.listOfControl[i].agentName = this.agentData.find(item => { + return item.id == id; + }).agentName; + this.agentId = id; + const whereObject = {}; + whereObject['pageNum'] = 1; + whereObject['pageSize'] = 10000; + whereObject['agentId'] = id; + this.agent.getDiscountAgentList(whereObject, data => { + if (data['return_code'] === '000000') { + this.discountList = data['return_data'].list; + } else { + this.message.error(data['return_msg']); + } + }); + } + + getDiscountName(id: number , i ) { + this.listOfControl[i].discountName = this.discountList.find(item => { + return item['highDiscount'].id == id; + })['highDiscount'].discountName; + console.log(this.listOfControl); + } + + public getListAgent(whereObject) { + this.agent.getListAgent(whereObject, data => { + if (data['return_code'] === '000000') { + this.agentData = data['return_data'].list; + } else { + this.message.error(data['return_msg']); + } + }); + } + + // 图片查看 + handlePreview = async (file: NzUploadFile) => { + if (!file.url && !file.preview) { + // tslint:disable-next-line:no-non-null-assertion + file.preview = await getBase64(file.originFileObj!); + } + this.previewImage = file.url || file.preview; + this.previewVisible = true; + } + // 返回 getBack() { history.back(); @@ -128,8 +224,10 @@ export class ActivateEditComponent implements OnInit { // 下一步 getNest(): void { - if (this.current === 1) { + if (this.current === 0) { this.editActivityInfo(); + } else { + } } @@ -140,4 +238,79 @@ export class ActivateEditComponent implements OnInit { } + // 新增 + addField(i): void { + if ( + this.listOfControl[i].prizeId == null || + this.listOfControl[i].prizeNum == null || + this.listOfControl[i].agentId == null + ) { + this.message.error('请填写必填项!'); + return; + } + this.listOfControl[i].isEdit = false; + const control = { + isEdit: true, + agentId: null, + agentName: null, + prizeNum: null, + prizeId: null, + discountName: null, + loading : false + }; + this.listOfControl.push(control); + + } + + // 删除资质 + removeField(i, e: MouseEvent): void { + e.preventDefault(); + if (this.listOfControl.length > 1) { + this.listOfControl.splice(i, 1); + this.listOfControl[i - 1].isEdit = true; + } + } + + + // 添加配置 + getAdd(): void { + this.isVisible = true; + } + + + handleOk(): void { + + // tslint:disable-next-line:forin + for (const i in this.validateFormAward.controls) { + this.validateFormAward.controls[i].markAsDirty(); + this.validateFormAward.controls[i].updateValueAndValidity(); + if (this.validateFormAward.controls[i].errors != null) { + this.message.error('必填项不能为空'); + return; + } + } + + if ( + this.listOfControl[this.listOfControl.length - 1].prizeId == null || + this.listOfControl[this.listOfControl.length - 1].prizeNum == null || + this.listOfControl[this.listOfControl.length - 1].agentId == null + ) { + this.message.error('请填写必填项!'); + return; + } + + this.validateForm.value.ruleArray = [{ + partakeMode: 1, + productType: 1 , + productIdArray: this.validateForm.value.productIdArray + }]; + + console.log(this.listOfControl); + + } + + handleCancel(): void { + this.isVisible = false; + } + } diff --git a/src/assets/images/post.png b/src/assets/images/post.png new file mode 100644 index 0000000000000000000000000000000000000000..fd650f625d4b37ca8bf27dcebbe6763a66d5de8c GIT binary patch literal 4937 zcmb7I`9G9z_a9@*AQ?-VtYZ{H8dwR74T<3b9>zrG5HWoqxk^&$QNXYUW z+8+3B0#6@wKk)AM+%5uv#9)?aQ^)I`zwReImL7?E%`70rV{#W&zzRnc%#nKj;9$`M zY14A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