From 21c0565e0811bbd9c3969edb4cbcbef0d22bf9dd Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Thu, 30 Mar 2023 09:49:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...tore-discount-activity-edit.component.html | 30 ++++++++++++++----- ...tore-discount-activity-edit.component.scss | 3 ++ .../store-discount-activity-edit.component.ts | 15 ++++++++-- ...tore-discount-activity-list.component.html | 4 +-- .../store-discount-activity-list.component.ts | 1 - 5 files changed, 41 insertions(+), 12 deletions(-) diff --git a/src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.html b/src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.html index 7819e34..df91ed3 100644 --- a/src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.html +++ b/src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.html @@ -30,6 +30,13 @@ + + 优惠活动名称 + + + + + 参与方式 @@ -39,10 +46,19 @@ - - 优惠活动名称 + + 限制类型 - + + + + + + + + 限制参与次数 + + @@ -65,16 +81,16 @@ - {{dataForm.value.discountType === '3' ? '优惠折扣' : '优惠金额'}} + {{dataForm.value.discountType === '3' ? '优惠折扣(%)' : '优惠金额'}} - {{dataForm.value.discountType === '3' ? '成本折扣' : '成本优惠'}} + {{dataForm.value.discountType === '3' ? '成本折扣(%)' : '成本优惠'}} - + @@ -87,7 +103,7 @@ - + diff --git a/src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.scss b/src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.scss index d3d16c1..379954c 100644 --- a/src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.scss +++ b/src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.scss @@ -4,3 +4,6 @@ nz-date-picker { .register-are { margin-bottom: 8px; } +nz-input-number { + width: 100%; +} diff --git a/src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.ts b/src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.ts index aebf0c0..4dbbdc8 100644 --- a/src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.ts +++ b/src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.ts @@ -2,10 +2,8 @@ import { Component, OnInit } from '@angular/core'; import {FormBuilder, FormGroup, Validators} from '@angular/forms'; import {NzModalService} from 'ng-zorro-antd'; import {ActivatedRoute, Router} from '@angular/router'; -import {ValidatorsService} from '../../../services/validators.service'; import {StoreDiscountActivityService} from '../../../services/store-discount-activity.service'; import {StoreService} from '../../../services/store.service'; -import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; import {MerService} from '../../../services/mer.service'; import {CommonsService} from '../../../services/commons.service'; @@ -43,6 +41,8 @@ export class StoreDiscountActivityEditComponent implements OnInit { discountCondition: [0, [Validators.required]], discountPrice: [0, [Validators.required]], finalCostPrice: [0, [Validators.required]], + restrictType: ['1'], + restrictPartakeNum: [1], endTime: [null, [Validators.required]], }); @@ -53,8 +53,13 @@ export class StoreDiscountActivityEditComponent implements OnInit { this.activatedRoute.queryParams.subscribe(queryParams => { if (queryParams['id'] != null) { this.storeDiscountActivityService.getActivityDetail(queryParams['id'], data => { + data['return_data']['merId'] = String(data['return_data']['merId']); data['return_data']['storeId'] = String(data['return_data']['storeId']); + data['return_data']['partakeWay'] = String(data['return_data']['partakeWay']); data['return_data']['discountType'] = String(data['return_data']['discountType']); + if (data['return_data']['restrictType'] != null) { + data['return_data']['restrictType'] = String(data['return_data']['restrictType']); + } this.dataForm.patchValue(data['return_data']); }); } @@ -78,6 +83,12 @@ export class StoreDiscountActivityEditComponent implements OnInit { }); return; } + + if (this.dataForm.value.partakeWay !== '3') { + this.dataForm.value.restrictType = null; + this.dataForm.value.restrictPartakeNum = null; + } + this.storeDiscountActivityService.configActivity(this.dataForm.value, data => { if (data['return_code'] === '000000') { this.modal.success({ diff --git a/src/app/admin/store-discount-activity/store-discount-activity-list/store-discount-activity-list.component.html b/src/app/admin/store-discount-activity/store-discount-activity-list/store-discount-activity-list.component.html index 6a4958d..0c05a5c 100644 --- a/src/app/admin/store-discount-activity/store-discount-activity-list/store-discount-activity-list.component.html +++ b/src/app/admin/store-discount-activity/store-discount-activity-list/store-discount-activity-list.component.html @@ -83,8 +83,8 @@ 立减 折扣 - ¥ {{data.discountCondition}} - ¥ {{data.discountPrice}} + {{data.discountType==3?data.discountCondition+'%':'¥'+data.discountCondition}} + {{data.discountType==3?data.discountPrice+'%':'¥'+data.discountPrice}} {{data.endTime | date : 'yyyy-MM-dd HH:mm:ss'}} 编辑中 diff --git a/src/app/admin/store-discount-activity/store-discount-activity-list/store-discount-activity-list.component.ts b/src/app/admin/store-discount-activity/store-discount-activity-list/store-discount-activity-list.component.ts index 214df99..bab6abb 100644 --- a/src/app/admin/store-discount-activity/store-discount-activity-list/store-discount-activity-list.component.ts +++ b/src/app/admin/store-discount-activity/store-discount-activity-list/store-discount-activity-list.component.ts @@ -3,7 +3,6 @@ import {FormBuilder, FormGroup, Validators} from '@angular/forms'; import {ActivatedRoute} from '@angular/router'; import {LocalStorageService} from '../../../services/local-storage.service'; import {NzMessageService, NzModalService} from 'ng-zorro-antd'; -import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; import {StoreDiscountActivityService} from '../../../services/store-discount-activity.service'; @Component({