|
|
@ -6,6 +6,7 @@ import {NzMessageService, NzUploadFile} from 'ng-zorro-antd'; |
|
|
|
import {ActivatedRoute} from '@angular/router'; |
|
|
|
import {ActivatedRoute} from '@angular/router'; |
|
|
|
import {ValidatorsService} from '../../../services/validators.service'; |
|
|
|
import {ValidatorsService} from '../../../services/validators.service'; |
|
|
|
import {MerchantStoreService} from '../../../services/merchant-store.service'; |
|
|
|
import {MerchantStoreService} from '../../../services/merchant-store.service'; |
|
|
|
|
|
|
|
import {CommonsService} from "../../../services/commons.service"; |
|
|
|
|
|
|
|
|
|
|
|
declare var AMap: any; // 一定要声明AMap,要不然报错找不到AMap
|
|
|
|
declare var AMap: any; // 一定要声明AMap,要不然报错找不到AMap
|
|
|
|
declare var AMapUI: any; |
|
|
|
declare var AMapUI: any; |
|
|
@ -35,15 +36,16 @@ export class StoreEditComponent implements OnInit { |
|
|
|
WEB_SERVE_URL = environment.baseUrl; |
|
|
|
WEB_SERVE_URL = environment.baseUrl; |
|
|
|
previewVisible = false; |
|
|
|
previewVisible = false; |
|
|
|
previewImage: string | undefined = ''; |
|
|
|
previewImage: string | undefined = ''; |
|
|
|
|
|
|
|
brandData = []; |
|
|
|
|
|
|
|
|
|
|
|
constructor( |
|
|
|
constructor( |
|
|
|
private fb: FormBuilder, |
|
|
|
private fb: FormBuilder, |
|
|
|
private merchantStore: MerchantStoreService, |
|
|
|
private merchantStore: MerchantStoreService, |
|
|
|
private message: NzMessageService, // 信息提示
|
|
|
|
private message: NzMessageService, // 信息提示
|
|
|
|
|
|
|
|
private commonsService: CommonsService, |
|
|
|
private activatedRoute: ActivatedRoute, |
|
|
|
private activatedRoute: ActivatedRoute, |
|
|
|
) { |
|
|
|
) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
ngOnInit(): void { |
|
|
|
this.activatedRoute.queryParams.subscribe(queryParams => { |
|
|
|
this.activatedRoute.queryParams.subscribe(queryParams => { |
|
|
|
if (queryParams.storeId != null) { |
|
|
|
if (queryParams.storeId != null) { |
|
|
@ -55,19 +57,23 @@ export class StoreEditComponent implements OnInit { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
this.validateForm = this.fb.group({ |
|
|
|
this.validateForm = this.fb.group({ |
|
|
|
telephone: [null, [Validators.required, ValidatorsService.mobile]], |
|
|
|
|
|
|
|
password: [null, [Validators.required, ValidatorsService.minLength(6)]], |
|
|
|
|
|
|
|
storeKey: [null, [Validators.required, ValidatorsService.maxLength(10)]], |
|
|
|
|
|
|
|
storeName: [null, [Validators.required]], |
|
|
|
storeName: [null, [Validators.required]], |
|
|
|
address: [null, [Validators.required]], |
|
|
|
address: [null, [Validators.required]], |
|
|
|
|
|
|
|
contactName: [null, [Validators.required]], |
|
|
|
|
|
|
|
prestoreType: [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]], |
|
|
|
status: [null], |
|
|
|
deviceSn: [null], |
|
|
|
companyId: [null], |
|
|
|
deviceKey: [null], |
|
|
|
|
|
|
|
deviceName: [null], |
|
|
|
regionId: [null], |
|
|
|
regionId: [null], |
|
|
|
merchantId: [null], |
|
|
|
brandId: [null], |
|
|
|
createTime: [null], |
|
|
|
type: [null], |
|
|
|
secUser: {}, |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.commonsService.getDictionary('MERCHANT_STORE_BRANCH', data => { |
|
|
|
|
|
|
|
this.brandData = data['return_data']; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
@ -103,8 +109,6 @@ export class StoreEditComponent implements OnInit { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.validateForm.value['secUser']['telephone'] = this.validateForm.value.telephone; |
|
|
|
|
|
|
|
this.validateForm.value['secUser']['password'] = this.validateForm.value.password; |
|
|
|
|
|
|
|
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]; |
|
|
@ -138,8 +142,9 @@ export class StoreEditComponent implements OnInit { |
|
|
|
public getDetails(id) { |
|
|
|
public getDetails(id) { |
|
|
|
this.merchantStore.getMerchantStoreById(id, data => { |
|
|
|
this.merchantStore.getMerchantStoreById(id, data => { |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
data['return_data'].telephone = data['return_data'].secUser.loginName; |
|
|
|
console.log(data); |
|
|
|
data['return_data'].password = data['return_data'].secUser.password; |
|
|
|
data['return_data']['brandId'] = String(data['return_data']['brandId']); |
|
|
|
|
|
|
|
data['return_data']['type'] = String(data['return_data']['type']); |
|
|
|
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 = []; |
|
|
@ -164,7 +169,6 @@ export class StoreEditComponent implements OnInit { |
|
|
|
getMap() { |
|
|
|
getMap() { |
|
|
|
// tslint:disable-next-line:variable-name
|
|
|
|
// tslint:disable-next-line:variable-name
|
|
|
|
AMapUI.loadUI(['misc/PositionPicker'], PositionPicker => { |
|
|
|
AMapUI.loadUI(['misc/PositionPicker'], PositionPicker => { |
|
|
|
console.log(this.validateForm.value); |
|
|
|
|
|
|
|
const map = new AMap.Map('container', { |
|
|
|
const map = new AMap.Map('container', { |
|
|
|
resizeEnable: true, |
|
|
|
resizeEnable: true, |
|
|
|
scrollWheel: false, |
|
|
|
scrollWheel: false, |
|
|
@ -194,7 +198,6 @@ export class StoreEditComponent implements OnInit { |
|
|
|
map: map |
|
|
|
map: map |
|
|
|
}); |
|
|
|
}); |
|
|
|
positionPicker.on('success', positionResult => { |
|
|
|
positionPicker.on('success', positionResult => { |
|
|
|
console.log(positionResult); |
|
|
|
|
|
|
|
positionResult['latitude'] = positionResult.position.lat; |
|
|
|
positionResult['latitude'] = positionResult.position.lat; |
|
|
|
positionResult['longitude'] = positionResult.position.lng; |
|
|
|
positionResult['longitude'] = positionResult.position.lng; |
|
|
|
positionResult['regionId'] = positionResult.regeocode.addressComponent.adcode; |
|
|
|
positionResult['regionId'] = positionResult.regeocode.addressComponent.adcode; |
|
|
|