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 8126a9b..0cb7436 100644 --- a/src/app/admin/activate/activate-edit/activate-edit.component.html +++ b/src/app/admin/activate/activate-edit/activate-edit.component.html @@ -90,9 +90,7 @@ - Action 一 {{ data.name }} - - Delete + 删除 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 dd309eb..0d27102 100644 --- a/src/app/admin/activate/activate-edit/activate-edit.component.scss +++ b/src/app/admin/activate/activate-edit/activate-edit.component.scss @@ -60,3 +60,7 @@ background-color: #f3f9ff; margin-bottom: 20px; } +.head_img { + height: 60px; + width: 60px; +} 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 771aba4..bc0ff24 100644 --- a/src/app/admin/activate/activate-edit/activate-edit.component.ts +++ b/src/app/admin/activate/activate-edit/activate-edit.component.ts @@ -6,9 +6,7 @@ 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"; +import {AgentService} from '../../../services/agent.service'; function getBase64(file: File): Promise { return new Promise((resolve, reject) => { @@ -35,7 +33,7 @@ export class ActivateEditComponent implements OnInit { listOfOption: string[] = []; listOfData = []; agentData = []; - current = 1; + current = 0; listOfControl = [{ isEdit: true, agentId: null, @@ -192,6 +190,8 @@ export class ActivateEditComponent implements OnInit { } this.activate.editActivityInfo(this.validateForm.value, data => { if (data['return_code'] === '000000') { + this.editFlag = true; + this.id = data['return_data'].id; this.current += 1; this.message.success('编辑成功'); } else { @@ -212,6 +212,18 @@ export class ActivateEditComponent implements OnInit { this.message.create('error', data['return_msg']); } }); + this.getListByActivityId(id); + + } + + getListByActivityId(id: number ) { + this.activate.getListByActivityId(id , data => { + if (data['return_code'] === '000000') { + this.listOfData = data['return_data']; + } else { + this.message.create('error', data['return_msg']); + } + }); } // 上一步 @@ -224,7 +236,7 @@ export class ActivateEditComponent implements OnInit { if (this.current === 0) { this.editActivityInfo(); } else { - + history.back(); } } @@ -297,7 +309,7 @@ export class ActivateEditComponent implements OnInit { } this.validateFormAward.value.activityPrizes = this.listOfControl; - this.validateFormAward.value.activityInfoId = 7; + this.validateFormAward.value.activityInfoId = this.id; if (this.logoFile.length !== 0) { if (this.logoFile[0]['response'] != null) { this.validateFormAward.value.img = this.logoFile[0]['response']['return_data'][0]; @@ -305,10 +317,11 @@ export class ActivateEditComponent implements OnInit { this.validateFormAward.value.img = this.logoFile[0].name; } } - console.log(this.validateFormAward.value); + this.message.loading('生成奖品中!'); this.activate.editActivityAward(this.validateFormAward.value , data => { - console.log(data); if (data['return_code'] === '000000') { + this.isVisible = false; + this.getListByActivityId(this.id); this.message.success('编辑成功'); } else { this.message.create('error', '编辑失败'); @@ -321,4 +334,15 @@ export class ActivateEditComponent implements OnInit { this.isVisible = false; } + + deleteActivateAward(id: number) { + this.activate.deleteActivateAward(id , data => { + if (data['return_code'] === '000000') { + this.getListByActivityId(this.id); + this.message.success('成功'); + } else { + this.message.create('error', '编辑失败'); + } + }); + } } diff --git a/src/app/admin/activate/activate-list/activate-list.component.html b/src/app/admin/activate/activate-list/activate-list.component.html index 3af4252..70a1d71 100644 --- a/src/app/admin/activate/activate-list/activate-list.component.html +++ b/src/app/admin/activate/activate-list/activate-list.component.html @@ -89,7 +89,7 @@ {{data.createTime | date: 'yyyy-MM-dd HH:mm'}} {{data.status | status}} - 编辑 + 编辑 发布 结束 更多操作 diff --git a/src/app/admin/activate/activate-lottery-record/activate-lottery-record.component.html b/src/app/admin/activate/activate-lottery-record/activate-lottery-record.component.html index 9a288e8..ed37e42 100644 --- a/src/app/admin/activate/activate-lottery-record/activate-lottery-record.component.html +++ b/src/app/admin/activate/activate-lottery-record/activate-lottery-record.component.html @@ -3,6 +3,8 @@ + +
@@ -34,6 +36,17 @@
+
+
+ +

