pull/1/head
袁野 3 years ago
parent c433775d67
commit f681f5d881
  1. 4
      src/app/admin/activate/activate-edit/activate-edit.component.html
  2. 4
      src/app/admin/activate/activate-edit/activate-edit.component.scss
  3. 40
      src/app/admin/activate/activate-edit/activate-edit.component.ts
  4. 2
      src/app/admin/activate/activate-list/activate-list.component.html
  5. 27
      src/app/admin/activate/activate-lottery-record/activate-lottery-record.component.html
  6. 42
      src/app/admin/activate/activate-lottery-record/activate-lottery-record.component.ts
  7. 2
      src/app/app-routing.module.ts
  8. 54
      src/app/services/activate.service.ts

@ -90,9 +90,7 @@
<img class="head_img" src="{{FILE_URL + data.img}}" onerror="this.src='../../../../assets/admin/navigation/icon.png'" alt=""> <img class="head_img" src="{{FILE_URL + data.img}}" onerror="this.src='../../../../assets/admin/navigation/icon.png'" alt="">
</td> </td>
<td> <td>
<a>Action 一 {{ data.name }}</a> <a (click)="deleteActivateAward(data.id)">删除</a>
<nz-divider nzType="vertical"></nz-divider>
<a>Delete</a>
</td> </td>
</tr> </tr>
</tbody> </tbody>

@ -60,3 +60,7 @@
background-color: #f3f9ff; background-color: #f3f9ff;
margin-bottom: 20px; margin-bottom: 20px;
} }
.head_img {
height: 60px;
width: 60px;
}

