parent
2b02d84f72
commit
6bc3b4a6cc
@ -1,4 +0,0 @@ |
||||
{ |
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846 |
||||
"recommendations": ["angular.ng-template"] |
||||
} |
@ -1,20 +0,0 @@ |
||||
{ |
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 |
||||
"version": "0.2.0", |
||||
"configurations": [ |
||||
{ |
||||
"name": "ng serve", |
||||
"type": "chrome", |
||||
"request": "launch", |
||||
"preLaunchTask": "npm: start", |
||||
"url": "http://localhost:4200/" |
||||
}, |
||||
{ |
||||
"name": "ng test", |
||||
"type": "chrome", |
||||
"request": "launch", |
||||
"preLaunchTask": "npm: test", |
||||
"url": "http://localhost:9876/debug.html" |
||||
} |
||||
] |
||||
} |
@ -1,42 +0,0 @@ |
||||
{ |
||||
// For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558 |
||||
"version": "2.0.0", |
||||
"tasks": [ |
||||
{ |
||||
"type": "npm", |
||||
"script": "start", |
||||
"isBackground": true, |
||||
"problemMatcher": { |
||||
"owner": "typescript", |
||||
"pattern": "$tsc", |
||||
"background": { |
||||
"activeOnStart": true, |
||||
"beginsPattern": { |
||||
"regexp": "(.*?)" |
||||
}, |
||||
"endsPattern": { |
||||
"regexp": "bundle generation complete" |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
{ |
||||
"type": "npm", |
||||
"script": "test", |
||||
"isBackground": true, |
||||
"problemMatcher": { |
||||
"owner": "typescript", |
||||
"pattern": "$tsc", |
||||
"background": { |
||||
"activeOnStart": true, |
||||
"beginsPattern": { |
||||
"regexp": "(.*?)" |
||||
}, |
||||
"endsPattern": { |
||||
"regexp": "bundle generation complete" |
||||
} |
||||
} |
||||
} |
||||
} |
||||
] |
||||
} |
@ -1,13 +0,0 @@ |
||||
|
||||
export const fallbackImg = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMIAAADDCAYAAADQvc6UAAABRWlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGASSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8LAwSDCIMogwMCcmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsis7PPOq3QdDFcvjV3jOD1boQVTPQrgSkktTgbSf4A4LbmgqISBgTEFyFYuLykAsTuAbJEioKOA7DkgdjqEvQHEToKwj4DVhAQ5A9k3gGyB5IxEoBmML4BsnSQk8XQkNtReEOBxcfXxUQg1Mjc0dyHgXNJBSWpFCYh2zi+oLMpMzyhRcASGUqqCZ16yno6CkYGRAQMDKMwhqj/fAIcloxgHQqxAjIHBEugw5sUIsSQpBobtQPdLciLEVJYzMPBHMDBsayhILEqEO4DxG0txmrERhM29nYGBddr//5/DGRjYNRkY/l7////39v///y4Dmn+LgeHANwDrkl1AuO+pmgAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAwqADAAQAAAABAAAAwwAAAAD9b/HnAAAHlklEQVR4Ae3dP3PTWBSGcbGzM6GCKqlIBRV0dHRJFarQ0eUT8LH4BnRU0NHR0UEFVdIlFRV7TzRksomPY8uykTk/zewQfKw/9znv4yvJynLv4uLiV2dBoDiBf4qP3/ARuCRABEFAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghgg0Aj8i0JO4OzsrPv69Wv+hi2qPHr0qNvf39+iI97soRIh4f3z58/u7du3SXX7Xt7Z2enevHmzfQe+oSN2apSAPj09TSrb+XKI/f379+08+A0cNRE2ANkupk+ACNPvkSPcAAEibACyXUyfABGm3yNHuAECRNgAZLuYPgEirKlHu7u7XdyytGwHAd8jjNyng4OD7vnz51dbPT8/7z58+NB9+/bt6jU/TI+AGWHEnrx48eJ/EsSmHzx40L18+fLyzxF3ZVMjEyDCiEDjMYZZS5wiPXnyZFbJaxMhQIQRGzHvWR7XCyOCXsOmiDAi1HmPMMQjDpbpEiDCiL358eNHurW/5SnWdIBbXiDCiA38/Pnzrce2YyZ4//59F3ePLNMl4PbpiL2J0L979+7yDtHDhw8vtzzvdGnEXdvUigSIsCLAWavHp/+qM0BcXMd/q25n1vF57TYBp0a3mUzilePj4+7k5KSLb6gt6ydAhPUzXnoPR0dHl79WGTNCfBnn1uvSCJdegQhLI1vvCk+fPu2ePXt2tZOYEV6/fn31dz+shwAR1sP1cqvLntbEN9MxA9xcYjsxS1jWR4AIa2Ibzx0tc44fYX/16lV6NDFLXH+YL32jwiACRBiEbf5KcXoTIsQSpzXx4N28Ja4BQoK7rgXiydbHjx/P25TaQAJEGAguWy0+2Q8PD6/Ki4R8EVl+bzBOnZY95fq9rj9zAkTI2SxdidBHqG9+skdw43borCXO/ZcJdraPWdv22uIEiLA4q7nvvCug8WTqzQveOH26fodo7g6uFe/a17W3+nFBAkRYENRdb1vkkz1CH9cPsVy/jrhr27PqMYvENYNlHAIesRiBYwRy0V+8iXP8+/fvX11Mr7L7ECueb/r48eMqm7FuI2BGWDEG8cm+7G3NEOfmdcTQw4h9/55lhm7DekRYKQPZF2ArbXTAyu4kDYB2YxUzwg0gi/41ztHnfQG26HbGel/crVrm7tNY+/1btkOEAZ2M05r4FB7r9GbAIdxaZYrHdOsgJ/wCEQY0J74TmOKnbxxT9n3FgGGWWsVdowHtjt9Nnvf7yQM2aZU/TIAIAxrw6dOnAWtZZcoEnBpNuTuObWMEiLAx1HY0ZQJEmHJ3HNvGCBBhY6jtaMoEiJB0Z29vL6ls58vxPcO8/zfrdo5qvKO+d3Fx8Wu8zf1dW4p/cPzLly/dtv9Ts/EbcvGAHhHyfBIhZ6NSiIBTo0LNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiECRCjUbEPNCRAhZ6NSiAARCjXbUHMCRMjZqBQiQIRCzTbUnAARcjYqhQgQoVCzDTUnQIScjUohAkQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiEC/wGgKKC4YMA4TAAAAABJRU5ErkJggg=='; |
||||
|
||||
export const orderGoodsStatus = [ |
||||
{name: "待发货" , key: 1} , |
||||
{name: "已发货" , key: 2}, |
||||
{name: "配送中" , key: 3}, |
||||
{name: "已送达" , key: 4}, |
||||
{name: "已取消" , key: 5}, |
||||
{name: "退货中" , key: 6}, |
||||
{name: "已退货" , key: 7}, |
||||
{name: "待支付" , key: 8} |
||||
]; |
@ -1,10 +1,8 @@ |
||||
import { Routes } from '@angular/router'; |
||||
import {SysAccountComponent} from "./sys-account/sys-account.component"; |
||||
import {SysRoleComponent} from "./sys-role/sys-role.component"; |
||||
import {UserComponent} from "./user/user.component"; |
||||
|
||||
export const ACCOUNT_ROUTES: Routes = [ |
||||
{ path: 'sys_account', component: SysAccountComponent}, |
||||
{ path: 'sys_role', component: SysRoleComponent}, |
||||
{ path: 'user_list', component: UserComponent}, |
||||
]; |
||||
|
@ -1,81 +0,0 @@ |
||||
<form nz-form [formGroup]="searchForm" [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"> |
||||
<nz-form-item> |
||||
<nz-form-label>状态</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select nzSize="large" formControlName="status" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of userStatusArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></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)="searchFormSubmit()">查询</button> |
||||
<button nz-button (click)="searchFormReset()">重置</button> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
|
||||
<nz-table #basicTable |
||||
[nzBordered]="true" |
||||
[nzFrontPagination]="false" |
||||
[nzShowQuickJumper]="true" |
||||
[nzShowTotal]="totalTemplate" |
||||
[(nzPageIndex)]="tablePageNum" |
||||
(nzPageIndexChange)="queryData()" |
||||
[nzTotal]="tableData.total" |
||||
[nzData]="tableData.list" > |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="80px">用户名</th> |
||||
<th nzWidth="80px">手机号</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.phone}}</td> |
||||
<td>{{data.integral}}</td> |
||||
<td>{{data.status | dictionary: 'USER_STATUS'}}</td> |
||||
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||
<td> |
||||
<a *ngIf="data.status == 1" (click)="showDisable(data.id)">禁用账户</a> |
||||
<a *ngIf="data.status == 2" (click)="showRestore(data.id)">恢复账户</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 nz-menu-item ></li> |
||||
</ul> |
||||
</nz-dropdown-menu>--> |
||||
</td> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
</nz-table> |
@ -1,6 +0,0 @@ |
||||
.search-area { |
||||
margin-top: 30px; |
||||
} |
||||
button { |
||||
margin-left: 8px; |
||||
} |
@ -1,173 +0,0 @@ |
||||
import { Component } from '@angular/core'; |
||||
import {FormGroup, NonNullableFormBuilder, ReactiveFormsModule} from "@angular/forms"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||
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 {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||
import { |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzTheadComponent, |
||||
NzThMeasureDirective, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||
import {UserService} from "../../../services/account/user.service"; |
||||
|
||||
@Component({ |
||||
selector: 'app-user', |
||||
standalone: true, |
||||
imports: [ |
||||
DatePipe, |
||||
NgForOf, |
||||
NzButtonComponent, |
||||
NzColDirective, |
||||
NzDividerComponent, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzInputDirective, |
||||
NzRowDirective, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzThMeasureDirective, |
||||
NzTheadComponent, |
||||
NzTrDirective, |
||||
ReactiveFormsModule, |
||||
DictionaryPipe, |
||||
NzSelectComponent, |
||||
NzOptionComponent, |
||||
NzModalModule, |
||||
NgIf, |
||||
NzDropDownADirective, |
||||
NzDropDownDirective, |
||||
NzDropdownMenuComponent, |
||||
NzIconDirective, |
||||
NzMenuDirective, |
||||
NzMenuItemComponent, |
||||
], |
||||
templateUrl: './user.component.html', |
||||
styleUrl: './user.component.less' |
||||
}) |
||||
export class UserComponent { |
||||
// 表单页数
|
||||
tablePageNum = 1; |
||||
// 表单数据
|
||||
tableData: any = { |
||||
total: 0, |
||||
list: [], |
||||
}; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
|
||||
// 用户状态
|
||||
userStatusArray = new DictionaryPipe().getDictionaryList("USER_STATUS"); |
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private userService: UserService, |
||||
private message: NzMessageService, |
||||
private modal: NzModalService) { |
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
name: [''], |
||||
phone: [''], |
||||
status: [''], |
||||
}); |
||||
|
||||
|
||||
this.queryData(); |
||||
} |
||||
|
||||
queryData() { |
||||
this.searchForm.value.pageNum = this.tablePageNum; |
||||
this.searchForm.value.pageSize = 10; |
||||
this.searchForm.value.time = new Date().getTime(); |
||||
this.userService.queryUserList(this.searchForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.tableData = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单提交 |
||||
*/ |
||||
searchFormSubmit(): void { |
||||
this.tablePageNum = 1; |
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单重置 |
||||
*/ |
||||
searchFormReset(): void { |
||||
this.searchForm.reset(); |
||||
} |
||||
|
||||
/** |
||||
* 打开恢复账户确认框 |
||||
*/ |
||||
showRestore(dataId: number) { |
||||
this.modal.confirm({ |
||||
nzTitle: '提示', |
||||
nzContent: '确定恢复账户状态?', |
||||
nzOnOk: () => this.restore(dataId) |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 恢复 |
||||
*/ |
||||
restore(dataId: number) { |
||||
const param = { |
||||
userId: dataId |
||||
} |
||||
this.userService.restore(param, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
// 刷新数据
|
||||
this.queryData(); |
||||
this.message.success("操作成功"); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 打开禁用账户确认框 |
||||
*/ |
||||
showDisable(dataId: number) { |
||||
this.modal.confirm({ |
||||
nzTitle: '提示', |
||||
nzContent: '确定禁用账户吗?禁用后无法登录、交易!', |
||||
nzOnOk: () => this.disable(dataId) |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 禁用 |
||||
*/ |
||||
disable(dataId: number) { |
||||
const param = { |
||||
userId: dataId |
||||
} |
||||
this.userService.disable(param, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
// 刷新数据
|
||||
this.queryData(); |
||||
this.message.success("操作成功"); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
} |
@ -1,192 +0,0 @@ |
||||
<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="submitObjectName" 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="submitOpName" 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="status"> |
||||
<nz-option nzLabel="驳回" nzValue="0"></nz-option> |
||||
<nz-option nzLabel="1通过" nzValue="1"></nz-option> |
||||
<nz-option nzLabel="待审批" nzValue="2"></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> |
||||
</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>审核对象</th> |
||||
<th>提交人名称</th> |
||||
<th>审核流水号</th> |
||||
<th>创建时间</th> |
||||
<th>更新时间</th> |
||||
<th>状态</th> |
||||
<th>操作</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td>{{data.submitObjectName}}</td> |
||||
<td>{{data.submitOpName}}</td> |
||||
<td>{{data.auditSerialNo}}</td> |
||||
<td>{{ data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||
<td>{{ data.updateTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||
<td>{{data.status | auditStatus}}</td> |
||||
<td> |
||||
<a (click)="showDetail(data.id)">详情</a> |
||||
<nz-divider *ngIf="data.status == 2" nzType="vertical"></nz-divider> |
||||
<a *ngIf="data.status == 2" nz-dropdown [nzDropdownMenu]="menu"> |
||||
更多 |
||||
<span nz-icon nzType="down"></span> |
||||
</a> |
||||
<nz-dropdown-menu #menu="nzDropdownMenu"> |
||||
<ul nz-menu nzSelectable> |
||||
<li nz-menu-item> |
||||
<a (click)="passOrOverrule(data.id , 1)">通过</a> |
||||
</li> |
||||
<li nz-menu-item nzDanger> |
||||
<a (click)="passOrOverrule(data.id , 0)">驳回</a> |
||||
</li> |
||||
|
||||
</ul> |
||||
</nz-dropdown-menu> |
||||
</td> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
|
||||
<!--添加弹出框--> |
||||
<nz-modal [nzWidth]="1400" [(nzVisible)]="isVisibleDetail" nzTitle="查看详情" (nzOnCancel)="isVisibleDetail = false"> |
||||
<ng-container *nzModalContent> |
||||
<nz-descriptions nzTitle="产品详情" nzBordered> |
||||
<nz-descriptions-item nzTitle="审核流水号">{{ auditDetail.auditSerialNo }}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="提交人">{{ auditDetail.submitOpName }}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="审核人">{{ auditDetail.auditOpName }}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="产品名称">{{ auditDetail.submitObjectName }}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="分类">{{ auditDetail['goodsModel'].goodsTypeName + "/" + auditDetail['goodsModel'].goodsTypeParentName}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="品牌">{{ auditDetail['goodsModel'].goodsBrandName }}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="商品类型">{{ auditDetail['goodsModel'].type == 1 ? '实物商品' : '虚拟商品' }}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="商品说明" [nzSpan]="2">{{ auditDetail['goodsModel'].goodsExplain}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="创建时间">{{ auditDetail.createTime | date: 'yyyy-MM-dd HH:mm' }}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="商品标签" [nzSpan]="2">{{ auditDetail['goodsModel'].goodsLabel}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="更新时间">{{ auditDetail.updateTime | date: 'yyyy-MM-dd HH:mm' }}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="审批批注" [nzSpan]="2">{{ auditDetail.remarks}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="状态" [nzSpan]="3"> |
||||
<nz-badge *ngIf="auditDetail.status == 0" nzStatus="error" nzText="{{auditDetail.status | auditStatus}}"></nz-badge> |
||||
<nz-badge *ngIf="auditDetail.status == 1" nzStatus="success" nzText="{{auditDetail.status | auditStatus}}"></nz-badge> |
||||
<nz-badge *ngIf="auditDetail.status == 2" nzStatus="processing" nzText="{{auditDetail.status | auditStatus}}"></nz-badge> |
||||
</nz-descriptions-item> |
||||
<nz-descriptions-item [nzSpan]="3" nzTitle="列表图"> |
||||
<nz-image-group> |
||||
<img nz-image width="80px" *ngFor="let item of auditDetail['goodsModel']['listImg'].split(',') " [nzFallback]="fallbackImg" nzSrc="{{imageUrl + item}}" alt="" /> |
||||
</nz-image-group> |
||||
</nz-descriptions-item> |
||||
<nz-descriptions-item [nzSpan]="3" nzTitle="轮播图"> |
||||
<nz-image-group> |
||||
<img nz-image width="80px" style="margin-left: 10px" *ngFor="let item of auditDetail['goodsModel']['bannerImg'].split(',') " [nzFallback]="fallbackImg" nzSrc="{{imageUrl + item}}" alt="" /> |
||||
</nz-image-group> |
||||
</nz-descriptions-item> |
||||
<nz-descriptions-item [nzSpan]="3" nzTitle="详情图"> |
||||
<nz-image-group> |
||||
<img nz-image width="80px" style="margin-left: 10px" *ngFor="let item of auditDetail['goodsModel']['detailImg'].split(',') " [nzFallback]="fallbackImg" nzSrc="{{imageUrl + item}}" alt="" /> |
||||
</nz-image-group> |
||||
</nz-descriptions-item> |
||||
</nz-descriptions> |
||||
<h2>规格列表</h2> |
||||
<nz-table [nzScroll]="{ x: '1980px' }" [nzBordered]="true" #basicTable [nzData]="auditDetail['goodsModel']['goodsModelSpecs']"> |
||||
<thead> |
||||
<tr> |
||||
<th nzLeft rowspan="2">规格名称</th> |
||||
<th colspan="2">价格(RMB)</th> |
||||
<th rowspan="2">图片</th> |
||||
<!-- <th rowspan="2">限购(个)</th>--> |
||||
<th rowspan="2">库存(个)</th> |
||||
<th colspan="2">时间</th> |
||||
<th colspan="7" *ngIf="auditDetail['goodsModel']?.type == 2">虚拟产品</th> |
||||
</tr> |
||||
<tr> |
||||
<th rowspan="1">售价</th> |
||||
<th rowspan="1">原价</th> |
||||
<th rowspan="1">销售截止时间</th> |
||||
<th rowspan="1">创建时间</th> |
||||
<th *ngIf="auditDetail['goodsModel']?.type == 2" rowspan="1">卡密</th> |
||||
<th *ngIf="auditDetail['goodsModel']?.type == 2" rowspan="1">归库天数</th> |
||||
<th *ngIf="auditDetail['goodsModel']?.type == 2" rowspan="1">类型</th> |
||||
<th *ngIf="auditDetail['goodsModel']?.type == 2" rowspan="1">产品来源</th> |
||||
<th *ngIf="auditDetail['goodsModel']?.type == 2" rowspan="1">跳转类型</th> |
||||
<th *ngIf="auditDetail['goodsModel']?.type == 2" rowspan="1">跳转地址</th> |
||||
<th *ngIf="auditDetail['goodsModel']?.type == 2" rowspan="1">应用ID</th> |
||||
</tr> |
||||
|
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td nzLeft>{{data.name}}</td> |
||||
<td> |
||||
<span style="font-size: 24px;" nz-typography nzType="danger">¥{{data.salePrice}}</span> |
||||
</td> |
||||
<td> |
||||
<span nz-typography nzType="secondary">¥{{data.originalPrice}}</span> |
||||
</td> |
||||
<td> |
||||
<img nz-image width="60px" height="60px" nzSrc="{{imageUrl + data.showImg }}" [nzFallback]="fallbackImg" alt="" /> |
||||
</td> |
||||
<!-- <td>{{data.purLimit}}</td>--> |
||||
<td>{{data.stock}}</td> |
||||
<td>{{ data.salesEndTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||
<td>{{ data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||
<td *ngIf="auditDetail['goodsModel']?.type == 2">{{data.key}}</td> |
||||
<td *ngIf="auditDetail['goodsModel']?.type == 2">{{data.validDay}}</td> |
||||
<td *ngIf="auditDetail['goodsModel']?.type == 2">{{data.type == 1 ? '内部虚拟商品' : '外部虚拟产品'}}</td> |
||||
<td *ngIf="auditDetail['goodsModel']?.type == 2">{{data.source | dictionary: 'GOODS_VPD_SOURCE'}}</td> |
||||
<td *ngIf="auditDetail['goodsModel']?.type == 2">{{data.jumpType == 1 ? '小程序' : 'H5'}}</td> |
||||
<td *ngIf="auditDetail['goodsModel']?.type == 2">{{data.jumpUrl}}</td> |
||||
<td *ngIf="auditDetail['goodsModel']?.type == 2">{{data.appid}}</td> |
||||
|
||||
</tr> |
||||
</tbody> |
||||
</nz-table> |
||||
</ng-container> |
||||
<div *nzModalFooter> |
||||
<button *ngIf="auditDetail.status == 2" nz-button nzType="default" (click)="passOrOverrule(auditDetail.id , 0)">驳回</button> |
||||
<button *ngIf="auditDetail.status == 2" nz-button nzType="primary" (click)="passOrOverrule(auditDetail.id , 1)">通过</button> |
||||
</div> |
||||
</nz-modal> |
||||
|
||||
<nz-modal [(nzVisible)]="isVisibleAudit" nzTitle="审批" (nzOnCancel)="isVisibleAudit = false" (nzOnOk)="postAuditMsg()"> |
||||
<ng-container *nzModalContent> |
||||
<textarea rows="4" nz-input [(ngModel)]="remarks"></textarea> |
||||
</ng-container> |
||||
</nz-modal> |
@ -1,15 +0,0 @@ |
||||
[nz-form-label] { |
||||
overflow: visible; |
||||
} |
||||
button { |
||||
margin-left: 8px; |
||||
} |
||||
.submit-btn { |
||||
width: 150px; |
||||
} |
||||
.search-area { |
||||
margin-top: 30px; |
||||
} |
||||
nz-select { |
||||
width: 100%; |
||||
} |
@ -1,197 +0,0 @@ |
||||
import { Component } from '@angular/core'; |
||||
import {DatePipe, NgForOf, NgIf} from "@angular/common"; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||
import { |
||||
NzCellFixedDirective, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, NzTheadComponent, |
||||
NzThMeasureDirective, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; |
||||
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, NzImageGroupComponent, NzImageModule} from "ng-zorro-antd/image"; |
||||
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||
import { |
||||
NzInputNumberComponent, |
||||
NzInputNumberGroupComponent, |
||||
NzInputNumberGroupWhitSuffixOrPrefixDirective |
||||
} from "ng-zorro-antd/input-number"; |
||||
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||
import {NzModalComponent, NzModalContentDirective, NzModalFooterDirective, NzModalModule} from "ng-zorro-antd/modal"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {NzPopconfirmDirective} from "ng-zorro-antd/popconfirm"; |
||||
import {NzUploadComponent} from "ng-zorro-antd/upload"; |
||||
import {environment} from "../../../../environments/environment"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {DiscountService} from "../../../services/marketing/discount.service"; |
||||
import { fallbackImg } from '../../../data/goods/goods.namespace'; |
||||
import {AuditService} from "../../../services/audit/audit.service"; |
||||
import {NzTreeSelectComponent} from "ng-zorro-antd/tree-select"; |
||||
import {NzDescriptionsComponent, NzDescriptionsItemComponent} from "ng-zorro-antd/descriptions"; |
||||
import {NzBadgeComponent} from "ng-zorro-antd/badge"; |
||||
import {AuditStatusPipe} from "../../../pipes/audit/audit-status.pipe"; |
||||
import {NzTypographyComponent} from "ng-zorro-antd/typography"; |
||||
|
||||
@Component({ |
||||
selector: 'app-audit-list', |
||||
standalone: true, |
||||
imports: [ |
||||
DatePipe, |
||||
DictionaryPipe, |
||||
FormsModule, |
||||
NgForOf, |
||||
NgIf, |
||||
NzButtonComponent, |
||||
NzCellFixedDirective, |
||||
NzColDirective, |
||||
NzDatePickerComponent, |
||||
NzDividerComponent, |
||||
NzDropDownADirective, |
||||
NzDropDownDirective, |
||||
NzDropdownMenuComponent, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzIconDirective, |
||||
NzImageDirective, |
||||
NzInputDirective, |
||||
NzInputNumberComponent, |
||||
NzInputNumberGroupComponent, |
||||
NzInputNumberGroupWhitSuffixOrPrefixDirective, |
||||
NzMenuDirective, |
||||
NzMenuItemComponent, |
||||
NzModalComponent, |
||||
NzOptionComponent, |
||||
NzPopconfirmDirective, |
||||
NzRowDirective, |
||||
NzModalModule, |
||||
NzImageModule, |
||||
NzSelectComponent, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzThMeasureDirective, |
||||
NzTheadComponent, |
||||
NzTrDirective, |
||||
NzUploadComponent, |
||||
ReactiveFormsModule, |
||||
NzTreeSelectComponent, |
||||
NzDescriptionsItemComponent, |
||||
NzBadgeComponent, |
||||
NzDescriptionsComponent, |
||||
NzModalFooterDirective, |
||||
NzModalContentDirective, |
||||
AuditStatusPipe, |
||||
NzImageGroupComponent, |
||||
NzTypographyComponent |
||||
], |
||||
templateUrl: './audit-list.component.html', |
||||
styleUrl: './audit-list.component.less' |
||||
}) |
||||
export class AuditListComponent { |
||||
// 表单页数
|
||||
tablePageNum = 1; |
||||
// 表单数据
|
||||
tableData: any = { |
||||
total: 0, |
||||
loading: false, |
||||
list: [], |
||||
}; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
auditDetail: any = { |
||||
goodsModel: {} |
||||
}; |
||||
|
||||
baseUrl = environment.baseUrl; |
||||
imageUrl = environment.imageUrl; |
||||
isVisibleDetail = false; |
||||
isVisibleAudit = false; |
||||
postAudit:any; |
||||
remarks: string | undefined; |
||||
|
||||
protected readonly fallbackImg = fallbackImg; |
||||
|
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private msg: NzMessageService, |
||||
private auditService: AuditService, |
||||
private discountService: DiscountService) { |
||||
|
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
submitObjectName: [''], |
||||
submitOpName: [''], |
||||
status: [''], |
||||
}); |
||||
|
||||
this.getRequest(); |
||||
|
||||
|
||||
} |
||||
|
||||
showDetail(id: number): void { |
||||
this.isVisibleDetail = true; |
||||
let params = { |
||||
id: id, |
||||
time: new Date().getTime() |
||||
} |
||||
this.auditService.auditDetail(params , (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.auditDetail = data['return_data']; |
||||
} |
||||
}) |
||||
} |
||||
|
||||
// 查询列表
|
||||
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.auditService.getListGoodsAudit(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; |
||||
}); |
||||
} |
||||
|
||||
passOrOverrule(id: number , auditStatus: number): void { |
||||
this.postAudit = { |
||||
id: id, |
||||
time: new Date().getTime(), |
||||
status: auditStatus |
||||
} |
||||
|
||||
this.isVisibleAudit = true; |
||||
|
||||
} |
||||
|
||||
postAuditMsg(): void { |
||||
this.postAudit.remarks = this.remarks; |
||||
this.auditService.auditMsg(this.postAudit , (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.getRequest(true); |
||||
this.msg.success("操作成功") |
||||
} else { |
||||
this.msg.error(data['return_msg']); |
||||
} |
||||
this.isVisibleAudit = false; |
||||
}); |
||||
} |
||||
|
||||
} |
@ -1,12 +0,0 @@ |
||||
import { NgModule } from '@angular/core'; |
||||
import { CommonModule } from '@angular/common'; |
||||
|
||||
|
||||
|
||||
@NgModule({ |
||||
declarations: [], |
||||
imports: [ |
||||
CommonModule |
||||
] |
||||
}) |
||||
export class AuditModule { } |
@ -1,6 +0,0 @@ |
||||
import { Routes } from '@angular/router'; |
||||
import {AuditListComponent} from "./audit-list/audit-list.component"; |
||||
|
||||
export const AUDIT_ROUTES: Routes = [ |
||||
{ path: 'audit-goods-list', component: AuditListComponent}, |
||||
]; |
@ -1,98 +0,0 @@ |
||||
<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="title" 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> |
||||
<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="50px">创建时间</th> |
||||
<th nzWidth="50px">更新时间</th> |
||||
<th nzWidth="70px">操作</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td>{{data.title}}</td> |
||||
<td> |
||||
<img nz-image width="60px" height="60px" nzSrc="{{imageUrl + data.imgUrl }}" [nzFallback]="fallbackImg" alt="" /> |
||||
</td> |
||||
<td>{{ data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||
<td>{{ data.updateTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||
<td> |
||||
<a (click)="showEdit(data)">修改</a> |
||||
<nz-divider nzType="vertical"></nz-divider> |
||||
<a nz-popconfirm nzPopconfirmTitle="是否确认删除?" (nzOnConfirm)="delete(data.id)">删除</a> |
||||
</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="title" 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)]="imgUrl" |
||||
[nzShowButton]="imgUrl.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> |
@ -1,12 +0,0 @@ |
||||
[nz-form-label] { |
||||
overflow: visible; |
||||
} |
||||
button { |
||||
margin-left: 8px; |
||||
} |
||||
.submit-btn { |
||||
width: 150px; |
||||
} |
||||
.search-area { |
||||
margin-top: 30px; |
||||
} |
@ -1,206 +0,0 @@ |
||||
import { Component } from '@angular/core'; |
||||
import {DatePipe, NgForOf, NgOptimizedImage, NgStyle} from "@angular/common"; |
||||
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 {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {FormGroup, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {NzModalComponent, NzModalContentDirective, NzModalModule} from "ng-zorro-antd/modal"; |
||||
import {GoodsService} from "../../../services/goods/goods.service"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzTreeSelectComponent} from "ng-zorro-antd/tree-select"; |
||||
import {NzUploadComponent, NzUploadFile} from "ng-zorro-antd/upload"; |
||||
import {environment} from "../../../../environments/environment"; |
||||
import {GoodsTypeData} from "../../../model/goods.interface"; |
||||
import {CommonService} from "../../../services/common/common.service"; |
||||
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||
import { |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzTheadComponent, |
||||
NzThMeasureDirective, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
import {NzPopconfirmDirective} from "ng-zorro-antd/popconfirm"; |
||||
import {fallbackImg} from "../../../data/goods/goods.namespace"; |
||||
import {NzImageModule} from "ng-zorro-antd/image"; |
||||
|
||||
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-goods-brand', |
||||
standalone: true, |
||||
imports: [ |
||||
NgForOf, |
||||
NzButtonComponent, |
||||
NzColDirective, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzInputDirective, |
||||
NzOptionComponent, |
||||
NzRowDirective, |
||||
NzModalModule, |
||||
NzSelectComponent, |
||||
ReactiveFormsModule, |
||||
NzIconDirective, |
||||
NzModalComponent, |
||||
NzTreeSelectComponent, |
||||
NzUploadComponent, |
||||
NzModalContentDirective, |
||||
NgStyle, |
||||
DatePipe, |
||||
NzDividerComponent, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzThMeasureDirective, |
||||
NzTheadComponent, |
||||
NzTrDirective, |
||||
NzPopconfirmDirective, |
||||
NzImageModule, |
||||
NgOptimizedImage |
||||
], |
||||
templateUrl: './goods-brand.component.html', |
||||
styleUrl: './goods-brand.component.less' |
||||
}) |
||||
export class GoodsBrandComponent { |
||||
// 表单页数
|
||||
tablePageNum = 1; |
||||
// 表单数据
|
||||
tableData: any = { |
||||
total: 0, |
||||
loading: false, |
||||
list: [], |
||||
}; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
|
||||
// 图片
|
||||
imgUrl: 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 goodsService: GoodsService) { |
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
title: [''], |
||||
}); |
||||
|
||||
// 初始化
|
||||
this.editForm = this.fb.group({ |
||||
title: ['' , [Validators.required]], |
||||
id: [null], |
||||
imgUrl: [''], |
||||
}); |
||||
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.goodsService.getListBrand(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?: GoodsTypeData) { |
||||
if (item != null) { |
||||
item.businessType = String(item.businessType); |
||||
this.editForm.patchValue(item); |
||||
if (!this.commonService.whetherStringIsNull(item.imgUrl)) { |
||||
this.imgUrl = this.commonService.stitchImg(item.imgUrl); |
||||
} |
||||
} else { |
||||
this.editForm.reset(); |
||||
} |
||||
this.isVisibleEdit = true; |
||||
} |
||||
// 编辑表单提交
|
||||
handleEdit(): void { |
||||
|
||||
if (this.editForm.valid) { |
||||
if (this.imgUrl.length !== 0) { |
||||
this.editForm.value.imgUrl = this.commonService.imgList(this.imgUrl); |
||||
} |
||||
this.goodsService.editGoodsBrand(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.goodsService.deleteBrand(id , (data: any) => { |
||||
if (data['return_code'] === '000000') { |
||||
this.msg.success("成功!"); |
||||
this.getRequest(); |
||||
} else { |
||||
this.msg.error(data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
} |
@ -1,464 +0,0 @@ |
||||
<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="title" 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-tree-select |
||||
nzPlaceHolder="请选择" |
||||
formControlName="goodsType" |
||||
[nzNodes]="nodes" |
||||
nzShowSearch |
||||
></nz-tree-select> |
||||
</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="goodsBrand"> |
||||
<nz-option *ngFor="let item of nodesBrand" nzLabel="{{item['title']}}" nzValue="{{item['id']}}"></nz-option> |
||||
</nz-select> |
||||
</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="type"> |
||||
<nz-option nzLabel="实物商品" nzValue="1"></nz-option> |
||||
<nz-option nzLabel="虚拟商品商品" nzValue="2"></nz-option> |
||||
</nz-select> |
||||
</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="status"> |
||||
<nz-option nzLabel="上线中" nzValue="1"></nz-option> |
||||
<nz-option nzLabel="编辑中" nzValue="2"></nz-option> |
||||
<nz-option nzLabel="审核中" nzValue="3"></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="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.title}}</td> |
||||
<td> |
||||
<img nz-image width="60px" height="60px" nzSrc="{{imageUrl + data.listImg }}" [nzFallback]="fallbackImg" alt="" /> |
||||
</td> |
||||
<td>{{data.type == 1 ? '实物商品' : '虚拟商品'}}</td> |
||||
<td>{{data.goodsTypeName}}</td> |
||||
<td>{{data.goodsBrandName}}</td> |
||||
<td>{{ data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||
<td>{{ data.updateTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||
<td>{{data.status | goodsStatus}}</td> |
||||
<td> |
||||
<a *ngIf="data.status == 2" (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 nz-menu-item><a (click)="showSpecsList(data)">规格列表</a></li> |
||||
<li *ngIf="data.status != 3" nz-menu-item> |
||||
<a nz-popconfirm nzPopconfirmTitle="是否确认{{ data.status == 1 ? '下线':'上线'}}?" (nzOnConfirm)="goodsAudit(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="title" 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-tree-select |
||||
nzPlaceHolder="请选择" |
||||
formControlName="goodsType" |
||||
[nzNodes]="nodes" |
||||
nzShowSearch |
||||
></nz-tree-select> |
||||
</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"> |
||||
<nz-select nzSize="large" nzShowSearch nzAllowClear nzPlaceHolder="请选择" formControlName="type"> |
||||
<nz-option nzLabel="实物商品" nzValue="1"></nz-option> |
||||
<nz-option nzLabel="虚拟商品商品" nzValue="2"></nz-option> |
||||
</nz-select> |
||||
</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"> |
||||
<nz-select nzSize="large" nzShowSearch nzAllowClear nzPlaceHolder="请选择" formControlName="goodsBrand"> |
||||
<nz-option *ngFor="let item of nodesBrand" nzLabel="{{item['title']}}" nzValue="{{item['id']}}"></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" nzErrorTip="请输入商品标签!"> |
||||
<input nzSize="large" nz-input formControlName="goodsLabel" 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" nzErrorTip="请输入商品说明!"> |
||||
<input nzSize="large" nz-input formControlName="goodsExplain" 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"> |
||||
<nz-upload |
||||
nzAction="{{baseUrl}}fileUpload/fileUpload" |
||||
nzListType="picture-card" |
||||
[(nzFileList)]="listImg" |
||||
[nzShowButton]="listImg.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> |
||||
<nz-form-item > |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>轮播图片</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-upload |
||||
nzAction="{{baseUrl}}fileUpload/fileUpload" |
||||
nzListType="picture-card" |
||||
[(nzFileList)]="bannerImg" |
||||
[nzShowButton]="bannerImg.length < 20" |
||||
[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> |
||||
<nz-form-item > |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>详情图片</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<nz-upload |
||||
nzAction="{{baseUrl}}fileUpload/fileUpload" |
||||
nzListType="picture-card" |
||||
[(nzFileList)]="detailImg" |
||||
[nzShowButton]="detailImg.length < 20" |
||||
[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> |
||||
|
||||
<nz-modal [nzWidth]="1400" [(nzVisible)]="isVisibleSpecs" nzTitle="{{goodsMsg?.title}}-规格列表" [nzFooter]="null" (nzOnCancel)="isVisibleSpecs= false"> |
||||
<!--列表--> |
||||
<ng-container *nzModalContent> |
||||
<button *ngIf="goodsMsg?.status == 2" nz-button (click)="showEditSpecs()" nzType="primary">创建</button> |
||||
<button nz-button [nzType]="'default'" (click)="getSpecsList()">查询</button> |
||||
<br /> |
||||
<br /> |
||||
<nz-table [nzScroll]="{ x: '1980px' }" [nzBordered]="true" #basicTable [nzData]="nodesSpecs"> |
||||
<thead> |
||||
<tr> |
||||
<th nzLeft rowspan="2">规格名称</th> |
||||
<th colspan="2">价格(RMB)</th> |
||||
<th rowspan="2">图片</th> |
||||
<!-- <th rowspan="2">限购(个)</th>--> |
||||
<th rowspan="2">库存(个)</th> |
||||
<th colspan="2">时间</th> |
||||
<th colspan="7" *ngIf="goodsMsg?.type == 2">虚拟产品</th> |
||||
<th *ngIf="goodsMsg?.status == 2" rowspan="2" nzRight>操作</th> |
||||
</tr> |
||||
<tr> |
||||
<th rowspan="1">售价</th> |
||||
<th rowspan="1">原价</th> |
||||
<th rowspan="1">销售截止时间</th> |
||||
<th rowspan="1">创建时间</th> |
||||
<th *ngIf="goodsMsg?.type == 2" rowspan="1">卡密</th> |
||||
<th *ngIf="goodsMsg?.type == 2" rowspan="1">归库天数</th> |
||||
<th *ngIf="goodsMsg?.type == 2" rowspan="1">类型</th> |
||||
<th *ngIf="goodsMsg?.type == 2" rowspan="1">产品来源</th> |
||||
<th *ngIf="goodsMsg?.type == 2" rowspan="1">跳转类型</th> |
||||
<th *ngIf="goodsMsg?.type == 2" rowspan="1">跳转地址</th> |
||||
<th *ngIf="goodsMsg?.type == 2" rowspan="1">应用ID</th> |
||||
</tr> |
||||
|
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td nzLeft>{{data.name}}</td> |
||||
<td> |
||||
<span style="font-size: 24px;" nz-typography nzType="danger">¥{{data.salePrice}}</span> |
||||
</td> |
||||
<td> |
||||
<span nz-typography nzType="secondary">¥{{data.originalPrice}}</span> |
||||
</td> |
||||
<td> |
||||
<img nz-image width="60px" height="60px" nzSrc="{{imageUrl + data.showImg }}" [nzFallback]="fallbackImg" alt="" /> |
||||
</td> |
||||
<!-- <td>{{data.purLimit}}</td>--> |
||||
<td>{{data.stock}}</td> |
||||
<td>{{ data.salesEndTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||
<td>{{ data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||
<td *ngIf="goodsMsg?.type == 2">{{data.key}}</td> |
||||
<td *ngIf="goodsMsg?.type == 2">{{data.validDay}}</td> |
||||
<td *ngIf="goodsMsg?.type == 2">{{data.type == 1 ? '内部虚拟商品' : '外部虚拟产品'}}</td> |
||||
<td *ngIf="goodsMsg?.type == 2">{{data.source | dictionary: 'GOODS_VPD_SOURCE'}}</td> |
||||
<td *ngIf="goodsMsg?.type == 2">{{data.jumpType == 1 ? '小程序' : 'H5'}}</td> |
||||
<td *ngIf="goodsMsg?.type == 2">{{data.jumpUrl}}</td> |
||||
<td *ngIf="goodsMsg?.type == 2">{{data.appid}}</td> |
||||
|
||||
<td *ngIf="goodsMsg?.status == 2" nzRight> |
||||
<a (click)="showEditSpecs(data)">修改</a> |
||||
<nz-divider nzType="vertical"></nz-divider> |
||||
<a nz-popconfirm nzPopconfirmTitle="是否确认删除?" (nzOnConfirm)="deleteGoodsSpecs(data.specsId)">删除</a> |
||||
</td> |
||||
</tr> |
||||
</tbody> |
||||
</nz-table> |
||||
</ng-container> |
||||
</nz-modal> |
||||
|
||||
<!--添加弹出框--> |
||||
<nz-modal [(nzVisible)]="editSpecs" [nzMaskClosable] = false nzTitle="编辑规格" (nzOnCancel)="editSpecs = false" (nzOnOk)="handleEditSpecs()"> |
||||
<ng-container *nzModalContent> |
||||
<form nz-form [formGroup]="editSpecsForm"> |
||||
<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>限购数量</nz-form-label>--> |
||||
<!-- <nz-form-control [nzSm]="14" [nzXs]="24" nzErrorTip="请输入限购数量!">--> |
||||
<!-- <nz-input-number style="width: 100%" formControlName="purLimit" [nzSize]="'large'" [nzMin]="1" [nzMax]="99999" [nzStep]="1" ></nz-input-number>--> |
||||
<!-- </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-input-number-group nzPrefix="¥" nzSuffix="RMB" style="width: 100%"> |
||||
<nz-input-number formControlName="salePrice" [nzPrecision]="2"></nz-input-number> |
||||
</nz-input-number-group> |
||||
</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-input-number-group nzPrefix="¥" nzSuffix="RMB" style="width: 100%"> |
||||
<nz-input-number formControlName="originalPrice" [nzPrecision]="2" ></nz-input-number> |
||||
</nz-input-number-group> |
||||
</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-input-number style="width: 100%" formControlName="stock" [nzSize]="'large'" [nzMin]="1" [nzMax]="99999" [nzStep]="1" ></nz-input-number> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
<nz-form-item *ngIf="goodsMsg?.type == 2"> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>有效天数</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24" nzErrorTip="请输入有效天数!"> |
||||
<nz-input-number style="width: 100%" formControlName="validDay" [nzSize]="'large'" [nzMin]="1" [nzMax]="99999" [nzStep]="1" ></nz-input-number> |
||||
</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-date-picker |
||||
nzSize="large" |
||||
nzShowTime |
||||
nzFormat="yyyy-MM-dd HH:mm:ss" |
||||
formControlName="salesEndTime" |
||||
nzPlaceHolder="请选择售卖最终时间" |
||||
></nz-date-picker> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
<nz-form-item *ngIf="goodsMsg?.type == 2"> |
||||
<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 formControlName="source" nzPlaceHolder="请选择"> |
||||
<nz-option *ngFor="let item of nodesVpdSource" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
<nz-form-item *ngIf="goodsMsg?.type == 2"> |
||||
<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="type" (ngModelChange)="typeChange($event)"> |
||||
<nz-option nzLabel="内部虚拟商品" nzValue="1"></nz-option> |
||||
<nz-option nzLabel="外部虚拟产品" nzValue="2"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
<nz-form-item *ngIf="editSpecsForm.value.type == 2"> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24">卡密</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nzSize="large" nz-input formControlName="key" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
<nz-form-item *ngIf="editSpecsForm.value.type == 2"> |
||||
<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="jumpType" (ngModelChange)="jumpTypeChange($event)"> |
||||
<nz-option nzLabel="小程序" nzValue="1"></nz-option> |
||||
<nz-option nzLabel="H5" nzValue="2"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
<nz-form-item *ngIf="editSpecsForm.value.type == 2"> |
||||
<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="editSpecsForm.value['jumpType'] == 1"> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>应用ID</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24" nzErrorTip="请输入应用ID!"> |
||||
<input nzSize="large" nz-input formControlName="appid" 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"> |
||||
<nz-upload |
||||
nzAction="{{baseUrl}}fileUpload/fileUpload" |
||||
nzListType="picture-card" |
||||
[(nzFileList)]="showImg" |
||||
[nzShowButton]="showImg.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> |
@ -1,12 +0,0 @@ |
||||
[nz-form-label] { |
||||
overflow: visible; |
||||
} |
||||
button { |
||||
margin-left: 8px; |
||||
} |
||||
.submit-btn { |
||||
width: 150px; |
||||
} |
||||
.search-area { |
||||
margin-top: 30px; |
||||
} |
@ -1,470 +0,0 @@ |
||||
import { Component } from '@angular/core'; |
||||
import {DatePipe, NgForOf, NgIf, NgStyle} from "@angular/common"; |
||||
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 {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||
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 {GoodsService} from "../../../services/goods/goods.service"; |
||||
import { fallbackImg } from '../../../data/goods/goods.namespace'; |
||||
import {GoodsMsgData, GoodsTypeData, SpecsData} from "../../../model/goods.interface"; |
||||
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzImageDirective, NzImageModule} from "ng-zorro-antd/image"; |
||||
import {NzModalModule} from "ng-zorro-antd/modal"; |
||||
import {NzPopconfirmDirective} from "ng-zorro-antd/popconfirm"; |
||||
import { |
||||
NzTableComponent, NzTableModule, |
||||
NzTdAddOnComponent, |
||||
} from "ng-zorro-antd/table"; |
||||
import {NzTreeSelectComponent} from "ng-zorro-antd/tree-select"; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import {GoodsStatusPipe} from "../../../pipes/goods/goods-status.pipe"; |
||||
import {NzConfigService} from "ng-zorro-antd/core/config"; |
||||
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"; |
||||
|
||||
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-goods-list', |
||||
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 |
||||
], |
||||
templateUrl: './goods-list.component.html', |
||||
styleUrl: './goods-list.component.less' |
||||
}) |
||||
export class GoodsListComponent { |
||||
// 表单页数
|
||||
tablePageNum = 1; |
||||
// 表单数据
|
||||
tableData: any = { |
||||
total: 0, |
||||
loading: false, |
||||
list: [], |
||||
}; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
|
||||
// 图片
|
||||
listImg: NzUploadFile[] = [] |
||||
bannerImg: NzUploadFile[] = [] |
||||
detailImg: NzUploadFile[] = [] |
||||
showImg: NzUploadFile[] = [] |
||||
baseUrl = environment.baseUrl; |
||||
imageUrl = environment.imageUrl; |
||||
|
||||
// 展示图片
|
||||
previewImage: string | undefined = ''; |
||||
// 上传是否展示
|
||||
previewVisible = false; |
||||
|
||||
// 编辑产品类型表单
|
||||
editForm: FormGroup; |
||||
editSpecsForm: FormGroup; |
||||
// 编辑弹出框
|
||||
isVisibleEdit = false; |
||||
// 编辑商品规格弹出框
|
||||
isVisibleSpecs = false; |
||||
editSpecs = false; |
||||
loadingSpecs = false; |
||||
// 商品类型数据
|
||||
nodes = []; |
||||
nodesBrand = []; |
||||
nodesSpecs:SpecsData[] = []; |
||||
nodesVpdSource; |
||||
goodsMsg?: GoodsMsgData; |
||||
|
||||
|
||||
protected readonly fallbackImg = fallbackImg; |
||||
|
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private msg: NzMessageService, |
||||
|
||||
private commonService: CommonService, |
||||
private goodsService: GoodsService) { |
||||
|
||||
this.nodesVpdSource = new DictionaryPipe().getDictionaryList('GOODS_VPD_SOURCE'); |
||||
|
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
title: [''], |
||||
goodsType: [''], |
||||
goodsBrand: [''], |
||||
type: [''], |
||||
status: [''], |
||||
}); |
||||
|
||||
// 初始化
|
||||
this.editForm = this.fb.group({ |
||||
title: ['' , [Validators.required]], |
||||
goodsType: ['' , [Validators.required]], |
||||
type: ['' , [Validators.required]], |
||||
goodsBrand: ['' , [Validators.required]], |
||||
id: [null], |
||||
goodsLabel: [''], |
||||
goodsExplain: [''], |
||||
}); |
||||
// 初始化
|
||||
this.editSpecsForm = this.fb.group({ |
||||
name: ['' , [Validators.required]], |
||||
// purLimit: ['' , [Validators.required]],
|
||||
salePrice: ['' , [Validators.required]], |
||||
originalPrice: ['' , [Validators.required]], |
||||
stock: ['' , [Validators.required]], |
||||
validDay: ['' , [Validators.required]], |
||||
salesEndTime: ['' , [Validators.required]], |
||||
type: [''], |
||||
source: [''], |
||||
id: [null], |
||||
specsId: [null], |
||||
jumpType: [null], |
||||
jumpUrl: [null], |
||||
goodsId: [null], |
||||
appid: [null], |
||||
key: [''], |
||||
}); |
||||
this.getRequest(); |
||||
this.getGoodsTypeNode(); |
||||
this.getGoodsBrandNode(); |
||||
|
||||
} |
||||
|
||||
// 查询列表
|
||||
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.goodsService.getListGoods(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.goodsBrand = String(item.goodsBrand); |
||||
item.type = String(item.type); |
||||
this.editForm.patchValue(item); |
||||
if (!this.commonService.whetherStringIsNull(item.listImg)) { |
||||
this.listImg = this.commonService.stitchImg(item.listImg); |
||||
} |
||||
if (!this.commonService.whetherStringIsNull(item.bannerImg)) { |
||||
this.bannerImg = this.commonService.stitchImg(item.bannerImg); |
||||
} |
||||
if (!this.commonService.whetherStringIsNull(item.detailImg)) { |
||||
this.detailImg = this.commonService.stitchImg(item.detailImg); |
||||
} |
||||
} else { |
||||
this.editForm.reset() |
||||
this.listImg = []; |
||||
this.bannerImg = []; |
||||
this.detailImg = []; |
||||
} |
||||
this.isVisibleEdit = true; |
||||
} |
||||
// 编辑表单提交
|
||||
handleEdit(): void { |
||||
|
||||
if (this.editForm.valid) { |
||||
|
||||
if (this.listImg.length === 0 || this.bannerImg.length === 0 || this.detailImg.length === 0) { |
||||
this.msg.error('相关图片未上传!'); |
||||
return; |
||||
} |
||||
|
||||
this.editForm.value.listImg = this.commonService.postImg(this.listImg); |
||||
this.editForm.value.bannerImg = this.commonService.postImg(this.bannerImg); |
||||
this.editForm.value.detailImg = this.commonService.postImg(this.detailImg); |
||||
|
||||
this.goodsService.editGoodsMsg(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.goodsService.deleteGoodsMsg(id , (data: any) => { |
||||
if (data['return_code'] === '000000') { |
||||
this.msg.success("成功!"); |
||||
this.getRequest(); |
||||
} else { |
||||
this.msg.error(data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
// 删除
|
||||
deleteGoodsSpecs(id: number): void { |
||||
this.goodsService.deleteGoodsSpecs(id , (data: any) => { |
||||
if (data['return_code'] === '000000') { |
||||
this.msg.success("成功!"); |
||||
this.getSpecsList(); |
||||
} else { |
||||
this.msg.error(data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
// 获取商品分类
|
||||
getGoodsTypeNode() { |
||||
this.goodsService.getList({time: new Date().getTime()}, (data: any) => { |
||||
if (data['return_code'] === '000000') { |
||||
this.getNode(data['return_data']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
// 配置数据
|
||||
getNode(array: any): any { |
||||
array.forEach((item: any) => { |
||||
if (item.children) { |
||||
this.getNode(item.children); |
||||
}else { |
||||
item["isLeaf"] = true; |
||||
} |
||||
item["key"] = item.id; |
||||
|
||||
}); |
||||
this.nodes = array; |
||||
} |
||||
|
||||
// 获取商品品牌
|
||||
getGoodsBrandNode() { |
||||
this.goodsService.getListBrandAll( (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.nodesBrand = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
// 弹出
|
||||
showSpecsList(data: any): void { |
||||
this.goodsMsg = data; |
||||
this.isVisibleSpecs = true; |
||||
|
||||
if (data.type == "1") { |
||||
this.editSpecsForm.controls['type'].clearValidators(); |
||||
this.editSpecsForm.controls['type'].markAsPristine(); |
||||
|
||||
this.editSpecsForm.controls['source'].clearValidators(); |
||||
this.editSpecsForm.controls['source'].markAsPristine(); |
||||
|
||||
this.editSpecsForm.controls['validDay'].clearValidators(); |
||||
this.editSpecsForm.controls['validDay'].markAsPristine(); |
||||
} else { |
||||
this.editSpecsForm.controls['type'].setValidators(Validators.required); |
||||
this.editSpecsForm.controls['type'].markAsDirty(); |
||||
|
||||
this.editSpecsForm.controls['source'].setValidators(Validators.required); |
||||
this.editSpecsForm.controls['source'].markAsDirty(); |
||||
|
||||
this.editSpecsForm.controls['validDay'].setValidators(Validators.required); |
||||
this.editSpecsForm.controls['validDay'].markAsDirty(); |
||||
} |
||||
this.editSpecsForm.controls['type'].updateValueAndValidity(); |
||||
this.editSpecsForm.controls['validDay'].updateValueAndValidity(); |
||||
this.editSpecsForm.controls['source'].updateValueAndValidity(); |
||||
|
||||
this.getSpecsList(); |
||||
} |
||||
|
||||
// 查询规格列表
|
||||
getSpecsList(): void { |
||||
this.loadingSpecs = true; |
||||
let params = { |
||||
id: this.goodsMsg?.id, |
||||
time: new Date().getTime() |
||||
} |
||||
this.goodsService.getGoodsSpecsList(params , (data: any) => { |
||||
this.loadingSpecs = false; |
||||
if (data['return_code'] == '000000') { |
||||
this.nodesSpecs = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
// 添加规格
|
||||
showEditSpecs(item?: any): void { |
||||
|
||||
if (item != null) { |
||||
item.source = String(item.source); |
||||
item.type = String(item.type); |
||||
item.jumpType = String(item.jumpType); |
||||
this.editSpecsForm.patchValue(item); |
||||
if (!this.commonService.whetherStringIsNull(item.showImg)) { |
||||
this.showImg = this.commonService.stitchImg(item.showImg); |
||||
} |
||||
} else { |
||||
this.editSpecsForm.reset() |
||||
} |
||||
this.editSpecs = true; |
||||
} |
||||
|
||||
handleEditSpecs(): void { |
||||
if (this.editSpecsForm.valid) { |
||||
if (this.showImg.length !== 0) { |
||||
this.editSpecsForm.value.showImg = this.commonService.imgList(this.showImg); |
||||
} else { |
||||
this.msg.error("请上传展示图片"); |
||||
return; |
||||
} |
||||
this.editSpecsForm.value.goodsId = this.goodsMsg?.id; |
||||
this.goodsService.editGoodsSpecs(this.editSpecsForm.value , (data: any) => { |
||||
if (data['return_code'] === '000000') { |
||||
this.msg.success("成功!"); |
||||
this.editSpecs = false; |
||||
this.getSpecsList(); |
||||
} else { |
||||
this.msg.error(data['return_msg']); |
||||
} |
||||
}); |
||||
} else { |
||||
Object.values(this.editSpecsForm.controls).forEach(control => { |
||||
if (control.invalid) { |
||||
control.markAsDirty(); |
||||
control.updateValueAndValidity({ onlySelf: true }); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
typeChange(type: string): void { |
||||
if (type == "1") { |
||||
this.editSpecsForm.controls['jumpType'].clearValidators(); |
||||
this.editSpecsForm.controls['jumpType'].markAsPristine(); |
||||
|
||||
|
||||
} else { |
||||
this.editSpecsForm.controls['jumpType'].setValidators(Validators.required); |
||||
this.editSpecsForm.controls['jumpType'].markAsDirty(); |
||||
|
||||
|
||||
} |
||||
this.editSpecsForm.controls['jumpType'].updateValueAndValidity(); |
||||
} |
||||
|
||||
jumpTypeChange(type: string): void { |
||||
console.log("type" , type); |
||||
if (type == "2") { |
||||
this.editSpecsForm.controls['appid'].clearValidators(); |
||||
this.editSpecsForm.controls['appid'].markAsPristine(); |
||||
} else { |
||||
this.editSpecsForm.controls['appid'].setValidators(Validators.required); |
||||
this.editSpecsForm.controls['appid'].markAsDirty(); |
||||
} |
||||
this.editSpecsForm.controls['appid'].updateValueAndValidity(); |
||||
} |
||||
|
||||
// 上下线
|
||||
goodsAudit(id: number): void { |
||||
let params = { |
||||
id: id, |
||||
time: new Date().getTime() |
||||
} |
||||
this.goodsService.goodsAudit(params , (data: any) => { |
||||
if (data['return_code'] === '000000') { |
||||
this.msg.success("成功!"); |
||||
this.getRequest(); |
||||
} else { |
||||
this.msg.error(data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
|
||||
|
||||
} |
@ -1,111 +0,0 @@ |
||||
<button nz-button (click)="showEditGoodsType()" nzType="primary">创建</button> |
||||
<button nz-button [nzType]="'default'" (click)="getRequest()">查询</button> |
||||
<br /> |
||||
<br /> |
||||
<!--列表--> |
||||
<nz-table #expandTable [nzData]="listOfMapData" [nzLoading]="loading" [nzTotal]="listOfMapData.length" [nzBordered]="true" nzTableLayout="fixed"> |
||||
<thead> |
||||
<tr> |
||||
<th>标题</th> |
||||
<th>业务类型</th> |
||||
<th>图片</th> |
||||
<th>创建时间</th> |
||||
<th>更新时间</th> |
||||
<th>操作</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<ng-container *ngFor="let data of expandTable.data"> |
||||
<ng-container *ngFor="let item of mapOfExpandedData[data.id]"> |
||||
<tr *ngIf="(item.parent && item.parent.expand) || !item.parent"> |
||||
<td |
||||
|
||||
[nzIndentSize]="item.level! * 20" |
||||
[nzShowExpand]="!!item.children" |
||||
[(nzExpand)]="item.expand" |
||||
(nzExpandChange)="collapse(mapOfExpandedData[data.id], item, $event)" |
||||
> |
||||
{{ item.title }} |
||||
</td> |
||||
<td>{{ item.businessType | dictionary: 'GOODS_TYPE' }}</td> |
||||
<td> |
||||
<img nz-image width="60px" height="60px" nzSrc="{{imageUrl + item.imgUrl }}" [nzFallback]="fallbackImg" alt="" /> |
||||
</td> |
||||
<td>{{ item.createTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||
<td>{{ item.updateTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||
<td> |
||||
<a (click)="showEditGoodsType(item)">编辑</a> |
||||
<nz-divider nzType="vertical"></nz-divider> |
||||
<a nz-popconfirm nzPopconfirmTitle="是否确认删除?" (nzOnConfirm)="delete(item.id)">删除</a> |
||||
</td> |
||||
</tr> |
||||
</ng-container> |
||||
</ng-container> |
||||
</tbody> |
||||
</nz-table> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!--添加弹出框--> |
||||
<nz-modal [(nzVisible)]="isVisibleEdit" [nzMaskClosable] = false nzTitle="编辑类目" (nzOnCancel)="isVisibleEdit = false" (nzOnOk)="handleEdit()"> |
||||
<ng-container *nzModalContent> |
||||
<form nz-form [formGroup]="editGoodSTypeForm"> |
||||
<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="title" 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 formControlName="businessType" nzPlaceHolder="请选择"> |
||||
<nz-option *ngFor="let item of goodsTypeArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></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-tree-select |
||||
nzPlaceHolder="请选择" |
||||
formControlName="parentId" |
||||
[nzNodes]="nodes" |
||||
nzShowSearch |
||||
></nz-tree-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-upload |
||||
nzAction="{{baseUrl}}fileUpload/fileUpload" |
||||
nzListType="picture-card" |
||||
[(nzFileList)]="imgUrl" |
||||
[nzShowButton]="imgUrl.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> |
@ -1,12 +0,0 @@ |
||||
[nz-form-label] { |
||||
overflow: visible; |
||||
} |
||||
button { |
||||
margin-left: 8px; |
||||
} |
||||
.submit-btn { |
||||
width: 150px; |
||||
} |
||||
.search-area { |
||||
margin-top: 30px; |
||||
} |
@ -1,255 +0,0 @@ |
||||
import { Component } from '@angular/core'; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||
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 {DatePipe, NgForOf, NgIf, NgStyle} from "@angular/common"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {GoodsTypeData} from "../../../model/goods.interface"; |
||||
import {NzModalModule} from "ng-zorro-antd/modal"; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import {NzUploadComponent, NzUploadFile} from "ng-zorro-antd/upload"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {environment} from "../../../../environments/environment"; |
||||
import {CommonService} from "../../../services/common/common.service"; |
||||
import {GoodsService} from "../../../services/goods/goods.service"; |
||||
import {NzTableComponent, NzTableModule, NzTdAddOnComponent} from "ng-zorro-antd/table"; |
||||
import {NzImageDirective , NzImageModule} from "ng-zorro-antd/image"; |
||||
import {fallbackImg} from "../../../data/goods/goods.namespace"; |
||||
import {NzTreeSelectComponent} from "ng-zorro-antd/tree-select"; |
||||
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||
import {it} from "node:test"; |
||||
import {NzPopconfirmDirective} from "ng-zorro-antd/popconfirm"; |
||||
|
||||
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-goods-type', |
||||
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 |
||||
], |
||||
templateUrl: './goods-type.component.html', |
||||
styleUrl: './goods-type.component.less' |
||||
}) |
||||
export class GoodsTypeComponent { |
||||
|
||||
// 编辑产品类型表单
|
||||
editGoodSTypeForm: FormGroup; |
||||
// 列表数据
|
||||
listOfMapData: GoodsTypeData[] = []; |
||||
// 列表展示数据
|
||||
mapOfExpandedData: { [id: string]: GoodsTypeData[] } = {}; |
||||
|
||||
// 编辑弹出框
|
||||
isVisibleEdit = false; |
||||
// 商品類型數據字典
|
||||
goodsTypeArray; |
||||
// 上传等待
|
||||
loading = false; |
||||
// 图片
|
||||
imgUrl: NzUploadFile[] = [] |
||||
baseUrl = environment.baseUrl; |
||||
imageUrl = environment.imageUrl; |
||||
|
||||
// 展示图片
|
||||
previewImage: string | undefined = ''; |
||||
// 上传是否展示
|
||||
previewVisible = false; |
||||
nodes = []; |
||||
|
||||
constructor( |
||||
private fb: NonNullableFormBuilder, |
||||
private commonService: CommonService, |
||||
private goodsType: GoodsService, |
||||
private msg: NzMessageService |
||||
) { |
||||
|
||||
this.getRequest(); |
||||
// 菜单类型
|
||||
this.goodsTypeArray = new DictionaryPipe().getDictionaryList('GOODS_TYPE'); |
||||
// 初始化
|
||||
this.editGoodSTypeForm = this.fb.group({ |
||||
title: ['' , [Validators.required]], |
||||
parentId: [''], |
||||
id: [null], |
||||
businessType: ['' ,[Validators.required]], |
||||
imgUrl: [''], |
||||
}); |
||||
|
||||
} |
||||
|
||||
getNode(array: any): any { |
||||
array.forEach((item: any) => { |
||||
if (item.children) { |
||||
this.getNode(item.children); |
||||
}else { |
||||
item["isLeaf"] = true; |
||||
} |
||||
item["key"] = item.id; |
||||
|
||||
}); |
||||
this.nodes = array; |
||||
} |
||||
|
||||
// 关闭
|
||||
collapse(array: GoodsTypeData[], data: GoodsTypeData, $event: boolean): void { |
||||
if (!$event) { |
||||
if (data.children) { |
||||
data.children.forEach(d => { |
||||
const target = array.find(a => a.id === d.id)!; |
||||
target.expand = false; |
||||
this.collapse(array, target, false); |
||||
}); |
||||
} else { |
||||
return; |
||||
} |
||||
} |
||||
} |
||||
|
||||
// 配置数据
|
||||
convertTreeToList(root: GoodsTypeData): GoodsTypeData[] { |
||||
const stack: GoodsTypeData[] = []; |
||||
const array: GoodsTypeData[] = []; |
||||
const hashMap = {}; |
||||
stack.push({ ...root, level: 0, expand: false }); |
||||
while (stack.length !== 0) { |
||||
const node = stack.pop()!; |
||||
this.visitNode(node, hashMap, array); |
||||
if (node.children) { |
||||
for (let i = node.children.length - 1; i >= 0; i--) { |
||||
stack.push({ ...node.children[i], level: node.level! + 1, expand: false, parent: node }); |
||||
} |
||||
} |
||||
} |
||||
return array; |
||||
} |
||||
|
||||
|
||||
|
||||
// 插入数据
|
||||
visitNode(node: GoodsTypeData, hashMap: { [key: string]: boolean }, array: GoodsTypeData[]): void { |
||||
if (!hashMap[node.id]) { |
||||
hashMap[node.id] = true; |
||||
array.push(node); |
||||
} |
||||
} |
||||
|
||||
|
||||
// 搜索表单提交
|
||||
getRequest(): void { |
||||
this.loading = true; |
||||
this.goodsType.getList({time: new Date().getTime()}, (data: any) => { |
||||
if (data['return_code'] === '000000') { |
||||
this.listOfMapData = data['return_data']; |
||||
this.getNode(this.listOfMapData); |
||||
this.listOfMapData.forEach(item => { |
||||
this.mapOfExpandedData[item.id] = this.convertTreeToList(item); |
||||
}); |
||||
} else { |
||||
this.msg.error(data['return_msg']); |
||||
} |
||||
this.loading = false; |
||||
}); |
||||
} |
||||
|
||||
// 唤醒编辑表单
|
||||
showEditGoodsType(item?: GoodsTypeData): void { |
||||
if (item != null) { |
||||
item.businessType = String(item.businessType); |
||||
this.editGoodSTypeForm.patchValue(item); |
||||
if (!this.commonService.whetherStringIsNull(item.imgUrl)) { |
||||
this.imgUrl = this.commonService.stitchImg(item.imgUrl); |
||||
} |
||||
} else { |
||||
this.editGoodSTypeForm.reset(); |
||||
} |
||||
this.isVisibleEdit = true; |
||||
} |
||||
// 编辑表单提交
|
||||
handleEdit(): void { |
||||
if (this.editGoodSTypeForm.valid) { |
||||
if (this.imgUrl.length !== 0) { |
||||
this.editGoodSTypeForm.value.imgUrl = this.commonService.imgList(this.imgUrl); |
||||
} |
||||
this.goodsType.editGoodsType(this.editGoodSTypeForm.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.editGoodSTypeForm.controls).forEach(control => { |
||||
if (control.invalid) { |
||||
control.markAsDirty(); |
||||
control.updateValueAndValidity({ onlySelf: true }); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
} |
||||
|
||||
// 删除
|
||||
delete(id: number): void { |
||||
this.goodsType.delete(id , (data: any) => { |
||||
if (data['return_code'] === '000000') { |
||||
this.msg.success("成功!"); |
||||
this.getRequest(); |
||||
} else { |
||||
this.msg.error(data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
// 上传操作
|
||||
handlePreview = async (file: NzUploadFile): Promise<void> => { |
||||
console.log("数据" , file); |
||||
if (!file.url && !file['preview']) { |
||||
file['preview'] = await getBase64(file.originFileObj!); |
||||
} |
||||
this.previewImage = file.url || file['preview']; |
||||
this.previewVisible = true; |
||||
}; |
||||
|
||||
|
||||
protected readonly fallbackImg = fallbackImg; |
||||
} |
@ -1,12 +0,0 @@ |
||||
import { NgModule } from '@angular/core'; |
||||
import { CommonModule } from '@angular/common'; |
||||
|
||||
|
||||
|
||||
@NgModule({ |
||||
declarations: [], |
||||
imports: [ |
||||
CommonModule |
||||
] |
||||
}) |
||||
export class GoodsModule { } |
@ -1,12 +0,0 @@ |
||||
import { Routes } from '@angular/router'; |
||||
import {GoodsTypeComponent} from "./goods-type/goods-type.component"; |
||||
import {GoodsBrandComponent} from "./goods-brand/goods-brand.component"; |
||||
import {GoodsListComponent} from "./goods-list/goods-list.component"; |
||||
|
||||
|
||||
export const GOODS_ROUTES: Routes = [ |
||||
{ path: 'goods_type', component: GoodsTypeComponent}, |
||||
{ path: 'goods_brand', component: GoodsBrandComponent}, |
||||
{ path: 'goods-list', component: GoodsListComponent}, |
||||
|
||||
]; |
@ -1,64 +0,0 @@ |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
||||
<p>首页</p> |
@ -1,166 +0,0 @@ |
||||
<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="title" 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> |
||||
<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="80px">名称</th> |
||||
<th nzWidth="80px">库存(个)</th> |
||||
<th nzWidth="80px">有效期</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.key}}</td> |
||||
<td>{{data.title}}</td> |
||||
<td>{{data.surplusStock}}</td> |
||||
<td>{{ data.effectiveTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||
<td>{{ data.createdTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||
<td>{{ data.updatedTime | date: 'yyyy-MM-dd HH:mm'}}</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 nz-menu-item><a (click)="getDetailList(data.id)">详情列表</a></li> |
||||
<li nz-menu-item nzDanger> |
||||
<a (click)="giveDiscountPackageShow(data.id)">赠送券包</a> |
||||
</li> |
||||
<li 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="title" 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-date-picker |
||||
nzSize="large" |
||||
nzShowTime |
||||
nzFormat="yyyy-MM-dd HH:mm:ss" |
||||
formControlName="effectiveTime" |
||||
nzPlaceHolder="请选择领取最终时间" |
||||
></nz-date-picker> |
||||
</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-input-number style="width: 100%" formControlName="surplusStock" [nzSize]="'large'" [nzMin]="1" [nzMax]="99999" [nzStep]="1" ></nz-input-number> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</form> |
||||
</ng-container> |
||||
</nz-modal> |
||||
|
||||
<nz-modal [nzWidth]="1200" [(nzVisible)]="isVisibleDetail" nzTitle="绑定优惠券" (nzOnCancel)="isVisibleDetail= false" (nzOnOk)="isVisibleDetail= false" > |
||||
<!--列表--> |
||||
<ng-container *nzModalContent> |
||||
<button nz-button (click)="showEditDetail()" nzType="primary">创建</button> |
||||
<button nz-button [nzType]="'default'" (click)="getDetailList(discountPackageId)">查询</button> |
||||
<br /> |
||||
<br /> |
||||
<nz-table #basicTable [nzData]="discountPackage"> |
||||
<thead> |
||||
<tr> |
||||
<th>优惠券名称</th> |
||||
<th>数量</th> |
||||
<th>创建时间</th> |
||||
<th>操作</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td>{{data.discountName}}</td> |
||||
<td>{{data.num}}</td> |
||||
<td>{{data.createdTime}}</td> |
||||
<td> |
||||
<a nz-popconfirm nzPopconfirmTitle="是否确认删除?" (nzOnConfirm)="deleteDetail(data.id)">删除</a> |
||||
</td> |
||||
</tr> |
||||
</tbody> |
||||
</nz-table> |
||||
</ng-container> |
||||
</nz-modal> |
||||
|
||||
<nz-modal [(nzVisible)]="isVisibleDetailEdit" [nzMaskClosable] = false nzTitle="编辑" (nzOnCancel)="isVisibleDetailEdit = false" (nzOnOk)="handleDetailEdit()"> |
||||
<ng-container *nzModalContent> |
||||
<form nz-form [formGroup]="detailForm"> |
||||
<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 formControlName="discountId" nzPlaceHolder="请选择优惠券"> |
||||
<nz-option *ngFor="let item of discountData" nzValue="{{item.id}}" nzLabel="{{item.name}}"></nz-option> |
||||
</nz-select> |
||||
</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-input-number style="width: 100%" formControlName="num" [nzSize]="'large'" [nzMin]="1" [nzMax]="99999" [nzStep]="1" ></nz-input-number> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</form> |
||||
</ng-container> |
||||
</nz-modal> |
||||
|
||||
<nz-modal [(nzVisible)]="isVisibleGive" [nzMaskClosable] = false nzTitle="编辑" (nzOnCancel)="isVisibleGive = false" (nzOnOk)="giveDiscountPackage()"> |
||||
<ng-container *nzModalContent> |
||||
<form nz-form [formGroup]="giveForm"> |
||||
<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="phone" placeholder="请输入赠送手机号" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</form> |
||||
</ng-container> |
||||
</nz-modal> |
@ -1,12 +0,0 @@ |
||||
[nz-form-label] { |
||||
overflow: visible; |
||||
} |
||||
button { |
||||
margin-left: 8px; |
||||
} |
||||
.submit-btn { |
||||
width: 150px; |
||||
} |
||||
.search-area { |
||||
margin-top: 30px; |
||||
} |
@ -1,308 +0,0 @@ |
||||
import { Component } from '@angular/core'; |
||||
import {DatePipe, NgForOf, NgIf, NgOptimizedImage, NgStyle} from "@angular/common"; |
||||
import {FormGroup,NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzImageModule} from "ng-zorro-antd/image"; |
||||
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||
import {NzModalComponent, NzModalContentDirective, NzModalModule} from "ng-zorro-antd/modal"; |
||||
import {NzPopconfirmDirective} from "ng-zorro-antd/popconfirm"; |
||||
import { |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzTheadComponent, |
||||
NzThMeasureDirective, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
import {NzUploadComponent, NzUploadFile} from "ng-zorro-antd/upload"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {NzTreeSelectComponent} from "ng-zorro-antd/tree-select"; |
||||
import {environment} from "../../../../environments/environment"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {CommonService} from "../../../services/common/common.service"; |
||||
import {GoodsService} from "../../../services/goods/goods.service"; |
||||
import {GoodsTypeData} from "../../../model/goods.interface"; |
||||
import {DiscountService} from "../../../services/marketing/discount.service"; |
||||
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; |
||||
import {NzInputNumberComponent} from "ng-zorro-antd/input-number"; |
||||
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||
import {MyValidators} from "../../../services/common/validators.service"; |
||||
|
||||
@Component({ |
||||
selector: 'app-coupon-discount-list', |
||||
standalone: true, |
||||
imports: [ |
||||
NgForOf, |
||||
NzButtonComponent, |
||||
NzColDirective, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzInputDirective, |
||||
NzOptionComponent, |
||||
NzRowDirective, |
||||
NzModalModule, |
||||
NzSelectComponent, |
||||
ReactiveFormsModule, |
||||
NzIconDirective, |
||||
NzModalComponent, |
||||
NzTreeSelectComponent, |
||||
NzUploadComponent, |
||||
NzModalContentDirective, |
||||
NgStyle, |
||||
DatePipe, |
||||
NzDividerComponent, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzThMeasureDirective, |
||||
NzTheadComponent, |
||||
NzTrDirective, |
||||
NzPopconfirmDirective, |
||||
NzImageModule, |
||||
NgOptimizedImage, |
||||
NzDatePickerComponent, |
||||
NzInputNumberComponent, |
||||
NgIf, |
||||
NzDropDownADirective, |
||||
NzDropDownDirective, |
||||
NzDropdownMenuComponent, |
||||
NzMenuDirective, |
||||
NzMenuItemComponent |
||||
], |
||||
templateUrl: './coupon-discount-list.component.html', |
||||
styleUrl: './coupon-discount-list.component.less' |
||||
}) |
||||
export class CouponDiscountListComponent { |
||||
// 表单页数
|
||||
tablePageNum = 1; |
||||
// 表单数据
|
||||
tableData: any = { |
||||
total: 0, |
||||
loading: false, |
||||
list: [], |
||||
}; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
|
||||
// 图片
|
||||
imgUrl: NzUploadFile[] = [] |
||||
baseUrl = environment.baseUrl; |
||||
imageUrl = environment.imageUrl; |
||||
|
||||
isVisibleDetail = false; |
||||
isVisibleGive = false; |
||||
|
||||
// 编辑产品类型表单
|
||||
editForm: FormGroup; |
||||
detailForm: FormGroup; |
||||
giveForm: FormGroup; |
||||
// 编辑弹出框
|
||||
isVisibleEdit = false; |
||||
isVisibleDetailEdit = false; |
||||
discountPackageId: number = 0; |
||||
discountPackage: any; |
||||
discountData: any; |
||||
|
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private msg: NzMessageService, |
||||
private commonService: CommonService, |
||||
private discountService: DiscountService) { |
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
title: [''], |
||||
}); |
||||
|
||||
let params = { |
||||
status: 1, |
||||
pageNum: 1, |
||||
pageSize: 100000, |
||||
time: new Date().getTime() |
||||
} |
||||
|
||||
this.discountService.getListDiscount(params , (data: any)=>{ |
||||
if (data['return_code'] == '000000') { |
||||
this.discountData = data['return_data'].list; |
||||
} |
||||
}); |
||||
const { required, maxLength, minLength, email, mobile } = MyValidators; |
||||
// 初始化
|
||||
this.editForm = this.fb.group({ |
||||
title: ['' , [Validators.required]], |
||||
surplusStock: ['' , [Validators.required]], |
||||
effectiveTime: ['' , [Validators.required]], |
||||
id: [null], |
||||
}); |
||||
this.detailForm = this.fb.group({ |
||||
discountId: ['' , [Validators.required]], |
||||
num: ['' , [Validators.required]], |
||||
discountPackageId: [''], |
||||
id: [null], |
||||
}); |
||||
this.giveForm = this.fb.group({ |
||||
phone: ['' , [required, mobile]], |
||||
discountPackageId: [''], |
||||
}); |
||||
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.discountService.getDiscountPackageList(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?: GoodsTypeData) { |
||||
if (item != null) { |
||||
this.editForm.patchValue(item); |
||||
} else { |
||||
this.editForm.reset(); |
||||
} |
||||
this.isVisibleEdit = true; |
||||
} |
||||
// 编辑表单提交
|
||||
handleEdit(): void { |
||||
|
||||
if (this.editForm.valid) { |
||||
|
||||
this.discountService.editCouponPackageInfo(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 }); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
} |
||||
|
||||
// 删除
|
||||
delete(id: number): void { |
||||
this.discountService.deleteCouponDiscount(id , (data: any) => { |
||||
if (data['return_code'] === '000000') { |
||||
this.msg.success("成功!"); |
||||
this.getRequest(); |
||||
} else { |
||||
this.msg.error(data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
// 删除券包详情
|
||||
deleteDetail(id: number): void { |
||||
this.discountService.deleteDetail(id , (data: any) => { |
||||
if (data['return_code'] === '000000') { |
||||
this.msg.success("成功!"); |
||||
this.getDetailList(this.discountPackageId); |
||||
} else { |
||||
this.msg.error(data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
// 查询券包详情
|
||||
getDetailList(id: number): void { |
||||
this.discountPackageId = id; |
||||
this.isVisibleDetail = true; |
||||
let params = { |
||||
discountPackageId: id, |
||||
time: new Date().getTime() |
||||
} |
||||
this.discountService.getDetailList(params, (data: any) => { |
||||
if (data['return_code'] === '000000') { |
||||
this.discountPackage = data['return_data']; |
||||
} else { |
||||
this.msg.error(data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
giveDiscountPackageShow(id: number): void { |
||||
this.discountPackageId = id; |
||||
this.isVisibleGive = true; |
||||
} |
||||
|
||||
giveDiscountPackage(): void { |
||||
this.giveForm.value.discountPackageId = this.discountPackageId; |
||||
if (this.giveForm.valid) { |
||||
|
||||
this.discountService.giveDiscountPackage(this.giveForm.value , (data: any) => { |
||||
if (data['return_code'] === '000000') { |
||||
this.msg.success("成功!"); |
||||
this.getRequest(false); |
||||
this.isVisibleGive = false; |
||||
} else { |
||||
this.msg.error(data['return_msg']); |
||||
} |
||||
}); |
||||
} else { |
||||
Object.values(this.giveForm.controls).forEach(control => { |
||||
if (control.invalid) { |
||||
control.markAsDirty(); |
||||
control.updateValueAndValidity({ onlySelf: true }); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
// 创建详情
|
||||
showEditDetail(): void { |
||||
this.detailForm.reset(); |
||||
this.isVisibleDetailEdit = true; |
||||
} |
||||
|
||||
handleDetailEdit(): void { |
||||
this.detailForm.value.discountPackageId = this.discountPackageId; |
||||
if (this.detailForm.valid) { |
||||
|
||||
this.discountService.insertCouponPackageDetail(this.detailForm.value , (data: any) => { |
||||
if (data['return_code'] === '000000') { |
||||
this.msg.success("成功!"); |
||||
this.isVisibleDetailEdit = false; |
||||
this.getDetailList(this.discountPackageId); |
||||
} else { |
||||
this.msg.error(data['return_msg']); |
||||
} |
||||
}); |
||||
} else { |
||||
Object.values(this.detailForm.controls).forEach(control => { |
||||
if (control.invalid) { |
||||
control.markAsDirty(); |
||||
control.updateValueAndValidity({ onlySelf: true }); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
} |
@ -1,241 +0,0 @@ |
||||
<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> |
||||
<nz-select nzSize="large" nzShowSearch nzAllowClear formControlName="type" nzPlaceHolder="请选择"> |
||||
<nz-option *ngFor="let item of discountType" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</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="status"> |
||||
<nz-option nzLabel="编辑中" nzValue="1"></nz-option> |
||||
<nz-option nzLabel="上线中" nzValue="2"></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" |
||||
[nzScroll]="{ x: '1980px' }" |
||||
[nzShowTotal]="totalTemplate" |
||||
[(nzPageIndex)]="tablePageNum" |
||||
(nzPageIndexChange)="getRequest(false)" |
||||
[nzTotal]="tableData.total" |
||||
[nzData]="tableData.list" > |
||||
<thead> |
||||
<tr> |
||||
<th nzLeft nzWidth="80px">优惠券名称</th> |
||||
<th nzWidth="80px">优惠券图片</th> |
||||
<th nzWidth="100px">优惠券类型</th> |
||||
<th nzWidth="160px">优惠内容</th> |
||||
<th nzWidth="70px">有效天数</th> |
||||
<th nzWidth="70px">领取数量(个)</th> |
||||
<th nzWidth="100px">使用截止日期</th> |
||||
<th nzWidth="100px">创建时间</th> |
||||
<th nzWidth="100px">更新时间</th> |
||||
<th nzRight nzWidth="70px">操作</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td nzLeft>{{data.name}}</td> |
||||
<td> |
||||
<img nz-image width="60px" height="60px" nzSrc="{{imageUrl + data.img }}" [nzFallback]="fallbackImg" alt="" /> |
||||
</td> |
||||
<td>{{data.type | dictionary: 'DISCOUNT_TYPE'}}</td> |
||||
<td> |
||||
<span *ngIf="data.type == 1" nzType="danger">满{{data.condition}}直减{{data.price}}</span> |
||||
<span *ngIf="data.type == 2" nzType="danger">直减{{data.price}}</span> |
||||
<span *ngIf="data.type == 3" nzType="danger">优惠{{100 - data.percentage}}%</span> |
||||
</td> |
||||
<td>{{data.effectiveDay}}天</td> |
||||
<td>{{data.effectiveNum}}</td> |
||||
<td>{{ data.salesEndTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||
<td>{{ data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||
<td>{{ data.updateTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||
<td nzRight> |
||||
<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 nz-menu-item><a (click)="showDiscountSpecsList(data)">绑定规格</a></li> |
||||
<li 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>优惠券类型</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24" nzErrorTip="请选择优惠券类型!"> |
||||
<nz-select nzSize="large" nzShowSearch nzAllowClear formControlName="type" nzPlaceHolder="请选择" (ngModelChange)="typeChange($event)"> |
||||
<nz-option *ngFor="let item of discountType" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
<nz-form-item *ngIf="editForm.value.type == 1"> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>满减条件</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24" nzErrorTip="请输入满减条件!"> |
||||
<nz-input-number-group nzPrefix="¥" nzSuffix="RMB" style="width: 100%"> |
||||
<nz-input-number formControlName="condition" [nzPrecision]="2" ></nz-input-number> |
||||
</nz-input-number-group> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
<nz-form-item *ngIf="editForm.value.type == 1 ||editForm.value.type == 2 "> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>优惠金额</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24" nzErrorTip="请输入优惠金额!"> |
||||
<nz-input-number-group nzPrefix="¥" nzSuffix="RMB" style="width: 100%"> |
||||
<nz-input-number formControlName="price" [nzPrecision]="2" ></nz-input-number> |
||||
</nz-input-number-group> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
<nz-form-item *ngIf="editForm.value.type == 3 "> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>优惠折扣</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24" nzErrorTip="请输入优惠折扣!"> |
||||
<nz-input-number-group nzSuffix="%" style="width: 100%"> |
||||
<nz-input-number formControlName="percentage" [nzPrecision]="2" ></nz-input-number> |
||||
</nz-input-number-group> |
||||
</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-input-number style="width: 100%" formControlName="effectiveNum" [nzSize]="'large'" [nzMin]="1" [nzMax]="99999" [nzStep]="1" ></nz-input-number> |
||||
</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-input-number style="width: 100%" formControlName="effectiveDay" [nzSize]="'large'" [nzMin]="1" [nzMax]="99999" [nzStep]="1" ></nz-input-number> |
||||
</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-date-picker |
||||
nzSize="large" |
||||
nzShowTime |
||||
nzFormat="yyyy-MM-dd HH:mm:ss" |
||||
formControlName="salesEndTime" |
||||
nzPlaceHolder="请选择领取最终时间" |
||||
></nz-date-picker> |
||||
</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> |
||||
|
||||
<nz-modal [nzWidth]="1400" [(nzVisible)]="isVisibleSpecsDiscount" nzTitle="{{discount?.name}}-绑定商品列表" [nzFooter]="null" (nzOnCancel)="isVisibleSpecsDiscount= false"> |
||||
<!--列表--> |
||||
<ng-container *nzModalContent> |
||||
<button nz-button (click)="bindDiscountSpecs()" nzType="primary">绑定商品</button> |
||||
<button nz-button [nzType]="'default'" (click)="getSpecsDiscountList()">查询</button> |
||||
<br /> |
||||
<br /> |
||||
<nz-table #basicTable [nzData]="nodesDiscountGoods"> |
||||
<thead> |
||||
<tr> |
||||
<th>商品名称</th> |
||||
<th>规格</th> |
||||
<th>售价(RMB)</th> |
||||
<th>创建时间</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data"> |
||||
<td>{{data.goodsName}}</td> |
||||
<td>{{data.specsName}}</td> |
||||
<td>¥{{data.salePrice}}</td> |
||||
<td>{{ data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||
</tr> |
||||
</tbody> |
||||
</nz-table> |
||||
</ng-container> |
||||
</nz-modal> |
||||
|
||||
<nz-modal [(nzVisible)]="isVisibleBind" nzTitle="绑定商品" (nzOnCancel)="isVisibleBind= false" (nzOnOk)="handleOk()"> |
||||
<!--列表--> |
||||
<ng-container *nzModalContent> |
||||
<nz-select |
||||
nzMode="multiple" |
||||
nzPlaceHolder="请选择绑定商品规格" |
||||
[(ngModel)]="listOfSelectBind" |
||||
> |
||||
<nz-option *ngFor="let item of goodsSpecs" [nzLabel]="item.goodsName + '-【' + item.name + '】-【¥'+item.salePrice + '】'" [nzValue]="item.id"></nz-option> |
||||
</nz-select> |
||||
</ng-container> |
||||
</nz-modal> |
@ -1,15 +0,0 @@ |
||||
[nz-form-label] { |
||||
overflow: visible; |
||||
} |
||||
button { |
||||
margin-left: 8px; |
||||
} |
||||
.submit-btn { |
||||
width: 150px; |
||||
} |
||||
.search-area { |
||||
margin-top: 30px; |
||||
} |
||||
nz-select { |
||||
width: 100%; |
||||
} |
@ -1,334 +0,0 @@ |
||||
import { Component } from '@angular/core'; |
||||
import {DatePipe, NgForOf, NgIf, NgOptimizedImage, NgStyle} from "@angular/common"; |
||||
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 {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {NzModalComponent, NzModalContentDirective, NzModalModule} from "ng-zorro-antd/modal"; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzTreeSelectComponent} from "ng-zorro-antd/tree-select"; |
||||
import {NzUploadComponent, NzUploadFile} from "ng-zorro-antd/upload"; |
||||
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||
import { |
||||
NzCellFixedDirective, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzTheadComponent, |
||||
NzThMeasureDirective, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
import {NzPopconfirmDirective} from "ng-zorro-antd/popconfirm"; |
||||
import {NzImageModule} from "ng-zorro-antd/image"; |
||||
import {environment} from "../../../../environments/environment"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {CommonService} from "../../../services/common/common.service"; |
||||
import { fallbackImg } from '../../../data/goods/goods.namespace'; |
||||
import {DiscountService} from "../../../services/marketing/discount.service"; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import { |
||||
NzInputNumberComponent, |
||||
NzInputNumberGroupComponent, |
||||
NzInputNumberGroupWhitSuffixOrPrefixDirective |
||||
} from "ng-zorro-antd/input-number"; |
||||
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; |
||||
import {NzTypographyComponent} from "ng-zorro-antd/typography"; |
||||
import {DiscountData, NodesDiscountGoods} from "../../../model/discount.interface"; |
||||
import {GoodsService} from "../../../services/goods/goods.service"; |
||||
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||
|
||||
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-discount-list', |
||||
standalone: true, |
||||
imports: [ |
||||
NgForOf, |
||||
NzButtonComponent, |
||||
NzColDirective, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzInputDirective, |
||||
NzOptionComponent, |
||||
NzRowDirective, |
||||
NzModalModule, |
||||
NzSelectComponent, |
||||
ReactiveFormsModule, |
||||
NzIconDirective, |
||||
NzModalComponent, |
||||
NzTreeSelectComponent, |
||||
NzUploadComponent, |
||||
NzModalContentDirective, |
||||
NgStyle, |
||||
DatePipe, |
||||
NzDividerComponent, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzThMeasureDirective, |
||||
NzTheadComponent, |
||||
NzTrDirective, |
||||
NzPopconfirmDirective, |
||||
NzImageModule, |
||||
NgOptimizedImage, |
||||
DictionaryPipe, |
||||
NzCellFixedDirective, |
||||
NgIf, |
||||
NzInputNumberComponent, |
||||
NzInputNumberGroupComponent, |
||||
NzInputNumberGroupWhitSuffixOrPrefixDirective, |
||||
NzDatePickerComponent, |
||||
NzTypographyComponent, |
||||
FormsModule, |
||||
NzDropDownADirective, |
||||
NzDropDownDirective, |
||||
NzDropdownMenuComponent, |
||||
NzMenuDirective, |
||||
NzMenuItemComponent |
||||
], |
||||
templateUrl: './discount-list.component.html', |
||||
styleUrl: './discount-list.component.less' |
||||
}) |
||||
export class DiscountListComponent { |
||||
// 表单页数
|
||||
tablePageNum = 1; |
||||
// 表单数据
|
||||
tableData: any = { |
||||
total: 0, |
||||
loading: false, |
||||
list: [], |
||||
}; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
|
||||
// 图片
|
||||
img: NzUploadFile[] = [] |
||||
baseUrl = environment.baseUrl; |
||||
imageUrl = environment.imageUrl; |
||||
|
||||
// 展示图片
|
||||
previewImage: string | undefined = ''; |
||||
// 上传是否展示
|
||||
previewVisible = false; |
||||
isVisibleSpecsDiscount = false; |
||||
|
||||
// 编辑产品类型表单
|
||||
editForm: FormGroup; |
||||
// 编辑弹出框
|
||||
isVisibleEdit = false; |
||||
isVisibleBind = false; |
||||
discountType; |
||||
discount?: DiscountData; |
||||
nodesDiscountGoods:NodesDiscountGoods[] = []; |
||||
listOfSelectBind: any = [] |
||||
goodsSpecs:any = []; |
||||
protected readonly fallbackImg = fallbackImg; |
||||
|
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private msg: NzMessageService, |
||||
private commonService: CommonService, |
||||
private goodsService: GoodsService, |
||||
private discountService: DiscountService) { |
||||
|
||||
this.discountType = new DictionaryPipe().getDictionaryList('DISCOUNT_TYPE'); |
||||
|
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
name: [''], |
||||
type: [''], |
||||
status: [''], |
||||
}); |
||||
|
||||
// 初始化
|
||||
this.editForm = this.fb.group({ |
||||
name: ['' , [Validators.required]], |
||||
type: ['' , [Validators.required]], |
||||
effectiveNum: ['' , [Validators.required]], |
||||
effectiveDay: ['' , [Validators.required]], |
||||
salesEndTime: ['' , [Validators.required]], |
||||
condition: ['' , [Validators.required]], |
||||
price: ['' , [Validators.required]], |
||||
percentage: ['' , [Validators.required]], |
||||
img: [''], |
||||
id: [null], |
||||
}); |
||||
this.getRequest(); |
||||
this.getGoodsSpecsListAll(); |
||||
|
||||
} |
||||
|
||||
// 查询列表
|
||||
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.discountService.getListDiscount(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.type = String(item.type); |
||||
this.typeChange(item.type) |
||||
this.editForm.patchValue(item); |
||||
if (!this.commonService.whetherStringIsNull(item.img)) { |
||||
this.img = this.commonService.stitchImg(item.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); |
||||
} |
||||
this.discountService.editDiscount(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.discountService.deleteDiscount(id , (data: any) => { |
||||
if (data['return_code'] === '000000') { |
||||
this.msg.success("成功!"); |
||||
this.getRequest(); |
||||
} else { |
||||
this.msg.error(data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
typeChange(type: string): void { |
||||
if (type == "1") { |
||||
this.editForm.controls['percentage'].clearValidators(); |
||||
this.editForm.controls['percentage'].markAsPristine(); |
||||
|
||||
} else if (type == "2") { |
||||
this.editForm.controls['percentage'].clearValidators(); |
||||
this.editForm.controls['percentage'].markAsPristine(); |
||||
|
||||
this.editForm.controls['condition'].clearValidators(); |
||||
this.editForm.controls['condition'].markAsPristine(); |
||||
|
||||
} else if (type == "3") { |
||||
this.editForm.controls['price'].clearValidators(); |
||||
this.editForm.controls['price'].markAsPristine(); |
||||
|
||||
this.editForm.controls['condition'].clearValidators(); |
||||
this.editForm.controls['condition'].markAsPristine(); |
||||
|
||||
} |
||||
this.editForm.controls['percentage'].updateValueAndValidity(); |
||||
this.editForm.controls['condition'].updateValueAndValidity(); |
||||
this.editForm.controls['price'].updateValueAndValidity(); |
||||
|
||||
} |
||||
|
||||
showDiscountSpecsList(item: DiscountData):void { |
||||
this.listOfSelectBind = []; |
||||
this.discount = item; |
||||
this.getSpecsDiscountList(); |
||||
this.isVisibleSpecsDiscount = true; |
||||
} |
||||
|
||||
|
||||
bindDiscountSpecs():void { |
||||
this.isVisibleBind = true; |
||||
} |
||||
|
||||
|
||||
|
||||
// 查询绑定商品列表
|
||||
getSpecsDiscountList(): void { |
||||
let params = { |
||||
discountId: this.discount?.id, |
||||
time: new Date().getTime() |
||||
} |
||||
this.discountService.getListDiscountGoodsRel(params , (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.listOfSelectBind.length = 0; |
||||
this.nodesDiscountGoods = data['return_data']; |
||||
for (const dataKey of this.nodesDiscountGoods) { |
||||
this.listOfSelectBind.push(dataKey['specsId']) |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
// 查询所有商品规格
|
||||
getGoodsSpecsListAll(): void { |
||||
this.goodsService.getGoodsSpecsListAll( (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.goodsSpecs = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
|
||||
handleOk(): void { |
||||
let params = { |
||||
discountId: this.discount?.id, |
||||
specsIds: this.listOfSelectBind.join(",") |
||||
} |
||||
this.discountService.bindDiscountSpecs(params , (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.msg.success("绑定成功"); |
||||
this.getSpecsDiscountList(); |
||||
this.isVisibleBind = false; |
||||
} |
||||
}); |
||||
} |
||||
} |
@ -1,12 +0,0 @@ |
||||
import { NgModule } from '@angular/core'; |
||||
import { CommonModule } from '@angular/common'; |
||||
|
||||
|
||||
|
||||
@NgModule({ |
||||
declarations: [], |
||||
imports: [ |
||||
CommonModule |
||||
] |
||||
}) |
||||
export class MarketingModule { } |
@ -1,11 +0,0 @@ |
||||
import { Routes } from '@angular/router'; |
||||
import {DiscountListComponent} from "./discount-list/discount-list.component"; |
||||
import {CouponDiscountListComponent} from "./coupon-discount-list/coupon-discount-list.component"; |
||||
|
||||
|
||||
|
||||
export const MARKETING_ROUTES: Routes = [ |
||||
{ path: 'discount-list', component: DiscountListComponent}, |
||||
{ path: 'coupon-discount-list', component: CouponDiscountListComponent}, |
||||
|
||||
]; |
@ -1,241 +0,0 @@ |
||||
<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 nz-input formControlName="userPhone" 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 nz-input formControlName="orderNo" 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 formControlName="payType" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of orderPayTypeArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</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 formControlName="tradeStatus" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of orderStatusArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="24"> |
||||
<nz-form-item> |
||||
<nz-form-label>创建时间</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-range-picker formControlName="createTimeArray" nzShowTime [nzFormat]="'yyyy/MM/dd HH:mm:ss'"></nz-range-picker> |
||||
<nz-radio-group nzButtonStyle="solid" formControlName="createTimeSelect" (ngModelChange)="createTimeInit()"> |
||||
<label nz-radio-button *ngFor="let item of dateTypeSelect" nzValue="{{item.value}}">{{item.name}}</label> |
||||
</nz-radio-group> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6" [hidden]="!isCollapse"> |
||||
<nz-form-item> |
||||
<nz-form-label>商品名称</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="goodsName" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6" [hidden]="!isCollapse"> |
||||
<nz-form-item> |
||||
<nz-form-label>卡密订单</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="channelOrderNo" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6" [hidden]="!isCollapse"> |
||||
<nz-form-item> |
||||
<nz-form-label>卡密</nz-form-label> |
||||
<nz-form-control> |
||||
<input nz-input formControlName="couNo" placeholder="请输入" /> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="6" [hidden]="!isCollapse"> |
||||
<nz-form-item> |
||||
<nz-form-label>卡密状态</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-select formControlName="couStatus" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of orderCouponNoStatus" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
|
||||
<div nz-col [nzSpan]="24" class="search-area"> |
||||
<button nz-button [nzType]="'primary'" (click)="searchFormSubmit()">查询</button> |
||||
<button nz-button (click)="searchFormReset()">重置</button> |
||||
<a class="collapse" (click)="isCollapse = !isCollapse"> |
||||
更多查询条件 |
||||
<i nz-icon [nzType]="!isCollapse ? 'down' : 'up'"></i> |
||||
</a> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
|
||||
<nz-table #basicTable |
||||
[nzScroll]="{ x: '3500px' }" |
||||
[nzBordered]="true" |
||||
[nzFrontPagination]="false" |
||||
[nzShowQuickJumper]="true" |
||||
[nzShowTotal]="totalTemplate" |
||||
[(nzPageIndex)]="tablePageNum" |
||||
(nzPageIndexChange)="queryData()" |
||||
[nzTotal]="tableData.total" |
||||
[nzData]="tableData.list" > |
||||
<thead> |
||||
<tr> |
||||
<th rowspan="2" nzWidth="180px">交易单号</th> |
||||
<th rowspan="2" nzWidth="150px">商品订单号</th> |
||||
<th rowspan="2" nzWidth="120px">用户手机号</th> |
||||
<th rowspan="2" nzWidth="120px">商品key</th> |
||||
<th rowspan="2" nzWidth="180px">商品名称</th> |
||||
<th rowspan="2" nzWidth="150px">商品规格</th> |
||||
<th rowspan="2" nzWidth="100px">商品价格</th> |
||||
<th rowspan="2" nzWidth="100px">购买数量</th> |
||||
<th colspan="9">交易信息</th> |
||||
<th rowspan="2">卡密订单</th> |
||||
<th rowspan="2">卡密</th> |
||||
<th rowspan="2">过期时间</th> |
||||
<th rowspan="2">卡密状态</th> |
||||
<th rowspan="2" nzRight>操作</th> |
||||
</tr> |
||||
<tr> |
||||
<th>订单金额</th> |
||||
<th>优惠券优惠</th> |
||||
<th>积分抵扣</th> |
||||
<th>实付金额</th> |
||||
<th>支付渠道</th> |
||||
<th>支付方式</th> |
||||
<th>交易状态</th> |
||||
<th>创建时间</th> |
||||
<th>支付时间</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data;index as i"> |
||||
<td *ngIf="basicTable.data[i-1]?.orderNo != data['orderNo']" rowSpan="{{data.rowSpan}}">{{data.orderNo}}</td> |
||||
<td *ngIf="basicTable.data[i-1]?.orderNo != data['orderNo']" rowSpan="{{data.rowSpan}}">{{data.childOrderNo}}</td> |
||||
<td *ngIf="basicTable.data[i-1]?.orderNo != data['orderNo']" rowSpan="{{data.rowSpan}}">{{data.userPhone}}</td> |
||||
<td *ngIf="basicTable.data[i-1]?.orderNo != data['orderNo']" rowSpan="{{data.rowSpan}}">{{data.goodsKey}}</td> |
||||
<td *ngIf="basicTable.data[i-1]?.orderNo != data['orderNo']" rowSpan="{{data.rowSpan}}">{{data.goodsName}}</td> |
||||
<td *ngIf="basicTable.data[i-1]?.orderNo != data['orderNo']" rowSpan="{{data.rowSpan}}">{{data.goodsSpecsName}}</td> |
||||
<td *ngIf="basicTable.data[i-1]?.orderNo != data['orderNo']" rowSpan="{{data.rowSpan}}">{{data.goodsPrice}}</td> |
||||
<td *ngIf="basicTable.data[i-1]?.orderNo != data['orderNo']" rowSpan="{{data.rowSpan}}">{{data.goodsCount}}</td> |
||||
<td *ngIf="basicTable.data[i-1]?.orderNo != data['orderNo']" rowSpan="{{data.rowSpan}}">{{data.totalPrice}}</td> |
||||
<td *ngIf="basicTable.data[i-1]?.orderNo != data['orderNo']" rowSpan="{{data.rowSpan}}">{{data.couponDiscountPrice}}</td> |
||||
<td *ngIf="basicTable.data[i-1]?.orderNo != data['orderNo']" rowSpan="{{data.rowSpan}}">{{data.integralDiscountPrice}}</td> |
||||
<td *ngIf="basicTable.data[i-1]?.orderNo != data['orderNo']" rowSpan="{{data.rowSpan}}">{{data.payRealPrice}}</td> |
||||
<td *ngIf="basicTable.data[i-1]?.orderNo != data['orderNo']" rowSpan="{{data.rowSpan}}">{{data.payChannel | dictionary: 'ORDER_PAY_CHANNEL'}}</td> |
||||
<td *ngIf="basicTable.data[i-1]?.orderNo != data['orderNo']" rowSpan="{{data.rowSpan}}">{{data.payType | dictionary: 'ORDER_PAY_TYPE'}}</td> |
||||
<td *ngIf="basicTable.data[i-1]?.orderNo != data['orderNo']" rowSpan="{{data.rowSpan}}">{{data.tradeStatus | dictionary: 'ORDER_CHILD_STATUS'}}</td> |
||||
<td *ngIf="basicTable.data[i-1]?.orderNo != data['orderNo']" rowSpan="{{data.rowSpan}}">{{data.createTime | date: 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||
<td *ngIf="basicTable.data[i-1]?.orderNo != data['orderNo']" rowSpan="{{data.rowSpan}}">{{data.payTime | date: 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||
<td nzEllipsis nz-tooltip nzTooltipTitle="{{data.channelOrderNo}}">{{data.channelOrderNo}}</td> |
||||
<td nzEllipsis nz-tooltip nzTooltipTitle="{{data.couNo}}">{{data.couNo}}</td> |
||||
<td>{{data.expireTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||
<td>{{data.couStatus | dictionary: 'ORDER_COUPON_NO_STATUS'}}</td> |
||||
<td nzRight> |
||||
<a (click)="showDetail(data.childOrderNo)">详情</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 nz-menu-item nzDanger >删除</li> |
||||
</ul> |
||||
</nz-dropdown-menu> |
||||
</td> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
</nz-table> |
||||
|
||||
|
||||
<nz-modal [(nzVisible)]="orderDetailVisible" nzWidth="1000px" nzTitle="订单详情" [nzFooter]="null" (nzOnCancel)="closeDetail()" [nzBodyStyle]="{ 'padding': '10px' }"> |
||||
<ng-container *nzModalContent> |
||||
<nz-tabset nzType="card" nzSize="small"> |
||||
<nz-tab nzTitle="交易详情"> |
||||
<nz-descriptions nzBordered [nzColumn]="{ xxl: 2, xl: 2, lg: 2, md: 2, sm: 2, xs: 1 }"> |
||||
<nz-descriptions-item nzTitle="用户手机号">{{orderDetail.order.userPhone}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="交易单号">{{orderDetail.order.orderNo}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="商品订单号">{{orderDetail.order.childOrderNo}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="交易金额">{{orderDetail.order.totalPrice}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="总优惠金额">{{orderDetail.order.totalDeductionPrice}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="优惠券优惠">{{orderDetail.order.couponDiscountPrice}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="积分抵扣">{{orderDetail.order.integralDiscountPrice}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="实付金额">{{orderDetail.order.payRealPrice}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="支付渠道">{{orderDetail.order.payChannel | dictionary: 'ORDER_PAY_CHANNEL'}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="支付方式">{{orderDetail.order.payType | dictionary: 'ORDER_PAY_TYPE'}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="支付流水号">{{orderDetail.order.paySerialNo}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="创建时间">{{orderDetail.order.createTime | date: 'yyyy-MM-dd HH:mm:ss'}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="支付时间" *ngIf="orderDetail.order.payTime != null">{{orderDetail.order.payTime | date: 'yyyy-MM-dd HH:mm:ss'}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="完成时间" *ngIf="orderDetail.order.finishTime != null">{{orderDetail.order.finishTime | date: 'yyyy-MM-dd HH:mm:ss'}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="取消时间" *ngIf="orderDetail.order.cancelTime != null">{{orderDetail.order.cancelTime | date: 'yyyy-MM-dd HH:mm:ss'}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="退款时间" *ngIf="orderDetail.order.refundTime != null">{{orderDetail.order.refundTime | date: 'yyyy-MM-dd HH:mm:ss'}}</nz-descriptions-item> |
||||
</nz-descriptions> |
||||
</nz-tab> |
||||
<nz-tab nzTitle="商品详情"> |
||||
<nz-table #orderDetailTable |
||||
[nzData]="orderDetail.goods" |
||||
[nzTotal]="orderDetail.goods.length" |
||||
[nzScroll]="{ x: '2000px' }" |
||||
[nzPaginationType]="'small'" |
||||
[nzSize]="'small'" |
||||
> |
||||
<thead> |
||||
<tr> |
||||
<th>商品key</th> |
||||
<th>商品名称</th> |
||||
<th>商品规格</th> |
||||
<th>商品面值</th> |
||||
<th>卡密订单号</th> |
||||
<th>卡密</th> |
||||
<th>状态</th> |
||||
<th>过期时间</th> |
||||
<th>派发时间</th> |
||||
<th>完成时间</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of orderDetailTable.data"> |
||||
<td>{{ data.goodsKey }}</td> |
||||
<td>{{ data.goodsName }}</td> |
||||
<td>{{ data.goodsSpecsName }}</td> |
||||
<td>{{ data.goodsPrice }}</td> |
||||
<td nzEllipsis nz-tooltip nzTooltipTitle="{{data.channelOrderNo}}">{{ data.channelOrderNo }}</td> |
||||
<td nzEllipsis nz-tooltip nzTooltipTitle="{{data.couNo}}">{{ data.couNo }}</td> |
||||
<td>{{ data.couStatus | dictionary: 'ORDER_COUPON_NO_STATUS'}}</td> |
||||
<td>{{ data.expireTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||
<td>{{ data.deliverTime | date: 'yyyy-MM-dd HH:mm:ss' }}</td> |
||||
<td>{{ data.finishTime | date: 'yyyy-MM-dd HH:mm:ss' }}</td> |
||||
</tr> |
||||
</tbody> |
||||
</nz-table> |
||||
</nz-tab> |
||||
</nz-tabset> |
||||
|
||||
</ng-container> |
||||
</nz-modal> |
@ -1,6 +0,0 @@ |
||||
.search-area { |
||||
margin-bottom: 10px; |
||||
} |
||||
.search-area button { |
||||
margin-right: 8px; |
||||
} |
@ -1,212 +0,0 @@ |
||||
import { Component } from '@angular/core'; |
||||
import {DatePipe, NgForOf, NgIf, NgSwitch} from "@angular/common"; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule} from "@angular/forms"; |
||||
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||
import { |
||||
NzCellEllipsisDirective, |
||||
NzCellFixedDirective, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, NzTheadComponent, |
||||
NzThMeasureDirective, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
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 {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||
import {NzModalComponent, NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {SysAccountService} from "../../../services/account/sys-account.service"; |
||||
import {RoleService} from "../../../services/role/role.service"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {OrderCouponService} from "../../../services/trade/order-coupon.service"; |
||||
import {NzDatePickerComponent, NzDatePickerModule, NzRangePickerComponent} from "ng-zorro-antd/date-picker"; |
||||
import {NzRadioButtonDirective, NzRadioComponent, NzRadioGroupComponent} from "ng-zorro-antd/radio"; |
||||
import {NzTooltipDirective} from "ng-zorro-antd/tooltip"; |
||||
import {DateSelectType, DateUtils} from "../../../utils/dateUtils.service"; |
||||
import {NzTreeComponent} from "ng-zorro-antd/tree"; |
||||
import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||
import {NzTabComponent, NzTabSetComponent, NzTabsModule} from "ng-zorro-antd/tabs"; |
||||
|
||||
@Component({ |
||||
selector: 'app-comp-order', |
||||
standalone: true, |
||||
imports: [ |
||||
DatePipe, |
||||
DictionaryPipe, |
||||
FormsModule, |
||||
NgForOf, |
||||
NgIf, |
||||
NzButtonComponent, |
||||
NzCellFixedDirective, |
||||
NzColDirective, |
||||
NzDividerComponent, |
||||
NzDropDownADirective, |
||||
NzDropDownDirective, |
||||
NzDropdownMenuComponent, |
||||
NzFlexDirective, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzIconDirective, |
||||
NzInputDirective, |
||||
NzMenuDirective, |
||||
NzMenuItemComponent, |
||||
NzModalComponent, |
||||
NzOptionComponent, |
||||
NzRowDirective, |
||||
NzSelectComponent, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzThMeasureDirective, |
||||
NzTheadComponent, |
||||
NzTrDirective, |
||||
ReactiveFormsModule, |
||||
NzModalModule, |
||||
NzRangePickerComponent, |
||||
NzDatePickerComponent, |
||||
NzDatePickerModule, |
||||
NzRadioButtonDirective, |
||||
NzRadioComponent, |
||||
NzRadioGroupComponent, |
||||
NgSwitch, |
||||
NzCellEllipsisDirective, |
||||
NzTooltipDirective, |
||||
NzTreeComponent, |
||||
NzDescriptionsModule, |
||||
NzTabSetComponent, |
||||
NzTabComponent, |
||||
NzTabsModule |
||||
], |
||||
templateUrl: './comp-order.component.html', |
||||
styleUrl: './comp-order.component.less' |
||||
}) |
||||
export class CompOrderComponent { |
||||
// 表单页数
|
||||
tablePageNum = 1; |
||||
// 表单数据
|
||||
tableData: any = { |
||||
total: 0, |
||||
list: [], |
||||
}; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
// 更多查询条件
|
||||
isCollapse = false; |
||||
// 时间类型选择
|
||||
dateTypeSelect = DateSelectType; |
||||
// 订单支付类型
|
||||
orderPayTypeArray = new DictionaryPipe().getDictionaryList('ORDER_PAY_TYPE'); |
||||
// 订单状态
|
||||
orderStatusArray = new DictionaryPipe().getDictionaryList('ORDER_STATUS'); |
||||
// 卡密使用状态
|
||||
orderCouponNoStatus = new DictionaryPipe().getDictionaryList('ORDER_COUPON_NO_STATUS'); |
||||
// 订单详情模态框
|
||||
orderDetailVisible = false; |
||||
// 订单详情数据
|
||||
orderDetail: any = { |
||||
order: {}, |
||||
goods: [], |
||||
}; |
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private orderService : OrderCouponService, |
||||
private message: NzMessageService, |
||||
private modal: NzModalService) { |
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
userPhone: [''], |
||||
orderNo: [''], |
||||
tradeStatus: [''], |
||||
payType: [''], |
||||
goodsName: [''], |
||||
channelOrderNo: [''], |
||||
couNo: [''], |
||||
couStatus: [''], |
||||
createTimeArray: [[]], |
||||
createTimeSelect: ['1'], |
||||
createTimeS: [''], |
||||
createTimeE: [''], |
||||
}); |
||||
this.createTimeInit(); |
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 获取数据 |
||||
*/ |
||||
queryData() { |
||||
if (this.searchForm.controls['createTimeArray'].value != null |
||||
&& this.searchForm.controls['createTimeArray'].value.length > 0) { |
||||
this.searchForm.controls['createTimeS'].setValue(this.searchForm.controls['createTimeArray'].value[0]); |
||||
this.searchForm.controls['createTimeE'].setValue(this.searchForm.controls['createTimeArray'].value[1]); |
||||
} else { |
||||
this.searchForm.controls['createTimeS'].setValue(null) |
||||
this.searchForm.controls['createTimeE'].setValue(null) |
||||
} |
||||
this.searchForm.value.pageNum = this.tablePageNum; |
||||
this.searchForm.value.pageSize = 10; |
||||
this.searchForm.value.time = new Date().getTime(); |
||||
this.orderService.queryList(this.searchForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.tableData = data['return_data']; |
||||
for (let data of this.tableData.list) { |
||||
data['rowSpan'] = this.tableData.list.filter((s: { orderNo: any; }) => s.orderNo == data.orderNo).length; |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单提交 |
||||
*/ |
||||
searchFormSubmit(): void { |
||||
this.tablePageNum = 1; |
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单重置 |
||||
*/ |
||||
searchFormReset(): void { |
||||
this.searchForm.reset(); |
||||
} |
||||
|
||||
/** |
||||
* 创建时间初始化 |
||||
*/ |
||||
createTimeInit() { |
||||
let createTimeSelect = this.searchForm.controls['createTimeSelect'].value; |
||||
if (createTimeSelect != null) { |
||||
let timeObj = DateUtils.getDate(new Date(), Number(createTimeSelect)); |
||||
this.searchForm.controls['createTimeArray'].setValue([timeObj.timeS, timeObj.timeE]); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 展示详情 |
||||
* @param childOrderNo |
||||
*/ |
||||
showDetail(childOrderNo: string) { |
||||
this.orderService.queryDetail(childOrderNo,(data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.orderDetail = data['return_data']; |
||||
} |
||||
}); |
||||
this.orderDetailVisible = true; |
||||
} |
||||
|
||||
/** |
||||
* 关闭详情 |
||||
*/ |
||||
closeDetail() { |
||||
this.orderDetail = {}; |
||||
this.orderDetailVisible = false; |
||||
} |
||||
} |
@ -1,225 +0,0 @@ |
||||
<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="goodsName" 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="logisticsNo" 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="orderNo" 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="userPhone" 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-tree-select |
||||
nzPlaceHolder="请选择" |
||||
formControlName="goodsType" |
||||
[nzNodes]="nodes" |
||||
nzShowSearch |
||||
></nz-tree-select> |
||||
</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="goodsBrand"> |
||||
<nz-option *ngFor="let item of nodesBrand" nzLabel="{{item['title']}}" nzValue="{{item['id']}}"></nz-option> |
||||
</nz-select> |
||||
</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="status"> |
||||
<nz-option *ngFor="let item of orderGoodsStatus" nzLabel="{{item['name']}}" nzValue="{{item['key']}}"></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> |
||||
</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="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.goodsName}} - {{data.goodsSpecsName}}</td> |
||||
<td> |
||||
<img nz-image width="60px" height="60px" nzSrc="{{imageUrl + data.img }}" [nzFallback]="fallbackImg" alt="" /> |
||||
</td> |
||||
<td>{{data.goodsTypeName}}</td> |
||||
<td>{{data.goodsBrandName}}</td> |
||||
<td>{{data.orderNo}}</td> |
||||
<td>{{data.childOrderNo}}</td> |
||||
<td>{{data.logisticsNo}}</td> |
||||
<td>{{ data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||
<td>{{ data.updateTime | date: 'yyyy-MM-dd HH:mm'}}</td> |
||||
<td> |
||||
<span *ngIf="data.logisticsStatusDesc == null">{{data.status | orderGoodsStatus}}</span> |
||||
<span *ngIf="data.logisticsStatusDesc != null">{{data.logisticsStatusDesc}}</span> |
||||
</td> |
||||
<td> |
||||
<a (click)="showDetail(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 nz-menu-item (click)="getLogisticsNo(data.id)"><a>录入物流编码</a></li> |
||||
<li nz-menu-item (click)="showLogisticsNo(data.id)"><a>查看物流</a></li> |
||||
</ul> |
||||
</nz-dropdown-menu> |
||||
</td> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
|
||||
<nz-modal [nzWidth]="1400" [(nzVisible)]="orderDetailModal" nzTitle="订单详情" (nzOnCancel)="orderDetailModal = false" (nzOnOk)="orderDetailModal = false"> |
||||
<ng-container *nzModalContent> |
||||
|
||||
<nz-tabset nzType="card"> |
||||
<nz-tab nzTitle="订单信息"> |
||||
<nz-descriptions nzTitle="订单信息" nzBordered> |
||||
<nz-descriptions-item nzTitle="商品名称">{{orderGoodsData?.goodsName}} - {{orderGoodsData?.goodsSpecsName}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="用户手机号">{{ orderGoodsData?.userPhone }}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="商品分类">{{ orderGoodsData?.goodsTypeName }}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="商品品牌">{{ orderGoodsData?.goodsBrandName }}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="商品价格">{{ orderGoodsData?.goodsSpecsOriginalPrice }}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="商品数量">{{ orderGoodsData?.goodsCount }}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="图片" [nzSpan]="3"> |
||||
<nz-image-group> |
||||
<img nz-image width="80px" [nzFallback]="fallbackImg" nzSrc="{{imageUrl + orderGoodsData.img }}" alt="" /> |
||||
</nz-image-group> |
||||
</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="物流状态" [nzSpan]="3"> |
||||
<span *ngIf="orderGoodsData?.logisticsStatusDesc == null"> |
||||
{{orderGoodsData.status | orderGoodsStatus}} |
||||
</span> |
||||
<span *ngIf="orderGoodsData?.logisticsStatusDesc != null"> |
||||
<nz-badge *ngIf="orderGoodsData?.logisticsStatus == 'DELIVERING'" nzColor="cyan" nzText="{{orderGoodsData.logisticsStatusDesc}}"></nz-badge> |
||||
<nz-badge *ngIf="orderGoodsData?.logisticsStatus == 'TRANSPORT'" nzColor="lime" nzText="{{orderGoodsData.logisticsStatusDesc}}"></nz-badge> |
||||
<nz-badge *ngIf="orderGoodsData?.logisticsStatus == 'AGENT_SIGN'" nzStatus="success" nzText="{{orderGoodsData.logisticsStatusDesc}}"></nz-badge> |
||||
<nz-badge *ngIf="orderGoodsData?.logisticsStatus == 'SIGN'" nzStatus="success" nzText="{{orderGoodsData.logisticsStatusDesc}}"></nz-badge> |
||||
<nz-badge *ngIf="orderGoodsData?.logisticsStatus == 'ACCEPT'" nzStatus="processing" nzText="{{orderGoodsData.logisticsStatusDesc}}"></nz-badge> |
||||
<nz-badge *ngIf="orderGoodsData?.logisticsStatus == 'FAILED'" nzStatus="error" nzText="{{orderGoodsData.logisticsStatusDesc}}"></nz-badge> |
||||
<nz-badge *ngIf="orderGoodsData?.logisticsStatus == 'WAIT_ACCEPT'" nzStatus="default" nzText="{{orderGoodsData.logisticsStatusDesc}}"></nz-badge> |
||||
</span> |
||||
</nz-descriptions-item> |
||||
</nz-descriptions> |
||||
</nz-tab> |
||||
<nz-tab nzTitle="支付信息"> |
||||
<nz-descriptions nzTitle="支付信息" nzBordered> |
||||
<nz-descriptions-item nzTitle="订单号">{{ orderGoodsData?.orderNo }}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="子订单号" [nzSpan]="2">{{ orderGoodsData?.childOrderNo }}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="支付流水号" [nzSpan]="3">{{ orderGoodsData?.paySerialNo }}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="商品总金额" [nzSpan]="3">{{ orderGoodsData?.totalPrice }}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="优惠券优惠金额" [nzSpan]="3">{{ orderGoodsData?.couponDiscountPrice }}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="积分抵扣优惠金额" [nzSpan]="3">{{ orderGoodsData?.integralDiscountPrice }}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="总优惠金额(优惠券优惠金额 + 积分抵扣)" [nzSpan]="3">{{ orderGoodsData?.totalDeductionPrice }}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="实付金额" [nzSpan]="3">{{ orderGoodsData?.payRealPrice }}</nz-descriptions-item> |
||||
</nz-descriptions> |
||||
</nz-tab> |
||||
<nz-tab nzTitle="订单时间"> |
||||
<nz-descriptions nzTitle="订单时间" nzBordered> |
||||
<nz-descriptions-item *ngIf="orderGoodsData?.createTime != null" nzTitle="创建时间">{{ orderGoodsData?.createTime | date: 'yyyy-MM-dd HH:mm' }}</nz-descriptions-item> |
||||
<nz-descriptions-item *ngIf="orderGoodsData?.payTime != null" nzTitle="支付时间">{{ orderGoodsData?.payTime | date: 'yyyy-MM-dd HH:mm' }}</nz-descriptions-item> |
||||
<nz-descriptions-item *ngIf="orderGoodsData?.cancelTime != null" nzTitle="取消时间">{{ orderGoodsData?.cancelTime | date: 'yyyy-MM-dd HH:mm' }}</nz-descriptions-item> |
||||
<nz-descriptions-item *ngIf="orderGoodsData?.refundTime != null" nzTitle="退款时间">{{ orderGoodsData?.refundTime | date: 'yyyy-MM-dd HH:mm' }}</nz-descriptions-item> |
||||
<nz-descriptions-item *ngIf="orderGoodsData?.finishTime != null" nzTitle="完成时间">{{ orderGoodsData?.finishTime | date: 'yyyy-MM-dd HH:mm' }}</nz-descriptions-item> |
||||
<nz-descriptions-item *ngIf="orderGoodsData?.updateTime != null" nzTitle="更新时间">{{ orderGoodsData?.updateTime | date: 'yyyy-MM-dd HH:mm' }}</nz-descriptions-item> |
||||
</nz-descriptions> |
||||
</nz-tab> |
||||
</nz-tabset> |
||||
|
||||
</ng-container> |
||||
</nz-modal> |
||||
|
||||
<nz-modal [(nzVisible)]="isVisible" nzTitle="新增物流单号" (nzOnCancel)="isVisible = false" (nzOnOk)="handleOk()"> |
||||
<ng-container *nzModalContent> |
||||
<div nz-row> |
||||
<div nz-col nzSpan="20"> |
||||
<nz-form-item> |
||||
<nz-form-label [nzSpan]="6">物流单号</nz-form-label> |
||||
<nz-form-control [nzSpan]="16"> |
||||
<input nz-input [(ngModel)]="logisticsNo"/> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
</div> |
||||
</ng-container> |
||||
</nz-modal> |
||||
|
||||
<nz-modal [(nzVisible)]="orderDetailModalChild" nzTitle="物流详情" (nzOnCancel)="orderDetailModalChild = false" [nzFooter]="null" |
||||
nzWidth="1000px" [nzBodyStyle]=" { padding: '20px 20px 30px 20px'}"> |
||||
<ng-container *nzModalContent> |
||||
<nz-spin [nzSpinning]="orderDetailModalLoading"> |
||||
<nz-timeline [nzReverse]="true" *ngIf="logisticsTraceDetails !== null"> |
||||
<nz-timeline-item *ngFor="let item of logisticsTraceDetails;let i = index" [nzColor]="i===logisticsTraceDetails.length -1?'green':'gray'"> |
||||
<p [ngClass]="{'fontColorBlue': i===logisticsTraceDetails.length -1 }">{{item['desc']}}</p> |
||||
<p [ngClass]="{'fontColorBlue': i===logisticsTraceDetails.length -1 }">{{item.time | date : 'yyyy-MM-dd HH:mm:ss'}}</p> |
||||
</nz-timeline-item> |
||||
</nz-timeline> |
||||
<nz-result *ngIf="logisticsTraceDetails === null" nzStatus="404" nzTitle="404" nzSubTitle="很抱歉暂无物流信息."></nz-result> |
||||
</nz-spin> |
||||
</ng-container> |
||||
</nz-modal> |
@ -1,12 +0,0 @@ |
||||
[nz-form-label] { |
||||
overflow: visible; |
||||
} |
||||
button { |
||||
margin-left: 8px; |
||||
} |
||||
.submit-btn { |
||||
width: 150px; |
||||
} |
||||
.search-area { |
||||
margin-top: 30px; |
||||
} |
@ -1,244 +0,0 @@ |
||||
import { Component } from '@angular/core'; |
||||
import {DatePipe, NgClass, NgForOf, NgIf} from "@angular/common"; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule} from "@angular/forms"; |
||||
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||
import { |
||||
NzTableComponent, NzTableModule, |
||||
NzThMeasureDirective |
||||
} from "ng-zorro-antd/table"; |
||||
import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; |
||||
|
||||
import {NzFormDirective, NzFormModule} from "ng-zorro-antd/form"; |
||||
import {NzImageDirective, NzImageModule,} from "ng-zorro-antd/image"; |
||||
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||
|
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {NzTreeSelectComponent} from "ng-zorro-antd/tree-select"; |
||||
|
||||
import {environment} from "../../../../environments/environment"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {GoodsService} from "../../../services/goods/goods.service"; |
||||
import {fallbackImg, orderGoodsStatus} from '../../../data/goods/goods.namespace'; |
||||
import {GoodsStatusPipe} from "../../../pipes/goods/goods-status.pipe"; |
||||
import {NzModalModule} from "ng-zorro-antd/modal"; |
||||
import {OrderGoodsService} from "../../../services/trade/order-goods.service"; |
||||
import {OrderGoodsStatusPipe} from "../../../pipes/order/order-goods-status.pipe"; |
||||
import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; |
||||
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||
import {NzPopconfirmDirective} from "ng-zorro-antd/popconfirm"; |
||||
import {OrderGoodsData} from "../../../model/order.interface"; |
||||
import {NzDividerComponent} from "ng-zorro-antd/divider"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||
import {NzBadgeComponent} from "ng-zorro-antd/badge"; |
||||
import {AuditStatusPipe} from "../../../pipes/audit/audit-status.pipe"; |
||||
import {NzTabComponent, NzTabSetComponent, NzTabsModule} from "ng-zorro-antd/tabs"; |
||||
import {NzSpinComponent} from "ng-zorro-antd/spin"; |
||||
import {NzTimelineComponent, NzTimelineItemComponent} from "ng-zorro-antd/timeline"; |
||||
import {NzResultComponent} from "ng-zorro-antd/result"; |
||||
|
||||
@Component({ |
||||
selector: 'app-goods-list', |
||||
standalone: true, |
||||
imports: [ |
||||
NzColDirective, |
||||
NzRowDirective, |
||||
NzFormDirective, |
||||
ReactiveFormsModule, |
||||
NzTreeSelectComponent, |
||||
NzInputDirective, |
||||
NzSelectComponent, |
||||
NzOptionComponent, |
||||
NzButtonComponent, |
||||
NzTableComponent, |
||||
NzImageModule, |
||||
NzModalModule, |
||||
NzTableModule, |
||||
NzFormModule, |
||||
NzThMeasureDirective, |
||||
NgForOf, |
||||
NzImageDirective, |
||||
GoodsStatusPipe, |
||||
DatePipe, |
||||
OrderGoodsStatusPipe, |
||||
NzDropdownMenuComponent, |
||||
NgIf, |
||||
NzMenuDirective, |
||||
NzDescriptionsModule, |
||||
NzMenuItemComponent, |
||||
NzPopconfirmDirective, |
||||
NzDividerComponent, |
||||
NzDropDownADirective, |
||||
NzDropDownDirective, |
||||
NzTabsModule, |
||||
NzIconDirective, |
||||
NzBadgeComponent, |
||||
AuditStatusPipe, |
||||
NzTabSetComponent, |
||||
FormsModule, |
||||
NzSpinComponent, |
||||
NzTimelineItemComponent, |
||||
NgClass, |
||||
NzResultComponent, |
||||
NzTimelineComponent, |
||||
|
||||
], |
||||
templateUrl: './goods-list.component.html', |
||||
styleUrl: './goods-list.component.less' |
||||
}) |
||||
export class GoodsListComponent { |
||||
// 表单页数
|
||||
tablePageNum = 1; |
||||
// 表单数据
|
||||
tableData: any = { |
||||
total: 0, |
||||
loading: false, |
||||
list: [], |
||||
}; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
|
||||
baseUrl = environment.baseUrl; |
||||
imageUrl = environment.imageUrl; |
||||
|
||||
// 商品类型数据
|
||||
nodes = []; |
||||
nodesBrand = []; |
||||
orderGoodsData: any; |
||||
orderDetailModal = false; |
||||
isVisible = false; |
||||
orderDetailModalChild = false; |
||||
orderDetailModalLoading = false; |
||||
logisticsNo: any; |
||||
logisticsTraceDetails: any; |
||||
goodsOrderId: any; |
||||
|
||||
protected readonly fallbackImg = fallbackImg; |
||||
protected readonly orderGoodsStatus = orderGoodsStatus; |
||||
|
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private msg: NzMessageService, |
||||
private orderGoodsService: OrderGoodsService, |
||||
private goodsService: GoodsService) { |
||||
|
||||
|
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
logisticsNo: [''], |
||||
orderNo: [''], |
||||
goodsType: [''], |
||||
goodsBrand: [''], |
||||
userPhone: [''], |
||||
goodsSpecsName: [''], |
||||
goodsName: [''], |
||||
payType: [''], |
||||
status: [''], |
||||
}); |
||||
|
||||
|
||||
this.getRequest(); |
||||
this.getGoodsTypeNode(); |
||||
this.getGoodsBrandNode(); |
||||
|
||||
} |
||||
|
||||
// 查询列表
|
||||
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.orderGoodsService.getListGoods(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; |
||||
}); |
||||
} |
||||
|
||||
// 获取商品分类
|
||||
getGoodsTypeNode() { |
||||
this.goodsService.getList({time: new Date().getTime()}, (data: any) => { |
||||
if (data['return_code'] === '000000') { |
||||
this.getNode(data['return_data']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
// 配置数据
|
||||
getNode(array: any): any { |
||||
array.forEach((item: any) => { |
||||
if (item.children) { |
||||
this.getNode(item.children); |
||||
}else { |
||||
item["isLeaf"] = true; |
||||
} |
||||
item["key"] = item.id; |
||||
|
||||
}); |
||||
this.nodes = array; |
||||
} |
||||
|
||||
// 获取商品品牌
|
||||
getGoodsBrandNode() { |
||||
this.goodsService.getListBrandAll( (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.nodesBrand = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
getLogisticsNo(id: number): void { |
||||
this.getRequest(false); |
||||
this.goodsOrderId = id; |
||||
this.isVisible = true; |
||||
} |
||||
|
||||
showDetail(data: OrderGoodsData): void { |
||||
console.log(data); |
||||
this.orderGoodsData = data; |
||||
this.orderDetailModal = true; |
||||
} |
||||
|
||||
handleOk(): void { |
||||
let params = { |
||||
id: this.goodsOrderId, |
||||
logisticsNo: this.logisticsNo, |
||||
time: new Date().getTime() |
||||
} |
||||
|
||||
this.orderGoodsService.updateLogisticsNo(params , (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.isVisible = false; |
||||
|
||||
this.msg.success("成功") |
||||
} else { |
||||
this.msg.error(data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
showLogisticsNo(id: number): void { |
||||
let params = { |
||||
id:id, |
||||
time: new Date().getTime() |
||||
} |
||||
|
||||
this.orderGoodsService.getLogisticsMsg(params , (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.orderDetailModalChild = true; |
||||
this.getRequest(false); |
||||
this.logisticsTraceDetails = data['return_data']['logisticsTraceDetails']; |
||||
} else { |
||||
this.msg.error(data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
} |
@ -1,219 +0,0 @@ |
||||
<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 nz-input formControlName="applyNo" 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 formControlName="type" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of applyTypeArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</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 nz-input formControlName="userPhone" 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 nz-input formControlName="childOrderNo" 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 formControlName="status" nzAllowClear [nzPlaceHolder]="'请选择'"> |
||||
<nz-option *ngFor="let item of applyStatusArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="18"> |
||||
<nz-form-item> |
||||
<nz-form-label>创建时间</nz-form-label> |
||||
<nz-form-control> |
||||
<nz-range-picker formControlName="createTimeArray" nzShowTime [nzFormat]="'yyyy/MM/dd HH:mm:ss'"></nz-range-picker> |
||||
<nz-radio-group nzButtonStyle="solid" formControlName="createTimeSelect" (ngModelChange)="createTimeInit()"> |
||||
<label nz-radio-button *ngFor="let item of dateTypeSelect" nzValue="{{item.value}}">{{item.name}}</label> |
||||
</nz-radio-group> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</div> |
||||
<div nz-col [nzSpan]="24" class="search-area"> |
||||
<button nz-button [nzType]="'primary'" (click)="searchFormSubmit()">查询</button> |
||||
<button nz-button (click)="searchFormReset()">重置</button> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
|
||||
<nz-table #basicTable |
||||
[nzScroll]="{ x: '1500px' }" |
||||
[nzBordered]="true" |
||||
[nzFrontPagination]="false" |
||||
[nzShowQuickJumper]="true" |
||||
[nzShowTotal]="totalTemplate" |
||||
[(nzPageIndex)]="tablePageNum" |
||||
(nzPageIndexChange)="queryData()" |
||||
[nzTotal]="tableData.total" |
||||
[nzData]="tableData.list" > |
||||
<thead> |
||||
<tr> |
||||
<th nzWidth="150px">申请单号</th> |
||||
<th nzWidth="100px">申请类型</th> |
||||
<th nzWidth="130px">客户电话</th> |
||||
<th nzWidth="150px">商品单号</th> |
||||
<th nzWidth="100px">产品类型</th> |
||||
<th nzWidth="200px">产品名称</th> |
||||
<th nzWidth="100px">产品规格</th> |
||||
<th nzWidth="100px">申请数量</th> |
||||
<th nzWidth="150px">申请时间</th> |
||||
<th nzWidth="100px">状态</th> |
||||
<th nzWidth="120px" nzRight>操作</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<tr *ngFor="let data of basicTable.data;index as i"> |
||||
<td>{{data.applyNo}}</td> |
||||
<td>{{data.type | dictionary: 'ORDER_AFTER_SALES_APPLY_TYPE'}}</td> |
||||
<td>{{data.userPhone}}</td> |
||||
<td>{{data.childOrderNo}}</td> |
||||
<td>{{data.productType | dictionary: 'ORDER_CHILD_PRODUCT_TYPE'}}</td> |
||||
<td>{{data.productName}}</td> |
||||
<td>{{data.productSpecName}}</td> |
||||
<td>{{data.productCount}}</td> |
||||
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm:ss'}}</td> |
||||
<td>{{data.status | dictionary: 'ORDER_AFTER_SALES_APPLY_STATUS'}}</td> |
||||
<td nzRight> |
||||
<a (click)="showDetail(data.applyNo)">详情</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 nz-menu-item *ngIf="data.status == 1" (click)="showAudit(data)">审核申请</li> |
||||
<li nz-menu-item *ngIf="data.status == 4" (click)="showFinishConfirm(data.applyNo)">完结申请</li> |
||||
</ul> |
||||
</nz-dropdown-menu> |
||||
</td> |
||||
</tr> |
||||
</tbody> |
||||
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template> |
||||
</nz-table> |
||||
|
||||
|
||||
<nz-modal [(nzVisible)]="applyDetailVisible" nzWidth="1000px" nzTitle="申请详情" [nzFooter]="null" (nzOnCancel)="closeDetail()" [nzBodyStyle]="{ 'padding': '10px' }"> |
||||
<ng-container *nzModalContent> |
||||
<nz-tabset nzType="card" nzSize="small"> |
||||
<nz-tab nzTitle="申请详情"> |
||||
<nz-descriptions nzBordered [nzColumn]="{ xxl: 2, xl: 2, lg: 2, md: 2, sm: 2, xs: 1 }"> |
||||
<nz-descriptions-item nzTitle="申请单号">{{applyDetail.applyDetail.applyNo}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="申请类型">{{applyDetail.applyDetail.type | dictionary: 'ORDER_AFTER_SALES_APPLY_TYPE'}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="用户手机号">{{applyDetail.applyDetail.userPhone}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="产品类型">{{applyDetail.applyDetail.productType | dictionary: 'ORDER_CHILD_PRODUCT_TYPE'}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="产品名称">{{applyDetail.applyDetail.productName}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="产品规格">{{applyDetail.applyDetail.productSpecName}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="申请产品数量">{{applyDetail.applyDetail.productCount}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="申请时间">{{applyDetail.applyDetail.createTime | date:'yyyy-MM-dd HH:mm:ss'}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="申请退款金额">{{applyDetail.applyDetail.refundPrice}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="申请退款积分">{{applyDetail.applyDetail.refundIntegral}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="快递单号" [nzSpan]="3">{{applyDetail.applyDetail.sendExpressNo}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="图片" [nzSpan]="3"> |
||||
<div nz-row *ngIf="applyDetail.applyDetail.photo != null && applyDetail.applyDetail.photo != ''"> |
||||
<div *ngFor="let img of applyDetail.applyDetail.photo.split(';')" nz-col class="gutter-row" [nzSpan]="4"> |
||||
<img nz-image width="100px" height="100px" nzSrc="{{imageUrl + img}}" alt="" src=""/> |
||||
</div> |
||||
</div> |
||||
</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="备注" [nzSpan]="3">{{applyDetail.applyDetail.remarks}}</nz-descriptions-item> |
||||
</nz-descriptions> |
||||
</nz-tab> |
||||
<nz-tab nzTitle="商品订单"> |
||||
<nz-descriptions nzBordered [nzColumn]="{ xxl: 2, xl: 2, lg: 2, md: 2, sm: 2, xs: 1 }"> |
||||
<nz-descriptions-item nzTitle="交易单号">{{applyDetail.childOrder.orderNo}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="商品单号">{{applyDetail.childOrder.childOrderNo}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="产品类型">{{applyDetail.childOrder.productType | dictionary: 'ORDER_CHILD_PRODUCT_TYPE'}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="产品名称">{{applyDetail.childOrder.productName}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="产品规格">{{applyDetail.childOrder.productSpecName}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="购买数量">{{applyDetail.childOrder.productCount}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="商品总价">{{applyDetail.childOrder.productTotalPrice}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="总优惠">{{applyDetail.childOrder.totalDeductionPrice}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="优惠券优惠">{{applyDetail.childOrder.couponDiscountPrice}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="积分抵扣">{{applyDetail.childOrder.integralDiscountPrice}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="实付金额">{{applyDetail.childOrder.productActualPrice}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="状态">{{applyDetail.childOrder.status | dictionary: 'ORDER_CHILD_STATUS'}}</nz-descriptions-item> |
||||
<nz-descriptions-item nzTitle="下单时间">{{applyDetail.childOrder.createTime | date: 'yyyy-MM-dd HH:mm:ss'}}</nz-descriptions-item> |
||||
</nz-descriptions> |
||||
</nz-tab> |
||||
<nz-tab nzTitle="时间线"> |
||||
<nz-timeline> |
||||
<nz-timeline-item *ngFor="let item of applyDetail.applyOpRecord"> |
||||
{{item.createTime | date: 'yyyy-MM-dd HH:mm:ss'}}【{{item.status | dictionary: 'ORDER_AFTER_SALES_APPLY_STATUS'}}】 操作人:{{item.opUserName}} |
||||
<div nz-row *ngIf="item.photo != null && item.photo != ''"> |
||||
<div *ngFor="let img of item.photo.split(';')" nz-col class="gutter-row" [nzSpan]="2"> |
||||
<img nz-image width="50px" height="50px" nzSrc="{{imageUrl + img}}" alt="" src=""/> |
||||
</div> |
||||
</div> |
||||
<p nz-typography>备注:{{item.remarks!=null?item.remarks:'无'}}</p> |
||||
</nz-timeline-item> |
||||
</nz-timeline> |
||||
</nz-tab> |
||||
</nz-tabset> |
||||
</ng-container> |
||||
</nz-modal> |
||||
|
||||
<nz-modal [(nzVisible)]="applyAuditVisible" nzWidth="500px" nzTitle="审核" [nzFooter]="null" (nzOnCancel)="closeAudit()" [nzBodyStyle]="{ 'padding': '10px' }"> |
||||
<ng-container *nzModalContent> |
||||
<form nz-form [formGroup]="applyAuditForm" > |
||||
<nz-form-item> |
||||
<nz-form-label [nzSm]="6" [nzXs]="24">申请单号</nz-form-label> |
||||
<nz-form-control [nzSm]="14" [nzXs]="24"> |
||||
<input nz-input formControlName="applyNo" /> |
||||
</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 formControlName="type"> |
||||
<nz-option *ngFor="let item of applyTypeArray" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option> |
||||
</nz-select> |
||||
</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-radio-group formControlName="auditStatus" > |
||||
<label nz-radio nzValue="true">通过</label> |
||||
<label nz-radio nzValue="false">驳回</label> |
||||
</nz-radio-group> |
||||
</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" nzErrorTip=""> |
||||
<textarea rows="4" formControlName="remarks" nz-input></textarea> |
||||
</nz-form-control> |
||||
</nz-form-item> |
||||
</form> |
||||
<div nz-flex [nzJustify]="'center'"> |
||||
<button nz-button nzType="primary" class="submit-btn" (click)="submitAuditForm()">确定</button> |
||||
</div> |
||||
</ng-container> |
||||
</nz-modal> |
@ -1,9 +0,0 @@ |
||||
.search-area { |
||||
margin-bottom: 10px; |
||||
} |
||||
.search-area button { |
||||
margin-right: 8px; |
||||
} |
||||
.submit-btn { |
||||
width: 150px; |
||||
} |
@ -1,298 +0,0 @@ |
||||
import { Component } from '@angular/core'; |
||||
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
||||
import {DateSelectType, DateUtils} from "../../../utils/dateUtils.service"; |
||||
import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; |
||||
import {NzMessageService} from "ng-zorro-antd/message"; |
||||
import {NzModalComponent, NzModalModule, NzModalService} from "ng-zorro-antd/modal"; |
||||
import {OrderAfterSalesService} from "../../../services/trade/order-after-sales.service"; |
||||
import {DatePipe, NgForOf, NgIf, NgSwitch} from "@angular/common"; |
||||
import {NzButtonComponent} from "ng-zorro-antd/button"; |
||||
import { |
||||
NzCellEllipsisDirective, |
||||
NzCellFixedDirective, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, NzTheadComponent, |
||||
NzThMeasureDirective, NzTrDirective |
||||
} from "ng-zorro-antd/table"; |
||||
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 {NzFlexDirective} from "ng-zorro-antd/flex"; |
||||
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; |
||||
import {NzIconDirective} from "ng-zorro-antd/icon"; |
||||
import {NzInputDirective} from "ng-zorro-antd/input"; |
||||
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; |
||||
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; |
||||
import {NzDatePickerComponent, NzDatePickerModule, NzRangePickerComponent} from "ng-zorro-antd/date-picker"; |
||||
import {NzRadioButtonDirective, NzRadioComponent, NzRadioGroupComponent} from "ng-zorro-antd/radio"; |
||||
import {NzTooltipDirective} from "ng-zorro-antd/tooltip"; |
||||
import {NzTreeComponent} from "ng-zorro-antd/tree"; |
||||
import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; |
||||
import {NzTabComponent, NzTabSetComponent, NzTabsModule} from "ng-zorro-antd/tabs"; |
||||
import {NzTimelineModule} from "ng-zorro-antd/timeline"; |
||||
import {NzImageDirective, NzImageModule} from "ng-zorro-antd/image"; |
||||
import {NzTypographyComponent} from "ng-zorro-antd/typography"; |
||||
import {environment} from "../../../../environments/environment"; |
||||
|
||||
@Component({ |
||||
selector: 'app-order-after-sales', |
||||
standalone: true, |
||||
imports: [ |
||||
DatePipe, |
||||
DictionaryPipe, |
||||
FormsModule, |
||||
NgForOf, |
||||
NgIf, |
||||
NzButtonComponent, |
||||
NzCellFixedDirective, |
||||
NzColDirective, |
||||
NzDividerComponent, |
||||
NzDropDownADirective, |
||||
NzDropDownDirective, |
||||
NzDropdownMenuComponent, |
||||
NzFlexDirective, |
||||
NzFormControlComponent, |
||||
NzFormDirective, |
||||
NzFormItemComponent, |
||||
NzFormLabelComponent, |
||||
NzIconDirective, |
||||
NzInputDirective, |
||||
NzMenuDirective, |
||||
NzMenuItemComponent, |
||||
NzModalComponent, |
||||
NzOptionComponent, |
||||
NzRowDirective, |
||||
NzSelectComponent, |
||||
NzTableCellDirective, |
||||
NzTableComponent, |
||||
NzTbodyComponent, |
||||
NzThMeasureDirective, |
||||
NzTheadComponent, |
||||
NzTrDirective, |
||||
ReactiveFormsModule, |
||||
NzModalModule, |
||||
NzRangePickerComponent, |
||||
NzDatePickerComponent, |
||||
NzDatePickerModule, |
||||
NzRadioButtonDirective, |
||||
NzRadioComponent, |
||||
NzRadioGroupComponent, |
||||
NgSwitch, |
||||
NzCellEllipsisDirective, |
||||
NzTooltipDirective, |
||||
NzTreeComponent, |
||||
NzDescriptionsModule, |
||||
NzTabSetComponent, |
||||
NzTabComponent, |
||||
NzTabsModule, |
||||
NzTimelineModule, |
||||
NzImageDirective, |
||||
NzImageModule, |
||||
NzTypographyComponent |
||||
], |
||||
templateUrl: './order-after-sales.component.html', |
||||
styleUrl: './order-after-sales.component.less' |
||||
}) |
||||
export class OrderAfterSalesComponent { |
||||
imageUrl = environment.imageUrl; |
||||
// 表单页数
|
||||
tablePageNum = 1; |
||||
// 表单数据
|
||||
tableData: any = { |
||||
total: 0, |
||||
list: [], |
||||
}; |
||||
// 搜索表单
|
||||
searchForm: FormGroup; |
||||
// 时间类型选择
|
||||
dateTypeSelect = DateSelectType; |
||||
// 申请状态
|
||||
applyStatusArray = new DictionaryPipe().getDictionaryList('ORDER_AFTER_SALES_APPLY_STATUS'); |
||||
// 申请类型
|
||||
applyTypeArray = new DictionaryPipe().getDictionaryList('ORDER_AFTER_SALES_APPLY_TYPE'); |
||||
// 申请详情模态框
|
||||
applyDetailVisible = false; |
||||
// 申请详情数据
|
||||
applyDetail: any = { |
||||
applyOpRecord: [] |
||||
}; |
||||
// 申请审核表单
|
||||
applyAuditForm: FormGroup; |
||||
// 申请审核模态框
|
||||
applyAuditVisible = false; |
||||
constructor(private fb: NonNullableFormBuilder, |
||||
private orderAfterSalesService : OrderAfterSalesService, |
||||
private message: NzMessageService, |
||||
private modal: NzModalService) { |
||||
// 初始化搜索框
|
||||
this.searchForm = this.fb.group({ |
||||
type: [''], |
||||
userPhone: [''], |
||||
childOrderNo: [''], |
||||
applyNo: [''], |
||||
status: [''], |
||||
createTimeArray: [[]], |
||||
createTimeSelect: ['1'], |
||||
createTimeS: [''], |
||||
createTimeE: [''], |
||||
}); |
||||
|
||||
this.applyAuditForm = this.fb.group({ |
||||
applyNo: [''], |
||||
type: [''], |
||||
auditStatus: ['', [Validators.required]], |
||||
remarks: [''], |
||||
}); |
||||
this.createTimeInit(); |
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 获取数据 |
||||
*/ |
||||
queryData() { |
||||
if (this.searchForm.controls['createTimeArray'].value != null |
||||
&& this.searchForm.controls['createTimeArray'].value.length > 0) { |
||||
this.searchForm.controls['createTimeS'].setValue(this.searchForm.controls['createTimeArray'].value[0]); |
||||
this.searchForm.controls['createTimeE'].setValue(this.searchForm.controls['createTimeArray'].value[1]); |
||||
} else { |
||||
this.searchForm.controls['createTimeS'].setValue(null) |
||||
this.searchForm.controls['createTimeE'].setValue(null) |
||||
} |
||||
this.searchForm.value.pageNum = this.tablePageNum; |
||||
this.searchForm.value.pageSize = 10; |
||||
this.searchForm.value.time = new Date().getTime(); |
||||
this.orderAfterSalesService.queryApplyList(this.searchForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.tableData = data['return_data']; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单提交 |
||||
*/ |
||||
searchFormSubmit(): void { |
||||
this.tablePageNum = 1; |
||||
this.queryData(); |
||||
} |
||||
|
||||
/** |
||||
* 搜索表单重置 |
||||
*/ |
||||
searchFormReset(): void { |
||||
this.searchForm.reset(); |
||||
} |
||||
|
||||
/** |
||||
* 创建时间初始化 |
||||
*/ |
||||
createTimeInit() { |
||||
let createTimeSelect = this.searchForm.controls['createTimeSelect'].value; |
||||
if (createTimeSelect != null) { |
||||
let timeObj = DateUtils.getDate(new Date(), Number(createTimeSelect)); |
||||
this.searchForm.controls['createTimeArray'].setValue([timeObj.timeS, timeObj.timeE]); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 展示详情 |
||||
* @param applyNo |
||||
*/ |
||||
showDetail(applyNo: string) { |
||||
this.orderAfterSalesService.queryApply(applyNo,(data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.applyDetail = data['return_data']; |
||||
console.log(this.applyDetail); |
||||
this.applyDetailVisible = true; |
||||
} else { |
||||
this.message.error(data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 关闭详情 |
||||
*/ |
||||
closeDetail() { |
||||
this.applyDetail = {}; |
||||
this.applyDetailVisible = false; |
||||
} |
||||
|
||||
/** |
||||
* 打开审核模态框 |
||||
* @param data |
||||
*/ |
||||
showAudit(data: any) { |
||||
data.type = String(data.type); |
||||
data.remarks = ''; |
||||
this.applyAuditForm.patchValue(data); |
||||
this.applyAuditForm.controls['applyNo'].disable(); |
||||
this.applyAuditForm.controls['type'].disable(); |
||||
this.applyAuditVisible = true; |
||||
} |
||||
|
||||
/** |
||||
* 提交审核 |
||||
*/ |
||||
submitAuditForm() { |
||||
if (this.applyAuditForm.valid) { |
||||
this.applyAuditForm.controls['applyNo'].enable(); |
||||
this.orderAfterSalesService.audit(this.applyAuditForm.value, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
|
||||
this.message.create('success', '操作成功'); |
||||
// 清空表单
|
||||
this.closeAudit(); |
||||
|
||||
this.queryData(); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} else { |
||||
this.applyAuditForm.controls['applyNo'].disable(); |
||||
Object.values(this.applyAuditForm.controls).forEach(control => { |
||||
if (control.invalid) { |
||||
control.markAsDirty(); |
||||
control.updateValueAndValidity({ onlySelf: true }); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 关闭审核 |
||||
*/ |
||||
closeAudit() { |
||||
this.applyAuditForm.reset(); |
||||
this.applyAuditVisible = false; |
||||
} |
||||
|
||||
/** |
||||
* 完结提示框 |
||||
* @param applyNo |
||||
*/ |
||||
showFinishConfirm(applyNo: string): void { |
||||
this.modal.confirm({ |
||||
nzTitle: '提示', |
||||
nzContent: '申请完结后金额原路退回', |
||||
nzOnOk: () => this.submitFinish(applyNo) |
||||
}); |
||||
} |
||||
submitFinish(applyNo: string): void { |
||||
const param = { |
||||
applyNo: applyNo |
||||
} |
||||
this.orderAfterSalesService.finish(param, (data: any) => { |
||||
if (data['return_code'] == '000000') { |
||||
this.message.create('success', '操作成功'); |
||||
this.queryData(); |
||||
} else { |
||||
this.message.create('error', data['return_msg']); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
} |
@ -1,12 +1,6 @@ |
||||
import { Routes } from '@angular/router'; |
||||
import {CompOrderComponent} from "./comp-order/comp-order.component"; |
||||
import {OrderAfterSalesComponent} from "./order-after-sales/order-after-sales.component"; |
||||
import {GoodsListComponent} from "./goods-list/goods-list.component"; |
||||
import {OrderRefundComponent} from "./order-refund/order-refund.component"; |
||||
|
||||
export const TRADE_ROUTES: Routes = [ |
||||
{ path: 'goods-list', component: GoodsListComponent }, |
||||
{ path: 'comp-order', component: CompOrderComponent }, |
||||
{ path: 'order-after-sales', component: OrderAfterSalesComponent }, |
||||
{ path: 'order-refund', component: OrderRefundComponent }, |
||||
]; |
||||
|
@ -1,48 +0,0 @@ |
||||
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 UserService { |
||||
constructor(private http: HttpClient) { } |
||||
|
||||
/** |
||||
* 恢复账户 |
||||
* @param param |
||||
* @param callBack |
||||
*/ |
||||
public restore(param: any, callBack:any) { |
||||
param.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'user/restore', param).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 禁用账户 |
||||
* @param param |
||||
* @param callBack |
||||
*/ |
||||
public disable(param: any, callBack:any) { |
||||
param.time = new Date().getTime(); |
||||
this.http.post(environment.baseUrl + 'user/disable', param).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询账户登录列表 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public queryUserList(params: any, callBack:any) { |
||||
params.time = new Date().getTime(); |
||||
this.http.get(environment.baseUrl + 'user/queryUserList?'+ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
} |
@ -1,45 +0,0 @@ |
||||
import { Injectable } from '@angular/core'; |
||||
import {environment} from "../../../environments/environment"; |
||||
import {ObjectData} from "../../utils/objectData.service"; |
||||
import {HttpClient} from "@angular/common/http"; |
||||
|
||||
@Injectable({ |
||||
providedIn: 'root' |
||||
}) |
||||
export class AuditService { |
||||
|
||||
constructor(private http: HttpClient) { } |
||||
|
||||
/** |
||||
* 获取商品规格列表 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public auditMsg(params: object, callBack:any) { |
||||
this.http.post(environment.baseUrl + 'audit/auditMsg', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询商品审核列表 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public getListGoodsAudit(params: object, callBack:any) { |
||||
this.http.get(environment.baseUrl + 'audit/getListGoodsAudit?' + ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询商品审核详情 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public auditDetail(params: object, callBack:any) { |
||||
this.http.get(environment.baseUrl + 'audit/auditDetail?' + ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
} |
@ -1,174 +0,0 @@ |
||||
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 GoodsService { |
||||
|
||||
constructor(private http: HttpClient) { } |
||||
|
||||
|
||||
/** |
||||
* 编辑商品类型 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public editGoodsType(params: object, callBack:any) { |
||||
this.http.post(environment.baseUrl + 'goodsType/editGoodsType', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询列表 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public getList(params: object, callBack:any) { |
||||
this.http.get(environment.baseUrl + 'goodsType/getList?' + ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 删除 |
||||
* @param id |
||||
* @param callBack |
||||
*/ |
||||
public delete(id: number, callBack:any) { |
||||
this.http.get(environment.baseUrl + 'goodsType/delete?id=' + id ).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 编辑商品品牌 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public editGoodsBrand(params: object, callBack:any) { |
||||
this.http.post(environment.baseUrl + 'goodsBrand/editGoodsBrand', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询品牌列表 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public getListBrand(params: object, callBack:any) { |
||||
this.http.get(environment.baseUrl + 'goodsBrand/getListBrand?' + ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
public getListBrandAll(callBack:any) { |
||||
this.http.get(environment.baseUrl + 'goodsBrand/getListBrandAll?time=' + new Date().getTime()).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 删除品牌 |
||||
* @param id |
||||
* @param callBack |
||||
*/ |
||||
public deleteBrand(id: number, callBack:any) { |
||||
this.http.get(environment.baseUrl + 'goodsBrand/delete?id=' + id ).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 获取商品列表 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public getListGoods(params: object, callBack:any) { |
||||
this.http.get(environment.baseUrl + 'goods/getListGoods?' + ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 编辑商品信息 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public editGoodsMsg(params: object, callBack:any) { |
||||
this.http.post(environment.baseUrl + 'goods/editGoodsMsg', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 编辑商品规格信息 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public editGoodsSpecs(params: object, callBack:any) { |
||||
this.http.post(environment.baseUrl + 'goods/editGoodsSpecs', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 获取商品规格列表 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public getGoodsSpecsList(params: object, callBack:any) { |
||||
this.http.get(environment.baseUrl + 'goods/getGoodsSpecsList?' + ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 删除商品 |
||||
* @param id |
||||
* @param callBack |
||||
*/ |
||||
public deleteGoodsMsg(id: number, callBack:any) { |
||||
this.http.get(environment.baseUrl + 'goods/deleteGoodsMsg?id=' + id ).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 删除商品规格 |
||||
* @param id |
||||
* @param callBack |
||||
*/ |
||||
public deleteGoodsSpecs(id: number, callBack:any) { |
||||
this.http.get(environment.baseUrl + 'goods/deleteGoodsSpecs?id=' + id ).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 获取全部上线中的商品规格 |
||||
* @param callBack |
||||
*/ |
||||
public getGoodsSpecsListAll(callBack:any) { |
||||
this.http.get(environment.baseUrl + 'goods/getGoodsSpecsListAll?time=' + new Date().getTime()).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 商品审批 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public goodsAudit(params: object, callBack:any) { |
||||
this.http.get(environment.baseUrl + 'goods/goodsAudit?' + ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
|
||||
} |
@ -1,141 +0,0 @@ |
||||
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 DiscountService { |
||||
|
||||
constructor(private http: HttpClient) { } |
||||
|
||||
/** |
||||
* 查询列表 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public getListDiscount(params: object, callBack:any) { |
||||
this.http.get(environment.baseUrl + 'discount/getListDiscount?' + ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 编辑优惠券 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public editDiscount(params: object, callBack:any) { |
||||
this.http.post(environment.baseUrl + 'discount/editDiscount', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 删除优惠券 |
||||
* @param id |
||||
* @param callBack |
||||
*/ |
||||
public deleteDiscount(id: number, callBack:any) { |
||||
this.http.get(environment.baseUrl + 'discount/delete?id=' + id ).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询列表 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public getListDiscountGoodsRel(params: object, callBack:any) { |
||||
this.http.get(environment.baseUrl + 'discount/getListDiscountGoodsRel?' + ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 绑定优惠券规格 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public bindDiscountSpecs(params: object, callBack:any) { |
||||
this.http.post(environment.baseUrl + 'discount/bindDiscountSpecs', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询列表 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public getDiscountPackageList(params: object, callBack:any) { |
||||
this.http.get(environment.baseUrl + 'discountPackage/getDiscountPackageList?' + ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 新增优惠券包基本信息 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public editCouponPackageInfo(params: object, callBack:any) { |
||||
this.http.post(environment.baseUrl + 'discountPackage/editCouponPackageInfo', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 删除 |
||||
* @param id |
||||
* @param callBack |
||||
*/ |
||||
public deleteCouponDiscount(id: number, callBack:any) { |
||||
this.http.get(environment.baseUrl + 'discountPackage/delete?id=' + id ).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询列表 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public getDetailList(params: object, callBack:any) { |
||||
this.http.get(environment.baseUrl + 'discountPackage/getDetailList?' + ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 删除 |
||||
* @param id |
||||
* @param callBack |
||||
*/ |
||||
public deleteDetail(id: number, callBack:any) { |
||||
this.http.get(environment.baseUrl + 'discountPackage/deleteDetail?detailId=' + id ).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 新增优惠券包详情 |
||||
* @param params |
||||
* @param callBack |
||||
*/ |
||||
public insertCouponPackageDetail(params: object, callBack:any) { |
||||
this.http.post(environment.baseUrl + 'discountPackage/insertCouponPackageDetail', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
public giveDiscountPackage(params: object, callBack:any) { |
||||
this.http.post(environment.baseUrl + 'discountPackage/giveDiscountPackage', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
} |
@ -1,64 +0,0 @@ |
||||
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 OrderAfterSalesService { |
||||
|
||||
constructor(private http: HttpClient) { } |
||||
|
||||
/** |
||||
* 查询订单列表 |
||||
* @param param |
||||
* @param callBack |
||||
*/ |
||||
public queryApplyList(param: any, callBack:any) { |
||||
param.time = new Date().getTime(); |
||||
this.http.get(environment.orderUrl + 'afterSales/queryApplyList?'+ObjectData.objectByString(param)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询订单详情 |
||||
* @param applyNo |
||||
* @param callBack |
||||
*/ |
||||
public queryApply(applyNo: string, callBack:any) { |
||||
let params = { |
||||
applyNo: applyNo, |
||||
time: new Date().getTime() |
||||
}; |
||||
this.http.get(environment.orderUrl + 'afterSales/queryApply?'+ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 审核 |
||||
* @param param |
||||
* @param callBack |
||||
*/ |
||||
public audit(param: any, callBack:any) { |
||||
param.time = new Date().getTime(); |
||||
this.http.post(environment.orderUrl + 'afterSales/audit', param).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 完成申请 |
||||
* @param param |
||||
* @param callBack |
||||
*/ |
||||
public finish(param: any, callBack:any) { |
||||
param.time = new Date().getTime(); |
||||
this.http.post(environment.orderUrl + 'afterSales/finish', param).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
} |
@ -1,39 +0,0 @@ |
||||
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 OrderCouponService { |
||||
|
||||
constructor(private http: HttpClient) { } |
||||
|
||||
/** |
||||
* 查询订单列表 |
||||
* @param param |
||||
* @param callBack |
||||
*/ |
||||
public queryList(param: any, callBack:any) { |
||||
param.time = new Date().getTime(); |
||||
this.http.get(environment.orderUrl + 'coupon/queryList?'+ObjectData.objectByString(param)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 查询订单详情 |
||||
* @param param |
||||
* @param callBack |
||||
*/ |
||||
public queryDetail(orderChildNo: string, callBack:any) { |
||||
let params = { |
||||
orderChildNo: orderChildNo, |
||||
time: new Date().getTime() |
||||
}; |
||||
this.http.get(environment.orderUrl + 'coupon/queryDetail?'+ObjectData.objectByString(params)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
} |
@ -1,35 +0,0 @@ |
||||
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 OrderGoodsService { |
||||
|
||||
constructor(private http: HttpClient) { } |
||||
|
||||
/** |
||||
* 查询订单列表 |
||||
* @param param |
||||
* @param callBack |
||||
*/ |
||||
public getListGoods(param: object, callBack:any) { |
||||
this.http.get(environment.orderUrl + 'orderGoods/getListGoods?'+ObjectData.objectByString(param)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
public updateLogisticsNo(params: object, callBack:any) { |
||||
this.http.post(environment.orderUrl + 'orderGoods/updateLogisticsNo', params).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
|
||||
public getLogisticsMsg(param: object, callBack:any) { |
||||
this.http.get(environment.orderUrl + 'orderGoods/getLogisticsMsg?'+ObjectData.objectByString(param)).subscribe(data => { |
||||
callBack(data); |
||||
}); |
||||
} |
||||
} |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.5 KiB |
Loading…
Reference in new issue