提交赠券功能开发

pull/1/head
袁野 3 years ago
parent dd8e297741
commit d3ebf33fae
  1. 34
      src/app/admin/discount-package/discount-package-edit/discount-package-edit.component.html
  2. 176
      src/app/admin/discount-package/discount-package-edit/discount-package-edit.component.ts
  3. 27
      src/app/admin/discount-package/discount-package-list/discount-package-list.component.html
  4. 52
      src/app/admin/discount-package/discount-package-list/discount-package-list.component.ts
  5. 2
      src/app/admin/order/order-routing.module.ts
  6. 3
      src/app/admin/order/order.module.ts
  7. 103
      src/app/admin/order/package-record-list/package-record-list.component.html
  8. 0
      src/app/admin/order/package-record-list/package-record-list.component.scss
  9. 80
      src/app/admin/order/package-record-list/package-record-list.component.ts
  10. 107
      src/app/services/discount-package.service.ts

@ -26,10 +26,10 @@
</div> </div>
<div nz-col class="gutter-row" [nzSpan]="24"> <div nz-col class="gutter-row" [nzSpan]="24">
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="3" nzRequired>使用归属</nz-form-label> <nz-form-label [nzSpan]="3" >使用归属</nz-form-label>
<nz-form-control [nzSpan]="8" nzErrorTip="请选择使用归属"> <nz-form-control [nzSpan]="8" nzErrorTip="请选择使用归属">
<nz-select formControlName="usingAttribution" nzAllowClear nzPlaceHolder="选择使用归属类型"> <nz-select formControlName="usingAttribution" nzAllowClear nzPlaceHolder="选择使用归属类型">
<nz-option *ngFor="let item of usingAttribution" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> <nz-option *ngFor="let item of usingAttribution" [nzValue]="item.codeValue" nzLabel="{{item.codeName}}"></nz-option>
</nz-select> </nz-select>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
@ -39,13 +39,13 @@
<nz-form-label [nzSpan]="3" nzRequired>优惠券包类型</nz-form-label> <nz-form-label [nzSpan]="3" nzRequired>优惠券包类型</nz-form-label>
<nz-form-control [nzSpan]="8" nzErrorTip="请选择优惠券包类型"> <nz-form-control [nzSpan]="8" nzErrorTip="请选择优惠券包类型">
<nz-select nzShowSearch nzAllowClear formControlName="salesType" nzPlaceHolder="请选择优惠券包类型"> <nz-select nzShowSearch nzAllowClear formControlName="salesType" nzPlaceHolder="请选择优惠券包类型">
<nz-option nzLabel="售卖" nzValue="1"></nz-option> <nz-option nzLabel="售卖" [nzValue]="1"></nz-option>
<nz-option nzLabel="赠送" nzValue="2"></nz-option> <nz-option nzLabel="赠送" [nzValue]="2"></nz-option>
</nz-select> </nz-select>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</div> </div>
<div nz-col class="gutter-row" [nzSpan]="24" *ngIf="validateForm.value['salesType'] === '1'"> <div nz-col class="gutter-row" [nzSpan]="24" *ngIf="validateForm.value['salesType'] === 1">
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="3" nzRequired>售卖价格</nz-form-label> <nz-form-label [nzSpan]="3" nzRequired>售卖价格</nz-form-label>
<nz-form-control [nzSpan]="8" nzErrorTip="请输入售卖价格"> <nz-form-control [nzSpan]="8" nzErrorTip="请输入售卖价格">
@ -55,7 +55,7 @@
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</div> </div>
<div nz-col class="gutter-row" [nzSpan]="24" *ngIf="validateForm.value['salesType'] === '1'"> <div nz-col class="gutter-row" [nzSpan]="24" *ngIf="validateForm.value['salesType'] === 1">
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="3" nzRequired>限购数量</nz-form-label> <nz-form-label [nzSpan]="3" nzRequired>限购数量</nz-form-label>
<nz-form-control [nzSpan]="8" nzErrorTip="请输入限购数量"> <nz-form-control [nzSpan]="8" nzErrorTip="请输入限购数量">
@ -143,19 +143,15 @@
<nz-table #basicTable [nzData]="listOfData"> <nz-table #basicTable [nzData]="listOfData">
<thead> <thead>
<tr> <tr>
<th>奖励名称</th> <th>优惠券名称</th>
<th>数量</th> <th>数量</th>
<th>图片</th>
<th>操作</th> <th>操作</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let data of basicTable.data"> <tr *ngFor="let data of basicTable.data">
<td>{{ data.name }}</td> <td>{{ data.discountName }}</td>
<td>{{ data.num }}</td> <td>{{ data.num }}</td>
<td>
<img class="head_img" src="{{FILE_URL + data.img}}" onerror="this.src='../../../../assets/admin/navigation/icon.png'" alt="">
</td>
<td> <td>
<a (click)="deleteActivateAward(data.id)">删除</a> <a (click)="deleteActivateAward(data.id)">删除</a>
</td> </td>
@ -187,15 +183,17 @@
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>奖励名称</nz-form-label> <nz-form-label [nzSpan]="6" nzRequired>优惠券</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请输入奖励名称"> <nz-form-control [nzSpan]="16" nzErrorTip="请选择优惠券">
<input nz-input type="text" formControlName="name" placeholder="请输入奖励名称" /> <nz-select formControlName="discountId" (ngModelChange)="getDiscountPackageByList($event)" nzAllowClear nzPlaceHolder="请选择优惠券">
<nz-option *ngFor="let item of discountList" nzValue="{{item.id}}" nzLabel="{{item.discountName}}"></nz-option>
</nz-select>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>奖励数量</nz-form-label> <nz-form-label [nzSpan]="6" nzRequired>数量</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请输入奖励数量"> <nz-form-control [nzSpan]="16" nzErrorTip="请输入数量">
<input nz-input type="number" formControlName="num" placeholder="请输入奖励名称" /> <input nz-input type="number" formControlName="num" placeholder="请输入数量" />
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</form> </form>

