From 60ba90150ae12143d49cc2a9d0d8ab8491b74399 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 7 Dec 2021 15:14:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E4=BC=98=E6=83=A0=E5=88=B8?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sales-code-list.component.html | 241 ++++++++++-------- .../sales-code-list.component.ts | 48 +++- src/app/pipes/coupon-code.pipe.ts | 2 + src/app/services/coupon.service.ts | 13 + 4 files changed, 202 insertions(+), 102 deletions(-) diff --git a/src/app/admin/coupon/sales-code-list/sales-code-list.component.html b/src/app/admin/coupon/sales-code-list/sales-code-list.component.html index 61e02f8..a438fd7 100644 --- a/src/app/admin/coupon/sales-code-list/sales-code-list.component.html +++ b/src/app/admin/coupon/sales-code-list/sales-code-list.component.html @@ -1,113 +1,115 @@ + + +
+
+
- -
- -
- -
- - 消费码KEY - - - - -
-
- - 消费码状态 - - - - - - - - - +
+ + 消费码KEY + + + + +
+
+ + 消费码状态 + + + + + + + + + + +
-
-
-
- - +
+
+ + +
-
- -
- - -
- 共计 {{total}} 条数据 - - 卡券名称: - {{name}}({{type === 1 ? '内部券' : '外部券'}}) - -
- - - - +
- - - - 编号 - 消费码 - 是否分发 - 使用门店 - 领取时间 - 消费时间 - 销售截止时间 - 使用截止时间 - 创建时间 - 状态 - - - - - {{i + 1}} - {{data.salesCode}} - {{data.isAssignAgent === true ? '已分发' : '未分发'}} - {{data.storeName == null ? '暂无' : data.storeName}} - {{data.receiveTime == null ? '未领取' : data.receiveTime | date: 'yyyy-MM-dd HH:mm'}} - {{data.consumeTime == null ? '未消费' : data.consumeTime | date: 'yyyy-MM-dd HH:mm'}} - {{data.salesEndTime | date: 'yyyy-MM-dd HH:mm'}} - {{data.useEndTime | date: 'yyyy-MM-dd HH:mm'}} - {{data.createTime | date: 'yyyy-MM-dd HH:mm'}} - {{data.status | couponCode}} - - -
- +
+ 共计 {{total}} 条数据 + + 卡券名称: + {{name}}({{type === 1 ? '内部券' : '外部券'}}) + +
+ + + + + +
+ + + + 序号 + 消费码key + 消费码 + 是否分发 + 使用门店 + 领取时间 + 消费时间 + 销售截止时间 + 使用截止时间 + 创建时间 + 销售码状态 + + + + + {{i + 1}} + {{data.codeKey}} + {{data.salesCode}} + {{data.isAssignAgent === true ? '已分发' : '未分发'}} + {{data.storeName == null ? '暂无' : data.storeName}} + {{data.receiveTime == null ? '未领取' : data.receiveTime | date: 'yyyy-MM-dd HH:mm'}} + {{data.consumeTime == null ? '未消费' : data.consumeTime | date: 'yyyy-MM-dd HH:mm'}} + {{data.salesEndTime | date: 'yyyy-MM-dd HH:mm'}} + {{data.useEndTime | date: 'yyyy-MM-dd HH:mm'}} + {{data.createTime | date: 'yyyy-MM-dd HH:mm'}} + {{data.status | couponCode}} + + +
+
@@ -168,3 +170,40 @@ + + + + + + + + 创建时间 + + + + + + + + 销售码状态 + + + + + + + + + + + +
+ +
+ +
+
diff --git a/src/app/admin/coupon/sales-code-list/sales-code-list.component.ts b/src/app/admin/coupon/sales-code-list/sales-code-list.component.ts index bebdd97..5841814 100644 --- a/src/app/admin/coupon/sales-code-list/sales-code-list.component.ts +++ b/src/app/admin/coupon/sales-code-list/sales-code-list.component.ts @@ -11,7 +11,7 @@ import {environment} from '../../../../environments/environment'; styleUrls: ['./sales-code-list.component.scss'] }) export class SalesCodeListComponent implements OnInit { - + FILE_URL = environment.imageUrl; searchForm: FormGroup; // 搜索框 codeForm: FormGroup; // 搜索框 requestData = []; // 列表数据 @@ -19,6 +19,7 @@ export class SalesCodeListComponent implements OnInit { pageNum = 1; // 页码 pageSize = 10; // 条码 loading = true; + exportLoading = false; id = null; name: string; type: number; @@ -27,6 +28,9 @@ export class SalesCodeListComponent implements OnInit { importErrorStudentArray = []; errorStudentVisible = false; + exportSalesCodeModal = false; + exportSalesCodeForm: FormGroup; + constructor( private form: FormBuilder, private activatedRoute: ActivatedRoute, @@ -54,6 +58,11 @@ export class SalesCodeListComponent implements OnInit { useEndTime: [null, [Validators.required]], generateNum: [null, [Validators.required]], }); + + this.exportSalesCodeForm = this.form.group({ + createTime: [null], + status: [null], + }); } // 查询列表 @@ -147,4 +156,41 @@ export class SalesCodeListComponent implements OnInit { this.importErrorStudentArray = data['errorData']; this.errorStudentVisible = true; } + + /** + * 打开销售码数据 + */ + showExportSalesCodeModal() { + this.exportSalesCodeModal = true; + } + + /** + * 导出销售码数据 + */ + exportSalesCodeData() { + this.exportLoading = true; + this.exportSalesCodeForm.value['couponId'] = this.id; + if (this.exportSalesCodeForm.value.createTime != null) { + this.exportSalesCodeForm.value['createTimeS'] = this.exportSalesCodeForm.value.createTime[0]; + this.exportSalesCodeForm.value['createTimeE'] = this.exportSalesCodeForm.value.createTime[1]; + } else { + this.exportSalesCodeForm.value['createTimeS'] = null; + this.exportSalesCodeForm.value['createTimeE'] = null; + } + this.coupon.exportStock(this.exportSalesCodeForm.value, data => { + if (data['return_code'] === '000000') { + window.location.href = this.FILE_URL + 'temporary/' + data['return_data']; + } else { + this.message.error(data['return_msg']); + } + this.exportLoading = false; + }); + } + + /** + * 关闭销售码数据 + */ + closeExportSalesCodeModal() { + this.exportSalesCodeModal = true; + } } diff --git a/src/app/pipes/coupon-code.pipe.ts b/src/app/pipes/coupon-code.pipe.ts index 0299016..f9ec0bf 100644 --- a/src/app/pipes/coupon-code.pipe.ts +++ b/src/app/pipes/coupon-code.pipe.ts @@ -15,6 +15,8 @@ export class CouponCodePipe implements PipeTransform { return '已使用'; case 4: return '已过期'; + case 99: + return '预支付'; } } diff --git a/src/app/services/coupon.service.ts b/src/app/services/coupon.service.ts index 6356ab3..70f41fd 100644 --- a/src/app/services/coupon.service.ts +++ b/src/app/services/coupon.service.ts @@ -119,5 +119,18 @@ export class CouponService { }); } + /** + * 导出销售码 + * + * @param params 上传对象 + * @param callBack 回调 + * @return data 返回结果 + */ + public exportStock(params: object, callBack) { + this.http.post(environment.baseUrl + 'coupon/exportStock', params).subscribe(data => { + callBack(data); + }); + } + }