|
|
@ -36,6 +36,7 @@ import { |
|
|
|
import {NzSpaceItemDirective} from "ng-zorro-antd/space"; |
|
|
|
import {NzSpaceItemDirective} from "ng-zorro-antd/space"; |
|
|
|
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; |
|
|
|
import {NzDatePickerComponent} from "ng-zorro-antd/date-picker"; |
|
|
|
import {NzTypographyComponent} from "ng-zorro-antd/typography"; |
|
|
|
import {NzTypographyComponent} from "ng-zorro-antd/typography"; |
|
|
|
|
|
|
|
import {Observable, Observer} from "rxjs"; |
|
|
|
|
|
|
|
|
|
|
|
const getBase64 = (file: File): Promise<string | ArrayBuffer | null> => |
|
|
|
const getBase64 = (file: File): Promise<string | ArrayBuffer | null> => |
|
|
|
new Promise((resolve, reject) => { |
|
|
|
new Promise((resolve, reject) => { |
|
|
@ -135,6 +136,8 @@ export class GoodsListComponent { |
|
|
|
goodsMsg?: GoodsMsgData; |
|
|
|
goodsMsg?: GoodsMsgData; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected readonly fallbackImg = fallbackImg; |
|
|
|
protected readonly fallbackImg = fallbackImg; |
|
|
|
|
|
|
|
|
|
|
|
constructor(private fb: NonNullableFormBuilder, |
|
|
|
constructor(private fb: NonNullableFormBuilder, |
|
|
@ -145,6 +148,7 @@ export class GoodsListComponent { |
|
|
|
|
|
|
|
|
|
|
|
this.nodesVpdSource = new DictionaryPipe().getDictionaryList('GOODS_VPD_SOURCE'); |
|
|
|
this.nodesVpdSource = new DictionaryPipe().getDictionaryList('GOODS_VPD_SOURCE'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 初始化搜索框
|
|
|
|
// 初始化搜索框
|
|
|
|
this.searchForm = this.fb.group({ |
|
|
|
this.searchForm = this.fb.group({ |
|
|
|
title: [''], |
|
|
|
title: [''], |
|
|
@ -172,7 +176,7 @@ export class GoodsListComponent { |
|
|
|
originalPrice: ['' , [Validators.required]], |
|
|
|
originalPrice: ['' , [Validators.required]], |
|
|
|
stock: ['' , [Validators.required]], |
|
|
|
stock: ['' , [Validators.required]], |
|
|
|
validDay: ['' , [Validators.required]], |
|
|
|
validDay: ['' , [Validators.required]], |
|
|
|
salesEndTime: ['' , [Validators.required]], |
|
|
|
salesEndTime: [new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDay(), 23, 59, 59) , [Validators.required]], |
|
|
|
type: [''], |
|
|
|
type: [''], |
|
|
|
source: [''], |
|
|
|
source: [''], |
|
|
|
id: [null], |
|
|
|
id: [null], |
|
|
@ -389,7 +393,8 @@ export class GoodsListComponent { |
|
|
|
this.showImg = this.commonService.stitchImg(item.showImg); |
|
|
|
this.showImg = this.commonService.stitchImg(item.showImg); |
|
|
|
} |
|
|
|
} |
|
|
|
} else{ |
|
|
|
} else{ |
|
|
|
this.editSpecsForm.reset() |
|
|
|
this.showImg = []; |
|
|
|
|
|
|
|
this.editSpecsForm.reset(); |
|
|
|
} |
|
|
|
} |
|
|
|
this.editSpecs = true; |
|
|
|
this.editSpecs = true; |
|
|
|
} |
|
|
|
} |
|
|
@ -465,6 +470,25 @@ export class GoodsListComponent { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 图片上传操作
|
|
|
|
|
|
|
|
beforeUpload = (file: NzUploadFile, _fileList: NzUploadFile[]): Observable<boolean> => |
|
|
|
|
|
|
|
new Observable((observer: Observer<boolean>) => { |
|
|
|
|
|
|
|
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'; |
|
|
|
|
|
|
|
if (!isJpgOrPng) { |
|
|
|
|
|
|
|
this.msg.error('上传格式错误!'); |
|
|
|
|
|
|
|
observer.complete(); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
const isLt2M = file.size! / 1024 / 1024 < 5; |
|
|
|
|
|
|
|
if (!isLt2M) { |
|
|
|
|
|
|
|
this.msg.error('图片大小超过5MB!'); |
|
|
|
|
|
|
|
observer.complete(); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
observer.next(isJpgOrPng && isLt2M); |
|
|
|
|
|
|
|
observer.complete(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|