袁野 4 months ago
parent 02adfbf9d5
commit b7cf30bc62
  1. 54
      src/app/pages/account/complaint/complaint.component.html
  2. 12
      src/app/pages/account/complaint/complaint.component.less
  3. 111
      src/app/pages/account/complaint/complaint.component.ts
  4. 3
      src/app/pages/merchant/mer-list/mer-list.component.html
  5. 176
      src/app/pages/system/cms/cms.component.html
  6. 12
      src/app/pages/system/cms/cms.component.less
  7. 255
      src/app/pages/system/cms/cms.component.ts
  8. 22
      src/app/pipes/common/platform-code.pipe.ts
  9. 59
      src/app/services/cms/cms.service.ts

@ -0,0 +1,54 @@
<form nz-form [formGroup]="searchForm" class="search_form" [nzLayout]="'vertical'">
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="6">
<nz-form-item>
<nz-form-label>用户名称</nz-form-label>
<nz-form-control>
<input nzSize="large" nz-input formControlName="name" placeholder="请输入" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="6">
<nz-form-item>
<nz-form-label>用户手机</nz-form-label>
<nz-form-control>
<input nzSize="large" nz-input formControlName="phone" placeholder="请输入" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="6" class="search-area">
<button nz-button [nzType]="'primary'" (click)="getRequest(true)">查询</button>
<button nz-button (click)="searchForm.reset()">重置</button>
</div>
</div>
</form>
<nz-table #basicTable
[nzBordered]="true"
[nzFrontPagination]="false"
[nzShowQuickJumper]="true"
[nzShowTotal]="totalTemplate"
[(nzPageIndex)]="tablePageNum"
(nzPageIndexChange)="getRequest(false)"
[nzTotal]="tableData.total"
[nzData]="tableData.list" >
<thead>
<tr>
<th nzWidth="80px">用户名称</th>
<th nzWidth="100px">用户手机</th>
<th nzWidth="100px">内容</th>
<th nzWidth="50px">创建时间</th>
<th nzWidth="50px">更新时间</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data">
<td>{{data.name}}</td>
<td>{{data.phone}}</td>
<td>{{ data.content}}</td>
<td>{{ data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>{{ data.updateTime | date: 'yyyy-MM-dd HH:mm'}}</td>
</tr>
</tbody>
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template>

@ -0,0 +1,12 @@
[nz-form-label] {
overflow: visible;
}
button {
margin-left: 8px;
}
.submit-btn {
width: 150px;
}
.search-area {
margin-top: 30px;
}

@ -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;
});
}
}

@ -330,8 +330,7 @@
<nz-form-control [nzSm]="14" [nzXs]="24" nzErrorTip="请选择类型!">
<nz-select nzSize="large" nzShowSearch nzAllowClear nzPlaceHolder="请选择" formControlName="productType">
<nz-option nzLabel="电影票" nzValue="3"></nz-option>
<nz-option nzLabel="肯德基" nzValue="4"></nz-option>
<nz-option nzLabel="会员充值" nzValue="5"></nz-option>
<nz-option nzLabel="星巴克" nzValue="4"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>

