diff --git a/src/app/pages/body/index/index.component.ts b/src/app/pages/body/index/index.component.ts index 41b08da..1170162 100644 --- a/src/app/pages/body/index/index.component.ts +++ b/src/app/pages/body/index/index.component.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; } - } diff --git a/src/app/pages/goods/goods.routes.ts b/src/app/pages/goods/goods.routes.ts index 6bfdd09..aa82294 100644 --- a/src/app/pages/goods/goods.routes.ts +++ b/src/app/pages/goods/goods.routes.ts @@ -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}, ]; diff --git a/src/app/pages/goods/jd-goods-list/jd-goods-list.component.html b/src/app/pages/goods/jd-goods-list/jd-goods-list.component.html new file mode 100644 index 0000000..00cde13 --- /dev/null +++ b/src/app/pages/goods/jd-goods-list/jd-goods-list.component.html @@ -0,0 +1,93 @@ +
+
+
+ + 商品名称 + + + + +
+
+ + 商品分类 + + + + +
+
+ + 商品品牌 + + + + + + +
+
+ + 价格区间 + + + + + + + + + +
+ +
+ + + +
+
+
+ + + + + 一级分类 + 二级分类 + 品牌名称 + 商品名称 + 列表图 + 售卖价格 + 京东价 + 原价 + sku编码 + + + + + {{data.goodsTypeParentName}} + {{data.goodsTypeName}} + {{data.goodsBrandName}} + {{data.title}} + + + + ¥{{data.salePrice}} + ¥{{data.thirdPrice}} + ¥{{data.originalPrice}} + {{data.thirdId}} + + + 总计 {{ total }} 条 diff --git a/src/app/pages/goods/jd-goods-list/jd-goods-list.component.less b/src/app/pages/goods/jd-goods-list/jd-goods-list.component.less new file mode 100644 index 0000000..6d5c351 --- /dev/null +++ b/src/app/pages/goods/jd-goods-list/jd-goods-list.component.less @@ -0,0 +1,12 @@ +[nz-form-label] { + overflow: visible; +} +button { + margin-left: 8px; +} +.submit-btn { + width: 150px; +} +.search-area { + margin-top: 30px; +} diff --git a/src/app/pages/goods/jd-goods-list/jd-goods-list.component.ts b/src/app/pages/goods/jd-goods-list/jd-goods-list.component.ts new file mode 100644 index 0000000..3cb35d2 --- /dev/null +++ b/src/app/pages/goods/jd-goods-list/jd-goods-list.component.ts @@ -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 => + 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; + }); + } + +} diff --git a/src/app/pages/trade/goods-list/goods-list.component.html b/src/app/pages/trade/goods-list/goods-list.component.html index b0fec0b..a57d3d1 100644 --- a/src/app/pages/trade/goods-list/goods-list.component.html +++ b/src/app/pages/trade/goods-list/goods-list.component.html @@ -275,10 +275,7 @@ - {{deliveryAddress?.consignee}} - {{ deliveryAddress?.phone }} - {{ deliveryAddress?.regionName }} -{{deliveryAddress?.consignee}} -{{ deliveryAddress?.phone }} -{{ deliveryAddress?.address }} - + {{ orderGoodsData?.deliveryAddress }} diff --git a/src/app/pages/trade/goods-list/goods-list.component.ts b/src/app/pages/trade/goods-list/goods-list.component.ts index 63e10f9..328870a 100644 --- a/src/app/pages/trade/goods-list/goods-list.component.ts +++ b/src/app/pages/trade/goods-list/goods-list.component.ts @@ -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; } diff --git a/src/app/services/common/validators.service.ts b/src/app/services/common/validators.service.ts index 77d6c64..5197846 100644 --- a/src/app/services/common/validators.service.ts +++ b/src/app/services/common/validators.service.ts @@ -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); +} diff --git a/src/app/services/goods/goods.service.ts b/src/app/services/goods/goods.service.ts index 43993ef..4263100 100644 --- a/src/app/services/goods/goods.service.ts +++ b/src/app/services/goods/goods.service.ts @@ -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