提交代码

pull/1/head
胡锐 2 years ago
parent 7196d106b1
commit 110a0c905b
  1. 16
      src/app/admin/merchant-store/store-edit/store-edit.component.html
  2. 4
      src/app/admin/merchant-store/store-edit/store-edit.component.scss
  3. 19
      src/app/admin/merchant-store/store-edit/store-edit.component.ts

@ -46,6 +46,22 @@
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</div> </div>
<div nz-col [nzSpan]="8" *ngIf="validateForm.value.prestoreType == 0">
<nz-form-item>
<nz-form-label nzRequired>分账商户号</nz-form-label>
<nz-form-control >
<input nz-input placeholder="请输入分账商户号" [formControlName]="'splitAccountNo'" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="8" *ngIf="validateForm.value.prestoreType == 0">
<nz-form-item>
<nz-form-label nzRequired>分账比例(%)</nz-form-label>
<nz-form-control>
<nz-input-number [formControlName]="'splitRate'" nzPlaceHolder="请输入分账比例" nzMin="0" [nzMax]="30" [nzPrecision]="2"></nz-input-number>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="8"> <div nz-col [nzSpan]="8">
<nz-form-item> <nz-form-item>
<nz-form-label [nzFor]="'type'" nzRequired>门店类型</nz-form-label> <nz-form-label [nzFor]="'type'" nzRequired>门店类型</nz-form-label>

@ -5,3 +5,7 @@ button {
background-color: #ffffff; background-color: #ffffff;
} }
#container {width:800px; height: 500px; } #container {width:800px; height: 500px; }
nz-input-number {
width: 100%;
}

@ -61,6 +61,9 @@ export class StoreEditComponent implements OnInit {
address: [null, [Validators.required]], address: [null, [Validators.required]],
contactName: [null, [Validators.required]], contactName: [null, [Validators.required]],
prestoreType: [null, [Validators.required]], prestoreType: [null, [Validators.required]],
splitType: [1],
splitAccountNo: [null],
splitRate: [null],
telephone: [null, [Validators.required]], telephone: [null, [Validators.required]],
latitude: [29.553134, [Validators.required]], latitude: [29.553134, [Validators.required]],
longitude: [106.565428, [Validators.required]], longitude: [106.565428, [Validators.required]],
@ -109,6 +112,15 @@ export class StoreEditComponent implements OnInit {
return; return;
} }
} }
if (this.validateForm.value.prestoreType === '0') {
if (this.validateForm.value.splitAccountNo == null || this.validateForm.value.splitRate == null) {
this.message.error('必填项不能为空');
return;
}
this.validateForm.value.splitAccounts = { type: this.validateForm.value.splitType,
accountNo: this.validateForm.value.splitAccountNo,
rate: this.validateForm.value.splitRate };
}
if (this.logoFile.length !== 0) { if (this.logoFile.length !== 0) {
if (this.logoFile[0]['response'] != null) { if (this.logoFile[0]['response'] != null) {
this.validateForm.value.storeLogo = this.logoFile[0]['response']['return_data'][0]; this.validateForm.value.storeLogo = this.logoFile[0]['response']['return_data'][0];
@ -116,6 +128,7 @@ export class StoreEditComponent implements OnInit {
this.validateForm.value.storeLogo = this.logoFile[0].name; this.validateForm.value.storeLogo = this.logoFile[0].name;
} }
} }
if (this.editFlag) { if (this.editFlag) {
this.validateForm.value.id = this.id; this.validateForm.value.id = this.id;
this.merchantStore.updateMerchantStore(this.validateForm.value, data => { this.merchantStore.updateMerchantStore(this.validateForm.value, data => {
@ -145,6 +158,7 @@ export class StoreEditComponent implements OnInit {
console.log(data); console.log(data);
data['return_data']['brandId'] = String(data['return_data']['brandId']); data['return_data']['brandId'] = String(data['return_data']['brandId']);
data['return_data']['type'] = String(data['return_data']['type']); data['return_data']['type'] = String(data['return_data']['type']);
data['return_data']['prestoreType'] = String(data['return_data']['prestoreType']);
if (data['return_data']['storeLogo'] != null && data['return_data']['storeLogo'] !== '') { if (data['return_data']['storeLogo'] != null && data['return_data']['storeLogo'] !== '') {
const logo = String(data['return_data']['storeLogo']); const logo = String(data['return_data']['storeLogo']);
const logoArray = []; const logoArray = [];
@ -157,6 +171,11 @@ export class StoreEditComponent implements OnInit {
}); });
this.logoFile = logoArray; this.logoFile = logoArray;
} }
if (data['return_data']['splitAccounts'] != null) {
data['return_data']['splitType'] = data['return_data']['splitAccounts']['type'];
data['return_data']['splitAccountNo'] = data['return_data']['splitAccounts']['accountNo'];
data['return_data']['splitRate'] = data['return_data']['splitAccounts']['rate'];
}
this.validateForm.patchValue(data['return_data']); this.validateForm.patchValue(data['return_data']);
this.getMap(); this.getMap();
} else { } else {

Loading…
Cancel
Save