|
|
@ -2,10 +2,8 @@ import { Component, OnInit } from '@angular/core'; |
|
|
|
import {FormBuilder, FormGroup, Validators} from '@angular/forms'; |
|
|
|
import {FormBuilder, FormGroup, Validators} from '@angular/forms'; |
|
|
|
import {NzModalService} from 'ng-zorro-antd'; |
|
|
|
import {NzModalService} from 'ng-zorro-antd'; |
|
|
|
import {ActivatedRoute, Router} from '@angular/router'; |
|
|
|
import {ActivatedRoute, Router} from '@angular/router'; |
|
|
|
import {ValidatorsService} from '../../../services/validators.service'; |
|
|
|
|
|
|
|
import {StoreDiscountActivityService} from '../../../services/store-discount-activity.service'; |
|
|
|
import {StoreDiscountActivityService} from '../../../services/store-discount-activity.service'; |
|
|
|
import {StoreService} from '../../../services/store.service'; |
|
|
|
import {StoreService} from '../../../services/store.service'; |
|
|
|
import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace'; |
|
|
|
|
|
|
|
import {MerService} from '../../../services/mer.service'; |
|
|
|
import {MerService} from '../../../services/mer.service'; |
|
|
|
import {CommonsService} from '../../../services/commons.service'; |
|
|
|
import {CommonsService} from '../../../services/commons.service'; |
|
|
|
|
|
|
|
|
|
|
@ -43,6 +41,8 @@ export class StoreDiscountActivityEditComponent implements OnInit { |
|
|
|
discountCondition: [0, [Validators.required]], |
|
|
|
discountCondition: [0, [Validators.required]], |
|
|
|
discountPrice: [0, [Validators.required]], |
|
|
|
discountPrice: [0, [Validators.required]], |
|
|
|
finalCostPrice: [0, [Validators.required]], |
|
|
|
finalCostPrice: [0, [Validators.required]], |
|
|
|
|
|
|
|
restrictType: ['1'], |
|
|
|
|
|
|
|
restrictPartakeNum: [1], |
|
|
|
endTime: [null, [Validators.required]], |
|
|
|
endTime: [null, [Validators.required]], |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
@ -53,8 +53,13 @@ export class StoreDiscountActivityEditComponent implements OnInit { |
|
|
|
this.activatedRoute.queryParams.subscribe(queryParams => { |
|
|
|
this.activatedRoute.queryParams.subscribe(queryParams => { |
|
|
|
if (queryParams['id'] != null) { |
|
|
|
if (queryParams['id'] != null) { |
|
|
|
this.storeDiscountActivityService.getActivityDetail(queryParams['id'], data => { |
|
|
|
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']['storeId'] = String(data['return_data']['storeId']); |
|
|
|
|
|
|
|
data['return_data']['partakeWay'] = String(data['return_data']['partakeWay']); |
|
|
|
data['return_data']['discountType'] = String(data['return_data']['discountType']); |
|
|
|
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']); |
|
|
|
this.dataForm.patchValue(data['return_data']); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
@ -78,6 +83,12 @@ export class StoreDiscountActivityEditComponent implements OnInit { |
|
|
|
}); |
|
|
|
}); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.dataForm.value.partakeWay !== '3') { |
|
|
|
|
|
|
|
this.dataForm.value.restrictType = null; |
|
|
|
|
|
|
|
this.dataForm.value.restrictPartakeNum = null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.storeDiscountActivityService.configActivity(this.dataForm.value, data => { |
|
|
|
this.storeDiscountActivityService.configActivity(this.dataForm.value, data => { |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
this.modal.success({ |
|
|
|
this.modal.success({ |
|
|
|