提交代码

pull/1/head
胡锐 2 years ago
parent 9135a1e5fa
commit 38e41317c2
  1. 6
      src/app/admin/config-manage/integral-rebate/integral-rebate.component.ts
  2. 122
      src/app/admin/merchant-account/mer-account-record-list/mer-account-record-list.component.html
  3. 3
      src/app/admin/merchant-account/mer-account-record-list/mer-account-record-list.component.scss
  4. 181
      src/app/admin/merchant-account/mer-account-record-list/mer-account-record-list.component.ts
  5. 14
      src/app/admin/merchant-account/merchant-account-routing.module.ts
  6. 26
      src/app/admin/merchant-account/merchant-account.module.ts
  7. 106
      src/app/admin/merchant/merchant-list/merchant-list.component.html
  8. 86
      src/app/admin/merchant/merchant-list/merchant-list.component.ts
  9. 5
      src/app/app-routing.module.ts
  10. 28
      src/app/services/mer-account-record.service.ts
  11. 42
      src/app/services/mer-account.service.ts
  12. 8
      src/environments/environment.ts

@ -1,14 +1,14 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import {environment} from '../../../../environments/environment'; import {environment} from '../../../../environments/environment';
import {FormBuilder, FormGroup, Validators} from '_@angular_forms@9.0.7@@angular/forms';
import {RechargeService} from '../../../services/recharge.service'; import {RechargeService} from '../../../services/recharge.service';
import {DiscountService} from '../../../services/discount.service'; import {DiscountService} from '../../../services/discount.service';
import {CouponService} from '../../../services/coupon.service'; import {CouponService} from '../../../services/coupon.service';
import {IconService} from '../../../services/icon.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 {CommonsService} from '../../../services/commons.service';
import {ApiProductService} from '../../../services/api-product.service'; import {ApiProductService} from '../../../services/api-product.service';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {NzMessageService} from 'ng-zorro-antd';
import {Router} from '@angular/router';
@Component({ @Component({
selector: 'app-integral-rebate', selector: 'app-integral-rebate',

@ -0,0 +1,122 @@
<!-- start 面包屑 -->
<app-breadcrumb></app-breadcrumb>
<!-- end 面包屑 -->
<!--条件搜索-->
<nz-spin [nzSpinning]="loadingObject.spinning" nzTip="{{loadingObject.msg}}">
<!--<div class="inner-content">
<form nz-form [formGroup]="searchForm" (ngSubmit)="search(searchForm.value)">
<div nz-row>
</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">
<div *ngIf="roleType == 5 && adminFlag == 0" style="width: 100%;text-align: center;">
<nz-row [nzGutter]="16">
<nz-col [nzSpan]="24">
<nz-statistic [nzValue]="'' + accountObject['amounts']" [nzTitle]="'账户余额'"></nz-statistic>
</nz-col>
</nz-row>
</div>
<span>共计 {{dataObject.total?dataObject.total:0}} 条数据</span>
<div class="operating-button">
<!-- <button nz-button nzType="primary" class="right-btn" >充值金额</button>-->
</div>
<!--数组表格 -->
<nz-table #basicTable
[nzData]="dataObject.list"
[nzTotal]="dataObject.total"
[nzFrontPagination]="false"
[nzLoading]="tableLoading"
[nzPageIndex]="whereObject.pageNum"
(nzPageIndexChange)="requestData($event)"
[nzScroll]="{ x: '1100px'}">
<thead>
<tr>
<th nzWidth="60px">序号</th>
<th nzWidth="110px">商户名称</th>
<th nzWidth="110px">交易类型</th>
<th nzWidth="110px">交易来源</th>
<th nzWidth="110px">交易余额</th>
<th nzWidth="110px">参与营销</th>
<th nzWidth="110px">营销方式</th>
<th nzWidth="110px">营销金额</th>
<th nzWidth="130px">营销交易金额</th>
<th nzWidth="130px">总交易金额</th>
<th nzWidth="110px">变更前余额</th>
<th nzWidth="110px">变更后余额</th>
<th nzWidth="110px">操作人</th>
<th nzWidth="160px">生成时间</th>
<!-- <th nzWidth="160px" nzRight="0px">操作</th>-->
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data;let i = index">
<td>{{i+1}}</td>
<td>{{data.merName}}</td>
<td>{{data.type == 1?'进账':'出账'}}</td>
<td>{{data.sourceType == 1?'金额充值':'未知'}}</td>
<td>¥{{data.amount}}</td>
<td>{{data.marketingStatus == 1?'是':'否'}}</td>
<td>
<span *ngIf="data.marketingType == null"></span>
<span *ngIf="data.marketingType == 1">赠送金额</span>
<span *ngIf="data.marketingType == 2">充值返点</span>
</td>
<td>
<span *ngIf="data.marketingType == null"></span>
<span *ngIf="data.marketingType == 1">{{'¥' + data.marketingPrice}}</span>
<span *ngIf="data.marketingType == 2">{{(data.marketingPrice * 100) + '%'}}</span>
</td>
<td>{{data.marketingTradePrice?'¥'+data.marketingTradePrice:'无'}}</td>
<td>¥{{data.tradePrice}}</td>
<td>¥{{data.beforeAmount}}</td>
<td>¥{{data.afterAmount}}</td>
<td>{{data.opUserName}}</td>
<td>{{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td>
<!-- <td nzRight="0px" class="table-td-operation">
<a (click)="showRechargeModal(data.cardNo)"> 充值 </a>
<a nz-dropdown [nzDropdownMenu]="menu"> 操作列表 <i nz-icon nzType="down"></i> </a>
<nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu nzSelectable>
</ul>
</nz-dropdown-menu>
</td>-->
</tr>
</tbody>
</nz-table>
</div>
</nz-spin>
<nz-modal [(nzVisible)]="rechargeModal" nzTitle="余额充值" (nzOnCancel)="closeRechargeModal()" nzWidth="500px" [nzFooter]="null">
<form nz-form [formGroup]="rechargeForm">
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired >当前余额</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-input-number style="width: 100%" formControlName="amount"></nz-input-number>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired >充值金额</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-input-number style="width: 100%" formControlName="amount" [nzMin]="0.01" [nzMax]="9999999" [nzStep]="1" [nzPrecision]="2"></nz-input-number>
</nz-form-control>
</nz-form-item>
<div style="text-align: center;">
<button nz-button nzType="primary" style="width: 150px;" (click)="submitRecharge()">确定</button>
</div>
</form>
</nz-modal>

@ -0,0 +1,181 @@
import { Component, OnInit } from '@angular/core';
import {environment} from '../../../../environments/environment';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {NzMessageService, NzModalService} from 'ng-zorro-antd';
import {LocalStorageService} from '../../../services/local-storage.service';
import {OilCardService} from '../../../services/oil-card.service';
import {OrganizationService} from '../../../services/organization.service';
import {CompanyAccountService} from '../../../services/company-account.service';
import {ActivatedRoute, Router} from '@angular/router';
import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace';
import {ValidatorsService} from '../../../services/validators.service';
import {MerAccountService} from '../../../services/mer-account.service';
import {MerAccountRecordService} from '../../../services/mer-account-record.service';
@Component({
selector: 'app-mer-account-record-list',
templateUrl: './mer-account-record-list.component.html',
styleUrls: ['./mer-account-record-list.component.scss']
})
export class MerAccountRecordListComponent implements OnInit {
FILE_URL = environment.imageUrl;
roleType;
adminFlag;
loadingObject = {
spinning: false,
msg: '加载中'
};
dataObject: any = {};
tableLoading = true;
searchForm: FormGroup;
pageNum: number;
whereObject: any = {};
rechargeModal = false;
rechargeForm: FormGroup; // 充值模态框
merId: number;
accountObject = {
amounts: 0
};
constructor(private modal: NzModalService,
private message: NzMessageService,
private store: LocalStorageService,
private merAccountService: MerAccountService,
private merAccountRecordService: MerAccountRecordService,
private router: Router,
private activatedRoute: ActivatedRoute,
private form: FormBuilder) {
this.activatedRoute.queryParams.subscribe(queryParams => {
if (queryParams.merId != null) {
this.merId = queryParams.merId;
}
});
this.roleType = Number(this.store.get(ADMIN_INFO_OBJECT)['secRole'].roleType);
this.adminFlag = Number(this.store.get(ADMIN_INFO_OBJECT)['secUser'].adminFlag);
}
ngOnInit(): void {
this.searchForm = this.form.group({
orgId: [null],
cardNo: [null],
contactName: [null],
contactPhone: [null],
createTime: [null],
createTimeS: [null],
createTimeE: [null],
bindTime: [null],
bindTimeS: [null],
bindTimeE: [null],
isConfigContact: [null],
status: [null],
bindStatus: [null],
});
this.rechargeForm = this.form.group({
merId: [null, [Validators.required]],
amount: [null, [Validators.required]],
marketingStatus: [null, [Validators.required]],
marketingType: [null],
marketingPrice: [null],
});
if (this.roleType === 5 && this.adminFlag === 0) {
this.getAccount();
}
this.requestData(1);
}
/**
*
*/
requestData(pageNum) {
this.tableLoading = true;
if (this.merId != null) {
this.whereObject['merId'] = this.merId;
}
this.whereObject['pageNum'] = pageNum;
this.whereObject['pageSize'] = 10;
this.merAccountRecordService.getRecordList(this.whereObject, data => {
if (data['return_code'] === '000000') {
this.dataObject = data['return_data'];
} else {
this.modal.error(data['return_msg']);
}
this.tableLoading = false;
});
}
/**
*
*/
getAccount() {
/*this.merAccountService.getAccount(data => {
this.accountObject = data['return_data'];
});*/
}
/**
*
* @param whereObject
*/
search(whereObject: object) {
this.whereObject = whereObject;
if (this.searchForm.value.createTime != null) {
this.searchForm.value.createTimeS = new Date(this.searchForm.value.createTime[0]).getTime();
this.searchForm.value.createTimeE = new Date(this.searchForm.value.createTime[1]).getTime();
} else {
this.searchForm.value.createTimeS = null;
this.searchForm.value.createTimeE = null;
}
this.requestData(1);
}
/**
*
*/
resetForm(): void {
this.searchForm.reset();
}
showRechargeModal(merId: number) {
this.rechargeForm.patchValue({ 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.merAccountService.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'],
});
}
});
}
}

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

@ -0,0 +1,26 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MerchantAccountRoutingModule } from './merchant-account-routing.module';
import { MerAccountRecordListComponent } from './mer-account-record-list/mer-account-record-list.component';
import {NgZorroAntdModule} from 'ng-zorro-antd';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module';
import {AppCommonModule} from '../../app-common.module';
import {NgxEchartsModule} from 'ngx-echarts';
@NgModule({
declarations: [MerAccountRecordListComponent],
imports: [
CommonModule,
MerchantAccountRoutingModule,
NgZorroAntdModule,
ReactiveFormsModule,
FormsModule,
BreadcrumbModule,
AppCommonModule,
NgxEchartsModule,
]
})
export class MerchantAccountModule { }

@ -80,7 +80,7 @@
<th nzWidth="100px">商户电话</th> <th nzWidth="100px">商户电话</th>
<th nzWidth="100px">创建时间</th> <th nzWidth="100px">创建时间</th>
<th nzWidth="50px">状态</th> <th nzWidth="50px">状态</th>
<th nzWidth="120px" nzRight="0px">操作</th> <th nzWidth="50px" nzRight="0px">操作</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -95,18 +95,33 @@
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td> <td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>{{data.status ===1 ? '正常' : '禁用'}}</td> <td>{{data.status ===1 ? '正常' : '禁用'}}</td>
<td nzRight="0px" class="table-td-operation"> <td nzRight="0px" class="table-td-operation">
<a (click)="getEdit(data.id)"><i nz-icon nzType="form" nzTheme="outline" nz-tooltip="编辑"></i></a> <a nz-dropdown [nzDropdownMenu]="menu">操作列表 <i nz-icon nzType="down"></i></a>
<nz-divider nzType="vertical"></nz-divider> <nz-dropdown-menu #menu="nzDropdownMenu">
<a (click)="getDetail(data.id)"><i nz-icon [nzIconfont]="'icon-xiangqing'" nz-tooltip="商户详情"></i></a> <ul nz-menu nzSelectable>
<nz-divider nzType="vertical"></nz-divider> <li nz-menu-item>
<a (click)="getList(data.id , data.merchantName)"><i nz-icon nzType="unordered-list" nzTheme="outline" nz-tooltip="门店列表"></i></a> <a (click)="getEdit(data.id)">编辑</a>
<nz-divider nzType="vertical"></nz-divider> </li>
<a *ngIf="data.status === 1" (click)='disableMerchant(data.id)'><i nz-icon nzType="stop" nzTheme="outline" nz-tooltip="禁用"></i></a> <li nz-menu-item>
<a *ngIf="data.status !== 1" (click)='enableMerchant(data.id)'><i nz-icon nzType="check-circle" nzTheme="outline" nz-tooltip="启用"></i></a> <a (click)="getDetail(data.id)">商户详情</a>
<nz-divider nzType="vertical"></nz-divider> </li>
<a (click)='showRechargeModal(data.id)'><i nz-icon nzType="dollar" nzTheme="outline" nz-tooltip="余额充值"></i></a> <li nz-menu-item>
<nz-divider nzType="vertical"></nz-divider> <a (click)="getList(data.id , data.merchantName)">门店列表</a>
<a (click)='showTripartitePlatformModal(data.id)'><i nz-icon nzType="shop" nzTheme="outline" nz-tooltip="商户平台配置"></i></a> </li>
<li nz-menu-item>
<a *ngIf="data.status === 1" (click)='disableMerchant(data.id)'>禁用</a>
<a *ngIf="data.status !== 1" (click)='enableMerchant(data.id)'>启用</a>
</li>
<li nz-menu-item>
<a (click)='showRechargeModal(data.id)'>余额充值</a>
</li>
<li nz-menu-item>
<a (click)='jumpMerAccountRecord(data.id)'>余额充值记录</a>
</li>
<li nz-menu-item>
<a (click)='showTripartitePlatformModal(data.id)'>商户平台配置</a>
</li>
</ul>
</nz-dropdown-menu>
</td> </td>
</tbody> </tbody>
</nz-table> </nz-table>
@ -114,16 +129,75 @@
<nz-modal [(nzVisible)]="rechargeModal" nzTitle="余额充值" (nzOnCancel)="closeRechargeModal()" nzWidth="500px" [nzFooter]="null"> <nz-modal [(nzVisible)]="rechargeModal" nzTitle="余额充值" (nzOnCancel)="closeRechargeModal()" nzWidth="500px" [nzFooter]="null">
<form nz-form [formGroup]="rechargeForm"> <form nz-form [formGroup]="rechargeForm">
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired >当前余额</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-input-number style="width: 100%" formControlName="merBalance"></nz-input-number>
</nz-form-control>
</nz-form-item>
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired >充值金额</nz-form-label> <nz-form-label [nzSpan]="6" nzRequired >充值金额</nz-form-label>
<nz-form-control [nzSpan]="14"> <nz-form-control [nzSpan]="14">
<nz-input-number style="width: 100%" formControlName="amount" [nzMin]="0.01" [nzMax]="9999999" [nzStep]="1" [nzPrecision]="2"></nz-input-number> <nz-input-number style="width: 100%" formControlName="amount" [nzMin]="0.01" [nzMax]="9999999" [nzStep]="1" [nzPrecision]="2"></nz-input-number>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<div style="text-align: center;">
<button nz-button nzType="primary" style="width: 150px;" (click)="submitRecharge()">确定</button> <nz-form-item>
</div> <nz-form-label [nzSpan]="6" nzRequired >参与营销</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-switch formControlName="marketingStatus" nzCheckedChildren="是" nzUnCheckedChildren="否"></nz-switch>
</nz-form-control>
</nz-form-item>
<nz-form-item *ngIf="rechargeForm.controls.marketingStatus.value == 1">
<nz-form-label [nzSpan]="6" nzRequired>营销类型</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-select formControlName="marketingType">
<nz-option nzValue="1" nzLabel="充值赠送"></nz-option>
<nz-option nzValue="2" nzLabel="充值返点"></nz-option>
<nz-option nzValue="3" nzLabel="加油减免"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item *ngIf="rechargeForm.controls.marketingStatus.value == 1
&& (rechargeForm.controls.marketingType.value == 1 || rechargeForm.controls.marketingType.value == 2)">
<nz-form-label [nzSpan]="6" nzRequired >营销金额({{rechargeForm.controls.marketingType.value == 1?'¥':''}}
{{rechargeForm.controls.marketingType.value == 2?'%':''}})</nz-form-label>
<nz-form-control [nzSpan]="14">
<nz-input-number formControlName="marketingPrice" [nzMin]="0" [nzMax]="9999" [nzStep]="1" [nzPrecision]="4" [nzPlaceHolder]="'注意营销金额(单位)'"></nz-input-number>
</nz-form-control>
</nz-form-item>
</form> </form>
<div nz-row *ngIf="rechargeForm.controls.marketingType.value == 3">
<span nz-typography><mark>注意:减免的是油站价。<br>例如:油站价8元减免0.1元,结算时每升以7.9元结算扣除商户余额。</mark></span>
<div nz-col [nzSpan]="2"></div>
<div nz-col [nzSpan]="18">
<nz-table style="text-align: center;" #editRowTable nzBordered [nzData]="oilNoData" [nzShowPagination]="false">
<thead>
<tr>
<th>油号</th>
<th>减免金额(¥)</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of editRowTable.data;" class="editable-row">
<td>{{ data.oilNo }}</td>
<td>
<div [hidden]="editOilNo === data.oilNo" (click)="startEdit(data.oilNo)">{{ data.price }}</div>
<nz-input-number [hidden]="editOilNo !== data.oilNo" [(ngModel)]="data.price" [nzMin]="0" [nzMax]="9999" [nzStep]="1" [nzPrecision]="2" (blur)="stopEdit()"></nz-input-number>
</td>
</tr>
</tbody>
</nz-table>
</div>
</div>
<div style="margin-top:15px;text-align: center;">
<button nz-button nzType="primary" style="width: 150px;" (click)="submitRecharge()">确定</button>
</div>
</nz-modal> </nz-modal>
<nz-modal [(nzVisible)]="tripartitePlatformModal" nzTitle="商户配置" (nzOnCancel)="closeTripartitePlatformModal()" nzWidth="500px" [nzFooter]="null"> <nz-modal [(nzVisible)]="tripartitePlatformModal" nzTitle="商户配置" (nzOnCancel)="closeTripartitePlatformModal()" nzWidth="500px" [nzFooter]="null">

@ -8,6 +8,7 @@ import {Router} from '@angular/router';
import {environment} from '../../../../environments/environment'; import {environment} from '../../../../environments/environment';
import {MerAmountService} from '../../../services/mer-amount.service'; import {MerAmountService} from '../../../services/mer-amount.service';
import {MerchantTripartitePlatformService} from '../../../services/merchant-tripartite-platform.service'; import {MerchantTripartitePlatformService} from '../../../services/merchant-tripartite-platform.service';
import {MerAccountService} from '../../../services/mer-account.service';
@Component({ @Component({
selector: 'app-merchant-list', selector: 'app-merchant-list',
@ -29,12 +30,16 @@ export class MerchantListComponent implements OnInit {
tripartitePlatformModal = false; tripartitePlatformModal = false;
tripartitePlatformForm: FormGroup; // 充值模态框 tripartitePlatformForm: FormGroup; // 充值模态框
oilNoData: any = [];
editOilNo: string;
constructor( constructor(
private form: FormBuilder, private form: FormBuilder,
private merchant: MerchantService, private merchant: MerchantService,
private iconService: IconService, private iconService: IconService,
private message: NzMessageService, private message: NzMessageService,
private merAmountService: MerAmountService, private merAccountService: MerAccountService,
private tripartitePlatformService: MerchantTripartitePlatformService, private tripartitePlatformService: MerchantTripartitePlatformService,
private router: Router, private router: Router,
private common: CommonsService, private common: CommonsService,
@ -56,7 +61,11 @@ export class MerchantListComponent implements OnInit {
this.rechargeForm = this.form.group({ this.rechargeForm = this.form.group({
merId: [null], merId: [null],
merBalance: [{ value: 0, disabled: true}],
amount: [null, [Validators.required]], amount: [null, [Validators.required]],
marketingStatus: [0, [Validators.required]],
marketingType: ['1'],
marketingPrice: [null],
}); });
this.tripartitePlatformForm = this.form.group({ this.tripartitePlatformForm = this.form.group({
@ -69,6 +78,16 @@ export class MerchantListComponent implements OnInit {
profitSharingReceiversNumber: [null], profitSharingReceiversNumber: [null],
profitSharingReceiversName: [null], profitSharingReceiversName: [null],
}); });
this.common.getDictionary('GAS_OIL_TYPE', data => {
for (let item of data['return_data']) {
this.oilNoData.push({
oilNo: item['codeValue'],
oilNoName: item['codeName'],
price: 0,
})
}
});
this.getRequest(true, this.searchForm.value); this.getRequest(true, this.searchForm.value);
} }
@ -161,11 +180,31 @@ export class MerchantListComponent implements OnInit {
showRechargeModal(merId: number) { showRechargeModal(merId: number) {
this.rechargeForm.patchValue({ merId}); this.merAccountService.getMerAccount(merId, data => {
let oilNoReliefPrice = data['return_data']['oilNoReliefPrice'];
// 配置了加油减免
if (oilNoReliefPrice != null) {
this.rechargeForm.controls.marketingStatus.disable();
this.rechargeForm.controls.marketingType.disable();
this.rechargeForm.patchValue({ marketingStatus: 1, marketingType: '3'});
let oilNoReliefPriceArray = JSON.parse(oilNoReliefPrice['oilNoReliefPrice']);
for (let item of oilNoReliefPriceArray) {
let oilNoData = this.oilNoData.find(o => o['oilNo'] == item['oilNo']);
if (oilNoData != null) {
oilNoData['price'] = item['price'];
}
}
} else {
this.rechargeForm.patchValue({ marketingStatus: 0, marketingType: '1'});
}
this.rechargeForm.patchValue({ merId: merId, merBalance: data['return_data']['amount']})
});
this.rechargeModal = true; this.rechargeModal = true;
} }
closeRechargeModal() { closeRechargeModal() {
this.rechargeForm.controls.marketingStatus.enable();
this.rechargeForm.controls.marketingType.enable();
this.rechargeModal = false; this.rechargeModal = false;
} }
@ -181,8 +220,30 @@ export class MerchantListComponent implements OnInit {
}); });
return; return;
} }
if (this.rechargeForm.value.marketingStatus == 1
&& (this.rechargeForm.value.marketingType == 1 || this.rechargeForm.value.marketingType == 2)) {
if (this.rechargeForm.value.marketingPrice == null) {
this.modal.warning({
nzTitle: '提示',
nzContent: '请填写所有必填项',
});
return;
}
}
this.merAmountService.recharge(this.rechargeForm.value, data => { // 营销返点
if (this.rechargeForm.controls.marketingType.value == 2) {
this.rechargeForm.value.marketingPrice = this.rechargeForm.value.marketingPrice / 10;
}
// 加油减免
if (this.rechargeForm.controls.marketingType.value == 3) {
this.rechargeForm.value.marketingOilNoData = this.oilNoData;
}
this.rechargeForm.value.marketingStatus = this.rechargeForm.controls.marketingStatus.value;
this.rechargeForm.value.marketingType = this.rechargeForm.controls.marketingType.value;
this.merAccountService.recharge(this.rechargeForm.value, data => {
if (data['return_code'] === '000000') { if (data['return_code'] === '000000') {
this.modal.success({ this.modal.success({
nzTitle: '提示', nzTitle: '提示',
@ -256,5 +317,24 @@ export class MerchantListComponent implements OnInit {
}); });
} }
// 跳转余额充值记录
public jumpMerAccountRecord(id: number): void {
this.router.navigate(['/admin/merchantAccount/account-record-list'], {
queryParams: {
merId: id
}
}).then(r => console.log(r));
}
startEdit(oilNo: string): void {
this.editOilNo = oilNo;
}
stopEdit(): void {
this.editOilNo = null;
}
} }

@ -27,6 +27,11 @@ const routes: Routes = [
loadChildren: () => import('./admin/merchant/merchant.module').then(m => m.MerchantModule), loadChildren: () => import('./admin/merchant/merchant.module').then(m => m.MerchantModule),
canActivate: [InitGuardService] canActivate: [InitGuardService]
}, },
{
path: 'merchantAccount',
loadChildren: () => import('./admin/merchant-account/merchant-account.module').then(m => m.MerchantAccountModule),
canActivate: [InitGuardService]
},
{ {
path: 'merchantStore', path: 'merchantStore',
loadChildren: () => import('./admin/merchant-store/merchant-store.module').then(m => m.MerchantStoreModule), loadChildren: () => import('./admin/merchant-store/merchant-store.module').then(m => m.MerchantStoreModule),

@ -0,0 +1,28 @@
import { Injectable } from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {CommonsService} from './commons.service';
import {environment} from '../../environments/environment';
@Injectable({
providedIn: 'root'
})
export class MerAccountRecordService {
constructor(
private http: HttpClient,
private common: CommonsService
) { }
/**
*
*
* @param params
* @param callBack
* @return data
*/
public getRecordList(params: object, callBack) {
this.http.get(environment.baseUrl + 'merAccountRecord/getRecordList?' + this.common.getWhereCondition(params)).subscribe(data => {
callBack(data);
});
}
}

@ -0,0 +1,42 @@
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 MerAccountService {
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);
});
}
/**
*
*
* @param params
* @param callBack
* @return data
*/
public getMerAccount(merId: number, callBack) {
this.http.get(environment.baseUrl + 'merAccount/getMerAccount?merId=' + merId).subscribe(data => {
callBack(data);
});
}
}

@ -4,10 +4,10 @@
export const environment = { export const environment = {
production: false, production: false,
baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址) /* baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址)
imageUrl: 'http://localhost:9302/filesystem/', imageUrl: 'http://localhost:9302/filesystem/',*/
/* baseUrl: 'https://hsgcs.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) baseUrl: 'https://hsgcs.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址)
imageUrl: 'https://hsgcs.dctpay.com/filesystem/',*/ imageUrl: 'https://hsgcs.dctpay.com/filesystem/',
key: 'https://hsgcs.dctpay.com/phone-recharge-H5/index.html?codeValue=', key: 'https://hsgcs.dctpay.com/phone-recharge-H5/index.html?codeValue=',
inviteUrl: 'https://hsgcs.dctpay.com/wx/?action=ic&id=', inviteUrl: 'https://hsgcs.dctpay.com/wx/?action=ic&id=',
}; };

Loading…
Cancel
Save