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