From 7106b88c6ba9d639e0adc075356f03e2c66a030a Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Fri, 27 May 2022 17:37:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/index/index/index.component.html | 37 +++++++++++- src/app/admin/index/index/index.component.ts | 20 +++++++ .../merchant-list.component.html | 19 ++++++- .../merchant-list/merchant-list.component.ts | 57 ++++++++++++++++++- .../oil-station-order.component.html | 4 +- .../oil-station-order.component.ts | 3 + src/app/services/gas.service.ts | 14 ++++- src/app/services/index.service.ts | 13 +++++ src/app/services/mer-amount.service.ts | 28 +++++++++ 9 files changed, 186 insertions(+), 9 deletions(-) create mode 100644 src/app/services/mer-amount.service.ts diff --git a/src/app/admin/index/index/index.component.html b/src/app/admin/index/index/index.component.html index 5734a56..f37ae00 100644 --- a/src/app/admin/index/index/index.component.html +++ b/src/app/admin/index/index/index.component.html @@ -8,7 +8,7 @@
-
+ @@ -64,6 +64,39 @@
+ + +
+
+ + + + + +
+


+ + + + + 序号 + 油站名称 + 油站地址 + 油站加油总额 + + + + + {{ i + 1 }} + {{ data.store_name }} + {{ data.address }} + {{ '¥' + data.countPrice }} + + + + +
+
diff --git a/src/app/admin/index/index/index.component.ts b/src/app/admin/index/index/index.component.ts index 4f38c5c..9efaa93 100644 --- a/src/app/admin/index/index/index.component.ts +++ b/src/app/admin/index/index/index.component.ts @@ -34,6 +34,10 @@ export class IndexComponent implements OnInit { history: {}, today: {}, }; + merGasCount: any = { + amount: 0, + storeList: [] + }; recordList = []; tyBalance; webSocket: WebSocket; @@ -72,6 +76,10 @@ export class IndexComponent implements OnInit { this.getGasAccount(); } } + + if (this.store.get(ADMIN_INFO_OBJECT)['secUser']['objectType'] === 2) { + this.getMerGasStatistical(); + } } // 查询余额 @@ -272,6 +280,18 @@ export class IndexComponent implements OnInit { }); } + // 查询加油站统计 + public getMerGasStatistical(): void { + this.index.getMerGasStatistical(data => { + if (data['return_code'] === '000000') { + this.merGasCount = data['return_data']; + this.loading = false; + } else { + this.message.error(data['return_msg']); + } + }); + } + // 查询预存账户油站记录 public getGasAccountRecord(): void { const paramsObject = { diff --git a/src/app/admin/merchant/merchant-list/merchant-list.component.html b/src/app/admin/merchant/merchant-list/merchant-list.component.html index dcecb3d..706d723 100644 --- a/src/app/admin/merchant/merchant-list/merchant-list.component.html +++ b/src/app/admin/merchant/merchant-list/merchant-list.component.html @@ -80,7 +80,7 @@ 商户电话 创建时间 状态 - 操作 + 操作 @@ -103,10 +103,27 @@ + +
+ +
+ + 充值金额 + + + + +
+ +
+
+
+ + diff --git a/src/app/admin/merchant/merchant-list/merchant-list.component.ts b/src/app/admin/merchant/merchant-list/merchant-list.component.ts index 53fd260..3737264 100644 --- a/src/app/admin/merchant/merchant-list/merchant-list.component.ts +++ b/src/app/admin/merchant/merchant-list/merchant-list.component.ts @@ -1,11 +1,12 @@ import { Component, OnInit } from '@angular/core'; -import {FormBuilder, FormGroup} from '@angular/forms'; +import {FormBuilder, FormGroup, Validators} from '@angular/forms'; import {IconService} from '../../../services/icon.service'; -import {NzMessageService} from 'ng-zorro-antd'; +import {NzMessageService, NzModalService} from 'ng-zorro-antd'; import {CommonsService} from '../../../services/commons.service'; import {MerchantService} from '../../../services/merchant.service'; import {Router} from '@angular/router'; import {environment} from '../../../../environments/environment'; +import {MerAmountService} from "../../../services/mer-amount.service"; @Component({ selector: 'app-merchant-list', @@ -21,13 +22,18 @@ export class MerchantListComponent implements OnInit { pageSize = 10; // 条码 loading = true; + rechargeModal = false; + rechargeForm: FormGroup; // 充值模态框 + constructor( private form: FormBuilder, private merchant: MerchantService, private iconService: IconService, private message: NzMessageService, + private merAmountService: MerAmountService, private router: Router, - private common: CommonsService + private common: CommonsService, + private modal: NzModalService, ) { } @@ -42,6 +48,11 @@ export class MerchantListComponent implements OnInit { telephone: [null], status: [null], }); + + this.rechargeForm = this.form.group({ + merId: [null], + amount: [null, [Validators.required]], + }); this.getRequest(true, this.searchForm.value); } @@ -131,5 +142,45 @@ export class MerchantListComponent implements OnInit { } }).then(r => console.log(r)); } + + + showRechargeModal(merId: number) { + this.rechargeForm.patchValue({ merId: merId}); + this.rechargeModal = true; + } + + closeRechargeModal() { + this.rechargeModal = false; + } + + submitRecharge() { + for (const i in this.rechargeForm.controls) { + this.rechargeForm.controls[i].markAsDirty(); + this.rechargeForm.controls[i].updateValueAndValidity(); + } + if (this.rechargeForm.status == null || this.rechargeForm.status !== 'VALID') { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请填写所有必填项', + }); + return; + } + + this.merAmountService.recharge(this.rechargeForm.value, data => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '充值成功', + }); + this.closeRechargeModal(); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + }); + } + } diff --git a/src/app/admin/order/oil-station-order/oil-station-order.component.html b/src/app/admin/order/oil-station-order/oil-station-order.component.html index b295686..7686ff5 100644 --- a/src/app/admin/order/oil-station-order/oil-station-order.component.html +++ b/src/app/admin/order/oil-station-order/oil-station-order.component.html @@ -111,8 +111,8 @@ {{data.status | orderCouponStatus}} 详情 - - 退款 + + 退款 diff --git a/src/app/admin/order/oil-station-order/oil-station-order.component.ts b/src/app/admin/order/oil-station-order/oil-station-order.component.ts index cbd0e9b..4c78b49 100644 --- a/src/app/admin/order/oil-station-order/oil-station-order.component.ts +++ b/src/app/admin/order/oil-station-order/oil-station-order.component.ts @@ -10,6 +10,7 @@ import {MerchantService} from '../../../services/merchant.service'; import {LocalStorageService} from '../../../services/local-storage.service'; import {CommonsService} from '../../../services/commons.service'; import {WebsocketService} from '../../../services/websocket.service'; +import {ADMIN_INFO_OBJECT} from "../../../services/local-storage.namespace"; @Component({ selector: 'app-oil-station-order', @@ -34,6 +35,7 @@ export class OilStationOrderComponent implements OnInit { isVisibleDetail = false; refundContent: string; roleType: number; + secUser: object; constructor( private form: FormBuilder, private order: OrderService, @@ -49,6 +51,7 @@ export class OilStationOrderComponent implements OnInit { } ngOnInit(): void { + this.secUser = this.store.get(ADMIN_INFO_OBJECT)['secUser']; this.init(); // 接收消息 this.webSocketService.messageSubject.subscribe( diff --git a/src/app/services/gas.service.ts b/src/app/services/gas.service.ts index 6dc73e5..64664d6 100644 --- a/src/app/services/gas.service.ts +++ b/src/app/services/gas.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import {HttpClient} from '_@angular_common@9.0.7@@angular/common/http'; import {CommonsService} from './commons.service'; -import {environment} from "../../environments/environment"; +import {environment} from '../../environments/environment'; @Injectable({ providedIn: 'root' @@ -13,6 +13,18 @@ export class GasService { private common: CommonsService ) { } + /** + * 查询商户油站统计 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public getMerGasStatistical(param: object, callBack) { + this.http.post(environment.baseUrl + 'highGas/getMerGasStatistical', param).subscribe(data => { + callBack(data); + }); + } + /** * 禁用油品 * diff --git a/src/app/services/index.service.ts b/src/app/services/index.service.ts index 9195faa..7377d43 100644 --- a/src/app/services/index.service.ts +++ b/src/app/services/index.service.ts @@ -164,6 +164,19 @@ export class IndexService { }); } + /** + * @Author Sum1Dream + * @methodName getGasStatistical + * @Description // 查询加油站统计 + * @Date 10:00 2022/5/18 + * @Param + */ + public getMerGasStatistical(callBack) { + this.http.post(environment.baseUrl + 'highGas/getMerGasStatistical', null).subscribe(data => { + callBack(data); + }); + } + /** * @Author Sum1Dream * @methodName getAccountRecordList diff --git a/src/app/services/mer-amount.service.ts b/src/app/services/mer-amount.service.ts new file mode 100644 index 0000000..2ff2b6c --- /dev/null +++ b/src/app/services/mer-amount.service.ts @@ -0,0 +1,28 @@ +import { Injectable } from '@angular/core'; +import {HttpClient} from '_@angular_common@9.0.7@@angular/common/http'; +import {CommonsService} from './commons.service'; +import {environment} from '../../environments/environment'; + +@Injectable({ + providedIn: 'root' +}) +export class MerAmountService { + + constructor( + private http: HttpClient, + private common: CommonsService + ) { } + + /** + * 充值 + * + * @param params 上传对象 + * @param callBack 回调 + * @return data 返回结果 + */ + public recharge(params: object, callBack) { + this.http.post(environment.baseUrl + 'merAccount/recharge', params).subscribe(data => { + callBack(data); + }); + } +}