提交修改

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

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

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

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

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

@ -9,17 +9,56 @@
<div nz-col nzSpan="6"> <div nz-col nzSpan="6">
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="6">门店名称</nz-form-label> <nz-form-label [nzSpan]="6">卡券名称</nz-form-label>
<nz-form-control [nzSpan]="16"> <nz-form-control [nzSpan]="16">
<input nz-input formControlName="storeName"/> <input nz-input formControlName="couponName"/>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</div> </div>
<div nz-col nzSpan="6"> <div nz-col nzSpan="6">
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="6">门店电话</nz-form-label> <nz-form-label [nzSpan]="6">商户</nz-form-label>
<nz-form-control [nzSpan]="16"> <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-control>
</nz-form-item> </nz-form-item>
</div> </div>
@ -60,26 +99,36 @@
<thead nzSingleSort> <thead nzSingleSort>
<tr> <tr>
<th nzWidth="50px">编号</th> <th nzWidth="50px">编号</th>
<th nzWidth="80px">门店编号</th> <th nzWidth="80px">卡券编号</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="80px" nzRight="0px">操作</th> <th nzWidth="100px">卡券类型</th>
<th nzWidth="100px">卡券状态</th>
<th nzWidth="120px">销售截止时间</th>
<th nzWidth="120px">创建时间</th>
<th nzWidth="100px" nzRight="0px">操作</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let data of ajaxTable.data; let i = index"> <tr *ngFor="let data of ajaxTable.data; let i = index">
<td>{{i+1}}</td> <td>{{i+1}}</td>
<td>{{data.storeKey}}</td> <td>{{data.couponKey}}</td>
<td>{{data.storeName}}</td> <td>{{data.couponName}}</td>
<td>{{data.telephone}}</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>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td nzRight="0px" class="table-td-operation"> <td nzRight="0px" class="table-td-operation">
<a (click)="getEdit(data.id)"><i nz-icon nzType="form" 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"></nz-divider> <nz-divider nzType="vertical" *ngIf="data.status === 1 || data.status === 3 || data.status === 102"></nz-divider>
<a (click)="getDetail(data.id)"><i nz-icon [nzIconfont]="'icon-xiangqing'" nz-tooltip="门店详情"></i></a> <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 nzType="vertical"></nz-divider> <nz-divider *ngIf="data.status === 2" nzType="vertical"></nz-divider>
<a (click)="getDelete(data.id)"><i nz-icon nzType="delete" nzTheme="outline" nz-tooltip="删除"></i></a> <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> </td>
</tbody> </tbody>
</nz-table> </nz-table>

