diff --git a/package-lock.json b/package-lock.json index e10e242..8d88a33 100644 --- a/package-lock.json +++ b/package-lock.json @@ -331,7 +331,7 @@ "strip-ansi": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W3MaA3J+lbiWA==", "dev": true, "requires": { "ansi-regex": "^4.1.0" diff --git a/src/app/admin/agent/agent-edit/agent-edit.component.html b/src/app/admin/agent/agent-edit/agent-edit.component.html new file mode 100644 index 0000000..18ed894 --- /dev/null +++ b/src/app/admin/agent/agent-edit/agent-edit.component.html @@ -0,0 +1,86 @@ + + + + 系统管理 + + + 增加公司 + + + + +
+ +
+
+
+
+
+ +
+ + 用户名 + + + + +
+
+ + 登录密码 + + + + + + + + + +
+ + +
+ + 代理商名称 + + + + +
+
+ + 代理商地址 + + + + +
+
+ + 联系人 + + + + +
+
+ + 联系方式 + + + + +
+ +
+
+
+ +
+
+
+
+
+
+
diff --git a/src/app/admin/agent/agent-edit/agent-edit.component.scss b/src/app/admin/agent/agent-edit/agent-edit.component.scss new file mode 100644 index 0000000..ac60fb8 --- /dev/null +++ b/src/app/admin/agent/agent-edit/agent-edit.component.scss @@ -0,0 +1,6 @@ +button { + margin-left: 8px; +} +:host ::ng-deep .ant-upload { + background-color: #ffffff; +} diff --git a/src/app/admin/agent/agent-edit/agent-edit.component.ts b/src/app/admin/agent/agent-edit/agent-edit.component.ts new file mode 100644 index 0000000..ec899e6 --- /dev/null +++ b/src/app/admin/agent/agent-edit/agent-edit.component.ts @@ -0,0 +1,122 @@ +import { Component, OnInit } from '@angular/core'; +import {FormBuilder, FormGroup, Validators} from '@angular/forms'; +import {environment} from '../../../../environments/environment'; +import {CompanyService} from '../../../services/company.service'; +import {NzMessageService, NzUploadFile} from 'ng-zorro-antd'; +import {ActivatedRoute} from '@angular/router'; +import {ValidatorsService} from '../../../services/validators.service'; +import {AgentService} from '../../../services/agent.service'; + +@Component({ + selector: 'app-agent-edit', + templateUrl: './agent-edit.component.html', + styleUrls: ['./agent-edit.component.scss'] +}) +export class AgentEditComponent implements OnInit { + + validateForm!: FormGroup; + data: any; + editFlag = false; + id: number; + passwordVisible = false; + logoFile = []; + WEB_SERVE_URL = environment.baseUrl; + userId: number; + time; + constructor( + private fb: FormBuilder, + private agent: AgentService, + private message: NzMessageService, // 信息提示 + private activatedRoute: ActivatedRoute, + ) { + } + + ngOnInit(): void { + this.activatedRoute.queryParams.subscribe(queryParams => { + if (queryParams.agentId != null) { + this.editFlag = true; + this.id = queryParams.agentId; + this.getDetails(queryParams.agentId); + } + }); + this.validateForm = this.fb.group({ + loginName: [null, [Validators.required, ValidatorsService.maxLength(20)]], + password: [null, [Validators.required]], + agentName: [null, [Validators.required]], + agentUser: [null, [Validators.required, ValidatorsService.maxLength(50)]], + agentPhone: [null, [Validators.required, ValidatorsService.maxLength(50)]], + agentAddress: [null, [Validators.required, ValidatorsService.maxLength(80)]], + secUser: {}, + }); + } + + // 返回 + getBack() { + history.back(); + } + + // 重置 + public resetForm(): void { + this.validateForm.reset(); + } + + // 课程保存 + public getSave(): 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['secUser']['loginName'] = this.validateForm.value.loginName; + this.validateForm.value['secUser']['password'] = this.validateForm.value.password; + if (this.logoFile.length !== 0) { + if (this.logoFile[0]['response'] != null) { + this.validateForm.value.logo = this.logoFile[0]['response']['return_data'][0]; + } else { + this.validateForm.value.logo = this.logoFile[0].name; + } + } + + if (this.editFlag) { + this.validateForm.value.id = this.id; + this.agent.updateAgent(this.validateForm.value, data => { + if (data['return_code'] === '000000') { + this.getBack(); + this.message.success('修改成功'); + } else { + this.message.create('error', '修改失败'); + } + }); + } else { + + this.agent.insertAgent(this.validateForm.value, data => { + if (data['return_code'] === '000000') { + this.getBack(); + this.message.success('添加成功'); + } else { + this.message.create('error', data['return_msg']); + } + }); + } + } + + + + public getDetails(id) { + this.agent.findByAgentId(id, data => { + console.log(data); + if (data['return_code'] === '000000') { + data['return_data'].loginName = data['return_data'].secUser.loginName; + data['return_data'].password = data['return_data'].secUser.password; + this.validateForm.patchValue(data['return_data']); + } else { + this.message.create('error', data['return_msg']); + } + }); + } + +} diff --git a/src/app/admin/agent/agent-list/agent-list.component.html b/src/app/admin/agent/agent-list/agent-list.component.html new file mode 100644 index 0000000..c121e49 --- /dev/null +++ b/src/app/admin/agent/agent-list/agent-list.component.html @@ -0,0 +1,172 @@ + + + + + +
+
+
+ +
+ + 名称 + + + + +
+
+ + 电话 + + + + +
+
+ + 代理商状态 + + + + + + + +
+ +
+ +
+
+ + +
+
+
+
+ + +
+ 共计 {{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}} + + + + + + diff --git a/src/app/admin/agent/agent-list/agent-list.component.scss b/src/app/admin/agent/agent-list/agent-list.component.scss new file mode 100644 index 0000000..ebfbfbd --- /dev/null +++ b/src/app/admin/agent/agent-list/agent-list.component.scss @@ -0,0 +1,4 @@ +.head_img { + height: 80px; + width: 80px; +} diff --git a/src/app/admin/agent/agent-list/agent-list.component.ts b/src/app/admin/agent/agent-list/agent-list.component.ts new file mode 100644 index 0000000..5053c3b --- /dev/null +++ b/src/app/admin/agent/agent-list/agent-list.component.ts @@ -0,0 +1,191 @@ +import {Component, OnInit} from '@angular/core'; +import {environment} from '../../../../environments/environment'; +import {FormBuilder, FormGroup, Validators} from '@angular/forms'; +import {CompanyService} from '../../../services/company.service'; +import {IconService} from '../../../services/icon.service'; +import {NzMessageService} from 'ng-zorro-antd'; +import {Router} from '@angular/router'; +import {CommonsService} from '../../../services/commons.service'; +import {AgentService} from '../../../services/agent.service'; +import {DiscountService} from '../../../services/discount.service'; + +@Component({ + selector: 'app-agent-list', + templateUrl: './agent-list.component.html', + styleUrls: ['./agent-list.component.scss'] +}) +export class AgentListComponent implements OnInit { + + WEB_SERVE_URL = environment.imageUrl; + searchForm: FormGroup; // 搜索框 + validateForm: FormGroup; // 搜索框 + requestData = []; // 列表数据 + discountList = []; // 列表数据 + total: number; // 页码 + pageNum = 1; // 页码 + pageSize = 10; // 条码 + loading = true; + isVisible = false; + isVisibleDiscount = false; + id: number; + + requestDataDiscount = []; // 列表数据 + totalDiscount: number; // 页码 + pageNumDiscount = 1; // 页码 + pageSizeDiscount = 10; // 条码 + loadingDiscount = true; + constructor( + private form: FormBuilder, + private agent: AgentService, + private discount: DiscountService, + 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.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.validateForm.value['agentId'] = this.id; + this.agent.insertDiscountAgent(this.validateForm.value , data => { + if (data['return_code'] === '000000') { + console.log(data); + this.isVisible = false; + } else { + this.message.error(data['return_msg']); + } + }); + } + + handleCancel(): void { + this.isVisible = false; + } + + public getDiscountList(id: number): void { + this.id = id; + this.isVisibleDiscount = true; + this.getRequestDiscount(true); + } + + handleCancelDiscount() { + this.isVisibleDiscount = false; + } + + // 查询列表 + public getRequestDiscount(reset: boolean = false) { + const whereObject = {}; + this.loadingDiscount = false; + if (reset) { + this.pageNumDiscount = 1; + } + whereObject['pageNum'] = this.pageNumDiscount; + whereObject['pageSize'] = this.pageSizeDiscount; + whereObject['agentId'] = this.id; + this.agent.getDiscountAgentList(whereObject, data => { + if (data['return_code'] === '000000') { + this.requestDataDiscount = data['return_data'].list; + this.totalDiscount = data['return_data'].total; + } else { + this.message.error(data['return_msg']); + } + }); + } +} + diff --git a/src/app/admin/agent/agent-routing.module.ts b/src/app/admin/agent/agent-routing.module.ts new file mode 100644 index 0000000..4004a2b --- /dev/null +++ b/src/app/admin/agent/agent-routing.module.ts @@ -0,0 +1,16 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import {AgentListComponent} from './agent-list/agent-list.component'; +import {AgentEditComponent} from './agent-edit/agent-edit.component'; + + +const routes: Routes = [ + { path: 'agent-list', component: AgentListComponent }, + { path: 'agent-edit', component: AgentEditComponent}, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class AgentRoutingModule { } diff --git a/src/app/admin/agent/agent.module.ts b/src/app/admin/agent/agent.module.ts new file mode 100644 index 0000000..c3c7363 --- /dev/null +++ b/src/app/admin/agent/agent.module.ts @@ -0,0 +1,29 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { AgentRoutingModule } from './agent-routing.module'; +import { AgentListComponent } from './agent-list/agent-list.component'; +import { AgentEditComponent } from './agent-edit/agent-edit.component'; +import {NgZorroAntdModule} from 'ng-zorro-antd'; +import {SeparateModule} from '../../common/separate/separate.module'; +import {FormsModule, ReactiveFormsModule} from '@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: [AgentListComponent, AgentEditComponent], + imports: [ + CommonModule, + AgentRoutingModule, + NgZorroAntdModule, + SeparateModule, + ReactiveFormsModule, + FormsModule, + BreadcrumbModule, + RegionSelectorModule, + AppCommonModule + ] +}) +export class AgentModule { } diff --git a/src/app/admin/company/company-detail/company-detail.component.html b/src/app/admin/company/company-detail/company-detail.component.html index 48e3fa0..72e22a8 100644 --- a/src/app/admin/company/company-detail/company-detail.component.html +++ b/src/app/admin/company/company-detail/company-detail.component.html @@ -21,7 +21,7 @@ {{data.company.regionName}} - + {{data.company.name}} {{data.company.phone}} diff --git a/src/app/admin/company/company-edit/company-edit.component.html b/src/app/admin/company/company-edit/company-edit.component.html index 9421d4d..66b1549 100644 --- a/src/app/admin/company/company-edit/company-edit.component.html +++ b/src/app/admin/company/company-edit/company-edit.component.html @@ -38,14 +38,7 @@ -
- - 联系电话 - - - - -
+
@@ -65,14 +58,6 @@
- - 公司地址 - - - - -
-
公司LOGO diff --git a/src/app/admin/company/company-edit/company-edit.component.ts b/src/app/admin/company/company-edit/company-edit.component.ts index 9572b03..6eef281 100644 --- a/src/app/admin/company/company-edit/company-edit.component.ts +++ b/src/app/admin/company/company-edit/company-edit.component.ts @@ -54,10 +54,8 @@ export class CompanyEditComponent implements OnInit { this.validateForm = this.fb.group({ loginName: [null, [Validators.required, ValidatorsService.maxLength(20)]], password: [null, [Validators.required]], - phone: [null, [Validators.required, ValidatorsService.mobile]], regionId: [null], name: [null, [Validators.required, ValidatorsService.maxLength(50)]], - address: [null, [Validators.required, ValidatorsService.maxLength(80)]], logo: [null], regionName: [null], company: {}, @@ -96,8 +94,6 @@ export class CompanyEditComponent implements OnInit { } this.validateForm.value['company']['name'] = this.validateForm.value.name; this.validateForm.value['company']['regionId'] = this.regionId; - this.validateForm.value['company']['address'] = this.validateForm.value.address; - this.validateForm.value['company']['phone'] = this.validateForm.value.phone; this.validateForm.value['company']['logo'] = this.validateForm.value.logo; this.validateForm.value['user']['loginName'] = this.validateForm.value.loginName; this.validateForm.value['user']['password'] = this.validateForm.value.password; diff --git a/src/app/admin/company/company-list/company-list.component.html b/src/app/admin/company/company-list/company-list.component.html index 499f69b..f78e537 100644 --- a/src/app/admin/company/company-list/company-list.component.html +++ b/src/app/admin/company/company-list/company-list.component.html @@ -52,8 +52,6 @@ 所属地区 公司名称 公司LOGO - 联系方式 - 地址 创建时间 更新时间 操作 @@ -67,8 +65,6 @@ - {{data.phone}} - {{data.address}} {{data.createTime | date: 'yyyy-MM-dd HH:mm'}} {{data.updateTime | date: 'yyyy-MM-dd HH:mm'}} diff --git a/src/app/admin/coupon/coupon-edit/coupon-edit.component.html b/src/app/admin/coupon/coupon-edit/coupon-edit.component.html index 3ebb5d1..d5e0930 100644 --- a/src/app/admin/coupon/coupon-edit/coupon-edit.component.html +++ b/src/app/admin/coupon/coupon-edit/coupon-edit.component.html @@ -24,7 +24,7 @@ 卡券类型 - + @@ -35,15 +35,17 @@ 卡券来源 - + + +
-
+
- 展示区域 + 展示区域 @@ -124,7 +126,7 @@ 归库天数 - +
@@ -192,6 +194,7 @@ @@ -232,8 +236,8 @@
- - + +
diff --git a/src/app/admin/coupon/coupon-edit/coupon-edit.component.ts b/src/app/admin/coupon/coupon-edit/coupon-edit.component.ts index a857fe5..01fbc0c 100644 --- a/src/app/admin/coupon/coupon-edit/coupon-edit.component.ts +++ b/src/app/admin/coupon/coupon-edit/coupon-edit.component.ts @@ -78,9 +78,9 @@ export class CouponEditComponent implements OnInit { salesPrice: [null, [Validators.required]], discountPrice: [null, [Validators.required]], merchantId: [null, [Validators.required]], - isPresent: [false, [Validators.required]], - payType: [false, [Validators.required]], - displayArea: [false, [Validators.required]], + isPresent: [false], + payType: [null, [Validators.required]], + displayArea: [null], couponSource: [null], handselCouponId: [null], status: [null], @@ -150,6 +150,7 @@ export class CouponEditComponent implements OnInit { pageNum: this.pageNumCoupon, pageSize: this.pageSizeCoupon, merchantName: e, + status: 2, }; this.getCouponList(paramsObject); } @@ -190,6 +191,14 @@ export class CouponEditComponent implements OnInit { } } + if (this.validateForm.value.isPresent == null) { + this.validateForm.value.isPresent = false; + } + + if (this.validateForm.value.isPresent === false) { + this.validateForm.value.handselCouponId = []; + } + if (this.couponImg.length !== 0) { if (this.couponImg[0]['response'] != null) { this.validateForm.value.couponImg = this.couponImg[0]['response']['return_data'][0]; @@ -294,7 +303,7 @@ export class CouponEditComponent implements OnInit { for (const i of couponCarouselImg) { couponCarouselArray.push( { - uid: 1, + uid: i, name: i, status: 'done', url: environment.imageUrl + i @@ -308,7 +317,7 @@ export class CouponEditComponent implements OnInit { for (const i of couponDescImg) { couponDescArray.push( { - uid: 1, + uid: i, name: i, status: 'done', url: environment.imageUrl + i diff --git a/src/app/admin/coupon/coupon-list/coupon-list.component.html b/src/app/admin/coupon/coupon-list/coupon-list.component.html index d04cdff..8c1f9a4 100644 --- a/src/app/admin/coupon/coupon-list/coupon-list.component.html +++ b/src/app/admin/coupon/coupon-list/coupon-list.component.html @@ -41,7 +41,7 @@ 卡券类型 - + @@ -52,7 +52,7 @@ 卡券状态 - + diff --git a/src/app/admin/coupon/coupon-list/coupon-list.component.ts b/src/app/admin/coupon/coupon-list/coupon-list.component.ts index e010336..fdbcf43 100644 --- a/src/app/admin/coupon/coupon-list/coupon-list.component.ts +++ b/src/app/admin/coupon/coupon-list/coupon-list.component.ts @@ -1,6 +1,5 @@ import {Component, OnInit} from '@angular/core'; import {FormBuilder, FormGroup} from '@angular/forms'; -import {MerchantStoreService} from '../../../services/merchant-store.service'; import {IconService} from '../../../services/icon.service'; import {NzMessageService} from 'ng-zorro-antd'; import {ActivatedRoute, Router} from '@angular/router'; diff --git a/src/app/admin/discount/discount-coupon/discount-coupon.component.html b/src/app/admin/discount/discount-coupon/discount-coupon.component.html new file mode 100644 index 0000000..0f7c14f --- /dev/null +++ b/src/app/admin/discount/discount-coupon/discount-coupon.component.html @@ -0,0 +1 @@ +

discount-coupon works!

diff --git a/src/app/admin/discount/discount-coupon/discount-coupon.component.scss b/src/app/admin/discount/discount-coupon/discount-coupon.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/admin/discount/discount-coupon/discount-coupon.component.spec.ts b/src/app/admin/discount/discount-coupon/discount-coupon.component.spec.ts new file mode 100644 index 0000000..dc88035 --- /dev/null +++ b/src/app/admin/discount/discount-coupon/discount-coupon.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { DiscountCouponComponent } from './discount-coupon.component'; + +describe('DiscountCouponComponent', () => { + let component: DiscountCouponComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ DiscountCouponComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(DiscountCouponComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/discount/discount-coupon/discount-coupon.component.ts b/src/app/admin/discount/discount-coupon/discount-coupon.component.ts new file mode 100644 index 0000000..7318406 --- /dev/null +++ b/src/app/admin/discount/discount-coupon/discount-coupon.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-discount-coupon', + templateUrl: './discount-coupon.component.html', + styleUrls: ['./discount-coupon.component.scss'] +}) +export class DiscountCouponComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/src/app/admin/discount/discount-detail/discount-detail.component.html b/src/app/admin/discount/discount-detail/discount-detail.component.html new file mode 100644 index 0000000..ac197e7 --- /dev/null +++ b/src/app/admin/discount/discount-detail/discount-detail.component.html @@ -0,0 +1,22 @@ + + + + + Name + Age + Address + + + + + + {{ data.name }} + {{ data.age }} + {{ data.address }} + + + diff --git a/src/app/admin/discount/discount-detail/discount-detail.component.scss b/src/app/admin/discount/discount-detail/discount-detail.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/admin/discount/discount-detail/discount-detail.component.spec.ts b/src/app/admin/discount/discount-detail/discount-detail.component.spec.ts new file mode 100644 index 0000000..7d040d3 --- /dev/null +++ b/src/app/admin/discount/discount-detail/discount-detail.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { DiscountDetailComponent } from './discount-detail.component'; + +describe('DiscountDetailComponent', () => { + let component: DiscountDetailComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ DiscountDetailComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(DiscountDetailComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/admin/discount/discount-detail/discount-detail.component.ts b/src/app/admin/discount/discount-detail/discount-detail.component.ts new file mode 100644 index 0000000..a5c4147 --- /dev/null +++ b/src/app/admin/discount/discount-detail/discount-detail.component.ts @@ -0,0 +1,54 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-discount-detail', + templateUrl: './discount-detail.component.html', + styleUrls: ['./discount-detail.component.scss'] +}) +export class DiscountDetailComponent implements OnInit { + + constructor() { } + + checked = false; + indeterminate = false; + listOfData = []; + setOfCheckedId = new Set(); + + updateCheckedSet(id: number, checked: boolean): void { + if (checked) { + this.setOfCheckedId.add(id); + } else { + this.setOfCheckedId.delete(id); + } + } + + onItemChecked(id: number, checked: boolean): void { + this.updateCheckedSet(id, checked); + this.refreshCheckedStatus(); + } + + onAllChecked(value: boolean): void { + this.listOfData.forEach(item => this.updateCheckedSet(item.id, value)); + this.refreshCheckedStatus(); + } + + + + refreshCheckedStatus(): void { + this.checked = this.listOfData.every(item => this.setOfCheckedId.has(item.id)); + this.indeterminate = this.listOfData.some(item => this.setOfCheckedId.has(item.id)) && !this.checked; + } + + ngOnInit(): void { + this.listOfData = new Array(200).fill(0).map((_, index) => { + return { + id: index, + name: `Edward King ${index}`, + age: 32, + address: `London, Park Lane no. ${index}` + }; + }); + this.refreshCheckedStatus(); + + } +} diff --git a/src/app/admin/discount/discount-edit/discount-edit.component.html b/src/app/admin/discount/discount-edit/discount-edit.component.html new file mode 100644 index 0000000..34080ef --- /dev/null +++ b/src/app/admin/discount/discount-edit/discount-edit.component.html @@ -0,0 +1,108 @@ + + + + 卡券管理 + + + 编辑卡券 + + + + + +
+
+
+ + 优惠券名称 + + + + +
+
+ + 优惠券类型 + + + + + + + + +
+ +
+ + 满减条件价格 + + + + +
+ +
+ + {{validateForm.value.discountType === '3' ? '折扣' : '抵扣价格'}} + + + + +
+ +
+ + 截止日期 + + + + +
+ +
+ + 领取有效天数 + + + + +
+
+ + 优惠券图片 + + + +
上传图片
+
+ + + + + +
+
+
+ + + +
+
+
+ + +
+
+
+ +
diff --git a/src/app/admin/discount/discount-edit/discount-edit.component.scss b/src/app/admin/discount/discount-edit/discount-edit.component.scss new file mode 100644 index 0000000..ac60fb8 --- /dev/null +++ b/src/app/admin/discount/discount-edit/discount-edit.component.scss @@ -0,0 +1,6 @@ +button { + margin-left: 8px; +} +:host ::ng-deep .ant-upload { + background-color: #ffffff; +} diff --git a/src/app/admin/discount/discount-edit/discount-edit.component.ts b/src/app/admin/discount/discount-edit/discount-edit.component.ts new file mode 100644 index 0000000..eac1253 --- /dev/null +++ b/src/app/admin/discount/discount-edit/discount-edit.component.ts @@ -0,0 +1,161 @@ +import {Component, OnInit} from '@angular/core'; +import {FormBuilder, FormGroup, Validators} from '@angular/forms'; +import {environment} from '../../../../environments/environment'; +import {CommonsService} from '../../../services/commons.service'; +import {NzMessageService, NzUploadFile} from 'ng-zorro-antd'; +import {ActivatedRoute} from '@angular/router'; +import {DiscountService} from '../../../services/discount.service'; + +function getBase64(file: File): Promise { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.readAsDataURL(file); + reader.onload = () => resolve(reader.result); + reader.onerror = error => reject(error); + }); +} + +@Component({ + selector: 'app-discount-edit', + templateUrl: './discount-edit.component.html', + styleUrls: ['./discount-edit.component.scss'] +}) +export class DiscountEditComponent implements OnInit { + + + validateForm!: FormGroup; + data: any; + editFlag = false; + id: number; + discountImg = []; + WEB_SERVE_URL = environment.baseUrl; + previewImage: string | undefined = ''; + previewVisible = false; + + constructor( + private fb: FormBuilder, + private discount: DiscountService, + private common: CommonsService, + private message: NzMessageService, // 信息提示 + private activatedRoute: ActivatedRoute, + ) { + } + + ngOnInit(): void { + this.activatedRoute.queryParams.subscribe(queryParams => { + if (queryParams.discountId != null) { + this.editFlag = true; + this.id = queryParams.discountId; + this.getDetails(queryParams.discountId); + } + }); + this.validateForm = this.fb.group({ + discountName: [null, [Validators.required]], + discountCondition: [null], + discountType: [null, [Validators.required]], + discountPrice: [null, [Validators.required]], + salesEndTime: [null, [Validators.required]], + effectiveDay: [1, [Validators.required]], + status: [null], + createTime: [null], + secUser: {}, + }); + } + + + // 返回 + getBack() { + history.back(); + } + + // 重置 + public resetForm(): void { + this.validateForm.reset(); + } + + // 保存 + + public getSave(): 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; + } + } + + if (this.discountImg.length !== 0) { + if (this.discountImg[0]['response'] != null) { + this.validateForm.value.discountImg = this.discountImg[0]['response']['return_data'][0]; + } else { + this.validateForm.value.discountImg = this.discountImg[0].name; + } + } else { + this.message.error('请上传卡券图片'); + return; + } + + if (this.editFlag) { + this.common.showConfirm('是否确定修改,确定将下架', dataR => { + if (dataR) { + this.validateForm.value.id = this.id; + this.discount.updateDiscount(this.validateForm.value, data => { + if (data['return_code'] === '000000') { + this.getBack(); + this.message.success('修改成功,卡券已下架!'); + } else { + this.message.error(data['return_msg']); + } + }); + } + }); + } else { + this.discount.insertDiscount(this.validateForm.value, data => { + if (data['return_code'] === '000000') { + this.getBack(); + this.message.success('添加成功'); + } else { + this.message.error(data['return_msg']); + } + }); + } + } + + // 图片查看 + handlePreview = async (file: NzUploadFile) => { + if (!file.url && !file.preview) { + // tslint:disable-next-line:no-non-null-assertion + file.preview = await getBase64(file.originFileObj!); + } + this.previewImage = file.url || file.preview; + this.previewVisible = true; + } + + public getDetails(id) { + this.discount.getDiscountById(id, data => { + if (data['return_code'] === '000000') { + data['return_data']['discountType'] = String(data['return_data']['discountType']); + if (data['return_data']['discountImg'] != null && data['return_data']['discountImg'] !== '') { + const discountImg = String(data['return_data']['discountImg']); + const couponArray = []; + couponArray.push( + { + uid: 1, + name: discountImg, + status: 'done', + url: environment.imageUrl + discountImg + }); + this.discountImg = couponArray; + } + + this.validateForm.patchValue(data['return_data']); + } else { + this.message.create('error', data['return_msg']); + } + }); + } + + +} diff --git a/src/app/admin/discount/discount-list/discount-list.component.html b/src/app/admin/discount/discount-list/discount-list.component.html new file mode 100644 index 0000000..32c9112 --- /dev/null +++ b/src/app/admin/discount/discount-list/discount-list.component.html @@ -0,0 +1,263 @@ + + + + + +
+
+
+ +
+ + 优惠券KYE + + + + +
+
+ + 优惠券名称 + + + + +
+
+ + 优惠券类型 + + + + + + + + +
+ +
+ +
+
+ + +
+
+
+
+ + +
+ 共计 {{total}} 条数据 +
+ +
+ + + + 编号 + 优惠券KEY + 优惠券名称 + 优惠券类型 + 优惠内容 + 有效天数 + 截止日期 + 创建时间 + 状态 + 操作 + + + + + {{i + 1}} + {{data.discountKey}} + {{data.discountName}} + {{data.discountType | discountType}} + + + 满{{data.discountCondition}}抵扣{{data.discountPrice}} + + + 抵扣{{data.discountPrice}} + + + {{data.discountPrice}}折 + + + {{data.effectiveDay}} + {{data.salesEndTime | date: 'yyyy-MM-dd HH:mm'}} + {{data.createTime}} + {{data.status | discountStatus}} + + + + + + + + + + + +
+ + + +
+
+
+ +
+ + 卡券名称 + + + + +
+
+ + 商户 + + + + + + +
+
+ + 卡券类型 + + + + + + + +
+
+ + 卡券来源 + + + + + + + +
+ +
+ +
+
+ + +
+
+
+
+
+ + + + + 卡券编号 + 卡券名称 + 销售价格 + 有效库存 + 卡券类型 + 卡券状态 + 销售截止时间 + + + + + + {{data.couponKey}} + {{data.couponName}} + ¥{{data.salesPrice}} + {{data.stockCount}} + {{data.couponType === 1 ? '内部卷' : '外部卷'}} + {{data.status | couponStatus}} + {{data.salesEndTime | date: 'yyyy-MM-dd HH:mm'}} + + +
+
+ + +
+ + + + 卡券编号 + 卡券名称 + 销售价格 + 有效库存 + 卡券类型 + 卡券状态 + 销售截止时间 + 绑定时间 + 操作 + + + + + {{data['highCoupon'].couponKey}} + {{data['highCoupon'].couponName}} + ¥{{data['highCoupon'].salesPrice}} + {{data['highCoupon'].stockCount}} + {{data['highCoupon'].couponType === 1 ? '内部卷' : '外部卷'}} + {{data['highCoupon'].status | couponStatus}} + {{data['highCoupon'].salesEndTime | date: 'yyyy-MM-dd HH:mm'}} + {{data.createTime | date: 'yyyy-MM-dd HH:mm'}} + 删除 + + +
+
diff --git a/src/app/admin/discount/discount-list/discount-list.component.scss b/src/app/admin/discount/discount-list/discount-list.component.scss new file mode 100644 index 0000000..8bee3fb --- /dev/null +++ b/src/app/admin/discount/discount-list/discount-list.component.scss @@ -0,0 +1,4 @@ +.head_img { + height: 60px; + width: 60px; +} diff --git a/src/app/admin/discount/discount-list/discount-list.component.ts b/src/app/admin/discount/discount-list/discount-list.component.ts new file mode 100644 index 0000000..805fce9 --- /dev/null +++ b/src/app/admin/discount/discount-list/discount-list.component.ts @@ -0,0 +1,252 @@ +import { Component, OnInit } from '@angular/core'; +import {environment} from '../../../../environments/environment'; +import {FormBuilder, FormGroup} from '@angular/forms'; +import {AgentService} from '../../../services/agent.service'; +import {IconService} from '../../../services/icon.service'; +import {NzMessageService} from 'ng-zorro-antd'; +import {Router} from '@angular/router'; +import {CommonsService} from '../../../services/commons.service'; +import {DiscountService} from '../../../services/discount.service'; +import {CouponService} from '../../../services/coupon.service'; +import {MerchantService} from '../../../services/merchant.service'; + +@Component({ + selector: 'app-discount-list', + templateUrl: './discount-list.component.html', + styleUrls: ['./discount-list.component.scss'] +}) +export class DiscountListComponent implements OnInit { + + WEB_SERVE_URL = environment.imageUrl; + searchForm: FormGroup; // 搜索框 + searchFormCoupon: FormGroup; // 搜索框 + requestData = []; // 列表数据 + couponData = []; // 列表数据 + optionList = []; // 列表数据 + discountCoupon = []; // 列表数据 + total: number; // 页码 + pageNum = 1; // 页码 + pageSize = 10; // 条码 + loading = true; + isVisible = false; + isVisibleList = false; + couponList: any; + requestCouponData = []; // 列表数据 + loadingCoupon = true; + loadingDiscountCoupon = true; + discountId: number; + RelByDiscountId: number; + + setOfCheckedId = new Set(); + checked = false; + indeterminate = false; + + updateCheckedSet(id: number, checked: boolean): void { + if (checked) { + this.setOfCheckedId.add(id); + } else { + this.setOfCheckedId.delete(id); + } + } + + onItemChecked(id: number, checked: boolean): void { + this.updateCheckedSet(id, checked); + this.refreshCheckedStatus(); + } + + onAllChecked(value: boolean): void { + this.requestCouponData.forEach(item => this.updateCheckedSet(item.id, value)); + this.refreshCheckedStatus(); + } + + + + refreshCheckedStatus(): void { + this.checked = this.requestCouponData.every(item => this.setOfCheckedId.has(item.id)); + this.indeterminate = this.requestCouponData.some(item => this.setOfCheckedId.has(item.id)) && !this.checked; + } + + constructor( + private form: FormBuilder, + private discount: DiscountService, + private iconService: IconService, + private merchant: MerchantService, + private message: NzMessageService, + private router: Router, + private common: CommonsService, + private coupon: CouponService + ) { + } + + ngOnInit(): void { + this.init(); + const whereObject = {}; + whereObject['pageNum'] = 1; + whereObject['pageSize'] = 30000; + this.merchant.getMerchantList(whereObject , data => { + if (data['return_code'] === '000000' ) { + this.optionList = data['return_data'].list; + } + }); + } + + public init(): void { + this.searchForm = this.form.group({ + discountKey: [null], + discountName: [null], + discountType: [null], + }); + this.searchFormCoupon = this.form.group({ + merchantId: [null], + couponName: [null], + couponType: [null], + couponSource: [null], + status: [2], + }); + 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.discount.getDiscountList(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 === 2 ? '是否下架当前优惠券' : '是否上架当前优惠券'); + const s = status === 2 ? 3 : 2; + this.common.showConfirm(message, data => { + if (data) { + this.discount.editStatus(id, s , dataUser => { + if (dataUser['return_code'] === '000000') { + this.message.success(dataUser['return_data']); + } else { + this.message.error(dataUser['return_msg']); + } + this.getRequest(false , this.searchForm.value); + }); + } + }); + } + + + // 修改 + public getEdit(id: number): void { + this.router.navigate(['/admin/discount/discount-detail'], { + queryParams: { + discountId: 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 getCoupon(whereObject: object , id: number): void { + this.isVisible = true; + this.discountId = id; + whereObject['pageNum'] = 1; + whereObject['pageSize'] = 30000; + this.coupon.getCouponList(whereObject, data => { + if (data['return_code'] === '000000') { + this.loadingCoupon = false; + this.requestCouponData = data['return_data'].list; + } else { + this.message.error(data['return_msg']); + } + }); + + } + + handleOk(): void { + const couponIdStr = []; + this.setOfCheckedId.forEach(item => couponIdStr.push(item)); + const params = { + discountId : this.discountId, + couponIdStr : couponIdStr.join(',') + }; + this.discount.insertDiscountCoupon(params , data => { + if (data['return_code'] === '000000') { + this.message.success(data['return_data']); + } else { + this.message.error(data['return_msg']); + } + }); + this.isVisible = false; + } + + handleCancel(): void { + this.isVisible = false; + } + + + // 重置 + public resetCouponForm(): void { + this.searchFormCoupon.reset(); + } + + public getCouponList(id: number): void { + this.RelByDiscountId = id; + this.getRelByDiscount(id); + this.isVisibleList = true; + } + + getRelByDiscount(id: number): void { + this.loadingDiscountCoupon = true; + this.discount.getRelByDiscount(id , data => { + if (data['return_code'] === '000000') { + this.loadingDiscountCoupon = false; + this.discountCoupon = data['return_data']; + } else { + this.message.error(data['return_msg']); + } + }); + } + + handleCancelList(): void { + this.isVisibleList = false; + } + + showDeleteConfirmDelete(id: number): void { + this.common.showConfirm('是否确定删除!' , dataR => { + if (dataR) { + this.discount.delete(id, data => { + if (data['return_code'] === '000000') { + this.getRelByDiscount(this.RelByDiscountId); + this.message.success(data['return_data']); + } else { + this.message.error(data['return_msg']); + } + }); + } + }); + } + + +} + diff --git a/src/app/admin/discount/discount-routing.module.ts b/src/app/admin/discount/discount-routing.module.ts new file mode 100644 index 0000000..ade5001 --- /dev/null +++ b/src/app/admin/discount/discount-routing.module.ts @@ -0,0 +1,21 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; + +import {DiscountListComponent} from './discount-list/discount-list.component'; +import {DiscountEditComponent} from './discount-edit/discount-edit.component'; +import {DiscountDetailComponent} from './discount-detail/discount-detail.component'; +import {DiscountCouponComponent} from './discount-coupon/discount-coupon.component'; + + +const routes: Routes = [ + { path: 'discount-list', component: DiscountListComponent }, + { path: 'discount-edit', component: DiscountEditComponent }, + { path: 'discount-detail', component: DiscountDetailComponent }, + { path: 'discount-coupon', component: DiscountCouponComponent }, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class DiscountRoutingModule { } diff --git a/src/app/admin/discount/discount.module.ts b/src/app/admin/discount/discount.module.ts new file mode 100644 index 0000000..a483d7f --- /dev/null +++ b/src/app/admin/discount/discount.module.ts @@ -0,0 +1,31 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { DiscountRoutingModule } from './discount-routing.module'; +import { DiscountListComponent } from './discount-list/discount-list.component'; +import { DiscountEditComponent } from './discount-edit/discount-edit.component'; +import { DiscountDetailComponent } from './discount-detail/discount-detail.component'; +import {NgZorroAntdModule} from 'ng-zorro-antd'; +import {SeparateModule} from '../../common/separate/separate.module'; +import {FormsModule, ReactiveFormsModule} from '@angular/forms'; +import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module'; +import {RichtextModule} from '../../common/richtext/richtext.module'; +import {AppCommonModule} from '../../app-common.module'; +import { DiscountCouponComponent } from './discount-coupon/discount-coupon.component'; + + +@NgModule({ + declarations: [DiscountListComponent, DiscountEditComponent, DiscountDetailComponent, DiscountCouponComponent], + imports: [ + CommonModule, + DiscountRoutingModule, + NgZorroAntdModule, + SeparateModule, + ReactiveFormsModule, + FormsModule, + BreadcrumbModule, + RichtextModule, + AppCommonModule + ] +}) +export class DiscountModule { } diff --git a/src/app/admin/merchant/merchant-detail/merchant-detail.component.html b/src/app/admin/merchant/merchant-detail/merchant-detail.component.html index 5ea9a7b..31ec073 100644 --- a/src/app/admin/merchant/merchant-detail/merchant-detail.component.html +++ b/src/app/admin/merchant/merchant-detail/merchant-detail.component.html @@ -1,7 +1,7 @@
- + {{data['secUser']['loginName']}} {{data['merchantKey']}} diff --git a/src/app/admin/merchant/merchant-detail/merchant-detail.component.ts b/src/app/admin/merchant/merchant-detail/merchant-detail.component.ts index 88d34a1..dd25626 100644 --- a/src/app/admin/merchant/merchant-detail/merchant-detail.component.ts +++ b/src/app/admin/merchant/merchant-detail/merchant-detail.component.ts @@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core'; import {MerchantService} from '../../../services/merchant.service'; import {NzMessageService} from 'ng-zorro-antd'; import {ActivatedRoute} from '@angular/router'; +import {environment} from '../../../../environments/environment'; @Component({ selector: 'app-merchant-detail', @@ -12,6 +13,7 @@ export class MerchantDetailComponent implements OnInit { data: any = {}; id: number; + FILE_URL = environment.imageUrl; constructor( private merchant: MerchantService, private message: NzMessageService, // 信息提示 diff --git a/src/app/admin/merchant/merchant-edit/merchant-edit.component.html b/src/app/admin/merchant/merchant-edit/merchant-edit.component.html index 5e6c7fa..7a4537d 100644 --- a/src/app/admin/merchant/merchant-edit/merchant-edit.component.html +++ b/src/app/admin/merchant/merchant-edit/merchant-edit.component.html @@ -22,7 +22,7 @@
- 77 + 登录密码 diff --git a/src/app/admin/merchant/merchant-edit/merchant-edit.component.ts b/src/app/admin/merchant/merchant-edit/merchant-edit.component.ts index dd91d47..0a88cb1 100644 --- a/src/app/admin/merchant/merchant-edit/merchant-edit.component.ts +++ b/src/app/admin/merchant/merchant-edit/merchant-edit.component.ts @@ -51,7 +51,7 @@ export class MerchantEditComponent implements OnInit { this.validateForm = this.fb.group({ loginTelephone: [null, [Validators.required, ValidatorsService.mobile]], password: [null, [Validators.required, ValidatorsService.minLength(6)]], - merchantName: [null, [Validators.required, ValidatorsService.pwdLength(2, 12)]], + merchantName: [null, [Validators.required, ValidatorsService.pwdLength(2, 5)]], telephone: [null, [Validators.required]], address: [null, [Validators.required]], bankName: [null], @@ -86,6 +86,7 @@ export class MerchantEditComponent implements OnInit { } } + console.log(this.validateForm.value); this.validateForm.value['secUser']['telephone'] = this.validateForm.value.loginTelephone; this.validateForm.value['secUser']['password'] = this.validateForm.value.password; if (this.logoFile.length !== 0) { diff --git a/src/app/admin/order/order-detail/order-detail.component.html b/src/app/admin/order/order-detail/order-detail.component.html new file mode 100644 index 0000000..d128785 --- /dev/null +++ b/src/app/admin/order/order-detail/order-detail.component.html @@ -0,0 +1 @@ +

order-detail works!

diff --git a/src/app/admin/order/order-detail/order-detail.component.scss b/src/app/admin/order/order-detail/order-detail.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/admin/order/order-detail/order-detail.component.ts b/src/app/admin/order/order-detail/order-detail.component.ts new file mode 100644 index 0000000..66e9666 --- /dev/null +++ b/src/app/admin/order/order-detail/order-detail.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-order-detail', + templateUrl: './order-detail.component.html', + styleUrls: ['./order-detail.component.scss'] +}) +export class OrderDetailComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/src/app/admin/order/order-list/order-list.component.html b/src/app/admin/order/order-list/order-list.component.html index e311aa6..4ebe375 100644 --- a/src/app/admin/order/order-list/order-list.component.html +++ b/src/app/admin/order/order-list/order-list.component.html @@ -18,7 +18,7 @@ 客户手机号 - +
@@ -26,7 +26,7 @@ 状态 - + @@ -66,33 +66,79 @@ 编号 + 商品名称 + 订单来源 订单号 支付流水号 客户名称 客户电话 - 支付模式 + 支付模式 支付方式 支付金额 - 支付时间 - 取消时间 创建时间 状态 + {{i+1}} - {{data.orderNo}} - {{data.paySerialNo == null ? '暂无': data.paySerialNo}} + {{data.goodsName}} + {{data.giveawayType === true ? '赠送' : '购买'}} + + + 赠送订单 + + + {{data.orderNo}} + + + + + 赠送订单 + + + {{data.paySerialNo}} + + {{data.memName == null ? '暂无': data.memName}} {{data.memPhone == null ? '暂无': data.memPhone}} - {{data.payModel == null ? '暂无': data.payModel}} - {{data.payType == null ? '暂无': data.payType}} - {{data.payPrice == null ? '暂无': data.payPrice}} - {{data.payTime | date: 'yyyy-MM-dd HH:mm'}} - {{data.cancelTime | date: 'yyyy-MM-dd HH:mm'}} + + + 赠送 + + + {{data.payModel == null ? '暂无': data.payModel | paymodel}} + + + + + 赠送 + + + {{data.payType == null ? '暂无': data.payType | paytype}} + + + + + 0 + + + {{data.payPrice == null ? '暂无': data.payPrice}} + + {{data.createTime | date: 'yyyy-MM-dd HH:mm'}} - {{data.orderStatus | orderCouponStatus}} + + + 赠送订单 + + + {{data.orderStatus | orderCouponStatus}} + + + + + diff --git a/src/app/admin/order/order-list/order-list.component.ts b/src/app/admin/order/order-list/order-list.component.ts index 87ba687..1937b2b 100644 --- a/src/app/admin/order/order-list/order-list.component.ts +++ b/src/app/admin/order/order-list/order-list.component.ts @@ -39,9 +39,9 @@ export class OrderListComponent implements OnInit { public init(): void { this.searchForm = this.form.group({ - phone: [null], + memPhone: [null], orderNo: [null], - status: [null], + orderStatus: [null], }); this.getRequest(true, this.searchForm.value); } @@ -74,7 +74,7 @@ export class OrderListComponent implements OnInit { // 查看详情 public getDetail(id: number): void { - this.router.navigate(['/admin/merchant/merchant-detail'], { + this.router.navigate(['/admin/order/order-detail'], { queryParams: { merchantId: id } diff --git a/src/app/admin/order/order-routing.module.ts b/src/app/admin/order/order-routing.module.ts index 67bba9b..4d2bf72 100644 --- a/src/app/admin/order/order-routing.module.ts +++ b/src/app/admin/order/order-routing.module.ts @@ -1,10 +1,12 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import {OrderListComponent} from './order-list/order-list.component'; +import {OrderDetailComponent} from './order-detail/order-detail.component'; const routes: Routes = [ { path: 'order-list', component: OrderListComponent }, + { path: 'order-detail', component: OrderDetailComponent }, ]; @NgModule({ diff --git a/src/app/admin/order/order.module.ts b/src/app/admin/order/order.module.ts index 6f9c393..a75b6ac 100644 --- a/src/app/admin/order/order.module.ts +++ b/src/app/admin/order/order.module.ts @@ -9,10 +9,11 @@ import {FormsModule, ReactiveFormsModule} from '@angular/forms'; import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module'; import {RegionSelectorModule} from '../../common/region-selector/region-selector.module'; import {AppCommonModule} from "../../app-common.module"; +import { OrderDetailComponent } from './order-detail/order-detail.component'; @NgModule({ - declarations: [OrderListComponent], + declarations: [OrderListComponent, OrderDetailComponent], imports: [ CommonModule, OrderRoutingModule, diff --git a/src/app/admin/system/system-organization/system-organization.component.html b/src/app/admin/system/system-organization/system-organization.component.html index 19bbb3a..c198290 100644 --- a/src/app/admin/system/system-organization/system-organization.component.html +++ b/src/app/admin/system/system-organization/system-organization.component.html @@ -71,12 +71,12 @@
- - 地区 - - - - + + + + + + + + + + + @@ -149,12 +149,12 @@ - - 地区 - - - - + + + + + + + + + + + - - logo - - - -
上传
-
-
-
+ + + + + + + + + + + + + + - - 邮箱 - - - - + + + + + + - - 网站 - - - - + + + + + + - - 备注 - - - - + + + + + +
diff --git a/src/app/admin/system/system-organization/system-organization.component.ts b/src/app/admin/system/system-organization/system-organization.component.ts index f46b128..f58c395 100644 --- a/src/app/admin/system/system-organization/system-organization.component.ts +++ b/src/app/admin/system/system-organization/system-organization.component.ts @@ -126,7 +126,7 @@ export class SystemOrganizationComponent implements OnInit { this.validateForm = this.fb.group({ // regionAbbreviate: [null, [Validators.required, ValidatorsService.maxLength(10)]], name: [null, [Validators.required]], - address: [null, [Validators.required]], + // address: [null, [Validators.required]], phone: [null, [Validators.required]], siteUrl: [null], email: [null], @@ -272,12 +272,16 @@ export class SystemOrganizationComponent implements OnInit { } // 确定添加按钮 handleOk(value: any): void { + if (this.orgId == null || this.orgId === '') { + this.message.error('请选择上级部门'); + return; + } // 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.status == null || this.validateForm.status !== 'VALID' || this.regionId == null) { + if (this.validateForm.status == null || this.validateForm.status !== 'VALID') { this.modalService.info({ nzTitle: '提示', nzContent: '有未填写的必填项', @@ -360,7 +364,7 @@ export class SystemOrganizationComponent implements OnInit { this.validateForm.controls[i].markAsDirty(); this.validateForm.controls[i].updateValueAndValidity(); } - if (this.validateForm.status == null || this.validateForm.status !== 'VALID' || this.regionId == null) { + if (this.validateForm.status == null || this.validateForm.status !== 'VALID') { this.modalService.info({ nzTitle: '提示', nzContent: '有未填写的必填项', diff --git a/src/app/app-common.module.ts b/src/app/app-common.module.ts index dfb3e53..a3b12f4 100644 --- a/src/app/app-common.module.ts +++ b/src/app/app-common.module.ts @@ -16,9 +16,14 @@ import { CouponStatusPipe, CouponCodePipe, AuditTypePipe, - AuditStatusPipe + AuditStatusPipe, + PaymodelPipe, + PaytypePipe, + DiscountTypePipe, + OrderCouponStatusPipe, + DiscountStatusPipe } from './pipes'; -import { OrderCouponStatusPipe } from './pipes/order/order-coupon-status.pipe'; + const PIPES = [ TimesPipe, @@ -29,6 +34,10 @@ const PIPES = [ AuditTypePipe, AuditStatusPipe, OrderCouponStatusPipe, + PaymodelPipe, + PaytypePipe, + DiscountTypePipe, + DiscountStatusPipe ]; @@ -42,6 +51,7 @@ const PIPES = [ ], declarations: [ ...PIPES, + ], exports: [ diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index d9efb45..9ac20b3 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -61,11 +61,21 @@ const routes: Routes = [ loadChildren: () => import('./admin/order/order.module').then(m => m.OrderModule), canActivate: [InitGuardService] }, + { + path: 'discount', + loadChildren: () => import('./admin/discount/discount.module').then(m => m.DiscountModule), + canActivate: [InitGuardService] + }, { path: 'system', loadChildren: () => import('./admin/system/system.module').then(m => m.SystemModule), canActivate: [InitGuardService] }, + { + path: 'agent', + loadChildren: () => import('./admin/agent/agent.module').then(m => m.AgentModule), + canActivate: [InitGuardService] + }, { path: 'cms', loadChildren: () => import('./admin/cms/cms.module').then(m => m.CmsModule), diff --git a/src/app/pipes/discount-status.pipe.ts b/src/app/pipes/discount-status.pipe.ts new file mode 100644 index 0000000..1e69943 --- /dev/null +++ b/src/app/pipes/discount-status.pipe.ts @@ -0,0 +1,19 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'discountStatus' +}) +export class DiscountStatusPipe implements PipeTransform { + + transform(value: number): string { + switch (value) { + case 1: + return '编辑中'; + case 2: + return '已上架'; + case 3: + return '已下架'; + } + } + +} diff --git a/src/app/pipes/discount-type.pipe.ts b/src/app/pipes/discount-type.pipe.ts new file mode 100644 index 0000000..4845a4c --- /dev/null +++ b/src/app/pipes/discount-type.pipe.ts @@ -0,0 +1,19 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'discountType' +}) +export class DiscountTypePipe implements PipeTransform { + + transform(value: number): string { + switch (value) { + case 1: + return '满减'; + case 2: + return '抵扣'; + case 3: + return '折扣'; + } + } + +} diff --git a/src/app/pipes/index.ts b/src/app/pipes/index.ts index ddadb9b..98a80b9 100644 --- a/src/app/pipes/index.ts +++ b/src/app/pipes/index.ts @@ -6,3 +6,7 @@ export * from './coupon-code.pipe'; export * from './audit-status.pipe'; export * from './audit-type.pipe'; export * from './order/order-coupon-status.pipe'; +export * from './paymodel.pipe'; +export * from './paytype.pipe'; +export * from './discount-type.pipe'; +export * from './discount-status.pipe'; diff --git a/src/app/pipes/paymodel.pipe.ts b/src/app/pipes/paymodel.pipe.ts new file mode 100644 index 0000000..14e6c20 --- /dev/null +++ b/src/app/pipes/paymodel.pipe.ts @@ -0,0 +1,18 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'paymodel' +}) +export class PaymodelPipe implements PipeTransform { + + transform(value: number): string { + switch (value) { + case 1: + return '金币支付'; + case 2: + return '第三方支付'; + case 3: + return '混合支付'; + } + } +} diff --git a/src/app/pipes/paytype.pipe.ts b/src/app/pipes/paytype.pipe.ts new file mode 100644 index 0000000..e47fd25 --- /dev/null +++ b/src/app/pipes/paytype.pipe.ts @@ -0,0 +1,18 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'paytype' +}) +export class PaytypePipe implements PipeTransform { + + transform(value: number): string { + switch (value) { + case 1: + return '支付宝'; + case 2: + return '微信'; + case 3: + return '金币'; + } + } +} diff --git a/src/app/services/agent.service.ts b/src/app/services/agent.service.ts new file mode 100644 index 0000000..863e116 --- /dev/null +++ b/src/app/services/agent.service.ts @@ -0,0 +1,106 @@ +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 AgentService { + + + constructor( + private http: HttpClient, + private common: CommonsService + ) { } + + /** + * 查询列表 + * + * @param paramsObject 对象 + * @param callBack 回调 + */ + public getListAgent(paramsObject: object, callBack) { + this.http.get(environment.baseUrl + 'highAgent/getListAgent?' + this.common.getWhereCondition(paramsObject)).subscribe(data => { + callBack(data); + }); + } + + /** + * 新增 + * + * @param params 上传对象 + * @param callBack 回调 + * @return data 返回结果 + */ + public insertAgent(params: object, callBack) { + this.http.post(environment.baseUrl + 'highAgent/insertAgent', params).subscribe(data => { + callBack(data); + }); + } + + /** + * 修改卡券 + * + * @param params 上传对象 + * @param callBack 回调 + * @return data 返回结果 + */ + public updateAgent(params: object, callBack) { + this.http.post(environment.baseUrl + 'highAgent/updateAgent', 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); + }); + } + + + /** + * 修改公司状态 + * + * @param id 用户id + * @param status status + * @param callBack 返回参数 + */ + public editStatus(id: number, callBack) { + this.http.get(environment.baseUrl + 'highAgent/forbiddenUser?agentId=' + id ).subscribe(data => { + callBack(data); + }); + } + + /** + * 分配优惠券给代理商 + * + * @param params 上传对象 + * @param callBack 回调 + * @return data 返回结果 + */ + public insertDiscountAgent(params: object, callBack) { + this.http.post(environment.baseUrl + 'discountAgentRel/insertDiscountAgent', params).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询列表 + * + * @param paramsObject 对象 + * @param callBack 回调 + */ + public getDiscountAgentList(paramsObject: object, callBack) { + this.http.get(environment.baseUrl + 'discountAgentRel/getDiscountAgentList?' + this.common.getWhereCondition(paramsObject)).subscribe(data => { + callBack(data); + }); + } + +} diff --git a/src/app/services/discount.service.ts b/src/app/services/discount.service.ts new file mode 100644 index 0000000..98ef801 --- /dev/null +++ b/src/app/services/discount.service.ts @@ -0,0 +1,119 @@ +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 DiscountService { + + + constructor( + private http: HttpClient, + private common: CommonsService + ) { } + + /** + * 查询列表 + * + * @param paramsObject 对象 + * @param callBack 回调 + */ + public getDiscountList(paramsObject: object, callBack) { + this.http.get(environment.baseUrl + 'discount/getDiscountList?' + this.common.getWhereCondition(paramsObject)).subscribe(data => { + callBack(data); + }); + } + + /** + * 新增 + * + * @param params 上传对象 + * @param callBack 回调 + * @return data 返回结果 + */ + public insertDiscount(params: object, callBack) { + this.http.post(environment.baseUrl + 'discount/insertDiscount', params).subscribe(data => { + callBack(data); + }); + } + + /** + * 修改卡券 + * + * @param params 上传对象 + * @param callBack 回调 + * @return data 返回结果 + */ + public updateDiscount(params: object, callBack) { + this.http.post(environment.baseUrl + 'discount/updateDiscount', params).subscribe(data => { + callBack(data); + }); + } + + /** + * 根据id查询详情 + * + * @param id id + * @param callBack 回调 + */ + public getDiscountById(id: number, callBack) { + this.http.get(environment.baseUrl + 'discount/getDiscountById?id=' + id).subscribe(data => { + callBack(data); + }); + } + + + /** + * 修改公司状态 + * + * @param id 用户id + * @param status status + * @param callBack 返回参数 + */ + public editStatus(id: number, status: number, callBack) { + this.http.get(environment.baseUrl + 'discount/updateDiscountStatus?discountId=' + id + '&status=' + status ).subscribe(data => { + callBack(data); + }); + } + + + /** + * 增加优惠券和卡券关系 + * + * @param params 上传对象 + * @param callBack 回调 + * @return data 返回结果 + */ + public insertDiscountCoupon(params: object, callBack) { + this.http.post(environment.baseUrl + 'discountCoupon/insertDiscountCoupon', params).subscribe(data => { + callBack(data); + }); + } + + + /** + * 根据优惠券 查询关联卡券 + * + * @param id 用户id + * @param callBack 返回参数 + */ + public getRelByDiscount(id: number, callBack) { + this.http.get(environment.baseUrl + 'discountCoupon/getRelByDiscount?discountId=' + id ).subscribe(data => { + callBack(data); + }); + } + + /** + * 删除 + * + * @param id 用户id + * @param callBack 返回参数 + */ + public delete(id: number, callBack) { + this.http.get(environment.baseUrl + 'discountCoupon/delete?id=' + id ).subscribe(data => { + callBack(data); + }); + } +} diff --git a/src/app/services/icon.service.ts b/src/app/services/icon.service.ts index e9882fc..86ff7ce 100644 --- a/src/app/services/icon.service.ts +++ b/src/app/services/icon.service.ts @@ -12,7 +12,7 @@ export class IconService { constructor(private iconService: NzIconService) { this.iconService.fetchFromIconfont({ - scriptUrl: 'https://at.alicdn.com/t/font_2424521_9lbh3xk0u0h.js' + scriptUrl: 'https://at.alicdn.com/t/font_2424521_irl9t133o8k.js' }); } } diff --git a/src/app/services/order.service.ts b/src/app/services/order.service.ts index 49898c2..f42ed2f 100644 --- a/src/app/services/order.service.ts +++ b/src/app/services/order.service.ts @@ -20,7 +20,7 @@ export class OrderService { * @param callBack 回调 */ public getOrderCouponList(paramsObject: object, callBack) { - this.http.get(environment.baseUrl + 'highOrder/getOrderList?' + this.common.getWhereCondition(paramsObject)).subscribe(data => { + this.http.get(environment.baseUrl + 'highOrder/getOrderBList?' + this.common.getWhereCondition(paramsObject)).subscribe(data => { callBack(data); }); } diff --git a/src/assets/node_modules/@notadd/neditor/dialogs/fonts/iconfont.svg b/src/assets/node_modules/@notadd/neditor/dialogs/fonts/iconfont.svg index f2e73d5..d0c28bc 100644 --- a/src/assets/node_modules/@notadd/neditor/dialogs/fonts/iconfont.svg +++ b/src/assets/node_modules/@notadd/neditor/dialogs/fonts/iconfont.svg @@ -23,7 +23,7 @@ Created by iconfont - + diff --git a/src/assets/node_modules/@notadd/neditor/neditor.service.js b/src/assets/node_modules/@notadd/neditor/neditor.service.js index 28062e5..75a5fe9 100644 --- a/src/assets/node_modules/@notadd/neditor/neditor.service.js +++ b/src/assets/node_modules/@notadd/neditor/neditor.service.js @@ -5,7 +5,7 @@ * @returns 返回自定义的上传接口 */ -let UPLOADFILE = 'https://hsgcs.dctpay.com/brest//fileUpload/uploadfile'; +let UPLOADFILE = 'https://·/brest//fileUpload/uploadfile'; UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl; UE.Editor.prototype.getActionUrl = function(action) { diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 532a068..02e8aa1 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -5,9 +5,9 @@ export const environment = { production: false, baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址) - imageUrl: 'http://localhost:9302/filesystem/', + // imageUrl: 'http://localhost:9302/filesystem/', // baseUrl: 'https://hsgcs.dctpay.com/brest/', // 正式环境服务器地址(请求数据地址) - // imageUrl: 'https://hsgcs.dctpay.com/filesystem/', + imageUrl: 'https://hsgcs.dctpay.com/filesystem/', }; /*