@ -0,0 +1,176 @@
<form nz-form [formGroup]="searchForm" class="search_form" [nzLayout]="'vertical'">
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="6">
<nz-form-item>
<nz-form-label>cms编码</nz-form-label>
<nz-form-control>
<input nzSize="large" nz-input formControlName="code" placeholder="请输入" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="6">
<nz-form-item>
<nz-form-label>cms标题</nz-form-label>
<nz-form-control>
<input nzSize="large" nz-input formControlName="name" placeholder="请输入" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="6">
<nz-form-item>
<nz-form-label>平台</nz-form-label>
<nz-form-control>
<nz-select nzSize="large" nzShowSearch nzAllowClear nzPlaceHolder="请选择" formControlName="platformCode">
<nz-option nzLabel="普惠GO" nzValue="WXAPPLETS"></nz-option>
<nz-option nzLabel="v家园" nzValue="VFAMILY"></nz-option>
<nz-option nzLabel="省直机关" nzValue="GZGOV"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="6" class="search-area">
<button nz-button [nzType]="'primary'" (click)="getRequest(true)">查询</button>
<button nz-button (click)="searchForm.reset()">重置</button>
<button nz-button [nzType]="'primary'" (click)="showEdit()">创建</button>
</div>
</div>
</form>
<nz-table #basicTable
[nzBordered]="true"
[nzFrontPagination]="false"
[nzShowQuickJumper]="true"
[nzShowTotal]="totalTemplate"
[(nzPageIndex)]="tablePageNum"
(nzPageIndexChange)="getRequest(false)"
[nzTotal]="tableData.total"
[nzData]="tableData.list" >
<thead>
<tr>
<th nzWidth="80px">名称</th>
<th nzWidth="100px">平台</th>
<th nzWidth="100px">图片</th>
<th nzWidth="100px">编码</th>
<th nzWidth="50px">创建时间</th>
<th nzWidth="50px">更新时间</th>
<th nzWidth="50px">状态</th>
<th nzWidth="70px">操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data">
<td>{{data.name}}</td>
<td>{{data.platformCode | platformCode}}</td>
<td>
<img nz-image width="60px" height="60px" nzSrc="{{imageUrl + data.img }}" [nzFallback]="fallbackImg" alt="" />
</td>
<td>{{ data.code}}</td>
<td>{{ data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>{{ data.updateTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>{{ data.status == 1 ? '展示中' : '编辑中'}}</td>
<td>
<a (click)="showEdit(data)">修改</a>
<nz-divider nzType="vertical"></nz-divider>
<a nz-dropdown [nzDropdownMenu]="menu">
更多
<span nz-icon nzType="down"></span>
</a>
<nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu nzSelectable>
<li *ngIf="data.status != 3" nz-menu-item>
<a nz-popconfirm nzPopconfirmTitle="是否确认{{ data.status == 1 ? '下架':'发布'}}?" (nzOnConfirm)="cmsUpDown(data.id)">{{ data.status == 1 ? '下架':'发布'}}</a>
</li>
<li *ngIf="data.status == 2" nz-menu-item nzDanger>
<a nz-popconfirm nzPopconfirmTitle="是否确认删除?" (nzOnConfirm)="delete(data.id)">删除</a>
</li>
</ul>
</nz-dropdown-menu>
</td>
</tr>
</tbody>
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template>
<!--添加弹出框-->
<nz-modal [(nzVisible)]="isVisibleEdit" [nzMaskClosable] = false nzTitle="编辑类目" (nzOnCancel)="isVisibleEdit = false" (nzOnOk)="handleEdit()">
<ng-container *nzModalContent>
<form nz-form [formGroup]="editForm">
<nz-form-item >
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>标题</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24" nzErrorTip="请输入标题!">
<input nzSize="large" nz-input formControlName="name" placeholder="请输入" />
</nz-form-control>
</nz-form-item>
<nz-form-item >
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>CMS编码</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24" nzErrorTip="请输入CMS编码">
<input nzSize="large" nz-input formControlName="code" placeholder="请输入" />
</nz-form-control>
</nz-form-item>
<nz-form-item >
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>平台</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24" nzErrorTip="请选择平台">
<nz-select nzSize="large" nzShowSearch nzAllowClear nzPlaceHolder="请选择" formControlName="platformCode">
<nz-option nzLabel="普惠GO" nzValue="WXAPPLETS"></nz-option>
<nz-option nzLabel="v家园" nzValue="VFAMILY"></nz-option>
<nz-option nzLabel="省直机关" nzValue="GZGOV"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" >跳转类型</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24" >
<nz-select nzSize="large" nzShowSearch nzAllowClear nzPlaceHolder="请选择" formControlName="jumpType">
<nz-option nzLabel="小程序" nzValue="1"></nz-option>
<nz-option nzLabel="H5" nzValue="2"></nz-option>
<nz-option nzLabel="内部跳转" nzValue="3"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item >
<nz-form-label [nzSm]="6" [nzXs]="24" >跳转地址</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24">
<input nzSize="large" nz-input formControlName="jumpUrl" placeholder="请输入" />
</nz-form-control>
</nz-form-item>
<nz-form-item *ngIf="editForm.value['jumpType'] == 1">
<nz-form-label [nzSm]="6" [nzXs]="24">应用ID</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24">
<input nzSize="large" nz-input formControlName="appid" placeholder="请输入" />
</nz-form-control>
</nz-form-item>
<nz-form-item >
<nz-form-label [nzSm]="6" [nzXs]="24" >上传图片</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24">
<nz-upload
nzAction="{{baseUrl}}fileUpload/fileUpload"
nzListType="picture-card"
[(nzFileList)]="img"
[nzShowButton]="img.length < 1"
[nzPreview]="handlePreview"
nzAccept="image/*"
>
<div>
<span nz-icon nzType="plus"></span>
<div style="margin-top: 8px">上传图片</div>
</div>
</nz-upload>
<nz-modal
[nzVisible]="previewVisible"
[nzContent]="modalContent"
[nzFooter]="null"
(nzOnCancel)="previewVisible = false"
>
<ng-template #modalContent>
<img [src]="previewImage" [ngStyle]="{ width: '100%' }" alt=""/>
</ng-template>
</nz-modal>
</nz-form-control>
</nz-form-item>
</form>
</ng-container>
</nz-modal>

@ -0,0 +1,12 @@
[nz-form-label] {
overflow: visible;
}
button {
margin-left: 8px;
}
.submit-btn {
width: 150px;
}
.search-area {
margin-top: 30px;
}

@ -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<string | ArrayBuffer | null> =>
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<void> => {
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']);
}
});
}
}

@ -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 '未知平台'
}
}
}

@ -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);
});
}
}
Loading…
Cancel
Save