提交修改

pull/1/head
袁野 3 years ago
parent 9d87bc02fd
commit cf5d1c0a4d
  1. 2
      src/app/admin/discount-package/discount-package-edit/discount-package-edit.component.html
  2. 33
      src/app/admin/discount-package/discount-package-list/discount-package-list.component.html
  3. 40
      src/app/admin/discount-package/discount-package-list/discount-package-list.component.ts
  4. 2
      src/app/admin/discount-package/discount-package-routing.module.ts
  5. 3
      src/app/admin/discount-package/discount-package.module.ts
  6. 67
      src/app/admin/discount-package/inventory-record/inventory-record.component.html
  7. 0
      src/app/admin/discount-package/inventory-record/inventory-record.component.scss
  8. 79
      src/app/admin/discount-package/inventory-record/inventory-record.component.ts
  9. 27
      src/app/services/discount-package.service.ts

@ -162,7 +162,7 @@
</div>
<div nz-row>
<div nz-col [nzSpan]="24" class="search-area">
<button nz-button [nzType]="'primary'" (click)="pre()">上一步</button>
<button nz-button *ngIf="current == 1" [nzType]="'primary'" (click)="pre()">上一步</button>
<button nz-button [nzType]="'primary'" (click)="getNest()">{{current == 0 ? '下一步': '提交'}}</button>
</div>
</div>

@ -86,8 +86,10 @@
<th nzWidth="70px">销售价格</th>
<th nzWidth="70px">限购数量</th>
<th nzWidth="100px">创建时间</th>
<th nzWidth="80px" nzRight>活动状态</th>
<th nzWidth="120px" nzRight>操作</th>
<th nzWidth="70px" nzRight>总库存</th>
<th nzWidth="70px" nzRight>剩余库存</th>
<th nzWidth="70px" nzRight>状态</th>
<th nzWidth="100px" nzRight>操作</th>
</tr>
</thead>
<tbody>
@ -98,15 +100,22 @@
<td>{{data.price === null ? '暂无': data.price}}</td>
<td>{{data.purchaseNum === null? '暂无': data.purchaseNum}}</td>
<td>{{data.createdTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td nzRight>{{data.totalStock == null ? 0:data.totalStock }}</td>
<td nzRight>{{data.surplusStock == null ? 0:data.surplusStock }}</td>
<td nzRight>{{data.status | discountPackageStatus}}</td>
<td nzRight class="table-td-operation">
<a *ngIf="data.status == 2 || data.status == 3" (click)="getEdit(data.id)">编辑</a>
<a (click)="getDetails(data.id)" *ngIf="data.status == 1">详情</a>
<a (click)="getDetails(data.id)">详情</a>
<nz-divider nzType="vertical" ></nz-divider>
<a (click)="upDiscountPackage(data.id)" *ngIf="data.status == 2 || data.status == 3">上架</a>
<a (click)="downDiscountPackage(data.id)" *ngIf="data.status == 1">下架</a>
<nz-divider *ngIf="data.status == 2 || data.status == 3" nzType="vertical"></nz-divider>
<a (click)="deleteDiscountPackage(data.id)" *ngIf="data.status == 2 || data.status == 3">删除</a>
<a nz-dropdown [nzDropdownMenu]="menu">更多</a>
<nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu nzSelectable>
<li class="li-a" *ngIf="data.status == 2 || data.status == 3" nz-menu-item><a (click)="getEdit(data.id)">编辑</a></li>
<li class="li-a" *ngIf="data.status == 2 || data.status == 3" nz-menu-item><a (click)="addInventory(data.id)" >增加库存</a></li>
<li class="li-a" *ngIf="data.status == 2 || data.status == 3" nz-menu-item><a (click)="upDiscountPackage(data.id)" >上架</a></li>
<li class="li-a" *ngIf="data.status == 1" nz-menu-item><a (click)="downDiscountPackage(data.id)">下架</a></li>
<li class="li-a" *ngIf="data.status == 2 || data.status == 3" nz-menu-item><a (click)="deleteDiscountPackage(data.id)">删除</a></li>
</ul>
</nz-dropdown-menu>
</td>
</tbody>
</nz-table>
@ -130,3 +139,11 @@
</nz-table>
</nz-modal>
<nz-modal [(nzVisible)]="isVisibleInventory" nzTitle="增加库存" (nzOnCancel)="handleCancelInventory()" (nzOnOk)="handleOkdInventory()">
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>数量</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请输入数量">
<input nz-input type="number" [(ngModel)]="num" placeholder="请输入数量" />
</nz-form-control>
</nz-form-item>
</nz-modal>

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

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

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

@ -0,0 +1,67 @@
<!-- start 面包屑 -->
<app-breadcrumb></app-breadcrumb>
<!-- end 面包屑 -->
<!--条件搜索-->
<div class="inner-content">
<form nz-form [formGroup]="searchForm" (ngSubmit)="getRequest(true , searchForm.value)">
<div nz-row>
<div nz-col nzSpan="8">
<nz-form-item>
<nz-form-label [nzSpan]="6">优惠券包名称</nz-form-label>
<nz-form-control [nzSpan]="16">
<input nz-input formControlName="title"/>
</nz-form-control>
</nz-form-item>
</div>
</div>
<div nz-row>
<div nz-col nzSpan="24" class="search-button">
<button nz-button nzType="primary"><i nz-icon nzType="search" nzTheme="outline"></i>搜索</button>
<button nz-button nzType="default" (click)="resetForm()"><i nz-icon nzType="reload" nzTheme="outline"></i>重置</button>
</div>
</div>
</form>
</div>
<div class="inner-content">
<span>共计 {{total}} 条数据</span>
<nz-table
class="table"
#ajaxTable
nzShowSizeChanger
[nzFrontPagination]="false"
[nzData]="requestData"
[nzLoading]="loading"
[nzTotal]="total"
[(nzPageIndex)]="pageNum"
[(nzPageSize)]="pageSize"
[nzScroll]="{ x: '1200px' }"
(nzPageIndexChange)="getRequest(false , searchForm.value)"
(nzPageSizeChange)="getRequest(false , searchForm.value)">
<thead nzSingleSort>
<tr>
<th nzWidth="50px">编号</th>
<th nzWidth="150px">优惠券标题</th>
<th nzWidth="70px">当前库存数量</th>
<th nzWidth="70px">销售价格</th>
<th nzWidth="70px">原库存数量</th>
<th nzWidth="100px">创建时间</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of ajaxTable.data; let i = index">
<td>{{i+1}}</td>
<td>{{data.discountPackageTitle}}</td>
<td>{{data.nowStockNum === null ? '0': data.nowStockNum}}</td>
<td>{{data.frontStockNum === null ? '0': data.frontStockNum}}</td>
<td>{{data.stockNum === null ? '0': data.stockNum}}</td>
<td>{{data.createdTime | date: 'yyyy-MM-dd HH:mm'}}</td>
</tbody>
</nz-table>
</div>

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

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

Loading…
Cancel
Save