提交修改

pull/1/head
袁野 3 years ago
parent f7f3e5a0b4
commit 144dc676fd
  1. 24
      src/app/admin/recharge-order/price-list/price-list.component.html
  2. 12
      src/app/admin/recharge-order/price-list/price-list.component.ts

@ -56,6 +56,7 @@
<tr> <tr>
<th>编号</th> <th>编号</th>
<th>金额类型</th> <th>金额类型</th>
<th>商品ID</th>
<th>充值金额</th> <th>充值金额</th>
<th>支付金额</th> <th>支付金额</th>
<th>创建时间</th> <th>创建时间</th>
@ -66,6 +67,7 @@
<tr *ngFor="let data of ajaxTable.data; let i = index"> <tr *ngFor="let data of ajaxTable.data; let i = index">
<td>{{i + 1}}</td> <td>{{i + 1}}</td>
<td>{{data.type | rechargePrice}}</td> <td>{{data.type | rechargePrice}}</td>
<td>{{data.goodsId}}</td>
<td>{{data.price}}</td> <td>{{data.price}}</td>
<td>{{data.realPrice}}</td> <td>{{data.realPrice}}</td>
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td> <td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
@ -89,16 +91,34 @@
</nz-select> </nz-select>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>商品ID</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请输入商品ID!">
<input [type]="'number'" nz-input formControlName="goodsId" />
</nz-form-control>
</nz-form-item>
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>充值金额</nz-form-label> <nz-form-label [nzSpan]="6" nzRequired>充值金额</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请输入充值金额!"> <nz-form-control [nzSpan]="16" nzErrorTip="请输入充值金额!">
<input [type]="'number'" nz-input formControlName="price"/> <nz-input-group nzSuffix="RMB" nzPrefix="¥">
<input [type]="'number'" (ngModelChange)="getPrice()" nz-input formControlName="price" />
</nz-input-group>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>折扣比例</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请输入折扣比例!">
<nz-input-group nzSuffix="%" >
<input [type]="'number'" (ngModelChange)="getPrice()" nz-input formControlName="discount" />
</nz-input-group>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>支付金额</nz-form-label> <nz-form-label [nzSpan]="6" nzRequired>支付金额</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请输入支付金额!"> <nz-form-control [nzSpan]="16" nzErrorTip="请输入支付金额!">
<input [type]="'number'" nz-input formControlName="realPrice"/> <nz-input-group nzSuffix="RMB" nzPrefix="¥">
<input [type]="'number'" nz-input [(ngModel)]="realPrice" formControlName="realPrice" />
</nz-input-group>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</form> </form>

@ -29,7 +29,7 @@ export class PriceListComponent implements OnInit {
edit = false; edit = false;
isVisibleGoods = false; isVisibleGoods = false;
realPrice = 0;
goodsArray; goodsArray;
constructor( constructor(
private form: FormBuilder, private form: FormBuilder,
@ -54,9 +54,12 @@ export class PriceListComponent implements OnInit {
this.validateForm = this.form.group({ this.validateForm = this.form.group({
type: [null, [Validators.required]], type: [null, [Validators.required]],
price: [null, [Validators.required]], price: [null, [Validators.required]],
realPrice: [null, [Validators.required]], realPrice: [{value: null, disabled: true}, [Validators.required]],
goodsId: [null, [Validators.required]],
discount: [null, [Validators.required]],
}); });
this.getRequest(true, this.searchForm.value); this.getRequest(true, this.searchForm.value);
} }
@ -120,6 +123,7 @@ export class PriceListComponent implements OnInit {
return; return;
} }
} }
this.validateForm.value.realPrice = this.realPrice;
if (this.edit) { if (this.edit) {
this.validateForm.value['id'] = this.id; this.validateForm.value['id'] = this.id;
this.recharge.updatePrice(this.validateForm.value, data => { this.recharge.updatePrice(this.validateForm.value, data => {
@ -175,4 +179,8 @@ export class PriceListComponent implements OnInit {
}); });
} }
public getPrice(): void {
this.realPrice = this.validateForm.value.price * this.validateForm.value.discount / 100;
}
} }

Loading…
Cancel
Save