@ -5,6 +5,8 @@ import {IconService} from '../../../services/icon.service';
import {NzMessageService} from 'ng-zorro-antd'; import {NzMessageService} from 'ng-zorro-antd';
import {ActivatedRoute, Router} from '@angular/router'; import {ActivatedRoute, Router} from '@angular/router';
import {CommonsService} from '../../../services/commons.service'; import {CommonsService} from '../../../services/commons.service';
import {CouponService} from '../../../services/coupon.service';
import {MerchantService} from '../../../services/merchant.service';
@Component({ @Component({
selector: 'app-coupon-list', selector: 'app-coupon-list',
@ -21,9 +23,14 @@ export class CouponListComponent implements OnInit {
loading = true; loading = true;
id = null; id = null;
name: string; name: string;
merchantName: string;
optionList: string[] = [];
isLoading = false;
pageNumMer = 1;
constructor( constructor(
private form: FormBuilder, private form: FormBuilder,
private merchantStore: MerchantStoreService, private coupon: CouponService,
private merchant: MerchantService,
private iconService: IconService, private iconService: IconService,
private message: NzMessageService, private message: NzMessageService,
private router: Router, private router: Router,
@ -45,8 +52,10 @@ export class CouponListComponent implements OnInit {
} }
}); });
this.searchForm = this.form.group({ this.searchForm = this.form.group({
storeName: [null], merchantId: [null],
telephone: [null], couponName: [null],
couponType: [null],
status: [null],
}); });
this.getRequest(true, this.searchForm.value); this.getRequest(true, this.searchForm.value);
} }
@ -61,8 +70,7 @@ export class CouponListComponent implements OnInit {
} }
whereObject['pageNum'] = this.pageNum; whereObject['pageNum'] = this.pageNum;
whereObject['pageSize'] = this.pageSize; whereObject['pageSize'] = this.pageSize;
if (this.id == null) { this.coupon.getCouponList(whereObject, data => {
this.merchantStore.getStoreListByMerchant(whereObject, data => {
if (data['return_code'] === '000000') { if (data['return_code'] === '000000') {
this.requestData = data['return_data'].list; this.requestData = data['return_data'].list;
this.total = data['return_data'].total; this.total = data['return_data'].total;
@ -70,18 +78,6 @@ export class CouponListComponent implements OnInit {
this.message.error(data['return_msg']); 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(); this.searchForm.reset();
} }
// 禁用门店 // 删除门店
public getDelete(id): void { public getDelete(id): void {
const message = '是否删除门店'; const message = '是否删除门店';
this.common.showConfirm(message, data => { this.common.showConfirm(message, data => {
if (data) { if (data) {
this.merchantStore.deleteMerchantStore(id, dataReturn => { // this.coupon.disableMerchant(id, dataReturn => {
if (dataReturn['return_code'] === '000000') { // if (dataReturn['return_code'] === '000000') {
this.message.success('操作成功'); // this.message.success('操作成功');
this.getRequest(false , this.searchForm.value); // this.getRequest(false, this.searchForm.value);
} else { // } else {
this.message.warning(dataReturn['return_msg']); // this.message.warning(dataReturn['return_msg']);
} // }
}); // });
} }
}); });
} }
// 修改 // 修改
public getEdit(id: number): void { public getEdit(id: number): void {
this.router.navigate(['/admin/merchantStore/store-edit'], { this.router.navigate(['/admin/coupon/coupon-edit'], {
queryParams: { queryParams: {
storeId: id couponId: id
} }
}).then(r => console.log(r)); }).then(r => console.log(r));
} }
@ -125,4 +121,76 @@ export class CouponListComponent implements OnInit {
}).then(r => console.log(r)); }).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 {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module'; import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module';
import {RichtextModule} from '../../common/richtext/richtext.module'; import {RichtextModule} from '../../common/richtext/richtext.module';
import {AppCommonModule} from '../../app-common.module';
@NgModule({ @NgModule({
declarations: [CouponListComponent, CouponEditComponent, CouponDetailComponent], declarations: [CouponListComponent, CouponEditComponent, CouponDetailComponent],
@ -21,7 +22,8 @@ import {RichtextModule} from '../../common/richtext/richtext.module';
ReactiveFormsModule, ReactiveFormsModule,
FormsModule, FormsModule,
BreadcrumbModule, BreadcrumbModule,
RichtextModule RichtextModule,
AppCommonModule
] ]
}) })
export class CouponModule { } export class CouponModule { }

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

@ -11,6 +11,7 @@ import {NgxNeditorModule} from '@notadd/ngx-neditor';
// 管道 // 管道
import {TimesPipe , TextareaPipe} from './pipes'; import {TimesPipe , TextareaPipe} from './pipes';
import { SystemPipe } from './pipes/system.pipe'; import { SystemPipe } from './pipes/system.pipe';
import { CouponStatusPipe } from './pipes/coupon-status.pipe';
@ -19,6 +20,7 @@ const PIPES = [
TimesPipe, TimesPipe,
TextareaPipe, TextareaPipe,
SystemPipe, 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/times.pipe';
export * from './commons/textarea.pipe'; export * from './commons/textarea.pipe';
export * from './system.pipe'; export * from './system.pipe';
export * from './coupon-status.pipe';

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

@ -12,7 +12,7 @@ export class IconService {
constructor(private iconService: NzIconService) { constructor(private iconService: NzIconService) {
this.iconService.fetchFromIconfont({ 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