@ -6,9 +6,7 @@ import {CouponService} from '../../../services/coupon.service';
import {ActivateService} from '../../../services/activate.service'; import {ActivateService} from '../../../services/activate.service';
import {NzUploadFile} from 'ng-zorro-antd'; import {NzUploadFile} from 'ng-zorro-antd';
import {environment} from '../../../../environments/environment'; import {environment} from '../../../../environments/environment';
import {Observable, Observer} from 'rxjs'; import {AgentService} from '../../../services/agent.service';
import {AgentService} from "../../../services/agent.service";
import {DiscountService} from "../../../services/discount.service";
function getBase64(file: File): Promise<string | ArrayBuffer | null> { function getBase64(file: File): Promise<string | ArrayBuffer | null> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@ -35,7 +33,7 @@ export class ActivateEditComponent implements OnInit {
listOfOption: string[] = []; listOfOption: string[] = [];
listOfData = []; listOfData = [];
agentData = []; agentData = [];
current = 1; current = 0;
listOfControl = [{ listOfControl = [{
isEdit: true, isEdit: true,
agentId: null, agentId: null,
@ -192,6 +190,8 @@ export class ActivateEditComponent implements OnInit {
} }
this.activate.editActivityInfo(this.validateForm.value, data => { this.activate.editActivityInfo(this.validateForm.value, data => {
if (data['return_code'] === '000000') { if (data['return_code'] === '000000') {
this.editFlag = true;
this.id = data['return_data'].id;
this.current += 1; this.current += 1;
this.message.success('编辑成功'); this.message.success('编辑成功');
} else { } else {
@ -212,6 +212,18 @@ export class ActivateEditComponent implements OnInit {
this.message.create('error', data['return_msg']); 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) { if (this.current === 0) {
this.editActivityInfo(); this.editActivityInfo();
} else { } else {
history.back();
} }
} }
@ -297,7 +309,7 @@ export class ActivateEditComponent implements OnInit {
} }
this.validateFormAward.value.activityPrizes = this.listOfControl; 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.length !== 0) {
if (this.logoFile[0]['response'] != null) { if (this.logoFile[0]['response'] != null) {
this.validateFormAward.value.img = this.logoFile[0]['response']['return_data'][0]; 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; this.validateFormAward.value.img = this.logoFile[0].name;
} }
} }
console.log(this.validateFormAward.value); this.message.loading('生成奖品中!');
this.activate.editActivityAward(this.validateFormAward.value , data => { this.activate.editActivityAward(this.validateFormAward.value , data => {
console.log(data);
if (data['return_code'] === '000000') { if (data['return_code'] === '000000') {
this.isVisible = false;
this.getListByActivityId(this.id);
this.message.success('编辑成功'); this.message.success('编辑成功');
} else { } else {
this.message.create('error', '编辑失败'); this.message.create('error', '编辑失败');
@ -321,4 +334,15 @@ export class ActivateEditComponent implements OnInit {
this.isVisible = false; 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', '编辑失败');
}
});
}
} }

@ -89,7 +89,7 @@
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td> <td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td nzRight>{{data.status | status}}</td> <td nzRight>{{data.status | status}}</td>
<td nzRight class="table-td-operation"> <td nzRight class="table-td-operation">
<a *ngIf="data.status != 3" (click)="getEdit(data.id)">编辑</a> <a *ngIf="data.status == 1" (click)="getEdit(data.id)">编辑</a>
<a (click)="startActivity(data.id)" *ngIf="data.status == 1">发布</a> <a (click)="startActivity(data.id)" *ngIf="data.status == 1">发布</a>
<a (click)="endActivity(data.id)" *ngIf="data.status == 2">结束</a> <a (click)="endActivity(data.id)" *ngIf="data.status == 2">结束</a>
<a nz-dropdown [nzDropdownMenu]="menu">更多操作<i nz-icon nzType="down"></i></a> <a nz-dropdown [nzDropdownMenu]="menu">更多操作<i nz-icon nzType="down"></i></a>

@ -3,6 +3,8 @@
<!-- end 面包屑 --> <!-- end 面包屑 -->
<!--条件搜索--> <!--条件搜索-->
<div class="inner-content"> <div class="inner-content">
<form nz-form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)"> <form nz-form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)">
<div nz-row> <div nz-row>
@ -34,6 +36,17 @@
</form> </form>
</div> </div>
<div class="inner-content" nz-row>
<div style="margin-top: 20px;" nz-col nzSpan="6" *ngFor="let item of numData" (click)="getAdd(item.id)">
<nz-card nzHoverable style="width:240px">
<P>{{item.name}}</P>
<P>总数:{{item.num}}</P>
<P>剩余数量:{{item.ext3}}</P>
</nz-card>
</div>
</div>
<div class="inner-content"> <div class="inner-content">
<span>共计 {{dataObject.total?dataObject.total:0}} 条数据</span> <span>共计 {{dataObject.total?dataObject.total:0}} 条数据</span>
@ -70,3 +83,17 @@
</tbody> </tbody>
</nz-table> </nz-table>
</div> </div>
<nz-modal [(nzVisible)]="isVisible" nzTitle="新增数量" (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()">
<div nz-row>
<div nz-col nzSpan="20">
<nz-form-item>
<nz-form-label [nzSpan]="6">新增数量</nz-form-label>
<nz-form-control [nzSpan]="16">
<input nz-input [(ngModel)]="num"/>
</nz-form-control>
</nz-form-item>
</div>
</div>
</nz-modal>

@ -19,7 +19,10 @@ export class ActivateLotteryRecordComponent implements OnInit {
pageNum: number; pageNum: number;
whereObject: any = {}; whereObject: any = {};
activityId; activityId;
numData;
isVisible = false;
id;
num;
constructor( constructor(
private form: FormBuilder, private form: FormBuilder,
private activate: ActivateService, private activate: ActivateService,
@ -39,10 +42,17 @@ export class ActivateLotteryRecordComponent implements OnInit {
if (queryParams['activityId']) { if (queryParams['activityId']) {
this.activityId = queryParams['activityId']; this.activityId = queryParams['activityId'];
this.requestData(1); 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(); 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;
}
} }

@ -100,7 +100,7 @@ const routes: Routes = [
imports: [RouterModule.forRoot(routes)], imports: [RouterModule.forRoot(routes)],
exports: [RouterModule], exports: [RouterModule],
providers: [ providers: [
{ provide: RouteReuseStrategy, useClass: RouteStrategyService } // { provide: RouteReuseStrategy, useClass: RouteStrategyService }
], ],
}) })
export class AppRoutingModule { export class AppRoutingModule {

@ -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 * @Author Sum1Dream
* @methodName getWinLotteryList * @methodName getWinLotteryList
@ -101,4 +114,45 @@ export class ActivateService {
callBack(data); 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);
});
}
} }

Loading…
Cancel
Save