|
|
|
@ -5,7 +5,7 @@ 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} from "@angular/forms"; |
|
|
|
|
import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms"; |
|
|
|
|
import {NzUploadComponent} from "ng-zorro-antd/upload"; |
|
|
|
|
import {NzMessageService} from "ng-zorro-antd/message"; |
|
|
|
|
import {GoodsService} from "../../../services/goods/goods.service"; |
|
|
|
@ -102,7 +102,9 @@ export class JdGoodsListComponent { |
|
|
|
|
}; |
|
|
|
|
// 搜索表单
|
|
|
|
|
searchForm: FormGroup; |
|
|
|
|
|
|
|
|
|
// 京东价格修改
|
|
|
|
|
jdPriceForm: FormGroup; |
|
|
|
|
editPrice = false; |
|
|
|
|
|
|
|
|
|
// 展示图片
|
|
|
|
|
previewImage: string | undefined = ''; |
|
|
|
@ -113,7 +115,6 @@ export class JdGoodsListComponent { |
|
|
|
|
// 商品类型数据
|
|
|
|
|
nodes = []; |
|
|
|
|
nodesBrand = []; |
|
|
|
|
nodesSpecs: SpecsData[] = []; |
|
|
|
|
|
|
|
|
|
protected readonly fallbackImg = fallbackImg; |
|
|
|
|
|
|
|
|
@ -131,7 +132,12 @@ export class JdGoodsListComponent { |
|
|
|
|
salePriceS: [''], |
|
|
|
|
salePriceE: [''], |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// 初始化
|
|
|
|
|
this.jdPriceForm = this.fb.group({ |
|
|
|
|
automaticPrice: ['', [Validators.required]], |
|
|
|
|
salePrice: ['', [Validators.required]], |
|
|
|
|
thirdId: [''], |
|
|
|
|
}); |
|
|
|
|
this.getRequest(); |
|
|
|
|
this.checkAccountBalance(); |
|
|
|
|
this.getGoodsTypeNode(); |
|
|
|
@ -217,4 +223,32 @@ export class JdGoodsListComponent { |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
showEditSpecs(item: any) { |
|
|
|
|
this.editPrice = true; |
|
|
|
|
this.jdPriceForm.patchValue(item); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
handleEditPrice(): void { |
|
|
|
|
console.log("数据" , this.jdPriceForm.value); |
|
|
|
|
if (this.jdPriceForm.valid) { |
|
|
|
|
|
|
|
|
|
this.goodsService.jdPriceUpdate(this.jdPriceForm.value, (data: any) => { |
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
this.msg.success("成功!"); |
|
|
|
|
this.editPrice = false; |
|
|
|
|
this.getRequest(false); |
|
|
|
|
} else { |
|
|
|
|
this.msg.error(data['return_msg']); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
Object.values(this.jdPriceForm.controls).forEach(control => { |
|
|
|
|
if (control.invalid) { |
|
|
|
|
control.markAsDirty(); |
|
|
|
|
control.updateValueAndValidity({onlySelf: true}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|