提交代码

master
胡锐 2 years ago
parent 1fb88abfa2
commit 21c0565e08
  1. 30
      src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.html
  2. 3
      src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.scss
  3. 15
      src/app/admin/store-discount-activity/store-discount-activity-edit/store-discount-activity-edit.component.ts
  4. 4
      src/app/admin/store-discount-activity/store-discount-activity-list/store-discount-activity-list.component.html
  5. 1
      src/app/admin/store-discount-activity/store-discount-activity-list/store-discount-activity-list.component.ts

@ -30,6 +30,13 @@
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>优惠活动名称</nz-form-label>
<nz-form-control [nzSm]="6" [nzXs]="24">
<input nz-input placeholder="请输入优惠券名称..." [formControlName]="'name'" />
</nz-form-control>
</nz-form-item>
<nz-form-item> <nz-form-item>
<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]="6" [nzXs]="24"> <nz-form-control [nzSm]="6" [nzXs]="24">
@ -39,10 +46,19 @@
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<nz-form-item> <nz-form-item *ngIf="dataForm.value.partakeWay === '3'">
<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]="6" [nzXs]="24"> <nz-form-control [nzSm]="6" [nzXs]="24">
<input nz-input placeholder="请输入优惠券名称..." [formControlName]="'name'" /> <nz-select [formControlName]="'restrictType'">
<nz-option nzValue="1" nzLabel="每日"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item *ngIf="dataForm.value.partakeWay === '3'">
<nz-form-label [nzSm]="6" [nzXs]="24" nzRequired>限制参与次数</nz-form-label>
<nz-form-control [nzSm]="6" [nzXs]="24" >
<nz-input-number nz-input placeholder="请输入限制参与次数" [nzMin]="1" [nzMax]="100" [nzStep]="1" [formControlName]="'restrictPartakeNum'"></nz-input-number>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
@ -65,16 +81,16 @@
</nz-form-item> </nz-form-item>
<nz-form-item> <nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" [nzFor]="'discountPrice'" nzRequired>{{dataForm.value.discountType === '3' ? '优惠折扣' : '优惠金额'}}</nz-form-label> <nz-form-label [nzSm]="6" [nzXs]="24" [nzFor]="'discountPrice'" nzRequired>{{dataForm.value.discountType === '3' ? '优惠折扣(%)' : '优惠金额'}}</nz-form-label>
<nz-form-control [nzSm]="6" [nzXs]="24" nzErrorTip="{{dataForm.value.discountType === '3' ? '请输入优惠折扣' : '请输入优惠金额'}}"> <nz-form-control [nzSm]="6" [nzXs]="24" nzErrorTip="{{dataForm.value.discountType === '3' ? '请输入优惠折扣' : '请输入优惠金额'}}">
<input nz-input [type]="'number'" placeholder="{{dataForm.value.discountType === '3' ? '请输入优惠折扣' : '请输入优惠金额'}}" [formControlName]="'discountPrice'"/> <input nz-input [type]="'number'" placeholder="{{dataForm.value.discountType === '3' ? '请输入优惠折扣' : '请输入优惠金额'}}" [formControlName]="'discountPrice'"/>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<nz-form-item> <nz-form-item>
<nz-form-label [nzSm]="6" [nzXs]="24" [nzFor]="'finalCostPrice'" nzRequired>{{dataForm.value.discountType === '3' ? '成本折扣' : '成本优惠'}}</nz-form-label> <nz-form-label [nzSm]="6" [nzXs]="24" [nzFor]="'finalCostPrice'" nzRequired>{{dataForm.value.discountType === '3' ? '成本折扣(%)' : '成本优惠'}}</nz-form-label>
<nz-form-control [nzSm]="6" [nzXs]="24" nzErrorTip="{{dataForm.value.discountType === '3' ? '请输入成本折扣' : '请输入成本优惠'}}"> <nz-form-control [nzSm]="6" [nzXs]="24" nzErrorTip="{{dataForm.value.discountType === '3' ? '请输入成本折扣' : '请输入成本优惠'}}">
<input nz-input [type]="'number'" placeholder="{{dataForm.value.discountType === '3' ? '请输入成本折扣' : '请输入成本优惠'}}" [formControlName]="'discountPrice'"/> <input nz-input [type]="'number'" placeholder="{{dataForm.value.discountType === '3' ? '请输入成本折扣' : '请输入成本优惠'}}" [formControlName]="'finalCostPrice'"/>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
@ -87,7 +103,7 @@
<nz-form-item nz-row class="register-area"> <nz-form-item nz-row class="register-area">
<nz-form-control [nzSpan]="14" [nzOffset]="6"> <nz-form-control [nzSpan]="14" [nzOffset]="6">
<button nz-button nzType="primary" (click)="submitFrom()">提交</button> <button nz-button nzType="primary" style="width: 170px;" (click)="submitFrom()">提交</button>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</form> </form>

@ -4,3 +4,6 @@ nz-date-picker {
.register-are { .register-are {
margin-bottom: 8px; margin-bottom: 8px;
} }
nz-input-number {
width: 100%;
}

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

@ -83,8 +83,8 @@
<span *ngIf="data.discountType == 2">立减</span> <span *ngIf="data.discountType == 2">立减</span>
<span *ngIf="data.discountType == 3">折扣</span> <span *ngIf="data.discountType == 3">折扣</span>
</td> </td>
<td>{{data.discountCondition}}</td> <td>{{data.discountType==3?data.discountCondition+'%':'¥'+data.discountCondition}}</td>
<td>{{data.discountPrice}}</td> <td>{{data.discountType==3?data.discountPrice+'%':'¥'+data.discountPrice}}</td>
<td>{{data.endTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td> <td>{{data.endTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td>
<td> <td>
<span *ngIf="data.status == 1">编辑中</span> <span *ngIf="data.status == 1">编辑中</span>

@ -3,7 +3,6 @@ import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {ActivatedRoute} from '@angular/router'; import {ActivatedRoute} from '@angular/router';
import {LocalStorageService} from '../../../services/local-storage.service'; import {LocalStorageService} from '../../../services/local-storage.service';
import {NzMessageService, NzModalService} from 'ng-zorro-antd'; import {NzMessageService, NzModalService} from 'ng-zorro-antd';
import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace';
import {StoreDiscountActivityService} from '../../../services/store-discount-activity.service'; import {StoreDiscountActivityService} from '../../../services/store-discount-activity.service';
@Component({ @Component({

Loading…
Cancel
Save