|
|
@ -1,15 +1,15 @@ |
|
|
|
import {Component, OnInit} from '@angular/core'; |
|
|
|
import {Component, OnInit} from '@angular/core'; |
|
|
|
import {environment} from '../../../../environments/environment'; |
|
|
|
|
|
|
|
import {CouponService} from '../../../services/coupon.service'; |
|
|
|
|
|
|
|
import {IconService} from '../../../services/icon.service'; |
|
|
|
import {IconService} from '../../../services/icon.service'; |
|
|
|
import {CommonsService} from '../../../services/commons.service'; |
|
|
|
import {CommonsService} from '../../../services/commons.service'; |
|
|
|
import {ApiMerchantsService} from '../../../services/api-merchants.service'; |
|
|
|
import {ApiMerchantsService} from '../../../services/api-merchants.service'; |
|
|
|
import {ApiProductService} from '../../../services/api-product.service'; |
|
|
|
import {ApiProductService} from '../../../services/api-product.service'; |
|
|
|
import {FormBuilder, FormGroup, Validators} from '@angular/forms'; |
|
|
|
import {FormBuilder, FormGroup, Validators} from '@angular/forms'; |
|
|
|
import {NzMessageService} from 'ng-zorro-antd'; |
|
|
|
import {NzMessageService} from 'ng-zorro-antd'; |
|
|
|
import {Router} from '@angular/router'; |
|
|
|
|
|
|
|
import {HttpClient} from '@angular/common/http'; |
|
|
|
import {CompanyService} from '../../../services/company.service'; |
|
|
|
import { map, filter, scan , take } from 'rxjs/operators'; |
|
|
|
import {MerchantService} from '../../../services/merchant.service'; |
|
|
|
|
|
|
|
import {NzModalService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; |
|
|
|
|
|
|
|
|
|
|
|
@Component({ |
|
|
|
@Component({ |
|
|
|
selector: 'app-list', |
|
|
|
selector: 'app-list', |
|
|
@ -18,13 +18,9 @@ import { map, filter, scan , take } from 'rxjs/operators'; |
|
|
|
}) |
|
|
|
}) |
|
|
|
export class ListComponent implements OnInit { |
|
|
|
export class ListComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
|
|
WEB_SERVE_URL = environment.imageUrl; |
|
|
|
|
|
|
|
searchForm: FormGroup; // 搜索框
|
|
|
|
searchForm: FormGroup; // 搜索框
|
|
|
|
validateForm: FormGroup; // 添加框
|
|
|
|
validateForm: FormGroup; // 添加框
|
|
|
|
requestData = []; // 列表数据
|
|
|
|
requestData = []; // 列表数据
|
|
|
|
priceArray = []; // 价格数据
|
|
|
|
|
|
|
|
platformArray = []; // 充值平台数据
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
total: number; // 页码
|
|
|
|
total: number; // 页码
|
|
|
|
pageNum = 1; // 页码
|
|
|
|
pageNum = 1; // 页码
|
|
|
|
pageSize = 10; // 条码
|
|
|
|
pageSize = 10; // 条码
|
|
|
@ -36,9 +32,7 @@ export class ListComponent implements OnInit { |
|
|
|
visibleConfigProduct = false; |
|
|
|
visibleConfigProduct = false; |
|
|
|
id: number; |
|
|
|
id: number; |
|
|
|
edit = false; |
|
|
|
edit = false; |
|
|
|
payPrice; |
|
|
|
|
|
|
|
isVisibleIpAddress = false; |
|
|
|
isVisibleIpAddress = false; |
|
|
|
realPrice = 0; |
|
|
|
|
|
|
|
mchId: string; |
|
|
|
mchId: string; |
|
|
|
rechargeModal = false; |
|
|
|
rechargeModal = false; |
|
|
|
rechargeForm: FormGroup; |
|
|
|
rechargeForm: FormGroup; |
|
|
@ -48,7 +42,6 @@ export class ListComponent implements OnInit { |
|
|
|
smsCodeBtnLoading = false; |
|
|
|
smsCodeBtnLoading = false; |
|
|
|
submitRechargeBtnLoading = false; |
|
|
|
submitRechargeBtnLoading = false; |
|
|
|
countdownTime; |
|
|
|
countdownTime; |
|
|
|
|
|
|
|
|
|
|
|
merchantArray = []; |
|
|
|
merchantArray = []; |
|
|
|
merchRechargeData = []; |
|
|
|
merchRechargeData = []; |
|
|
|
merchantId: number; |
|
|
|
merchantId: number; |
|
|
@ -57,9 +50,14 @@ export class ListComponent implements OnInit { |
|
|
|
productConfigArray = []; |
|
|
|
productConfigArray = []; |
|
|
|
discount; |
|
|
|
discount; |
|
|
|
ipAddress: string; |
|
|
|
ipAddress: string; |
|
|
|
|
|
|
|
productName: string; |
|
|
|
isSpinning = false; |
|
|
|
isSpinning = false; |
|
|
|
isVisibleConfig = false; |
|
|
|
isVisibleConfig = false; |
|
|
|
checkOptions = []; |
|
|
|
checkOptions = []; |
|
|
|
|
|
|
|
merArray = []; |
|
|
|
|
|
|
|
// 产品类型
|
|
|
|
|
|
|
|
productTypeArray = []; |
|
|
|
|
|
|
|
companyArray = []; |
|
|
|
formatterPercent = (value: number): string => `${value == null ? 0 : value} %`; |
|
|
|
formatterPercent = (value: number): string => `${value == null ? 0 : value} %`; |
|
|
|
parserPercent = (value: string): string => value.replace(' %', ''); |
|
|
|
parserPercent = (value: string): string => value.replace(' %', ''); |
|
|
|
|
|
|
|
|
|
|
@ -67,12 +65,13 @@ export class ListComponent implements OnInit { |
|
|
|
private form: FormBuilder, |
|
|
|
private form: FormBuilder, |
|
|
|
private apiMerchants: ApiMerchantsService, |
|
|
|
private apiMerchants: ApiMerchantsService, |
|
|
|
private apiProduct: ApiProductService, |
|
|
|
private apiProduct: ApiProductService, |
|
|
|
private coupon: CouponService, |
|
|
|
|
|
|
|
private iconService: IconService, |
|
|
|
private iconService: IconService, |
|
|
|
private message: NzMessageService, |
|
|
|
private message: NzMessageService, |
|
|
|
private http: HttpClient, |
|
|
|
private companyService: CompanyService, |
|
|
|
private router: Router, |
|
|
|
private merchantService: MerchantService, |
|
|
|
|
|
|
|
private modalService: NzModalService, |
|
|
|
private common: CommonsService |
|
|
|
private common: CommonsService |
|
|
|
|
|
|
|
|
|
|
|
) { |
|
|
|
) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -83,13 +82,13 @@ export class ListComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
|
|
// 获取初始化数据
|
|
|
|
// 获取初始化数据
|
|
|
|
private getInitData(): void { |
|
|
|
private getInitData(): void { |
|
|
|
// 获取价格数据
|
|
|
|
// 获取产品类型
|
|
|
|
this.common.getDictionary('RECHARGE_AMOUNT ', data => { |
|
|
|
this.common.getDictionary('ORDER_PRODUCT_TYPE', data => { |
|
|
|
this.priceArray = data['return_data']; |
|
|
|
this.productTypeArray = data['return_data']; |
|
|
|
}); |
|
|
|
}); |
|
|
|
// 获取充值平台
|
|
|
|
// 获取所有公司
|
|
|
|
this.common.getDictionary('RECHARGE_PLATFORM ', data => { |
|
|
|
this.companyService.selectCompanyList({ pageNum: 1, pageSize: 999 }, data => { |
|
|
|
this.platformArray = data['return_data']; |
|
|
|
this.companyArray = data['return_data']['list']; |
|
|
|
}); |
|
|
|
}); |
|
|
|
// 获取可用接口数据
|
|
|
|
// 获取可用接口数据
|
|
|
|
this.common.getDictionary('API_PRODUCT_CONFIG', data => { |
|
|
|
this.common.getDictionary('API_PRODUCT_CONFIG', data => { |
|
|
@ -115,8 +114,11 @@ export class ListComponent implements OnInit { |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.initApiMerchantsPostFrom(false); |
|
|
|
this.initApiMerchantsPostFrom(false); |
|
|
|
this.configValidateForm = this.form.group({ |
|
|
|
this.configValidateForm = this.form.group({ |
|
|
|
productIds: [null, [Validators.required]], |
|
|
|
productType: [null], |
|
|
|
discount: [null, [Validators.required]], |
|
|
|
companyId: [null], |
|
|
|
|
|
|
|
merchantId: [null], |
|
|
|
|
|
|
|
mchId: [null], |
|
|
|
|
|
|
|
discount: [null], |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
this.getRequest(true, this.searchForm.value); |
|
|
|
this.getRequest(true, this.searchForm.value); |
|
|
@ -272,38 +274,6 @@ export class ListComponent implements OnInit { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public getEditConfigProductStatus(idPost, status: any): void { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let statusPost; |
|
|
|
|
|
|
|
let message; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (status) { |
|
|
|
|
|
|
|
case 102: |
|
|
|
|
|
|
|
statusPost = 101; |
|
|
|
|
|
|
|
message = '是否上线'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case 101: |
|
|
|
|
|
|
|
statusPost = 102; |
|
|
|
|
|
|
|
message = '是否禁用'; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.common.showConfirm(message, item => { |
|
|
|
|
|
|
|
if (item) { |
|
|
|
|
|
|
|
this.apiMerchants.editConfigApiProductByStatus({ |
|
|
|
|
|
|
|
id: idPost, |
|
|
|
|
|
|
|
status: statusPost |
|
|
|
|
|
|
|
}, data => { |
|
|
|
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
|
|
|
this.message.success('提交成功'); |
|
|
|
|
|
|
|
this.getListMerchProduct(this.merchantId); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
this.message.error(data['return_msg']); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 展示充值模态框 |
|
|
|
* 展示充值模态框 |
|
|
@ -410,8 +380,8 @@ export class ListComponent implements OnInit { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 配置产品
|
|
|
|
// 配置产品
|
|
|
|
public configProduct(id: number): void { |
|
|
|
public configProduct(mchId: string): void { |
|
|
|
this.merchantId = id; |
|
|
|
this.mchId = mchId; |
|
|
|
this.configVisible = true; |
|
|
|
this.configVisible = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -421,13 +391,13 @@ export class ListComponent implements OnInit { |
|
|
|
for (const i in this.configValidateForm.controls) { |
|
|
|
for (const i in this.configValidateForm.controls) { |
|
|
|
this.configValidateForm.controls[i].markAsDirty(); |
|
|
|
this.configValidateForm.controls[i].markAsDirty(); |
|
|
|
this.configValidateForm.controls[i].updateValueAndValidity(); |
|
|
|
this.configValidateForm.controls[i].updateValueAndValidity(); |
|
|
|
console.log(this.configValidateForm.controls[i]); |
|
|
|
|
|
|
|
if (this.configValidateForm.controls[i].errors != null) { |
|
|
|
if (this.configValidateForm.controls[i].errors != null) { |
|
|
|
this.message.error('必填项不能为空'); |
|
|
|
this.message.error('必填项不能为空'); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.configValidateForm.value['merchantsId'] = this.merchantId; |
|
|
|
this.configValidateForm.controls['mchId'].setValue(this.mchId); |
|
|
|
|
|
|
|
console.log(this.configValidateForm.value); |
|
|
|
this.apiMerchants.configApiProduct(this.configValidateForm.value , data => { |
|
|
|
this.apiMerchants.configApiProduct(this.configValidateForm.value , data => { |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
this.configVisible = false; |
|
|
|
this.configVisible = false; |
|
|
@ -439,15 +409,17 @@ export class ListComponent implements OnInit { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public showConfigProduct(id: number) { |
|
|
|
public showConfigProduct(id: string) { |
|
|
|
this.visibleConfigProduct = true; |
|
|
|
this.visibleConfigProduct = true; |
|
|
|
this.merchantId = id; |
|
|
|
this.mchId = id; |
|
|
|
this.getListMerchProduct(id); |
|
|
|
this.getListMerchProduct(id); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public getListMerchProduct(id: number): void { |
|
|
|
public getListMerchProduct(id: string): void { |
|
|
|
|
|
|
|
this.loading = true; |
|
|
|
this.apiProduct.getListMerchProduct(id , data => { |
|
|
|
this.apiProduct.getListMerchProduct(id , data => { |
|
|
|
|
|
|
|
this.loading = false; |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
this.productConfigArray = data['return_data']; |
|
|
|
this.productConfigArray = data['return_data']; |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -458,9 +430,10 @@ export class ListComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 修改商品
|
|
|
|
// 修改商品
|
|
|
|
public getEditConfigProduct(id: number) { |
|
|
|
public getEditConfigProduct(id: number , name: string) { |
|
|
|
this.configProductId = id; |
|
|
|
this.configProductId = id; |
|
|
|
this.apiMerchants.findConfigProduct(id , data => { |
|
|
|
this.productName = name; |
|
|
|
|
|
|
|
this.apiMerchants.findMchProduct(id , data => { |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
this.discount = data['return_data']['discount']; |
|
|
|
this.discount = data['return_data']['discount']; |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -482,7 +455,7 @@ export class ListComponent implements OnInit { |
|
|
|
this.apiMerchants.updateConfigApiProduct(prams , data => { |
|
|
|
this.apiMerchants.updateConfigApiProduct(prams , data => { |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
this.editConfigVisible = false; |
|
|
|
this.editConfigVisible = false; |
|
|
|
this.getListMerchProduct(this.merchantId); |
|
|
|
this.getListMerchProduct(this.mchId); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.message.error(data['return_msg']); |
|
|
|
this.message.error(data['return_msg']); |
|
|
|
} |
|
|
|
} |
|
|
@ -498,6 +471,7 @@ export class ListComponent implements OnInit { |
|
|
|
// 打开配置ip地址
|
|
|
|
// 打开配置ip地址
|
|
|
|
public configIp(mchId: string): void { |
|
|
|
public configIp(mchId: string): void { |
|
|
|
this.mchId = mchId; |
|
|
|
this.mchId = mchId; |
|
|
|
|
|
|
|
this.ipAddress = null; |
|
|
|
this.apiMerchants.findByMchId( mchId , data => { |
|
|
|
this.apiMerchants.findByMchId( mchId , data => { |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
this.ipAddress = data['return_data']['ipAddress']; |
|
|
|
this.ipAddress = data['return_data']['ipAddress']; |
|
|
@ -523,50 +497,41 @@ export class ListComponent implements OnInit { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 打开配置产品弹框
|
|
|
|
|
|
|
|
public configApiProduct(mchId: string): void { |
|
|
|
// 获取商户列表
|
|
|
|
this.mchId = mchId; |
|
|
|
requestMerList(companyId: number) { |
|
|
|
this.apiMerchants.getSecConfigList(mchId , data => { |
|
|
|
if (companyId != null) { |
|
|
|
console.log(data); |
|
|
|
this.merchantService.getMerchantListByCompany(companyId, data => { |
|
|
|
const returnData = data['return_data']; |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
if (data['return_data'].length > 0) { |
|
|
|
this.merArray = data['return_data']; |
|
|
|
for (const i of this.checkOptions) { |
|
|
|
|
|
|
|
if (returnData.filter(item => item['codeType'] === i['value']).length > 0) { |
|
|
|
|
|
|
|
i['checked'] = true; |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
i['checked'] = false; |
|
|
|
this.message.error(data['return_msg']); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.isVisibleConfig = true; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 是否删除
|
|
|
|
|
|
|
|
showDeleteConfirmDelete(id): void { |
|
|
|
|
|
|
|
this.modalService.confirm({ |
|
|
|
|
|
|
|
nzTitle: '是否确定删除', |
|
|
|
|
|
|
|
nzOkText: '是', |
|
|
|
|
|
|
|
nzOnOk: () => this.deleteModule(id), |
|
|
|
|
|
|
|
nzCancelText: '否', |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 配置产品
|
|
|
|
deleteModule(id: number) { |
|
|
|
public handleOkConfigProduct(): void { |
|
|
|
if (id != null) { |
|
|
|
const data = []; |
|
|
|
this.apiProduct.detailApiMchProduct(id, data => { |
|
|
|
for (const i of this.checkOptions) { |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
if (i['checked']) { |
|
|
|
this.getListMerchProduct(this.mchId); |
|
|
|
data.push(i['value']); |
|
|
|
this.message.success('操作成功'); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
console.log(data); |
|
|
|
|
|
|
|
const postData = { |
|
|
|
|
|
|
|
mchId: this.mchId, |
|
|
|
|
|
|
|
configProduct: data.join(',') |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
this.isSpinning = true; |
|
|
|
|
|
|
|
this.apiMerchants.configMerchant(postData , res => { |
|
|
|
|
|
|
|
if (res['return_code'] === '000000') { |
|
|
|
|
|
|
|
this.isSpinning = false; |
|
|
|
|
|
|
|
this.message.success('配置成功'); |
|
|
|
|
|
|
|
this.isVisibleConfig = false; |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this.message.error(res['return_msg']); |
|
|
|
this.message.error(data['return_msg']); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|