From 0110ded77d4a6750bced23c54ca681aaa863e6b0 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Thu, 13 Apr 2023 13:55:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E5=95=86=E5=93=81=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activate-list/activate-list.component.ts | 2 +- .../activate-lottery-record.component.ts | 8 +- .../config-manage/brand/brand.component.html | 18 ++-- .../config-manage/brand/brand.component.ts | 1 - .../config-manage/config-manage.module.ts | 4 +- .../goods-type/goods-type.component.html | 83 ++++++++++++++-- .../goods-type/goods-type.component.scss | 4 - .../goods-type/goods-type.component.ts | 97 +++++++++++++------ src/app/admin/index/index/index.component.ts | 3 +- src/app/admin/login/login/login.component.ts | 1 - src/app/app-routing.module.ts | 5 + src/app/services/commons.service.ts | 26 ++++- src/app/services/config.service.ts | 14 +++ src/app/services/icon.service.ts | 2 +- src/environments/environment.ts | 2 +- 15 files changed, 204 insertions(+), 66 deletions(-) diff --git a/src/app/admin/activate/activate-list/activate-list.component.ts b/src/app/admin/activate/activate-list/activate-list.component.ts index 032fe60..d007cac 100644 --- a/src/app/admin/activate/activate-list/activate-list.component.ts +++ b/src/app/admin/activate/activate-list/activate-list.component.ts @@ -6,7 +6,7 @@ import {NzMessageService} from 'ng-zorro-antd'; import {CommonsService} from '../../../services/commons.service'; import {FormBuilder, FormGroup} from '@angular/forms'; import {Router} from '@angular/router'; -import {ActivateService} from "../../../services/activate.service"; +import {ActivateService} from '../../../services/activate.service'; @Component({ selector: 'app-activate-list', diff --git a/src/app/admin/activate/activate-lottery-record/activate-lottery-record.component.ts b/src/app/admin/activate/activate-lottery-record/activate-lottery-record.component.ts index 050a048..1266c44 100644 --- a/src/app/admin/activate/activate-lottery-record/activate-lottery-record.component.ts +++ b/src/app/admin/activate/activate-lottery-record/activate-lottery-record.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; -import {ActivateService} from "../../../services/activate.service"; -import {IconService} from "../../../services/icon.service"; +import {ActivateService} from '../../../services/activate.service'; +import {IconService} from '../../../services/icon.service'; import { Params, ActivatedRoute } from '@angular/router'; import {FormBuilder, FormGroup} from '@angular/forms'; import {NzMessageService} from 'ng-zorro-antd'; @@ -98,10 +98,10 @@ export class ActivateLotteryRecordComponent implements OnInit { this.message.error('请输入新增数量!'); return; } - let post = { + const post = { activityAwardId: this.id , num: this.num - } + }; this.activate.numberOfNewRewards(post , data => { if (data['return_code'] === '000000') { this.isVisible = false; diff --git a/src/app/admin/config-manage/brand/brand.component.html b/src/app/admin/config-manage/brand/brand.component.html index 09d238e..91aa4d0 100644 --- a/src/app/admin/config-manage/brand/brand.component.html +++ b/src/app/admin/config-manage/brand/brand.component.html @@ -69,7 +69,7 @@ {{i+1}} {{data.title}} - + {{data.createdTime | date: 'yyyy-MM-dd HH:mm'}} {{data.updatedTime | date: 'yyyy-MM-dd HH:mm'}} @@ -90,14 +90,14 @@ - - 商品类别 - - - - - - + + + + + + + + 图片 diff --git a/src/app/admin/config-manage/brand/brand.component.ts b/src/app/admin/config-manage/brand/brand.component.ts index 3258d50..adb6c2c 100644 --- a/src/app/admin/config-manage/brand/brand.component.ts +++ b/src/app/admin/config-manage/brand/brand.component.ts @@ -61,7 +61,6 @@ export class BrandComponent implements OnInit { }); this.validateForm = this.fb.group({ title: [null, [Validators.required]], - goodTypeId: [null, [Validators.required]], }); this.getRequest(true, this.searchForm.value); diff --git a/src/app/admin/config-manage/config-manage.module.ts b/src/app/admin/config-manage/config-manage.module.ts index cf4c9ba..2274c20 100644 --- a/src/app/admin/config-manage/config-manage.module.ts +++ b/src/app/admin/config-manage/config-manage.module.ts @@ -13,6 +13,7 @@ import { ThirdProductComponent } from './third-product/third-product.component'; import {AppCommonModule} from '../../app-common.module'; import { MemberProductComponent } from './member-product/member-product.component'; import { IntegralRebateComponent } from './integral-rebate/integral-rebate.component'; +import {PreviewImageModule} from "../../common/preview-image/preview-image.module"; @NgModule({ @@ -26,7 +27,8 @@ import { IntegralRebateComponent } from './integral-rebate/integral-rebate.compo FormsModule, BreadcrumbModule, RegionSelectorModule, - AppCommonModule + AppCommonModule, + PreviewImageModule ] }) export class ConfigManageModule { } diff --git a/src/app/admin/config-manage/goods-type/goods-type.component.html b/src/app/admin/config-manage/goods-type/goods-type.component.html index 1a31292..3fbc455 100644 --- a/src/app/admin/config-manage/goods-type/goods-type.component.html +++ b/src/app/admin/config-manage/goods-type/goods-type.component.html @@ -6,7 +6,7 @@
-
+
标题 @@ -14,6 +14,26 @@
+ + + + + + + + + + +
+ + 业务类型 + + + + + + +
@@ -25,7 +45,6 @@
-
共计 {{total}} 条数据
@@ -35,6 +54,7 @@ class="table" #ajaxTable nzShowSizeChanger + nzBordered [nzFrontPagination]="false" [nzData]="requestData" [nzLoading]="loading" @@ -51,7 +71,7 @@ 图片 创建时间 更新时间 - 操作 + 操作 @@ -59,20 +79,28 @@ {{i+1}} {{data.title}} - + {{data.createdTime | date: 'yyyy-MM-dd HH:mm'}} {{data.updatedTime | date: 'yyyy-MM-dd HH:mm'}} 编辑 - 删除 + 更多操作 + + + +
- +
标题 @@ -81,15 +109,17 @@ - 使用业务 + 业务类型 - + + + + - 图片 - +
+ + + + + + + + 标题 + 图片 + 创建时间 + 更新时间 + 操作 + + + + + {{data.title}} + + + + {{data.createdTime | date: 'yyyy-MM-dd HH:mm'}} + {{data.updatedTime | date: 'yyyy-MM-dd HH:mm'}} + + 编辑 + + 删除 + + + + + + diff --git a/src/app/admin/config-manage/goods-type/goods-type.component.scss b/src/app/admin/config-manage/goods-type/goods-type.component.scss index 8bee3fb..e69de29 100644 --- a/src/app/admin/config-manage/goods-type/goods-type.component.scss +++ b/src/app/admin/config-manage/goods-type/goods-type.component.scss @@ -1,4 +0,0 @@ -.head_img { - height: 60px; - width: 60px; -} diff --git a/src/app/admin/config-manage/goods-type/goods-type.component.ts b/src/app/admin/config-manage/goods-type/goods-type.component.ts index b53e1ba..1e8abff 100644 --- a/src/app/admin/config-manage/goods-type/goods-type.component.ts +++ b/src/app/admin/config-manage/goods-type/goods-type.component.ts @@ -5,6 +5,7 @@ import {IconService} from '../../../services/icon.service'; import {NzMessageService, NzModalService, NzUploadFile} from 'ng-zorro-antd'; import {ConfigService} from '../../../services/config.service'; import {Router} from '@angular/router'; +import {CommonsService} from "../../../services/commons.service"; function getBase64(file: File): Promise { return new Promise((resolve, reject) => { @@ -37,7 +38,14 @@ export class GoodsTypeComponent implements OnInit { imgFile = []; previewImage: string | undefined = ''; previewVisible = false; - + businessTypeS; + goodsTypeData; + goodsTypeDataChild; + parentIdIsShow = false; + listModal = false; + listModalLoading = false; + editTitle = '编辑'; + parentId; constructor( private form: FormBuilder, private config: ConfigService, @@ -45,6 +53,7 @@ export class GoodsTypeComponent implements OnInit { private message: NzMessageService, private router: Router, private modalService: NzModalService, + private commonsService: CommonsService, private fb: FormBuilder, ) { } @@ -56,12 +65,20 @@ export class GoodsTypeComponent implements OnInit { public init(): void { this.searchForm = this.form.group({ title: [null], + businessType: [null], + parentId: [null], }); this.validateForm = this.fb.group({ title: [null, [Validators.required]], - userService: [null], + businessType: [null , [Validators.required]], + parentId: [null], }); this.getRequest(true, this.searchForm.value); + + this.getListGoodsTypeByParentId(); + this.commonsService.getDictionary('BUSINESS_TYPE', data => { + this.businessTypeS = data['return_data']; + }); } // 图片查看 @@ -74,6 +91,16 @@ export class GoodsTypeComponent implements OnInit { this.previewVisible = true; } + public getListGoodsTypeByParentId(parentId?: number): void { + this.config.getListGoodsTypeByParentId(parentId , data => { + if (data['return_code'] === '000000') { + parentId == null ? this.goodsTypeData = data['return_data'] : this.goodsTypeDataChild = data['return_data']; + } else { + this.message.error(data['return_msg']); + } + }); + } + // 查询列表 public getRequest(reset: boolean = false, whereObject: object) { @@ -100,23 +127,20 @@ export class GoodsTypeComponent implements OnInit { // 修改 - public getEdit(id?: number): void { + public getEdit(id?: number , parentId?: number , title?: string): void { this.id = id; - if (id != null) { + this.parentId = parentId; + if (title != null) { + this.editTitle = title + '添加子类'; + } + + if (id != null && parentId == null) { this.editFlag = true; this.config.getGoodsTypeById(id, data => { - if (data['return_data']['img'] != null && data['return_data']['img'] !== '') { - const img = String(data['return_data']['img']); - const imgArray = []; - imgArray.push( - { - uid: 1, - name: img, - status: 'done', - url: environment.imageUrl + img - }); - this.imgFile = imgArray; + if (!this.commonsService.whetherStringIsNull(data['return_data']['img'])) { + this.imgFile = this.commonsService.stitchImg(data['return_data']['img']); } + data['return_data']['businessType'] = String(data['return_data']['businessType']); this.validateForm.patchValue(data['return_data']); }); } else { @@ -137,12 +161,10 @@ export class GoodsTypeComponent implements OnInit { } 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; } } @@ -154,13 +176,20 @@ export class GoodsTypeComponent implements OnInit { this.validateForm.value.img = this.imgFile[0].name; } } + + if (this.validateForm.value['parentId'] == null) { + this.validateForm.value['parentId'] = this.parentId; + } + if (this.editFlag) { this.validateForm.value.id = this.id; + this.config.updateGoodsType(this.validateForm.value, data => { if (data['return_code'] === '000000') { this.message.success('修改成功'); this.isVisible = false; this.getRequest(true, this.searchForm.value); + this.getListGoodsTypeByParentId(this.validateForm.value['parentId']); } else { this.message.create('error', data['return_msg']); } @@ -171,39 +200,47 @@ export class GoodsTypeComponent implements OnInit { this.message.success('添加成功'); this.isVisible = false; this.getRequest(true, this.searchForm.value); + this.getListGoodsTypeByParentId(this.validateForm.value['parentId']); } else { this.message.create('error', data['return_msg']); } }); } + + } handleCancel(): void { this.isVisible = false; } + // 查看子类列表 + public getGoodsTypesChild(parentId: number) { + this.listModal = true; + this.getListGoodsTypeByParentId(parentId); + } // 對話框删除 showDeleteConfirm(id): void { this.modalService.confirm({ nzTitle: '确定删除', nzOkText: '是', - nzOnOk: () => this.onDelete(id), + nzOnOk: () => { + this.config.getGoodsTypeByDelete({ + id: id + }, data => { + if (data['return_code'] === '000000') { + this.message.create('success', `删除成功!`); + this.getRequest(true, this.searchForm.value); + this.getListGoodsTypeByParentId(this.parentId); + } else { + this.message.create('error', data['return_msg']); + } + }); + }, nzCancelText: '否', }); } - onDelete(ids) { - this.config.getGoodsTypeByDelete({ - id: ids - }, data => { - if (data['return_code'] === '000000') { - this.message.create('success', `删除成功!`); - this.getRequest(true, this.searchForm.value); - } else { - this.message.create('error', data['return_msg']); - } - }); - } } diff --git a/src/app/admin/index/index/index.component.ts b/src/app/admin/index/index/index.component.ts index d7319d7..600ff19 100644 --- a/src/app/admin/index/index/index.component.ts +++ b/src/app/admin/index/index/index.component.ts @@ -5,7 +5,7 @@ import {IndexService} from '../../../services/index.service'; import {environment} from '../../../../environments/environment'; import {NzMessageService} from 'ng-zorro-antd'; import {Router} from '@angular/router'; -import {CommonsService} from "../../../services/commons.service"; +import {CommonsService} from '../../../services/commons.service'; import {HttpClient , HttpClientJsonpModule} from '@angular/common/http'; @@ -64,7 +64,6 @@ export class IndexComponent implements OnInit { this.adminInfoObject = this.store.get(ADMIN_INFO_OBJECT); this.roleType = this.store.get(ADMIN_INFO_OBJECT)['secRole'].roleType; - console.log(this.roleType); if (this.roleType === 1) { this.getIndexCount(); this.getLineCount(); diff --git a/src/app/admin/login/login/login.component.ts b/src/app/admin/login/login/login.component.ts index ee9049a..6411efb 100644 --- a/src/app/admin/login/login/login.component.ts +++ b/src/app/admin/login/login/login.component.ts @@ -51,7 +51,6 @@ export class LoginComponent implements OnInit { return; } - this.loginService.userLogin(this.loginForm.value, data => { if (data['return_code'] === '000000') { data['return_data']['object']['menuList'] = data['return_data']['object']['menuList'].filter(o => o.showOnMobile === 0); diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index ab052ff..f237673 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -167,6 +167,11 @@ const routes: Routes = [ loadChildren: () => import('./admin/api-order/api-order.module').then(m => m.ApiOrderModule), canActivate: [InitGuardService] }, + { + path: 'goods', + loadChildren: () => import('./admin/goods/goods.module').then(m => m.GoodsModule), + canActivate: [InitGuardService] + }, ], }, ]; diff --git a/src/app/services/commons.service.ts b/src/app/services/commons.service.ts index 10f6692..cbb611a 100644 --- a/src/app/services/commons.service.ts +++ b/src/app/services/commons.service.ts @@ -378,7 +378,7 @@ export class CommonsService { case 7: return '优惠券包'; case 8: - return '汇联通充值'; + return 'HLT充值'; case 9: return '话费充值'; default: @@ -402,4 +402,28 @@ export class CommonsService { } } + // 判断字符串是否为空 + public whetherStringIsNull(s: string): boolean { + if (s != null && s !== '') { + return false; + } else { + return true; + } + } + + // 拼接图片内容 + public stitchImg(imgUrl: string): any { + const img = imgUrl; + const imgArray = []; + imgArray.push( + { + uid: 1, + name: img, + status: 'done', + url: environment.imageUrl + img + }); + return imgArray; + } + + } diff --git a/src/app/services/config.service.ts b/src/app/services/config.service.ts index 672cd15..f98fbe9 100644 --- a/src/app/services/config.service.ts +++ b/src/app/services/config.service.ts @@ -24,6 +24,20 @@ export class ConfigService { }); } + /** + * 查询列表不分页 + * + * @param parentId 对象 + * @param callBack 回调 + */ + public getListGoodsTypeByParentId(parentId: number, callBack) { + this.http.get(environment.baseUrl + 'highGoodsType/getListGoodsTypeByParentId?parentId=' + parentId ).subscribe(data => { + callBack(data); + }); + } + + + /** * @Author Sum1Dream * @methodName insertGoodsType diff --git a/src/app/services/icon.service.ts b/src/app/services/icon.service.ts index 535d7e7..85f4c93 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_tjuuaif43i.js' + scriptUrl: 'https://at.alicdn.com/t/c/font_2424521_u0r4ucawuek.js' }); } } diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 653c501..54aeb74 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -4,7 +4,7 @@ export const environment = { production: false, - baseUrl: 'https://hsgcs.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) + baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址) orderUrl: 'https://hsgcs.dctpay.com/order/', // 测试环境服务器地址(请求数据地址) imageUrl: 'https://hsgcs.dctpay.com/filesystem/', key: 'https://hsgcs.dctpay.com/phone-recharge-H5/index.html?codeValue=',