提交代码

master
胡锐 3 weeks ago
parent 1b860ac631
commit 5c735d392a
  1. 2
      src/app/app.config.ts
  2. 43
      src/app/pages/body/index/index.component.ts
  3. 56
      src/app/pages/discount-pk/discount-pk-edit/discount-pk-edit.component.html
  4. 10
      src/app/pages/discount-pk/discount-pk-edit/discount-pk-edit.component.less
  5. 52
      src/app/pages/discount-pk/discount-pk-edit/discount-pk-edit.component.ts
  6. 12
      src/app/pages/discount/discount-edit/discount-edit.component.html
  7. 8
      src/app/pages/discount/discount-edit/discount-edit.component.ts
  8. 2
      src/app/pages/discount/discount-list/discount-list.component.html
  9. 2
      src/app/pages/discount/discount-stock/discount-stock.component.ts
  10. 8
      src/environments/environment.dev.ts
  11. 2
      src/environments/environment.ts

@ -26,6 +26,6 @@ export const appConfig: ApplicationConfig = {
BrowserAnimationsModule, BrowserAnimationsModule,
InitGuardService, // 校验登录 InitGuardService, // 校验登录
{ provide: HTTP_INTERCEPTORS, useClass: InterceptorService, multi: true}, { provide: HTTP_INTERCEPTORS, useClass: InterceptorService, multi: true},
{ provide: RouteReuseStrategy, useClass: AiRouteReuseStrategy } /* { provide: RouteReuseStrategy, useClass: AiRouteReuseStrategy }*/
] ]
}; };

