diff --git a/src/app/admin/login/login/login.component.ts b/src/app/admin/login/login/login.component.ts index b1847ef..333777c 100644 --- a/src/app/admin/login/login/login.component.ts +++ b/src/app/admin/login/login/login.component.ts @@ -1,12 +1,13 @@ import {Component, OnInit} from '@angular/core'; import {FormGroup, Validators, FormBuilder} from '@angular/forms'; import {LoginService} from '../../../services/login.service'; -import {NzModalService} from 'ng-zorro-antd'; +import {NzMessageService, NzModalService} from 'ng-zorro-antd'; import {ADMIN_INFO_OBJECT, TOKEN, INIT_FLAG, LOGINTYPE} from '../../../services/local-storage.namespace'; import {LocalStorageService} from '../../../services/local-storage.service'; import {Router} from '@angular/router'; import {HttpClient} from '@angular/common/http'; + @Component({ selector: 'app-login', templateUrl: './login.component.html', @@ -21,6 +22,7 @@ export class LoginComponent implements OnInit { private form: FormBuilder, // 表单校验 private http: HttpClient, // http请求 private loginService: LoginService, + private message: NzMessageService, private modal: NzModalService) { } @@ -55,11 +57,9 @@ export class LoginComponent implements OnInit { this.store.set(LOGINTYPE, data['return_data']['type']); this.router.navigateByUrl('/admin/index').then(); } else { - this.modal.warning({ - nzTitle: '提示', - nzContent: data['return_msg'] - }); + this.message.error(data['return_msg']); } }); + } } diff --git a/src/app/admin/navigation/navigation.component.ts b/src/app/admin/navigation/navigation.component.ts index 3c7a236..9f1fd32 100644 --- a/src/app/admin/navigation/navigation.component.ts +++ b/src/app/admin/navigation/navigation.component.ts @@ -20,12 +20,11 @@ import {Md5} from 'ts-md5'; import {environment} from '../../../environments/environment'; import {HttpClient} from '@angular/common/http'; import {CompanyTwoPwdService} from '../../services/company-two-pwd.service'; -import {WebsocketService} from '../../services/websocket.service'; @Component({ selector: 'app-navigation', templateUrl: './navigation.component.html', - styleUrls: ['./navigation.component.less'], + styleUrls: ['./navigation.component.less'] }) export class NavigationComponent implements OnInit { @@ -47,9 +46,8 @@ export class NavigationComponent implements OnInit { private companyTwoPwdService: CompanyTwoPwdService, private http: HttpClient, // http请求 private iconService: IconService, - private webSocketService: WebsocketService, - private store: LocalStorageService, // 数据请求 private modal: NzModalService, + private common: CommonsService, private fb: FormBuilder, // 表单 private router: Router, ) { @@ -68,12 +66,16 @@ export class NavigationComponent implements OnInit { this.switchValue = data['return_data']['codeValue'] === '1'; }); this.menuList = this.storage.getList(ADMIN_INFO_OBJECT)['menuList']; // 定义菜单数据 - - // 连接websocket - // this.webSocketService.connect(`wss://hsgcs.dctpay.com/msg/WebSocket/` + this.store.get(ADMIN_INFO_OBJECT)['merchantStore'].id); - + this.common.getDictionaries(data => { + if (data['return_code'] === '000000') { + console.log(data); + } else { + this.message.error(data['return_msg']); + } + }); } + public activeLi(routeName): void { this.routeName = routeName; this.storage.set(ROUTENAME, routeName); diff --git a/src/app/admin/recharge-order/order-list/order-list.component.html b/src/app/admin/recharge-order/order-list/order-list.component.html index 56890d9..4a7e384 100644 --- a/src/app/admin/recharge-order/order-list/order-list.component.html +++ b/src/app/admin/recharge-order/order-list/order-list.component.html @@ -125,15 +125,15 @@
共计 {{total}} 条数据
- - - + + + + + + + + +
{{data.status | rechargeStatus}} 详情 - 再次充值 - 申请退款 + + @@ -215,10 +215,6 @@ {{data['refundTime'] | date: 'yyyy-MM-dd HH:mm:ss'}} {{data['status'] | rechargeStatus}} - - - - diff --git a/src/app/admin/recharge-order/price-list/price-list.component.html b/src/app/admin/recharge-order/price-list/price-list.component.html index 406ef4d..b2bf4e8 100644 --- a/src/app/admin/recharge-order/price-list/price-list.component.html +++ b/src/app/admin/recharge-order/price-list/price-list.component.html @@ -9,24 +9,23 @@
- 金额类型 + 运营商 - - - - + + + +
- 展示区域 + 充值平台 - - - - + + + @@ -42,6 +41,42 @@
+ + + + + + + + + + + + +
+ + 充值方式 + + + + + + + +
+
+ + 价格状态 + + + + + + + + +
+
@@ -73,35 +108,46 @@ [nzTotal]="total" [(nzPageIndex)]="pageNum" [(nzPageSize)]="pageSize" + [nzScroll]="{ x: '1200px' }" (nzPageIndexChange)="getRequest(false , searchForm.value)" (nzPageSizeChange)="getRequest(false , searchForm.value)"> - 编号 - 金额类型 - 充值类型 - 展示区域 - - - 充值金额 - 支付金额 - 创建时间 - 操作 + 编号 + 充值金额 + 折扣比例 + 支付金额 + 积分抵扣比例 + 运营商 + 充值类型 + 充值平台 + 支付方式 + 展示平台 + 商品ID + 创建时间 + 状态 + 操作 {{i + 1}} - {{data.type | rechargePrice}} + {{data.rechargePrice}} + {{data.discount + "%"}} + {{data.payPrice}} + {{data.integralDiscount + "%"}} + {{data.operatorType | rechargePrice}} {{data.rechargeType== 1? '快充':'慢充'}} - {{data.showType | showType}} - {{data.price}} - {{data.realPrice}} + {{data.rechargePlatform | rechargePlatform}} + {{data.productPayTypeString.substring(0 , data.productPayTypeString.length - 1)}} + {{data.productPlatformString.substring(0 , data.productPlatformString.length - 1)}} + {{data.goodsId == null ? '暂未配置' : data.goodsId}} {{data.createTime | date: 'yyyy-MM-dd HH:mm'}} - - 编辑 - {{data.status === 1 ? '禁用': '启用'}} - 删除 + {{data.status | priceStatus}} + + 编辑 + {{data.status === 1 ? '售空': '上线'}} + 删除 @@ -112,24 +158,80 @@ 金额类型 - - - - + + + - - 展示区域 - - - - - + + 充值金额 + + + + + + 支付金额 + + + + + + 运营商 + + + + + - + + 展示平台 + + + + + + + + 充值平台 + + + + + + + + 支付方式 + + + + + + + + 充值方式 + + + + + + + + 充值类型 @@ -139,73 +241,66 @@ - 商品排序 - - + 折扣比例 + + - - - - - - - - - - - - - 充值金额 - - - - + 积分支付比例 + + - - 折扣比例 - - - - + + 商品编号 + + - - 支付金额 - - - - + + 排序 + + - - - - - 供货商编号 - 商品ID - 渠道商标识符 - 折扣比例 - 商品名称 - 渠道商名称 - 状态 - - - - - {{data.channel}} - {{data.goodsId}} - {{data.channelMark | channelMark}} - {{data.discountRatio}}% - {{data.goodsName}} - {{data.memberName}} - {{data.state == 1 ? '上架' : '下架'}} - - - - diff --git a/src/app/admin/recharge-order/price-list/price-list.component.ts b/src/app/admin/recharge-order/price-list/price-list.component.ts index 36691eb..903eccd 100644 --- a/src/app/admin/recharge-order/price-list/price-list.component.ts +++ b/src/app/admin/recharge-order/price-list/price-list.component.ts @@ -19,6 +19,10 @@ export class PriceListComponent implements OnInit { searchForm: FormGroup; // 搜索框 validateForm: FormGroup; // 添加框 requestData = []; // 列表数据 + priceArray = []; // 价格数据 + priceTypeArray = []; // 支付类型数据 + platformArray = []; // 充值平台数据 + productPlatformArray = []; // 展示平台数据 total: number; // 页码 pageNum = 1; // 页码 @@ -27,10 +31,13 @@ export class PriceListComponent implements OnInit { isVisible = false; id: number; edit = false; - + payPrice; isVisibleGoods = false; realPrice = 0; - goodsArray; + + formatterPercent = (value: number): string => `${value == null ? 0 : value} %`; + parserPercent = (value: string): string => value.replace(' %', ''); + constructor( private form: FormBuilder, private recharge: RechargeService, @@ -45,23 +52,53 @@ export class PriceListComponent implements OnInit { ngOnInit(): void { this.init(); + this.getInitData(); + } + + // 获取初始化数据 + private getInitData(): void { + // 获取价格数据 + this.common.getDictionary('RECHARGE_AMOUNT ', data => { + this.priceArray = data['return_data']; + }); + // 获取支付类型 + this.common.getDictionary('PAY_TYPE ', data => { + this.priceTypeArray = data['return_data']; + }); + // 获取充值平台 + this.common.getDictionary('RECHARGE_PLATFORM ', data => { + this.platformArray = data['return_data']; + }); + // 获取展示平台 + this.common.getDictionary('SHOW_PLATFORM ', data => { + this.productPlatformArray = data['return_data']; + }); + } public init(): void { this.searchForm = this.form.group({ - type: [null], + operatorType : [null], + rechargePlatform: [null], rechargeType: [null], - showType: [null], + rechargeWay: [null], + status: [null], }); this.validateForm = this.form.group({ - type: [null, [Validators.required]], - showType: [null, [Validators.required]], - price: [null, [Validators.required]], - rechargeType: [null, [Validators.required]], - realPrice: [{value: null, disabled: true}, [Validators.required]], discount: [null, [Validators.required]], - sort: [null, [Validators.required]], - // channel: [null, [Validators.required]], + integralDiscount: [0], + operatorType: [null, [Validators.required]], + rechargePrices: [null, [Validators.required]], + productPlatform: [null, [Validators.required]], + rechargeType: [null, [Validators.required]], + rechargePlatform: [null, [Validators.required]], + rechargeWay: [null, [Validators.required]], + payType: [null, [Validators.required]], + rechargePrice: [null], + payPrice: [null], + sort: [null], + goodsId: [null], + }); @@ -98,6 +135,10 @@ export class PriceListComponent implements OnInit { this.id = id; this.edit = true; this.recharge.findById(id, data => { + data['return_data']['productPlatform'] = data['return_data']['productPlatformString'].substring(0 , data['return_data']['productPlatformString'].length - 1).split(','); + data['return_data']['rechargePlatform'] = data['return_data']['rechargePlatform'].substring(1 , data['return_data']['rechargePlatform'].length - 1).split('-'); + data['return_data']['payType'] = data['return_data']['productPayTypeString'].substring(0 , data['return_data']['productPayTypeString'].length - 1).split(','); + data['return_data']['rechargePrices'] = ['1']; this.validateForm.patchValue(data['return_data']); this.isVisible = true; }); @@ -108,17 +149,8 @@ export class PriceListComponent implements OnInit { } } - // 查看详情 - public getDetail(id: number): void { - this.router.navigate(['/admin/company/company-detail'], { - queryParams: { - companyId: id - } - }).then(r => console.log(r)); - } - - handleOk(): void { + const wait = this.message.loading('提交中..', { nzDuration: 0 }).messageId; // tslint:disable-next-line:forin for (const i in this.validateForm.controls) { this.validateForm.controls[i].markAsDirty(); @@ -128,14 +160,15 @@ export class PriceListComponent implements OnInit { return; } } - this.validateForm.value.realPrice = this.validateForm.value.price * this.validateForm.value.discount / 100; if (this.edit) { this.validateForm.value['id'] = this.id; this.recharge.updatePrice(this.validateForm.value, data => { if (data['return_code'] === '000000') { + this.message.remove(wait); this.message.success('修改成功'); this.getRequest(false, this.searchForm.value); + this.validateForm.reset(); this.isVisible = false; } else { this.message.error(data['return_msg']); @@ -144,9 +177,11 @@ export class PriceListComponent implements OnInit { } else { this.recharge.insertPrice(this.validateForm.value, data => { if (data['return_code'] === '000000') { + this.message.remove(wait); this.message.success('添加成功'); this.getRequest(false, this.searchForm.value); this.isVisible = false; + this.validateForm.reset(); } else { this.message.error(data['return_msg']); } @@ -156,35 +191,59 @@ export class PriceListComponent implements OnInit { } handleCancel(): void { + this.validateForm.reset(); this.isVisible = false; } - handleCancelGoods(): void { - this.isVisibleGoods = false; - } - public getForbiddenUser(id, status: any): void { - const message = (status === 1 ? '是否禁用' : '是否启用'); + public getForbiddenUser(idPost, status: any): void { + + let statusPost; + let message; - this.common.showConfirm(message, data => { - if (data) { - this.recharge.onAndOffShelves(id, dataUser => { - if (dataUser['return_code'] === '000000') { - this.message.success('操作成功'); - this.getRequest(false , this.searchForm.value); + switch (status) { + case 1: + statusPost = 2; + message = '是否售空'; + break; + case 2: + statusPost = 1; + message = '是否上线'; + break; + case 3: + statusPost = 1; + message = '是否上线'; + break; + } + + this.common.showConfirm(message, item => { + if (item) { + this.recharge.editPriceStatus( { + id: idPost, + status: statusPost + }, data => { + if (data['return_code'] === '000000') { + this.message.success('提交成功'); + this.getRequest(false, this.searchForm.value); } else { - this.message.error(dataUser['return_msg']); + this.message.error(data['return_msg']); } }); } }); + console.log(status); + console.log(statusPost); + console.log(message); } - public getForbiddenUserD(id): void { + public getForbiddenUserD(idPost): void { this.common.showConfirm('是否删除', item => { if (item) { - this.recharge.deletePrice(id, data => { + this.recharge.editPriceStatus({ + id: idPost, + status: 0 + }, data => { if (data['return_code'] === '000000') { this.message.success('删除成功'); this.getRequest(false, this.searchForm.value); @@ -196,17 +255,9 @@ export class PriceListComponent implements OnInit { }); } - public getMemberGoods(): void { - this.isVisibleGoods = true; - this.recharge.getMemberGoods(data => { - this.goodsArray = data['return_data']['data']; - }); + public changePayType(e): void { + this.payPrice = this.validateForm.value['rechargePrice'] * e / 100; } - public getPrice(): void { - this.realPrice = this.validateForm.value.price * this.validateForm.value.discount / 100; - } - - } diff --git a/src/app/app-common.module.ts b/src/app/app-common.module.ts index 06874e4..591af23 100644 --- a/src/app/app-common.module.ts +++ b/src/app/app-common.module.ts @@ -41,15 +41,11 @@ import { CompanyAmountRecordTypePipe, CompanyAmountRecordSourceTypePipe, OilCardBindStatusPipe, - OilCardRecordTypePipe, OilCardRecordSourceTypePipe + OilCardRecordTypePipe, OilCardRecordSourceTypePipe, RechargePlatformPipe, PriceStatusPipe } from './pipes'; -import {OilCardStatusPipe} from './pipes/oil-card/oil-card-status.pipe'; +import {OilCardStatusPipe} from './pipes'; import { OilTypePipe } from './pipes/store/oil-type.pipe'; -import {GasStaffStatusPipe} from './pipes/gas-staff/gas-staff-status.pipe'; - - - - +import {GasStaffStatusPipe} from './pipes'; const PIPES = [ TimesPipe, @@ -88,6 +84,10 @@ const PIPES = [ OilCardRecordTypePipe, OilCardRecordSourceTypePipe, GasStaffStatusPipe, + OilTypePipe, + RechargePlatformPipe, + PriceStatusPipe, + ]; @@ -101,8 +101,6 @@ const PIPES = [ ], declarations: [ ...PIPES, - OilTypePipe, - ], exports: [ diff --git a/src/app/pipes/index.ts b/src/app/pipes/index.ts index 42f638d..30281f4 100644 --- a/src/app/pipes/index.ts +++ b/src/app/pipes/index.ts @@ -33,3 +33,5 @@ export * from './oil-card/oil-card-bind-status.pipe'; export * from './oil-card/oil-card-record-type.pipe'; export * from './oil-card/oil-card-record-source-type.pipe'; export * from './gas-staff/gas-staff-status.pipe'; +export * from './recharge-price/recharge-platform.pipe'; +export * from './recharge-price/price-status.pipe'; diff --git a/src/app/pipes/recharge-price.pipe.ts b/src/app/pipes/recharge-price.pipe.ts index 7da171c..dfde7b3 100644 --- a/src/app/pipes/recharge-price.pipe.ts +++ b/src/app/pipes/recharge-price.pipe.ts @@ -8,11 +8,11 @@ export class RechargePricePipe implements PipeTransform { transform(value: number): string { switch (value) { case 1: - return '电信充值'; + return '电信运营商'; case 2: - return '移动充值'; + return '移动运营商'; case 3: - return '联通充值'; + return '联通运营商'; } } diff --git a/src/app/services/commons.service.ts b/src/app/services/commons.service.ts index cecb47c..d05e85f 100644 --- a/src/app/services/commons.service.ts +++ b/src/app/services/commons.service.ts @@ -6,353 +6,365 @@ import {environment} from '../../environments/environment'; import {HttpClient} from '@angular/common/http'; @Injectable({ - providedIn: 'root' + providedIn: 'root' }) export class CommonsService { - constructor( - private storage: LocalStorageService, - private modalService: NzModalService, // 对话框 - private http: HttpClient, - private notification: NzNotificationService - ) { } - - /** - * 将对象转换成GET请求参数 key1=value1&key2=value2 - * @param object 传入对象 - */ - getWhereCondition(object: object): string { - let str = ''; - for (const i in object) { - if (object[i] != null && object[i] !== '') { - if (str === '') { - str = i + '=' + object[i]; - } else { - str += '&' + i + '=' + object[i]; + constructor( + private storage: LocalStorageService, + private modalService: NzModalService, // 对话框 + private http: HttpClient, + private notification: NzNotificationService + ) { + } + + /** + * 将对象转换成GET请求参数 key1=value1&key2=value2 + * @param object 传入对象 + */ + getWhereCondition(object: object): string { + let str = ''; + for (const i in object) { + if (object[i] != null && object[i] !== '') { + if (str === '') { + str = i + '=' + object[i]; + } else { + str += '&' + i + '=' + object[i]; + } + } + } + return str; + } + + /** + * 校验当前用户是否拥有按钮权限 + * @param btnCode 按钮名称 + */ + public isBtnCompetence(btnCode: string): boolean { + let buttonList = []; + buttonList = this.storage.get(DATA).buttonList; + if (buttonList != null && buttonList.length > 0) { + if (buttonList.find(b => b.permissionCode === btnCode) != null) { + return true; + } + } + return false; + } + + /** + * 提示框提示 + * @param message 传入文字 + * @param callback 回调 + */ + public showConfirm(message, callback) { + this.modalService.confirm({ + nzTitle: message, + nzOkText: '是', + nzOkType: 'danger', + nzOnOk: () => callback(true), + nzCancelText: '否', + }); + } + + /** + * 根据estateId 查询类目树 + * + * @param estateId 类目id + * @param callBack 回调 + */ + public getMallCategoryTree(estateId: number, callBack) { + this.http.get(environment.baseUrl + 'categoryEstates/getMallCategoryTree?estateId=' + estateId).subscribe(data => { + callBack(data); + }); + } + + /** + * 获取全部区域 + * @param callBack 回调 + */ + public getParentInfosByRegionId(regionId: number, callBack) { + this.http.get(environment.baseUrl + 'common/getParentInfosByRegionId?regionId=' + regionId).subscribe(data => { + callBack(data); + }); + } + + /** + * 获取全部区域 + * @param callBack 回调 + */ + public getAllRegion(callBack) { + this.http.get(environment.baseUrl + 'common/getAllProvinceAndCity').subscribe(data => { + callBack(data); + }); + } + + /** + * 获取所有 省 市 区 + * @param callBack 回调 + */ + public getAllProvinceAndCityRegion(callBack) { + this.http.get(environment.baseUrl + 'common/getAllProvinceAndCityRegion').subscribe(data => { + callBack(data); + }); + } + + /** + * 获取行业分类 + * @param callBack 回调 + */ + public getAllIndustry(callBack) { + this.http.get(environment.baseUrl + 'secCompanyIndustry/findIndustryTree').subscribe(data => { + callBack(data); + }); + } + + + /** + * 根据数组对象去重 + * + * @param object 对象 + */ + public getUniqueObject(object: any): any { + const map = {}; + // 1、把数组元素作为对象的键存起来(这样就算有重复的元素,也会相互替换掉) + object.forEach(item => map[JSON.stringify(item)] = item); + + // 2、再把对象的值抽成一个数组返回即为不重复的集合 + return Object.keys(map).map(key => map[key]) as T[]; + } + + /** + * 根据String 非空判断 + * + * @param name String + */ + public getStringIsNull(name: string): boolean { + if (name == null) { + return true; } - } + if (name === '') { + return true; + } + } + + /** + * 校验手机号码 + * + * @param phone String + */ + public verifyPhone(phone: string): boolean { + return phone.length === 11; + } + + /** + * 根据数据类型查询数据字典 + * + * @param codeType 页码 + * @param callback 回调 + */ + public getDictionary(codeType: string, callback): any { + this.http.get(environment.baseUrl + '/common/getDictionaryByCodeType?codeType=' + codeType).subscribe(data => { + callback(data); + }); } - return str; - } - - /** - * 校验当前用户是否拥有按钮权限 - * @param btnCode 按钮名称 - */ - public isBtnCompetence(btnCode: string): boolean { - let buttonList = []; - buttonList = this.storage.get(DATA).buttonList; - if (buttonList != null && buttonList.length > 0) { - if (buttonList.find(b => b.permissionCode === btnCode) != null) { - return true; - } + + public mappingSysNameOl(codeType: string, callback): any { + this.http.get(environment.baseUrl + '/common/getDictionaryByCodeTypeOl?codeType=' + codeType).subscribe(data => { + callback(data); + }); } - return false; - } - - /** - * 提示框提示 - * @param message 传入文字 - * @param callback 回调 - */ - public showConfirm(message , callback) { - this.modalService.confirm({ - nzTitle: message, - nzOkText: '是', - nzOkType: 'danger', - nzOnOk: () => callback(true), - nzCancelText: '否', - }); - } - - /** - * 根据estateId 查询类目树 - * - * @param estateId 类目id - * @param callBack 回调 - */ - public getMallCategoryTree(estateId: number , callBack) { - this.http.get(environment.baseUrl + 'categoryEstates/getMallCategoryTree?estateId=' + estateId).subscribe(data => { - callBack(data); - }); - } - - /** - * 获取全部区域 - * @param callBack 回调 - */ - public getParentInfosByRegionId(regionId: number, callBack) { - this.http.get(environment.baseUrl + 'common/getParentInfosByRegionId?regionId=' + regionId).subscribe(data => { - callBack(data); - }); - } - - /** - * 获取全部区域 - * @param callBack 回调 - */ - public getAllRegion(callBack) { - this.http.get(environment.baseUrl + 'common/getAllProvinceAndCity').subscribe(data => { - callBack(data); - }); - } - - /** - * 获取所有 省 市 区 - * @param callBack 回调 - */ - public getAllProvinceAndCityRegion(callBack) { - this.http.get(environment.baseUrl + 'common/getAllProvinceAndCityRegion').subscribe(data => { - callBack(data); - }); - } - - /** - * 获取行业分类 - * @param callBack 回调 - */ - public getAllIndustry(callBack) { - this.http.get(environment.baseUrl + 'secCompanyIndustry/findIndustryTree').subscribe(data => { - callBack(data); - }); - } - - - /** - * 根据数组对象去重 - * - * @param object 对象 - */ - public getUniqueObject(object: any): any { - const map = {}; - // 1、把数组元素作为对象的键存起来(这样就算有重复的元素,也会相互替换掉) - object.forEach(item => map[JSON.stringify(item)] = item); - - // 2、再把对象的值抽成一个数组返回即为不重复的集合 - return Object.keys(map).map(key => map[key]) as T[]; - } - - /** - * 根据String 非空判断 - * - * @param name String - */ - public getStringIsNull(name: string): boolean { - if (name == null) { - return true; - } - if (name === '') { - return true; - } - } - - /** - * 校验手机号码 - * - * @param phone String - */ - public verifyPhone(phone: string): boolean { - return phone.length === 11; - } - - /** - * 根据数据类型查询数据字典 - * - * @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); - }); - } - - public updateDictionary(codeType: string , codeValue: string , callback): any { - this.http.get(environment.baseUrl + '/common/updateDictionary?codeType=' + codeType + '&codeValue=' + codeValue).subscribe( data => { - callback(data); - }); - } - - /** - * - * 获取全部职位类型 - * - * @param callback - */ - getAllJobType(callback) { - this.http.get('assets/json/jobType.json').subscribe( data => { - callback(data); - }); - } - - /** - * 时间戳转化为年 月 日 时 分 秒 - * timestamp: 时间戳 - * format:返回格式,支持自定义,但参数必须与formatArr里保持一致 - */ - public formatTime(timestamp: number, format: string) { - - const formatArr = ['yyyy', 'MM', 'dd', 'HH', 'mm', 'ss']; - const returnArr = []; - const date = new Date(timestamp); - - returnArr.push(date.getFullYear()); - returnArr.push(this.formatNumber(date.getMonth() + 1)); - returnArr.push(this.formatNumber(date.getDate())); - - returnArr.push(this.formatNumber(date.getHours())); - returnArr.push(this.formatNumber(date.getMinutes())); - returnArr.push(this.formatNumber(date.getSeconds())); - - // tslint:disable-next-line:forin - for (const i in returnArr) { - format = format.replace(formatArr[i], returnArr[i]); + + public updateDictionary(codeType: string, codeValue: string, callback): any { + this.http.get(environment.baseUrl + '/common/updateDictionary?codeType=' + codeType + '&codeValue=' + codeValue).subscribe(data => { + callback(data); + }); } - return format; - } - - // 数据转化 - formatNumber(n) { - n = n.toString(); - return n[1] ? n : '0' + n; - } - - /** - * Notification通知提醒框 - * - * @param type 页码 - * @param title 标题 - * @param content 内容 - */ - public createNotification(type: string , title: string , content: string): void { - this.notification.create( - type, - title, - content - ); - } - - /** - * 职位列表key查询value - * - * @param value string - * @param object object - * @param callback 回调 - */ - public positionKeyValue(value: string , object: Array , callback): void { - // tslint:disable-next-line:forin - for (const i in object) { - if (object[i].value === value) { - callback(object[i].label); - } else { - this.positionKeyValue(value , object[i].children , callback); - } + + /** + * + * 获取全部职位类型 + * + * @param callback + */ + getAllJobType(callback) { + this.http.get('assets/json/jobType.json').subscribe(data => { + callback(data); + }); + } + + /** + * 时间戳转化为年 月 日 时 分 秒 + * timestamp: 时间戳 + * format:返回格式,支持自定义,但参数必须与formatArr里保持一致 + */ + public formatTime(timestamp: number, format: string) { + + const formatArr = ['yyyy', 'MM', 'dd', 'HH', 'mm', 'ss']; + const returnArr = []; + const date = new Date(timestamp); + + returnArr.push(date.getFullYear()); + returnArr.push(this.formatNumber(date.getMonth() + 1)); + returnArr.push(this.formatNumber(date.getDate())); + + returnArr.push(this.formatNumber(date.getHours())); + returnArr.push(this.formatNumber(date.getMinutes())); + returnArr.push(this.formatNumber(date.getSeconds())); + + // tslint:disable-next-line:forin + for (const i in returnArr) { + format = format.replace(formatArr[i], returnArr[i]); + } + return format; + } + + // 数据转化 + formatNumber(n) { + n = n.toString(); + return n[1] ? n : '0' + n; + } + + /** + * Notification通知提醒框 + * + * @param type 页码 + * @param title 标题 + * @param content 内容 + */ + public createNotification(type: string, title: string, content: string): void { + this.notification.create( + type, + title, + content + ); + } + + /** + * 职位列表key查询value + * + * @param value string + * @param object object + * @param callback 回调 + */ + public positionKeyValue(value: string, object: Array, callback): void { + // tslint:disable-next-line:forin + for (const i in object) { + if (object[i].value === value) { + callback(object[i].label); + } else { + this.positionKeyValue(value, object[i].children, callback); + } + } + } + + /** + * 根据数据类型查询数据字典 + * + * @param codeType 类型 + * @param codeValue value + * @param callback 回调 + */ + public getDictionaryByCodeTypeAndValue(codeType: string, codeValue: string, callback): any { + this.http.get(environment.baseUrl + '/common/getDictionaryByCodeTypeAndValue?codeType=' + codeType + '&codeValue=' + codeValue).subscribe(data => { + callback(data); + }); + } + + /** + * 根据数据类型查询数据字典 同步请求 + * + * @param codeType 类型 + * @param codeValue value + * @param callback 回调 + */ + public getDictionaryByCodeTypeAndValuePromise(codeType: string, codeValue: string): any { + return new Promise(resolve => { + this.http.get(environment.baseUrl + '/common/getDictionaryByCodeTypeAndValue?codeType=' + codeType + '&codeValue=' + codeValue).subscribe(data => { + resolve(data['return_data']['codeName']); + }); + }); } - } - - /** - * 根据数据类型查询数据字典 - * - * @param codeType 类型 - * @param codeValue value - * @param callback 回调 - */ - public getDictionaryByCodeTypeAndValue(codeType: string , codeValue: string , callback): any { - this.http.get(environment.baseUrl + '/common/getDictionaryByCodeTypeAndValue?codeType=' + codeType + '&codeValue=' + codeValue).subscribe( data => { - callback(data); - }); - } - - /** - * 根据数据类型查询数据字典 同步请求 - * - * @param codeType 类型 - * @param codeValue value - * @param callback 回调 - */ - public getDictionaryByCodeTypeAndValuePromise(codeType: string , codeValue: string): any { - return new Promise(resolve => { - this.http.get(environment.baseUrl + '/common/getDictionaryByCodeTypeAndValue?codeType=' + codeType + '&codeValue=' + codeValue).subscribe(data => { - resolve(data['return_data']['codeName']); - }); - }); - } /** * 查询登录页展示的公司 * @param param 参数 * @param callback 回调 */ - public getHomeCompanyList(param: object, callback): any { - this.http.get(environment.baseUrl + 'common/getHomeCompanyList?' + this.getWhereCondition(param)).subscribe( data => { - callback(data); - }); - } - - /** - * 新增团油油品配置 - * - * @param params 上传对象 - * @param callBack 回调 - * @return data 返回结果 - */ - public editGasDiscountOilPrice(params: object, callBack) { - this.http.post(environment.baseUrl + 'highGasDiscountOilPrice/editGasDiscountOilPrice', params).subscribe(data => { - callBack(data); - }); - } - - /** - * 查询公司列表 - * - * @param paramsObject 对象 - * @param callBack 回调 - */ - public getList(paramsObject: object, callBack) { - this.http.get(environment.baseUrl + 'highGasDiscountOilPrice/getList?' + this.getWhereCondition(paramsObject)).subscribe(data => { - callBack(data); - }); - } - - /** - * 根据estateId 查询类目树 - * - * @param id 类目id - * @param callBack 回调 - */ - public getDetailById(id: number , callBack) { - this.http.get(environment.baseUrl + 'highGasDiscountOilPrice/getDetailById?id=' + id).subscribe(data => { - callBack(data); - }); - } - - /** - * 根据estateId 查询类目树 - * - * @param id 类目id - * @param callBack 回调 - */ - public delete(id: number , callBack) { - this.http.post(environment.baseUrl + 'highGasDiscountOilPrice/delete' , { id: id}).subscribe(data => { - callBack(data); - }); - } - - /** - * 查询公司 - * @param param 参数 - * @param callback 回调 - */ - public getOrganizationList(param: object, callback): any { - this.http.get(environment.baseUrl + 'bsOrganization/getOrganizationList?' + this.getWhereCondition(param)).subscribe( data => { - callback(data); - }); - } + public getHomeCompanyList(param: object, callback): any { + this.http.get(environment.baseUrl + 'common/getHomeCompanyList?' + this.getWhereCondition(param)).subscribe(data => { + callback(data); + }); + } + + /** + * 新增团油油品配置 + * + * @param params 上传对象 + * @param callBack 回调 + * @return data 返回结果 + */ + public editGasDiscountOilPrice(params: object, callBack) { + this.http.post(environment.baseUrl + 'highGasDiscountOilPrice/editGasDiscountOilPrice', params).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询公司列表 + * + * @param paramsObject 对象 + * @param callBack 回调 + */ + public getList(paramsObject: object, callBack) { + this.http.get(environment.baseUrl + 'highGasDiscountOilPrice/getList?' + this.getWhereCondition(paramsObject)).subscribe(data => { + callBack(data); + }); + } + + /** + * 根据estateId 查询类目树 + * + * @param id 类目id + * @param callBack 回调 + */ + public getDetailById(id: number, callBack) { + this.http.get(environment.baseUrl + 'highGasDiscountOilPrice/getDetailById?id=' + id).subscribe(data => { + callBack(data); + }); + } + + /** + * 根据estateId 查询类目树 + * + * @param id 类目id + * @param callBack 回调 + */ + public delete(id: number, callBack) { + this.http.post(environment.baseUrl + 'highGasDiscountOilPrice/delete', {id: id}).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询公司 + * @param param 参数 + * @param callback 回调 + */ + public getOrganizationList(param: object, callback): any { + this.http.get(environment.baseUrl + 'bsOrganization/getOrganizationList?' + this.getWhereCondition(param)).subscribe(data => { + callback(data); + }); + } + + /** + * 查询所有数据字典 + * @param param 参数 + * @param callback 回调 + */ + public getDictionaries(callback): any { + this.http.get(environment.baseUrl + 'bsOrganization/getOrganizationList').subscribe(data => { + callback(data); + }); + } } diff --git a/src/app/services/local-storage.namespace.ts b/src/app/services/local-storage.namespace.ts index 7932616..c98ad03 100644 --- a/src/app/services/local-storage.namespace.ts +++ b/src/app/services/local-storage.namespace.ts @@ -14,3 +14,4 @@ export const RESUME_STATUS = 'resume_status'; export const RESUME_STATUS_NAME = 'resume_status_name'; export const LOGINTYPE = 'loginType'; // 1 pc端登录 2 后台登录 export const COMPANYMENU = 'companyMenu'; // 1 公司路由 +export const ALL_DICTIONARY = 'dictionary'; // 数据字典 diff --git a/src/app/services/recharge.service.ts b/src/app/services/recharge.service.ts index 756f6ae..9e5c3ad 100644 --- a/src/app/services/recharge.service.ts +++ b/src/app/services/recharge.service.ts @@ -28,13 +28,13 @@ export class RechargeService { /** * @Author Sum1Dream - * @methodName deletePrice - * @Description //上下架 + * @methodName editPriceStatus + * @Description // 修改价格状态 * @Date 15:03 2021/8/12 * @Param mod **/ - public onAndOffShelves(id: number, callBack) { - this.http.get(environment.baseUrl + 'outRechargePrice/onAndOffShelves?id=' + id).subscribe(data => { + public editPriceStatus(params: object, callBack) { + this.http.post(environment.baseUrl + 'outRechargePrice/editPriceStatus' , params ).subscribe(data => { callBack(data); }); } diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 5a795b3..a2d6d6f 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://hsg.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) - imageUrl: 'https://hsg.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=', };