提交修改

pull/1/head
yuanye 4 years ago
parent bfef05c788
commit 64d89bcde7
  1. 65
      src/app/admin/company/company-detail/company-detail.component.html
  2. 4
      src/app/admin/company/company-detail/company-detail.component.scss
  3. 4
      src/app/admin/company/company-detail/company-detail.component.ts
  4. 6
      src/app/admin/coupon/coupon-edit/coupon-edit.component.html
  5. 65
      src/app/admin/coupon/coupon-edit/coupon-edit.component.ts
  6. 83
      src/app/admin/coupon/coupon-list/coupon-list.component.html
  7. 124
      src/app/admin/coupon/coupon-list/coupon-list.component.ts
  8. 4
      src/app/admin/coupon/coupon.module.ts
  9. 6
      src/app/admin/navigation/navigation.component.html
  10. 2
      src/app/app-common.module.ts
  11. 24
      src/app/pipes/coupon-status.pipe.ts
  12. 1
      src/app/pipes/index.ts
  13. 19
      src/app/services/coupon.service.ts
  14. 2
      src/app/services/icon.service.ts

@ -1,32 +1,33 @@
<!--<div class="inner-content">-->
<!-- <nz-descriptions nzBordered>-->
<!-- <nz-descriptions-item nzTitle="商户logo" [nzSpan]="3">-->
<!-- <img class="head_img" src="{{data.merchantLogo}}" onerror="this.src='../../../../assets/admin/navigation/icon.png'" alt="">-->
<!-- </nz-descriptions-item>-->
<!-- <nz-descriptions-item nzTitle="登录账户">{{data['secUser']['loginName']}}</nz-descriptions-item>-->
<!-- <nz-descriptions-item nzTitle="商户编号">{{data['merchantKey']}}</nz-descriptions-item>-->
<!-- <nz-descriptions-item nzTitle="商户名称">{{data.merchantName}}</nz-descriptions-item>-->
<!-- <nz-descriptions-item nzTitle="联系电话">{{data.secUser.telephone}}</nz-descriptions-item>-->
<!-- <nz-descriptions-item nzTitle="商户地址">{{data.address}}</nz-descriptions-item>-->
<!-- <nz-descriptions-item nzTitle="状态">{{data.status ===1 ? '正常' : '禁用'}}</nz-descriptions-item>-->
<!-- <nz-descriptions-item nzTitle="银行名称">-->
<!-- {{data.bankName == null ? '未上传' : data.bankName}}-->
<!-- </nz-descriptions-item>-->
<!-- <nz-descriptions-item nzTitle="银行账号">-->
<!-- {{data.bankAccount == null ? '未上传' : data.bankAccount}}-->
<!-- </nz-descriptions-item>-->
<!-- <nz-descriptions-item nzTitle="开户人">-->
<!-- {{data.bankHolder == null ? '未上传' : data.bankHolder}}-->
<!-- </nz-descriptions-item>-->
<!-- <nz-descriptions-item nzTitle="创建时间">-->
<!-- {{data.createTime | date: 'yyyy-MM-dd'}}-->
<!-- </nz-descriptions-item>-->
<!-- <nz-descriptions-item nzTitle="更新时间">-->
<!-- {{data.updateTime | date: 'yyyy-MM-dd'}}-->
<!-- </nz-descriptions-item>-->
<!-- <nz-descriptions-item nzTitle="操作人员">{{data.operatorName }}</nz-descriptions-item>-->
<!-- <nz-descriptions-item nzTitle="简介" [nzSpan]="3">-->
<!-- {{data.merchantDesc}}-->
<!-- </nz-descriptions-item>-->
<!-- </nz-descriptions>-->
<!--</div>-->
<!-- start 面包屑 -->
<nz-breadcrumb>
<nz-breadcrumb-item>
系统管理
</nz-breadcrumb-item>
<nz-breadcrumb-item>
公司详情
</nz-breadcrumb-item>
</nz-breadcrumb>
<!-- end 面包屑 -->
<div class="inner-content">
<nz-tabset>
<nz-tab nzTitle="账号信息">
<nz-descriptions nzBordered>
<nz-descriptions-item nzTitle="登录账户" [nzSpan]="1.5">{{data.user.loginName}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="用户名" [nzSpan]="1.5">{{data.user.userName}}</nz-descriptions-item>
</nz-descriptions>
</nz-tab>
<nz-tab nzTitle="单位信息">
<nz-descriptions nzBordered>
<nz-descriptions-item nzTitle="所属地区">{{data.company.regionName}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="单位logo">
<img class="head_img" src="{{FILE_URL +data.logo}}" onerror="this.src='../../../../assets/admin/navigation/icon.png'" alt="">
</nz-descriptions-item>
<nz-descriptions-item nzTitle="公司名称">{{data.company.name}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="联系方式">{{data.company.phone}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="创建时间">{{data.company.createTime | date: 'yyyy-MM-dd HH:mm'}} </nz-descriptions-item>
<nz-descriptions-item nzTitle="更新时间">{{data.company.updateTime | date: 'yyyy-MM-dd HH:mm'}} </nz-descriptions-item>
</nz-descriptions>
</nz-tab>
</nz-tabset>
</div>

@ -0,0 +1,4 @@
.head_img {
height: 60px;
width: 60px;
}

@ -1,8 +1,8 @@
import { Component, OnInit } from '@angular/core';
import {MerchantService} from '../../../services/merchant.service';
import {NzMessageService} from 'ng-zorro-antd';
import {ActivatedRoute} from '@angular/router';
import {CompanyService} from '../../../services/company.service';
import {environment} from '../../../../environments/environment';
@Component({
selector: 'app-company-detail',
@ -10,7 +10,7 @@ import {CompanyService} from '../../../services/company.service';
styleUrls: ['./company-detail.component.scss']
})
export class CompanyDetailComponent implements OnInit {
FILE_URL = environment.imageUrl;
data: any = {};
id: number;
constructor(

@ -22,7 +22,6 @@
</div>
<div nz-col [nzSpan]="8">
<nz-form-item>
<nz-form-label [nzFor]="'couponType'" nzRequired>卡券类型</nz-form-label>
<nz-form-control nzErrorTip="请选择卡券类型!">
<nz-select nzPlaceHolder="请选择卡券类型" [formControlName]="'couponType'">
@ -117,7 +116,7 @@
</div>
<div nz-col [nzSpan]="8" *ngIf="validateForm.value.isPresent">
<div nz-col [nzSpan]="16" *ngIf="validateForm.value.isPresent">
<nz-form-item>
<nz-form-label [nzFor]="'handselCouponList'" nzRequired>选择卡券</nz-form-label>
<nz-form-control nzErrorTip="请选择卡券!">
@ -126,12 +125,13 @@
(nzScrollToBottom)="loadMoreCoupon()"
(nzOnSearch)="searchCoupon($event)"
nzShowSearch
nzMode="multiple"
nzServerSearch
nzPlaceHolder="请选择卡券"
nzAllowClear
[nzDropdownRender]="renderTemplateCoupon"
>
<nz-option *ngFor="let o of optionListCoupon" [nzValue]="o.id" [nzLabel]="o.merchantName"></nz-option>
<nz-option *ngFor="let o of optionListCoupon" [nzValue]="o.id" [nzLabel]="o.couponName"></nz-option>
</nz-select>
<ng-template #renderTemplateCoupon>
<nz-spin *ngIf="isLoading"></nz-spin>

@ -5,7 +5,7 @@ import {MerchantService} from '../../../services/merchant.service';
import {NzMessageService, NzUploadFile} from 'ng-zorro-antd';
import {ActivatedRoute} from '@angular/router';
import {CouponService} from '../../../services/coupon.service';
import {forEachToken} from 'tslint';
import {IconService} from '../../../services/icon.service';
function getBase64(file: File): Promise<string | ArrayBuffer | null> {
return new Promise((resolve, reject) => {
const reader = new FileReader();
@ -36,6 +36,7 @@ export class CouponEditComponent implements OnInit {
optionList: string[] = [];
isLoading = false;
pageNum = 1;
pageSize = 10;
merchantName: string;
optionListCoupon: string[] = [];
isLoadingCoupon = false;
@ -51,16 +52,14 @@ export class CouponEditComponent implements OnInit {
) {
}
ngOnInit(): void {
this.activatedRoute.queryParams.subscribe(queryParams => {
if (queryParams.merchantId != null) {
if (queryParams.couponId != null) {
this.editFlag = true;
this.id = queryParams.merchantId;
this.getDetails(queryParams.merchantId);
this.id = queryParams.couponId;
this.getDetails(queryParams.couponId);
this.pageSize = 10000;
this.loadMore();
}
});
this.validateForm = this.fb.group({
@ -77,6 +76,7 @@ export class CouponEditComponent implements OnInit {
isPresent: [false, [Validators.required]],
handselCouponList: [null],
status: [null],
couponKey: [null],
createTime: [null],
secUser: {},
});
@ -88,7 +88,7 @@ export class CouponEditComponent implements OnInit {
this.isLoading = true;
const paramsObject = {
pageNum: this.pageNum,
pageSize: 10,
pageSize: this.pageSize,
merchantName: this.merchantName,
};
this.getMerchantList(paramsObject);
@ -102,7 +102,7 @@ export class CouponEditComponent implements OnInit {
this.pageNum = 1;
const paramsObject = {
pageNum: this.pageNum,
pageSize: 10,
pageSize: this.pageSize,
merchantName: e,
};
this.getMerchantList(paramsObject);
@ -149,13 +149,12 @@ export class CouponEditComponent implements OnInit {
// 查询卡券
public getCouponList(paramsObject): void {
this.coupon.getCouponList(paramsObject , data => {
console.log(data);
if (data['return_code'] === '000000' && this.pageNum <= data['return_data'].pages ) {
this.pageNum ++;
this.isLoading = false;
this.optionList = [...this.optionList, ...data['return_data'].list];
if (data['return_code'] === '000000' && this.pageNumCoupon <= data['return_data'].pages ) {
this.pageNumCoupon ++;
this.isLoadingCoupon = false;
this.optionListCoupon = [...this.optionListCoupon, ...data['return_data'].list];
} else {
this.isLoading = false;
this.isLoadingCoupon = false;
}
});
}
@ -201,7 +200,7 @@ export class CouponEditComponent implements OnInit {
if (i['response'] != null) {
couponCarouselImg.push(i['response']['return_data'][0]);
} else {
this.validateForm.value.couponCarouselImg = i.name;
couponCarouselImg.push(i.name);
}
}
} else {
@ -244,19 +243,35 @@ export class CouponEditComponent implements OnInit {
}
public getDetails(id) {
this.merchant.getMerchantById(id, data => {
this.coupon.getCouponById(id, data => {
if (data['return_code'] === '000000') {
if (data['return_data']['merchantLogo'] != null && data['return_data']['merchantLogo'] !== '') {
const logo = String(data['return_data']['merchantLogo']);
const logoArray = [];
logoArray.push(
data['return_data']['couponType'] = String(data['return_data']['couponType']);
this.content = data['return_data']['couponDesc'];
if (data['return_data']['couponImg'] != null && data['return_data']['couponImg'] !== '') {
const couponImg = String(data['return_data']['couponImg']);
const couponArray = [];
couponArray.push(
{
uid: 1,
name: couponImg,
status: 'done',
url: environment.imageUrl + couponImg
});
this.couponImg = couponArray;
}
if (data['return_data']['couponCarouselImg'] != null && data['return_data']['couponCarouselImg'] !== '') {
const couponCarouselImg = data['return_data']['couponCarouselImg'].split(',');
const couponCarouselArray = [];
for (const i of couponCarouselImg) {
couponCarouselArray.push(
{
uid: 1,
name: logo,
name: i,
status: 'done',
url: environment.imageUrl + logo
url: environment.imageUrl + i
});
// this.logoFile = logoArray;
}
this.couponCarouselImg = couponCarouselArray;
}
this.validateForm.patchValue(data['return_data']);
} else {

@ -9,17 +9,56 @@
<div nz-col nzSpan="6">
<nz-form-item>
<nz-form-label [nzSpan]="6">门店名称</nz-form-label>
<nz-form-label [nzSpan]="6">卡券名称</nz-form-label>
<nz-form-control [nzSpan]="16">
<input nz-input formControlName="storeName"/>
<input nz-input formControlName="couponName"/>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="6">
<nz-form-item>
<nz-form-label [nzSpan]="6">门店电话</nz-form-label>
<nz-form-label [nzSpan]="6">商户</nz-form-label>
<nz-form-control [nzSpan]="16">
<input nz-input formControlName="telephone"/>
<nz-select
(nzScrollToBottom)="loadMore()"
(nzOnSearch)="search($event)"
nzShowSearch
[formControlName]="'merchantId'"
nzServerSearch
nzPlaceHolder="请选择商户"
nzAllowClear
[nzDropdownRender]="renderTemplate"
>
<nz-option *ngFor="let o of optionList" [nzValue]="o.id" [nzLabel]="o.merchantName"></nz-option>
</nz-select>
<ng-template #renderTemplate>
<nz-spin *ngIf="isLoading"></nz-spin>
</ng-template>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="6">
<nz-form-item>
<nz-form-label [nzSpan]="6">卡券类型</nz-form-label>
<nz-form-control [nzSpan]="16">
<nz-select [formControlName]="'couponType'">
<nz-option nzValue="1" nzLabel="内部卷"></nz-option>
<nz-option nzValue="2" nzLabel="外部卷"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="6">
<nz-form-item>
<nz-form-label [nzSpan]="6">卡券状态</nz-form-label>
<nz-form-control [nzSpan]="16">
<nz-select [formControlName]="'status'">
<nz-option nzValue="1" nzLabel="编辑中"></nz-option>
<nz-option nzValue="2" nzLabel="已上架"></nz-option>
<nz-option nzValue="3" nzLabel="已下架"></nz-option>
<nz-option nzValue="101" nzLabel="上架审批中"></nz-option>
<nz-option nzValue="102" nzLabel="上架审批驳回"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
@ -60,26 +99,36 @@
<thead nzSingleSort>
<tr>
<th nzWidth="50px">编号</th>
<th nzWidth="80px">门店编号</th>
<th nzWidth="80px">门店名称</th>
<th nzWidth="100px">门店电话</th>
<th nzWidth="100px">创建时间</th>
<th nzWidth="80px" nzRight="0px">操作</th>
<th nzWidth="80px">卡券编号</th>
<th nzWidth="80px">卡券名称</th>
<th nzWidth="100px">卡券面值</th>
<th nzWidth="100px">销售价格</th>
<th nzWidth="100px">卡券类型</th>
<th nzWidth="100px">卡券状态</th>
<th nzWidth="120px">销售截止时间</th>
<th nzWidth="120px">创建时间</th>
<th nzWidth="100px" nzRight="0px">操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of ajaxTable.data; let i = index">
<td>{{i+1}}</td>
<td>{{data.storeKey}}</td>
<td>{{data.storeName}}</td>
<td>{{data.telephone}}</td>
<td>{{data.couponKey}}</td>
<td>{{data.couponName}}</td>
<td>¥{{data.couponPrice}}</td>
<td>¥{{data.salesPrice}}</td>
<td>{{data.couponType === 1 ? '内部卷' : '外部卷'}}</td>
<td>{{data.status | couponStatus}}</td>
<td>{{data.salesEndTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td nzRight="0px" class="table-td-operation">
<a (click)="getEdit(data.id)"><i nz-icon nzType="form" nzTheme="outline" nz-tooltip="编辑"></i></a>
<nz-divider nzType="vertical"></nz-divider>
<a (click)="getDetail(data.id)"><i nz-icon [nzIconfont]="'icon-xiangqing'" nz-tooltip="门店详情"></i></a>
<nz-divider nzType="vertical"></nz-divider>
<a (click)="getDelete(data.id)"><i nz-icon nzType="delete" nzTheme="outline" nz-tooltip="删除"></i></a>
<a *ngIf="data.status !== 101" (click)="getEdit(data.id)"><i nz-icon nzType="form" nzTheme="outline" nz-tooltip="编辑"></i></a>
<nz-divider nzType="vertical" *ngIf="data.status === 1 || data.status === 3 || data.status === 102"></nz-divider>
<a *ngIf="data.status === 1 || data.status === 3 || data.status === 102" (click)="enableMerchant(data.id)"> <i nz-icon [nzIconfont]="'icon-shangjia'" nz-tooltip="上架"></i></a>
<nz-divider *ngIf="data.status === 2" nzType="vertical"></nz-divider>
<a *ngIf="data.status === 2" (click)="disableMerchant(data.id)"> <i nz-icon [nzIconfont]="'icon-xiajia'" nz-tooltip="下架"></i></a>
<nz-divider *ngIf="data.status !== 101" nzType="vertical"></nz-divider>
<a *ngIf="data.status !== 101" (click)="getDelete(data.id)"><i nz-icon nzType="delete" nzTheme="outline" nz-tooltip="删除"></i></a>
</td>
</tbody>
</nz-table>

@ -5,6 +5,8 @@ import {IconService} from '../../../services/icon.service';
import {NzMessageService} from 'ng-zorro-antd';
import {ActivatedRoute, Router} from '@angular/router';
import {CommonsService} from '../../../services/commons.service';
import {CouponService} from '../../../services/coupon.service';
import {MerchantService} from '../../../services/merchant.service';
@Component({
selector: 'app-coupon-list',
@ -21,9 +23,14 @@ export class CouponListComponent implements OnInit {
loading = true;
id = null;
name: string;
merchantName: string;
optionList: string[] = [];
isLoading = false;
pageNumMer = 1;
constructor(
private form: FormBuilder,
private merchantStore: MerchantStoreService,
private coupon: CouponService,
private merchant: MerchantService,
private iconService: IconService,
private message: NzMessageService,
private router: Router,
@ -45,8 +52,10 @@ export class CouponListComponent implements OnInit {
}
});
this.searchForm = this.form.group({
storeName: [null],
telephone: [null],
merchantId: [null],
couponName: [null],
couponType: [null],
status: [null],
});
this.getRequest(true, this.searchForm.value);
}
@ -61,8 +70,7 @@ export class CouponListComponent implements OnInit {
}
whereObject['pageNum'] = this.pageNum;
whereObject['pageSize'] = this.pageSize;
if (this.id == null) {
this.merchantStore.getStoreListByMerchant(whereObject, data => {
this.coupon.getCouponList(whereObject, data => {
if (data['return_code'] === '000000') {
this.requestData = data['return_data'].list;
this.total = data['return_data'].total;
@ -70,18 +78,6 @@ export class CouponListComponent implements OnInit {
this.message.error(data['return_msg']);
}
});
} else {
whereObject['merchantId'] = this.id;
this.merchantStore.getStoreListByCompany(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']);
}
});
}
}
@ -90,28 +86,28 @@ export class CouponListComponent implements OnInit {
this.searchForm.reset();
}
// 禁用门店
// 删除门店
public getDelete(id): void {
const message = '是否删除门店';
this.common.showConfirm(message, data => {
if (data) {
this.merchantStore.deleteMerchantStore(id, dataReturn => {
if (dataReturn['return_code'] === '000000') {
this.message.success('操作成功');
this.getRequest(false , this.searchForm.value);
} else {
this.message.warning(dataReturn['return_msg']);
}
});
// this.coupon.disableMerchant(id, dataReturn => {
// if (dataReturn['return_code'] === '000000') {
// this.message.success('操作成功');
// this.getRequest(false, this.searchForm.value);
// } else {
// this.message.warning(dataReturn['return_msg']);
// }
// });
}
});
}
// 修改
public getEdit(id: number): void {
this.router.navigate(['/admin/merchantStore/store-edit'], {
this.router.navigate(['/admin/coupon/coupon-edit'], {
queryParams: {
storeId: id
couponId: id
}
}).then(r => console.log(r));
}
@ -125,4 +121,76 @@ export class CouponListComponent implements OnInit {
}).then(r => console.log(r));
}
// 查询商户
loadMore(): void {
this.isLoading = true;
const paramsObject = {
pageNum: this.pageNumMer,
pageSize: 10,
merchantName: this.merchantName,
};
this.getMerchantList(paramsObject);
}
// 搜索商户
search(e): void {
this.optionList = [];
this.isLoading = true;
this.merchantName = e;
this.pageNumMer = 1;
const paramsObject = {
pageNum: this.pageNumMer,
pageSize: 10,
merchantName: e,
};
this.getMerchantList(paramsObject);
}
// 查询商户
public getMerchantList(paramsObject): void {
this.merchant.getMerchantList(paramsObject , data => {
if (data['return_code'] === '000000' && this.pageNumMer <= data['return_data'].pages ) {
this.pageNumMer ++;
this.isLoading = false;
this.optionList = [...this.optionList, ...data['return_data'].list];
} else {
this.isLoading = false;
}
});
}
// 下架卡券
public disableMerchant(id): void {
const message = '是否下架卡券';
this.common.showConfirm(message, data => {
if (data) {
this.coupon.ofShelfApprove(id, dataReturn => {
if (dataReturn['return_code'] === '000000') {
this.message.success('操作成功');
this.getRequest(false , this.searchForm.value);
} else {
this.message.warning(dataReturn['return_msg']);
}
});
}
});
}
// 上架
public enableMerchant(id): void {
const message = '是否上架审核卡券';
this.common.showConfirm(message, data => {
if (data) {
this.coupon.upShelfApprove(id, dataReturn => {
if (dataReturn['return_code'] === '000000') {
this.message.success('操作成功');
this.getRequest(false , this.searchForm.value);
} else {
this.message.warning(dataReturn['return_msg']);
}
});
}
});
}
}

@ -10,6 +10,7 @@ import {SeparateModule} from '../../common/separate/separate.module';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module';
import {RichtextModule} from '../../common/richtext/richtext.module';
import {AppCommonModule} from '../../app-common.module';
@NgModule({
declarations: [CouponListComponent, CouponEditComponent, CouponDetailComponent],
@ -21,7 +22,8 @@ import {RichtextModule} from '../../common/richtext/richtext.module';
ReactiveFormsModule,
FormsModule,
BreadcrumbModule,
RichtextModule
RichtextModule,
AppCommonModule
]
})
export class CouponModule { }

@ -1,8 +1,8 @@
<nz-layout class="app-layout">
<nz-sider class="menu-sidebar left_nav" nzCollapsible [(nzCollapsed)]="isCollapsed" [nzTrigger]="null">
<div class="logo">
<img nzTooltipTitle="{{userInfo.secUser.userName}}" nzTooltipPlacement="topCenter" nz-tooltip src="../../../assets/admin/navigation/icon.png" alt="">
<span *ngIf="!isCollapsed">{{userInfo.secUser.userName}}</span>
<img nzTooltipTitle="{{userInfo.secRole.roleName}}" nzTooltipPlacement="topCenter" nz-tooltip src="../../../assets/admin/navigation/icon.png" alt="">
<span *ngIf="!isCollapsed">{{userInfo.secRole.roleName}}</span>
</div>
<ul nz-menu nzTheme="dark" nzMode="inline" [nzInlineCollapsed]="isCollapsed">
<li nz-menu-item nz-tooltip nzPlacement="right" (click)="activeLi('index')" [nzSelected]="routeName == 'index' ? true : false" routerLink="/admin/index" [nzTitle]="isCollapsed ? '首页' : ''" >
@ -30,7 +30,7 @@
</span>
<button nz-button (click)="getBack()" nzType="primary">上一步</button>
<a style="float: right; margin-right:30px;" nz-dropdown [nzDropdownMenu]="menu">
{{userInfo.secRole.roleName}}
{{userInfo.secUser.userName}}
<i nz-icon nzType="down"></i>
</a>
<nz-dropdown-menu #menu="nzDropdownMenu">

@ -11,6 +11,7 @@ import {NgxNeditorModule} from '@notadd/ngx-neditor';
// 管道
import {TimesPipe , TextareaPipe} from './pipes';
import { SystemPipe } from './pipes/system.pipe';
import { CouponStatusPipe } from './pipes/coupon-status.pipe';
@ -19,6 +20,7 @@ const PIPES = [
TimesPipe,
TextareaPipe,
SystemPipe,
CouponStatusPipe,
];

@ -0,0 +1,24 @@
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'couponStatus'
})
export class CouponStatusPipe implements PipeTransform {
transform(value: number): string {
switch (value) {
case 0:
return '删除';
case 1:
return '编辑中';
case 2:
return '已上架';
case 3:
return '已下架';
case 101:
return '上架审批中';
case 102:
return '上架审批驳回';
}
}
}

@ -1,3 +1,4 @@
export * from './commons/times.pipe';
export * from './commons/textarea.pipe';
export * from './system.pipe';
export * from './coupon-status.pipe';

@ -53,39 +53,40 @@ export class CouponService {
/**
* id查询详情
*
* @param merchantId id
* @param couponId id
* @param callBack
*/
public getMerchantById(merchantId: number, callBack) {
this.http.get(environment.baseUrl + 'highMerchant/getMerchantById?id=' + merchantId).subscribe(data => {
public getCouponById(couponId: number, callBack) {
this.http.get(environment.baseUrl + 'coupon/getCouponById?id=' + couponId).subscribe(data => {
callBack(data);
});
}
/**
*
*
*
* @param id id
* @param callBack
*/
public disableMerchant(id: number, callBack) {
this.http.get(environment.baseUrl + 'highMerchant/disableMerchant?id=' + id).subscribe(data => {
public ofShelfApprove(id: number, callBack) {
this.http.get(environment.baseUrl + 'coupon/ofShelfApprove?id=' + id).subscribe(data => {
callBack(data);
});
}
/**
*
*
*
* @param id id
* @param callBack
*/
public enableMerchant(id: number, callBack) {
this.http.get(environment.baseUrl + 'highMerchant/enableMerchant?id=' + id).subscribe(data => {
public upShelfApprove(id: number, callBack) {
this.http.get(environment.baseUrl + 'coupon/upShelfApprove?id=' + id).subscribe(data => {
callBack(data);
});
}
}

@ -12,7 +12,7 @@ export class IconService {
constructor(private iconService: NzIconService) {
this.iconService.fetchFromIconfont({
scriptUrl: 'https://at.alicdn.com/t/font_2424521_5ot4v5e6dp.js'
scriptUrl: 'https://at.alicdn.com/t/font_2424521_elodxcgd21v.js'
});
}
}

Loading…
Cancel
Save