From f3f788c26c81018135daf0577bc4cace5f8663f9 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Mon, 20 Nov 2023 14:12:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sc-printer-list.component.html | 33 +++++++++++++ .../sc-printer-list.component.scss | 0 .../sc-printer-list.component.ts | 46 +++++++++++++++++++ src/app/pipes/api-coupon/sc-printer.pipe.ts | 25 ++++++++++ 4 files changed, 104 insertions(+) create mode 100644 src/app/admin/coupon/sc-printer-list/sc-printer-list.component.html create mode 100644 src/app/admin/coupon/sc-printer-list/sc-printer-list.component.scss create mode 100644 src/app/admin/coupon/sc-printer-list/sc-printer-list.component.ts create mode 100644 src/app/pipes/api-coupon/sc-printer.pipe.ts diff --git a/src/app/admin/coupon/sc-printer-list/sc-printer-list.component.html b/src/app/admin/coupon/sc-printer-list/sc-printer-list.component.html new file mode 100644 index 0000000..59de56f --- /dev/null +++ b/src/app/admin/coupon/sc-printer-list/sc-printer-list.component.html @@ -0,0 +1,33 @@ + + + + +
+ 共计 {{total}} 条数据 + + + + 编码 + 名称 + 面额 + 类型 + 有效天数 + 库存 + 状态 + + + + + {{ data.request_code }} + {{ data.ticket_name }} + {{ data.face_amount }} + {{ data.goods_type | scPrinter}} + {{ data.effective_days}} + {{ data.total_num}} + {{ data.status == 1 ? '正常':'停用'}} + + + + + +
\ No newline at end of file diff --git a/src/app/admin/coupon/sc-printer-list/sc-printer-list.component.scss b/src/app/admin/coupon/sc-printer-list/sc-printer-list.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/admin/coupon/sc-printer-list/sc-printer-list.component.ts b/src/app/admin/coupon/sc-printer-list/sc-printer-list.component.ts new file mode 100644 index 0000000..8e0074b --- /dev/null +++ b/src/app/admin/coupon/sc-printer-list/sc-printer-list.component.ts @@ -0,0 +1,46 @@ +import { Component, OnInit } from '@angular/core'; +import {FormBuilder, FormGroup} from "@angular/forms"; +import {CouponService} from "../../../services/coupon.service"; +import {NzMessageService} from "ng-zorro-antd"; + +@Component({ + selector: 'app-sc-printer-list', + templateUrl: './sc-printer-list.component.html', + styleUrls: ['./sc-printer-list.component.scss'] +}) +export class ScPrinterListComponent implements OnInit { + searchForm: FormGroup; // 搜索框 + requestData = []; // 列表数据 + total: number = 0; // 总计条数 + loading = false; + + constructor( + private form: FormBuilder, + private coupon: CouponService, + private message: NzMessageService, + ) { } + + ngOnInit() { + this.searchForm = this.form.group({}); + this.getRequest() + } + + + // 查询列表 + public getRequest() { + + this.loading = true; + + this.coupon.synCouponRule( data => { + this.loading = false; + if (data['return_code'] === '000000') { + this.requestData = data['return_data']; + this.total = data['return_data'].size; + } else { + this.message.error(data['return_msg']); + } + }); + + } + +} diff --git a/src/app/pipes/api-coupon/sc-printer.pipe.ts b/src/app/pipes/api-coupon/sc-printer.pipe.ts new file mode 100644 index 0000000..0213112 --- /dev/null +++ b/src/app/pipes/api-coupon/sc-printer.pipe.ts @@ -0,0 +1,25 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'scPrinter' +}) +export class ScPrinterPipe implements PipeTransform { + + transform(value: number): unknown { + switch (value) { + case 4001: + return '油品券'; + case 4002: + return '汽油券'; + case 4003: + return '柴油券'; + case 4004: + return '非油券'; + case 4006: + return '异业券'; + default: + return '其他' + } + } + +}