diff --git a/src/app/admin/config-manage/integral-rebate/integral-rebate.component.ts b/src/app/admin/config-manage/integral-rebate/integral-rebate.component.ts index 53d3b3d..2372512 100644 --- a/src/app/admin/config-manage/integral-rebate/integral-rebate.component.ts +++ b/src/app/admin/config-manage/integral-rebate/integral-rebate.component.ts @@ -1,14 +1,14 @@ import { Component, OnInit } from '@angular/core'; import {environment} from '../../../../environments/environment'; -import {FormBuilder, FormGroup, Validators} from '_@angular_forms@9.0.7@@angular/forms'; import {RechargeService} from '../../../services/recharge.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 {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({ selector: 'app-integral-rebate', diff --git a/src/app/admin/merchant-account/mer-account-record-list/mer-account-record-list.component.html b/src/app/admin/merchant-account/mer-account-record-list/mer-account-record-list.component.html new file mode 100644 index 0000000..8589fc1 --- /dev/null +++ b/src/app/admin/merchant-account/mer-account-record-list/mer-account-record-list.component.html @@ -0,0 +1,122 @@ + + + + + + + + +
+
+ + + + + +
+ 共计 {{dataObject.total?dataObject.total:0}} 条数据 +
+ +
+ + + + + + 序号 + 商户名称 + 交易类型 + 交易来源 + 交易余额 + 参与营销 + 营销方式 + 营销金额 + 营销交易金额 + 总交易金额 + 变更前余额 + 变更后余额 + 操作人 + 生成时间 + + + + + + {{i+1}} + {{data.merName}} + {{data.type == 1?'进账':'出账'}} + {{data.sourceType == 1?'金额充值':'未知'}} + ¥{{data.amount}} + {{data.marketingStatus == 1?'是':'否'}} + + + 赠送金额 + 充值返点 + + + + {{'¥' + data.marketingPrice}} + {{(data.marketingPrice * 100) + '%'}} + + {{data.marketingTradePrice?'¥'+data.marketingTradePrice:'无'}} + ¥{{data.tradePrice}} + ¥{{data.beforeAmount}} + ¥{{data.afterAmount}} + {{data.opUserName}} + {{data.createTime | date : 'yyyy-MM-dd HH:mm:ss'}} + + + + +
+
+ + + + +
+ + 当前余额 + + + + + + + 充值金额 + + + + +
+ +
+
+
diff --git a/src/app/admin/merchant-account/mer-account-record-list/mer-account-record-list.component.scss b/src/app/admin/merchant-account/mer-account-record-list/mer-account-record-list.component.scss new file mode 100644 index 0000000..690993b --- /dev/null +++ b/src/app/admin/merchant-account/mer-account-record-list/mer-account-record-list.component.scss @@ -0,0 +1,3 @@ +.table-td-operation a { + padding: 0px 5px; +} diff --git a/src/app/admin/merchant-account/mer-account-record-list/mer-account-record-list.component.ts b/src/app/admin/merchant-account/mer-account-record-list/mer-account-record-list.component.ts new file mode 100644 index 0000000..1361bf6 --- /dev/null +++ b/src/app/admin/merchant-account/mer-account-record-list/mer-account-record-list.component.ts @@ -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'], + }); + } + }); + } + +} diff --git a/src/app/admin/merchant-account/merchant-account-routing.module.ts b/src/app/admin/merchant-account/merchant-account-routing.module.ts new file mode 100644 index 0000000..7c3afc6 --- /dev/null +++ b/src/app/admin/merchant-account/merchant-account-routing.module.ts @@ -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 { } diff --git a/src/app/admin/merchant-account/merchant-account.module.ts b/src/app/admin/merchant-account/merchant-account.module.ts new file mode 100644 index 0000000..33a5dbe --- /dev/null +++ b/src/app/admin/merchant-account/merchant-account.module.ts @@ -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 { } 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 e27aa7d..f97087e 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 @@ 商户电话 创建时间 状态 - 操作 + 操作 @@ -95,18 +95,33 @@ {{data.createTime | date: 'yyyy-MM-dd HH:mm'}} {{data.status ===1 ? '正常' : '禁用'}} - - - - - - - - - - - - + 操作列表 + + + @@ -114,16 +129,75 @@
+ + 当前余额 + + + + + 充值金额 -
- -
+ + + 参与营销 + + + + + + + 营销类型 + + + + + + + + + + + 营销金额({{rechargeForm.controls.marketingType.value == 1?'¥':''}} + {{rechargeForm.controls.marketingType.value == 2?'%':''}}) + + + +
+ +
+ 注意:减免的是油站价。
例如:油站价8元减免0.1元,结算时每升以7.9元结算扣除商户余额。
+
+
+ + + + 油号 + 减免金额(¥) + + + + + {{ data.oilNo }} + +
{{ data.price }}
+ + + + +
+
+
+ +
+ +
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 3c550ae..eeb290a 100644 --- a/src/app/admin/merchant/merchant-list/merchant-list.component.ts +++ b/src/app/admin/merchant/merchant-list/merchant-list.component.ts @@ -8,6 +8,7 @@ import {Router} from '@angular/router'; import {environment} from '../../../../environments/environment'; import {MerAmountService} from '../../../services/mer-amount.service'; import {MerchantTripartitePlatformService} from '../../../services/merchant-tripartite-platform.service'; +import {MerAccountService} from '../../../services/mer-account.service'; @Component({ selector: 'app-merchant-list', @@ -29,12 +30,16 @@ export class MerchantListComponent implements OnInit { tripartitePlatformModal = false; tripartitePlatformForm: FormGroup; // 充值模态框 + + oilNoData: any = []; + editOilNo: string; + constructor( private form: FormBuilder, private merchant: MerchantService, private iconService: IconService, private message: NzMessageService, - private merAmountService: MerAmountService, + private merAccountService: MerAccountService, private tripartitePlatformService: MerchantTripartitePlatformService, private router: Router, private common: CommonsService, @@ -56,7 +61,11 @@ export class MerchantListComponent implements OnInit { this.rechargeForm = this.form.group({ merId: [null], + merBalance: [{ value: 0, disabled: true}], amount: [null, [Validators.required]], + marketingStatus: [0, [Validators.required]], + marketingType: ['1'], + marketingPrice: [null], }); this.tripartitePlatformForm = this.form.group({ @@ -69,6 +78,16 @@ export class MerchantListComponent implements OnInit { profitSharingReceiversNumber: [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); } @@ -161,11 +180,31 @@ export class MerchantListComponent implements OnInit { 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; } closeRechargeModal() { + this.rechargeForm.controls.marketingStatus.enable(); + this.rechargeForm.controls.marketingType.enable(); this.rechargeModal = false; } @@ -181,8 +220,30 @@ export class MerchantListComponent implements OnInit { }); 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') { this.modal.success({ 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; + } + + } diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 4b44e07..977f099 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -27,6 +27,11 @@ const routes: Routes = [ loadChildren: () => import('./admin/merchant/merchant.module').then(m => m.MerchantModule), canActivate: [InitGuardService] }, + { + path: 'merchantAccount', + loadChildren: () => import('./admin/merchant-account/merchant-account.module').then(m => m.MerchantAccountModule), + canActivate: [InitGuardService] + }, { path: 'merchantStore', loadChildren: () => import('./admin/merchant-store/merchant-store.module').then(m => m.MerchantStoreModule), diff --git a/src/app/services/mer-account-record.service.ts b/src/app/services/mer-account-record.service.ts new file mode 100644 index 0000000..bfadc03 --- /dev/null +++ b/src/app/services/mer-account-record.service.ts @@ -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); + }); + } +} diff --git a/src/app/services/mer-account.service.ts b/src/app/services/mer-account.service.ts new file mode 100644 index 0000000..c63dbb7 --- /dev/null +++ b/src/app/services/mer-account.service.ts @@ -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); + }); + } + +} diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 0f97376..ca22a39 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -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/', key: 'https://hsgcs.dctpay.com/phone-recharge-H5/index.html?codeValue=', inviteUrl: 'https://hsgcs.dctpay.com/wx/?action=ic&id=', };