From 020a1ce94d3955e36b4fe7ecd02fd7aa3be1abf0 Mon Sep 17 00:00:00 2001
From: Sum1Dream <418471657@qq.com>
Date: Mon, 18 Jul 2022 09:38:35 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E7=AC=AC=E4=B8=89=E6=96=B9?=
=?UTF-8?q?=E4=BA=A7=E5=93=81=E9=85=8D=E7=BD=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../member-product.component.html | 162 ++++++++++++
.../member-product.component.scss | 0
.../member-product.component.ts | 234 ++++++++++++++++++
.../third-product.component.html | 189 ++++++++++++++
.../third-product.component.scss | 0
.../third-product/third-product.component.ts | 231 +++++++++++++++++
6 files changed, 816 insertions(+)
create mode 100644 src/app/admin/config-manage/member-product/member-product.component.html
create mode 100644 src/app/admin/config-manage/member-product/member-product.component.scss
create mode 100644 src/app/admin/config-manage/member-product/member-product.component.ts
create mode 100644 src/app/admin/config-manage/third-product/third-product.component.html
create mode 100644 src/app/admin/config-manage/third-product/third-product.component.scss
create mode 100644 src/app/admin/config-manage/third-product/third-product.component.ts
diff --git a/src/app/admin/config-manage/member-product/member-product.component.html b/src/app/admin/config-manage/member-product/member-product.component.html
new file mode 100644
index 0000000..c9d1386
--- /dev/null
+++ b/src/app/admin/config-manage/member-product/member-product.component.html
@@ -0,0 +1,162 @@
+
+
+
+
+
+
+
+
+
+
共计 {{total}} 条数据
+
+
+
+
+
+
+ 编号 |
+ 产品名称 |
+ 产品编码 |
+ 成本价 |
+ 面值 |
+ 创建时间 |
+ 操作 |
+
+
+
+
+ {{i + 1}} |
+ {{data.name}} |
+ {{data.productId}} |
+ {{data.costPrice + "RMB"}} |
+ {{data.price + "RMB"}} |
+ {{data.createTime | date: 'yyyy-MM-dd HH:mm'}} |
+
+ 更多操作
+
+
+
+ |
+
+
+
+
+
+
+
+
diff --git a/src/app/admin/config-manage/member-product/member-product.component.scss b/src/app/admin/config-manage/member-product/member-product.component.scss
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/admin/config-manage/member-product/member-product.component.ts b/src/app/admin/config-manage/member-product/member-product.component.ts
new file mode 100644
index 0000000..d18ef28
--- /dev/null
+++ b/src/app/admin/config-manage/member-product/member-product.component.ts
@@ -0,0 +1,234 @@
+import { Component, OnInit } from '@angular/core';
+import {environment} from '../../../../environments/environment';
+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 {CommonsService} from '../../../services/commons.service';
+import {ApiProductService} from '../../../services/api-product.service';
+import {FormBuilder, FormGroup, Validators} from '_@angular_forms@9.0.7@@angular/forms';
+import {NzMessageService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd';
+import {Router} from '_@angular_router@9.0.7@@angular/router';
+import {ConfigService} from "../../../services/config.service";
+
+@Component({
+ selector: 'app-member-product',
+ templateUrl: './member-product.component.html',
+ styleUrls: ['./member-product.component.scss']
+})
+export class MemberProductComponent implements OnInit {
+
+
+ WEB_SERVE_URL = environment.imageUrl;
+ searchForm: FormGroup; // 搜索框
+ validateForm: FormGroup; // 添加框
+ requestData = []; // 列表数据
+ productArray = []; // 价格数据
+ priceTypeArray = []; // 支付类型数据
+ productPlatformArray = []; // 展示平台数据
+
+ total: number; // 页码
+ pageNum = 1; // 页码
+ pageSize = 10; // 条码
+ loading = true;
+ isVisible = false;
+ isVisibleProduct = false;
+ id: number;
+ edit = false;
+ payPrice;
+ isVisibleGoods = false;
+ realPrice = 0;
+ data = {};
+ goodsTypeData;
+ brandData;
+
+ formatterPercent = (value: number): string => `${value == null ? 0 : value} RMB`;
+ parserPercent = (value: string): string => value.replace(' RMB', '');
+
+ constructor(
+ private form: FormBuilder,
+ private recharge: RechargeService,
+ private discount: DiscountService,
+ private coupon: CouponService,
+ private iconService: IconService,
+ private message: NzMessageService,
+ private config: ConfigService,
+ private router: Router,
+ private common: CommonsService,
+ private apiProduct: ApiProductService
+ ) {
+ }
+
+ ngOnInit(): void {
+ this.init();
+ this.getInitData();
+ }
+
+ // 获取初始化数据
+ private getInitData(): void {
+ const params = {
+ pageNum: 1,
+ userService: '会员充值',
+ pageSize: 10000
+ };
+ this.config.getListGoodsType(params , data => {
+ this.goodsTypeData = data['return_data'].list;
+ });
+
+ }
+
+ public getBrandByList(e): void {
+
+ const params = {
+ pageNum: 1,
+ pageSize: 10000,
+ goodTypeId: e
+ };
+
+ this.config.getBrandByList(params , data => {
+ this.brandData = data['return_data'].list;
+ });
+ }
+
+ public init(): void {
+ this.searchForm = this.form.group({
+ name: [null],
+ });
+ this.validateForm = this.form.group({
+ sort: [null],
+ price: [null, [Validators.required]],
+ costPrice: [null, [Validators.required]],
+ brandId: [null, [Validators.required]],
+ productId: [null, [Validators.required]],
+ typeId: [null, [Validators.required]],
+ name: [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.getListApiMemberProduct(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 getEdit(id?: number): void {
+ if (id != null) {
+ this.id = id;
+ this.edit = true;
+ this.apiProduct.findMemberProductById(id, data => {
+ 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.updateMemberProduct(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.insertMemberProduct(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.html b/src/app/admin/config-manage/third-product/third-product.component.html
new file mode 100644
index 0000000..e78c2d2
--- /dev/null
+++ b/src/app/admin/config-manage/third-product/third-product.component.html
@@ -0,0 +1,189 @@
+
+
+
+
+
+
+
+
+
+
共计 {{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'}} |
+
+ 更多操作
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+ {{data['categoryName']}}
+ {{data['name']}}
+
+ {{data['cupSize']}}
+ {{data['temperature']}}
+ {{data['cream']}}
+ {{data['espresso']}}
+ {{data['milk']}}
+ {{data['milkBubble']}}
+ ¥{{data['marketTallPrice']}}
+ ¥{{data['marketGrandePrice']}}
+ ¥{{data['marketVentiPrice']}}
+ ¥{{data['salesTallPrice']}}
+ ¥{{data['salesGrandePrice']}}
+ ¥{{data['salesVentiPrice']}}
+
+
diff --git a/src/app/admin/config-manage/third-product/third-product.component.scss b/src/app/admin/config-manage/third-product/third-product.component.scss
new file mode 100644
index 0000000..e69de29
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
new file mode 100644
index 0000000..f0f8d29
--- /dev/null
+++ b/src/app/admin/config-manage/third-product/third-product.component.ts
@@ -0,0 +1,231 @@
+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-third-product',
+ templateUrl: './third-product.component.html',
+ styleUrls: ['./third-product.component.scss']
+})
+export class ThirdProductComponent 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 = {};
+
+ 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(' %', '');
+
+ 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();
+ this.getInitData();
+
+ }
+
+ // 获取初始化数据
+ private getInitData(): void {
+ // 获取星巴克数据
+ this.apiProduct.getStarbucksProducts(data => {
+ this.productArray = data['return_data'];
+ });
+ // 获取支付类型
+ this.common.getDictionary('PAY_TYPE ', data => {
+ this.priceTypeArray = data['return_data'];
+ });
+ // 获取展示平台
+ this.common.getDictionary('SHOW_PLATFORM ', data => {
+ this.productPlatformArray = data['return_data'];
+ });
+
+ }
+
+
+ public init(): void {
+ this.searchForm = this.form.group({
+ productType: [null],
+ productName: [null],
+ });
+ this.validateForm = this.form.group({
+ discount: [null, [Validators.required]],
+ integralDiscount: [0],
+ productPlatform: [null, [Validators.required]],
+ payType: [null, [Validators.required]],
+ productType: [null, [Validators.required]],
+ productName: [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.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']);
+ }
+ });
+ }
+
+
+
+
+}