+
限购数量
@@ -143,19 +143,15 @@
- 奖励名称 |
+ 优惠券名称 |
数量 |
- 图片 |
操作 |
- {{ data.name }} |
+ {{ data.discountName }} |
{{ data.num }} |
-
-
- |
删除
|
@@ -187,15 +183,17 @@
- 奖励名称
-
-
+ 优惠券
+
+
+
+
- 奖励数量
-
-
+ 数量
+
+
diff --git a/src/app/admin/discount-package/discount-package-edit/discount-package-edit.component.ts b/src/app/admin/discount-package/discount-package-edit/discount-package-edit.component.ts
index 3ac1b78..a300ad1 100644
--- a/src/app/admin/discount-package/discount-package-edit/discount-package-edit.component.ts
+++ b/src/app/admin/discount-package/discount-package-edit/discount-package-edit.component.ts
@@ -7,9 +7,9 @@ import {ActivateService} from '../../../services/activate.service';
import {NzUploadFile} from 'ng-zorro-antd';
import {environment} from '../../../../environments/environment';
import {AgentService} from '../../../services/agent.service';
-import {CommonsService} from "../../../services/commons.service";
-import {DiscountPackageService} from "../../../services/discount-package.service";
-import {DiscountService} from "../../../services/discount.service";
+import {CommonsService} from '../../../services/commons.service';
+import {DiscountPackageService} from '../../../services/discount-package.service';
+import {DiscountService} from '../../../services/discount.service';
function getBase64(file: File): Promise {
return new Promise((resolve, reject) => {
@@ -32,30 +32,16 @@ export class DiscountPackageEditComponent implements OnInit {
data: any;
editFlag = false;
id: number;
- agentId: number;
- listOfOption: string[] = [];
listOfData = [];
- agentData = [];
usingAttribution = [];
current = 0;
- listOfControl = [{
- isEdit: true,
- agentId: null,
- agentName: null,
- prizeNum: null,
- prizeId: null,
- prizeName: null,
- loading : false
- }];
FILE_URL = environment.imageUrl;
POST_URL = environment.baseUrl;
isVisible = false;
- logoFile = [];
previewImage: string | undefined = '';
previewVisible = false;
discountList = []; // 列表数据
usingScope = []; // 列表数据
-
listImg = [];
bannerImg = [];
detailsImg = [];
@@ -89,42 +75,18 @@ export class DiscountPackageEditComponent implements OnInit {
});
this.validateForm = this.fb.group({
title: [null, [Validators.required]],
- usingAttribution: [null, [Validators.required]],
+ usingAttribution: [null],
salesType: [null, [Validators.required]],
price: [null],
purchaseNum: [null],
});
this.validateFormAward = this.fb.group({
- getDiscountId: [null, [Validators.required]],
+ discountId: [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') {
this.editFlag = true;
this.id = data['return_data'].id;
+ this.getListByActivityId(data['return_data'].id);
this.current += 1;
this.message.success('编辑成功');
} else {
- this.message.create('error', '编辑失败');
+ this.message.create('error', data['return_msg']);
}
});
} else {
@@ -180,10 +143,11 @@ export class DiscountPackageEditComponent implements OnInit {
if (data['return_code'] === '000000') {
this.editFlag = true;
this.id = data['return_data'].id;
+ this.getListByActivityId(data['return_data'].id);
this.current += 1;
this.message.success('编辑成功');
} 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) {
this.validateForm.value.listImg = this.listImg[0]['response']['return_data'][0];
} else {
- this.validateForm.value.listImg= this.listImg[0].name;
+ this.validateForm.value.listImg = this.listImg[0].name;
}
} else {
this.message.error('请上传列表图片');
@@ -236,22 +200,59 @@ export class DiscountPackageEditComponent implements OnInit {
// 查询详情
public getDetails(id) {
- this.disCountPackage.getDiscountPackageList(id, data => {
+ this.disCountPackage.getDiscountPackageById(id, data => {
if (data['return_code'] === '000000') {
- data['return_data'].time = [new Date(data['return_data']['startTime']), new Date(data['return_data']['endTime'])];
- data['return_data'].type = String(data['return_data'].type);
- data['return_data'].productIdArray = data['return_data'].ruleArray[0].productIdArray;
+ data['return_data']['usingAttribution'] = String(data['return_data']['usingAttribution']);
+ if (data['return_data']['listImg'] != null && data['return_data']['listImg'] !== '') {
+ 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']);
} else {
this.message.create('error', data['return_msg']);
}
});
this.getListByActivityId(id);
-
}
getListByActivityId(id: number ) {
- this.activate.getListByActivityId(id , data => {
+ this.disCountPackage.getDiscountPackageRuleById(id , data => {
if (data['return_code'] === '000000') {
this.listOfData = data['return_data'];
} 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 {
@@ -331,33 +294,15 @@ export class DiscountPackageEditComponent implements OnInit {
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.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 => {
+ this.validateFormAward.value['discountPackageId'] = this.id;
+ this.disCountPackage.insertCouponPackageRule(this.validateFormAward.value , data => {
if (data['return_code'] === '000000') {
this.isVisible = false;
this.getListByActivityId(this.id);
+ this.validateFormAward.reset();
this.message.success('编辑成功');
} else {
- this.message.create('error', '编辑失败');
+ this.message.create('error', data['return_msg']);
}
});
@@ -369,12 +314,12 @@ export class DiscountPackageEditComponent implements OnInit {
deleteActivateAward(id: number) {
- this.activate.deleteActivateAward(id , data => {
+ this.disCountPackage.deleteDiscountPackageRule(id , data => {
if (data['return_code'] === '000000') {
this.getListByActivityId(this.id);
this.message.success('成功');
} 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.discountList = data['return_data'].list;
- console.log(data);
});
}
}
diff --git a/src/app/admin/discount-package/discount-package-list/discount-package-list.component.html b/src/app/admin/discount-package/discount-package-list/discount-package-list.component.html
index 3621869..aba5d46 100644
--- a/src/app/admin/discount-package/discount-package-list/discount-package-list.component.html
+++ b/src/app/admin/discount-package/discount-package-list/discount-package-list.component.html
@@ -100,14 +100,33 @@
{{data.createdTime | date: 'yyyy-MM-dd HH:mm'}} |
{{data.status | discountPackageStatus}} |
- 编辑
-
- 上架
- 下架
+ 编辑
+ 详情
+
+ 上架
+ 下架
+
+ 删除
|
+
+
+
+
+ 优惠券名称 |
+ 数量 |
+
+
+
+
+ {{ data.discountName }} |
+ {{ data.num }} |
+
+
+
+
diff --git a/src/app/admin/discount-package/discount-package-list/discount-package-list.component.ts b/src/app/admin/discount-package/discount-package-list/discount-package-list.component.ts
index b348de3..ab5c9d2 100644
--- a/src/app/admin/discount-package/discount-package-list/discount-package-list.component.ts
+++ b/src/app/admin/discount-package/discount-package-list/discount-package-list.component.ts
@@ -24,6 +24,8 @@ export class DiscountPackageListComponent implements OnInit {
pageNum = 1; // 页码
pageSize = 10; // 条码
loading = true;
+ listOfData = [];
+ isVisible = false;
constructor(
private form: FormBuilder,
@@ -46,7 +48,8 @@ export class DiscountPackageListComponent implements OnInit {
title: [null],
salesType: [null],
usingAttribution: [null],
- status: [null],
+ recordNo: [null],
+ phone: [null],
});
this.getRequest(true, this.searchForm.value);
this.commonsService.getDictionary('USING_ATTRIBUTION ', data => {
@@ -79,10 +82,10 @@ export class DiscountPackageListComponent implements OnInit {
}
// 活动开始
- public startActivity(id: number): void {
- this.activate.startActivity({activityId : id}, data => {
+ public upDiscountPackage(id: number): void {
+ this.discountPackage.upDiscountPackage({discountId : id}, data => {
if (data['return_code'] === '000000') {
- this.message.success(data['return_msg']);
+ this.message.success('上架成功');
this.getRequest(true, this.searchForm.value);
} else {
this.message.error(data['return_msg']);
@@ -91,10 +94,10 @@ export class DiscountPackageListComponent implements OnInit {
}
// 活动结束
- public endActivity(id: number): void {
- this.activate.endActivity({activityId : id}, data => {
+ public downDiscountPackage(id: number): void {
+ this.discountPackage.downDiscountPackage({discountId : id}, data => {
if (data['return_code'] === '000000') {
- this.message.success(data['return_msg']);
+ this.message.success('下架成功');
this.getRequest(true, this.searchForm.value);
} else {
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 {
@@ -112,14 +131,21 @@ export class DiscountPackageListComponent implements OnInit {
}).then(r => console.log(r));
}
- // 跳转中奖记录
- public jumpLotteryRecord(id: number): void {
- this.router.navigate(['/admin/activate/activate-lottery-record'], {
- queryParams: {
- activityId: id
+ handleCancel(): void {
+ this.isVisible = false;
+ }
+
+ 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']);
}
- }).then(r => console.log(r));
+ });
}
+
}
diff --git a/src/app/admin/order/order-routing.module.ts b/src/app/admin/order/order-routing.module.ts
index 6cd9dc2..146f7c0 100644
--- a/src/app/admin/order/order-routing.module.ts
+++ b/src/app/admin/order/order-routing.module.ts
@@ -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 {OrderAgentComponent} from './order-agent/order-agent.component';
import {PreOrderComponent} from './pre-order/pre-order.component';
+import {PackageRecordListComponent} from "./package-record-list/package-record-list.component";
const routes: Routes = [
@@ -23,6 +24,7 @@ const routes: Routes = [
{ path: 'order-h-list', component: OrderHListComponent },
{ path: 'order-agent', component: OrderAgentComponent },
{ path: 'pre-order', component: PreOrderComponent },
+ { path: 'package-record-list', component: PackageRecordListComponent },
];
@NgModule({
diff --git a/src/app/admin/order/order.module.ts b/src/app/admin/order/order.module.ts
index fd6d2bc..b92ed5f 100644
--- a/src/app/admin/order/order.module.ts
+++ b/src/app/admin/order/order.module.ts
@@ -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 { OrderAgentComponent } from './order-agent/order-agent.component';
import { PreOrderComponent } from './pre-order/pre-order.component';
+import { PackageRecordListComponent } from './package-record-list/package-record-list.component';
@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: [
CommonModule,
OrderRoutingModule,
diff --git a/src/app/admin/order/package-record-list/package-record-list.component.html b/src/app/admin/order/package-record-list/package-record-list.component.html
new file mode 100644
index 0000000..d24f985
--- /dev/null
+++ b/src/app/admin/order/package-record-list/package-record-list.component.html
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
+
+
+ 共计 {{total}} 条数据
+
+
+
+ 编号 |
+ 优惠券包标题 |
+ 销售类型 |
+ 销售价格 |
+ 记录订单号 |
+ 创建时间 |
+
+
+
+
+ {{i+1}} |
+ {{data.discountPackageTitle}} |
+ {{data.salesType === 1 ? '售卖' : '赠送'}} |
+ {{data.price === null ? '暂无': data.price}} |
+ {{data.recordNo}} |
+ {{data.createdTime | date: 'yyyy-MM-dd HH:mm'}} |
+
+
+
+
diff --git a/src/app/admin/order/package-record-list/package-record-list.component.scss b/src/app/admin/order/package-record-list/package-record-list.component.scss
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/admin/order/package-record-list/package-record-list.component.ts b/src/app/admin/order/package-record-list/package-record-list.component.ts
new file mode 100644
index 0000000..ffec6e4
--- /dev/null
+++ b/src/app/admin/order/package-record-list/package-record-list.component.ts
@@ -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();
+ }
+
+}
diff --git a/src/app/services/discount-package.service.ts b/src/app/services/discount-package.service.ts
index 684bf0e..c72d2f9 100644
--- a/src/app/services/discount-package.service.ts
+++ b/src/app/services/discount-package.service.ts
@@ -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) {
this.http.post(environment.baseUrl + 'highDiscountPackage/updateCouponPackageInfo', params).subscribe(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);
+ });
+ }
+
+
}