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 new file mode 100644 index 0000000..082eecd --- /dev/null +++ b/src/app/admin/recharge-order/order-list/order-list.component.html @@ -0,0 +1,259 @@ + + + + + +
+
+
+ +
+ + 名称 + + + + +
+
+ + 电话 + + + + +
+
+ + 代理商状态 + + + + + + + +
+ +
+ +
+
+ + +
+
+
+
+ + +
+ 共计 {{total}} 条数据 +
+ +
+ + + + 编号 + 代理商名称 + 代理商地址 + 联系人 + 联系方式 + 创建时间 + 操作 + + + + + {{i + 1}} + {{data.agentName}} + {{data.agentAddress}} + {{data.agentUser}} + {{data.agentPhone}} + {{data.createTime | date: 'yyyy-MM-dd HH:mm'}} + + 编辑 + 更多 + + + + + + +
+ + +
+ + 优惠券 + + + + + + + + 分配优惠券数量 + + + + +
+
+ + + + + + 优惠券KEY + 优惠券名称 + 优惠券类型 + 优惠内容 + 有效天数 + 截止日期 + 库存数量 + + + + + {{data['highDiscount'].discountKey}} + {{data['highDiscount'].discountName}} + {{data['highDiscount'].discountType | discountType}} + + + 满{{data['highDiscount'].discountCondition}}抵扣{{data['highDiscount'].discountPrice}} + + + 抵扣{{data['highDiscount'].discountPrice}} + + + {{data['highDiscount'].discountPrice}}折 + + + {{data['highDiscount'].effectiveDay}} + {{data['highDiscount'].salesEndTime | date: 'yyyy-MM-dd HH:mm'}} + {{data.stockCount}} + + + + + + + + + + + + + + + + + 卡券名称 + 卡券销售价格 + 库存数量 + 销售数量 + 分发时间 + 操作 + + + + + {{data['couponName']}} + {{data['salesPrice']}}元 + {{data['stockCount']}} + {{data['salesCount']}} + {{data['createTime'] | date: 'yyyy-MM-dd HH:mm'}} + + 分发历史 + + + + + + + + + + + 卡券名称 + 代理商 + 分发数量 + 分发时间 + + + + + {{data.couponName}} + {{data.agentName}} + {{data.stockCount}} + {{data['createTime'] | date: 'yyyy-MM-dd HH:mm'}} + + + + diff --git a/src/app/admin/recharge-order/order-list/order-list.component.scss b/src/app/admin/recharge-order/order-list/order-list.component.scss new file mode 100644 index 0000000..b9c92c7 --- /dev/null +++ b/src/app/admin/recharge-order/order-list/order-list.component.scss @@ -0,0 +1,12 @@ +.head_img { + height: 80px; + width: 80px; +} +.table-td-operation { + a { + margin-left: 8px; + } +} +.li-a :hover { + color: #1890ff; +} diff --git a/src/app/admin/recharge-order/order-list/order-list.component.ts b/src/app/admin/recharge-order/order-list/order-list.component.ts new file mode 100644 index 0000000..52258bd --- /dev/null +++ b/src/app/admin/recharge-order/order-list/order-list.component.ts @@ -0,0 +1,307 @@ +import { Component, OnInit } from '@angular/core'; +import {environment} from "../../../../environments/environment"; +import {FormBuilder, FormGroup, Validators} from "_@angular_forms@9.0.7@@angular/forms"; +import {AgentService} from "../../../services/agent.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"; + +@Component({ + selector: 'app-order-list', + templateUrl: './order-list.component.html', + styleUrls: ['./order-list.component.scss'] +}) +export class OrderListComponent implements OnInit { + + WEB_SERVE_URL = environment.imageUrl; + searchForm: FormGroup; // 搜索框 + validateForm: FormGroup; // 搜索框 + validateFormDistribute: FormGroup; // 搜索框 + requestData = []; // 列表数据 + discountList = []; // 列表数据 + distributeList = []; // 列表数据 + total: number; // 页码 + pageNum = 1; // 页码 + pageSize = 10; // 条码 + loading = true; + isVisible = false; + isVisibleDiscount = false; + isVisibleDistribute = false; + isVisibleList = false; + id: number; + isSpinning = false; + isSpinningDistribute = false; + requestDataDiscount = []; // 列表数据 + totalDiscount: number; // 页码 + pageNumDiscount = 1; // 页码 + pageSizeDiscount = 10; // 条码 + loadingDiscount = true; + agentId: number; + requestDataList = []; // 列表数据 + totalList: number; // 页码 + pageNumList = 1; // 页码 + pageSizeList = 10; // 条码 + loadingList = true; + isOkLoading = false; + isVisibleShow = false; + dataSet; + constructor( + private form: FormBuilder, + private agent: AgentService, + private discount: DiscountService, + private coupon: CouponService, + private iconService: IconService, + private message: NzMessageService, + private router: Router, + private common: CommonsService + ) { + } + + ngOnInit(): void { + this.init(); + } + + public init(): void { + this.searchForm = this.form.group({ + agentName: [null], + agentPhone: [null], + status: [null], + }); + this.validateForm = this.form.group({ + discountId: [null, [Validators.required]], + stockCount: [null, [Validators.required]], + }); + this.validateFormDistribute = this.form.group({ + couponId: [null, [Validators.required]], + stockCount: [null, [Validators.required]], + }); + this.getRequest(true, this.searchForm.value); + } + + // 查询列表 + public getRequest(reset: boolean = false, whereObject: object) { + + this.loading = false; + if (reset) { + this.pageNum = 1; + } + whereObject['pageNum'] = this.pageNum; + whereObject['pageSize'] = this.pageSize; + this.agent.getListAgent(whereObject, data => { + if (data['return_code'] === '000000') { + this.requestData = data['return_data'].list; + this.total = data['return_data'].total; + } else { + this.message.error(data['return_msg']); + } + }); + } + + // 重置 + public resetForm(): void { + this.searchForm.reset(); + } + + public getForbiddenUser(id, status: any): void { + const message = (status === 1 ? '是否禁用当前代理商' : '是否启用当前代理商'); + + this.common.showConfirm(message, data => { + if (data) { + this.agent.editStatus(id, dataUser => { + this.getRequest(false, this.searchForm.value); + }); + } + }); + } + + // 修改 + public getEdit(id: number): void { + this.router.navigate(['/admin/agent/agent-edit'], { + queryParams: { + agentId: id + } + }).then(r => console.log(r)); + } + + // 查看详情 + public getDetail(id: number): void { + this.router.navigate(['/admin/company/company-detail'], { + queryParams: { + companyId: id + } + }).then(r => console.log(r)); + } + + // 绑定优惠券 + public getDiscount(id: number): void { + this.id = id; + const whereObject = {}; + whereObject['pageNum'] = 1; + whereObject['pageSize'] = 10000; + this.discount.getDiscountList(whereObject, data => { + if (data['return_code'] === '000000') { + this.discountList = data['return_data'].list; + } else { + this.message.error(data['return_msg']); + } + }); + this.isVisible = true; + } + + handleOk(): void { + // tslint:disable-next-line:forin + for (const i in this.validateForm.controls) { + this.validateForm.controls[i].markAsDirty(); + this.validateForm.controls[i].updateValueAndValidity(); + if (this.validateForm.controls[i].errors != null) { + this.message.error('必填项不能为空'); + return; + } + } + // this.isSpinning = true; + this.validateForm.value['agentId'] = this.id; + this.agent.insertDiscountAgent(this.validateForm.value , data => { + if (data['return_code'] === '000000') { + this.message.success('生成中,请耐心等待!'); + this.isVisible = false; + } else { + this.message.error(data['return_msg']); + } + this.isSpinning = false; + }); + } + + handleCancel(): void { + this.isVisible = false; + } + + public getDiscountList(id: number): void { + this.id = id; + this.isVisibleDiscount = true; + this.getRequestDiscount(true); + } + + public getDistributionList(id: number): void { + this.id = id; + this.isVisibleList = true; + this.getRequestList(true); + } + + handleCancelList() { + this.isVisibleList = false; + } + + handleCancelDiscount() { + this.isVisibleDiscount = false; + } + handleCancelDistribute() { + this.isVisibleDistribute = false; + } + // 查询列表 + public getRequestDiscount(reset: boolean = false) { + const whereObject = {}; + this.loadingDiscount = true; + if (reset) { + this.pageNumDiscount = 1; + } + whereObject['pageNum'] = this.pageNumDiscount; + whereObject['pageSize'] = this.pageSizeDiscount; + whereObject['agentId'] = this.id; + this.agent.getDiscountAgentList(whereObject, data => { + this.loadingDiscount = false; + if (data['return_code'] === '000000') { + this.requestDataDiscount = data['return_data'].list; + this.totalDiscount = data['return_data'].total; + } else { + this.message.error(data['return_msg']); + } + }); + } + + // 分发卡券 + public getDistribution(id: number): void { + this.isSpinningDistribute = true; + this.agentId = id; + const whereObject = {}; + whereObject['pageNum'] = 1; + whereObject['pageSize'] = 10000; + this.coupon.getCouponList(whereObject, data => { + if (data['return_code'] === '000000') { + this.distributeList = data['return_data'].list; + } else { + this.message.error(data['return_msg']); + } + this.isSpinningDistribute = false; + }); + this.isVisibleDistribute = true; + } + + // 查询f分发列表 + public getRequestList(reset: boolean = false) { + const whereObject = {}; + this.loadingList = true; + if (reset) { + this.pageNumList = 1; + } + whereObject['pageNum'] = this.pageNumList; + whereObject['pageSize'] = this.pageSizeList; + whereObject['agentId'] = this.id; + this.agent.getCouponByAgent(whereObject, data => { + this.loadingList = false; + if (data['return_code'] === '000000') { + this.requestDataList = data['return_data'].list; + this.totalList = data['return_data'].total; + } else { + this.message.error(data['return_msg']); + } + }); + } + + // 提交分发 + public handleOkDistribute(): void { + // tslint:disable-next-line:forin + for (const i in this.validateFormDistribute.controls) { + this.validateFormDistribute.controls[i].markAsDirty(); + this.validateFormDistribute.controls[i].updateValueAndValidity(); + if (this.validateFormDistribute.controls[i].errors != null) { + this.message.error('必填项不能为空'); + return; + } + } + this.isOkLoading = true; + this.validateFormDistribute.value['agentId'] = this.agentId; + this.agent.assignCouponAgent(this.validateFormDistribute.value , data => { + if (data['return_code'] === '000000') { + this.validateFormDistribute.reset(); + this.message.success('分发成功'); + this.isVisibleDistribute = false; + this.isOkLoading = false; + } else { + this.message.error(data['return_msg']); + } + this.isSpinning = false; + }); + } + + public getList(id: number): void { + const whereObject = {}; + whereObject['pageNum'] = 1; + whereObject['pageSize'] = 10000; + whereObject['couponAgentId'] = id; + this.isVisibleShow = true; + this.agent.getRecordByCouponAgentId(whereObject , data => { + if (data['return_code'] === '000000') { + this.dataSet = data['return_data'].list; + } else { + this.message.error(data['return_msg']); + } + }); + } + + handleCancelListShow() { + this.isVisibleShow = false; + } +} 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 new file mode 100644 index 0000000..359cb6a --- /dev/null +++ b/src/app/admin/recharge-order/price-list/price-list.component.html @@ -0,0 +1,106 @@ + + + + + +
+
+
+ +
+ + 金额类型 + + + + + + + + +
+ +
+ +
+
+ + +
+
+
+
+ + +
+ 共计 {{total}} 条数据 +
+ +
+ + + + 编号 + 金额类型 + 充值金额 + 支付金额 + 创建时间 + 操作 + + + + + {{i + 1}} + {{data.type | rechargePrice}} + {{data.price}} + {{data.realPrice}} + {{data.createTime | date: 'yyyy-MM-dd HH:mm'}} + + 编辑 + 删除 + + + +
+ + +
+ + 金额类型 + + + + + + + + + + 充值金额 + + + + + + 支付金额 + + + + +
+
+ diff --git a/src/app/admin/recharge-order/price-list/price-list.component.scss b/src/app/admin/recharge-order/price-list/price-list.component.scss new file mode 100644 index 0000000..e69de29 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 new file mode 100644 index 0000000..526211c --- /dev/null +++ b/src/app/admin/recharge-order/price-list/price-list.component.ts @@ -0,0 +1,124 @@ +import { Component, OnInit } from '@angular/core'; +import {environment} from '../../../../environments/environment'; +import {FormBuilder, FormGroup, Validators} from '_@angular_forms@9.0.7@@angular/forms'; +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 {RechargeService} from '../../../services/recharge.service'; + +@Component({ + selector: 'app-price-list', + templateUrl: './price-list.component.html', + styleUrls: ['./price-list.component.scss'] +}) +export class PriceListComponent implements OnInit { + WEB_SERVE_URL = environment.imageUrl; + searchForm: FormGroup; // 搜索框 + validateForm: FormGroup; // 添加框 + requestData = []; // 列表数据 + + total: number; // 页码 + pageNum = 1; // 页码 + pageSize = 10; // 条码 + loading = true; + isVisible = false; + id: number; + + constructor( + private form: FormBuilder, + private recharge: RechargeService, + private discount: DiscountService, + private coupon: CouponService, + private iconService: IconService, + private message: NzMessageService, + private router: Router, + private common: CommonsService + ) { + } + + ngOnInit(): void { + this.init(); + } + + public init(): void { + this.searchForm = this.form.group({ + type: [null], + }); + this.validateForm = this.form.group({ + type: [null, [Validators.required]], + price: [null, [Validators.required]], + realPrice: [null, [Validators.required]], + }); + + this.getRequest(true, this.searchForm.value); + } + + // 查询列表 + public getRequest(reset: boolean = false, whereObject: object) { + + this.loading = false; + if (reset) { + this.pageNum = 1; + } + whereObject['pageNum'] = this.pageNum; + whereObject['pageSize'] = this.pageSize; + this.recharge.getListOutRechargePrice(whereObject, data => { + if (data['return_code'] === '000000') { + this.requestData = data['return_data'].list; + this.total = data['return_data'].total; + } else { + this.message.error(data['return_msg']); + } + }); + } + + // 重置 + public resetForm(): void { + this.searchForm.reset(); + } + + // 修改 + public getEdit(id?: number): void { + this.isVisible = true; + } + + // 查看详情 + public getDetail(id: number): void { + this.router.navigate(['/admin/company/company-detail'], { + queryParams: { + companyId: id + } + }).then(r => console.log(r)); + } + + + + handleOk(): void { + // tslint:disable-next-line:forin + for (const i in this.validateForm.controls) { + this.validateForm.controls[i].markAsDirty(); + this.validateForm.controls[i].updateValueAndValidity(); + if (this.validateForm.controls[i].errors != null) { + this.message.error('必填项不能为空'); + return; + } + } + this.validateForm.value['agentId'] = this.id; + this.recharge.insertPrice(this.validateForm.value , data => { + if (data['return_code'] === '000000') { + this.message.success('添加成功'); + this.isVisible = false; + } else { + this.message.error(data['return_msg']); + } + }); + } + + handleCancel(): void { + this.isVisible = false; + } + +} diff --git a/src/app/admin/recharge-order/recharge-order-routing.module.ts b/src/app/admin/recharge-order/recharge-order-routing.module.ts new file mode 100644 index 0000000..fade0e9 --- /dev/null +++ b/src/app/admin/recharge-order/recharge-order-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import {OrderListComponent} from './order-list/order-list.component'; +import {PriceListComponent} from './price-list/price-list.component'; + + + +const routes: Routes = [ + { path: 'order-list', component: OrderListComponent }, + { path: 'price-list', component: PriceListComponent}, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class RechargeOrderRoutingModule { } diff --git a/src/app/admin/recharge-order/recharge-order.module.ts b/src/app/admin/recharge-order/recharge-order.module.ts new file mode 100644 index 0000000..cf95675 --- /dev/null +++ b/src/app/admin/recharge-order/recharge-order.module.ts @@ -0,0 +1,29 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { RechargeOrderRoutingModule } from './recharge-order-routing.module'; +import { OrderListComponent } from './order-list/order-list.component'; +import { PriceListComponent } from './price-list/price-list.component'; +import {NgZorroAntdModule} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; +import {SeparateModule} from '../../common/separate/separate.module'; +import {FormsModule, ReactiveFormsModule} from '_@angular_forms@9.0.7@@angular/forms'; +import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module'; +import {RegionSelectorModule} from '../../common/region-selector/region-selector.module'; +import {AppCommonModule} from '../../app-common.module'; + + +@NgModule({ + declarations: [OrderListComponent, PriceListComponent], + imports: [ + CommonModule, + RechargeOrderRoutingModule, + NgZorroAntdModule, + SeparateModule, + ReactiveFormsModule, + FormsModule, + BreadcrumbModule, + RegionSelectorModule, + AppCommonModule + ] +}) +export class RechargeOrderModule { } diff --git a/src/app/app-common.module.ts b/src/app/app-common.module.ts index f515adc..a445702 100644 --- a/src/app/app-common.module.ts +++ b/src/app/app-common.module.ts @@ -23,7 +23,8 @@ import { OrderCouponStatusPipe, DiscountStatusPipe, DisplayAreaPipe, - DiscountCodeStatusPipe + DiscountCodeStatusPipe, + RechargePricePipe } from './pipes'; @@ -42,6 +43,7 @@ const PIPES = [ DiscountStatusPipe, DisplayAreaPipe, DiscountCodeStatusPipe, + RechargePricePipe, ]; diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 9ac20b3..ad7ddbd 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -76,6 +76,11 @@ const routes: Routes = [ loadChildren: () => import('./admin/agent/agent.module').then(m => m.AgentModule), canActivate: [InitGuardService] }, + { + path: 'rechargeOrder', + loadChildren: () => import('./admin/recharge-order/recharge-order.module').then(m => m.RechargeOrderModule), + canActivate: [InitGuardService] + }, { path: 'cms', loadChildren: () => import('./admin/cms/cms.module').then(m => m.CmsModule), diff --git a/src/app/pipes/index.ts b/src/app/pipes/index.ts index ab2e7c8..9e50b32 100644 --- a/src/app/pipes/index.ts +++ b/src/app/pipes/index.ts @@ -12,3 +12,4 @@ export * from './discount-type.pipe'; export * from './discount-status.pipe'; export * from './display-area.pipe'; export * from './discount-code-status.pipe'; +export * from './recharge-price.pipe'; diff --git a/src/app/pipes/recharge-price.pipe.ts b/src/app/pipes/recharge-price.pipe.ts new file mode 100644 index 0000000..af4e4d2 --- /dev/null +++ b/src/app/pipes/recharge-price.pipe.ts @@ -0,0 +1,19 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'rechargePrice' +}) +export class RechargePricePipe implements PipeTransform { + + transform(value: number): string { + switch (value) { + case 1: + return '话费充值'; + case 2: + return '中石化'; + case 3: + return '中石油'; + } + } + +} diff --git a/src/app/pipes/system.pipe.ts b/src/app/pipes/system.pipe.ts index fc258f5..834419b 100644 --- a/src/app/pipes/system.pipe.ts +++ b/src/app/pipes/system.pipe.ts @@ -19,6 +19,8 @@ export class SystemPipe implements PipeTransform { return '代理商账号'; case 5: return '分公司账号'; + case 6: + return '后台充值人员'; } } diff --git a/src/app/services/recharge.service.ts b/src/app/services/recharge.service.ts new file mode 100644 index 0000000..f61ec1d --- /dev/null +++ b/src/app/services/recharge.service.ts @@ -0,0 +1,66 @@ +import { Injectable } from '@angular/core'; +import {HttpClient} from '_@angular_common@9.0.7@@angular/common/http'; +import {CommonsService} from './commons.service'; +import {environment} from '../../environments/environment'; + +@Injectable({ + providedIn: 'root' +}) +export class RechargeService { + + constructor( + private http: HttpClient, + private common: CommonsService + ) { + } + + /** + * 查询列表 + * + * @param paramsObject 对象 + * @param callBack 回调 + */ + public getListOutRechargePrice(paramsObject: object, callBack) { + this.http.get(environment.baseUrl + 'outRechargePrice/getListOutRechargePrice?' + this.common.getWhereCondition(paramsObject)).subscribe(data => { + callBack(data); + }); + } + + /** + * 新增 + * + * @param params 上传对象 + * @param callBack 回调 + * @return data 返回结果 + */ + public insertPrice(params: object, callBack) { + this.http.post(environment.baseUrl + 'outRechargePrice/insertPrice', params).subscribe(data => { + callBack(data); + }); + } + + /** + * 修改卡券 + * + * @param params 上传对象 + * @param callBack 回调 + * @return data 返回结果 + */ + public updateAgent(params: object, callBack) { + this.http.post(environment.baseUrl + 'outRechargePrice/updatePrice', params).subscribe(data => { + callBack(data); + }); + } + + /** + * 根据id查询详情 + * + * @param agentId id + * @param callBack 回调 + */ + public findByAgentId(agentId: number, callBack) { + this.http.get(environment.baseUrl + 'highAgent/findByAgentId?agentId=' + agentId).subscribe(data => { + callBack(data); + }); + } +}