From 38c2891d662600fa232e7517b2b89c62be046949 Mon Sep 17 00:00:00 2001
From: Sum1Dream <418471657@qq.com>
Date: Tue, 2 Aug 2022 23:00:06 +0800
Subject: [PATCH] 1
---
.../config-manage-routing.module.ts | 2 +
.../config-manage/config-manage.module.ts | 3 +-
.../integral-rebate.component.html | 208 ++++++++++++++++++
.../integral-rebate.component.scss | 0
.../integral-rebate.component.ts | 208 ++++++++++++++++++
.../third-product/third-product.component.ts | 5 -
.../sercices/integr-rebate.service.spec.ts | 16 ++
src/app/sercices/integr-rebate.service.ts | 9 +
8 files changed, 445 insertions(+), 6 deletions(-)
create mode 100644 src/app/admin/config-manage/integral-rebate/integral-rebate.component.html
create mode 100644 src/app/admin/config-manage/integral-rebate/integral-rebate.component.scss
create mode 100644 src/app/admin/config-manage/integral-rebate/integral-rebate.component.ts
create mode 100644 src/app/sercices/integr-rebate.service.spec.ts
create mode 100644 src/app/sercices/integr-rebate.service.ts
diff --git a/src/app/admin/config-manage/config-manage-routing.module.ts b/src/app/admin/config-manage/config-manage-routing.module.ts
index 709aeac..1bf33ce 100644
--- a/src/app/admin/config-manage/config-manage-routing.module.ts
+++ b/src/app/admin/config-manage/config-manage-routing.module.ts
@@ -4,6 +4,7 @@ import {GoodsTypeComponent} from './goods-type/goods-type.component';
import {BrandComponent} from './brand/brand.component';
import {ThirdProductComponent} from './third-product/third-product.component';
import {MemberProductComponent} from './member-product/member-product.component';
+import {IntegralRebateComponent} from './integral-rebate/integral-rebate.component';
const routes: Routes = [
@@ -11,6 +12,7 @@ const routes: Routes = [
{ path: 'brand', component: BrandComponent },
{ path: 'third-product', component: ThirdProductComponent },
{ path: 'member-product', component: MemberProductComponent },
+ { path: 'integral-rebate', component: IntegralRebateComponent },
];
@NgModule({
diff --git a/src/app/admin/config-manage/config-manage.module.ts b/src/app/admin/config-manage/config-manage.module.ts
index 96a4a07..7012845 100644
--- a/src/app/admin/config-manage/config-manage.module.ts
+++ b/src/app/admin/config-manage/config-manage.module.ts
@@ -12,10 +12,11 @@ import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import { ThirdProductComponent } from './third-product/third-product.component';
import {AppCommonModule} from "../../app-common.module";
import { MemberProductComponent } from './member-product/member-product.component';
+import { IntegralRebateComponent } from './integral-rebate/integral-rebate.component';
@NgModule({
- declarations: [GoodsTypeComponent, BrandComponent, ThirdProductComponent, MemberProductComponent],
+ declarations: [GoodsTypeComponent, BrandComponent, ThirdProductComponent, MemberProductComponent, IntegralRebateComponent],
imports: [
CommonModule,
ConfigManageRoutingModule,
diff --git a/src/app/admin/config-manage/integral-rebate/integral-rebate.component.html b/src/app/admin/config-manage/integral-rebate/integral-rebate.component.html
new file mode 100644
index 0000000..23d349f
--- /dev/null
+++ b/src/app/admin/config-manage/integral-rebate/integral-rebate.component.html
@@ -0,0 +1,208 @@
+
+
+
+
+
+
+
+
+
+
共计 {{total}} 条数据
+
+
+
+
+
+
+ 编号 |
+
+ 产品名称 |
+ 利润比例 |
+ 积分抵扣比例 |
+ 支付方式 |
+ 展示平台 |
+ 创建时间 |
+ 操作 |
+
+
+
+
+ {{i + 1}} |
+
+ {{data.productName}} |
+ {{data.discount + "%"}} |
+ {{data.integralDiscount + "%"}} |
+ {{data.productPayTypeString.substring(0 , data.productPayTypeString.length - 1)}} |
+ {{data.productPlatformString.substring(0 , data.productPlatformString.length - 1)}} |
+ {{data.createTime | date: 'yyyy-MM-dd HH:mm'}} |
+
+ 更多操作
+
+
+
+ |
+
+
+
+
+
+
+
+
diff --git a/src/app/admin/config-manage/integral-rebate/integral-rebate.component.scss b/src/app/admin/config-manage/integral-rebate/integral-rebate.component.scss
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/admin/config-manage/integral-rebate/integral-rebate.component.ts b/src/app/admin/config-manage/integral-rebate/integral-rebate.component.ts
new file mode 100644
index 0000000..ef731a6
--- /dev/null
+++ b/src/app/admin/config-manage/integral-rebate/integral-rebate.component.ts
@@ -0,0 +1,208 @@
+import { Component, OnInit } from '@angular/core';
+import {environment} from '../../../../environments/environment';
+import {FormBuilder, FormGroup, Validators} from '_@angular_forms@9.0.7@@angular/forms';
+import {RechargeService} from '../../../services/recharge.service';
+import {DiscountService} from '../../../services/discount.service';
+import {CouponService} from '../../../services/coupon.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 {ApiProductService} from '../../../services/api-product.service';
+
+@Component({
+ selector: 'app-integral-rebate',
+ templateUrl: './integral-rebate.component.html',
+ styleUrls: ['./integral-rebate.component.scss']
+})
+export class IntegralRebateComponent implements OnInit {
+
+
+ WEB_SERVE_URL = environment.imageUrl;
+ searchForm: FormGroup; // 搜索框
+ validateForm: FormGroup; // 添加框
+ requestData = []; // 列表数据
+ productArray = []; // 价格数据
+ priceTypeArray = []; // 支付类型数据
+ platformArray = []; // 充值平台数据
+ productPlatformArray = []; // 展示平台数据
+
+ total: number; // 页码
+ pageNum = 1; // 页码
+ pageSize = 10; // 条码
+ loading = true;
+ isVisible = false;
+ isVisibleProduct = false;
+ id: number;
+ edit = false;
+ payPrice;
+ isVisibleGoods = false;
+ realPrice = 0;
+ data = {};
+
+
+ formatterPercent = (value: number): string => `${value == null ? 0 : value} %`;
+ parserPercent = (value: string): string => value.replace(' %', '');
+
+ constructor(
+ private form: FormBuilder,
+ private recharge: RechargeService,
+ private discount: DiscountService,
+ private coupon: CouponService,
+ private iconService: IconService,
+ private message: NzMessageService,
+ private router: Router,
+ private common: CommonsService,
+ private apiProduct: ApiProductService
+ ) {
+ }
+
+ ngOnInit(): void {
+ this.init();
+ }
+
+
+
+
+ public init(): void {
+ this.searchForm = this.form.group({
+ type: [null],
+ productId: [null],
+ });
+ this.validateForm = this.form.group({
+ productId: [null],
+ type: [null, [Validators.required]],
+ percentage: [null, [Validators.required]],
+ });
+
+
+ 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.apiProduct.getProductConfig(whereObject, data => {
+ if (data['return_code'] === '000000') {
+ console.log(data);
+ 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 getEdit(id?: number): void {
+ if (id != null) {
+ this.id = id;
+ this.edit = true;
+ this.apiProduct.findProductConfig(id, data => {
+ data['return_data']['productPlatform'] = data['return_data']['productPlatformString'].substring(0 , data['return_data']['productPlatformString'].length - 1).split(',');
+ data['return_data']['payType'] = data['return_data']['productPayTypeString'].substring(0 , data['return_data']['productPayTypeString'].length - 1).split(',');
+ this.validateForm.patchValue(data['return_data']);
+ this.isVisible = true;
+ });
+ } else {
+ this.validateForm.reset();
+ this.isVisible = true;
+ this.edit = false;
+ }
+ }
+
+ handleOk(): void {
+ console.log(this.validateForm.value);
+ const wait = this.message.loading('提交中..', { nzDuration: 0 }).messageId;
+ // tslint:disable-next-line:forin
+ for (const i in this.validateForm.controls) {
+ this.validateForm.controls[i].markAsDirty();
+ this.validateForm.controls[i].updateValueAndValidity();
+ if (this.validateForm.controls[i].errors != null) {
+ this.message.error('必填项不能为空');
+ this.message.remove(wait);
+ return;
+ }
+ }
+
+ if (this.edit) {
+ this.validateForm.value['id'] = this.id;
+ this.apiProduct.updateProductConfig(this.validateForm.value, data => {
+ this.message.remove(wait);
+ if (data['return_code'] === '000000') {
+ this.message.success('修改成功');
+ this.getRequest(false, this.searchForm.value);
+ this.validateForm.reset();
+ this.isVisible = false;
+ } else {
+ this.message.error(data['return_msg']);
+ }
+ });
+ } else {
+ this.apiProduct.productConfig(this.validateForm.value, data => {
+ this.message.remove(wait);
+ if (data['return_code'] === '000000') {
+ this.message.success('添加成功');
+ this.getRequest(false, this.searchForm.value);
+ this.isVisible = false;
+ this.validateForm.reset();
+ } else {
+ this.message.error(data['return_msg']);
+ }
+ });
+ }
+
+ }
+
+ handleCancel(): void {
+ this.validateForm.reset();
+ this.isVisible = false;
+ }
+
+ public getForbiddenUserD(idPost): void {
+
+ this.common.showConfirm('是否删除', item => {
+ if (item) {
+ this.recharge.editPriceStatus({
+ id: idPost,
+ status: 0
+ }, data => {
+ if (data['return_code'] === '000000') {
+ this.message.success('删除成功');
+ this.getRequest(false, this.searchForm.value);
+ } else {
+ this.message.error(data['return_msg']);
+ }
+ });
+ }
+ });
+ }
+
+ // 详情
+ public getDetail(id: number): void {
+ this.id = id;
+ this.apiProduct.findStarbucksProducts(id, data => {
+ if (data['return_code'] === '000000') {
+ this.data = data['return_data'];
+ this.isVisibleProduct = true;
+ } else {
+ this.message.error(data['return_msg']);
+ }
+ });
+ }
+
+
+
+
+}
diff --git a/src/app/admin/config-manage/third-product/third-product.component.ts b/src/app/admin/config-manage/third-product/third-product.component.ts
index dd6a9df..56b6185 100644
--- a/src/app/admin/config-manage/third-product/third-product.component.ts
+++ b/src/app/admin/config-manage/third-product/third-product.component.ts
@@ -39,11 +39,6 @@ export class ThirdProductComponent implements OnInit {
realPrice = 0;
data = {};
- array = [{num: 1, productId: 28, cupSize: '中杯', temperature: '特别热', milk: '全脂牛奶', cream: '奶油', espresso: '浓缩', milkBubble: '奶泡'}];
- hero2 = {num: 2, productId: 28, cupSize: '中杯', temperature: '特别热', milk: '全脂牛奶', cream: '奶油', espresso: '浓缩', milkBubble: '奶泡'};
- hero3 = {num: 1, productId: 28, cupSize: '超大杯', temperature: '特别热', milk: '全脂牛奶', cream: '奶油', espresso: '浓缩', milkBubble: '奶泡'};
-
-
formatterPercent = (value: number): string => `${value == null ? 0 : value} %`;
parserPercent = (value: string): string => value.replace(' %', '');
diff --git a/src/app/sercices/integr-rebate.service.spec.ts b/src/app/sercices/integr-rebate.service.spec.ts
new file mode 100644
index 0000000..c3b9129
--- /dev/null
+++ b/src/app/sercices/integr-rebate.service.spec.ts
@@ -0,0 +1,16 @@
+import { TestBed } from '@angular/core/testing';
+
+import { IntegrRebateService } from './integr-rebate.service';
+
+describe('IntegrRebateService', () => {
+ let service: IntegrRebateService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(IntegrRebateService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/src/app/sercices/integr-rebate.service.ts b/src/app/sercices/integr-rebate.service.ts
new file mode 100644
index 0000000..3972d33
--- /dev/null
+++ b/src/app/sercices/integr-rebate.service.ts
@@ -0,0 +1,9 @@
+import { Injectable } from '@angular/core';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class IntegrRebateService {
+
+ constructor() { }
+}