From 386dfaf024231d5fdd510b431deb1d9321cc382c Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Wed, 24 Aug 2022 09:11:25 +0800 Subject: [PATCH] =?UTF-8?q?1.=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 --- .../integral-rebate.component.html | 6 +- .../store-edit/store-edit.component.html | 1 + .../distribution-integral-list.component.html | 124 ++++++++++++++++++ .../distribution-integral-list.component.scss | 4 + .../distribution-integral-list.component.ts | 115 ++++++++++++++++ .../promotion-order-list.component.html | 86 ++++++++++++ .../promotion-order-list.component.scss | 0 .../promotion-order-list.component.ts | 92 +++++++++++++ .../promotion/promotion-routing.module.ts | 17 +++ src/app/admin/promotion/promotion.module.ts | 25 ++++ .../user/user-list/user-list.component.html | 8 +- .../user/user-list/user-list.component.ts | 19 +++ src/app/app-routing.module.ts | 5 + .../pipes/integral/integral-product.pipe.ts | 2 +- .../sercices/integr-rebate.service.spec.ts | 16 --- src/app/sercices/integr-rebate.service.ts | 9 -- src/app/services/distribution.service.ts | 94 +++++++++++++ src/app/services/user.service.ts | 14 ++ src/environments/environment.ts | 8 +- 19 files changed, 606 insertions(+), 39 deletions(-) create mode 100644 src/app/admin/promotion/distribution-integral-list/distribution-integral-list.component.html create mode 100644 src/app/admin/promotion/distribution-integral-list/distribution-integral-list.component.scss create mode 100644 src/app/admin/promotion/distribution-integral-list/distribution-integral-list.component.ts create mode 100644 src/app/admin/promotion/promotion-order-list/promotion-order-list.component.html create mode 100644 src/app/admin/promotion/promotion-order-list/promotion-order-list.component.scss create mode 100644 src/app/admin/promotion/promotion-order-list/promotion-order-list.component.ts create mode 100644 src/app/admin/promotion/promotion-routing.module.ts create mode 100644 src/app/admin/promotion/promotion.module.ts delete mode 100644 src/app/sercices/integr-rebate.service.spec.ts delete mode 100644 src/app/sercices/integr-rebate.service.ts create mode 100644 src/app/services/distribution.service.ts diff --git a/src/app/admin/config-manage/integral-rebate/integral-rebate.component.html b/src/app/admin/config-manage/integral-rebate/integral-rebate.component.html index 2da2de2..b35ff48 100644 --- a/src/app/admin/config-manage/integral-rebate/integral-rebate.component.html +++ b/src/app/admin/config-manage/integral-rebate/integral-rebate.component.html @@ -24,8 +24,7 @@ 产品 - - + @@ -148,8 +147,7 @@ 卡券产品 - - + diff --git a/src/app/admin/merchant-store/store-edit/store-edit.component.html b/src/app/admin/merchant-store/store-edit/store-edit.component.html index a12b00e..ca9b096 100644 --- a/src/app/admin/merchant-store/store-edit/store-edit.component.html +++ b/src/app/admin/merchant-store/store-edit/store-edit.component.html @@ -52,6 +52,7 @@ + diff --git a/src/app/admin/promotion/distribution-integral-list/distribution-integral-list.component.html b/src/app/admin/promotion/distribution-integral-list/distribution-integral-list.component.html new file mode 100644 index 0000000..3a85af9 --- /dev/null +++ b/src/app/admin/promotion/distribution-integral-list/distribution-integral-list.component.html @@ -0,0 +1,124 @@ + + + + + +
+
+
+ +
+ + 代理商 + + + + + + +
+
+ + 一级分销 + + + + + + +
+
+ + 二级分销 + + + + + + +
+
+ + 订单号 + + + + +
+
+ + 标题 + + + + +
+
+ + 用户名称 + + + + +
+ +
+ +
+
+ + +
+
+
+
+ + +
+ 共计 {{total}} 条数据 + + + + + 编号 + 标题 + 商品logo + 分销类型 + 订单号 + 用户名称 + 积分数量 + 创建时间 + + + + + {{i+1}} + {{data.title}} + + + + {{data.type == 1 ? '二级分销' : '一级分销'}} + {{data.orderNo}} + {{data.userName}} + {{data.integralNum}} + {{data.createTime | date: 'yyyy-MM-dd HH:mm'}} + + +
+ + + diff --git a/src/app/admin/promotion/distribution-integral-list/distribution-integral-list.component.scss b/src/app/admin/promotion/distribution-integral-list/distribution-integral-list.component.scss new file mode 100644 index 0000000..8bee3fb --- /dev/null +++ b/src/app/admin/promotion/distribution-integral-list/distribution-integral-list.component.scss @@ -0,0 +1,4 @@ +.head_img { + height: 60px; + width: 60px; +} diff --git a/src/app/admin/promotion/distribution-integral-list/distribution-integral-list.component.ts b/src/app/admin/promotion/distribution-integral-list/distribution-integral-list.component.ts new file mode 100644 index 0000000..9c691ad --- /dev/null +++ b/src/app/admin/promotion/distribution-integral-list/distribution-integral-list.component.ts @@ -0,0 +1,115 @@ +import { Component, OnInit } from '@angular/core'; +import {environment} from '../../../../environments/environment'; +import {FormBuilder, FormGroup} from '_@angular_forms@9.0.7@@angular/forms'; +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 {DistributionService} from '../../../services/distribution.service'; + +@Component({ + selector: 'app-distribution-integral-list', + templateUrl: './distribution-integral-list.component.html', + styleUrls: ['./distribution-integral-list.component.scss'] +}) +export class DistributionIntegralListComponent implements OnInit { + + WEB_SERVE_URL = environment.imageUrl; + searchForm: FormGroup; // 搜索框 + requestData = []; // 列表数据 + agentData = []; // 代理商列表 + distributionFirst = []; // 一级分销 + distributionSecond = []; // 二级分销人员 + + total: number; // 页码 + pageNum = 1; // 页码 + pageSize = 10; // 条码 + loading = true; + // 代理商id + agentId: number; + popularizeUserId: number; + + + constructor( + private form: FormBuilder, + private distribution: DistributionService, + private iconService: IconService, + private message: NzMessageService, + ) { + } + + ngOnInit(): void { + this.init(); + this.getInitData(); + this.getDistributionFirst(); + this.getDistributionSecond(); + } + + // 获取初始化数据 + private getInitData(): void { + // 获取价格数据 + this.distribution.getDistributionAgent( data => { + this.agentData = data['return_data']; + }); + + } + + public init(): void { + this.searchForm = this.form.group({ + agentId : [null], + popularizeUserId: [null], + orderNo: [null], + title: [null], + userName: [null], + }); + + 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.distribution.getDistributionIntegralList(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 getDistributionFirst(agentId?: number) { + this.agentId = agentId; + const param = { + agentId : this.agentId + }; + this.distribution.getDistributionFirst(param , data => { + this.distributionFirst = data['return_data']; + }); + } + + // 查询二级分销 + public getDistributionSecond(popularizeUserId?: number) { + this.popularizeUserId = popularizeUserId; + const param = { + agentId : this.agentId, + popularizeUserId : this.popularizeUserId, + }; + this.distribution.getDistributionSecond(param , data => { + this.distributionSecond = data['return_data']; + }); + } +} diff --git a/src/app/admin/promotion/promotion-order-list/promotion-order-list.component.html b/src/app/admin/promotion/promotion-order-list/promotion-order-list.component.html new file mode 100644 index 0000000..da79e46 --- /dev/null +++ b/src/app/admin/promotion/promotion-order-list/promotion-order-list.component.html @@ -0,0 +1,86 @@ + + + + + +
+
+
+ +
+ + 推广人 + + + + + + +
+
+ + 推广码 + + + + +
+ +
+ +
+
+ + +
+
+
+
+ + +
+ 共计 {{total}} 条数据 + + + + + 编号 + 标题 + 推广人 + 订单金额 + 订单号 + 用户名称 + 用户电话 + 创建时间 + + + + + {{i+1}} + {{data.goodsTypeName}} + {{data.agentName}} + {{'¥' + data.totalPrice}} + {{data.orderNo}} + {{data.memName}} + {{data.memPhone}} + {{data.createTime | date: 'yyyy-MM-dd HH:mm'}} + + +
+ + + diff --git a/src/app/admin/promotion/promotion-order-list/promotion-order-list.component.scss b/src/app/admin/promotion/promotion-order-list/promotion-order-list.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/admin/promotion/promotion-order-list/promotion-order-list.component.ts b/src/app/admin/promotion/promotion-order-list/promotion-order-list.component.ts new file mode 100644 index 0000000..ed85794 --- /dev/null +++ b/src/app/admin/promotion/promotion-order-list/promotion-order-list.component.ts @@ -0,0 +1,92 @@ +import { Component, OnInit } from '@angular/core'; +import {environment} from '../../../../environments/environment'; +import {FormBuilder, FormGroup} from '_@angular_forms@9.0.7@@angular/forms'; +import {DistributionService} from '../../../services/distribution.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-promotion-order-list', + templateUrl: './promotion-order-list.component.html', + styleUrls: ['./promotion-order-list.component.scss'] +}) +export class PromotionOrderListComponent implements OnInit { + + WEB_SERVE_URL = environment.imageUrl; + searchForm: FormGroup; // 搜索框 + requestData = []; // 列表数据 + agentData = []; // 代理商列表 + + + total: number; // 页码 + pageNum = 1; // 页码 + pageSize = 10; // 条码 + loading = true; + + + + constructor( + private form: FormBuilder, + private distribution: DistributionService, + private iconService: IconService, + private message: NzMessageService, + private router: Router, + private common: CommonsService + ) { + } + + ngOnInit(): void { + this.init(); + this.getInitData(); + } + + // 获取初始化数据 + private getInitData(): void { + // 获取价格数据 + this.distribution.agentUserList( data => { + this.agentData = data['return_data']; + }); + + } + + public init(): void { + this.searchForm = this.form.group({ + agentId : [null], + popularizeUserId: [null], + orderNo: [null], + title: [null], + userName: [null], + code: [null], + }); + + 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.distribution.orderListByAgentId(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(); + } + + +} diff --git a/src/app/admin/promotion/promotion-routing.module.ts b/src/app/admin/promotion/promotion-routing.module.ts new file mode 100644 index 0000000..151efc9 --- /dev/null +++ b/src/app/admin/promotion/promotion-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import {DistributionIntegralListComponent} from './distribution-integral-list/distribution-integral-list.component'; +import {PromotionOrderListComponent} from './promotion-order-list/promotion-order-list.component'; + + + +const routes: Routes = [ + { path: 'distribution-integral-list', component: DistributionIntegralListComponent }, + { path: 'promotion-order-list', component: PromotionOrderListComponent }, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class PromotionRoutingModule { } diff --git a/src/app/admin/promotion/promotion.module.ts b/src/app/admin/promotion/promotion.module.ts new file mode 100644 index 0000000..a4e6705 --- /dev/null +++ b/src/app/admin/promotion/promotion.module.ts @@ -0,0 +1,25 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { PromotionRoutingModule } from './promotion-routing.module'; +import { DistributionIntegralListComponent } from './distribution-integral-list/distribution-integral-list.component'; +import { PromotionOrderListComponent } from './promotion-order-list/promotion-order-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'; + + +@NgModule({ + declarations: [DistributionIntegralListComponent, PromotionOrderListComponent], + imports: [ + CommonModule, + NgZorroAntdModule, + SeparateModule, + ReactiveFormsModule, + FormsModule, + BreadcrumbModule, + PromotionRoutingModule + ] +}) +export class PromotionModule { } diff --git a/src/app/admin/user/user-list/user-list.component.html b/src/app/admin/user/user-list/user-list.component.html index 36d2359..5a1fb5b 100644 --- a/src/app/admin/user/user-list/user-list.component.html +++ b/src/app/admin/user/user-list/user-list.component.html @@ -92,11 +92,9 @@ {{data.regTime | date: 'yyyy-MM-dd HH:mm'}} {{data.status ===1 ? '正常' : '禁用'}} - - - - - + {{data.status === 1 ? '禁用': '启用'}} + + {{data.isAgent === true ? '禁用推广员': '启用推广员'}} diff --git a/src/app/admin/user/user-list/user-list.component.ts b/src/app/admin/user/user-list/user-list.component.ts index 9cd45f1..455c689 100644 --- a/src/app/admin/user/user-list/user-list.component.ts +++ b/src/app/admin/user/user-list/user-list.component.ts @@ -85,4 +85,23 @@ export class UserListComponent implements OnInit { }); } + // 是否设置成代理商 + setUpAgent(id , isAgent: boolean) { + const message = (isAgent === true ? '当前用户禁用推广员' : '启用推广员'); + + this.common.showConfirm(message, data => { + if (data) { + this.user.setUpAgent(id, dataUser => { + if (dataUser['return_code'] === '000000') { + this.message.success('操作成功'); + this.getRequest(false , this.searchForm.value); + } else { + this.message.error(dataUser['return_msg']); + } + + }); + } + }); + } + } diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 977f099..3877c1f 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -152,6 +152,11 @@ const routes: Routes = [ loadChildren: () => import('./admin/api-merchants/api-merchants.module').then(m => m.ApiMerchantsModule), canActivate: [InitGuardService] }, + { + path: 'promotion', + loadChildren: () => import('./admin/promotion/promotion.module').then(m => m.PromotionModule), + canActivate: [InitGuardService] + }, ], }, ]; diff --git a/src/app/pipes/integral/integral-product.pipe.ts b/src/app/pipes/integral/integral-product.pipe.ts index 91a68fb..545f47e 100644 --- a/src/app/pipes/integral/integral-product.pipe.ts +++ b/src/app/pipes/integral/integral-product.pipe.ts @@ -6,7 +6,7 @@ import { Pipe, PipeTransform } from '@angular/core'; export class IntegralProductPipe implements PipeTransform { array = { - 1: ['重庆中石化' , '', '', '贵州中石化'], + 1: ['卡券产品'], 2: ['在线加油' ], 3: ['电信' , '移动' , '联通'], 4: ['星巴克' , '肯德基' , '会员充值'] diff --git a/src/app/sercices/integr-rebate.service.spec.ts b/src/app/sercices/integr-rebate.service.spec.ts deleted file mode 100644 index c3b9129..0000000 --- a/src/app/sercices/integr-rebate.service.spec.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { TestBed } from '@angular/core/testing'; - -import { IntegrRebateService } from './integr-rebate.service'; - -describe('IntegrRebateService', () => { - let service: IntegrRebateService; - - beforeEach(() => { - TestBed.configureTestingModule({}); - service = TestBed.inject(IntegrRebateService); - }); - - it('should be created', () => { - expect(service).toBeTruthy(); - }); -}); diff --git a/src/app/sercices/integr-rebate.service.ts b/src/app/sercices/integr-rebate.service.ts deleted file mode 100644 index 3972d33..0000000 --- a/src/app/sercices/integr-rebate.service.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Injectable } from '@angular/core'; - -@Injectable({ - providedIn: 'root' -}) -export class IntegrRebateService { - - constructor() { } -} diff --git a/src/app/services/distribution.service.ts b/src/app/services/distribution.service.ts new file mode 100644 index 0000000..159feab --- /dev/null +++ b/src/app/services/distribution.service.ts @@ -0,0 +1,94 @@ +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 DistributionService { + + constructor( + private http: HttpClient, + private common: CommonsService + ) { } + + /** + * @Author Sum1Dream + * @methodName getDistributionAgent + * @Description // 查询分销代理商 + * @Date 11:06 2022/8/19 + * @Param callBack + */ + public getDistributionAgent(callBack) { + this.http.get(environment.baseUrl + 'bsDistributionUserRel/getDistributionAgent').subscribe(data => { + callBack(data); + }); + } + + /** + * @Author Sum1Dream + * @methodName getDistributionFirst + * @Description // 查询一级分销 + * @Date 11:07 2022/8/19 + * @Param param: object , callBack + */ + public getDistributionFirst(param: object , callBack) { + this.http.get(environment.baseUrl + 'bsDistributionUserRel/getDistributionFirst?' + this.common.getWhereCondition(param)).subscribe(data => { + callBack(data); + }); + } + + /** + * @Author Sum1Dream + * @methodName getDistributionSecond + * @Description // 查询二级分销 + * @Date 11:08 2022/8/19 + * @Param param: object , callBack + */ + public getDistributionSecond(param: object , callBack) { + this.http.get(environment.baseUrl + 'bsDistributionUserRel/getDistributionSecond?' + this.common.getWhereCondition(param)).subscribe(data => { + callBack(data); + }); + } + + /** + * @Author Sum1Dream + * @methodName getDistributionIntegralList + * @Description // 查询分销积分列表 + * @Date 11:09 2022/8/19 + * @Param param: object , callBack + */ + public getDistributionIntegralList(param: object , callBack) { + this.http.get(environment.baseUrl + 'bsDistributionUserRel/getDistributionIntegralList?' + this.common.getWhereCondition(param)).subscribe(data => { + callBack(data); + }); + } + + /** + * @Author Sum1Dream + * @methodName getDistributionAgent + * @Description // 查询推广代理商 + * @Date 11:06 2022/8/19 + * @Param callBack + */ + public agentUserList(callBack) { + this.http.get(environment.baseUrl + 'bsDistributionUserRel/agentUserList').subscribe(data => { + callBack(data); + }); + } + + /** + * @Author Sum1Dream + * @methodName getDistributionIntegralList + * @Description // 查询推广订单列表 + * @Date 11:09 2022/8/19 + * @Param param: object , callBack + */ + public orderListByAgentId(param: object , callBack) { + this.http.get(environment.baseUrl + 'bsDistributionUserRel/orderListByAgentId?' + this.common.getWhereCondition(param)).subscribe(data => { + callBack(data); + }); + } + +} diff --git a/src/app/services/user.service.ts b/src/app/services/user.service.ts index c470a16..0edd05a 100644 --- a/src/app/services/user.service.ts +++ b/src/app/services/user.service.ts @@ -85,4 +85,18 @@ export class UserService { }); } + + /** + * @Author Sum1Dream + * @methodName setAgent + * @Description // 设置代理商 + * @Date 15:41 2022/8/19 + * @Param userId: number, callBack + */ + public setUpAgent(userId: number, callBack) { + this.http.get(environment.baseUrl + 'highUser/setUpAgent?userId=' + userId).subscribe(data => { + callBack(data); + }); + } + } diff --git a/src/environments/environment.ts b/src/environments/environment.ts index ca22a39..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://hsgcs.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) - imageUrl: 'https://hsgcs.dctpay.com/filesystem/', + baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址) + imageUrl: 'http://localhost:9302/filesystem/', + // baseUrl: 'https://hsgcs.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) + // imageUrl: 'https://hsgcs.dctpay.com/filesystem/', key: 'https://hsgcs.dctpay.com/phone-recharge-H5/index.html?codeValue=', inviteUrl: 'https://hsgcs.dctpay.com/wx/?action=ic&id=', };