diff --git a/src/app/app.config.ts b/src/app/app.config.ts index a8c9593..6b9ccc8 100644 --- a/src/app/app.config.ts +++ b/src/app/app.config.ts @@ -26,6 +26,6 @@ export const appConfig: ApplicationConfig = { BrowserAnimationsModule, InitGuardService, // 校验登录 { provide: HTTP_INTERCEPTORS, useClass: InterceptorService, multi: true}, - { provide: RouteReuseStrategy, useClass: AiRouteReuseStrategy } +/* { provide: RouteReuseStrategy, useClass: AiRouteReuseStrategy }*/ ] }; diff --git a/src/app/pages/body/index/index.component.ts b/src/app/pages/body/index/index.component.ts index 1cae0a6..ad80492 100644 --- a/src/app/pages/body/index/index.component.ts +++ b/src/app/pages/body/index/index.component.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import {Component, OnInit} from '@angular/core'; import {Router, RouterLink, RouterOutlet} from "@angular/router"; import { NzContentComponent, @@ -55,7 +55,7 @@ import {buttonData} from "../../../data/common/button.namespace"; templateUrl: './index.component.html', styleUrl: './index.component.less', }) -export class IndexComponent { +export class IndexComponent implements OnInit { // 菜单数据 menuData: any = [{ 'menuName' : '首页', @@ -69,6 +69,27 @@ export class IndexComponent { // 当前顶级菜单 currentParentMenu: any = {}; + ngOnInit(): void { + // 缓存数据字典 + this.commonService.queryDictionary('','',(data: any) => { + dictionaryData.length = 0; + for (let item of data['return_data']) { + dictionaryData.push( + { + codeType: item.codeType, + codeValue: item.codeValue, + codeName: item.codeName, + codeDesc: item.codeDesc, + sortId: item.sortId, + ext1: item.ext1, + ext2: item.ext2, + ext3: item.ext3 + } + ); + } + }); + } + constructor( private commonService: CommonService, private storage: BrowserStorageService, @@ -91,24 +112,6 @@ export class IndexComponent { } ); } - // 缓存数据字典 - this.commonService.queryDictionary('','',(data: any) => { - dictionaryData.length = 0; - for (let item of data['return_data']) { - dictionaryData.push( - { - codeType: item.codeType, - codeValue: item.codeValue, - codeName: item.codeName, - codeDesc: item.codeDesc, - sortId: item.sortId, - ext1: item.ext1, - ext2: item.ext2, - ext3: item.ext3 - } - ); - } - }); this.menuData = this.menuData.concat(this.storage.get(DATA)['menuTree']); this.userInfo = this.storage.get(DATA)['account']; diff --git a/src/app/pages/discount-pk/discount-pk-edit/discount-pk-edit.component.html b/src/app/pages/discount-pk/discount-pk-edit/discount-pk-edit.component.html index 1a97db6..fb5c4b0 100644 --- a/src/app/pages/discount-pk/discount-pk-edit/discount-pk-edit.component.html +++ b/src/app/pages/discount-pk/discount-pk-edit/discount-pk-edit.component.html @@ -60,20 +60,32 @@ - - + + + 优惠券编码 优惠券名称 数量 + 操作 - + {{data.discountNo}} {{data.discountName}} {{data.number}} + + 修改数量 + @@ -100,7 +112,6 @@ 优惠类型 优惠券金额 优惠券条件 - 使用范围 领取有效期 结束时间 @@ -113,7 +124,6 @@ {{data.discountType | dictionary: 'DISCOUNT_TYPE'}} {{data.discountPrice}} {{data.discountCondition}} - {{data.useScope}} {{data.receiveExpirationDate}}天 {{data.endTime | date : 'yyyy-MM-dd HH:mm:ss'}} @@ -121,3 +131,39 @@ + + + + +
+ + 优惠券编号 + + + + + + + 优惠券名称 + + + + + + + 数量 + + + + + +
+ +
+ +
+
+
diff --git a/src/app/pages/discount-pk/discount-pk-edit/discount-pk-edit.component.less b/src/app/pages/discount-pk/discount-pk-edit/discount-pk-edit.component.less index 9cc89f8..af646eb 100644 --- a/src/app/pages/discount-pk/discount-pk-edit/discount-pk-edit.component.less +++ b/src/app/pages/discount-pk/discount-pk-edit/discount-pk-edit.component.less @@ -17,3 +17,13 @@ nz-input-number-group { nz-date-picker { width: 100%; } +.editable-cell { + position: relative; + padding: 5px 12px; + cursor: pointer; +} +.editable-row:hover .editable-cell { + border: 1px solid #d9d9d9; + border-radius: 4px; + padding: 4px 11px; +} diff --git a/src/app/pages/discount-pk/discount-pk-edit/discount-pk-edit.component.ts b/src/app/pages/discount-pk/discount-pk-edit/discount-pk-edit.component.ts index 9873ab1..156a48d 100644 --- a/src/app/pages/discount-pk/discount-pk-edit/discount-pk-edit.component.ts +++ b/src/app/pages/discount-pk/discount-pk-edit/discount-pk-edit.component.ts @@ -29,7 +29,6 @@ import {NzCheckboxModule} from "ng-zorro-antd/checkbox"; import {DiscountPkService} from "../../../services/discount/discount-pk.service"; import {environment} from "../../../../environments/environment"; import {Observable, Observer} from "rxjs"; -import {ka_GE} from "ng-zorro-antd/i18n"; import { NzCellFixedDirective, NzTableCellDirective, @@ -38,6 +37,7 @@ import { NzTheadComponent, NzThMeasureDirective, NzThSelectionComponent, NzTrDirective } from "ng-zorro-antd/table"; +import {NzDividerModule} from "ng-zorro-antd/divider"; @Component({ selector: 'app-discount-pk-edit', @@ -78,7 +78,8 @@ import { NzTrDirective, NzCellFixedDirective, NzTdAddOnComponent, - NzThSelectionComponent + NzThSelectionComponent, + NzDividerModule ], templateUrl: './discount-pk-edit.component.html', styleUrl: './discount-pk-edit.component.less' @@ -101,6 +102,9 @@ export class DiscountPkEditComponent { // 选中的优惠券数据 checkedDiscountData: any = []; + editNumberForm: FormGroup; + editNumberModal = false; + constructor(private fb: NonNullableFormBuilder, private merService: MerService, private discountService: DiscountService, @@ -116,6 +120,12 @@ export class DiscountPkEditComponent { listImg: [null], content: [null], }); + // 初始化表单 + this.editNumberForm = this.fb.group({ + discountNo: [{ value: null, disabled: true}, [Validators.required]], + discountName: [{ value: null, disabled: true}, [Validators.required]], + number: [null, [Validators.required]], + }); // 查询优惠券数据 this.queryDiscount(); @@ -160,20 +170,19 @@ export class DiscountPkEditComponent { submitCheckedDiscount() { let array = []; for (let discountNo of this.setOfCheckedId) { + // 优惠券数据是否存在 let data = this.discountData.find((o: any) => o.discountNo == discountNo); if (data != null) { + // 是否已选择 let checkedDiscount = this.checkedDiscountData.find((o: any) => o.discountNo == discountNo); if (checkedDiscount == null) { data['number'] = 1; - let s = { - discountNo: data.discountNo - } - array.push(data); } + array.push(data); } } this.checkedDiscountData = array; - this.closeCheckedModal(); + this.closeCheckedModal(); } /** * 提交表单 @@ -185,7 +194,6 @@ export class DiscountPkEditComponent { } if (this.form.valid) { const param = this.form.value; - param['useScope'] = this.form.controls['useScope'].value.join(','); param['endTime'] = new Date(this.form.controls['endTime'].value).getTime(); this.discountPkService.edit(param, (data: any) => { if (data['return_code'] == '000000') { @@ -289,11 +297,33 @@ export class DiscountPkEditComponent { refreshCheckedStatus(): void { // @ts-ignore this.checked = this.discountData.every(({ discountNo }) => this.setOfCheckedId.has(discountNo)); - - console.log(this.setOfCheckedId); } + /** + * 修改数量 + * @param data 数据 + */ + showEditNumber(data: any): void { + this.editNumberForm.patchValue(data); + this.editNumberModal = true; + } + editNumber() { + if (this.editNumberForm.valid) { + let data = this.checkedDiscountData.find((o: any) => o.discountNo == this.editNumberForm.controls['discountNo'].value); + if (data != null) { + data['number'] = this.editNumberForm.controls['number'].value; + } + this.editNumberForm.reset(); + this.editNumberModal = false; + } else { + Object.values(this.editNumberForm.controls).forEach(control => { + if (control.invalid) { + control.markAsDirty(); + control.updateValueAndValidity({ onlySelf: true }); + } + }); + } - + } } diff --git a/src/app/pages/discount/discount-edit/discount-edit.component.html b/src/app/pages/discount/discount-edit/discount-edit.component.html index a973a54..e95a3af 100644 --- a/src/app/pages/discount/discount-edit/discount-edit.component.html +++ b/src/app/pages/discount/discount-edit/discount-edit.component.html @@ -15,6 +15,18 @@ + + 优惠条件 diff --git a/src/app/pages/discount/discount-edit/discount-edit.component.ts b/src/app/pages/discount/discount-edit/discount-edit.component.ts index 9a883bd..e9f20e9 100644 --- a/src/app/pages/discount/discount-edit/discount-edit.component.ts +++ b/src/app/pages/discount/discount-edit/discount-edit.component.ts @@ -31,6 +31,8 @@ import {NzTabsModule} from "ng-zorro-antd/tabs"; import {DiscountService} from "../../../services/discount/discount.service"; import {NzCheckboxModule} from "ng-zorro-antd/checkbox"; import {NzDatePickerModule} from "ng-zorro-antd/date-picker"; +import {NzSwitchModule} from "ng-zorro-antd/switch"; +import {NzTooltipDirective} from "ng-zorro-antd/tooltip"; @Component({ selector: 'app-discount-edit', @@ -60,7 +62,9 @@ import {NzDatePickerModule} from "ng-zorro-antd/date-picker"; NzTabsModule, NzCheckboxModule, NzDatePickerModule, - NzInputNumberGroupComponent + NzInputNumberGroupComponent, + NzSwitchModule, + NzTooltipDirective ], templateUrl: './discount-edit.component.html', styleUrl: './discount-edit.component.less' @@ -77,11 +81,13 @@ export class DiscountEditComponent { private discountService: DiscountService, private message: NzMessageService, private activatedRoute: ActivatedRoute) { + // 初始化表单 this.form = this.fb.group({ discountNo: [null], discountName: [null, [Validators.required]], discountType: [null, [Validators.required]], + //overlayDiscount: [null, [Validators.required]], discountPrice: [null, [Validators.required]], discountCondition: [null], useScope: [null], diff --git a/src/app/pages/discount/discount-list/discount-list.component.html b/src/app/pages/discount/discount-list/discount-list.component.html index 5f84d77..f4fee44 100644 --- a/src/app/pages/discount/discount-list/discount-list.component.html +++ b/src/app/pages/discount/discount-list/discount-list.component.html @@ -245,7 +245,7 @@ (nzPageIndexChange)="queryMer()" nzShowSizeChanger (nzPageSizeChange)="this.assignTablePageSize = $event;queryMer()" - [nzPageSizeOptions]="[ 10, 20, 30, 50, 100 ]" + [nzPageSizeOptions]="[ 10, 500, 100, 5000, 10000]" [nzTotal]="assignTableData.total" [nzData]="assignTableData.list" > diff --git a/src/app/pages/discount/discount-stock/discount-stock.component.ts b/src/app/pages/discount/discount-stock/discount-stock.component.ts index 2dc1b6e..c9be9a4 100644 --- a/src/app/pages/discount/discount-stock/discount-stock.component.ts +++ b/src/app/pages/discount/discount-stock/discount-stock.component.ts @@ -129,12 +129,12 @@ export class DiscountStockComponent implements OnInit{ stockCount: ['', [Validators.required]], }); } - ngOnInit(): void { // 查询数据 this.queryData(); } + /** * 获取数据 */ diff --git a/src/environments/environment.dev.ts b/src/environments/environment.dev.ts index 71468d7..ef9caa8 100644 --- a/src/environments/environment.dev.ts +++ b/src/environments/environment.dev.ts @@ -1,7 +1,5 @@ export const environment = { - production: true, - baseUrl: 'https://phgcs.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) - orderUrl: 'https://phgcs.dctpay.com/order/', // 测试环境服务器地址(请求数据地址) - userUrl: 'https://phgcs.dctpay.com/user/', // 测试环境服务器地址(请求数据地址) - imageUrl: 'https://phg-test.obs.cn-southwest-2.myhuaweicloud.com/', + production: false, + baseUrl: 'https://test-oil.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) + imageUrl: 'https://test-oil.dctpay.com/filesystem/', }; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index debd267..1942a40 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -4,7 +4,7 @@ export const environment = { production: false, - baseUrl: 'https://test-oil.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) + baseUrl: 'http://localhost:9802/brest/', // 测试环境服务器地址(请求数据地址) imageUrl: 'https://test-oil.dctpay.com/filesystem/', };