提交代码

master
袁野 1 year ago
parent ddc4c26996
commit f3f788c26c
  1. 33
      src/app/admin/coupon/sc-printer-list/sc-printer-list.component.html
  2. 0
      src/app/admin/coupon/sc-printer-list/sc-printer-list.component.scss
  3. 46
      src/app/admin/coupon/sc-printer-list/sc-printer-list.component.ts
  4. 25
      src/app/pipes/api-coupon/sc-printer.pipe.ts

@ -0,0 +1,33 @@
<!-- start 面包屑 -->
<app-breadcrumb></app-breadcrumb>
<!-- end 面包屑 -->
<div class="inner-content">
<span>共计 {{total}} 条数据</span>
<nz-table #basicTable [nzData]="requestData">
<thead>
<tr>
<th>编码</th>
<th>名称</th>
<th>面额</th>
<th>类型</th>
<th>有效天数</th>
<th>库存</th>
<th>状态</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data">
<td>{{ data.request_code }}</td>
<td>{{ data.ticket_name }}</td>
<td>{{ data.face_amount }}</td>
<td>{{ data.goods_type | scPrinter}}</td>
<td>{{ data.effective_days}}</td>
<td>{{ data.total_num}}</td>
<td>{{ data.status == 1 ? '正常':'停用'}}</td>
</tr>
</tbody>
</nz-table>
</div>

@ -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']);
}
});
}
}

@ -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 '其他'
}
}
}
Loading…
Cancel
Save