pull/1/head
袁野 2 years ago
parent d71591fbba
commit 38c2891d66
  1. 2
      src/app/admin/config-manage/config-manage-routing.module.ts
  2. 3
      src/app/admin/config-manage/config-manage.module.ts
  3. 208
      src/app/admin/config-manage/integral-rebate/integral-rebate.component.html
  4. 0
      src/app/admin/config-manage/integral-rebate/integral-rebate.component.scss
  5. 208
      src/app/admin/config-manage/integral-rebate/integral-rebate.component.ts
  6. 5
      src/app/admin/config-manage/third-product/third-product.component.ts
  7. 16
      src/app/sercices/integr-rebate.service.spec.ts
  8. 9
      src/app/sercices/integr-rebate.service.ts

@ -4,6 +4,7 @@ import {GoodsTypeComponent} from './goods-type/goods-type.component';
import {BrandComponent} from './brand/brand.component'; import {BrandComponent} from './brand/brand.component';
import {ThirdProductComponent} from './third-product/third-product.component'; import {ThirdProductComponent} from './third-product/third-product.component';
import {MemberProductComponent} from './member-product/member-product.component'; import {MemberProductComponent} from './member-product/member-product.component';
import {IntegralRebateComponent} from './integral-rebate/integral-rebate.component';
const routes: Routes = [ const routes: Routes = [
@ -11,6 +12,7 @@ const routes: Routes = [
{ path: 'brand', component: BrandComponent }, { path: 'brand', component: BrandComponent },
{ path: 'third-product', component: ThirdProductComponent }, { path: 'third-product', component: ThirdProductComponent },
{ path: 'member-product', component: MemberProductComponent }, { path: 'member-product', component: MemberProductComponent },
{ path: 'integral-rebate', component: IntegralRebateComponent },
]; ];
@NgModule({ @NgModule({

@ -12,10 +12,11 @@ import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import { ThirdProductComponent } from './third-product/third-product.component'; import { ThirdProductComponent } from './third-product/third-product.component';
import {AppCommonModule} from "../../app-common.module"; import {AppCommonModule} from "../../app-common.module";
import { MemberProductComponent } from './member-product/member-product.component'; import { MemberProductComponent } from './member-product/member-product.component';
import { IntegralRebateComponent } from './integral-rebate/integral-rebate.component';
@NgModule({ @NgModule({
declarations: [GoodsTypeComponent, BrandComponent, ThirdProductComponent, MemberProductComponent], declarations: [GoodsTypeComponent, BrandComponent, ThirdProductComponent, MemberProductComponent, IntegralRebateComponent],
imports: [ imports: [
CommonModule, CommonModule,
ConfigManageRoutingModule, ConfigManageRoutingModule,

@ -0,0 +1,208 @@
<!-- 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">
<nz-select nzShowSearch nzAllowClear formControlName="type" nzPlaceHolder="请选择产品类型">
<nz-option nzLabel="卡券" [nzValue]="1"></nz-option>
<nz-option nzLabel="在线加油" [nzValue]="2"></nz-option>
<nz-option nzLabel="话费" [nzValue]="3"></nz-option>
<nz-option nzLabel="第三方" [nzValue]="4"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="8" *ngIf="searchForm.value.type == 1">
<nz-form-item>
<nz-form-label [nzSpan]="6">产品</nz-form-label>
<nz-form-control [nzSpan]="16">
<nz-select nzShowSearch nzAllowClear formControlName="productId" nzPlaceHolder="请选择产品">
<nz-option nzValue="1" nzLabel="重庆中石化"></nz-option>
<nz-option nzValue="4" nzLabel="贵州中石化"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="8" *ngIf="searchForm.value.type == 2">
<nz-form-item>
<nz-form-label [nzSpan]="6">产品</nz-form-label>
<nz-form-control [nzSpan]="16">
<nz-select nzShowSearch nzAllowClear formControlName="productId" nzPlaceHolder="请选择产品">
<nz-option nzValue="1" nzLabel="在线加油"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="8" *ngIf="searchForm.value.type == 3">
<nz-form-item>
<nz-form-label [nzSpan]="6">产品</nz-form-label>
<nz-form-control [nzSpan]="16">
<nz-select nzShowSearch nzAllowClear formControlName="productId" nzPlaceHolder="请选择产品">
<nz-option nzValue="1" nzLabel="电信"></nz-option>
<nz-option nzValue="2" nzLabel="移动"></nz-option>
<nz-option nzValue="3" nzLabel="联通"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="8" *ngIf="searchForm.value.type == 4">
<nz-form-item>
<nz-form-label [nzSpan]="6">产品</nz-form-label>
<nz-form-control [nzSpan]="16">
<nz-select nzShowSearch nzAllowClear formControlName="productId" nzPlaceHolder="请选择产品">
<nz-option nzValue="1" nzLabel="星巴克"></nz-option>
<nz-option nzValue="2" nzLabel="肯德基"></nz-option>
<nz-option nzValue="3" nzLabel="会员充值"></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="type" nzPlaceHolder="请选择产品类型">
<nz-option nzLabel="卡券" [nzValue]="1"></nz-option>
<nz-option nzLabel="在线加油" [nzValue]="2"></nz-option>
<nz-option nzLabel="话费" [nzValue]="3"></nz-option>
<nz-option nzLabel="第三方" [nzValue]="4"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item *ngIf="validateForm.value.type == 1">
<nz-form-label [nzSpan]="6" nzRequired>卡券产品</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请选择卡券产品!">
<nz-select nzShowSearch nzAllowClear formControlName="productId" nzPlaceHolder="请选择卡券产品">
<nz-option nzValue="1" nzLabel="重庆中石化"></nz-option>
<nz-option nzValue="4" nzLabel="贵州中石化"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item *ngIf="validateForm.value.type == 2">
<nz-form-label [nzSpan]="6" nzRequired>在线加油产品</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请选择在线加油产品!">
<nz-select nzShowSearch nzAllowClear formControlName="productId" nzPlaceHolder="请选择在线加油产品">
<nz-option nzValue="1" nzLabel="在线加油"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item *ngIf="validateForm.value.type == 3">
<nz-form-label [nzSpan]="6" nzRequired>话费产品</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请选择话费产品!">
<nz-select nzShowSearch nzAllowClear formControlName="productId" nzPlaceHolder="请选择话费产品">
<nz-option nzValue="1" nzLabel="电信"></nz-option>
<nz-option nzValue="2" nzLabel="移动"></nz-option>
<nz-option nzValue="3" nzLabel="联通"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item *ngIf="validateForm.value.type == 4">
<nz-form-label [nzSpan]="6" nzRequired>第三方产品</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请选择第三方产品!">
<nz-select nzShowSearch nzAllowClear formControlName="productId" nzPlaceHolder="请选择第三方产品">
<nz-option nzValue="1" nzLabel="星巴克"></nz-option>
<nz-option nzValue="2" nzLabel="肯德基"></nz-option>
<nz-option nzValue="3" nzLabel="会员充值"></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="percentage"
[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>

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

@ -39,11 +39,6 @@ export class ThirdProductComponent implements OnInit {
realPrice = 0; realPrice = 0;
data = {}; 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} %`; formatterPercent = (value: number): string => `${value == null ? 0 : value} %`;
parserPercent = (value: string): string => value.replace(' %', ''); parserPercent = (value: string): string => value.replace(' %', '');

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

@ -0,0 +1,9 @@
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class IntegrRebateService {
constructor() { }
}
Loading…
Cancel
Save