袁野 2 months ago
parent 952f12f281
commit 28f93f9a92
  1. 12
      src/app/pages/body/index/index.component.ts
  2. 2
      src/app/pages/goods/goods.routes.ts
  3. 93
      src/app/pages/goods/jd-goods-list/jd-goods-list.component.html
  4. 12
      src/app/pages/goods/jd-goods-list/jd-goods-list.component.less
  5. 211
      src/app/pages/goods/jd-goods-list/jd-goods-list.component.ts
  6. 5
      src/app/pages/trade/goods-list/goods-list.component.html
  7. 2
      src/app/pages/trade/goods-list/goods-list.component.ts
  8. 17
      src/app/services/common/validators.service.ts
  9. 17
      src/app/services/goods/goods.service.ts

@ -61,6 +61,7 @@ import {
NzFormTooltipIcon
} from "ng-zorro-antd/form";
import {NzInputDirective, NzInputGroupComponent} from "ng-zorro-antd/input";
import {MyValidators} from "../../../services/common/validators.service";
@Component({
selector: 'app-index',
@ -170,7 +171,6 @@ export class IndexComponent {
private router: Router, // 路由
private login: LoginService
) {
this.validateForm = this.fb.group({
oldPassword: ['', [Validators.required]],
newPassword: ['', [Validators.required]],
@ -233,6 +233,15 @@ export class IndexComponent {
submitForm(): void {
if (this.validateForm.valid) {
if (this.validateForm.value.newPassword != null) {
const isWeak = /(?=.*[0-9])(?=.*[a-zA-Z])([^]{8,})/.test(this.validateForm.value.newPassword );
console.log("是否弱密码!" , this.validateForm.value.newPassword)
console.log("是否弱密码!" , isWeak)
if (!isWeak) {
this.message.error('密码强度太弱,请重新输入');
return;
}
}
this.login.sendUserPass( this.validateForm.value , (data: any) => {
if (data['return_code'] === '000000') {
this.storage.remove(LOGIN_DATA);
@ -364,5 +373,4 @@ export class IndexComponent {
this.visibleUpdatePwd = true;
}
}

@ -3,12 +3,14 @@ import {GoodsTypeComponent} from "./goods-type/goods-type.component";
import {GoodsBrandComponent} from "./goods-brand/goods-brand.component";
import {GoodsListComponent} from "./goods-list/goods-list.component";
import {PriceListComponent} from "./recharge/price-list/price-list.component";
import {JdGoodsListComponent} from "./jd-goods-list/jd-goods-list.component";
export const GOODS_ROUTES: Routes = [
{ path: 'goods_type', component: GoodsTypeComponent},
{ path: 'goods_brand', component: GoodsBrandComponent},
{ path: 'goods-list', component: GoodsListComponent},
{ path: 'jd-goods-list', component: JdGoodsListComponent},
{ path: 'recharge-price', component: PriceListComponent},
];

@ -0,0 +1,93 @@
<form nz-form [formGroup]="searchForm" class="search_form" [nzLayout]="'vertical'">
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="8">
<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]="8">
<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]="8">
<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]="8">
<nz-form-item>
<nz-form-label>价格区间</nz-form-label>
<nz-form-control>
<nz-space nzDirection="vertical" style="width: 100%">
<nz-input-number-group *nzSpaceItem nzCompact>
<nz-input-number formControlName="salePriceS" [nzPrecision]="2" style="width: 50%"></nz-input-number>
<nz-input-number formControlName="salePriceE" [nzPrecision]="2" style="width: 50%"></nz-input-number>
</nz-input-number-group>
</nz-space>
</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)="getExport()">导出</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="50px">sku编码</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of basicTable.data">
<td>{{data.goodsTypeParentName}}</td>
<td>{{data.goodsTypeName}}</td>
<td>{{data.goodsBrandName}}</td>
<td>{{data.title}}</td>
<td>
<img nz-image width="60px" height="60px" nzSrc="{{data.listImg }}" [nzFallback]="fallbackImg" alt="" />
</td>
<td>¥{{data.salePrice}}</td>
<td>¥{{data.thirdPrice}}</td>
<td>¥{{data.originalPrice}}</td>
<td>{{data.thirdId}}</td>
</tr>
</tbody>
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template>

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

@ -0,0 +1,211 @@
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, 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 {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown";
import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu";
import {
NzInputNumberComponent,
NzInputNumberGroupComponent,
NzInputNumberGroupWhitSuffixOrPrefixDirective, NzInputNumberModule
} from "ng-zorro-antd/input-number";
import {NzSpaceComponent, NzSpaceItemDirective} from "ng-zorro-antd/space";
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker";
import {NzTypographyComponent} from "ng-zorro-antd/typography";
import {Observable, Observer} from "rxjs";
import {BrowserStorageService} from "../../../utils/localStorage.service";
import {DATA} from "../../../data/login/localStorage.namespace";
import {MerService} from "../../../services/merchant/mer.service";
import {CommunicationService} from "../../../services/common/communication.service";
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,
NzInputNumberModule,
NzDropdownMenuComponent,
NzMenuDirective,
NzMenuItemComponent,
NzInputNumberComponent,
NzInputNumberGroupWhitSuffixOrPrefixDirective,
NzSpaceItemDirective,
NzInputNumberGroupComponent,
NzDatePickerComponent,
NzTypographyComponent,
NzSpaceComponent
],
templateUrl: './jd-goods-list.component.html',
styleUrl: './jd-goods-list.component.less'
})
export class JdGoodsListComponent {
// 表单页数
tablePageNum = 1;
// 表单数据
tableData: any = {
total: 0,
loading: false,
list: [],
};
// 搜索表单
searchForm: FormGroup;
// 展示图片
previewImage: string | undefined = '';
// 上传是否展示
previewVisible = false;
loadingSpecs = false;
// 商品类型数据
nodes = [];
nodesBrand = [];
nodesSpecs: SpecsData[] = [];
protected readonly fallbackImg = fallbackImg;
constructor(private fb: NonNullableFormBuilder,
private msg: NzMessageService,
private communicationService: CommunicationService,
private goodsService: GoodsService) {
// 初始化搜索框
this.searchForm = this.fb.group({
title: [''],
goodsType: [''],
goodsBrand: [''],
salePriceS: [''],
salePriceE: [''],
});
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.getJdGoodsList(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'];
}
});
}
// 订单导出
public getExport() {
this.searchForm.value.time = new Date().getTime();
this.goodsService.exportJdGoods(this.searchForm.value , (data: any) => {
if (data['return_code'] == '000000') {
this.communicationService.sendMessage(data['return_data']);
} else {
this.msg.error(data['return_msg']);
}
this.tableData.loading = false;
});
}
}

@ -275,10 +275,7 @@
</nz-tab>
<nz-tab nzTitle="发货信息">
<nz-descriptions nzTitle="发货信息" nzBordered>
<nz-descriptions-item nzTitle="收货人">{{deliveryAddress?.consignee}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="收货电话">{{ deliveryAddress?.phone }}</nz-descriptions-item>
<nz-descriptions-item nzTitle="发货信息" [nzSpan]="3">{{ deliveryAddress?.regionName }} -{{deliveryAddress?.consignee}} -{{ deliveryAddress?.phone }} -{{ deliveryAddress?.address }}</nz-descriptions-item>
<nz-descriptions-item nzTitle="发货信息" [nzSpan]="3">{{ orderGoodsData?.deliveryAddress }}</nz-descriptions-item>
</nz-descriptions>
</nz-tab>
</nz-tabset>

@ -268,7 +268,7 @@ export class GoodsListComponent {
showDetail(data: OrderGoodsData): void {
this.orderGoodsData = data;
this.findDeliveryAddressById(data.deliveryAddressId);
// this.findDeliveryAddressById(data.deliveryAddressId);
this.orderDetailModal = true;
}

@ -25,6 +25,18 @@ export class MyValidators extends Validators {
};
}
static checkIfWeakPassword(control: AbstractControl): MyValidationErrors | null {
const value = control.value;
if (isEmptyInputValue(value)) {
return null;
}
return isPassword(value)
? null
:{ weakPassword: { 'zh-cn': `密码强度太弱`, en: `Password is too weak` }} ;
}
static mobile(control: AbstractControl): MyValidationErrors | null {
const value = control.value;
@ -45,3 +57,8 @@ function isEmptyInputValue(value: NzSafeAny): boolean {
function isMobile(value: string): boolean {
return typeof value === 'string' && /(^1\d{10}$)/.test(value);
}
function isPassword(value: string): boolean {
return typeof value === 'string' && /^\d+$/.test(value);
}

@ -94,6 +94,23 @@ export class GoodsService {
});
}
public getJdGoodsList(params: object, callBack:any) {
this.http.get(environment.baseUrl + 'goods/getJdGoodsList?' + ObjectData.objectByString(params)).subscribe(data => {
callBack(data);
});
}
/**
*
* @param param
* @param callBack
*/
public exportJdGoods(param: object, callBack:any) {
this.http.get(environment.baseUrl + 'goods/exportJdGoods?'+ObjectData.objectByString(param)).subscribe(data => {
callBack(data);
});
}
/**
*
* @param params

Loading…
Cancel
Save