diff --git a/src/app/admin/audit/refund-audit/refund-audit.component.html b/src/app/admin/audit/refund-audit/refund-audit.component.html new file mode 100644 index 0000000..ba3bd2d --- /dev/null +++ b/src/app/admin/audit/refund-audit/refund-audit.component.html @@ -0,0 +1,148 @@ + + + + + +
+
+
+ +
+ + 订单状态 + + + + + + + + +
+ +
+ + 支付方式 + + + + + + + + +
+ +
+ + 订单号 + + + + +
+
+ + 支付时间 + + + + +
+ + + + + + + + + +
+
+
+ + +
+
+
+
+ +
+ 共计 {{total}} 条数据 +
+ +
+ + + + 编号 + 退款来源 + 订单号 + 退款金额 + 提交人 + 创建时间 + 支付方式 + 状态 + 操作 + + + + + {{i+1}} + {{data.refundSource | refundSource}} + {{data.sourceOrderNo}} + {{data.payPrice}} + {{data.createdUserName == null ? '暂无': data.createdUserName}} + {{data.createdTime | date: 'yyyy-MM-dd HH:mm:ss'}} + {{data.payType | rechargePayType}} + {{data.status | refundStatus}} + + 详情 + + 通过 + + 驳回 + + + +
+ + + + {{data['remarks']}} + {{data['rechargeModel'] | rechargePrice}} + {{data['orderNo']}} + {{data['userName'] == null ? '暂无': data['userName']}} + {{data['rechargeContent'] == null ? '暂无': data['rechargeContent']}} + {{data['idCard']}} + {{data['rechargeName']}} + {{data['orderPrice']}} + {{data['payPrice']}} + {{data['refundFee']}} + {{data['createTimed'] | date: 'yyyy-MM-dd HH:mm:ss'}} + {{data['cancelTime'] | date: 'yyyy-MM-dd HH:mm:ss'}} + {{data['finishTime'] | date: 'yyyy-MM-dd HH:mm:ss'}} + {{data['payTime'] | date: 'yyyy-MM-dd HH:mm:ss'}} + {{data['refundTime'] | date: 'yyyy-MM-dd HH:mm:ss'}} + {{data['status'] | rechargeStatus}} + +
+ +
+
+ diff --git a/src/app/admin/audit/refund-audit/refund-audit.component.scss b/src/app/admin/audit/refund-audit/refund-audit.component.scss new file mode 100644 index 0000000..b68da73 --- /dev/null +++ b/src/app/admin/audit/refund-audit/refund-audit.component.scss @@ -0,0 +1,5 @@ +.table-td-operation { + a { + margin-left: 8px; + } +} diff --git a/src/app/admin/audit/refund-audit/refund-audit.component.ts b/src/app/admin/audit/refund-audit/refund-audit.component.ts new file mode 100644 index 0000000..24895b6 --- /dev/null +++ b/src/app/admin/audit/refund-audit/refund-audit.component.ts @@ -0,0 +1,203 @@ +import {Component, OnDestroy, OnInit} from '@angular/core'; +import {environment} from '../../../../environments/environment'; + +import {DiscountService} from '../../../services/discount.service'; +import {CouponService} from '../../../services/coupon.service'; +import {IconService} from '../../../services/icon.service'; + +import {CommonsService} from '../../../services/commons.service'; +import {RechargeService} from '../../../services/recharge.service'; +import {NzMessageService, NzNotificationService} from 'ng-zorro-antd'; +import {FormBuilder, FormGroup, Validators} from '@angular/forms'; +import {Router} from '@angular/router'; +import {AuditService} from "../../../services/audit.service"; + +@Component({ + selector: 'app-refund-audit', + templateUrl: './refund-audit.component.html', + styleUrls: ['./refund-audit.component.scss'] +}) +export class RefundAuditComponent implements OnInit { + + FILE_URL = environment.imageUrl; + searchForm: FormGroup; // 搜索框 + validateForm: FormGroup; // 添加框 + requestData = []; // 列表数据 + + total: number; // 页码 + pageNum = 1; // 页码 + pageSize = 10; // 条码 + loading = true; + isVisible = false; + id: number; + edit = false; + data = {}; + private timer; // 定时器 + constructor( + private form: FormBuilder, + private recharge: RechargeService, + private discount: DiscountService, + private coupon: CouponService, + private audit: AuditService, + private iconService: IconService, + private message: NzMessageService, + private router: Router, + private notification: NzNotificationService, + private common: CommonsService + ) { + } + + ngOnInit(): void { + this.init(); + + } + + + + public init(): void { + this.searchForm = this.form.group({ + status: [null], + orderNo: [null], + rechargeModel: [null], + rechargeContent: [null], + userPhone: [null], + payTime: [null], + payType: [null], + createTime: [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) { + if (whereObject['payTime'] != null && whereObject['payTime'].length !== 0) { + whereObject['payTimeS'] = whereObject['payTime'][0].getTime(); + whereObject['payTimeE'] = whereObject['payTime'][1].getTime(); + } + + if (whereObject['createTime'] != null && whereObject['createTime'].length !== 0) { + whereObject['createTimeS'] = whereObject['createTime'][0].getTime(); + whereObject['createTimeE'] = whereObject['createTime'][1].getTime(); + } + this.loading = false; + if (reset) { + this.pageNum = 1; + } + whereObject['pageNum'] = this.pageNum; + whereObject['pageSize'] = this.pageSize; + this.audit.getOrderList(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 getDetail(id: number): void { + this.id = id; + this.recharge.getOrderById(id , data => { + if (data['return_code'] === '000000') { + console.log(data); + this.data = data['return_data']; + } else { + this.message.error(data['return_msg']); + } + }); + + this.isVisible = true; + } + + + handleCancel(): void { + this.isVisible = false; + } + + + + public orderToRefund(id): void { + this.common.showConfirm('确认订单是否退款', item => { + if (item) { + this.recharge.orderToRefund(id, data => { + if (data['return_code'] === '000000') { + this.message.success('退款成功'); + this.getRequest(false, this.searchForm.value); + } else { + this.message.error(data['return_msg']); + } + }); + } + }); + } + + public getRefundReject(id): void { + this.common.showConfirm('确认订单拒绝退款', item => { + if (item) { + this.audit.getRefundReject(id, data => { + if (data['return_code'] === '000000') { + this.message.success('操作成功'); + this.getRequest(false, this.searchForm.value); + } else { + this.message.error(data['return_msg']); + } + }); + } + }); + } + + + + public postRefund(orderNo): void { + this.common.showConfirm('确认订单申请退款', item => { + if (item) { + this.recharge.postRefund({ + refundSource: 1 , + sourceOrderNo: orderNo + }, data => { + if (data['return_code'] === '000000') { + this.message.success('退款成功'); + this.getRequest(false, this.searchForm.value); + } else { + this.message.error(data['return_msg']); + } + }); + } + }); + } + + + + // 下载模板 + downloadTemplate(whereObject) { + if (whereObject['payTime'] != null && whereObject['payTime'].length !== 0) { + whereObject['payTimeS'] = whereObject['payTime'][0].getTime(); + whereObject['payTimeE'] = whereObject['payTime'][1].getTime(); + } + if (whereObject['createTime'] != null && whereObject['createTime'].length !== 0) { + whereObject['createTimeS'] = whereObject['createTimeS'][0].getTime(); + whereObject['createTimeE'] = whereObject['createTimeE'][1].getTime(); + } + this.recharge.exportOrderList(whereObject, data => { + if (data['return_code'] === '000000') { + window.location.href = this.FILE_URL + data['return_data']; + } else { + this.message.error(data['return_msg']); + } + }); + } + + +} diff --git a/src/app/pipes/audit/refund-source.pipe.ts b/src/app/pipes/audit/refund-source.pipe.ts new file mode 100644 index 0000000..c6ba944 --- /dev/null +++ b/src/app/pipes/audit/refund-source.pipe.ts @@ -0,0 +1,15 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'refundSource' +}) +export class RefundSourcePipe implements PipeTransform { + + transform(value: number): string { + switch (value) { + case 1: + return '话费退款'; + } + } + +} diff --git a/src/app/pipes/audit/refund-status.pipe.spec.ts b/src/app/pipes/audit/refund-status.pipe.spec.ts new file mode 100644 index 0000000..8963446 --- /dev/null +++ b/src/app/pipes/audit/refund-status.pipe.spec.ts @@ -0,0 +1,8 @@ +import { RefundStatusPipe } from './refund-status.pipe'; + +describe('RefundStatusPipe', () => { + it('create an instance', () => { + const pipe = new RefundStatusPipe(); + expect(pipe).toBeTruthy(); + }); +}); diff --git a/src/app/pipes/audit/refund-status.pipe.ts b/src/app/pipes/audit/refund-status.pipe.ts new file mode 100644 index 0000000..9a3ab67 --- /dev/null +++ b/src/app/pipes/audit/refund-status.pipe.ts @@ -0,0 +1,19 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'refundStatus' +}) +export class RefundStatusPipe implements PipeTransform { + + transform(value: number): string { + switch (value) { + case 1: + return '退款通过'; + case 2: + return '退款驳回'; + case 0: + return '退款中'; + } + } + +}