袁野 2 months ago
parent 09ec482cd9
commit 83f0cffe7b
  1. 25
      src/app/pages/goods/goods-type/goods-type.component.html
  2. 10
      src/app/pages/goods/goods-type/goods-type.component.ts
  3. 31
      src/app/pages/goods/jd-goods-list/jd-goods-list.component.html
  4. 1
      src/app/pages/goods/jd-goods-list/jd-goods-list.component.less
  5. 42
      src/app/pages/goods/jd-goods-list/jd-goods-list.component.ts
  6. 5
      src/app/services/goods/goods.service.ts
  7. 1
      src/app/utils/Interceptor.service.ts
  8. 4
      src/environments/environment.ts

@ -1,5 +1,22 @@
<button nz-button (click)="showEditGoodsType()" nzType="primary">创建</button>
<button nz-button [nzType]="'default'" (click)="getRequest()">查询</button>
<form nz-form [formGroup]="searchForm" class="search_form" [nzLayout]="'vertical'">
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="6">
<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]="6" class="search-area">
<button nz-button [nzType]="'default'" (click)="getRequest()">查询</button>
<button nz-button (click)="searchForm.reset()">重置</button>
<button nz-button (click)="showEditGoodsType()" nzType="primary">创建</button>
</div>
</div>
</form>
<br />
<br />
<!--列表-->
@ -44,10 +61,6 @@
</tbody>
</nz-table>
<!--添加弹出框-->
<nz-modal [(nzVisible)]="isVisibleEdit" [nzMaskClosable] = false nzTitle="编辑类目" (nzOnCancel)="isVisibleEdit = false" (nzOnOk)="handleEdit()">
<ng-container *nzModalContent>

@ -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);

@ -71,6 +71,7 @@
</form>
<nz-table #basicTable
[nzScroll]="{ x: '1980px' }"
[nzBordered]="true"
[nzFrontPagination]="false"
[nzShowQuickJumper]="true"
@ -93,6 +94,7 @@
<th nzWidth="50px">京东价</th>
<th nzWidth="50px">原价</th>
<th nzWidth="50px">sku编码</th>
<th nzRight nzWidth="50px">操作</th>
</tr>
</thead>
<tbody>
@ -110,6 +112,35 @@
<td>¥{{data.thirdPrice}}</td>
<td>¥{{data.originalPrice}}</td>
<td>{{data.thirdId}}</td>
<td nzRight>
<a (click)="showEditSpecs(data)">修改价格</a>
</td>
</tr>
</tbody>
<ng-template #totalTemplate let-total>总计 {{ total }} 条</ng-template>
<!--添加弹出框-->
<nz-modal [(nzVisible)]="editPrice" [nzMaskClosable] = false nzTitle="编辑规格" (nzOnCancel)="editPrice = false" (nzOnOk)="handleEditPrice()">
<ng-container *nzModalContent>
<form nz-form [formGroup]="jdPriceForm">
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>售卖价格</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24" nzErrorTip="请输入售卖价格!">
<nz-input-number-group nzPrefix="¥" nzSuffix="RMB" style="width: 100%">
<nz-input-number formControlName="salePrice" [nzPrecision]="2"></nz-input-number>
</nz-input-number-group>
</nz-form-control>
</nz-form-item>
<nz-form-item >
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>自动更新价格</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24">
<nz-select nzSize="large" nzShowSearch nzAllowClear nzPlaceHolder="请选择" formControlName="automaticPrice" >
<nz-option nzLabel="更新" [nzValue]="1"></nz-option>
<nz-option nzLabel="不更新" [nzValue]="2"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</form>
</ng-container>
</nz-modal>

@ -9,4 +9,5 @@ button {
}
.search-area {
margin-top: 30px;
margin-bottom: 20px;
}

@ -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});
}
});
}
}
}

@ -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

@ -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));

@ -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/',
};
/*

Loading…
Cancel
Save