diff --git a/src/app/pages/account/complaint/complaint.component.html b/src/app/pages/account/complaint/complaint.component.html new file mode 100644 index 0000000..8d4b98a --- /dev/null +++ b/src/app/pages/account/complaint/complaint.component.html @@ -0,0 +1,54 @@ +
+
+
+ + 用户名称 + + + + +
+
+ + 用户手机 + + + + +
+
+ + +
+
+
+ + + + + 用户名称 + 用户手机 + 内容 + 创建时间 + 更新时间 + + + + + {{data.name}} + {{data.phone}} + {{ data.content}} + {{ data.createTime | date: 'yyyy-MM-dd HH:mm'}} + {{ data.updateTime | date: 'yyyy-MM-dd HH:mm'}} + + + + 总计 {{ total }} 条 diff --git a/src/app/pages/account/complaint/complaint.component.less b/src/app/pages/account/complaint/complaint.component.less new file mode 100644 index 0000000..6d5c351 --- /dev/null +++ b/src/app/pages/account/complaint/complaint.component.less @@ -0,0 +1,12 @@ +[nz-form-label] { + overflow: visible; +} +button { + margin-left: 8px; +} +.submit-btn { + width: 150px; +} +.search-area { + margin-top: 30px; +} diff --git a/src/app/pages/account/complaint/complaint.component.ts b/src/app/pages/account/complaint/complaint.component.ts new file mode 100644 index 0000000..f13e26b --- /dev/null +++ b/src/app/pages/account/complaint/complaint.component.ts @@ -0,0 +1,111 @@ +import { Component } from '@angular/core'; +import {DatePipe, NgForOf, NgIf} from "@angular/common"; +import {NzButtonComponent} from "ng-zorro-antd/button"; +import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; +import {NzDividerComponent} from "ng-zorro-antd/divider"; +import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; +import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; +import {NzIconDirective} from "ng-zorro-antd/icon"; +import {NzImageDirective} from "ng-zorro-antd/image"; +import {NzInputDirective} from "ng-zorro-antd/input"; +import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; +import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; +import {NzPopconfirmDirective} from "ng-zorro-antd/popconfirm"; +import { + NzTableCellDirective, + NzTableComponent, + NzTbodyComponent, + NzTheadComponent, + NzThMeasureDirective, NzTrDirective +} from "ng-zorro-antd/table"; +import {PlatformCodePipe} from "../../../pipes/common/platform-code.pipe"; +import {FormGroup, NonNullableFormBuilder, ReactiveFormsModule} from "@angular/forms"; + +import {NzMessageService} from "ng-zorro-antd/message"; +import {CommonService} from "../../../services/common/common.service"; +import {CmsService} from "../../../services/cms/cms.service"; +import {UserService} from "../../../services/account/user.service"; + +@Component({ + selector: 'app-complaint', + standalone: true, + imports: [ + DatePipe, + NgForOf, + NgIf, + NzButtonComponent, + NzColDirective, + NzDividerComponent, + NzDropDownADirective, + NzDropDownDirective, + NzDropdownMenuComponent, + NzFormControlComponent, + NzFormDirective, + NzFormItemComponent, + NzFormLabelComponent, + NzIconDirective, + NzImageDirective, + NzInputDirective, + NzMenuDirective, + NzMenuItemComponent, + NzOptionComponent, + NzPopconfirmDirective, + NzRowDirective, + NzSelectComponent, + NzTableCellDirective, + NzTableComponent, + NzTbodyComponent, + NzThMeasureDirective, + NzTheadComponent, + NzTrDirective, + PlatformCodePipe, + ReactiveFormsModule + ], + templateUrl: './complaint.component.html', + styleUrl: './complaint.component.less' +}) +export class ComplaintComponent { + // 表单页数 + tablePageNum = 1; + // 表单数据 + tableData: any = { + total: 0, + loading: false, + list: [], + }; + // 搜索表单 + searchForm: FormGroup; + constructor(private fb: NonNullableFormBuilder, + private msg: NzMessageService, + private userService: UserService) { + // 初始化搜索框 + this.searchForm = this.fb.group({ + phone: [''], + name: [''], + }); + + + this.getRequest(); + + } + + // 查询列表 + public getRequest(reset: boolean = false) { + this.tableData.loading = true; + if (reset) { + this.tablePageNum = 1; + } + this.searchForm.value.pageNum = this.tablePageNum; + this.searchForm.value.pageSize = 10; + this.searchForm.value.time = new Date().getTime(); + + this.userService.queryComplaintList(this.searchForm.value , (data: any) => { + if (data['return_code'] == '000000') { + this.tableData = data['return_data']; + } else { + this.msg.error(data['return_msg']); + } + this.tableData.loading = false; + }); + } +} diff --git a/src/app/pages/merchant/mer-list/mer-list.component.html b/src/app/pages/merchant/mer-list/mer-list.component.html index 2bfd972..35e42da 100644 --- a/src/app/pages/merchant/mer-list/mer-list.component.html +++ b/src/app/pages/merchant/mer-list/mer-list.component.html @@ -330,8 +330,7 @@ - - + diff --git a/src/app/pages/system/cms/cms.component.html b/src/app/pages/system/cms/cms.component.html new file mode 100644 index 0000000..38fb1d7 --- /dev/null +++ b/src/app/pages/system/cms/cms.component.html @@ -0,0 +1,176 @@ +
+
+
+ + cms编码 + + + + +
+
+ + cms标题 + + + + +
+
+ + 平台 + + + + + + + + +
+ +
+ + + +
+
+
+ + + + + 名称 + 平台 + 图片 + 编码 + 创建时间 + 更新时间 + 状态 + 操作 + + + + + {{data.name}} + {{data.platformCode | platformCode}} + + + + {{ data.code}} + {{ data.createTime | date: 'yyyy-MM-dd HH:mm'}} + {{ data.updateTime | date: 'yyyy-MM-dd HH:mm'}} + {{ data.status == 1 ? '展示中' : '编辑中'}} + + 修改 + + + 更多 + + + + + + + + + 总计 {{ total }} 条 + + + + + +
+ + 标题 + + + + + + CMS编码 + + + + + + 平台 + + + + + + + + + + 跳转类型 + + + + + + + + + + 跳转地址 + + + + + + 应用ID + + + + + + + 上传图片 + + +
+ +
上传图片
+
+
+ + + + + + +
+
+
+
+
diff --git a/src/app/pages/system/cms/cms.component.less b/src/app/pages/system/cms/cms.component.less new file mode 100644 index 0000000..6d5c351 --- /dev/null +++ b/src/app/pages/system/cms/cms.component.less @@ -0,0 +1,12 @@ +[nz-form-label] { + overflow: visible; +} +button { + margin-left: 8px; +} +.submit-btn { + width: 150px; +} +.search-area { + margin-top: 30px; +} diff --git a/src/app/pages/system/cms/cms.component.ts b/src/app/pages/system/cms/cms.component.ts new file mode 100644 index 0000000..a9715d0 --- /dev/null +++ b/src/app/pages/system/cms/cms.component.ts @@ -0,0 +1,255 @@ +import { Component } from '@angular/core'; +import {NzButtonComponent} from "ng-zorro-antd/button"; +import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; +import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; +import {NzInputDirective} from "ng-zorro-antd/input"; +import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; +import {DatePipe, NgForOf, NgIf, NgStyle} from "@angular/common"; +import {NzDividerComponent} from "ng-zorro-antd/divider"; +import {NzIconDirective} from "ng-zorro-antd/icon"; +import {NzImageDirective, NzImageModule} from "ng-zorro-antd/image"; +import {NzModalComponent, NzModalModule} from "ng-zorro-antd/modal"; +import {NzPopconfirmDirective} from "ng-zorro-antd/popconfirm"; +import { + NzTableComponent, NzTableModule + , NzTdAddOnComponent, + +} from "ng-zorro-antd/table"; +import {NzUploadComponent, NzUploadFile} from "ng-zorro-antd/upload"; +import {environment} from "../../../../environments/environment"; +import {NzMessageService} from "ng-zorro-antd/message"; +import {CommonService} from "../../../services/common/common.service"; +import {GoodsTypeData} from "../../../model/goods.interface"; +import { fallbackImg } from '../../../data/goods/goods.namespace'; +import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; +import {CmsService} from "../../../services/cms/cms.service"; +import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; +import {NzTreeSelectComponent} from "ng-zorro-antd/tree-select"; +import {GoodsStatusPipe} from "../../../pipes/goods/goods-status.pipe"; +import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; +import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; +import { + NzInputNumberComponent, + NzInputNumberGroupComponent, + NzInputNumberGroupWhitSuffixOrPrefixDirective +} from "ng-zorro-antd/input-number"; +import {NzSpaceItemDirective} from "ng-zorro-antd/space"; +import {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; +import {NzTypographyComponent} from "ng-zorro-antd/typography"; +import {PlatformCodePipe} from "../../../pipes/common/platform-code.pipe"; +const getBase64 = (file: File): Promise => + new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.readAsDataURL(file); + reader.onload = () => resolve(reader.result); + reader.onerror = error => reject(error); + }); +@Component({ + selector: 'app-cms', + standalone: true, + imports: [ + FormsModule, + NzButtonComponent, + NzColDirective, + NzFormControlComponent, + NzFormDirective, + NzFormItemComponent, + NzFormLabelComponent, + NzInputDirective, + NzRowDirective, + ReactiveFormsModule, + NgForOf, + NzOptionComponent, + NzSelectComponent, + NzModalModule, + NgIf, + NzUploadComponent, + NzIconDirective, + NzImageModule, + NgStyle, + NzTableComponent, + NzTdAddOnComponent, + NzTableModule, + DictionaryPipe, + DatePipe, + NzImageDirective, + NzTreeSelectComponent, + NzDividerComponent, + NzPopconfirmDirective, + GoodsStatusPipe, + NzDropDownADirective, + NzDropDownDirective, + NzDropdownMenuComponent, + NzMenuDirective, + NzMenuItemComponent, + NzInputNumberComponent, + NzInputNumberGroupWhitSuffixOrPrefixDirective, + NzSpaceItemDirective, + NzInputNumberGroupComponent, + NzDatePickerComponent, + NzTypographyComponent, + PlatformCodePipe + ], + templateUrl: './cms.component.html', + styleUrl: './cms.component.less' +}) +export class CmsComponent { + // 表单页数 + tablePageNum = 1; + // 表单数据 + tableData: any = { + total: 0, + loading: false, + list: [], + }; + // 搜索表单 + searchForm: FormGroup; + + // 图片 + img: NzUploadFile[] = [] + baseUrl = environment.baseUrl; + imageUrl = environment.imageUrl; + + // 展示图片 + previewImage: string | undefined = ''; + // 上传是否展示 + previewVisible = false; + + // 编辑产品类型表单 + editForm: FormGroup; + // 编辑弹出框 + isVisibleEdit = false; + + protected readonly fallbackImg = fallbackImg; + + constructor(private fb: NonNullableFormBuilder, + private msg: NzMessageService, + private commonService: CommonService, + private cmsService: CmsService) { + // 初始化搜索框 + this.searchForm = this.fb.group({ + code: [''], + name: [''], + platformCode: [''], + }); + + // 初始化 + this.editForm = this.fb.group({ + name: ['' , [Validators.required]], + code: ['' , [Validators.required]], + platformCode: ['' , [Validators.required]], + id: [null], + img: [''], + jumpType: [null], + jumpUrl: [null], + appid: [null], + }); + this.getRequest(); + + } + + // 查询列表 + public getRequest(reset: boolean = false) { + this.tableData.loading = true; + if (reset) { + this.tablePageNum = 1; + } + this.searchForm.value.pageNum = this.tablePageNum; + this.searchForm.value.pageSize = 10; + this.searchForm.value.time = new Date().getTime(); + + this.cmsService.getCms(this.searchForm.value , (data: any) => { + if (data['return_code'] == '000000') { + this.tableData = data['return_data']; + } else { + this.msg.error(data['return_msg']); + } + this.tableData.loading = false; + }); + } + + + // 唤醒编辑表单 + showEdit(item?: any) { + if (item != null) { + item.jumpType = String(item.jumpType); + this.editForm.patchValue(item); + if (!this.commonService.whetherStringIsNull(item.img)) { + this.img = this.commonService.stitchImg(item.img); + } else { + this.img = []; + } + } else { + this.editForm.reset(); + this.img = []; + } + this.isVisibleEdit = true; + } + // 编辑表单提交 + handleEdit(): void { + + if (this.editForm.valid) { + if (this.img.length !== 0) { + this.editForm.value.img = this.commonService.imgList(this.img); + } else { + this.editForm.value.img = null; + } + this.cmsService.editCms(this.editForm.value , (data: any) => { + if (data['return_code'] === '000000') { + this.msg.success("成功!"); + this.isVisibleEdit = false; + this.getRequest(); + } else { + this.msg.error(data['return_msg']); + } + }); + } else { + Object.values(this.editForm.controls).forEach(control => { + if (control.invalid) { + control.markAsDirty(); + control.updateValueAndValidity({ onlySelf: true }); + } + }); + } + + } + + // 上传操作 + handlePreview = async (file: NzUploadFile): Promise => { + if (!file.url && !file['preview']) { + file['preview'] = await getBase64(file.originFileObj!); + } + this.previewImage = file.url || file['preview']; + this.previewVisible = true; + }; + + // 删除 + delete(id: number): void { + this.cmsService.delete(id , (data: any) => { + if (data['return_code'] === '000000') { + this.msg.success("成功!"); + this.getRequest(); + } else { + this.msg.error(data['return_msg']); + } + }); + } + + // 上下线 + cmsUpDown(id: number): void { + let params = { + id: id, + time: new Date().getTime() + } + this.cmsService.cmsUpDown(params, (data: any) => { + if (data['return_code'] === '000000') { + this.msg.success("成功!"); + this.getRequest(); + } else { + this.msg.error(data['return_msg']); + } + }); + } + + +} diff --git a/src/app/pipes/common/platform-code.pipe.ts b/src/app/pipes/common/platform-code.pipe.ts new file mode 100644 index 0000000..7786a18 --- /dev/null +++ b/src/app/pipes/common/platform-code.pipe.ts @@ -0,0 +1,22 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'platformCode', + standalone: true +}) +export class PlatformCodePipe implements PipeTransform { + + transform(value: string): any { + switch (value) { + case "WXAPPLETS": + return '普惠GO'; + case "VFAMILY": + return 'v家园'; + case "GZGOV": + return '省直机关'; + default: + return '未知平台' + } + } + +} diff --git a/src/app/services/cms/cms.service.ts b/src/app/services/cms/cms.service.ts new file mode 100644 index 0000000..6f5dbe0 --- /dev/null +++ b/src/app/services/cms/cms.service.ts @@ -0,0 +1,59 @@ +import { Injectable } from '@angular/core'; +import {HttpClient} from "@angular/common/http"; +import {environment} from "../../../environments/environment"; +import {ObjectData} from "../../utils/objectData.service"; + +@Injectable({ + providedIn: 'root' +}) +export class CmsService { + + constructor(private http: HttpClient) { } + + /** + * 编辑商品类型 + * @param params + * @param callBack + */ + public editCms(params: object, callBack:any) { + this.http.post(environment.baseUrl + 'cms/editCms', params).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询列表 + * @param params + * @param callBack + */ + public getCms(params: object, callBack:any) { + this.http.get(environment.baseUrl + 'cms/getCms?' + ObjectData.objectByString(params)).subscribe(data => { + callBack(data); + }); + } + + /** + * 删除 + * @param id + * @param callBack + */ + public delete(id: number, callBack:any) { + this.http.get(environment.baseUrl + 'cms/delete?id=' + id ).subscribe(data => { + callBack(data); + }); + } + + /** + * 上下架 + * @param params + * @param callBack + */ + public cmsUpDown(params: object, callBack:any) { + this.http.get(environment.baseUrl + 'cms/cmsUpDown?' + ObjectData.objectByString(params)).subscribe(data => { + callBack(data); + }); + } + + + +}