From deabca91989de7b650718ff3f4591e0569362352 Mon Sep 17 00:00:00 2001
From: Sum1Dream <418471657@qq.com>
Date: Tue, 27 Jul 2021 09:25:21 +0800
Subject: [PATCH] 1
---
.../oils-discount.component.html | 101 +++++++++++++++
.../oils-discount.component.scss | 0
.../oils-discount/oils-discount.component.ts | 122 ++++++++++++++++++
3 files changed, 223 insertions(+)
create mode 100644 src/app/admin/system/oils-discount/oils-discount.component.html
create mode 100644 src/app/admin/system/oils-discount/oils-discount.component.scss
create mode 100644 src/app/admin/system/oils-discount/oils-discount.component.ts
diff --git a/src/app/admin/system/oils-discount/oils-discount.component.html b/src/app/admin/system/oils-discount/oils-discount.component.html
new file mode 100644
index 0000000..ee2e6f6
--- /dev/null
+++ b/src/app/admin/system/oils-discount/oils-discount.component.html
@@ -0,0 +1,101 @@
+
+
+
+
+
+
+
+
+
+
共计 {{total}} 条数据
+
+
+
+
+
+
+ 编号 |
+ 油品 |
+ 优惠比例 |
+ 创建时间 |
+ 更新时间 |
+ 操作 |
+
+
+
+
+ {{i+1}} |
+ {{data.oilNo}} |
+ {{data.priceRate}} % |
+ {{data.createTime | date: 'yyyy-MM-dd HH:mm'}} |
+ {{data.updateTime | date: 'yyyy-MM-dd HH:mm'}} |
+
+ 编辑
+
+ 删除
+ |
+
+
+
+
+
+
+
+
diff --git a/src/app/admin/system/oils-discount/oils-discount.component.scss b/src/app/admin/system/oils-discount/oils-discount.component.scss
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/admin/system/oils-discount/oils-discount.component.ts b/src/app/admin/system/oils-discount/oils-discount.component.ts
new file mode 100644
index 0000000..7843a9b
--- /dev/null
+++ b/src/app/admin/system/oils-discount/oils-discount.component.ts
@@ -0,0 +1,122 @@
+import {Component, OnInit} from '@angular/core';
+import {environment} from '../../../../environments/environment';
+import {CompanyService} from '../../../services/company.service';
+import {IconService} from '../../../services/icon.service';
+import {CommonsService} from '../../../services/commons.service';
+import {FormBuilder, FormGroup} from '@angular/forms';
+import {NzMessageService} from 'ng-zorro-antd';
+import {Router} from '@angular/router';
+
+@Component({
+ selector: 'app-oils-discount',
+ templateUrl: './oils-discount.component.html',
+ styleUrls: ['./oils-discount.component.scss']
+})
+export class OilsDiscountComponent implements OnInit {
+
+ WEB_SERVE_URL = environment.imageUrl;
+ searchForm: FormGroup; // 搜索框
+ getForm: FormGroup; // 搜索框
+ requestData = []; // 列表数据
+ total: number; // 页码
+ pageNum = 1; // 页码
+ pageSize = 10; // 条码
+ loading = true;
+ isVisible = false;
+ roleTypeArray;
+
+ constructor(
+ private form: FormBuilder,
+ private company: CompanyService,
+ private iconService: IconService,
+ private message: NzMessageService,
+ private router: Router,
+ private common: CommonsService
+ ) {
+ }
+
+ ngOnInit(): void {
+ this.common.getDictionary('GAS_OIL_TYPE', data => {
+ this.roleTypeArray = data['return_data'];
+ });
+ this.init();
+ }
+
+ public init(): void {
+ this.searchForm = this.form.group({
+ oilNo: [null],
+ });
+ this.getForm = this.form.group({
+ oilNo: [null],
+ priceRate: [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.common.getList(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();
+ }
+
+ public getForbiddenUser(id): void {
+ this.common.showConfirm('是否删除', data => {
+ if (data) {
+ this.common.delete(id, dataUser => {
+ this.getRequest(false, this.searchForm.value);
+ });
+ }
+ });
+ }
+
+
+ // 修改
+ public getAdd(): void {
+ this.isVisible = true;
+ }
+
+ getEdit(id: number): void {
+ this.isVisible = true;
+ this.common.getDetailById(id , data => {
+ this.getForm.patchValue(data['return_data']);
+ this.getForm.value.id = id;
+ });
+
+ }
+
+ handleOk(): void {
+ console.log(this.getForm.value);
+ this.common.editGasDiscountOilPrice(this.getForm.value, data => {
+ if (data['return_code'] === '000000') {
+ this.getRequest(false, this.searchForm.value);
+ } else {
+ this.message.error(data['return_msg']);
+ }
+ });
+ this.isVisible = false;
+ }
+
+ handleCancel(): void {
+ this.isVisible = false;
+ }
+
+}
+