@ -7,9 +7,9 @@ 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 {AgentService} from '../../../services/agent.service'; import {AgentService} from '../../../services/agent.service';
import {CommonsService} from "../../../services/commons.service"; import {CommonsService} from '../../../services/commons.service';
import {DiscountPackageService} from "../../../services/discount-package.service"; import {DiscountPackageService} from '../../../services/discount-package.service';
import {DiscountService} from "../../../services/discount.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) => {
@ -32,30 +32,16 @@ export class DiscountPackageEditComponent implements OnInit {
data: any; data: any;
editFlag = false; editFlag = false;
id: number; id: number;
agentId: number;
listOfOption: string[] = [];
listOfData = []; listOfData = [];
agentData = [];
usingAttribution = []; usingAttribution = [];
current = 0; current = 0;
listOfControl = [{
isEdit: true,
agentId: null,
agentName: null,
prizeNum: null,
prizeId: null,
prizeName: null,
loading : false
}];
FILE_URL = environment.imageUrl; FILE_URL = environment.imageUrl;
POST_URL = environment.baseUrl; POST_URL = environment.baseUrl;
isVisible = false; isVisible = false;
logoFile = [];
previewImage: string | undefined = ''; previewImage: string | undefined = '';
previewVisible = false; previewVisible = false;
discountList = []; // 列表数据 discountList = []; // 列表数据
usingScope = []; // 列表数据 usingScope = []; // 列表数据
listImg = []; listImg = [];
bannerImg = []; bannerImg = [];
detailsImg = []; detailsImg = [];
@ -89,42 +75,18 @@ export class DiscountPackageEditComponent implements OnInit {
}); });
this.validateForm = this.fb.group({ this.validateForm = this.fb.group({
title: [null, [Validators.required]], title: [null, [Validators.required]],
usingAttribution: [null, [Validators.required]], usingAttribution: [null],
salesType: [null, [Validators.required]], salesType: [null, [Validators.required]],
price: [null], price: [null],
purchaseNum: [null], purchaseNum: [null],
}); });
this.validateFormAward = this.fb.group({ this.validateFormAward = this.fb.group({
getDiscountId: [null, [Validators.required]], discountId: [null, [Validators.required]],
num: [null, [Validators.required]], num: [null, [Validators.required]],
useScope: [null, [Validators.required]], usingScope: [null, [Validators.required]],
}); });
const whereObject = {
pageNum: 1 ,
pageSize: 800 ,
status: 2
};
const whereObjectA = {
pageNum: 1 ,
pageSize: 800 ,
type: 1
};
this.getListAgent(whereObjectA);
}
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']);
}
});
} }
// 图片查看 // 图片查看
@ -169,10 +131,11 @@ export class DiscountPackageEditComponent implements OnInit {
if (data['return_code'] === '000000') { if (data['return_code'] === '000000') {
this.editFlag = true; this.editFlag = true;
this.id = data['return_data'].id; this.id = data['return_data'].id;
this.getListByActivityId(data['return_data'].id);
this.current += 1; this.current += 1;
this.message.success('编辑成功'); this.message.success('编辑成功');
} else { } else {
this.message.create('error', '编辑失败'); this.message.create('error', data['return_msg']);
} }
}); });
} else { } else {
@ -180,10 +143,11 @@ export class DiscountPackageEditComponent implements OnInit {
if (data['return_code'] === '000000') { if (data['return_code'] === '000000') {
this.editFlag = true; this.editFlag = true;
this.id = data['return_data'].id; this.id = data['return_data'].id;
this.getListByActivityId(data['return_data'].id);
this.current += 1; this.current += 1;
this.message.success('编辑成功'); this.message.success('编辑成功');
} else { } else {
this.message.create('error', '编辑失败'); this.message.create('error', data['return_msg']);
} }
}); });
} }
@ -195,7 +159,7 @@ export class DiscountPackageEditComponent implements OnInit {
if (this.listImg[0]['response'] != null) { if (this.listImg[0]['response'] != null) {
this.validateForm.value.listImg = this.listImg[0]['response']['return_data'][0]; this.validateForm.value.listImg = this.listImg[0]['response']['return_data'][0];
} else { } else {
this.validateForm.value.listImg= this.listImg[0].name; this.validateForm.value.listImg = this.listImg[0].name;
} }
} else { } else {
this.message.error('请上传列表图片'); this.message.error('请上传列表图片');
@ -236,22 +200,59 @@ export class DiscountPackageEditComponent implements OnInit {
// 查询详情 // 查询详情
public getDetails(id) { public getDetails(id) {
this.disCountPackage.getDiscountPackageList(id, data => { this.disCountPackage.getDiscountPackageById(id, data => {
if (data['return_code'] === '000000') { if (data['return_code'] === '000000') {
data['return_data'].time = [new Date(data['return_data']['startTime']), new Date(data['return_data']['endTime'])]; data['return_data']['usingAttribution'] = String(data['return_data']['usingAttribution']);
data['return_data'].type = String(data['return_data'].type); if (data['return_data']['listImg'] != null && data['return_data']['listImg'] !== '') {
data['return_data'].productIdArray = data['return_data'].ruleArray[0].productIdArray; const listImg = String(data['return_data']['listImg']);
const listImgArray = [];
listImgArray.push(
{
uid: 1,
name: listImg,
status: 'done',
url: environment.imageUrl + listImg
});
this.listImg = listImgArray;
}
if (data['return_data']['bannerImg'] != null && data['return_data']['bannerImg'] !== '') {
const bannerImg = data['return_data']['bannerImg'].split(',');
const bannerImgArray = [];
for (const i of bannerImg) {
bannerImgArray.push(
{
uid: i,
name: i,
status: 'done',
url: environment.imageUrl + i
});
}
this.bannerImg = bannerImgArray;
}
if (data['return_data']['detailsImg'] != null && data['return_data']['detailsImg'] !== '') {
const detailsImg = data['return_data']['detailsImg'].split(',');
const detailsImgArray = [];
for (const i of detailsImg) {
detailsImgArray.push(
{
uid: i,
name: i,
status: 'done',
url: environment.imageUrl + i
});
}
this.detailsImg = detailsImgArray;
}
this.validateForm.patchValue(data['return_data']); this.validateForm.patchValue(data['return_data']);
} else { } else {
this.message.create('error', data['return_msg']); this.message.create('error', data['return_msg']);
} }
}); });
this.getListByActivityId(id); this.getListByActivityId(id);
} }
getListByActivityId(id: number ) { getListByActivityId(id: number ) {
this.activate.getListByActivityId(id , data => { this.disCountPackage.getDiscountPackageRuleById(id , data => {
if (data['return_code'] === '000000') { if (data['return_code'] === '000000') {
this.listOfData = data['return_data']; this.listOfData = data['return_data'];
} else { } else {
@ -275,44 +276,6 @@ export class DiscountPackageEditComponent implements OnInit {
} }
// 完成
done(): void {
}
// 新增
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,
prizeName: 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 { getAdd(): void {
@ -331,33 +294,15 @@ export class DiscountPackageEditComponent implements OnInit {
return; return;
} }
} }
this.validateFormAward.value['discountPackageId'] = this.id;
if ( this.disCountPackage.insertCouponPackageRule(this.validateFormAward.value , data => {
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.validateFormAward.value.activityPrizes = this.listOfControl;
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];
} else {
this.validateFormAward.value.img = this.logoFile[0].name;
}
}
this.message.loading('生成奖品中!');
this.activate.editActivityAward(this.validateFormAward.value , data => {
if (data['return_code'] === '000000') { if (data['return_code'] === '000000') {
this.isVisible = false; this.isVisible = false;
this.getListByActivityId(this.id); this.getListByActivityId(this.id);
this.validateFormAward.reset();
this.message.success('编辑成功'); this.message.success('编辑成功');
} else { } else {
this.message.create('error', '编辑失败'); this.message.create('error', data['return_msg']);
} }
}); });
@ -369,12 +314,12 @@ export class DiscountPackageEditComponent implements OnInit {
deleteActivateAward(id: number) { deleteActivateAward(id: number) {
this.activate.deleteActivateAward(id , data => { this.disCountPackage.deleteDiscountPackageRule(id , data => {
if (data['return_code'] === '000000') { if (data['return_code'] === '000000') {
this.getListByActivityId(this.id); this.getListByActivityId(this.id);
this.message.success('成功'); this.message.success('成功');
} else { } else {
this.message.create('error', '编辑失败'); this.message.create('error', data['return_msg']);
} }
}); });
} }
@ -389,7 +334,6 @@ export class DiscountPackageEditComponent implements OnInit {
this.discount.getDiscountList(params , data => { this.discount.getDiscountList(params , data => {
this.discountList = data['return_data'].list; this.discountList = data['return_data'].list;
console.log(data);
}); });
} }
} }

@ -100,14 +100,33 @@
<td>{{data.createdTime | date: 'yyyy-MM-dd HH:mm'}}</td> <td>{{data.createdTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td nzRight>{{data.status | discountPackageStatus}}</td> <td nzRight>{{data.status | discountPackageStatus}}</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 == 2 || data.status == 3" (click)="getEdit(data.id)">编辑</a>
<nz-divider nzType="vertical"></nz-divider> <a (click)="getDetails(data.id)" *ngIf="data.status == 1">详情</a>
<a (click)="startActivity(data.id)" *ngIf="data.status == 2 || data.status == 3">上架</a> <nz-divider nzType="vertical" ></nz-divider>
<a (click)="endActivity(data.id)" *ngIf="data.status == 1">下架</a> <a (click)="upDiscountPackage(data.id)" *ngIf="data.status == 2 || data.status == 3">上架</a>
<a (click)="downDiscountPackage(data.id)" *ngIf="data.status == 1">下架</a>
<nz-divider *ngIf="data.status == 2 || data.status == 3" nzType="vertical"></nz-divider>
<a (click)="deleteDiscountPackage(data.id)" *ngIf="data.status == 2 || data.status == 3">删除</a>
</td> </td>
</tbody> </tbody>
</nz-table> </nz-table>
</div> </div>
<nz-modal [(nzVisible)]="isVisible" nzTitle="优惠券包规则内容" (nzOnCancel)="handleCancel()" (nzOnOk)="handleCancel()">
<nz-table #basicTable [nzData]="listOfData">
<thead>
<tr>
<th>优惠券名称</th>
<th>数量</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data">
<td>{{ data.discountName }}</td>
<td>{{ data.num }}</td>
</tr>
</tbody>
</nz-table>
</nz-modal>

@ -24,6 +24,8 @@ export class DiscountPackageListComponent implements OnInit {
pageNum = 1; // 页码 pageNum = 1; // 页码
pageSize = 10; // 条码 pageSize = 10; // 条码
loading = true; loading = true;
listOfData = [];
isVisible = false;
constructor( constructor(
private form: FormBuilder, private form: FormBuilder,
@ -46,7 +48,8 @@ export class DiscountPackageListComponent implements OnInit {
title: [null], title: [null],
salesType: [null], salesType: [null],
usingAttribution: [null], usingAttribution: [null],
status: [null], recordNo: [null],
phone: [null],
}); });
this.getRequest(true, this.searchForm.value); this.getRequest(true, this.searchForm.value);
this.commonsService.getDictionary('USING_ATTRIBUTION ', data => { this.commonsService.getDictionary('USING_ATTRIBUTION ', data => {
@ -79,10 +82,10 @@ export class DiscountPackageListComponent implements OnInit {
} }
// 活动开始 // 活动开始
public startActivity(id: number): void { public upDiscountPackage(id: number): void {
this.activate.startActivity({activityId : id}, data => { this.discountPackage.upDiscountPackage({discountId : id}, data => {
if (data['return_code'] === '000000') { if (data['return_code'] === '000000') {
this.message.success(data['return_msg']); this.message.success('上架成功');
this.getRequest(true, this.searchForm.value); this.getRequest(true, this.searchForm.value);
} else { } else {
this.message.error(data['return_msg']); this.message.error(data['return_msg']);
@ -91,10 +94,10 @@ export class DiscountPackageListComponent implements OnInit {
} }
// 活动结束 // 活动结束
public endActivity(id: number): void { public downDiscountPackage(id: number): void {
this.activate.endActivity({activityId : id}, data => { this.discountPackage.downDiscountPackage({discountId : id}, data => {
if (data['return_code'] === '000000') { if (data['return_code'] === '000000') {
this.message.success(data['return_msg']); this.message.success('下架成功');
this.getRequest(true, this.searchForm.value); this.getRequest(true, this.searchForm.value);
} else { } else {
this.message.error(data['return_msg']); this.message.error(data['return_msg']);
@ -102,6 +105,22 @@ export class DiscountPackageListComponent implements OnInit {
}); });
} }
// 删除
public deleteDiscountPackage(id: number): void {
this.commonsService.showConfirm('是否确认删除', isDelete => {
if (isDelete) {
this.discountPackage.deleteDiscountPackage({discountId : id}, data => {
if (data['return_code'] === '000000') {
this.message.success('删除成功');
this.getRequest(true, this.searchForm.value);
} else {
this.message.error(data['return_msg']);
}
});
}
});
}
// 修改 // 修改
public getEdit(id: number): void { public getEdit(id: number): void {
@ -112,14 +131,21 @@ export class DiscountPackageListComponent implements OnInit {
}).then(r => console.log(r)); }).then(r => console.log(r));
} }
// 跳转中奖记录 handleCancel(): void {
public jumpLotteryRecord(id: number): void { this.isVisible = false;
this.router.navigate(['/admin/activate/activate-lottery-record'], {
queryParams: {
activityId: id
} }
}).then(r => console.log(r));
public getDetails(id: number): void {
this.discountPackage.getDiscountPackageRuleById(id , data => {
if (data['return_code'] === '000000') {
this.listOfData = data['return_data'];
this.isVisible = true;
} else {
this.message.create('error', data['return_msg']);
}
});
} }
} }

@ -10,6 +10,7 @@ import {OrderKListComponent} from './order-k-list/order-k-list.component';
import {OrderHListComponent} from './order-h-list/order-h-list.component'; import {OrderHListComponent} from './order-h-list/order-h-list.component';
import {OrderAgentComponent} from './order-agent/order-agent.component'; import {OrderAgentComponent} from './order-agent/order-agent.component';
import {PreOrderComponent} from './pre-order/pre-order.component'; import {PreOrderComponent} from './pre-order/pre-order.component';
import {PackageRecordListComponent} from "./package-record-list/package-record-list.component";
const routes: Routes = [ const routes: Routes = [
@ -23,6 +24,7 @@ const routes: Routes = [
{ path: 'order-h-list', component: OrderHListComponent }, { path: 'order-h-list', component: OrderHListComponent },
{ path: 'order-agent', component: OrderAgentComponent }, { path: 'order-agent', component: OrderAgentComponent },
{ path: 'pre-order', component: PreOrderComponent }, { path: 'pre-order', component: PreOrderComponent },
{ path: 'package-record-list', component: PackageRecordListComponent },
]; ];
@NgModule({ @NgModule({

@ -18,10 +18,11 @@ import {OrderCListComponent} from './order-c-list/order-c-list.component';
import { OrderHListComponent } from './order-h-list/order-h-list.component'; import { OrderHListComponent } from './order-h-list/order-h-list.component';
import { OrderAgentComponent } from './order-agent/order-agent.component'; import { OrderAgentComponent } from './order-agent/order-agent.component';
import { PreOrderComponent } from './pre-order/pre-order.component'; import { PreOrderComponent } from './pre-order/pre-order.component';
import { PackageRecordListComponent } from './package-record-list/package-record-list.component';
@NgModule({ @NgModule({
declarations: [OrderListComponent, OrderDetailComponent, OrderCouponsComponent, OrderCouponComponent , OrderTListComponent, OrderKListComponent , OrderCListComponent, OrderHListComponent, OrderAgentComponent, PreOrderComponent], declarations: [OrderListComponent, OrderDetailComponent, OrderCouponsComponent, OrderCouponComponent , OrderTListComponent, OrderKListComponent , OrderCListComponent, OrderHListComponent, OrderAgentComponent, PreOrderComponent, PackageRecordListComponent],
imports: [ imports: [
CommonModule, CommonModule,
OrderRoutingModule, OrderRoutingModule,

@ -0,0 +1,103 @@
<!-- start 面包屑 -->
<app-breadcrumb></app-breadcrumb>
<!-- end 面包屑 -->
<!--条件搜索-->
<div class="inner-content">
<form nz-form [formGroup]="searchForm" (ngSubmit)="getRequest(true , searchForm.value)">
<div nz-row>
<div nz-col nzSpan="8">
<nz-form-item>
<nz-form-label [nzSpan]="6">优惠券包名称</nz-form-label>
<nz-form-control [nzSpan]="16">
<input nz-input formControlName="title"/>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="8">
<nz-form-item>
<nz-form-label [nzSpan]="6">类型</nz-form-label>
<nz-form-control [nzSpan]="16">
<nz-select nzShowSearch nzAllowClear formControlName="salesType" nzPlaceHolder="请选择类型">
<nz-option nzLabel="售卖" nzValue="1"></nz-option>
<nz-option nzLabel="赠送" nzValue="2"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="8">
<nz-form-item>
<nz-form-label [nzSpan]="6">使用归属</nz-form-label>
<nz-form-control [nzSpan]="16">
<nz-select formControlName="usingAttribution" nzAllowClear nzPlaceHolder="选择类型">
<nz-option *ngFor="let item of usingAttribution" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="8">
<nz-form-item>
<nz-form-label [nzSpan]="6">用户手机号码</nz-form-label>
<nz-form-control [nzSpan]="16">
<input nz-input formControlName="phone"/>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="8">
<nz-form-item>
<nz-form-label [nzSpan]="6">订单号</nz-form-label>
<nz-form-control [nzSpan]="16">
<input nz-input formControlName="recordNo"/>
</nz-form-control>
</nz-form-item>
</div>
</div>
<div nz-row>
<div nz-col nzSpan="24" class="search-button">
<button nz-button nzType="primary"><i nz-icon nzType="search" nzTheme="outline"></i>搜索</button>
<button nz-button nzType="default" (click)="resetForm()"><i nz-icon nzType="reload" nzTheme="outline"></i>重置</button>
</div>
</div>
</form>
</div>
<div class="inner-content">
<span>共计 {{total}} 条数据</span>
<nz-table
class="table"
#ajaxTable
nzShowSizeChanger
[nzFrontPagination]="false"
[nzData]="requestData"
[nzLoading]="loading"
[nzTotal]="total"
[(nzPageIndex)]="pageNum"
[(nzPageSize)]="pageSize"
[nzScroll]="{ x: '1200px' }"
(nzPageIndexChange)="getRequest(false , searchForm.value)"
(nzPageSizeChange)="getRequest(false , searchForm.value)">
<thead nzSingleSort>
<tr>
<th nzWidth="50px">编号</th>
<th nzWidth="150px">优惠券包标题</th>
<th nzWidth="70px">销售类型</th>
<th nzWidth="70px">销售价格</th>
<th nzWidth="250px">记录订单号</th>
<th nzWidth="100px">创建时间</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of ajaxTable.data; let i = index">
<td>{{i+1}}</td>
<td>{{data.discountPackageTitle}}</td>
<td>{{data.salesType === 1 ? '售卖' : '赠送'}}</td>
<td>{{data.price === null ? '暂无': data.price}}</td>
<td>{{data.recordNo}}</td>
<td>{{data.createdTime | date: 'yyyy-MM-dd HH:mm'}}</td>
</tbody>
</nz-table>
</div>

@ -0,0 +1,80 @@
import { Component, OnInit } from '@angular/core';
import {environment} from '../../../../environments/environment';
import {FormBuilder, FormGroup} from '_@angular_forms@9.0.7@@angular/forms';
import {CompanyService} from '../../../services/company.service';
import {ActivateService} from '../../../services/activate.service';
import {IconService} from '../../../services/icon.service';
import {NzMessageService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd';
import {Router} from '_@angular_router@9.0.7@@angular/router';
import {CommonsService} from '../../../services/commons.service';
import {DiscountPackageService} from '../../../services/discount-package.service';
@Component({
selector: 'app-package-record-list',
templateUrl: './package-record-list.component.html',
styleUrls: ['./package-record-list.component.scss']
})
export class PackageRecordListComponent implements OnInit {
searchForm: FormGroup; // 搜索框
requestData = []; // 列表数据
total: number; // 页码
pageNum = 1; // 页码
pageSize = 10; // 条码
loading = true;
usingAttribution = []; // 列表数据
constructor(
private form: FormBuilder,
private company: CompanyService,
private activate: ActivateService,
private iconService: IconService,
private message: NzMessageService,
private router: Router,
private discountPackage: DiscountPackageService,
private commonsService: CommonsService,
) {
}
ngOnInit(): void {
this.init();
this.commonsService.getDictionary('USING_ATTRIBUTION ', data => {
this.usingAttribution = data['return_data'];
});
}
public init(): void {
this.searchForm = this.form.group({
discountPackageTitle: [null],
salesType: [null],
usingAttribution: [null],
phone: [null],
recordNo: [null],
});
this.getRequest(true, this.searchForm.value);
}
// 查询列表
public getRequest(reset: boolean = false, whereObject: object) {
this.loading = false;
if (reset) {
this.pageNum = 1;
}
whereObject['pageNum'] = this.pageNum;
whereObject['pageSize'] = this.pageSize;
this.discountPackage.getDiscountPackageRecordList(whereObject, data => {
if (data['return_code'] === '000000') {
this.requestData = data['return_data'].list;
this.total = data['return_data'].total;
} else {
this.message.error(data['return_msg']);
}
});
}
// 重置
public resetForm(): void {
this.searchForm.reset();
}
}

@ -27,6 +27,24 @@ export class DiscountPackageService {
}); });
} }
public getDiscountPackageRecordList(paramsObject: object, callBack) {
this.http.get(environment.baseUrl + 'highDiscountPackage/getDiscountPackageRecordList?' + this.common.getWhereCondition(paramsObject)).subscribe(data => {
callBack(data);
});
}
/**
* @Author Sum1Dream
* @methodName getDiscountById
* @Description // 查询优惠券包详情
* @Date 9:18 2021/11/30
* @Param [id: number, callBack]
*/
public getDiscountPackageById(id: number, callBack) {
this.http.get(environment.baseUrl + 'highDiscountPackage/getDiscountPackageById?id=' + id).subscribe(data => {
callBack(data);
});
}
/** /**
@ -42,9 +60,98 @@ export class DiscountPackageService {
}); });
} }
/**
* @Author Sum1Dream
* @methodName updateCouponPackageInfo
* @Description // 修改优惠券包基本信息
* @Date 10:08 2021/11/30
* @Param [params: object, callBack]
*/
public updateCouponPackageInfo(params: object, callBack) { public updateCouponPackageInfo(params: object, callBack) {
this.http.post(environment.baseUrl + 'highDiscountPackage/updateCouponPackageInfo', params).subscribe(data => { this.http.post(environment.baseUrl + 'highDiscountPackage/updateCouponPackageInfo', params).subscribe(data => {
callBack(data); callBack(data);
}); });
} }
/**
* @Author Sum1Dream
* @methodName insertCouponPackageRule
* @Description // 新增优惠券包规则
* @Date 10:11 2021/11/30
* @Param [params: object, callBack]
*/
public insertCouponPackageRule(params: object, callBack) {
this.http.post(environment.baseUrl + 'highDiscountPackage/insertCouponPackageRule', params).subscribe(data => {
callBack(data);
});
}
/**
* @Author Sum1Dream
* @methodName deleteDiscountPackageRule
* @Description // 删除优惠券
* @Date 11:10 2021/11/30
* @Param [id: number , callBack]
*/
public deleteDiscountPackageRule(id: number , callBack) {
this.http.post(environment.baseUrl + 'highDiscountPackage/deleteDiscountPackageRule', {
discountPackageId: id
}).subscribe(data => {
callBack(data);
});
}
/**
* @Author Sum1Dream
* @methodName getDiscountPackageRuleById
* @Description //查询优惠券包规则
* @Date 10:12 2021/11/30
* @Param [id: number , callBack]
*/
public getDiscountPackageRuleById(id: number, callBack) {
this.http.get(environment.baseUrl + 'highDiscountPackage/getDiscountPackageRuleById?id=' + id).subscribe(data => {
callBack(data);
});
}
/**
* @Author Sum1Dream
* @methodName upDiscountPackage
* @Description // 上架优惠券包
* @Date 11:50 2021/11/30
* @Param [param: object, callBack]
*/
public upDiscountPackage(param: object, callBack) {
this.http.post(environment.baseUrl + 'highDiscountPackage/upDiscountPackage', param).subscribe(data => {
callBack(data);
});
}
/**
* @Author Sum1Dream
* @methodName downDiscountPackage
* @Description // 下架优惠券包
* @Date 11:51 2021/11/30
* @Param [param: object, callBack]
*/
public downDiscountPackage(param: object, callBack) {
this.http.post(environment.baseUrl + 'highDiscountPackage/downDiscountPackage', param).subscribe(data => {
callBack(data);
});
}
/**
* @Author Sum1Dream
* @methodName deleteDiscountPackage
* @Description // 删除优惠券包
* @Date 11:53 2021/11/30
* @Param [param: object, callBack]
*/
public deleteDiscountPackage(param: object, callBack) {
this.http.post(environment.baseUrl + 'highDiscountPackage/deleteDiscountPackage', param).subscribe(data => {
callBack(data);
});
}
} }

Loading…
Cancel
Save