From 258d808ce43e8fd9febf8af04fbb48b4a3f90c28 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Mon, 25 Jul 2022 11:22:29 +0800 Subject: [PATCH 1/5] =?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 --- .../petrol-station-manage/petrol-station-manage.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.html b/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.html index 282b88a..f6dfa13 100644 --- a/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.html +++ b/src/app/admin/tuanyou-agent/petrol-station-manage/petrol-station-manage.component.html @@ -7,7 +7,7 @@
-
+
地区 From f04b2272a8ecc0d3d190dab0b902fcebaa1d1714 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 26 Jul 2022 18:44:33 +0800 Subject: [PATCH 2/5] =?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 --- .../device-list/device-list.component.html | 2 +- .../discount-package-list.component.html | 356 ++++++++++++------ .../discount-package-list.component.scss | 32 ++ .../discount-package-list.component.ts | 195 +++++++++- src/app/services/commons.service.ts | 16 +- src/app/services/discount-package.service.ts | 18 + 6 files changed, 499 insertions(+), 120 deletions(-) diff --git a/src/app/admin/device/device-list/device-list.component.html b/src/app/admin/device/device-list/device-list.component.html index 1331620..047fdde 100644 --- a/src/app/admin/device/device-list/device-list.component.html +++ b/src/app/admin/device/device-list/device-list.component.html @@ -154,7 +154,7 @@ - + diff --git a/src/app/admin/discount-package/discount-package-list/discount-package-list.component.html b/src/app/admin/discount-package/discount-package-list/discount-package-list.component.html index 95c678c..a0d782e 100644 --- a/src/app/admin/discount-package/discount-package-list/discount-package-list.component.html +++ b/src/app/admin/discount-package/discount-package-list/discount-package-list.component.html @@ -2,125 +2,126 @@ - -
- -
-
- - 优惠券包名称 - - - - -
-
- - 类型 - - - - - - - -
-
- - 使用归属 - - - - - - -
-
- - 优惠券包状态 - - - - - - - - -
+ + +
+ +
+
+ + 优惠券包名称 + + + + +
+
+ + 类型 + + + + + + + +
+
+ + 使用归属 + + + + + + +
+
+ + 优惠券包状态 + + + + + + + + +
-
- -
-
- -
-
- -
- -
- 共计 {{total}} 条数据 -
- +
+
+ + +
+
+
- - - - 编号 - 优惠券标题 - 销售类型 - 销售价格 - 限购数量 - 创建时间 - 总库存 - 剩余库存 - 状态 - 操作 - - - - - {{i+1}} - {{data.title}} - {{data.salesType === 1 ? '售卖' : '赠送'}} - {{data.price === null ? '暂无': data.price}} - {{data.purchaseNum === null? '暂无': data.purchaseNum}} - {{data.createdTime | date: 'yyyy-MM-dd HH:mm'}} - {{data.totalStock == null ? 0:data.totalStock }} - {{data.surplusStock == null ? 0:data.surplusStock }} - {{data.status | discountPackageStatus}} - - 详情 - - 更多 - - - - - - -
+
+ 共计 {{total}} 条数据 +
+ +
+ + + + 编号 + 优惠券标题 + 销售类型 + 销售价格 + 限购数量 + 创建时间 + 总库存 + 剩余库存 + 状态 + 操作 + + + + + {{i+1}} + {{data.title}} + {{data.salesType === 1 ? '售卖' : '赠送'}} + {{data.price === null ? '暂无': data.price}} + {{data.purchaseNum === null? '暂无': data.purchaseNum}} + {{data.createdTime | date: 'yyyy-MM-dd HH:mm'}} + {{data.totalStock == null ? 0:data.totalStock }} + {{data.surplusStock == null ? 0:data.surplusStock }} + {{data.status | discountPackageStatus}} + + 详情 + + 更多 + + + + + + +
+
@@ -147,3 +148,130 @@ + + +
+ +
+
+ + + +
+
+
+ 注意:提交赠送时系统会自动过滤 ”有误“ 和 ”重复“ 的数据,有误的数据不会赠送卷包。 + + + + 序号 + 用户手机号 + 注册状态 + 数据状态 + 错误描述 + 操作 + + + + + {{data.serialNum}} + {{data.phone}} + {{data.registerStatus?'已注册':'未注册'}} + {{data.errorStatus?'有误':'正常'}} + {{data.errorMsg?data.errorMsg:'无'}} + + 删除 + + + + +
+
+ +
+
+
+ + +
+
+
+ + 用户手机号 + + + + +
+
+
+
+ +
+
+
+
+ + + 注意:导入用户会清空现有列表中的数据。 +
+
+ + excel文件 + + + + + + +
+
+
+
+ +
+
+
diff --git a/src/app/admin/discount-package/discount-package-list/discount-package-list.component.scss b/src/app/admin/discount-package/discount-package-list/discount-package-list.component.scss index 63e3f73..eb954d4 100644 --- a/src/app/admin/discount-package/discount-package-list/discount-package-list.component.scss +++ b/src/app/admin/discount-package/discount-package-list/discount-package-list.component.scss @@ -1,3 +1,35 @@ .table-td-operation a { margin-right: 8px; } +.ant-advanced-search-form { + padding: 24px; + background: #fbfbfb; + border: 1px solid #d9d9d9; + border-radius: 6px; + margin-bottom: 10px; +} + +.search-result-list { + margin-top: 16px; + border: 1px dashed #e9e9e9; + border-radius: 6px; + background-color: #fafafa; + min-height: 200px; + text-align: center; + padding-top: 80px; +} + +[nz-form-label] { + overflow: visible; +} + +button { + margin-left: 8px; +} +.collapse { + margin-left: 8px; + font-size: 12px; +} +.search-area { + text-align: center; +} diff --git a/src/app/admin/discount-package/discount-package-list/discount-package-list.component.ts b/src/app/admin/discount-package/discount-package-list/discount-package-list.component.ts index baf94d2..1f98e47 100644 --- a/src/app/admin/discount-package/discount-package-list/discount-package-list.component.ts +++ b/src/app/admin/discount-package/discount-package-list/discount-package-list.component.ts @@ -1,13 +1,14 @@ import { Component, OnInit } from '@angular/core'; import {environment} from '../../../../environments/environment'; -import {FormBuilder, FormGroup} from '@angular/forms'; +import {FormBuilder, FormGroup, Validators} from '@angular/forms'; import {CompanyService} from '../../../services/company.service'; import {ActivateService} from '../../../services/activate.service'; import {IconService} from '../../../services/icon.service'; -import {NzMessageService} from 'ng-zorro-antd'; +import {NzMessageService, NzModalService, NzUploadChangeParam} from 'ng-zorro-antd'; import {Router} from '@angular/router'; import {CommonsService} from '../../../services/commons.service'; import {DiscountPackageService} from '../../../services/discount-package.service'; +import {ValidatorsService} from '../../../services/validators.service'; @Component({ selector: 'app-discount-package-list', @@ -15,7 +16,7 @@ import {DiscountPackageService} from '../../../services/discount-package.service styleUrls: ['./discount-package-list.component.scss'] }) export class DiscountPackageListComponent implements OnInit { - + BASE_URL = environment.baseUrl; WEB_SERVE_URL = environment.imageUrl; searchForm: FormGroup; // 搜索框 requestData = []; // 列表数据 @@ -29,12 +30,32 @@ export class DiscountPackageListComponent implements OnInit { isVisibleInventory = false; id: number; num: number; + + deliverUserAddForm: FormGroup; + deliverUserAddModal = false; + + deliverUserSearchForm: FormGroup; + deliverUserModal = false; + deliverUserArray = []; + deliverUserForm: FormGroup; + serialNumber: string; + + excelUserModal = false; + excelUploadBtn = true; + excelUploadFile = []; + + spinObject = { + title: '处理中', + status: false + }; + constructor( private form: FormBuilder, private company: CompanyService, private activate: ActivateService, private iconService: IconService, private message: NzMessageService, + private modal: NzModalService, private router: Router, private discountPackage: DiscountPackageService, private commonsService: CommonsService, @@ -54,6 +75,23 @@ export class DiscountPackageListComponent implements OnInit { status: [null], phone: [null], }); + + this.deliverUserSearchForm = this.form.group({ + phone: [null], + registerStatus: [null], + errorStatus: [null], + }); + + this.deliverUserForm = this.form.group({ + packageId: [null], + packageName: [''], + phoneArray: [null], + }); + + this.deliverUserAddForm = this.form.group({ + phone: [null, [Validators.required, ValidatorsService.mobile]], + }); + this.getRequest(true, this.searchForm.value); this.commonsService.getDictionary('USING_ATTRIBUTION ', data => { this.usingAttribution = data['return_data']; @@ -185,5 +223,156 @@ export class DiscountPackageListComponent implements OnInit { }); } + // 打开 发送优惠券包给用户模态框 + showDeliverUserModal(packageId: number, packageName: string) { + this.deliverUserForm.patchValue({ packageId: packageId, packageName: packageName}) + this.deliverUserModal = true; + } + + // 关闭 发送优惠券包给用户模态框 + closeDeliverUserModal() { + this.deliverUserForm.reset(); + this.deliverUserModal = false; + } + + // 删除赠送用户 + delDeliverUser(serialNum: number) { + this.deliverUserArray = this.deliverUserArray.filter(o => o.serialNum != serialNum); + } + + // 展示导入模态框 + showExcelUserModal() { + this.excelUserModal = true; + } + + // 关闭导入模态框 + closeExcelUserModal() { + this.excelUploadBtn = true; + this.excelUploadFile = []; + this.excelUserModal = false; + } + + // 提交赠送数据 + submitDeliverUser() { + if (this.deliverUserArray.length == 0) { + this.modal.warning({ nzTitle: '提示', nzContent: '没有需要赠送的用户'}); + } + this.deliverUserForm.patchValue({ phoneArray: this.deliverUserArray.filter(o => o.errorStatus == false)}); + this.spinObject.status = true; + this.spinObject.title = '处理中...'; + this.discountPackage.giveAway(this.deliverUserForm.value, data => { + if (data['return_code'] === '000000') { + this.serialNumber = data['return_data']; + this.closeDeliverUserModal(); + this.processRate(this.serialNumber); + } else { + this.message.create('error', data['return_msg']); + this.spinObject.status = false; + } + }); + } + + // 处理进度 + processRate(serialNum: string) { + this.spinObject.status = true; + let time = setInterval(() => this.commonsService.getRedisValueByType(serialNum, data => { + if (data['return_data'] != null) { + this.spinObject.title = '已处理' + data['return_data'] + '条数据'; + } else { + this.spinObject.status = false; + clearTimeout(time); + this.getRequest(true, this.searchForm.value); + } + }), 1000); + } + + // 提交excel数据 + submitExcelUser() { + this.discountPackage.getPhoneListByFileUrl({ fileUrl: this.excelUploadFile[0]['url']}, data => { + if (data['return_code'] === '000000') { + this.deliverUserArray = data['return_data']['data']; + this.closeExcelUserModal(); + } else { + this.message.error(data['return_msg']); + } + }); + } + + // 上传excel回调 + excelUserHandleChange(info: NzUploadChangeParam): void { + if (info.file.status !== 'uploading') { + this.excelUploadFile = []; + } + if (info.file.status === 'done') { + this.excelUploadBtn = false; + this.excelUploadFile.push( + { + uid: '1', + name: info.file.name, + status: 'done', + url: info.file['response']['return_data'][0], + thumbUrl: this.WEB_SERVE_URL + info.file['response']['return_data'][0], + } + ) + } else if (info.file.status === 'error') { + this.message.error('文件上传失败'); + } + } + + // 打开 发送优惠券包给用户模态框 + showDeliverUserAddModal() { + this.deliverUserAddModal = true; + } + + // 关闭 发送优惠券包给用户模态框 + closeDeliverUserAddModal() { + this.deliverUserAddForm.reset(); + this.deliverUserAddModal = false; + } + + submitDeliverUserAdd() { + for (const i in this.deliverUserAddForm.controls) { + this.deliverUserAddForm.controls[i].markAsDirty(); + this.deliverUserAddForm.controls[i].updateValueAndValidity(); + } + if (this.deliverUserAddForm.status == null || this.deliverUserAddForm.status !== 'VALID') { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请规范填写所有的必填项信息', + }); + return; + } + + let phoneObject = this.deliverUserArray.find(o => o.phone == this.deliverUserAddForm.controls.phone.value); + if (phoneObject != null) { + this.modal.warning({ + nzTitle: '提示', + nzContent: '手机号在列表中已存在', + }); + return; + } + + this.discountPackage.getPhoneRegisterStatus(this.deliverUserAddForm.value, data => { + if (data['return_code'] === '000000') { + this.deliverUserArray.push({ + serialNum: this.deliverUserArray.length + 1, + phone: this.deliverUserAddForm.controls.phone.value, + registerStatus: data['return_data'], + errorStatus: false, + errorMsg: null + }); + this.deliverUserArray = this.deliverUserArray.slice(); + this.closeDeliverUserAddModal(); + } + }); + } + + // 下载模板 + downloadTemp() { + window.location.href = this.WEB_SERVE_URL + 'template/导入模板.xlsx'; + } + } + + diff --git a/src/app/services/commons.service.ts b/src/app/services/commons.service.ts index e6b2348..87e9a75 100644 --- a/src/app/services/commons.service.ts +++ b/src/app/services/commons.service.ts @@ -183,12 +183,24 @@ export class CommonsService { * @param codeType 页码 * @param callback 回调 */ - public getDictionary(codeType: string , callback): any { - this.http.get(environment.baseUrl + '/common/getDictionaryByCodeType?codeType=' + codeType).subscribe( data => { + public getRedisValueByType(key: string , callback): any { + this.http.get(environment.baseUrl + '/common/getRedisValueByType?key=' + key).subscribe( data => { callback(data); }); } + /** + * 根据数据类型查询数据字典 + * + * @param codeType 页码 + * @param callback 回调 + */ + public getDictionary(codeType: string , callback): any { + this.http.get(environment.baseUrl + '/common/getDictionaryByCodeType?codeType=' + codeType).subscribe( data => { + callback(data); + }); + } + public mappingSysNameOl(codeType: string , callback): any { this.http.get(environment.baseUrl + '/common/getDictionaryByCodeTypeOl?codeType=' + codeType).subscribe( data => { callback(data); diff --git a/src/app/services/discount-package.service.ts b/src/app/services/discount-package.service.ts index ef3d328..c33f233 100644 --- a/src/app/services/discount-package.service.ts +++ b/src/app/services/discount-package.service.ts @@ -193,5 +193,23 @@ export class DiscountPackageService { }); } + public getPhoneListByFileUrl(paramsObject: object, callBack) { + this.http.post(environment.baseUrl + 'highDiscountPackage/getPhoneListByFileUrl', paramsObject).subscribe(data => { + callBack(data); + }); + } + + public getPhoneRegisterStatus(paramsObject: object, callBack) { + this.http.post(environment.baseUrl + 'highDiscountPackage/getPhoneRegisterStatus', paramsObject).subscribe(data => { + callBack(data); + }); + } + + public giveAway(paramsObject: object, callBack) { + this.http.post(environment.baseUrl + 'highDiscountPackage/giveAway', paramsObject).subscribe(data => { + callBack(data); + }); + } + } From 0fba1e3e77a121ad00f3c9e18e3a7cb1cca47539 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Wed, 27 Jul 2022 15:10:21 +0800 Subject: [PATCH 3/5] =?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 --- .../discount-package-list.component.html | 51 ++++++++++--------- .../discount-package-list.component.ts | 32 +++++++++--- src/app/services/discount-package.service.ts | 7 +++ 3 files changed, 60 insertions(+), 30 deletions(-) diff --git a/src/app/admin/discount-package/discount-package-list/discount-package-list.component.html b/src/app/admin/discount-package/discount-package-list/discount-package-list.component.html index a0d782e..23098ac 100644 --- a/src/app/admin/discount-package/discount-package-list/discount-package-list.component.html +++ b/src/app/admin/discount-package/discount-package-list/discount-package-list.component.html @@ -114,7 +114,7 @@
  • 上架
  • 下架
  • 删除
  • -
  • 赠送用户
  • +
  • 赠送用户
  • @@ -197,7 +197,8 @@
    - 注意:提交赠送时系统会自动过滤 ”有误“ 和 ”重复“ 的数据,有误的数据不会赠送卷包。 + 注意:提交赠送时系统会自动过滤 ”有误“ 和 ”重复“ 的数据,有误的数据不会赠送卷包。
    + 共计 {{deliverUserArray.length}} 条数据 @@ -250,28 +251,30 @@ - 注意:导入用户会清空现有列表中的数据。 -
    -
    - - excel文件 - - - - - - + + 注意:导入用户会清空现有列表中的数据。 +
    +
    + + excel文件 + + + + + + +
    -
    -
    -
    - +
    +
    + +
    -
    + diff --git a/src/app/admin/discount-package/discount-package-list/discount-package-list.component.ts b/src/app/admin/discount-package/discount-package-list/discount-package-list.component.ts index 1f98e47..c22ed83 100644 --- a/src/app/admin/discount-package/discount-package-list/discount-package-list.component.ts +++ b/src/app/admin/discount-package/discount-package-list/discount-package-list.component.ts @@ -33,6 +33,7 @@ export class DiscountPackageListComponent implements OnInit { deliverUserAddForm: FormGroup; deliverUserAddModal = false; + userInterval; deliverUserSearchForm: FormGroup; deliverUserModal = false; @@ -225,8 +226,20 @@ export class DiscountPackageListComponent implements OnInit { // 打开 发送优惠券包给用户模态框 showDeliverUserModal(packageId: number, packageName: string) { - this.deliverUserForm.patchValue({ packageId: packageId, packageName: packageName}) - this.deliverUserModal = true; + this.discountPackage.getHandleByPackageId({ packageId: packageId}, data => { + if (data['return_code'] === '000000') { + if (data['return_data'] != null) { + this.modal.confirm({ + nzTitle: '提示', + nzContent: '当前卷包有赠送任务进行中,是否查看赠送进度?', + nzOnOk: () => this.processRate(data['return_data']['serialNumber']) + }) + } else { + this.deliverUserForm.patchValue({ packageId: packageId, packageName: packageName}); + this.deliverUserModal = true; + } + } + }); } // 关闭 发送优惠券包给用户模态框 @@ -247,6 +260,7 @@ export class DiscountPackageListComponent implements OnInit { // 关闭导入模态框 closeExcelUserModal() { + this.spinObject.status = false; this.excelUploadBtn = true; this.excelUploadFile = []; this.excelUserModal = false; @@ -260,12 +274,15 @@ export class DiscountPackageListComponent implements OnInit { this.deliverUserForm.patchValue({ phoneArray: this.deliverUserArray.filter(o => o.errorStatus == false)}); this.spinObject.status = true; this.spinObject.title = '处理中...'; - this.discountPackage.giveAway(this.deliverUserForm.value, data => { + const param = this.deliverUserForm.value; + this.closeDeliverUserModal(); + + this.discountPackage.giveAway(param, data => { if (data['return_code'] === '000000') { this.serialNumber = data['return_data']; - this.closeDeliverUserModal(); this.processRate(this.serialNumber); } else { + this.showDeliverUserModal(this.deliverUserForm.controls.packageId.value, this.deliverUserForm.controls.packageName.value); this.message.create('error', data['return_msg']); this.spinObject.status = false; } @@ -275,24 +292,27 @@ export class DiscountPackageListComponent implements OnInit { // 处理进度 processRate(serialNum: string) { this.spinObject.status = true; - let time = setInterval(() => this.commonsService.getRedisValueByType(serialNum, data => { + this.userInterval = setInterval(() => this.commonsService.getRedisValueByType(serialNum, data => { if (data['return_data'] != null) { this.spinObject.title = '已处理' + data['return_data'] + '条数据'; } else { this.spinObject.status = false; - clearTimeout(time); this.getRequest(true, this.searchForm.value); + clearTimeout(this.userInterval); } }), 1000); } // 提交excel数据 submitExcelUser() { + this.spinObject.title = '文件导入中... 数据太多会占用较长时间'; + this.spinObject.status = true; this.discountPackage.getPhoneListByFileUrl({ fileUrl: this.excelUploadFile[0]['url']}, data => { if (data['return_code'] === '000000') { this.deliverUserArray = data['return_data']['data']; this.closeExcelUserModal(); } else { + this.spinObject.status = false; this.message.error(data['return_msg']); } }); diff --git a/src/app/services/discount-package.service.ts b/src/app/services/discount-package.service.ts index c33f233..0c0db0d 100644 --- a/src/app/services/discount-package.service.ts +++ b/src/app/services/discount-package.service.ts @@ -205,6 +205,12 @@ export class DiscountPackageService { }); } + public getHandleByPackageId(paramsObject: object, callBack) { + this.http.post(environment.baseUrl + 'highDiscountPackage/getHandleByPackageId', paramsObject).subscribe(data => { + callBack(data); + }); + } + public giveAway(paramsObject: object, callBack) { this.http.post(environment.baseUrl + 'highDiscountPackage/giveAway', paramsObject).subscribe(data => { callBack(data); @@ -212,4 +218,5 @@ export class DiscountPackageService { } + } From f6e093ebc1600796109d4b1f70fb251262e5ceb1 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Mon, 1 Aug 2022 17:12:34 +0800 Subject: [PATCH 4/5] =?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 --- .../oils-discount.component.html | 79 ++++++++++++++- .../oils-discount.component.scss | 3 + .../oils-discount/oils-discount.component.ts | 95 +++++++++++++++++++ .../services/gas-channel-config.service.ts | 40 ++++++++ 4 files changed, 214 insertions(+), 3 deletions(-) create mode 100644 src/app/services/gas-channel-config.service.ts diff --git a/src/app/admin/system/oils-discount/oils-discount.component.html b/src/app/admin/system/oils-discount/oils-discount.component.html index aaa052a..7accdeb 100644 --- a/src/app/admin/system/oils-discount/oils-discount.component.html +++ b/src/app/admin/system/oils-discount/oils-discount.component.html @@ -31,8 +31,8 @@
    共计 {{total}} 条数据
    - - + +
    + + + + 渠道 + + + + + + + +
    + + 第三方平台 + + + + + + + + + 商户全称 + + + + + + + 商户号 + + + + + + + 是否分账 + + + + + + + + + + 分账比例(%) + + + + + + + 接收方全称 + + + + + + + 接收方商户号 + + + + + +
    + +
    +
    +
    + + diff --git a/src/app/admin/system/oils-discount/oils-discount.component.scss b/src/app/admin/system/oils-discount/oils-discount.component.scss index e69de29..90447c4 100644 --- a/src/app/admin/system/oils-discount/oils-discount.component.scss +++ b/src/app/admin/system/oils-discount/oils-discount.component.scss @@ -0,0 +1,3 @@ +nz-input-number { + width: 100%; +} diff --git a/src/app/admin/system/oils-discount/oils-discount.component.ts b/src/app/admin/system/oils-discount/oils-discount.component.ts index 063221e..1cce964 100644 --- a/src/app/admin/system/oils-discount/oils-discount.component.ts +++ b/src/app/admin/system/oils-discount/oils-discount.component.ts @@ -6,6 +6,7 @@ import {CommonsService} from '../../../services/commons.service'; import {FormBuilder, FormGroup, Validators} from '@angular/forms'; import {NzMessageService, NzModalService} from 'ng-zorro-antd'; import {Router} from '@angular/router'; +import {GasChannelConfigService} from '../../../services/gas-channel-config.service'; @Component({ selector: 'app-oils-discount', @@ -25,15 +26,21 @@ export class OilsDiscountComponent implements OnInit { isVisible = false; roleTypeArray; + gasChannelConfigChannelArray = []; configOilMerNumModal = false; configOilMerNumForm: FormGroup; + channelId = '1'; + tripartitePlatformModal = false; + tripartitePlatformForm: FormGroup; + constructor( private form: FormBuilder, private modal: NzModalService, private company: CompanyService, private iconService: IconService, private message: NzMessageService, + private gasChannelConfigService: GasChannelConfigService, private router: Router, private common: CommonsService ) { @@ -43,6 +50,10 @@ export class OilsDiscountComponent implements OnInit { this.common.getDictionary('GAS_OIL_TYPE', data => { this.roleTypeArray = data['return_data']; }); + + this.common.getDictionary('GAS_CHANNEL_CONFIG_CHANNEL', data => { + this.gasChannelConfigChannelArray = data['return_data']; + }); this.init(); } @@ -60,6 +71,15 @@ export class OilsDiscountComponent implements OnInit { codeValue: [null, [Validators.required]], }); + this.tripartitePlatformForm = this.form.group({ + payPlatformType: ['1', [Validators.required]], + payPlatformMerName: [null, [Validators.required]], + payPlatformMerNo: [null, [Validators.required]], + profitSharingStatus: ['false', [Validators.required]], + profitSharingRatio: [null], + profitSharingReceiversNo: [null], + profitSharingReceiversName: [null], + }); this.getRequest(true, this.searchForm.value); } @@ -167,5 +187,80 @@ export class OilsDiscountComponent implements OnInit { } }); } + + // 打开配置第三方模态框 + showTripartitePlatformModal () { + this.selectChannel(this.channelId); + this.tripartitePlatformModal = true; + } + + // 关闭配置第三方模态框 + closeTripartitePlatformModal () { + this.tripartitePlatformModal = false; + } + + // 提交第三方 + submitTripartitePlatform() { + for (const i in this.tripartitePlatformForm.controls) { + this.tripartitePlatformForm.controls[i].markAsDirty(); + this.tripartitePlatformForm.controls[i].updateValueAndValidity(); + } + if (this.tripartitePlatformForm.status == null || this.tripartitePlatformForm.status !== 'VALID') { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请填写所有必填项', + }); + return; + } + + if (this.tripartitePlatformForm.value.profitSharingStatus === 'true' + && (this.tripartitePlatformForm.value.profitSharingRatio == null || + this.tripartitePlatformForm.value.profitSharingReceiversNo == null || + this.tripartitePlatformForm.value.profitSharingReceiversName == null)) { + this.modal.warning({ + nzTitle: '提示', + nzContent: '请填写所有必填项', + }); + return; + } + + this.tripartitePlatformForm.value['channelId'] = this.channelId; + this.gasChannelConfigService.editTripartitePlatform(this.tripartitePlatformForm.value, data => { + if (data['return_code'] === '000000') { + this.modal.success({ + nzTitle: '提示', + nzContent: '保存成功', + }); + this.closeTripartitePlatformModal(); + } else { + this.modal.error({ + nzTitle: '提示', + nzContent: data['return_msg'], + }); + } + }); + + } + + // 选择商户号 + selectChannel(channelId: string) { + this.channelId = channelId; + this.gasChannelConfigService.getDetail(Number(channelId), this.tripartitePlatformForm.value['payPlatformType'], data => { + if (data['return_data'] != null) { + data['return_data']['channelId'] = String(data['return_data']['channelId']); + data['return_data']['payPlatformType'] = String(data['return_data']['payPlatformType']); + data['return_data']['profitSharingStatus'] = String(data['return_data']['profitSharingStatus']); + this.tripartitePlatformForm.patchValue(data['return_data']) + } else { + const param = { + channelId: channelId, + payPlatformType: String(this.tripartitePlatformForm.value['payPlatformType']), + profitSharingStatus: 'false' + } + this.tripartitePlatformForm.reset(); + this.tripartitePlatformForm.patchValue(param); + } + }); + } } diff --git a/src/app/services/gas-channel-config.service.ts b/src/app/services/gas-channel-config.service.ts new file mode 100644 index 0000000..029e6ef --- /dev/null +++ b/src/app/services/gas-channel-config.service.ts @@ -0,0 +1,40 @@ +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 GasChannelConfigService { + + constructor( + private http: HttpClient, + private common: CommonsService + ) { } + + /** + * 编辑第三方 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public editTripartitePlatform(param: object, callBack) { + this.http.post(environment.baseUrl + 'gasChannelConfig/editTripartitePlatform', param).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询详情 + * + * @param param 参数对象 + * @param callBack 回调 + */ + public getDetail(channelId: number, payPlatformType: number, callBack) { + this.http.get(environment.baseUrl + 'gasChannelConfig/getDetail?channelId=' + channelId + '&payPlatformType=' + payPlatformType).subscribe(data => { + callBack(data); + }); + } + +} From b9735557fd49607d5f3eeb4decf6d071b10ffc87 Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Tue, 2 Aug 2022 22:15:31 +0800 Subject: [PATCH 5/5] =?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 --- .../gas-station-list/gas-station-list.component.html | 4 ++-- src/app/admin/system/system-user/system-user.component.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/admin/merchant-store/gas-station-list/gas-station-list.component.html b/src/app/admin/merchant-store/gas-station-list/gas-station-list.component.html index 6e12a5e..a2e1d21 100644 --- a/src/app/admin/merchant-store/gas-station-list/gas-station-list.component.html +++ b/src/app/admin/merchant-store/gas-station-list/gas-station-list.component.html @@ -83,8 +83,8 @@ 所在商户 油站名称 预存类型 - 账户余额 - 预警余额 + 账户余额 + 预警余额 预警状态 油站编号 油站地址 diff --git a/src/app/admin/system/system-user/system-user.component.html b/src/app/admin/system/system-user/system-user.component.html index 437fc0b..4334564 100644 --- a/src/app/admin/system/system-user/system-user.component.html +++ b/src/app/admin/system/system-user/system-user.component.html @@ -148,9 +148,9 @@ - 通知权限 + 通知权限 - +