共计 {{total}} 条数据
-
+
+
+
+
+
+
+
+
+ 标题 |
+ 图片 |
+ 创建时间 |
+ 更新时间 |
+ 操作 |
+
+
+
+
+ {{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=',