From cf5d1c0a4dddc3522a8f34eda81ebfc4f3052ba1 Mon Sep 17 00:00:00 2001 From: yuanye <418471657@qq.com> Date: Wed, 8 Dec 2021 17:05:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../discount-package-edit.component.html | 2 +- .../discount-package-list.component.html | 33 ++++++-- .../discount-package-list.component.ts | 40 +++++++++- .../discount-package-routing.module.ts | 2 + .../discount-package.module.ts | 3 +- .../inventory-record.component.html | 67 ++++++++++++++++ .../inventory-record.component.scss | 0 .../inventory-record.component.ts | 79 +++++++++++++++++++ src/app/services/discount-package.service.ts | 27 +++++++ 9 files changed, 242 insertions(+), 11 deletions(-) create mode 100644 src/app/admin/discount-package/inventory-record/inventory-record.component.html create mode 100644 src/app/admin/discount-package/inventory-record/inventory-record.component.scss create mode 100644 src/app/admin/discount-package/inventory-record/inventory-record.component.ts diff --git a/src/app/admin/discount-package/discount-package-edit/discount-package-edit.component.html b/src/app/admin/discount-package/discount-package-edit/discount-package-edit.component.html index a1b4812..f68bd54 100644 --- a/src/app/admin/discount-package/discount-package-edit/discount-package-edit.component.html +++ b/src/app/admin/discount-package/discount-package-edit/discount-package-edit.component.html @@ -162,7 +162,7 @@
- +
diff --git a/src/app/admin/discount-package/discount-package-list/discount-package-list.component.html b/src/app/admin/discount-package/discount-package-list/discount-package-list.component.html index aba5d46..9dda782 100644 --- a/src/app/admin/discount-package/discount-package-list/discount-package-list.component.html +++ b/src/app/admin/discount-package/discount-package-list/discount-package-list.component.html @@ -86,8 +86,10 @@ 销售价格 限购数量 创建时间 - 活动状态 - 操作 + 总库存 + 剩余库存 + 状态 + 操作 @@ -98,15 +100,22 @@ {{data.price === null ? '暂无': data.price}} {{data.purchaseNum === null? '暂无': data.purchaseNum}} {{data.createdTime | date: 'yyyy-MM-dd HH:mm'}} + {{data.totalStock == null ? 0:data.totalStock }} + {{data.surplusStock == null ? 0:data.surplusStock }} {{data.status | discountPackageStatus}} - 编辑 - 详情 + 详情 - 上架 - 下架 - - 删除 + 更多 + + + @@ -130,3 +139,11 @@ + + + 数量 + + + + + diff --git a/src/app/admin/discount-package/discount-package-list/discount-package-list.component.ts b/src/app/admin/discount-package/discount-package-list/discount-package-list.component.ts index 1e5c09a..d95437f 100644 --- a/src/app/admin/discount-package/discount-package-list/discount-package-list.component.ts +++ b/src/app/admin/discount-package/discount-package-list/discount-package-list.component.ts @@ -26,7 +26,9 @@ export class DiscountPackageListComponent implements OnInit { loading = true; listOfData = []; isVisible = false; - + isVisibleInventory = false; + id: number; + num: number; constructor( private form: FormBuilder, private company: CompanyService, @@ -49,6 +51,7 @@ export class DiscountPackageListComponent implements OnInit { salesType: [null], usingAttribution: [null], recordNo: [null], + status: [null], phone: [null], }); this.getRequest(true, this.searchForm.value); @@ -146,6 +149,41 @@ export class DiscountPackageListComponent implements OnInit { }); } + // 增加库存 + public addInventory(id: number): void { + this.id = id; + this.isVisibleInventory = true; + } + + + handleCancelInventory(): void { + this.isVisibleInventory = false; + } + + handleOkdInventory(): void { + + if (this.num == null || this.num === 0) { + this.message.error('请输入新增库存数量'); + return; + } + + + const param = { + num: this.num, + discountPackageId: this.id + }; + const id = this.message.loading('增加库存中..', { nzDuration: 0 }).messageId; + this.discountPackage.addDiscountPackageStock(param , data => { + if (data['return_code'] === '000000') { + this.isVisibleInventory = false; + this.getRequest(true, this.searchForm.value); + this.message.success('新增成功'); + } else { + this.message.create('error', data['return_msg']); + } + this.message.remove(id); + }); + } } diff --git a/src/app/admin/discount-package/discount-package-routing.module.ts b/src/app/admin/discount-package/discount-package-routing.module.ts index 527d51b..fdf1554 100644 --- a/src/app/admin/discount-package/discount-package-routing.module.ts +++ b/src/app/admin/discount-package/discount-package-routing.module.ts @@ -2,11 +2,13 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import {DiscountPackageListComponent} from './discount-package-list/discount-package-list.component'; import {DiscountPackageEditComponent} from './discount-package-edit/discount-package-edit.component'; +import {InventoryRecordComponent} from './inventory-record/inventory-record.component'; const routes: Routes = [ { path: 'discount-package-list', component: DiscountPackageListComponent }, { path: 'discount-package-edit', component: DiscountPackageEditComponent }, + { path: 'inventory-record', component: InventoryRecordComponent }, ]; @NgModule({ diff --git a/src/app/admin/discount-package/discount-package.module.ts b/src/app/admin/discount-package/discount-package.module.ts index 1756814..031ac06 100644 --- a/src/app/admin/discount-package/discount-package.module.ts +++ b/src/app/admin/discount-package/discount-package.module.ts @@ -10,10 +10,11 @@ import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module'; import {RegionSelectorModule} from '../../common/region-selector/region-selector.module'; import {AppCommonModule} from '../../app-common.module'; import { DiscountPackageEditComponent } from './discount-package-edit/discount-package-edit.component'; +import { InventoryRecordComponent } from './inventory-record/inventory-record.component'; @NgModule({ - declarations: [DiscountPackageListComponent, DiscountPackageEditComponent], + declarations: [DiscountPackageListComponent, DiscountPackageEditComponent, InventoryRecordComponent], imports: [ CommonModule, DiscountPackageRoutingModule, diff --git a/src/app/admin/discount-package/inventory-record/inventory-record.component.html b/src/app/admin/discount-package/inventory-record/inventory-record.component.html new file mode 100644 index 0000000..580bbaa --- /dev/null +++ b/src/app/admin/discount-package/inventory-record/inventory-record.component.html @@ -0,0 +1,67 @@ + + + + + +
+
+
+
+ + 优惠券包名称 + + + + +
+
+ +
+
+ + +
+
+
+
+ + +
+ 共计 {{total}} 条数据 + + + + + 编号 + 优惠券标题 + 当前库存数量 + 销售价格 + 原库存数量 + 创建时间 + + + + + {{i+1}} + {{data.discountPackageTitle}} + {{data.nowStockNum === null ? '0': data.nowStockNum}} + {{data.frontStockNum === null ? '0': data.frontStockNum}} + {{data.stockNum === null ? '0': data.stockNum}} + {{data.createdTime | date: 'yyyy-MM-dd HH:mm'}} + + +
+ + diff --git a/src/app/admin/discount-package/inventory-record/inventory-record.component.scss b/src/app/admin/discount-package/inventory-record/inventory-record.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/admin/discount-package/inventory-record/inventory-record.component.ts b/src/app/admin/discount-package/inventory-record/inventory-record.component.ts new file mode 100644 index 0000000..18c3c5e --- /dev/null +++ b/src/app/admin/discount-package/inventory-record/inventory-record.component.ts @@ -0,0 +1,79 @@ +import { Component, OnInit } from '@angular/core'; +import {environment} from '../../../../environments/environment'; +import {FormBuilder, FormGroup} from '_@angular_forms@9.0.7@@angular/forms'; +import {CompanyService} from '../../../services/company.service'; +import {ActivateService} from '../../../services/activate.service'; +import {IconService} from '../../../services/icon.service'; +import {NzMessageService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; +import {Router} from '_@angular_router@9.0.7@@angular/router'; +import {CommonsService} from '../../../services/commons.service'; +import {DiscountPackageService} from '../../../services/discount-package.service'; + +@Component({ + selector: 'app-inventory-record', + templateUrl: './inventory-record.component.html', + styleUrls: ['./inventory-record.component.scss'] +}) +export class InventoryRecordComponent implements OnInit { + + WEB_SERVE_URL = environment.imageUrl; + searchForm: FormGroup; // 搜索框 + requestData = []; // 列表数据 + usingAttribution = []; // 列表数据 + total: number; // 页码 + pageNum = 1; // 页码 + pageSize = 10; // 条码 + loading = true; + listOfData = []; + isVisible = false; + isVisibleInventory = false; + id: number; + num: number; + constructor( + private form: FormBuilder, + private company: CompanyService, + private activate: ActivateService, + private iconService: IconService, + private message: NzMessageService, + private router: Router, + private discountPackage: DiscountPackageService, + ) { + } + + ngOnInit(): void { + this.init(); + } + + public init(): void { + this.searchForm = this.form.group({ + title: [null], + }); + this.getRequest(true, this.searchForm.value); + + } + + // 查询列表 + public getRequest(reset: boolean = false, whereObject: object) { + + this.loading = false; + if (reset) { + this.pageNum = 1; + } + whereObject['pageNum'] = this.pageNum; + whereObject['pageSize'] = this.pageSize; + this.discountPackage.getDiscountInventoryRecordServList(whereObject, data => { + if (data['return_code'] === '000000') { + this.requestData = data['return_data'].list; + this.total = data['return_data'].total; + } else { + this.message.error(data['return_msg']); + } + }); + } + + // 重置 + public resetForm(): void { + this.searchForm.reset(); + } + +} diff --git a/src/app/services/discount-package.service.ts b/src/app/services/discount-package.service.ts index c72d2f9..3c6abcb 100644 --- a/src/app/services/discount-package.service.ts +++ b/src/app/services/discount-package.service.ts @@ -153,5 +153,32 @@ export class DiscountPackageService { }); } + /** + * @Author Sum1Dream + * @methodName addDiscountPackageStock + * @Description // 新增库存 + * @Date 4:47 下午 2021/12/8 + * @Param [param: object, callBack] + */ + public addDiscountPackageStock(param: object, callBack) { + this.http.post(environment.baseUrl + 'highDiscountPackage/addDiscountPackageStock', param).subscribe(data => { + callBack(data); + }); + } + + + /** + * @Author Sum1Dream + * @methodName getDiscountInventoryRecordServList + * @Description // 查询补库记录 + * @Date 4:48 下午 2021/12/8 + * @Param [paramsObject: object, callBack] + */ + public getDiscountInventoryRecordServList(paramsObject: object, callBack) { + this.http.get(environment.baseUrl + 'highDiscountPackage/getDiscountInventoryRecordServList?' + this.common.getWhereCondition(paramsObject)).subscribe(data => { + callBack(data); + }); + } + }