提交代码

pull/1/head
胡锐 2 years ago
commit 3d60914d5c
  1. 10
      src/app/admin/api-merchants/list/list.component.html
  2. 6
      src/app/admin/api-merchants/list/list.component.ts
  3. 4
      src/app/admin/config-manage/brand/brand.component.html
  4. 371
      src/app/admin/config-manage/brand/brand.component.ts
  5. 4
      src/app/admin/config-manage/config-manage-routing.module.ts
  6. 26
      src/app/admin/config-manage/config-manage.module.ts
  7. 9
      src/app/admin/config-manage/goods-type/goods-type.component.html
  8. 350
      src/app/admin/config-manage/goods-type/goods-type.component.ts
  9. 162
      src/app/admin/config-manage/member-product/member-product.component.html
  10. 0
      src/app/admin/config-manage/member-product/member-product.component.scss
  11. 234
      src/app/admin/config-manage/member-product/member-product.component.ts
  12. 189
      src/app/admin/config-manage/third-product/third-product.component.html
  13. 0
      src/app/admin/config-manage/third-product/third-product.component.scss
  14. 231
      src/app/admin/config-manage/third-product/third-product.component.ts
  15. 4
      src/app/admin/index/index.module.ts
  16. 12
      src/app/admin/index/index/index.component.html
  17. 3
      src/app/admin/index/index/index.component.less
  18. 1
      src/app/admin/merchant-store/store-edit/store-edit.component.ts
  19. 2
      src/app/admin/recharge-order/order-list/order-list.component.html
  20. 45
      src/app/admin/recharge-order/price-list/price-list.component.html
  21. 38
      src/app/admin/recharge-order/price-list/price-list.component.ts
  22. 2
      src/app/admin/recharge-order/user/user.component.html
  23. 2
      src/app/app-common.module.ts
  24. 1
      src/app/pipes/index.ts
  25. 19
      src/app/pipes/recharge-pipe/platform.pipe.ts
  26. 3
      src/app/pipes/recharge-price/recharge-platform.pipe.ts
  27. 128
      src/app/services/api-product.service.ts
  28. 3
      src/app/services/config.service.ts
  29. 25
      src/app/services/recharge.service.ts
  30. 4
      src/environments/environment.ts

@ -206,7 +206,7 @@
</nz-table>
</nz-modal>
<nz-modal [(nzVisible)]="configVisible" nzTitle="产品配置" (nzOnCancel)="configVisible = false" (nzOnOk)="handleOkConfig()">
<nz-modal [(nzVisible)]="configVisible" nzTitle="产品配置" (nzOnCancel)="handleCancelConfig()" (nzOnOk)="handleOkConfig()">
<form nz-form [formGroup]="configValidateForm" class="login-form">
<nz-form-item *ngIf="!edit">
<nz-form-label [nzSpan]="6" nzRequired>选择产品</nz-form-label>
@ -252,9 +252,8 @@
<th nzWidth="90px">折扣金额</th>
<th nzWidth="120px">运营商</th>
<th nzWidth="90px">充值类型</th>
<th nzWidth="120px">创建时间</th>
<th nzRight nzWidth="80px">状态</th>
<th nzRight nzWidth="160px">操作</th>
<th nzWidth="80px">状态</th>
<th nzRight nzWidth="100px">操作</th>
</tr>
</thead>
<tbody>
@ -264,8 +263,7 @@
<td>{{data.discountPrice}}</td>
<td>{{data.operatorType | rechargePrice}}</td>
<td>{{data.phoneRechargeType== 1? '快充':'慢充'}}</td>
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td nzRight>{{data.configStatus== 101? '正常':'下架中'}}</td>
<td>{{data.configStatus== 101? '正常':'下架中'}}</td>
<td nzRight class="table-td-operation">
<a *ngIf="data.configStatus != 101" (click)="getEditConfigProduct(data.apiConfigProductId)">编辑</a>
<a style="margin-left: 20px;" (click)='getEditConfigProductStatus(data.apiConfigProductId , data.configStatus)'>{{data.configStatus === 101 ? '下线': '上线'}}</a>