@ -1,4 +1,4 @@
import { Component } from '@angular/core'; import {Component, OnInit} from '@angular/core';
import {Router, RouterLink, RouterOutlet} from "@angular/router"; import {Router, RouterLink, RouterOutlet} from "@angular/router";
import { import {
NzContentComponent, NzContentComponent,
@ -55,7 +55,7 @@ import {buttonData} from "../../../data/common/button.namespace";
templateUrl: './index.component.html', templateUrl: './index.component.html',
styleUrl: './index.component.less', styleUrl: './index.component.less',
}) })
export class IndexComponent { export class IndexComponent implements OnInit {
// 菜单数据 // 菜单数据
menuData: any = [{ menuData: any = [{
'menuName' : '首页', 'menuName' : '首页',
@ -69,6 +69,27 @@ export class IndexComponent {
// 当前顶级菜单 // 当前顶级菜单
currentParentMenu: any = {}; currentParentMenu: any = {};
ngOnInit(): void {
// 缓存数据字典
this.commonService.queryDictionary('','',(data: any) => {
dictionaryData.length = 0;
for (let item of data['return_data']) {
dictionaryData.push(
{
codeType: item.codeType,
codeValue: item.codeValue,
codeName: item.codeName,
codeDesc: item.codeDesc,
sortId: item.sortId,
ext1: item.ext1,
ext2: item.ext2,
ext3: item.ext3
}
);
}
});
}
constructor( constructor(
private commonService: CommonService, private commonService: CommonService,
private storage: BrowserStorageService, private storage: BrowserStorageService,
@ -91,24 +112,6 @@ export class IndexComponent {
} }
); );
} }
// 缓存数据字典
this.commonService.queryDictionary('','',(data: any) => {
dictionaryData.length = 0;
for (let item of data['return_data']) {
dictionaryData.push(
{
codeType: item.codeType,
codeValue: item.codeValue,
codeName: item.codeName,
codeDesc: item.codeDesc,
sortId: item.sortId,
ext1: item.ext1,
ext2: item.ext2,
ext3: item.ext3
}
);
}
});
this.menuData = this.menuData.concat(this.storage.get(DATA)['menuTree']); this.menuData = this.menuData.concat(this.storage.get(DATA)['menuTree']);
this.userInfo = this.storage.get(DATA)['account']; this.userInfo = this.storage.get(DATA)['account'];

@ -60,20 +60,32 @@
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<button nz-button nzType="primary" class="submit-btn" (click)="showCheckedModal()">选择优惠券</button> <nz-divider nzText="优惠券"></nz-divider>
<nz-table #checkedTable [nzData]="checkedDiscountData"> <button nz-button nzType="primary" style="margin-bottom: 10px" (click)="showCheckedModal()">选择优惠券</button>
<nz-table #checkedTable
style="margin-bottom: 10px"
[nzData]="checkedDiscountData"
nzBordered
[nzSize]="'small'"
[nzPageSize]="999"
[nzShowPagination]="false"
>
<thead> <thead>
<tr> <tr>
<th>优惠券编码</th> <th>优惠券编码</th>
<th>优惠券名称</th> <th>优惠券名称</th>
<th>数量</th> <th>数量</th>
<th>操作</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let data of checkedTable.data"> <tr *ngFor="let data of checkedTable.data" class="editable-row">
<td>{{data.discountNo}}</td> <td>{{data.discountNo}}</td>
<td>{{data.discountName}}</td> <td>{{data.discountName}}</td>
<td>{{data.number}}</td> <td>{{data.number}}</td>
<td>
<a (click)="showEditNumber(data)">修改数量</a>
</td>
</tr> </tr>
</tbody> </tbody>
</nz-table> </nz-table>
@ -100,7 +112,6 @@
<th nzWidth="70px">优惠类型</th> <th nzWidth="70px">优惠类型</th>
<th nzWidth="70px">优惠券金额</th> <th nzWidth="70px">优惠券金额</th>
<th nzWidth="70px">优惠券条件</th> <th nzWidth="70px">优惠券条件</th>
<th nzWidth="100px">使用范围</th>
<th nzWidth="80px">领取有效期</th> <th nzWidth="80px">领取有效期</th>
<th nzWidth="100px">结束时间</th> <th nzWidth="100px">结束时间</th>
</tr> </tr>
@ -113,7 +124,6 @@
<td>{{data.discountType | dictionary: 'DISCOUNT_TYPE'}}</td> <td>{{data.discountType | dictionary: 'DISCOUNT_TYPE'}}</td>
<td>{{data.discountPrice}}</td> <td>{{data.discountPrice}}</td>
<td>{{data.discountCondition}}</td> <td>{{data.discountCondition}}</td>
<td>{{data.useScope}}</td>
<td>{{data.receiveExpirationDate}}天</td> <td>{{data.receiveExpirationDate}}天</td>
<td>{{data.endTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> <td>{{data.endTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td>
</tr> </tr>
@ -121,3 +131,39 @@
</nz-table> </nz-table>
</ng-container> </ng-container>
</nz-modal> </nz-modal>
<nz-modal [(nzVisible)]="editNumberModal"
[nzWidth]="450"
[nzTitle]="'优惠券数量'"
[nzFooter]="null">
<ng-container *nzModalContent>
<form nz-form [formGroup]="editNumberForm">
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>优惠券编号</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24">
<input nz-input formControlName="discountNo" placeholder="请输入" />
</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">
<input nz-input formControlName="discountName" placeholder="请输入" />
</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-input-number formControlName="number" [nzMin]="0" [nzMax]="200" [nzStep]="1" [nzPlaceHolder]="'数量'"></nz-input-number>
</nz-form-control>
</nz-form-item>
<div nz-flex [nzJustify]="'center'">
<button nz-button nzType="primary" class="submit-btn" (click)="editNumber()">确定</button>
</div>
</form>
</ng-container>
</nz-modal>

@ -17,3 +17,13 @@ nz-input-number-group {
nz-date-picker { nz-date-picker {
width: 100%; width: 100%;
} }
.editable-cell {
position: relative;
padding: 5px 12px;
cursor: pointer;
}
.editable-row:hover .editable-cell {
border: 1px solid #d9d9d9;
border-radius: 4px;
padding: 4px 11px;
}

@ -29,7 +29,6 @@ import {NzCheckboxModule} from "ng-zorro-antd/checkbox";
import {DiscountPkService} from "../../../services/discount/discount-pk.service"; import {DiscountPkService} from "../../../services/discount/discount-pk.service";
import {environment} from "../../../../environments/environment"; import {environment} from "../../../../environments/environment";
import {Observable, Observer} from "rxjs"; import {Observable, Observer} from "rxjs";
import {ka_GE} from "ng-zorro-antd/i18n";
import { import {
NzCellFixedDirective, NzCellFixedDirective,
NzTableCellDirective, NzTableCellDirective,
@ -38,6 +37,7 @@ import {
NzTheadComponent, NzTheadComponent,
NzThMeasureDirective, NzThSelectionComponent, NzTrDirective NzThMeasureDirective, NzThSelectionComponent, NzTrDirective
} from "ng-zorro-antd/table"; } from "ng-zorro-antd/table";
import {NzDividerModule} from "ng-zorro-antd/divider";
@Component({ @Component({
selector: 'app-discount-pk-edit', selector: 'app-discount-pk-edit',
@ -78,7 +78,8 @@ import {
NzTrDirective, NzTrDirective,
NzCellFixedDirective, NzCellFixedDirective,
NzTdAddOnComponent, NzTdAddOnComponent,
NzThSelectionComponent NzThSelectionComponent,
NzDividerModule
], ],
templateUrl: './discount-pk-edit.component.html', templateUrl: './discount-pk-edit.component.html',
styleUrl: './discount-pk-edit.component.less' styleUrl: './discount-pk-edit.component.less'
@ -101,6 +102,9 @@ export class DiscountPkEditComponent {
// 选中的优惠券数据 // 选中的优惠券数据
checkedDiscountData: any = []; checkedDiscountData: any = [];
editNumberForm: FormGroup;
editNumberModal = false;
constructor(private fb: NonNullableFormBuilder, constructor(private fb: NonNullableFormBuilder,
private merService: MerService, private merService: MerService,
private discountService: DiscountService, private discountService: DiscountService,
@ -116,6 +120,12 @@ export class DiscountPkEditComponent {
listImg: [null], listImg: [null],
content: [null], content: [null],
}); });
// 初始化表单
this.editNumberForm = this.fb.group({
discountNo: [{ value: null, disabled: true}, [Validators.required]],
discountName: [{ value: null, disabled: true}, [Validators.required]],
number: [null, [Validators.required]],
});
// 查询优惠券数据 // 查询优惠券数据
this.queryDiscount(); this.queryDiscount();
@ -160,20 +170,19 @@ export class DiscountPkEditComponent {
submitCheckedDiscount() { submitCheckedDiscount() {
let array = []; let array = [];
for (let discountNo of this.setOfCheckedId) { for (let discountNo of this.setOfCheckedId) {
// 优惠券数据是否存在
let data = this.discountData.find((o: any) => o.discountNo == discountNo); let data = this.discountData.find((o: any) => o.discountNo == discountNo);
if (data != null) { if (data != null) {
// 是否已选择
let checkedDiscount = this.checkedDiscountData.find((o: any) => o.discountNo == discountNo); let checkedDiscount = this.checkedDiscountData.find((o: any) => o.discountNo == discountNo);
if (checkedDiscount == null) { if (checkedDiscount == null) {
data['number'] = 1; data['number'] = 1;
let s = {
discountNo: data.discountNo
}
array.push(data);
} }
array.push(data);
} }
} }
this.checkedDiscountData = array; this.checkedDiscountData = array;
this.closeCheckedModal(); this.closeCheckedModal();
} }
/** /**
* *
@ -185,7 +194,6 @@ export class DiscountPkEditComponent {
} }
if (this.form.valid) { if (this.form.valid) {
const param = this.form.value; const param = this.form.value;
param['useScope'] = this.form.controls['useScope'].value.join(',');
param['endTime'] = new Date(this.form.controls['endTime'].value).getTime(); param['endTime'] = new Date(this.form.controls['endTime'].value).getTime();
this.discountPkService.edit(param, (data: any) => { this.discountPkService.edit(param, (data: any) => {
if (data['return_code'] == '000000') { if (data['return_code'] == '000000') {
@ -289,11 +297,33 @@ export class DiscountPkEditComponent {
refreshCheckedStatus(): void { refreshCheckedStatus(): void {
// @ts-ignore // @ts-ignore
this.checked = this.discountData.every(({ discountNo }) => this.setOfCheckedId.has(discountNo)); this.checked = this.discountData.every(({ discountNo }) => this.setOfCheckedId.has(discountNo));
console.log(this.setOfCheckedId);
} }
/**
*
* @param data
*/
showEditNumber(data: any): void {
this.editNumberForm.patchValue(data);
this.editNumberModal = true;
}
editNumber() {
if (this.editNumberForm.valid) {
let data = this.checkedDiscountData.find((o: any) => o.discountNo == this.editNumberForm.controls['discountNo'].value);
if (data != null) {
data['number'] = this.editNumberForm.controls['number'].value;
}
this.editNumberForm.reset();
this.editNumberModal = false;
} else {
Object.values(this.editNumberForm.controls).forEach(control => {
if (control.invalid) {
control.markAsDirty();
control.updateValueAndValidity({ onlySelf: true });
}
});
}
}
} }

@ -15,6 +15,18 @@
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<!-- <nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>
<span>
优惠叠加
<i nz-icon nz-tooltip nzTooltipTitle="例:加油站有平台或渠道优惠,优惠后可再次用优惠券抵扣。不叠加:使用优惠券时,加油站价格会恢复原价(油站价)" nzType="question-circle" nzTheme="outline"></i>
</span>
</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24">
<nz-switch formControlName="overlayDiscount" nzCheckedChildren="是" nzUnCheckedChildren="否"></nz-switch>
</nz-form-control>
</nz-form-item>-->
<nz-form-item *ngIf="form.controls['discountType'].value == 1"> <nz-form-item *ngIf="form.controls['discountType'].value == 1">
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>优惠条件</nz-form-label> <nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>优惠条件</nz-form-label>
<nz-form-control [nzSm]="14" [nzXs]="24"> <nz-form-control [nzSm]="14" [nzXs]="24">

@ -31,6 +31,8 @@ import {NzTabsModule} from "ng-zorro-antd/tabs";
import {DiscountService} from "../../../services/discount/discount.service"; import {DiscountService} from "../../../services/discount/discount.service";
import {NzCheckboxModule} from "ng-zorro-antd/checkbox"; import {NzCheckboxModule} from "ng-zorro-antd/checkbox";
import {NzDatePickerModule} from "ng-zorro-antd/date-picker"; import {NzDatePickerModule} from "ng-zorro-antd/date-picker";
import {NzSwitchModule} from "ng-zorro-antd/switch";
import {NzTooltipDirective} from "ng-zorro-antd/tooltip";
@Component({ @Component({
selector: 'app-discount-edit', selector: 'app-discount-edit',
@ -60,7 +62,9 @@ import {NzDatePickerModule} from "ng-zorro-antd/date-picker";
NzTabsModule, NzTabsModule,
NzCheckboxModule, NzCheckboxModule,
NzDatePickerModule, NzDatePickerModule,
NzInputNumberGroupComponent NzInputNumberGroupComponent,
NzSwitchModule,
NzTooltipDirective
], ],
templateUrl: './discount-edit.component.html', templateUrl: './discount-edit.component.html',
styleUrl: './discount-edit.component.less' styleUrl: './discount-edit.component.less'
@ -77,11 +81,13 @@ export class DiscountEditComponent {
private discountService: DiscountService, private discountService: DiscountService,
private message: NzMessageService, private message: NzMessageService,
private activatedRoute: ActivatedRoute) { private activatedRoute: ActivatedRoute) {
// 初始化表单 // 初始化表单
this.form = this.fb.group({ this.form = this.fb.group({
discountNo: [null], discountNo: [null],
discountName: [null, [Validators.required]], discountName: [null, [Validators.required]],
discountType: [null, [Validators.required]], discountType: [null, [Validators.required]],
//overlayDiscount: [null, [Validators.required]],
discountPrice: [null, [Validators.required]], discountPrice: [null, [Validators.required]],
discountCondition: [null], discountCondition: [null],
useScope: [null], useScope: [null],

@ -245,7 +245,7 @@
(nzPageIndexChange)="queryMer()" (nzPageIndexChange)="queryMer()"
nzShowSizeChanger nzShowSizeChanger
(nzPageSizeChange)="this.assignTablePageSize = $event;queryMer()" (nzPageSizeChange)="this.assignTablePageSize = $event;queryMer()"
[nzPageSizeOptions]="[ 10, 20, 30, 50, 100 ]" [nzPageSizeOptions]="[ 10, 500, 100, 5000, 10000]"
[nzTotal]="assignTableData.total" [nzTotal]="assignTableData.total"
[nzData]="assignTableData.list" > [nzData]="assignTableData.list" >
<thead> <thead>

@ -129,12 +129,12 @@ export class DiscountStockComponent implements OnInit{
stockCount: ['', [Validators.required]], stockCount: ['', [Validators.required]],
}); });
} }
ngOnInit(): void { ngOnInit(): void {
// 查询数据 // 查询数据
this.queryData(); this.queryData();
} }
/** /**
* *
*/ */

@ -1,7 +1,5 @@
export const environment = { export const environment = {
production: true, production: false,
baseUrl: 'https://phgcs.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) baseUrl: 'https://test-oil.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址)
orderUrl: 'https://phgcs.dctpay.com/order/', // 测试环境服务器地址(请求数据地址) imageUrl: 'https://test-oil.dctpay.com/filesystem/',
userUrl: 'https://phgcs.dctpay.com/user/', // 测试环境服务器地址(请求数据地址)
imageUrl: 'https://phg-test.obs.cn-southwest-2.myhuaweicloud.com/',
}; };

@ -4,7 +4,7 @@
export const environment = { export const environment = {
production: false, production: false,
baseUrl: 'https://test-oil.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) baseUrl: 'http://localhost:9802/brest/', // 测试环境服务器地址(请求数据地址)
imageUrl: 'https://test-oil.dctpay.com/filesystem/', imageUrl: 'https://test-oil.dctpay.com/filesystem/',
}; };

Loading…
Cancel
Save