提交修改

pull/1/head
袁野 4 years ago
parent c8cf38ca8e
commit a0cf8b95b8
  1. 87
      src/app/admin/order/order-list/order-list.component.html
  2. 4
      src/app/admin/order/order-list/order-list.component.scss
  3. 84
      src/app/admin/order/order-list/order-list.component.ts
  4. 14
      src/app/admin/order/order-routing.module.ts
  5. 28
      src/app/admin/order/order.module.ts
  6. 2
      src/app/app-common.module.ts
  7. 5
      src/app/app-routing.module.ts
  8. 1
      src/app/pipes/index.ts
  9. 18
      src/app/pipes/order/order-coupon-status.pipe.ts
  10. 2
      src/app/services/icon.service.ts
  11. 27
      src/app/services/order.service.ts

@ -0,0 +1,87 @@
<!-- 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="6">
<nz-form-item>
<nz-form-label [nzSpan]="6">销售码</nz-form-label>
<nz-form-control [nzSpan]="16">
<input nz-input formControlName="salesCode"/>
</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">-->
<!-- <input nz-input formControlName="merchantName"/>-->
<!-- </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 nzShowSearch nzAllowClear nzPlaceHolder="请选择订单状态" formControlName="status">
<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>
</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>
<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="50px">编号</th>
<th nzWidth="80px">销售码</th>
<th nzWidth="80px">销售截止时间</th>
<th nzWidth="100px">使用截止时间</th>
<th nzWidth="100px">创建时间</th>
<th nzWidth="50px">状态</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of ajaxTable.data; let i = index">
<td>{{i+1}}</td>
<td>{{data.salesCode}}</td>
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>{{data.salesEndTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>{{data.useEndTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>{{data.status | orderCouponStatus}}</td>
</tbody>
</nz-table>
</div>

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

@ -0,0 +1,84 @@
import { Component, OnInit } from '@angular/core';
import {environment} from '../../../../environments/environment';
import {FormBuilder, FormGroup} from '@angular/forms';
import {MerchantService} from '../../../services/merchant.service';
import {IconService} from '../../../services/icon.service';
import {NzMessageService} from 'ng-zorro-antd';
import {Router} from '@angular/router';
import {CommonsService} from '../../../services/commons.service';
import {OrderService} from '../../../services/order.service';
@Component({
selector: 'app-order-list',
templateUrl: './order-list.component.html',
styleUrls: ['./order-list.component.scss']
})
export class OrderListComponent implements OnInit {
WEB_SERVE_URL = environment.baseUrl;
searchForm: FormGroup; // 搜索框
requestData = []; // 列表数据
total: number; // 页码
pageNum = 1; // 页码
pageSize = 10; // 条码
loading = true;
constructor(
private form: FormBuilder,
private order: OrderService,
private iconService: IconService,
private message: NzMessageService,
private router: Router,
private common: CommonsService
) {
}
ngOnInit(): void {
this.init();
}
public init(): void {
this.searchForm = this.form.group({
couponId: [null],
salesCode: [null],
status: [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.order.getOrderCouponList(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 getDetail(id: number): void {
this.router.navigate(['/admin/merchant/merchant-detail'], {
queryParams: {
merchantId: id
}
}).then(r => console.log(r));
}
}

@ -0,0 +1,14 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import {OrderListComponent} from './order-list/order-list.component';
const routes: Routes = [
{ path: 'order-list', component: OrderListComponent },
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class OrderRoutingModule { }

@ -0,0 +1,28 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { OrderRoutingModule } from './order-routing.module';
import { OrderListComponent } from './order-list/order-list.component';
import {NgZorroAntdModule} from 'ng-zorro-antd';
import {SeparateModule} from '../../common/separate/separate.module';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module';
import {RegionSelectorModule} from '../../common/region-selector/region-selector.module';
import {AppCommonModule} from "../../app-common.module";
@NgModule({
declarations: [OrderListComponent],
imports: [
CommonModule,
OrderRoutingModule,
NgZorroAntdModule,
SeparateModule,
ReactiveFormsModule,
FormsModule,
BreadcrumbModule,
RegionSelectorModule,
AppCommonModule
]
})
export class OrderModule { }

@ -18,6 +18,7 @@ import {
AuditTypePipe, AuditTypePipe,
AuditStatusPipe AuditStatusPipe
} from './pipes'; } from './pipes';
import { OrderCouponStatusPipe } from './pipes/order/order-coupon-status.pipe';
const PIPES = [ const PIPES = [
TimesPipe, TimesPipe,
@ -27,6 +28,7 @@ const PIPES = [
CouponCodePipe, CouponCodePipe,
AuditTypePipe, AuditTypePipe,
AuditStatusPipe, AuditStatusPipe,
OrderCouponStatusPipe,
]; ];

@ -56,6 +56,11 @@ const routes: Routes = [
loadChildren: () => import('./admin/audit/audit.module').then(m => m.AuditModule), loadChildren: () => import('./admin/audit/audit.module').then(m => m.AuditModule),
canActivate: [InitGuardService] canActivate: [InitGuardService]
}, },
{
path: 'order',
loadChildren: () => import('./admin/order/order.module').then(m => m.OrderModule),
canActivate: [InitGuardService]
},
{ {
path: 'system', path: 'system',
loadChildren: () => import('./admin/system/system.module').then(m => m.SystemModule), loadChildren: () => import('./admin/system/system.module').then(m => m.SystemModule),

@ -5,3 +5,4 @@ export * from './coupon-status.pipe';
export * from './coupon-code.pipe'; export * from './coupon-code.pipe';
export * from './audit-status.pipe'; export * from './audit-status.pipe';
export * from './audit-type.pipe'; export * from './audit-type.pipe';
export * from './order/order-coupon-status.pipe';

@ -0,0 +1,18 @@
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'orderCouponStatus'
})
export class OrderCouponStatusPipe implements PipeTransform {
transform(value: number): string {
switch (value) {
case 1:
return '待销售';
case 2:
return '未使用';
case 3:
return '已使用';
}
}
}

@ -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_j7tpclfptw.js' scriptUrl: 'https://at.alicdn.com/t/font_2424521_9lbh3xk0u0h.js'
}); });
} }
} }

@ -0,0 +1,27 @@
import { Injectable } from '@angular/core';
import {environment} from '../../environments/environment';
import {HttpClient} from '@angular/common/http';
import {CommonsService} from './commons.service';
@Injectable({
providedIn: 'root'
})
export class OrderService {
constructor(
private http: HttpClient,
private common: CommonsService
) { }
/**
*
*
* @param paramsObject
* @param callBack
*/
public getOrderCouponList(paramsObject: object, callBack) {
this.http.get(environment.baseUrl + 'highOrder/getOrderCouponList?' + this.common.getWhereCondition(paramsObject)).subscribe(data => {
callBack(data);
});
}
}
Loading…
Cancel
Save