@ -405,6 +405,7 @@ export class ListComponent implements OnInit {
this.apiMerchants.configApiProduct(this.configValidateForm.value , data => {
if (data['return_code'] === '000000') {
this.configVisible = false;
this.configValidateForm.reset();
this.message.success('提交成功');
} else {
this.message.error(data['return_msg']);
@ -462,4 +463,9 @@ export class ListComponent implements OnInit {
});
}
handleCancelConfig() {
this.configVisible = false;
this.configValidateForm.reset();
}
}

@ -69,14 +69,14 @@
<td>{{i+1}}</td>
<td>{{data.title}}</td>
<td>
<img class="head_img" src="{{WEB_SERVE_URL + data.img}}" onerror="this.src='../../../../assets/admin/navigation/icon.png'" alt="">
<img class="head_img" src="{{imageUrl + data.img}}" onerror="this.src='../../../../assets/admin/navigation/icon.png'" alt="">
</td>
<td>{{data.createdTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>{{data.updatedTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td nzRight="0px" class="table-td-operation">
<a (click)="getEdit(data.id)">编辑</a>
<nz-divider nzType="vertical"></nz-divider>
<a (click)="getDetail(data.id)">删除</a>
<a (click)="showDeleteConfirm(data.id)">删除</a>
</td>
</tbody>
</nz-table>

@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core';
import {Component, OnInit} from '@angular/core';
import {environment} from '../../../../environments/environment';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {IconService} from '../../../services/icon.service';
@ -7,212 +7,213 @@ import {Router} from '@angular/router';
import {ConfigService} from '../../../services/config.service';
function getBase64(file: File): Promise<string | ArrayBuffer | null> {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result);
reader.onerror = error => reject(error);
});
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result);
reader.onerror = error => reject(error);
});
}
@Component({
selector: 'app-brand',
templateUrl: './brand.component.html',
styleUrls: ['./brand.component.scss']
selector: 'app-brand',
templateUrl: './brand.component.html',
styleUrls: ['./brand.component.scss']
})
export class BrandComponent implements OnInit {
WEB_SERVE_URL = environment.baseUrl;
imageUrl = environment.imageUrl;
searchForm: FormGroup; // 搜索框
requestData = []; // 列表数据
total: number; // 页码
pageNum = 1; // 页码
pageSize = 10; // 条码
loading = true;
isVisible = false;
editFlag = false;
id: number;
validateForm!: FormGroup;
imgFile = [];
previewImage: string | undefined = '';
previewVisible = false;
goodTypData;
constructor(
private form: FormBuilder,
private config: ConfigService,
private iconService: IconService,
private message: NzMessageService,
private router: Router,
private modalService: NzModalService,
private fb: FormBuilder,
) {
}
WEB_SERVE_URL = environment.baseUrl;
searchForm: FormGroup; // 搜索框
requestData = []; // 列表数据
total: number; // 页码
pageNum = 1; // 页码
pageSize = 10; // 条码
loading = true;
isVisible = false;
editFlag = false;
id: number;
validateForm!: FormGroup;
imgFile = [];
previewImage: string | undefined = '';
previewVisible = false;
goodTypData;
constructor(
private form: FormBuilder,
private config: ConfigService,
private iconService: IconService,
private message: NzMessageService,
private router: Router,
private modalService: NzModalService,
private fb: FormBuilder,
) {
}
ngOnInit(): void {
this.init();
}
public init(): void {
this.searchForm = this.form.group({
title: [null],
goodTypeId: [null],
});
this.validateForm = this.fb.group({
title: [null, [Validators.required]],
goodTypeId: [null, [Validators.required]],
});
this.getRequest(true, this.searchForm.value);
ngOnInit(): void {
this.init();
}
this.config.getListGoodsType({
pageNum: 1 ,
pageSize: 1000000 ,
} , data => {
this.goodTypData = data['return_data']['list'];
});
}
public init(): void {
this.searchForm = this.form.group({
title: [null],
goodTypeId: [null],
});
this.validateForm = this.fb.group({
title: [null, [Validators.required]],
goodTypeId: [null, [Validators.required]],
});
this.getRequest(true, this.searchForm.value);
// 图片查看
handlePreview = async (file: NzUploadFile) => {
if (!file.url && !file.preview) {
// tslint:disable-next-line:no-non-null-assertion
file.preview = await getBase64(file.originFileObj!);
this.config.getListGoodsType({
pageNum: 1,
pageSize: 1000000,
}, data => {
this.goodTypData = data['return_data']['list'];
});
}
this.previewImage = file.url || file.preview;
this.previewVisible = true;
}
// 查询列表
public getRequest(reset: boolean = false, whereObject: object) {
this.loading = false;
if (reset) {
this.pageNum = 1;
// 图片查看
handlePreview = async (file: NzUploadFile) => {
if (!file.url && !file.preview) {
// tslint:disable-next-line:no-non-null-assertion
file.preview = await getBase64(file.originFileObj!);
}
this.previewImage = file.url || file.preview;
this.previewVisible = true;
}
whereObject['pageNum'] = this.pageNum;
whereObject['pageSize'] = this.pageSize;
this.config.getBrandByList(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 {
this.validateForm.reset();
this.editFlag = false;
this.imgFile = [];
this.id = id;
if (id != null) {
this.editFlag = true;
this.config.findById(id , data => {
data['return_data'].goodTypeId = String(data['return_data'].goodTypeId);
if (data['return_data']['img'] != null && data['return_data']['img'] !== '') {
const img = String(data['return_data']['img']);
const imgArray = [];
imgArray.push(
{
uid: 1,
name: img,
status: 'done',
url: environment.imageUrl + img
});
this.imgFile = imgArray;
// 查询列表
public getRequest(reset: boolean = false, whereObject: object) {
this.loading = false;
if (reset) {
this.pageNum = 1;
}
this.validateForm.patchValue(data['return_data']);
});
whereObject['pageNum'] = this.pageNum;
whereObject['pageSize'] = this.pageSize;
this.config.getBrandByList(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();
}
this.isVisible = true;
}
// 查看详情
public getDetail(id: number): void {
this.router.navigate(['/admin/company/company-detail'], {
queryParams: {
companyId: id
}
}).then(r => console.log(r));
}
handleOk(): void {
// 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('必填项不能为空');
return;
}
// 修改
public getEdit(id?: number): void {
this.validateForm.reset();
this.editFlag = false;
this.imgFile = [];
this.id = id;
if (id != null) {
this.editFlag = true;
this.config.findById(id, data => {
data['return_data'].goodTypeId = String(data['return_data'].goodTypeId);
if (data['return_data']['img'] != null && data['return_data']['img'] !== '') {
const img = String(data['return_data']['img']);
const imgArray = [];
imgArray.push(
{
uid: 1,
name: img,
status: 'done',
url: environment.imageUrl + img
});
this.imgFile = imgArray;
}
this.validateForm.patchValue(data['return_data']);
});
}
this.isVisible = true;
}
if (this.imgFile.length !== 0) {
if (this.imgFile[0]['response'] != null) {
this.validateForm.value.img = this.imgFile[0]['response']['return_data'][0];
} else {
this.validateForm.value.img = this.imgFile[0].name;
}
// 查看详情
public getDetail(id: number): void {
this.router.navigate(['/admin/company/company-detail'], {
queryParams: {
companyId: id
}
}).then(r => console.log(r));
}
if (this.editFlag) {
this.validateForm.value.id = this.id;
this.config.updateBrand(this.validateForm.value, data => {
if (data['return_code'] === '000000') {
this.message.success('修改成功');
this.isVisible = false;
this.getRequest(true, this.searchForm.value);
} else {
this.message.create('error', data['return_msg']);
handleOk(): void {
// 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('必填项不能为空');
return;
}
}
if (this.imgFile.length !== 0) {
if (this.imgFile[0]['response'] != null) {
this.validateForm.value.img = this.imgFile[0]['response']['return_data'][0];
} else {
this.validateForm.value.img = this.imgFile[0].name;
}
}
});
} else {
this.config.insertBrand(this.validateForm.value, data => {
if (data['return_code'] === '000000') {
this.message.success('添加成功');
this.isVisible = false;
this.getRequest(true, this.searchForm.value);
if (this.editFlag) {
this.validateForm.value.id = this.id;
this.config.updateBrand(this.validateForm.value, data => {
if (data['return_code'] === '000000') {
this.isVisible = false;
this.message.success('修改成功');
this.getRequest(true, this.searchForm.value);
} else {
this.message.create('error', data['return_msg']);
}
});
} else {
this.message.create('error', data['return_msg']);
console.log('123');
this.config.insertBrand(this.validateForm.value, data => {
if (data['return_code'] === '000000') {
this.isVisible = false;
this.message.success('添加成功');
this.getRequest(true, this.searchForm.value);
} else {
this.message.create('error', data['return_msg']);
}
});
}
});
}
}
handleCancel(): void {
this.isVisible = false;
}
handleCancel(): void {
this.isVisible = false;
}
// 對話框删除
showDeleteConfirm(id): void {
this.modalService.confirm({
nzTitle: '确定删除',
nzOkText: '是',
nzOnOk: () => this.onDelete(id),
nzCancelText: '否',
});
}
onDelete(ids) {
this.config.getByDelete({
id: ids
}, data => {
if (data['return_code'] === '000000') {
this.message.create('success', `删除成功!`);
this.getRequest(true, this.searchForm.value);
} else {
this.message.create('error', data['return_msg']);
}
});
}
// 對話框删除
showDeleteConfirm(id): void {
this.modalService.confirm({
nzTitle: '确定删除',
nzOkText: '是',
nzOnOk: () => this.onDelete(id),
nzCancelText: '否',
});
}
onDelete(ids) {
this.config.getByDelete({
id: ids
}, data => {
if (data['return_code'] === '000000') {
this.message.create('success', `删除成功!`);
this.getRequest(true, this.searchForm.value);
} else {
this.message.create('error', data['return_msg']);
}
});
}
}

@ -2,11 +2,15 @@ import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
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';
const routes: Routes = [
{ path: 'goods-type', component: GoodsTypeComponent },
{ path: 'brand', component: BrandComponent },
{ path: 'third-product', component: ThirdProductComponent },
{ path: 'member-product', component: MemberProductComponent },
];
@NgModule({

@ -9,19 +9,23 @@ import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module';
import {RegionSelectorModule} from '../../common/region-selector/region-selector.module';
import {NgZorroAntdModule} from 'ng-zorro-antd';
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';
@NgModule({
declarations: [GoodsTypeComponent, BrandComponent],
imports: [
CommonModule,
ConfigManageRoutingModule,
NgZorroAntdModule,
SeparateModule,
ReactiveFormsModule,
FormsModule,
BreadcrumbModule,
RegionSelectorModule
]
declarations: [GoodsTypeComponent, BrandComponent, ThirdProductComponent, MemberProductComponent],
imports: [
CommonModule,
ConfigManageRoutingModule,
NgZorroAntdModule,
SeparateModule,
ReactiveFormsModule,
FormsModule,
BreadcrumbModule,
RegionSelectorModule,
AppCommonModule
]
})
export class ConfigManageModule { }

@ -59,7 +59,7 @@
<td>{{i+1}}</td>
<td>{{data.title}}</td>
<td>
<img class="head_img" src="{{WEB_SERVE_URL + data.img}}" onerror="this.src='../../../../assets/admin/navigation/icon.png'" alt="">
<img class="head_img" src="{{imageUrl + data.img}}" onerror="this.src='../../../../assets/admin/navigation/icon.png'" alt="">
</td>
<td>{{data.createdTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>{{data.updatedTime | date: 'yyyy-MM-dd HH:mm'}}</td>
@ -80,6 +80,13 @@
<input nz-input placeholder="请输入标题..." [formControlName]="'title'" />
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="4">使用业务</nz-form-label>
<nz-form-control [nzSpan]="12">
<input nz-input placeholder="请输入使用业务..." [formControlName]="'userService'" />
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired>图片</nz-form-label>
<nz-form-control [nzSpan]="20" nzErrorTip="请上传图片!">

@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core';
import {Component, OnInit} from '@angular/core';
import {environment} from '../../../../environments/environment';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {IconService} from '../../../services/icon.service';
@ -7,201 +7,203 @@ import {ConfigService} from '../../../services/config.service';
import {Router} from '@angular/router';
function getBase64(file: File): Promise<string | ArrayBuffer | null> {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result);
reader.onerror = error => reject(error);
});
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result);
reader.onerror = error => reject(error);
});
}
@Component({
selector: 'app-goods-type',
templateUrl: './goods-type.component.html',
styleUrls: ['./goods-type.component.scss']
selector: 'app-goods-type',
templateUrl: './goods-type.component.html',
styleUrls: ['./goods-type.component.scss']
})
export class GoodsTypeComponent implements OnInit {
WEB_SERVE_URL = environment.baseUrl;
searchForm: FormGroup; // 搜索框
requestData = []; // 列表数据
total: number; // 页码
pageNum = 1; // 页码
pageSize = 10; // 条码
loading = true;
isVisible = false;
editFlag = false;
id: number;
validateForm!: FormGroup;
imgFile = [];
previewImage: string | undefined = '';
previewVisible = false;
constructor(
private form: FormBuilder,
private config: ConfigService,
private iconService: IconService,
private message: NzMessageService,
private router: Router,
private modalService: NzModalService,
private fb: FormBuilder,
) {
}
ngOnInit(): void {
this.init();
}
public init(): void {
this.searchForm = this.form.group({
title: [null],
});
this.validateForm = this.fb.group({
title: [null, [Validators.required]],
});
this.getRequest(true, this.searchForm.value);
}
// 图片查看
handlePreview = async (file: NzUploadFile) => {
if (!file.url && !file.preview) {
// tslint:disable-next-line:no-non-null-assertion
file.preview = await getBase64(file.originFileObj!);
WEB_SERVE_URL = environment.baseUrl;
imageUrl = environment.imageUrl;
searchForm: FormGroup; // 搜索框
requestData = []; // 列表数据
total: number; // 页码
pageNum = 1; // 页码
pageSize = 10; // 条码
loading = true;
isVisible = false;
editFlag = false;
id: number;
validateForm!: FormGroup;
imgFile = [];
previewImage: string | undefined = '';
previewVisible = false;
constructor(
private form: FormBuilder,
private config: ConfigService,
private iconService: IconService,
private message: NzMessageService,
private router: Router,
private modalService: NzModalService,
private fb: FormBuilder,
) {
}
this.previewImage = file.url || file.preview;
this.previewVisible = true;
}
// 查询列表
public getRequest(reset: boolean = false, whereObject: object) {
ngOnInit(): void {
this.init();
}
this.loading = false;
if (reset) {
this.pageNum = 1;
public init(): void {
this.searchForm = this.form.group({
title: [null],
});
this.validateForm = this.fb.group({
title: [null, [Validators.required]],
userService: [null],
});
this.getRequest(true, this.searchForm.value);
}
whereObject['pageNum'] = this.pageNum;
whereObject['pageSize'] = this.pageSize;
this.config.getListGoodsType(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 {
this.id = id;
if (id != null) {
this.editFlag = true;
this.config.getGoodsTypeById(id , data => {
if (data['return_data']['img'] != null && data['return_data']['img'] !== '') {
const img = String(data['return_data']['img']);
const imgArray = [];
imgArray.push(
{
uid: 1,
name: img,
status: 'done',
url: environment.imageUrl + img
});
this.imgFile = imgArray;
// 图片查看
handlePreview = async (file: NzUploadFile) => {
if (!file.url && !file.preview) {
// tslint:disable-next-line:no-non-null-assertion
file.preview = await getBase64(file.originFileObj!);
}
this.validateForm.patchValue(data['return_data']);
});
} else {
this.validateForm.reset();
this.editFlag = false;
this.imgFile = [];
this.previewImage = file.url || file.preview;
this.previewVisible = true;
}
this.isVisible = true;
}
// 查看详情
public getDetail(id: number): void {
this.router.navigate(['/admin/company/company-detail'], {
queryParams: {
companyId: id
}
}).then(r => console.log(r));
}
handleOk(): void {
// 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('必填项不能为空');
return;
}
// 查询列表
public getRequest(reset: boolean = false, whereObject: object) {
this.loading = false;
if (reset) {
this.pageNum = 1;
}
whereObject['pageNum'] = this.pageNum;
whereObject['pageSize'] = this.pageSize;
this.config.getListGoodsType(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']);
}
});
}
if (this.imgFile.length !== 0) {
if (this.imgFile[0]['response'] != null) {
this.validateForm.value.img = this.imgFile[0]['response']['return_data'][0];
} else {
this.validateForm.value.img = this.imgFile[0].name;
}
// 重置
public resetForm(): void {
this.searchForm.reset();
}
if (this.editFlag) {
this.validateForm.value.id = this.id;
this.config.updateGoodsType(this.validateForm.value, data => {
if (data['return_code'] === '000000') {
this.message.success('修改成功');
this.isVisible = false;
this.getRequest(true, this.searchForm.value);
// 修改
public getEdit(id?: number): void {
this.id = id;
if (id != null) {
this.editFlag = true;
this.config.getGoodsTypeById(id, data => {
if (data['return_data']['img'] != null && data['return_data']['img'] !== '') {
const img = String(data['return_data']['img']);
const imgArray = [];
imgArray.push(
{
uid: 1,
name: img,
status: 'done',
url: environment.imageUrl + img
});
this.imgFile = imgArray;
}
this.validateForm.patchValue(data['return_data']);
});
} else {
this.message.create('error', data['return_msg']);
this.validateForm.reset();
this.editFlag = false;
this.imgFile = [];
}
this.isVisible = true;
}
// 查看详情
public getDetail(id: number): void {
this.router.navigate(['/admin/company/company-detail'], {
queryParams: {
companyId: id
}
}).then(r => console.log(r));
}
handleOk(): void {
// 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('必填项不能为空');
return;
}
}
});
} else {
this.config.insertGoodsType(this.validateForm.value, data => {
if (data['return_code'] === '000000') {
this.message.success('添加成功');
this.isVisible = false;
this.getRequest(true, this.searchForm.value);
if (this.imgFile.length !== 0) {
if (this.imgFile[0]['response'] != null) {
this.validateForm.value.img = this.imgFile[0]['response']['return_data'][0];
} else {
this.validateForm.value.img = this.imgFile[0].name;
}
}
if (this.editFlag) {
this.validateForm.value.id = this.id;
this.config.updateGoodsType(this.validateForm.value, data => {
if (data['return_code'] === '000000') {
this.message.success('修改成功');
this.isVisible = false;
this.getRequest(true, this.searchForm.value);
} else {
this.message.create('error', data['return_msg']);
}
});
} else {
this.message.create('error', data['return_msg']);
this.config.insertGoodsType(this.validateForm.value, data => {
if (data['return_code'] === '000000') {
this.message.success('添加成功');
this.isVisible = false;
this.getRequest(true, this.searchForm.value);
} else {
this.message.create('error', data['return_msg']);
}
});
}
});
}
}
handleCancel(): void {
this.isVisible = false;
}
handleCancel(): void {
this.isVisible = false;
}
// 對話框删除
showDeleteConfirm(id): void {
this.modalService.confirm({
nzTitle: '确定删除',
nzOkText: '是',
nzOnOk: () => this.onDelete(id),
nzCancelText: '否',
});
}
onDelete(ids) {
this.config.getGoodsTypeByDelete({
id: ids
}, data => {
if (data['return_code'] === '000000') {
this.message.create('success', `删除成功!`);
this.getRequest(true, this.searchForm.value);
} else {
this.message.create('error', data['return_msg']);
}
});
}
// 對話框删除
showDeleteConfirm(id): void {
this.modalService.confirm({
nzTitle: '确定删除',
nzOkText: '是',
nzOnOk: () => this.onDelete(id),
nzCancelText: '否',
});
}
onDelete(ids) {
this.config.getGoodsTypeByDelete({
id: ids
}, data => {
if (data['return_code'] === '000000') {
this.message.create('success', `删除成功!`);
this.getRequest(true, this.searchForm.value);
} else {
this.message.create('error', data['return_msg']);
}
});
}
}

@ -0,0 +1,162 @@
<!-- start 面包屑 -->
<app-breadcrumb></app-breadcrumb>
<!-- end 面包屑 -->
<!--条件搜索-->
<div class="inner-content">
<form nz-form [formGroup]="searchForm" (ngSubmit)="getRequest(true , searchForm.value)">
<div nz-row>
<div nz-col nzSpan="8">
<nz-form-item>
<nz-form-label [nzSpan]="6">产品名称</nz-form-label>
<nz-form-control [nzSpan]="16">
<input nz-input formControlName="name"/>
</nz-form-control>
</nz-form-item>
</div>
</div>
<div nz-row>
<div nz-col nzSpan="24" class="search-button">
<button nz-button nzType="primary"><i nz-icon nzType="search" nzTheme="outline"></i>搜索</button>
<button nz-button nzType="default" (click)="resetForm()"><i nz-icon nzType="reload"
nzTheme="outline"></i>重置
</button>
</div>
</div>
</form>
</div>
<div class="inner-content">
<span>共计 {{total}} 条数据</span>
<div class="operating-button">
<button nz-button nzType="primary" class="right-btn" (click)="getEdit()"><i nz-icon nzType="plus" nzTheme="outline"></i>添加</button>
</div>
<nz-table
class="table"
#ajaxTable
nzShowSizeChanger
[nzFrontPagination]="false"
[nzData]="requestData"
[nzLoading]="loading"
[nzTotal]="total"
[(nzPageIndex)]="pageNum"
[(nzPageSize)]="pageSize"
[nzScroll]="{ x: '1200px' }"
(nzPageIndexChange)="getRequest(false , searchForm.value)"
(nzPageSizeChange)="getRequest(false , searchForm.value)">
<thead nzSingleSort>
<tr>
<th nzWidth="60px">编号</th>
<th nzWidth="90px">产品名称</th>
<th nzWidth="90px">产品编码</th>
<th nzWidth="120px">成本价</th>
<th nzWidth="120px">面值</th>
<th nzWidth="120px">创建时间</th>
<th nzRight nzWidth="80px">操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of ajaxTable.data; let i = index">
<td>{{i + 1}}</td>
<td>{{data.name}}</td>
<td>{{data.productId}}</td>
<td>{{data.costPrice + "RMB"}}</td>
<td>{{data.price + "RMB"}}</td>
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td nzRight class="table-td-operation">
<a nz-dropdown [nzDropdownMenu]="menu">更多操作<i nz-icon nzType="down"></i></a>
<nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu nzSelectable>
<li nz-menu-item *ngIf="data.status != 1"><a (click)="getEdit(data.id)">编辑</a></li>
</ul>
</nz-dropdown-menu>
</td>
</tbody>
</nz-table>
</div>
<nz-modal [(nzVisible)]="isVisible" nzTitle="会员产品配置" (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()">
<form nz-form [formGroup]="validateForm" class="login-form">
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>产品名称</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请输入产品名称!">
<input nz-input placeholder="请输入产品名称..." [formControlName]="'name'" id="'name'" />
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>产品编号</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请输入产品编号!">
<input nz-input placeholder="请输入产品编号..." [formControlName]="'productId'" id="'productId'" />
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>产品分类</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请选择产品分类!">
<nz-select nzPlaceHolder="请选择产品分类" (ngModelChange)="getBrandByList($event)" [formControlName]="'typeId'">
<nz-option *ngFor="let item of goodsTypeData" [nzValue]="item.id" nzLabel="{{item.title}}"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>产品分类</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请选择产品分类!">
<nz-select nzPlaceHolder="请选择品牌" [formControlName]="'brandId'">
<nz-option *ngFor="let item of brandData" [nzValue]="item.id" nzLabel="{{item.title}}"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>成本价</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请输入成本价!">
<nz-input-number
style="width: 200px"
formControlName="costPrice"
[nzMin]="1"
[nzMax]="10000"
[nzStep]="1"
[nzPrecision]="2"
nzPrecisionMode="cut"
nzPlaceHolder="请输入成本价!"
[nzFormatter]="formatterPercent"
[nzParser]="parserPercent"
></nz-input-number>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>面值</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请输入面值!">
<nz-input-number
style="width: 200px"
formControlName="price"
[nzMin]="1"
[nzMax]="10000"
[nzStep]="1"
[nzPrecision]="2"
nzPrecisionMode="cut"
nzPlaceHolder="请输入面值!"
[nzFormatter]="formatterPercent"
[nzParser]="parserPercent"
></nz-input-number>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" >排序</nz-form-label>
<nz-form-control [nzSpan]="16">
<nz-input-number
style="width: 200px"
formControlName="sort"
[nzMin]="1"
[nzMax]="10000"
[nzStep]="1"
nzPlaceHolder="请输入排序!"
></nz-input-number>
</nz-form-control>
</nz-form-item>
</form>
</nz-modal>

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

@ -0,0 +1,189 @@
<!-- start 面包屑 -->
<app-breadcrumb></app-breadcrumb>
<!-- end 面包屑 -->
<!--条件搜索-->
<div class="inner-content">
<form nz-form [formGroup]="searchForm" (ngSubmit)="getRequest(true , searchForm.value)">
<div nz-row>
<div nz-col nzSpan="8">
<nz-form-item>
<nz-form-label [nzSpan]="6">产品名称</nz-form-label>
<nz-form-control [nzSpan]="16">
<input nz-input formControlName="productName"/>
</nz-form-control>
</nz-form-item>
</div>
<!-- <div nz-col nzSpan="8">-->
<!-- <nz-form-item>-->
<!-- <nz-form-label [nzSpan]="6">产品类型</nz-form-label>-->
<!-- <nz-form-control [nzSpan]="16">-->
<!-- <nz-select nzShowSearch nzAllowClear formControlName="productType" nzPlaceHolder="请选择价格状态">-->
<!-- <nz-option nzLabel="星巴克" [nzValue]="1"></nz-option>-->
<!-- <nz-option nzLabel="肯德基" [nzValue]="2"></nz-option>-->
<!-- </nz-select>-->
<!-- </nz-form-control>-->
<!-- </nz-form-item>-->
<!-- </div>-->
</div>
<div nz-row>
<div nz-col nzSpan="24" class="search-button">
<button nz-button nzType="primary"><i nz-icon nzType="search" nzTheme="outline"></i>搜索</button>
<button nz-button nzType="default" (click)="resetForm()"><i nz-icon nzType="reload"
nzTheme="outline"></i>重置
</button>
</div>
</div>
</form>
</div>
<div class="inner-content">
<span>共计 {{total}} 条数据</span>
<div class="operating-button">
<button nz-button nzType="primary" class="right-btn" (click)="getEdit()"><i nz-icon nzType="plus" nzTheme="outline"></i>添加</button>
</div>
<nz-table
class="table"
#ajaxTable
nzShowSizeChanger
[nzFrontPagination]="false"
[nzData]="requestData"
[nzLoading]="loading"
[nzTotal]="total"
[(nzPageIndex)]="pageNum"
[(nzPageSize)]="pageSize"
[nzScroll]="{ x: '1200px' }"
(nzPageIndexChange)="getRequest(false , searchForm.value)"
(nzPageSizeChange)="getRequest(false , searchForm.value)">
<thead nzSingleSort>
<tr>
<th nzWidth="60px">编号</th>
<!-- <th nzWidth="90px">产品类型</th>-->
<th nzWidth="90px">产品名称</th>
<th nzWidth="90px">利润比例</th>
<th nzWidth="120px">积分抵扣比例</th>
<th nzWidth="100px">支付方式</th>
<th nzWidth="100px">展示平台</th>
<th nzWidth="120px">创建时间</th>
<th nzRight nzWidth="80px">操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of ajaxTable.data; let i = index">
<td>{{i + 1}}</td>
<!-- <td>{{data.productType == 1 ? '星巴克' : '肯德基'}}</td>-->
<td>{{data.productName}}</td>
<td>{{data.discount + "%"}}</td>
<td>{{data.integralDiscount + "%"}}</td>
<td>{{data.productPayTypeString.substring(0 , data.productPayTypeString.length - 1)}}</td>
<td>{{data.productPlatformString.substring(0 , data.productPlatformString.length - 1)}}</td>
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td nzRight class="table-td-operation">
<a nz-dropdown [nzDropdownMenu]="menu">更多操作<i nz-icon nzType="down"></i></a>
<nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu nzSelectable>
<li nz-menu-item *ngIf="data.status != 1"><a (click)="getEdit(data.id)">编辑</a></li>
<!-- <li nz-menu-item *ngIf="data.status != 1"><a (click)="getForbiddenUserD(data.id)">删除</a></li>-->
</ul>
</nz-dropdown-menu>
</td>
</tbody>
</nz-table>
</div>
<nz-modal [(nzVisible)]="isVisible" nzTitle="产品配置" (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()">
<form nz-form [formGroup]="validateForm" class="login-form">
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>产品类型</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请选择产品类型!">
<nz-select nzShowSearch nzAllowClear formControlName="productType" nzPlaceHolder="请选择产品类型">
<nz-option nzLabel="星巴克" [nzValue]="1"></nz-option>
<nz-option nzLabel="肯德基" [nzValue]="2"></nz-option>
<nz-option nzLabel="充值产品" [nzValue]="3"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>展示平台</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请选择展示平台!">
<nz-select
nzMode="multiple"
formControlName="productPlatform"
nzPlaceHolder="请选择展示平台"
>
<nz-option *ngFor="let item of productPlatformArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>支付方式</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请选择支付方式!">
<nz-select
nzMode="multiple"
formControlName="payType"
nzPlaceHolder="请选择支付方式"
>
<nz-option *ngFor="let item of priceTypeArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>利润比例</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请输入利润比例!">
<nz-input-number
style="width: 200px"
formControlName="discount"
[nzMin]="1"
[nzMax]="100"
[nzStep]="1"
[nzPrecision]="2"
nzPrecisionMode="cut"
nzPlaceHolder="请输入利润比例!"
[nzFormatter]="formatterPercent"
[nzParser]="parserPercent"
></nz-input-number>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>积分支付比例</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请输入积分支付比例!">
<nz-input-number
style="width: 200px"
formControlName="integralDiscount"
[nzMin]="0"
[nzMax]="100"
[nzStep]="1"
[nzPrecision]="2"
nzPrecisionMode="cut"
nzPlaceHolder="请输入积分支付比例!"
[nzFormatter]="formatterPercent"
[nzParser]="parserPercent"
></nz-input-number>
</nz-form-control>
</nz-form-item>
</form>
</nz-modal>
<nz-modal [(nzVisible)]="isVisibleProduct" nzTitle="商品详情" nzWidth="1200" (nzOnOk)="isVisibleProduct = false"
(nzOnCancel)="isVisibleProduct = false">
<nz-descriptions nzBordered [nzColumn]="{ xxl: 4, xl: 3, lg: 3, md: 3, sm: 2, xs: 1 }">
<nz-descriptions-item nzTitle="类别名称">{{data['categoryName']}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="商品名称">{{data['name']}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="商品图片"><img style="width: 80px;" src="{{data['defaultImage']}}" alt=""></nz-descriptions-item>
<nz-descriptions-item nzTitle="杯型">{{data['cupSize']}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="温度">{{data['temperature']}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="奶油">{{data['cream']}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="浓缩咖啡">{{data['espresso']}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="牛奶">{{data['milk']}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="奶泡">{{data['milkBubble']}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="中杯市场价(元)">¥{{data['marketTallPrice']}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="大杯市场价(元)">¥{{data['marketGrandePrice']}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="超大杯市场价(元)">¥{{data['marketVentiPrice']}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="中杯销售价(元)">¥{{data['salesTallPrice']}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="大杯销售价(元)">¥{{data['salesGrandePrice']}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="超大杯销售价(元)">¥{{data['salesVentiPrice']}}</nz-descriptions-item>
</nz-descriptions>
</nz-modal>

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

@ -13,6 +13,7 @@ import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module';
import {RegionSelectorModule} from '../../common/region-selector/region-selector.module';
import {AppCommonModule} from '../../app-common.module';
import { TestComponent } from './test/test.component';
import {NzSpaceModule} from "_ng-zorro-antd@9.3.0@ng-zorro-antd/space";
@NgModule({
@ -29,7 +30,8 @@ import { TestComponent } from './test/test.component';
RegionSelectorModule,
NgxEchartsModule,
IndexRoutingModule,
AppCommonModule
AppCommonModule,
NzSpaceModule
]
})
export class IndexModule { }

@ -133,32 +133,32 @@
<!--运营角色-->
<div class="inner-content" *ngIf="roleType == 1">
<div nz-row style="margin-top: 20px;" [nzGutter]="16">
<div nz-col nzSpan="8" *ngFor="let item of tyBalance">
<div nz-col nzSpan="8" *ngFor="let item of tyBalance" class="row-bottom">
<nz-card nzHoverable [nzLoading]="loading" [nzTitle]="item['energyType'] | energyType">
<h3>{{item['accountBalance']}}</h3>
</nz-card>
</div>
<div nz-col nzSpan="8" style="margin-top: 20px">
<div nz-col nzSpan="8" class="row-bottom">
<nz-card nzHoverable [nzLoading]="loading" [nzTitle]="'注册总人数'">
<h3>{{countData['registrantNum']}}</h3>
</nz-card>
</div>
<div nz-col nzSpan="8" style="margin-top: 20px">
<div nz-col nzSpan="8" class="row-bottom">
<nz-card nzHoverable [nzLoading]="loading" [nzTitle]="'总交易金额'">
<h3>{{countData['transactionNum']}}</h3>
</nz-card>
</div>
<div nz-col nzSpan="8" style="margin-top: 20px">
<div nz-col nzSpan="8" class="row-bottom">
<nz-card nzHoverable [nzLoading]="loading" [nzTitle]="'总交易订单数量'">
<h3>{{countData['transactionOrder']}}</h3>
</nz-card>
</div>
<div nz-col nzSpan="8" style="margin-top: 20px">
<div nz-col nzSpan="8" class="row-bottom">
<nz-card nzHoverable [nzLoading]="loading" [nzTitle]="'当天交易金额'">
<h3>{{countData['transactionToday']}}</h3>
</nz-card>
</div>
<div nz-col nzSpan="8" style="margin-top: 20px">
<div nz-col nzSpan="8" class="row-bottom">
<nz-card nzHoverable [nzLoading]="loading" [nzTitle]="'当天交易订单'">
<h3>{{countData['transactionOrderToday']}}</h3>
</nz-card>

@ -2,3 +2,6 @@
.enterprise-top{
margin-top: 30px;
}
.row-bottom {
margin-bottom: 16px;
}

@ -199,6 +199,7 @@ export class StoreEditComponent implements OnInit {
map: map
});
positionPicker.on('success', positionResult => {
console.log(positionResult);
positionResult['latitude'] = positionResult.position.lat;
positionResult['longitude'] = positionResult.position.lng;
positionResult['regionId'] = positionResult.regeocode.addressComponent.adcode;

@ -243,7 +243,7 @@
<tbody>
<tr *ngFor="let data of basicTable.data">
<td>{{data.orderNo}}</td>
<td>{{data.rechargePlatform == 2 ? '龙阅':'尖椒'}}</td>
<td>{{data.rechargePlatform | platform}}</td>
<td>{{data.status | chlidRechargeStatus}}</td>
<td>{{data['createTime'] | date: 'yyyy-MM-dd HH:mm'}}</td>
</tr>

@ -145,9 +145,15 @@
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td nzRight="">{{data.status | priceStatus}}</td>
<td nzRight class="table-td-operation">
<a *ngIf="data.status != 1" (click)="getEdit(data.id)">编辑</a>
<a style="margin-left: 20px;" (click)='getForbiddenUser(data.id , data.status)'>{{data.status === 1 ? '售空': '上线'}}</a>
<a *ngIf="data.status != 1" style="margin-left: 20px;" (click)="getForbiddenUserD(data.id)">删除</a>
<a nz-dropdown [nzDropdownMenu]="menu">更多操作<i nz-icon nzType="down"></i></a>
<nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu nzSelectable>
<li *ngIf="data.status != 1" nz-menu-item><a (click)="getEdit(data.id)">产品编辑</a></li>
<li nz-menu-item><a (click)='getForbiddenUser(data.id , data.status)'>{{data.status === 1 ? '产品售空': '产品上线'}}</a></li>
<li *ngIf="data.status != 1" nz-menu-item><a (click)="getForbiddenUserD(data.id)">产品删除</a></li>
<li *ngIf="data.status != 1" nz-menu-item><a (click)="getProductCode(data.id)">配置编码</a></li>
</ul>
</nz-dropdown-menu>
</td>
</tbody>
</nz-table>
@ -275,19 +281,19 @@
></nz-input-number>
</nz-form-control>
</nz-form-item>
<nz-form-item *ngIf="edit">
<nz-form-label [nzSpan]="6" >商品编号</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请输入商品编号!">
<nz-input-number
style="width: 200px"
formControlName="goodsId"
[nzMin]="1"
[nzMax]="10000"
[nzStep]="1"
nzPlaceHolder="请输入商品编号!"
></nz-input-number>
</nz-form-control>
</nz-form-item>
<!-- <nz-form-item *ngIf="edit">-->
<!-- <nz-form-label [nzSpan]="6" >商品编号</nz-form-label>-->
<!-- <nz-form-control [nzSpan]="16" nzErrorTip="请输入商品编号!">-->
<!-- <nz-input-number-->
<!-- style="width: 200px"-->
<!-- formControlName="goodsId"-->
<!-- [nzMin]="1"-->
<!-- [nzMax]="10000"-->
<!-- [nzStep]="1"-->
<!-- nzPlaceHolder="请输入商品编号!"-->
<!-- ></nz-input-number>-->
<!-- </nz-form-control>-->
<!-- </nz-form-item>-->
<nz-form-item *ngIf="edit">
<nz-form-label [nzSpan]="6" >排序</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请输入排序!">
@ -304,3 +310,10 @@
</form>
</nz-modal>
<nz-modal [(nzVisible)]="isVisibleProductCode" nzTitle="产品编码编辑" (nzOnCancel)="isVisibleProductCode = false" (nzOnOk)="handleOkCode()">
<div style="margin-bottom: 30px;" *ngFor="let item of rechargeCodeList">
<nz-input-group nzAddOnBefore="{{item.rechargePlatformName}}" >
<input type="text" nz-input [(ngModel)]="item.goodsId" placeholder="请输入产品编码" />
</nz-input-group>
</div>
</nz-modal>

@ -29,12 +29,13 @@ export class PriceListComponent implements OnInit {
pageSize = 10; // 条码
loading = true;
isVisible = false;
isVisibleProductCode = false;
id: number;
edit = false;
payPrice;
isVisibleGoods = false;
realPrice = 0;
rechargeCodeList: any;
formatterPercent = (value: number): string => `${value == null ? 0 : value} %`;
parserPercent = (value: string): string => value.replace(' %', '');
@ -231,9 +232,6 @@ export class PriceListComponent implements OnInit {
});
}
});
console.log(status);
console.log(statusPost);
console.log(message);
}
public getForbiddenUserD(idPost): void {
@ -259,5 +257,37 @@ export class PriceListComponent implements OnInit {
this.payPrice = this.validateForm.value['rechargePrice'] * e / 100;
}
// 配置产品编码
public getProductCode(productId: number): void {
const paramsObject = {
id: productId,
codeType: 'RECHARGE_PLATFORM'
};
this.recharge.getRechargeCodeList(paramsObject , data => {
if (data['return_code'] === '000000') {
this.isVisibleProductCode = true;
this.rechargeCodeList = data['return_data'];
for (const i of this.rechargeCodeList) {
i['sourceId'] = productId;
i['type'] = 1;
}
} else {
this.message.error(data['return_msg']);
}
});
}
// 上传配置
public handleOkCode(): void {
this.recharge.editRechargeCode(this.rechargeCodeList , data => {
if (data['return_code'] === '000000') {
this.isVisibleProductCode = false;
this.message.success('编辑成功');
this.getRequest(false, this.searchForm.value);
} else {
this.message.error(data['return_msg']);
}
});
}
}

@ -93,7 +93,7 @@
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td nzRight="0px" class="table-td-operation">
<a (click)="getEdit(data.id)">编辑</a>
<a nz-dropdown [nzDropdownMenu]="menu">更多</a>
<a nz-dropdown [nzDropdownMenu]="menu">Sum1Dream</a>
<nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu nzSelectable>
<li class="li-a" nz-menu-item><a (click)="generateRechargeAgentQrCode(data.id)">生成二维码</a></li>

@ -55,6 +55,7 @@ import {OilTypePipe} from './pipes/store/oil-type.pipe';
import {OilPriceTaskStatusPipe} from './pipes/gas-oil-price/oil-price-task-status.pipe';
import {OilPriceTaskExecutionTypePipe} from './pipes/gas-oil-price/oil-price-task-execution-type.pipe';
import {OilPriceTaskPriceTypePipe} from './pipes/gas-oil-price/oil-price-task-price-type.pipe';
import { PlatformPipe } from './pipes/recharge-pipe/platform.pipe';
const PIPES = [
TimesPipe,
@ -104,6 +105,7 @@ const PIPES = [
SourceTypePipe,
GasClassGroupTaskStatusPipe,
GasOrderStatusPipe,
PlatformPipe,
];

@ -40,3 +40,4 @@ export * from './chlid-recharge-status.pipe';
export * from './apiMerchant/source-type.pipe';
export * from './gas-class-group-task/gas-class-group-task-status.pipe';
export * from './gas-order/gas-order-status.pipe';
export * from './recharge-pipe/platform.pipe';

@ -0,0 +1,19 @@
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'platform'
})
export class PlatformPipe implements PipeTransform {
transform(value: number): string {
switch (value) {
case 1:
return '尖椒';
case 2:
return '龙阅';
case 3:
return '城宇';
}
}
}

@ -15,6 +15,9 @@ export class RechargePlatformPipe implements PipeTransform {
if (Number(i) === 2) {
string = string + '龙阅,';
}
if (Number(i) === 3) {
string = string + '城宇,';
}
}
return string.substring(0 , string.length - 1);

@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import {CommonsService} from './commons.service';
import {environment} from "../../environments/environment";
import {environment} from '../../environments/environment';
import {HttpClient} from '@angular/common/http';
@Injectable({
@ -94,4 +94,130 @@ export class ApiProductService {
});
}
/**
* @Author Sum1Dream
* @methodName getStarbucksProducts
* @Description // 查询星巴克产品
* @Date 13:53 2022/6/30
* @Param callBack
*/
public getStarbucksProducts(callBack) {
this.http.get(environment.baseUrl + 'apiProduct/getStarbucksProducts').subscribe(data => {
callBack(data);
});
}
/**
* @Author Sum1Dream
* @methodName insertProductConfig
* @Description // 新增第三方产品配置
* @Date 14:22 2022/6/30
* @Param params: object, callBack
*/
public productConfig(params: object, callBack) {
this.http.post(environment.baseUrl + 'bsProductConfig/productConfig', params).subscribe(data => {
callBack(data);
});
}
/**
* @Author Sum1Dream
* @methodName insertProductConfig
* @Description // 新增第三方产品配置
* @Date 14:22 2022/6/30
* @Param params: object, callBack
*/
public updateProductConfig(params: object, callBack) {
this.http.post(environment.baseUrl + 'bsProductConfig/updateProductConfig', params).subscribe(data => {
callBack(data);
});
}
/**
*
*
* @param paramsObject
* @param callBack
*/
public getProductConfig(paramsObject: object, callBack) {
this.http.get(environment.baseUrl + 'bsProductConfig/getProductConfig?' + this.common.getWhereCondition(paramsObject)).subscribe(data => {
callBack(data);
});
}
/**
* id查询产品详情
*
* @param id id
* @param callBack
*/
public findProductConfig(id: number, callBack) {
this.http.get(environment.baseUrl + 'bsProductConfig/findProductConfig?id=' + id).subscribe(data => {
callBack(data);
});
}
/**
* @Author Sum1Dream
* @methodName findStarbucksProducts
* @Description // 查询产品详情
* @Date 10:29 2022/7/1
* @Param id: number, callBack
*/
public findStarbucksProducts(id: number, callBack) {
this.http.get(environment.baseUrl + 'bsProductConfig/findStarbucksProducts?id=' + id).subscribe(data => {
callBack(data);
});
}
/**
* @Author Sum1Dream
* @methodName getListApiMemberProduct
* @Description // 查询会员产品列表
* @Date 10:38 2022/7/12
* @Param paramsObject: object, callBack
*/
public getListApiMemberProduct(paramsObject: object, callBack) {
this.http.get(environment.baseUrl + 'apiMemberProduct/getListApiMemberProduct?' + this.common.getWhereCondition(paramsObject)).subscribe(data => {
callBack(data);
});
}
/**
* @Author Sum1Dream
* @methodName insertMemberProduct
* @Description // 新增会员产品
* @Date 10:39 2022/7/12
* @Param params: object, callBack
*/
public insertMemberProduct(params: object, callBack) {
this.http.post(environment.baseUrl + 'apiMemberProduct/insertMemberProduct', params).subscribe(data => {
callBack(data);
});
}
/**
* @Author Sum1Dream
* @methodName updateMemberProduct
* @Description // 修改会员产品
* @Date 10:40 2022/7/12
* @Param params: object, callBack
*/
public updateMemberProduct(params: object, callBack) {
this.http.post(environment.baseUrl + 'apiMemberProduct/updateMemberProduct', params).subscribe(data => {
callBack(data);
});
}
/**
* id查询详情
*
* @param id id
* @param callBack
*/
public findMemberProductById(id: number, callBack) {
this.http.get(environment.baseUrl + 'apiMemberProduct/findById?id=' + id).subscribe(data => {
callBack(data);
});
}
}

@ -97,6 +97,7 @@ export class ConfigService {
*/
public insertBrand(params: object, callBack) {
this.http.post(environment.baseUrl + 'highBrand/insertBrand', params).subscribe(data => {
callBack(data);
});
}
@ -133,7 +134,7 @@ export class ConfigService {
* @param callBack
*/
public getByDelete(params: object, callBack) {
this.http.get(environment.baseUrl + 'highBrand/getByDelete' , params).subscribe(data => {
this.http.post(environment.baseUrl + 'highBrand/getByDelete' , params).subscribe(data => {
callBack(data);
});
}

@ -260,4 +260,29 @@ export class RechargeService {
});
}
/**
*
*
* @param paramsObject
* @param callBack
*/
public getRechargeCodeList(paramsObject: object, callBack) {
this.http.get(environment.baseUrl + 'outRechargePrice/getRechargeCodeList?' + this.common.getWhereCondition(paramsObject)).subscribe(data => {
callBack(data);
});
}
/**
*
*
* @param params
* @param callBack
* @return data
*/
public editRechargeCode(params: object, callBack) {
this.http.post(environment.baseUrl + 'outRechargePrice/editRechargeCode', params).subscribe(data => {
callBack(data);
});
}
}

@ -6,8 +6,8 @@ export const environment = {
production: false,
baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址)
imageUrl: 'http://localhost:9302/filesystem/',
/* baseUrl: 'https://hsgcs.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址)
imageUrl: 'https://hsgcs.dctpay.com/filesystem/',*/
// baseUrl: 'https://hsg.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址)
// imageUrl: 'https://hsg.dctpay.com/filesystem/',
key: 'https://hsgcs.dctpay.com/phone-recharge-H5/index.html?codeValue=',
inviteUrl: 'https://hsgcs.dctpay.com/wx/?action=ic&id=',
};

Loading…
Cancel
Save