pull/1/head
袁野 4 years ago
parent d9302f7a5a
commit 7a679909e6
  1. 30
      src/app/admin/agent/agent-list/agent-list.component.html
  2. 24
      src/app/admin/agent/agent-list/agent-list.component.ts
  3. 115
      src/app/admin/order/order-coupon/order-coupon.component.html
  4. 0
      src/app/admin/order/order-coupon/order-coupon.component.scss
  5. 91
      src/app/admin/order/order-coupon/order-coupon.component.ts
  6. 4
      src/app/admin/order/order-coupons/order-coupons.component.ts
  7. 2
      src/app/admin/order/order-routing.module.ts
  8. 3
      src/app/admin/order/order.module.ts
  9. 24
      src/app/services/agent.service.ts
  10. 8
      src/environments/environment.ts

@ -176,7 +176,7 @@
</nz-modal>
<nz-modal [(nzVisible)]="isVisibleDistribute" nzTitle="分发卡券" (nzOnCancel)="handleCancelDistribute()" (nzOnOk)="handleOkDistribute()">
<nz-modal [(nzVisible)]="isVisibleDistribute" nzTitle="分发卡券" (nzOnCancel)="handleCancelDistribute()" [nzOkLoading]="isOkLoading" (nzOnOk)="handleOkDistribute()">
<nz-spin [nzSpinning]="isSpinningDistribute">
<form nz-form [formGroup]="validateFormDistribute" class="login-form">
<nz-form-item>
@ -199,8 +199,7 @@
</nz-modal>
<nz-modal [(nzVisible)]="isVisibleList" nzWidth="1000" nzTitle="分发卡券列表" (nzOnCancel)="handleCancelList()"
(nzOnOk)="handleCancelList()">
<nz-modal [(nzVisible)]="isVisibleList" nzWidth="1000" nzTitle="分发卡券列表" (nzOnCancel)="handleCancelList()" (nzOnOk)="handleCancelList()">
<nz-table
class="table"
#ajaxTableList
@ -220,6 +219,7 @@
<th nzWidth="80px">库存数量</th>
<th nzWidth="70px">销售数量</th>
<th nzWidth="70px">分发时间</th>
<th nzWidth="70px">操作</th>
</tr>
</thead>
<tbody>
@ -229,7 +229,31 @@
<td>{{data['stockCount']}}</td>
<td>{{data['salesCount']}}</td>
<td>{{data['createTime'] | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>
<a (click)="getList(data['id'])">分发历史</a>
</td>
</tbody>
</nz-table>
</nz-modal>
<nz-modal [(nzVisible)]="isVisibleShow" nzWidth="700" nzTitle="分发记录" (nzOnCancel)="handleCancelListShow()" (nzOnOk)="handleCancelListShow()">
<nz-table #basicTable [nzData]="dataSet">
<thead>
<tr>
<th>卡券名称</th>
<th>代理商</th>
<th>分发数量</th>
<th>分发时间</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data">
<td>{{data.couponName}}</td>
<td>{{data.agentName}}</td>
<td>{{data.stockCount}}</td>
<td>{{data['createTime'] | date: 'yyyy-MM-dd HH:mm'}}</td>
</tr>
</tbody>
</nz-table>
</nz-modal>

@ -46,6 +46,9 @@ export class AgentListComponent implements OnInit {
pageNumList = 1; // 页码
pageSizeList = 10; // 条码
loadingList = true;
isOkLoading = false;
isVisibleShow = false;
dataSet;
constructor(
private form: FormBuilder,
private agent: AgentService,
@ -269,17 +272,38 @@ export class AgentListComponent implements OnInit {
return;
}
}
this.isOkLoading = true;
this.validateFormDistribute.value['agentId'] = this.agentId;
this.agent.assignCouponAgent(this.validateFormDistribute.value , data => {
if (data['return_code'] === '000000') {
this.validateFormDistribute.reset();
this.message.success('分发成功');
this.isVisibleDistribute = false;
this.isOkLoading = false;
} else {
this.message.error(data['return_msg']);
}
this.isSpinning = false;
});
}
public getList(id: number): void {
const whereObject = {};
whereObject['pageNum'] = 1;
whereObject['pageSize'] = 10000;
whereObject['couponAgentId'] = id;
this.isVisibleShow = true;
this.agent.getRecordByCouponAgentId(whereObject , data => {
if (data['return_code'] === '000000') {
this.dataSet = data['return_data'].list;
} else {
this.message.error(data['return_msg']);
}
});
}
handleCancelListShow() {
this.isVisibleShow = false;
}
}

@ -0,0 +1,115 @@
<!-- start 面包屑 -->
<app-breadcrumb></app-breadcrumb>
<!-- end 面包屑 -->
<div class="inner-content">
<nz-card nzTitle="销售统计">
<div nz-card-grid [ngStyle]="gridStyle">销售总额: ¥{{countData['salesCountPrice']}}</div>
<div nz-card-grid [ngStyle]="gridStyle">剩余总额: ¥{{countData['surplusCountPrice']}}</div>
<div nz-card-grid [ngStyle]="gridStyle">今日流水: ¥{{countData['turnoverPrice']}}</div>
<div nz-card-grid [ngStyle]="gridStyle">库存数量: {{countData['laveStockCount']}}</div>
<div nz-card-grid [ngStyle]="gridStyle">销售数量: {{countData['soldCount']}}</div>
<div nz-card-grid [ngStyle]="gridStyle">今日订单: {{countData['orderCount']}}</div>
</nz-card>
</div>
<div class="inner-content">
<nz-table #basicTable [nzData]="countData['list']">
<thead>
<tr>
<th>卡券名称</th>
<th>卡券金额</th>
<th>库存数量</th>
<th>销售数量</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data">
<td>{{data.couponName}}</td>
<td>¥{{data.salesPrice}}</td>
<td>{{data.stockCount}}</td>
<td>{{data.salesCount}}</td>
<td>
<a (click)="getDetail(data.couponId)">使用情况</a>
</td>
</tr>
</tbody>
</nz-table>
</div>
<nz-modal [(nzVisible)]="isVisible" nzTitle="使用情况" nzWidth="1000" (nzOnCancel)="handleCancel()" (nzOnOk)="handleCancel()">
<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">消费码KEY</nz-form-label>
<nz-form-control [nzSpan]="16">
<input nz-input formControlName="salesCode"/>
</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 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="4" 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>
<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="180px">消费码</th>
<th nzWidth="120px">使用门店</th>
<th nzWidth="120px">领取时间</th>
<th nzWidth="120px">消费时间</th>
<th nzWidth="120px">销售截止时间</th>
<th nzWidth="120px">使用截止时间</th>
<th nzWidth="120px">创建时间</th>
<th nzWidth="80px" nzRight="0px">状态</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of ajaxTable.data; let i = index">
<td>{{i + 1}}</td>
<td>{{data.salesCode}}</td>
<td>{{data.storeName == null ? '暂无' : data.storeName}}</td>
<td>{{data.receiveTime == null ? '未领取' : data.receiveTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>{{data.consumeTime == null ? '未消费' : data.consumeTime | 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.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td nzRight="0px">{{data.status | couponCode}}</td>
</tbody>
</nz-table>
</nz-modal>

@ -0,0 +1,91 @@
import { Component, OnInit } from '@angular/core';
import {FormBuilder, FormGroup} from '@angular/forms';
import {AgentService} from '../../../services/agent.service';
import {IconService} from '../../../services/icon.service';
import {NzMessageService} from 'ng-zorro-antd';
import {LocalStorageService} from '../../../services/local-storage.service';
import {environment} from '../../../../environments/environment';
import {CouponService} from '../../../services/coupon.service';
import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace';
@Component({
selector: 'app-order-coupon',
templateUrl: './order-coupon.component.html',
styleUrls: ['./order-coupon.component.scss']
})
export class OrderCouponComponent implements OnInit {
gridStyle = {
width: '33.3333%',
textAlign: 'center'
};
searchForm: FormGroup; // 搜索框
codeForm: FormGroup; // 搜索框
requestData = []; // 列表数据
total: number; // 页码
pageNum = 1; // 页码
pageSize = 10; // 条码
loading = true;
isVisible = false;
id;
countData = {};
constructor(
private form: FormBuilder,
private agent: AgentService,
private iconService: IconService,
private message: NzMessageService,
private store: LocalStorageService, // 数据请求
private coupon: CouponService
) {
}
ngOnInit(): void {
this.agent.getAgentCount(data => {
this.countData = data['return_data'];
});
this.searchForm = this.form.group({
status: [null],
salesCode: [null],
});
}
// 查询列表
public getRequest(reset: boolean = false, whereObject: object) {
this.loading = false;
if (reset) {
this.pageNum = 1;
}
whereObject['couponId'] = this.id;
whereObject['agentId'] = this.store.get(ADMIN_INFO_OBJECT)['highAgent'].id;
whereObject['pageNum'] = this.pageNum;
whereObject['pageSize'] = this.pageSize;
this.coupon.getCouponCodeList(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 getDetail(id): void {
this.id = id;
this.getRequest(false , this.searchForm.value);
this.isVisible = true;
}
handleCancel(): void {
this.isVisible = false;
}
// 重置
public resetForm(): void {
this.searchForm.reset();
}
}

@ -1,12 +1,9 @@
import { Component, OnInit } from '@angular/core';
import {environment} from '../../../../environments/environment';
import {FormBuilder, FormGroup} from '@angular/forms';
import {UserService} from '../../../services/user.service';
import {IconService} from '../../../services/icon.service';
import {NzMessageService} from 'ng-zorro-antd';
import {CommonsService} from '../../../services/commons.service';
import {AgentService} from '../../../services/agent.service';
import {DiscountService} from '../../../services/discount.service';
import {LocalStorageService} from '../../../services/local-storage.service';
import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace';
@ -17,7 +14,6 @@ import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace';
})
export class OrderCouponsComponent implements OnInit {
IMAGE_URL = environment.imageUrl;
searchForm: FormGroup; // 搜索框
requestData = []; // 列表数据
total: number; // 页码

@ -3,12 +3,14 @@ import { Routes, RouterModule } from '@angular/router';
import {OrderListComponent} from './order-list/order-list.component';
import {OrderDetailComponent} from './order-detail/order-detail.component';
import {OrderCouponsComponent} from './order-coupons/order-coupons.component';
import {OrderCouponComponent} from './order-coupon/order-coupon.component';
const routes: Routes = [
{ path: 'order-list', component: OrderListComponent },
{ path: 'order-detail', component: OrderDetailComponent },
{ path: 'order-coupons', component: OrderCouponsComponent },
{ path: 'order-coupon', component: OrderCouponComponent },
];
@NgModule({

@ -11,10 +11,11 @@ import {RegionSelectorModule} from '../../common/region-selector/region-selector
import {AppCommonModule} from "../../app-common.module";
import { OrderDetailComponent } from './order-detail/order-detail.component';
import { OrderCouponsComponent } from './order-coupons/order-coupons.component';
import { OrderCouponComponent } from './order-coupon/order-coupon.component';
@NgModule({
declarations: [OrderListComponent, OrderDetailComponent, OrderCouponsComponent],
declarations: [OrderListComponent, OrderDetailComponent, OrderCouponsComponent, OrderCouponComponent],
imports: [
CommonModule,
OrderRoutingModule,

@ -141,4 +141,28 @@ export class AgentService {
});
}
/**
*
*
* @param paramsObject
* @param callBack
*/
public getRecordByCouponAgentId(paramsObject: object, callBack) {
this.http.get(environment.baseUrl + 'highCouponAgent/getRecordByCouponAgentId?' + this.common.getWhereCondition(paramsObject)).subscribe(data => {
callBack(data);
});
}
/**
*
*
* @param callBack
*/
public getAgentCount(callBack) {
this.http.get(environment.baseUrl + 'highCouponAgent/getAgentCount').subscribe(data => {
callBack(data);
});
}
}

@ -4,10 +4,10 @@
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: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址)
imageUrl: 'http://localhost:9302/filesystem/',
// baseUrl: 'https://hsgcs.dctpay.com/brest/', // 正式环境服务器地址(请求数据地址)
// imageUrl: 'https://hsgcs.dctpay.com/filesystem/',
};
/*

Loading…
Cancel
Save