{{item.name}}

+

总数:{{item.num}}

+

剩余数量:{{item.ext3}}

+
+
+ +
+
共计 {{dataObject.total?dataObject.total:0}} 条数据 @@ -70,3 +83,17 @@
+ + + +
+
+ + 新增数量 + + + + +
+
+
\ No newline at end of file diff --git a/src/app/admin/activate/activate-lottery-record/activate-lottery-record.component.ts b/src/app/admin/activate/activate-lottery-record/activate-lottery-record.component.ts index 732d1ca..5cc0027 100644 --- a/src/app/admin/activate/activate-lottery-record/activate-lottery-record.component.ts +++ b/src/app/admin/activate/activate-lottery-record/activate-lottery-record.component.ts @@ -19,7 +19,10 @@ export class ActivateLotteryRecordComponent implements OnInit { pageNum: number; whereObject: any = {}; activityId; - + numData; + isVisible = false; + id; + num; constructor( private form: FormBuilder, private activate: ActivateService, @@ -39,10 +42,17 @@ export class ActivateLotteryRecordComponent implements OnInit { if (queryParams['activityId']) { this.activityId = queryParams['activityId']; this.requestData(1); + this.checkNumberPrizes(queryParams['activityId']); } }); } + checkNumberPrizes(id: number) { + this.activate.checkNumberPrizes(id , data => { + this.numData = data['return_data']; + }); + } + /** * 请求数据 */ @@ -77,4 +87,34 @@ export class ActivateLotteryRecordComponent implements OnInit { this.searchForm.reset(); } + getAdd(id: number) { + this.id = id; + this.isVisible = true; + + } + + handleOk(): void { + if (this.num == null) { + this.message.error('请输入新增数量!'); + return; + } + let post = { + activityAwardId: this.id , + num: this.num + } + this.activate.numberOfNewRewards(post , data => { + if (data['return_code'] === '000000') { + this.isVisible = false; + this.message.success('成功'); + } else { + this.message.create('error', '编辑失败'); + } + }); + + } + + handleCancel(): void { + this.isVisible = false; + } + } diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 9fc905c..1244631 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -100,7 +100,7 @@ const routes: Routes = [ imports: [RouterModule.forRoot(routes)], exports: [RouterModule], providers: [ - { provide: RouteReuseStrategy, useClass: RouteStrategyService } + // { provide: RouteReuseStrategy, useClass: RouteStrategyService } ], }) export class AppRoutingModule { diff --git a/src/app/services/activate.service.ts b/src/app/services/activate.service.ts index 0dd33ae..0cd135a 100644 --- a/src/app/services/activate.service.ts +++ b/src/app/services/activate.service.ts @@ -54,6 +54,19 @@ export class ActivateService { }); } + /** + * @params id + * @author sum1dream + * @description 根据id查询活动活动配置奖品 + * @date 2021/9/28 2:39 下午 + * @version: 1.0.0 + */ + public getListByActivityId(id: number, callBack) { + this.http.get(environment.baseUrl + 'activityAward/getListByActivityId?activityId=' + id).subscribe(data => { + callBack(data); + }); + } + /** * @Author Sum1Dream * @methodName getWinLotteryList @@ -101,4 +114,45 @@ export class ActivateService { callBack(data); }); } + + /** + * @params id + * @author sum1dream + * @description 删除 + * @date 2021/9/28 2:39 下午 + * @version: 1.0.0 + */ + public deleteActivateAward(id: number, callBack) { + this.http.get(environment.baseUrl + 'activityAward/deleteActivateAward?activityId=' + id).subscribe(data => { + callBack(data); + }); + } + + /** + * @params id + * @author sum1dream + * @description 查询剩余数量 + * @date 2021/9/28 2:39 下午 + * @version: 1.0.0 + */ + public checkNumberPrizes(id: number, callBack) { + this.http.get(environment.baseUrl + 'activityAward/checkNumberPrizes?activityId=' + id).subscribe(data => { + callBack(data); + }); + } + + /** + * @params params + * @author sum1dream + * @description 根据奖励id新增奖励数量 + * @date 2021/9/28 2:37 下午 + * @version: 1.0.0 + */ + public numberOfNewRewards(params: object, callBack) { + this.http.post(environment.baseUrl + 'activityAward/numberOfNewRewards', params).subscribe(data => { + callBack(data); + }); + } + + }