diff --git a/src/app/pages/goods/goods-type/goods-type.component.html b/src/app/pages/goods/goods-type/goods-type.component.html index 98041ce..fcb259b 100644 --- a/src/app/pages/goods/goods-type/goods-type.component.html +++ b/src/app/pages/goods/goods-type/goods-type.component.html @@ -1,5 +1,22 @@ - - +
+
+
+ + 类目名称 + + + + +
+ +
+ + + +
+
+
+

@@ -44,10 +61,6 @@ - - - - diff --git a/src/app/pages/goods/goods-type/goods-type.component.ts b/src/app/pages/goods/goods-type/goods-type.component.ts index 9670e96..35755ae 100644 --- a/src/app/pages/goods/goods-type/goods-type.component.ts +++ b/src/app/pages/goods/goods-type/goods-type.component.ts @@ -93,7 +93,7 @@ export class GoodsTypeComponent { // 上传是否展示 previewVisible = false; nodes = []; - + searchForm: FormGroup; constructor( private fb: NonNullableFormBuilder, private commonService: CommonService, @@ -101,6 +101,11 @@ export class GoodsTypeComponent { private msg: NzMessageService ) { + // 初始化搜索框 + this.searchForm = this.fb.group({ + title: [''], + }); + this.getRequest(); // 菜单类型 this.goodsTypeArray = new DictionaryPipe().getDictionaryList('GOODS_TYPE'); @@ -174,7 +179,8 @@ export class GoodsTypeComponent { // 搜索表单提交 getRequest(): void { this.loading = true; - this.goodsType.getList({time: new Date().getTime()}, (data: any) => { + this.searchForm.value.time = new Date().getTime(); + this.goodsType.getList(this.searchForm.value, (data: any) => { if (data['return_code'] === '000000') { this.listOfMapData = data['return_data']; this.getNode(this.listOfMapData); 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 index b853069..f4e0900 100644 --- 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 @@ -71,6 +71,7 @@ 京东价 原价 sku编码 + 操作 @@ -110,6 +112,35 @@ ¥{{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 index 6d5c351..5adee10 100644 --- 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 @@ -9,4 +9,5 @@ button { } .search-area { margin-top: 30px; + margin-bottom: 20px; } 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 index 39690dd..106cec9 100644 --- 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 @@ -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}); + } + }); + } + } + } diff --git a/src/app/services/goods/goods.service.ts b/src/app/services/goods/goods.service.ts index db48d1a..80c2602 100644 --- a/src/app/services/goods/goods.service.ts +++ b/src/app/services/goods/goods.service.ts @@ -139,6 +139,11 @@ export class GoodsService { }); } + public jdPriceUpdate(params: object, callBack:any) { + this.http.post(environment.baseUrl + 'goods/jdPriceUpdate', params).subscribe(data => { + callBack(data); + }); + } /** * 获取商品规格列表 * @param params diff --git a/src/app/utils/Interceptor.service.ts b/src/app/utils/Interceptor.service.ts index 44c48c9..61e5587 100644 --- a/src/app/utils/Interceptor.service.ts +++ b/src/app/utils/Interceptor.service.ts @@ -71,7 +71,6 @@ export class InterceptorService implements HttpInterceptor { jumpError(message: string , status: number) { if (status == 401) { this.router.navigateByUrl('/error/401').then(r => console.log("返回内容" ,r)); - } if (status == 403) { this.router.navigateByUrl('/error/403').then(r => console.log("返回内容" ,r)); diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 51971d1..36c3d1e 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -7,14 +7,14 @@ export const environment = { // baseUrl: 'https://phg.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) // orderUrl: 'https://phg.dctpay.com/order/', // 测试环境服务器地址(请求数据地址) // userUrl: 'https://phg.dctpay.com/user/', // 测试环境服务器地址(请求数据地址) - // imageUrl: 'https://phg.obs.cn-southwest-2.myhuaweicloud.com/', + imageUrl: 'https://phg.obs.cn-southwest-2.myhuaweicloud.com/', // baseUrl: 'http://localhost:9702/brest/', // 测试环境服务器地址(请求数据地址) orderUrl: 'http://localhost:9703/order/', // 测试环境服务器地址(请求数据地址) userUrl: 'http://localhost:9704/user/', // 测试环境服务器地址(请求数据地址) // userUrl: 'https://phgcs.dctpay.com/user/', // 测试环境服务器地址(请求数据地址) - imageUrl: 'https://phg-test.obs.cn-southwest-2.myhuaweicloud.com/', + // imageUrl: 'https://phg-test.obs.cn-southwest-2.myhuaweicloud.com/', }; /*