提交代码

pull/1/head
袁野 3 years ago
parent 9d3cf40620
commit 3119cecb82
  1. 1
      src/app/admin/navigation/navigation.component.ts
  2. 269
      src/app/admin/recharge-order/order-list/order-list.component.html
  3. 12
      src/app/admin/recharge-order/order-list/order-list.component.scss
  4. 287
      src/app/admin/recharge-order/order-list/order-list.component.ts
  5. 4
      src/app/admin/recharge-order/price-list/price-list.component.html
  6. 251
      src/app/admin/recharge-order/price-list/price-list.component.ts
  7. 5
      src/app/app-common.module.ts
  8. 1
      src/app/pipes/index.ts
  9. 23
      src/app/pipes/recharge-status.pipe.ts
  10. 69
      src/app/services/recharge.service.ts

@ -5,6 +5,7 @@ import {LoginService} from '../../services/login.service';
import {NzMessageService} from 'ng-zorro-antd';
import {Router} from '@angular/router';
import {IconService} from '../../services/icon.service';
import {RechargeService} from '../../services/recharge.service';
@Component({
selector: 'app-navigation',

@ -9,34 +9,58 @@
<div nz-col nzSpan="8">
<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="agentName"/>
<nz-select nzShowSearch nzAllowClear formControlName="status" 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-option nzLabel="已退款" nzValue="5"></nz-option>
</nz-select>
</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-label [nzSpan]="6">充值类型</nz-form-label>
<nz-form-control [nzSpan]="16">
<input nz-input formControlName="agentPhone"/>
<nz-select nzShowSearch nzAllowClear formControlName="rechargeModel" nzPlaceHolder="请选择订单状态">
<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 nz-col nzSpan="8">
<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-select nzShowSearch nzAllowClear formControlName="status" nzPlaceHolder="请选择代理商状态">
<nz-option nzLabel="禁用" nzValue="0"></nz-option>
<nz-option nzLabel="正常" nzValue="1"></nz-option>
</nz-select>
<input nz-input placeholder="请输入充值号码/充值卡号..." [formControlName]="'rechargeContent'" />
</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">
<input nz-input placeholder="请输入订单号..." [formControlName]="'orderNo'" />
</nz-form-control>
</nz-form-item>
</div>
</div>
<div nz-col nzSpan="8">
<nz-form-item>
<nz-form-label [nzSpan]="6">用户电话</nz-form-label>
<nz-form-control [nzSpan]="16">
<input nz-input placeholder="请输入用户电话..." [formControlName]="'userPhone'" />
</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>
@ -51,12 +75,6 @@
<div class="inner-content">
<span>共计 {{total}} 条数据</span>
<div class="operating-button">
<button nz-button nzType="primary" class="right-btn" [routerLink]="['/admin/agent/agent-edit']"><i nz-icon
nzType="plus"
nzTheme="outline"></i>添加
</button>
</div>
<nz-table
class="table"
#ajaxTable
@ -73,187 +91,60 @@
<thead nzSingleSort>
<tr>
<th nzWidth="50px">编号</th>
<th nzWidth="80px">代理商名称</th>
<th nzWidth="80px">代理商地址</th>
<th nzWidth="80px">联系人</th>
<th nzWidth="70px">联系方式</th>
<th nzWidth="100px">创建时间</th>
<th nzWidth="80px" nzRight="0px">操作</th>
<th nzWidth="180px">订单名称</th>
<th nzWidth="180px">订单类型</th>
<th nzWidth="180px">订单号</th>
<th nzWidth="120px">客户名称</th>
<th nzWidth="130px">客户电话</th>
<th nzWidth="100px">充值金额</th>
<th nzWidth="100px">支付金额</th>
<th nzWidth="140px">生成时间</th>
<th nzWidth="100px" nzRight>状态</th>
<th nzWidth="150px" nzRight>操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of ajaxTable.data; let i = index">
<td>{{i + 1}}</td>
<td>{{data.agentName}}</td>
<td>{{data.agentAddress}}</td>
<td>{{data.agentUser}}</td>
<td>{{data.agentPhone}}</td>
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td nzRight="0px" class="table-td-operation">
<a (click)="getEdit(data.id)">编辑</a>
<a nz-dropdown [nzDropdownMenu]="menu">更多</a>
<nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu nzSelectable>
<li class="li-a" nz-menu-item><a (click)="getDistribution(data.id)">分发卡券</a></li>
<li class="li-a" nz-menu-item><a (click)="getDiscount(data.id)">绑定优惠券</a></li>
<li class="li-a" nz-menu-item><a (click)="getDiscountList(data.id)">优惠券列表</a></li>
<li class="li-a" nz-menu-item><a (click)="getDistributionList(data.id)">分发列表</a></li>
<li class="li-a" nz-menu-item><a (click)='getForbiddenUser(data.id , data.status)'>{{data.status === 1 ? '禁用': '启用'}}</a></li>
</ul>
</nz-dropdown-menu>
<td>{{i+1}}</td>
<td>{{data.remarks}}</td>
<td>{{data.rechargeModel | rechargePrice}}</td>
<td>{{data.orderNo}}</td>
<td>{{data.userName == null ? '暂无': data.userName}}</td>
<td>{{data.userPhone == null ? '暂无': data.userPhone}}</td>
<td>{{data.orderPrice}}</td>
<td>{{data.payPrice}}</td>
<td>{{data.createTimed | date: 'yyyy-MM-dd HH:mm:ss'}}</td>
<td nzRight>{{data.status | rechargeStatus}}</td>
<td nzRight class="table-td-operation">
<a (click)="getDetail(data.id)">详情</a>
<a *ngIf="data.status === 2" (click)="getDetail(data.id)">退款</a>
</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="discountId" nzPlaceHolder="请选择优惠券">
<nz-option *ngFor="let item of discountList" nzLabel="{{item.discountName}}"
nzValue="{{item.id}}"></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="分配优惠券数量!">
<input [type]="'number'" nz-input formControlName="stockCount"/>
</nz-form-control>
</nz-form-item>
</form>
</nz-modal>
<nz-modal [(nzVisible)]="isVisibleDiscount" nzWidth="1000" nzTitle="分配优惠券列表" (nzOnCancel)="handleCancelDiscount()"
(nzOnOk)="handleCancelDiscount()">
<nz-table
class="table"
#ajaxTableDiscount
nzShowSizeChanger
[nzFrontPagination]="false"
[nzData]="requestDataDiscount"
[nzLoading]="loadingDiscount"
[nzTotal]="totalDiscount"
[(nzPageIndex)]="pageNumDiscount"
[(nzPageSize)]="pageSizeDiscount"
[nzScroll]="{ x: '1200px' }"
(nzPageIndexChange)="getRequestDiscount(false)"
(nzPageSizeChange)="getRequestDiscount(false)">
<thead nzSingleSort>
<tr>
<th nzWidth="80px">优惠券KEY</th>
<th nzWidth="80px">优惠券名称</th>
<th nzWidth="80px">优惠券类型</th>
<th nzWidth="70px">优惠内容</th>
<th nzWidth="70px">有效天数</th>
<th nzWidth="100px">截止日期</th>
<th nzWidth="100px">库存数量</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of ajaxTableDiscount.data; let i = index">
<td>{{data['highDiscount'].discountKey}}</td>
<td>{{data['highDiscount'].discountName}}</td>
<td>{{data['highDiscount'].discountType | discountType}}</td>
<td>
<span *ngIf="data['highDiscount'].discountType === 1">
满{{data['highDiscount'].discountCondition}}抵扣{{data['highDiscount'].discountPrice}}
</span>
<span *ngIf="data['highDiscount'].discountType === 2">
抵扣{{data['highDiscount'].discountPrice}}
</span>
<span *ngIf="data['highDiscount'].discountType === 3">
{{data['highDiscount'].discountPrice}}折
</span>
</td>
<td>{{data['highDiscount'].effectiveDay}}</td>
<td>{{data['highDiscount'].salesEndTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>{{data.stockCount}}</td>
</tbody>
</nz-table>
</nz-modal>
<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>
<nz-form-label [nzSpan]="6" nzRequired>卡券</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请选择卡券!">
<nz-select nzShowSearch nzAllowClear formControlName="couponId" nzPlaceHolder="请选择卡券">
<nz-option *ngFor="let item of distributeList" nzLabel="{{item.couponName + '-(有效库存:' + item.stockCount + ')'}}"
nzValue="{{item.id}}"></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="分发卡券数量!">
<input [type]="'number'" nz-input formControlName="stockCount"/>
</nz-form-control>
</nz-form-item>
</form>
</nz-spin>
</nz-modal>
<nz-modal [(nzVisible)]="isVisibleList" nzWidth="1000" nzTitle="分发卡券列表" (nzOnCancel)="handleCancelList()" (nzOnOk)="handleCancelList()">
<nz-table
class="table"
#ajaxTableList
nzShowSizeChanger
[nzFrontPagination]="false"
[nzData]="requestDataList"
[nzLoading]="loadingList"
[nzTotal]="totalList"
[(nzPageIndex)]="pageNumList"
[(nzPageSize)]="pageSizeList"
(nzPageIndexChange)="getRequestList(false)"
(nzPageSizeChange)="getRequestList(false)">
<thead nzSingleSort>
<tr>
<th nzWidth="80px">卡券名称</th>
<th nzWidth="80px">卡券销售价格</th>
<th nzWidth="80px">库存数量</th>
<th nzWidth="70px">销售数量</th>
<th nzWidth="70px">分发时间</th>
<th nzWidth="70px">操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of ajaxTableList.data; let i = index">
<td>{{data['couponName']}}</td>
<td>{{data['salesPrice']}}元</td>
<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 [(nzVisible)]="isVisible" nzTitle="订单详情" nzWidth="1200">
<nz-descriptions nzBordered [nzColumn]="{ xxl: 4, xl: 3, lg: 3, md: 3, sm: 2, xs: 1 }">
<nz-descriptions-item nzTitle="订单名称">{{data['remarks']}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="订单类型">{{data['rechargeModel'] | rechargePrice}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="订单号">{{data['orderNo']}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="客户名称">{{data['userName'] == null ? '暂无': data['userName']}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="客户电话">{{data['userPhone'] == null ? '暂无': data['userPhone']}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="身份证号" *ngIf="data['rechargeModel'] === 3 ">{{data['idCard']}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="充值姓名" *ngIf="data['rechargeModel'] === 3 ">{{data['rechargeName']}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="充值金额">{{data['orderPrice']}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="支付金额">{{data['payPrice']}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="退款金额" *ngIf="data['refundFee'] != null">{{data['refundFee']}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="生成时间">{{data['createTimed'] | date: 'yyyy-MM-dd HH:mm:ss'}}</nz-descriptions-item>
<nz-descriptions-item *ngIf="data['cancelTime'] != null" nzTitle="取消时间">{{data['cancelTime'] | date: 'yyyy-MM-dd HH:mm:ss'}}</nz-descriptions-item>
<nz-descriptions-item *ngIf="data['finishTime'] != null" nzTitle="完成时间">{{data['finishTime'] | date: 'yyyy-MM-dd HH:mm:ss'}}</nz-descriptions-item>
<nz-descriptions-item *ngIf="data['payTime'] != null" nzTitle="支付时间">{{data['payTime'] | date: 'yyyy-MM-dd HH:mm:ss'}}</nz-descriptions-item>
<nz-descriptions-item *ngIf="data['refundTime'] != null" nzTitle="退款时间">{{data['refundTime'] | date: 'yyyy-MM-dd HH:mm:ss'}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="状态">{{data['status'] | rechargeStatus}}</nz-descriptions-item>
</nz-descriptions>
<div *nzModalFooter>
<button nz-button nzType="default" (click)="handleCancel()">取消</button>
<button nz-button nzType="primary" (click)="handleOk()">完成充值</button>
</div>
</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>

@ -1,12 +0,0 @@
.head_img {
height: 80px;
width: 80px;
}
.table-td-operation {
a {
margin-left: 8px;
}
}
.li-a :hover {
color: #1890ff;
}

@ -1,83 +1,84 @@
import { Component, OnInit } from '@angular/core';
import {environment} from "../../../../environments/environment";
import {FormBuilder, FormGroup, Validators} from "_@angular_forms@9.0.7@@angular/forms";
import {AgentService} from "../../../services/agent.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 {Component, OnDestroy, OnInit} from '@angular/core';
import {environment} from '../../../../environments/environment';
import {FormBuilder, FormGroup, Validators} from '_@angular_forms@9.0.7@@angular/forms';
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 {RechargeService} from '../../../services/recharge.service';
import {NzNotificationService} from "ng-zorro-antd";
@Component({
selector: 'app-order-list',
templateUrl: './order-list.component.html',
styleUrls: ['./order-list.component.scss']
})
export class OrderListComponent implements OnInit {
export class OrderListComponent implements OnInit , OnDestroy {
WEB_SERVE_URL = environment.imageUrl;
searchForm: FormGroup; // 搜索框
validateForm: FormGroup; // 搜索框
validateFormDistribute: FormGroup; // 搜索框
validateForm: FormGroup; // 添加框
requestData = []; // 列表数据
discountList = []; // 列表数据
distributeList = []; // 列表数据
total: number; // 页码
pageNum = 1; // 页码
pageSize = 10; // 条码
loading = true;
isVisible = false;
isVisibleDiscount = false;
isVisibleDistribute = false;
isVisibleList = false;
id: number;
isSpinning = false;
isSpinningDistribute = false;
requestDataDiscount = []; // 列表数据
totalDiscount: number; // 页码
pageNumDiscount = 1; // 页码
pageSizeDiscount = 10; // 条码
loadingDiscount = true;
agentId: number;
requestDataList = []; // 列表数据
totalList: number; // 页码
pageNumList = 1; // 页码
pageSizeList = 10; // 条码
loadingList = true;
isOkLoading = false;
isVisibleShow = false;
dataSet;
edit = false;
data = {};
private timer; // 定时器
constructor(
private form: FormBuilder,
private agent: AgentService,
private recharge: RechargeService,
private discount: DiscountService,
private coupon: CouponService,
private iconService: IconService,
private message: NzMessageService,
private router: Router,
private notification: NzNotificationService,
private common: CommonsService
) {
}
ngOnInit(): void {
this.init();
this.timer = setInterval(() => { // 设置定时刷新事件,每隔1分钟刷新
this.recharge.countOrder(data => {
this.notification.info(
'充值订单',
'您有' + data['return_data'] + '条未充值的订单,请尽快充值,点击可查看未充值订单!'
).onClick.subscribe(() => {
this.searchForm.value.status = 2;
this.getRequest(true, this.searchForm.value);
});
});
}, 60000);
}
// 销毁
ngOnDestroy() {
if (this.timer) {
clearInterval(this.timer);
}
}
public init(): void {
this.searchForm = this.form.group({
agentName: [null],
agentPhone: [null],
status: [null],
orderNo: [null],
rechargeModel: [null],
rechargeContent: [null],
userPhone: [null],
});
this.validateForm = this.form.group({
discountId: [null, [Validators.required]],
stockCount: [null, [Validators.required]],
});
this.validateFormDistribute = this.form.group({
couponId: [null, [Validators.required]],
stockCount: [null, [Validators.required]],
type: [null, [Validators.required]],
price: [null, [Validators.required]],
realPrice: [null, [Validators.required]],
});
this.getRequest(true, this.searchForm.value);
}
@ -90,7 +91,7 @@ export class OrderListComponent implements OnInit {
}
whereObject['pageNum'] = this.pageNum;
whereObject['pageSize'] = this.pageSize;
this.agent.getListAgent(whereObject, data => {
this.recharge.getOrderList(whereObject, data => {
if (data['return_code'] === '000000') {
this.requestData = data['return_data'].list;
this.total = data['return_data'].total;
@ -105,203 +106,41 @@ export class OrderListComponent implements OnInit {
this.searchForm.reset();
}
public getForbiddenUser(id, status: any): void {
const message = (status === 1 ? '是否禁用当前代理商' : '是否启用当前代理商');
this.common.showConfirm(message, data => {
if (data) {
this.agent.editStatus(id, dataUser => {
this.getRequest(false, this.searchForm.value);
});
}
});
}
// 修改
public getEdit(id: number): void {
this.router.navigate(['/admin/agent/agent-edit'], {
queryParams: {
agentId: id
}
}).then(r => console.log(r));
}
// 查看详情
// 详情
public getDetail(id: number): void {
this.router.navigate(['/admin/company/company-detail'], {
queryParams: {
companyId: id
}
}).then(r => console.log(r));
}
// 绑定优惠券
public getDiscount(id: number): void {
this.id = id;
const whereObject = {};
whereObject['pageNum'] = 1;
whereObject['pageSize'] = 10000;
this.discount.getDiscountList(whereObject, data => {
this.recharge.getOrderById(id , data => {
if (data['return_code'] === '000000') {
this.discountList = data['return_data'].list;
console.log(data);
this.data = data['return_data'];
} else {
this.message.error(data['return_msg']);
}
});
this.isVisible = true;
}
handleOk(): void {
// 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('必填项不能为空');
return;
}
}
// this.isSpinning = true;
this.validateForm.value['agentId'] = this.id;
this.agent.insertDiscountAgent(this.validateForm.value , data => {
if (data['return_code'] === '000000') {
this.message.success('生成中,请耐心等待!');
this.isVisible = false;
} else {
this.message.error(data['return_msg']);
}
this.isSpinning = false;
});
}
handleCancel(): void {
this.isVisible = false;
}
public getDiscountList(id: number): void {
this.id = id;
this.isVisibleDiscount = true;
this.getRequestDiscount(true);
}
public getDistributionList(id: number): void {
this.id = id;
this.isVisibleList = true;
this.getRequestList(true);
}
handleCancelList() {
this.isVisibleList = false;
}
handleCancelDiscount() {
this.isVisibleDiscount = false;
}
handleCancelDistribute() {
this.isVisibleDistribute = false;
}
// 查询列表
public getRequestDiscount(reset: boolean = false) {
const whereObject = {};
this.loadingDiscount = true;
if (reset) {
this.pageNumDiscount = 1;
}
whereObject['pageNum'] = this.pageNumDiscount;
whereObject['pageSize'] = this.pageSizeDiscount;
whereObject['agentId'] = this.id;
this.agent.getDiscountAgentList(whereObject, data => {
this.loadingDiscount = false;
if (data['return_code'] === '000000') {
this.requestDataDiscount = data['return_data'].list;
this.totalDiscount = data['return_data'].total;
} else {
this.message.error(data['return_msg']);
}
});
}
// 分发卡券
public getDistribution(id: number): void {
this.isSpinningDistribute = true;
this.agentId = id;
const whereObject = {};
whereObject['pageNum'] = 1;
whereObject['pageSize'] = 10000;
this.coupon.getCouponList(whereObject, data => {
if (data['return_code'] === '000000') {
this.distributeList = data['return_data'].list;
} else {
this.message.error(data['return_msg']);
}
this.isSpinningDistribute = false;
});
this.isVisibleDistribute = true;
}
// 查询f分发列表
public getRequestList(reset: boolean = false) {
const whereObject = {};
this.loadingList = true;
if (reset) {
this.pageNumList = 1;
}
whereObject['pageNum'] = this.pageNumList;
whereObject['pageSize'] = this.pageSizeList;
whereObject['agentId'] = this.id;
this.agent.getCouponByAgent(whereObject, data => {
this.loadingList = false;
if (data['return_code'] === '000000') {
this.requestDataList = data['return_data'].list;
this.totalList = data['return_data'].total;
} else {
this.message.error(data['return_msg']);
}
});
}
// 提交分发
public handleOkDistribute(): void {
// tslint:disable-next-line:forin
for (const i in this.validateFormDistribute.controls) {
this.validateFormDistribute.controls[i].markAsDirty();
this.validateFormDistribute.controls[i].updateValueAndValidity();
if (this.validateFormDistribute.controls[i].errors != null) {
this.message.error('必填项不能为空');
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']);
handleOk(): void {
this.common.showConfirm('确认订单是否完成充值', item => {
if (item) {
this.recharge.finishOrder(this.id, data => {
if (data['return_code'] === '000000') {
this.getRequest(false, this.searchForm.value);
this.isVisible = false;
this.message.success('充值成功');
} 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;
}
}

@ -71,7 +71,7 @@
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td class="table-td-operation">
<a (click)="getEdit(data.id)">编辑</a>
<a style="margin-left: 20px;" (click)="getEdit(data.id)">删除</a>
<a style="margin-left: 20px;" (click)="getForbiddenUser(data.id)">删除</a>
</td>
</tbody>
</nz-table>
@ -79,7 +79,7 @@
<nz-modal [(nzVisible)]="isVisible" nzTitle="金额编辑" (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()">
<form nz-form [formGroup]="validateForm" class="login-form">
<nz-form-item>
<nz-form-item *ngIf="!edit">
<nz-form-label [nzSpan]="6" nzRequired>金额类型</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请选择类型!">
<nz-select nzShowSearch nzAllowClear formControlName="type" nzPlaceHolder="请选择类型">

@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core';
import {Component, OnInit} from '@angular/core';
import {environment} from '../../../../environments/environment';
import {FormBuilder, FormGroup, Validators} from '_@angular_forms@9.0.7@@angular/forms';
import {DiscountService} from '../../../services/discount.service';
@ -10,115 +10,154 @@ import {CommonsService} from '../../../services/commons.service';
import {RechargeService} from '../../../services/recharge.service';
@Component({
selector: 'app-price-list',
templateUrl: './price-list.component.html',
styleUrls: ['./price-list.component.scss']
selector: 'app-price-list',
templateUrl: './price-list.component.html',
styleUrls: ['./price-list.component.scss']
})
export class PriceListComponent implements OnInit {
WEB_SERVE_URL = environment.imageUrl;
searchForm: FormGroup; // 搜索框
validateForm: FormGroup; // 添加框
requestData = []; // 列表数据
total: number; // 页码
pageNum = 1; // 页码
pageSize = 10; // 条码
loading = true;
isVisible = false;
id: number;
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
) {
}
ngOnInit(): void {
this.init();
}
public init(): void {
this.searchForm = this.form.group({
type: [null],
});
this.validateForm = this.form.group({
type: [null, [Validators.required]],
price: [null, [Validators.required]],
realPrice: [null, [Validators.required]],
});
this.getRequest(true, this.searchForm.value);
}
// 查询列表
public getRequest(reset: boolean = false, whereObject: object) {
this.loading = false;
if (reset) {
this.pageNum = 1;
WEB_SERVE_URL = environment.imageUrl;
searchForm: FormGroup; // 搜索框
validateForm: FormGroup; // 添加框
requestData = []; // 列表数据
total: number; // 页码
pageNum = 1; // 页码
pageSize = 10; // 条码
loading = true;
isVisible = false;
id: number;
edit = false;
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
) {
}
whereObject['pageNum'] = this.pageNum;
whereObject['pageSize'] = this.pageSize;
this.recharge.getListOutRechargePrice(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 resetForm(): void {
this.searchForm.reset();
}
// 修改
public getEdit(id?: number): void {
this.isVisible = true;
}
// 查看详情
public getDetail(id: number): void {
this.router.navigate(['/admin/company/company-detail'], {
queryParams: {
companyId: id
}
}).then(r => console.log(r));
}
handleOk(): void {
// 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('必填项不能为空');
return;
}
ngOnInit(): void {
this.init();
}
public init(): void {
this.searchForm = this.form.group({
type: [null],
});
this.validateForm = this.form.group({
type: [null, [Validators.required]],
price: [null, [Validators.required]],
realPrice: [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.recharge.getListOutRechargePrice(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']);
}
});
}
this.validateForm.value['agentId'] = this.id;
this.recharge.insertPrice(this.validateForm.value , data => {
if (data['return_code'] === '000000') {
this.message.success('添加成功');
// 重置
public resetForm(): void {
this.searchForm.reset();
}
// 修改
public getEdit(id?: number): void {
if (id != null) {
this.id = id;
this.edit = true;
this.recharge.findById(id, data => {
this.validateForm.patchValue(data['return_data']);
this.isVisible = true;
});
} else {
this.validateForm.reset();
this.isVisible = true;
}
}
// 查看详情
public getDetail(id: number): void {
this.router.navigate(['/admin/company/company-detail'], {
queryParams: {
companyId: id
}
}).then(r => console.log(r));
}
handleOk(): void {
// 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('必填项不能为空');
return;
}
}
if (this.edit) {
this.validateForm.value['id'] = this.id;
this.recharge.updatePrice(this.validateForm.value, data => {
if (data['return_code'] === '000000') {
this.message.success('修改成功');
this.getRequest(false, this.searchForm.value);
this.isVisible = false;
} else {
this.message.error(data['return_msg']);
}
});
} else {
this.recharge.insertPrice(this.validateForm.value, data => {
if (data['return_code'] === '000000') {
this.message.success('添加成功');
this.getRequest(false, this.searchForm.value);
this.isVisible = false;
} else {
this.message.error(data['return_msg']);
}
});
}
}
handleCancel(): void {
this.isVisible = false;
} else {
this.message.error(data['return_msg']);
}
});
}
handleCancel(): void {
this.isVisible = false;
}
}
public getForbiddenUser(id): void {
this.common.showConfirm('是否删除', item => {
if (item) {
this.recharge.deletePrice(id, data => {
if (data['return_code'] === '000000') {
this.getRequest(false, this.searchForm.value);
this.message.success('删除成功');
} else {
this.message.error(data['return_msg']);
}
});
}
});
}
}

@ -24,7 +24,8 @@ import {
DiscountStatusPipe,
DisplayAreaPipe,
DiscountCodeStatusPipe,
RechargePricePipe
RechargePricePipe,
RechargeStatusPipe
} from './pipes';
@ -44,6 +45,7 @@ const PIPES = [
DisplayAreaPipe,
DiscountCodeStatusPipe,
RechargePricePipe,
RechargeStatusPipe
];
@ -57,7 +59,6 @@ const PIPES = [
],
declarations: [
...PIPES,
],
exports: [

@ -13,3 +13,4 @@ export * from './discount-status.pipe';
export * from './display-area.pipe';
export * from './discount-code-status.pipe';
export * from './recharge-price.pipe';
export * from './recharge-status.pipe';

@ -0,0 +1,23 @@
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'rechargeStatus'
})
export class RechargeStatusPipe implements PipeTransform {
transform(value: number): string {
switch (value) {
case 1:
return '待支付';
case 2:
return '已支付';
case 3:
return '已完成';
case 4:
return '已取消';
case 5:
return '已退款';
}
}
}

@ -46,7 +46,7 @@ export class RechargeService {
* @param callBack
* @return data
*/
public updateAgent(params: object, callBack) {
public updatePrice(params: object, callBack) {
this.http.post(environment.baseUrl + 'outRechargePrice/updatePrice', params).subscribe(data => {
callBack(data);
});
@ -55,12 +55,73 @@ export class RechargeService {
/**
* id查询详情
*
* @param agentId id
* @param id id
* @param callBack
*/
public findByAgentId(agentId: number, callBack) {
this.http.get(environment.baseUrl + 'highAgent/findByAgentId?agentId=' + agentId).subscribe(data => {
public findById(id: number, callBack) {
this.http.get(environment.baseUrl + 'outRechargePrice/findById?id=' + id).subscribe(data => {
callBack(data);
});
}
/**
* id查询详情
*
* @param id id
* @param callBack
*/
public deletePrice(id: number, callBack) {
this.http.get(environment.baseUrl + 'outRechargePrice/deletePrice?id=' + id).subscribe(data => {
callBack(data);
});
}
/**
*
*
* @param paramsObject
* @param callBack
*/
public getOrderList(paramsObject: object, callBack) {
this.http.get(environment.baseUrl + 'outRechargeOrder/getOrderList?' + this.common.getWhereCondition(paramsObject)).subscribe(data => {
callBack(data);
});
}
/**
* id查询详情
*
* @param id id
* @param callBack
*/
public getOrderById(id: number, callBack) {
this.http.get(environment.baseUrl + 'outRechargeOrder/getOrderById?orderId=' + id).subscribe(data => {
callBack(data);
});
}
/**
* id完成订单
*
* @param id id
* @param callBack
*/
public finishOrder(id: number, callBack) {
this.http.get(environment.baseUrl + 'outRechargeOrder/finishOrder?orderId=' + id).subscribe(data => {
callBack(data);
});
}
/**
*
*
* @param id id
* @param callBack
*/
public countOrder(callBack) {
this.http.get(environment.baseUrl + 'outRechargeOrder/countOrder').subscribe(data => {
callBack(data);
});
}
}

Loading…
Cancel
Save