提交修改

pull/1/head
yuanye 4 years ago
parent f52300394b
commit e3fc022d46
  1. 19
      src/app/admin/merchant-store/store-detail/store-detail.component.html
  2. 27
      src/app/admin/merchant-store/store-detail/store-detail.component.ts
  3. 52
      src/app/admin/merchant-store/store-edit/store-edit.component.html
  4. 1
      src/app/admin/merchant-store/store-edit/store-edit.component.scss
  5. 108
      src/app/admin/merchant-store/store-edit/store-edit.component.ts
  6. 53
      src/app/admin/merchant-store/store-list/store-list.component.html
  7. 90
      src/app/admin/merchant-store/store-list/store-list.component.ts
  8. 3
      src/app/admin/merchant/merchant-detail/merchant-detail.component.ts
  9. 2
      src/app/admin/merchant/merchant-edit/merchant-edit.component.ts
  10. 2
      src/app/admin/merchant/merchant-list/merchant-list.component.html
  11. 7
      src/app/admin/merchant/merchant-list/merchant-list.component.ts
  12. 39
      src/app/services/merchant-store.service.ts
  13. 2
      src/index.html
  14. 3
      tsconfig.json

@ -1 +1,18 @@
<p>store-detail works!</p> <div class="inner-content">
<nz-descriptions nzBordered>
<nz-descriptions-item nzTitle="登录账户">{{data.telephone}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="门店编号">{{data['storeKey']}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="门店名称">{{data.storeName}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="门店地址">{{data.address}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="地址经度">{{data.longitude}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="地址纬度">{{data.latitude}}</nz-descriptions-item>
<nz-descriptions-item nzTitle="创建时间">
{{data.createTime | date: 'yyyy-MM-dd'}}
</nz-descriptions-item>
<nz-descriptions-item nzTitle="更新时间">
{{data.updateTime | date: 'yyyy-MM-dd'}}
</nz-descriptions-item>
<nz-descriptions-item nzTitle="操作人员">{{data.operatorName }}</nz-descriptions-item>
</nz-descriptions>
</div>

@ -1,4 +1,7 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import {NzMessageService} from 'ng-zorro-antd';
import {ActivatedRoute} from '@angular/router';
import {MerchantStoreService} from '../../../services/merchant-store.service';
@Component({ @Component({
selector: 'app-store-detail', selector: 'app-store-detail',
@ -7,9 +10,31 @@ import { Component, OnInit } from '@angular/core';
}) })
export class StoreDetailComponent implements OnInit { export class StoreDetailComponent implements OnInit {
constructor() { } data: any = {};
id: number;
constructor(
private merchantStore: MerchantStoreService,
private message: NzMessageService, // 信息提示
private activatedRoute: ActivatedRoute,
) { }
ngOnInit(): void { ngOnInit(): void {
this.activatedRoute.queryParams.subscribe(queryParams => {
if (queryParams.storeId != null) {
this.id = queryParams.storeId;
this.getDetails(queryParams.storeId);
}
});
} }
// 查询详情
public getDetails(id: number) {
this.merchantStore.getMerchantStoreById(id , data => {
this.data = data['return_data'];
});
}
} }

@ -15,9 +15,9 @@
<div nz-row [nzGutter]="24"> <div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="8"> <div nz-col [nzSpan]="8">
<nz-form-item> <nz-form-item>
<nz-form-label [nzFor]="'loginTelephone'" nzRequired>登录手机号</nz-form-label> <nz-form-label [nzFor]="'telephone'" nzRequired>登录手机号</nz-form-label>
<nz-form-control nzErrorTip="请输入登录手机号!"> <nz-form-control nzErrorTip="请输入登录手机号!">
<input nz-input placeholder="请输入登录手机号..." [formControlName]="'loginTelephone'" id="'loginTelephone'" /> <input nz-input placeholder="请输入登录手机号..." [formControlName]="'telephone'" id="'telephone'" />
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</div> </div>
@ -36,25 +36,63 @@
</div> </div>
<div nz-col [nzSpan]="8"> <div nz-col [nzSpan]="8">
<nz-form-item> <nz-form-item>
<nz-form-label [nzFor]="'merchantKey'" nzRequired>门店编号</nz-form-label> <nz-form-label [nzFor]="'storeKey'" nzRequired>门店编号</nz-form-label>
<nz-form-control nzErrorTip="请输入门店编号!"> <nz-form-control nzErrorTip="请输入门店编号!">
<input nz-input placeholder="请输入门店编号..." [formControlName]="'merchantKey'" id="'merchantKey'" /> <input nz-input placeholder="请输入门店编号..." [formControlName]="'storeKey'" id="'storeKey'" />
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</div> </div>
<div nz-col [nzSpan]="8"> <div nz-col [nzSpan]="8">
<nz-form-item> <nz-form-item>
<nz-form-label [nzFor]="'merchantName'" nzRequired>门店名称</nz-form-label> <nz-form-label [nzFor]="'storeName'" nzRequired>门店名称</nz-form-label>
<nz-form-control nzErrorTip="请输入门店名称!"> <nz-form-control nzErrorTip="请输入门店名称!">
<input nz-input placeholder="请输入门店名称..." [formControlName]="'merchantName'" id="'merchantName'" /> <input nz-input placeholder="请输入门店名称..." [formControlName]="'storeName'" id="'storeName'" />
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</div> </div>
<div nz-col [nzSpan]="8"> <div nz-col [nzSpan]="8">
<nz-form-item>
<nz-form-label [nzFor]="'latitude'" nzRequired>地址维度</nz-form-label>
<nz-form-control nzErrorTip="请输入门店地址维度!">
<input nz-input placeholder="请输入门店地址维度..." readonly [formControlName]="'latitude'" id="'latitude'" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="8">
<nz-form-item>
<nz-form-label [nzFor]="'longitude'" nzRequired>地址经度</nz-form-label>
<nz-form-control nzErrorTip="请输入门店地址维度!">
<input nz-input placeholder="请输入门店地址维度..." readonly [formControlName]="'longitude'" id="'longitude'" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="14">
<nz-form-item> <nz-form-item>
<nz-form-label [nzFor]="'address'" nzRequired>门店地址</nz-form-label> <nz-form-label [nzFor]="'address'" nzRequired>门店地址</nz-form-label>
<nz-form-control nzErrorTip="请输入门店地址!"> <nz-form-control nzErrorTip="请输入门店地址!">
<input nz-input placeholder="请输入门店地址..." [formControlName]="'address'" id="'address'" /> <input nz-input placeholder="请输入门店地址..." readonly [formControlName]="'address'" id="'address'" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="24">
<nz-form-item>
<nz-form-label nzRequired>设置定位</nz-form-label>
<nz-form-control>
<div id="container"></div>
<div >
<table>
<tr>
<td>
<label>请输入关键字:</label>
</td>
</tr>
<tr>
<td>
<input nz-input id="input" />
</td>
</tr>
</table>
</div>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</div> </div>

@ -4,3 +4,4 @@ button {
:host ::ng-deep .ant-upload { :host ::ng-deep .ant-upload {
background-color: #ffffff; background-color: #ffffff;
} }
#container {width:800px; height: 500px; }

@ -2,9 +2,13 @@ import { Component, OnInit } from '@angular/core';
import {FormBuilder, FormGroup, Validators} from '@angular/forms'; import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {environment} from '../../../../environments/environment'; import {environment} from '../../../../environments/environment';
import {MerchantService} from '../../../services/merchant.service'; import {MerchantService} from '../../../services/merchant.service';
import {NzMessageService, NzUploadFile} from 'ng-zorro-antd'; import {NzMessageService} 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';
declare var AMap: any; // 一定要声明AMap,要不然报错找不到AMap
declare var AMapUI: any;
@Component({ @Component({
selector: 'app-store-edit', selector: 'app-store-edit',
@ -20,12 +24,10 @@ export class StoreEditComponent implements OnInit {
passwordVisible = false; passwordVisible = false;
logoFile = []; logoFile = [];
WEB_SERVE_URL = environment.baseUrl; WEB_SERVE_URL = environment.baseUrl;
previewImage: string | undefined = '';
previewVisible = false; previewVisible = false;
constructor( constructor(
private fb: FormBuilder, private fb: FormBuilder,
private merchant: MerchantService, private merchantStore: MerchantStoreService,
private message: NzMessageService, // 信息提示 private message: NzMessageService, // 信息提示
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
) { ) {
@ -33,25 +35,29 @@ export class StoreEditComponent implements OnInit {
ngOnInit(): void { ngOnInit(): void {
this.activatedRoute.queryParams.subscribe(queryParams => { this.activatedRoute.queryParams.subscribe(queryParams => {
if (queryParams.merchantId != null) { if (queryParams.storeId != null) {
this.editFlag = true; this.editFlag = true;
this.id = queryParams.merchantId; this.id = queryParams.storeId;
this.getDetails(queryParams.merchantId); this.getDetails(queryParams.storeId);
} else {
this.getMap ();
} }
}); });
this.validateForm = this.fb.group({ this.validateForm = this.fb.group({
loginTelephone: [null, [Validators.required, ValidatorsService.mobile]], telephone: [null, [Validators.required, ValidatorsService.mobile]],
password: [null, [Validators.required, ValidatorsService.minLength(6)]], password: [null, [Validators.required, ValidatorsService.minLength(6)]],
storeKey: [null, [Validators.required, ValidatorsService.maxLength(10)]], storeKey: [null, [Validators.required, ValidatorsService.maxLength(10)]],
storeKeyName: [null, [Validators.required, ValidatorsService.pwdLength(2, 12)]], storeName: [null, [Validators.required]],
telephone: [null, [Validators.required]],
address: [null, [Validators.required]], address: [null, [Validators.required]],
latitude: [null, [Validators.required]], latitude: [29.553134, [Validators.required]],
longitude: [null, [Validators.required]], longitude: [106.565428, [Validators.required]],
status: [null], status: [null],
companyId: [null],
merchantId: [null],
createTime: [null], createTime: [null],
secUser: {}, secUser: {},
}); });
} }
// 返回 // 返回
@ -75,8 +81,8 @@ export class StoreEditComponent implements OnInit {
return; return;
} }
} }
console.log(this.validateForm.value);
this.validateForm.value['secUser']['telephone'] = this.validateForm.value.loginTelephone; this.validateForm.value['secUser']['telephone'] = this.validateForm.value.telephone;
this.validateForm.value['secUser']['password'] = this.validateForm.value.password; 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) {
@ -85,10 +91,9 @@ export class StoreEditComponent implements OnInit {
this.validateForm.value.merchantLogo = this.logoFile[0].name; this.validateForm.value.merchantLogo = this.logoFile[0].name;
} }
} }
console.log(this.validateForm.value);
if (this.editFlag) { if (this.editFlag) {
this.validateForm.value.id = this.id; this.validateForm.value.id = this.id;
this.merchant.updateMerchant(this.validateForm.value, data => { this.merchantStore.updateMerchantStore(this.validateForm.value, data => {
if (data['return_code'] === '000000') { if (data['return_code'] === '000000') {
this.getBack(); this.getBack();
this.message.success('修改成功'); this.message.success('修改成功');
@ -98,8 +103,7 @@ export class StoreEditComponent implements OnInit {
}); });
} else { } else {
this.merchant.insertMerchant(this.validateForm.value, data => { this.merchantStore.insertMerchantStore(this.validateForm.value, data => {
console.log(data);
if (data['return_code'] === '000000') { if (data['return_code'] === '000000') {
this.getBack(); this.getBack();
this.message.success('添加成功'); this.message.success('添加成功');
@ -111,26 +115,66 @@ export class StoreEditComponent implements OnInit {
} }
public getDetails(id) { public getDetails(id) {
this.merchant.getMerchantById(id, data => { this.merchantStore.getMerchantStoreById(id, data => {
if (data['return_code'] === '000000') { if (data['return_code'] === '000000') {
data['return_data'].loginTelephone = data['return_data'].secUser.loginName; data['return_data'].telephone = data['return_data'].secUser.loginName;
data['return_data'].password = data['return_data'].secUser.password; data['return_data'].password = data['return_data'].secUser.password;
if (data['return_data']['merchantLogo'] != null && data['return_data']['merchantLogo'] !== '') {
const logo = String(data['return_data']['merchantLogo']);
const logoArray = [];
logoArray.push(
{
uid: 1,
name: logo,
status: 'done',
url: environment.imageUrl + logo
});
this.logoFile = logoArray;
}
this.validateForm.patchValue(data['return_data']); this.validateForm.patchValue(data['return_data']);
this.getMap ();
} else { } else {
this.message.create('error', data['return_msg']); this.message.create('error', data['return_msg']);
} }
}); });
} }
// 地图要放到函数里。
getMap() {
// tslint:disable-next-line:variable-name
AMapUI.loadUI(['misc/PositionPicker'], PositionPicker => {
console.log(this.validateForm.value);
const map = new AMap.Map('container', {
resizeEnable: true,
scrollWheel: false,
center: [this.validateForm.value.longitude, this.validateForm.value.latitude], // 初始化中心点坐标
zoom: 13,
});
AMap.plugin(['AMap.ToolBar', 'AMap.Autocomplete'], () => {
const toolbar = new AMap.ToolBar();
map.addControl(toolbar);
});
const autoOptions = {
// input 为绑定输入提示功能的input的DOM ID
input: 'input'
};
const autoComplete = new AMap.Autocomplete(autoOptions);
const placeSearch = new AMap.PlaceSearch({
map: map
}); // 构造地点查询类
AMap.event.addListener(autoComplete, 'select', select); // 注册监听,当选中某条记录时会触发
function select(e) {
placeSearch.setCity(e.poi.adcode);
placeSearch.search(e.poi.name); // 关键字查询查询
}
const positionPicker = new PositionPicker({
mode: 'dragMap',
map: map
});
positionPicker.on('success', positionResult => {
positionResult['latitude'] = positionResult.position.lat;
positionResult['longitude'] = positionResult.position.lng;
this.validateForm.patchValue(positionResult);
});
positionPicker.on('fail', positionResult => {
console.log(positionResult);
});
positionPicker.setMode('dragMap');
positionPicker.start();
map.panBy(0, 1);
map.addControl(new AMap.ToolBar({
liteStyle: true
}));
});
}
} }

@ -6,41 +6,23 @@
<div class="inner-content"> <div class="inner-content">
<form nz-form [formGroup]="searchForm" (ngSubmit)="getRequest(true , searchForm.value)"> <form nz-form [formGroup]="searchForm" (ngSubmit)="getRequest(true , searchForm.value)">
<div nz-row> <div nz-row>
<div nz-col nzSpan="6"> <div nz-col nzSpan="6">
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="6">商户编号</nz-form-label> <nz-form-label [nzSpan]="6">门店名称</nz-form-label>
<nz-form-control [nzSpan]="16">
<input nz-input formControlName="merchantKey"/>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="6">
<nz-form-item>
<nz-form-label [nzSpan]="6">商户名称</nz-form-label>
<nz-form-control [nzSpan]="16"> <nz-form-control [nzSpan]="16">
<input nz-input formControlName="merchantName"/> <input nz-input formControlName="storeName"/>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</div> </div>
<div nz-col nzSpan="6"> <div nz-col nzSpan="6">
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="6">商户电话</nz-form-label> <nz-form-label [nzSpan]="6">门店电话</nz-form-label>
<nz-form-control [nzSpan]="16"> <nz-form-control [nzSpan]="16">
<input nz-input formControlName="telephone"/> <input nz-input formControlName="telephone"/>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</div> </div>
<div nz-col nzSpan="6">
<nz-form-item>
<nz-form-label [nzSpan]="6">商户状态</nz-form-label>
<nz-form-control [nzSpan]="16">
<nz-select nzShowSearch nzAllowClear formControlName="status" nzPlaceHolder="请选择状态">
<nz-option nzLabel="禁用" nzValue="0"></nz-option>
<nz-option nzLabel="正常" nzValue="1"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
</div> </div>
<div nz-row> <div nz-row>
@ -55,6 +37,10 @@
<div class="inner-content"> <div class="inner-content">
<span>共计 {{total}} 条数据</span> <span>共计 {{total}} 条数据</span>
<span *ngIf="id != null" style="margin-left: 30px;;">
商戶名称:
<span style="font-weight: bold; font-size: 20px">{{name}}</span>
</span>
<div class="operating-button"> <div class="operating-button">
<button nz-button nzType="primary" class="right-btn" [routerLink]="['/admin/merchantStore/store-edit']" ><i nz-icon nzType="plus" nzTheme="outline"></i>添加</button> <button nz-button nzType="primary" class="right-btn" [routerLink]="['/admin/merchantStore/store-edit']" ><i nz-icon nzType="plus" nzTheme="outline"></i>添加</button>
</div> </div>
@ -74,35 +60,26 @@
<thead nzSingleSort> <thead nzSingleSort>
<tr> <tr>
<th nzWidth="50px">编号</th> <th nzWidth="50px">编号</th>
<th nzWidth="80px">商户编号</th> <th nzWidth="80px">门店编号</th>
<th nzWidth="80px">商户名称</th> <th nzWidth="80px">门店名称</th>
<th nzWidth="70px">商户LOGO</th> <th nzWidth="100px">门店电话</th>
<th nzWidth="100px">商户电话</th>
<th nzWidth="100px">创建时间</th> <th nzWidth="100px">创建时间</th>
<th nzWidth="50px">状态</th>
<th nzWidth="80px" nzRight="0px">操作</th> <th nzWidth="80px" nzRight="0px">操作</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<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.merchantKey}}</td> <td>{{data.storeKey}}</td>
<td>{{data.merchantName}}</td> <td>{{data.storeName}}</td>
<td>
<img class="head_img" src="{{data.merchantLogo}}" onerror="this.src='../../../../assets/admin/navigation/icon.png'" alt="">
</td>
<td>{{data.telephone}}</td> <td>{{data.telephone}}</td>
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td> <td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>{{data.status ===1 ? '正常' : '禁用'}}</td>
<td nzRight="0px" class="table-td-operation"> <td nzRight="0px" class="table-td-operation">
<a (click)="getEdit(data.id)"><i nz-icon nzType="form" nzTheme="outline" nz-tooltip="编辑"></i></a> <a (click)="getEdit(data.id)"><i nz-icon nzType="form" nzTheme="outline" nz-tooltip="编辑"></i></a>
<nz-divider nzType="vertical"></nz-divider> <nz-divider nzType="vertical"></nz-divider>
<a (click)="getDetail(data.id)"><i nz-icon [nzIconfont]="'icon-dingdanxiangqing_icon'" nz-tooltip="商户详情"></i></a> <a (click)="getDetail(data.id)"><i nz-icon [nzIconfont]="'icon-dingdanxiangqing_icon'" nz-tooltip="门店详情"></i></a>
<nz-divider nzType="vertical"></nz-divider>
<a (click)="getEdit(data.id)"><i nz-icon nzType="unordered-list" nzTheme="outline" nz-tooltip="门店列表"></i></a>
<nz-divider nzType="vertical"></nz-divider> <nz-divider nzType="vertical"></nz-divider>
<a *ngIf="data.status === 1" (click)='disableMerchant(data.id)'><i nz-icon nzType="stop" nzTheme="outline" nz-tooltip="禁用"></i></a> <a (click)="getDelete(data.id)"><i nz-icon nzType="delete" nzTheme="outline" nz-tooltip="删除"></i></a>
<a *ngIf="data.status !== 1" (click)='enableMerchant(data.id)'><i nz-icon nzType="check-circle" nzTheme="outline" nz-tooltip="启用"></i></a>
</td> </td>
</tbody> </tbody>
</nz-table> </nz-table>

@ -3,7 +3,7 @@ import {FormBuilder, FormGroup} from '@angular/forms';
import {MerchantService} from '../../../services/merchant.service'; import {MerchantService} from '../../../services/merchant.service';
import {IconService} from '../../../services/icon.service'; import {IconService} from '../../../services/icon.service';
import {NzMessageService} from 'ng-zorro-antd'; import {NzMessageService} from 'ng-zorro-antd';
import {Router} from '@angular/router'; import {ActivatedRoute, Router} from '@angular/router';
import {CommonsService} from '../../../services/commons.service'; import {CommonsService} from '../../../services/commons.service';
import {MerchantStoreService} from '../../../services/merchant-store.service'; import {MerchantStoreService} from '../../../services/merchant-store.service';
@ -20,31 +20,39 @@ export class StoreListComponent implements OnInit {
pageNum = 1; // 页码 pageNum = 1; // 页码
pageSize = 10; // 条码 pageSize = 10; // 条码
loading = true; loading = true;
id = null;
name: string;
constructor( constructor(
private form: FormBuilder, private form: FormBuilder,
private merchantStore: MerchantStoreService, private merchantStore: MerchantStoreService,
private iconService: IconService, private iconService: IconService,
private message: NzMessageService, private message: NzMessageService,
private router: Router, private router: Router,
private activatedRoute: ActivatedRoute,
private common: CommonsService private common: CommonsService
) { ) {
} }
ngOnInit(): void { ngOnInit(): void {
this.init(); this.init();
} }
public init(): void { public init(): void {
this.activatedRoute.queryParams.subscribe(queryParams => {
if (queryParams.merchantId != null) {
this.id = queryParams.merchantId;
this.name = queryParams.name;
}
});
this.searchForm = this.form.group({ this.searchForm = this.form.group({
merchantKey: [null], storeName: [null],
merchantName: [null],
telephone: [null], telephone: [null],
status: [null],
}); });
this.getRequest(true, this.searchForm.value); this.getRequest(true, this.searchForm.value);
} }
// 查询列表 // 查询列表
public getRequest(reset: boolean = false, whereObject: object) { public getRequest(reset: boolean = false, whereObject: object) {
@ -54,14 +62,28 @@ export class StoreListComponent implements OnInit {
} }
whereObject['pageNum'] = this.pageNum; whereObject['pageNum'] = this.pageNum;
whereObject['pageSize'] = this.pageSize; whereObject['pageSize'] = this.pageSize;
this.merchantStore.getStoreListByMerchant(whereObject, data => { if (this.id == null) {
if (data['return_code'] === '000000') { this.merchantStore.getStoreListByMerchant(whereObject, data => {
this.requestData = data['return_data'].list; if (data['return_code'] === '000000') {
this.total = data['return_data'].total; this.requestData = data['return_data'].list;
} else { this.total = data['return_data'].total;
this.message.error(data['return_msg']); } else {
} this.message.error(data['return_msg']);
}); }
});
} else {
whereObject['merchantId'] = this.id;
this.merchantStore.getStoreListByCompany(whereObject, data => {
if (data['return_code'] === '000000') {
this.requestData = data['return_data'].list;
this.total = data['return_data'].total;
} else {
this.message.error(data['return_msg']);
}
});
}
} }
// 重置 // 重置
@ -69,29 +91,12 @@ export class StoreListComponent implements OnInit {
this.searchForm.reset(); this.searchForm.reset();
} }
// 禁用商户 // 禁用门店
public disableMerchant(id): void { public getDelete(id): void {
const message = '是否禁用商户'; const message = '是否删除门店';
this.common.showConfirm(message, data => {
if (data) {
this.merchantStore.disableMerchant(id, dataReturn => {
if (dataReturn['return_code'] === '000000') {
this.message.success('操作成功');
this.getRequest(false , this.searchForm.value);
} else {
this.message.warning(dataReturn['return_msg']);
}
});
}
});
}
// 启动商户
public enableMerchant(id): void {
const message = '是否启用商户';
this.common.showConfirm(message, data => { this.common.showConfirm(message, data => {
if (data) { if (data) {
this.merchantStore.enableMerchant(id, dataReturn => { this.merchantStore.deleteMerchantStore(id, dataReturn => {
if (dataReturn['return_code'] === '000000') { if (dataReturn['return_code'] === '000000') {
this.message.success('操作成功'); this.message.success('操作成功');
this.getRequest(false , this.searchForm.value); this.getRequest(false , this.searchForm.value);
@ -103,31 +108,22 @@ export class StoreListComponent implements OnInit {
}); });
} }
// 修改 // 修改
public getEdit(id: number): void { public getEdit(id: number): void {
this.router.navigate(['/admin/merchant/merchant-edit'], { this.router.navigate(['/admin/merchantStore/store-edit'], {
queryParams: { queryParams: {
merchantId: id storeId: id
} }
}).then(r => console.log(r)); }).then(r => console.log(r));
} }
// 查看详情 // 查看详情
public getDetail(id: number): void { public getDetail(id: number): void {
this.router.navigate(['/admin/merchant/merchant-detail'], { this.router.navigate(['/admin/merchantStore/store-detail'], {
queryParams: { queryParams: {
merchantId: id storeId: id
} }
}).then(r => console.log(r)); }).then(r => console.log(r));
} }
// 查看门店列表
public getList(id: number): void {
this.router.navigate(['/admin/merchant/merchant-detail'], {
queryParams: {
merchantId: id
}
}).then(r => console.log(r));
}
} }

@ -27,11 +27,10 @@ export class MerchantDetailComponent implements OnInit {
}); });
} }
// 查询课程详情 // 查询详情
public getDetails(id: number) { public getDetails(id: number) {
this.merchant.getMerchantById(id , data => { this.merchant.getMerchantById(id , data => {
this.data = data['return_data']; this.data = data['return_data'];
console.log(data);
}); });
} }

@ -96,7 +96,7 @@ export class MerchantEditComponent implements OnInit {
this.validateForm.value.merchantLogo = this.logoFile[0].name; this.validateForm.value.merchantLogo = this.logoFile[0].name;
} }
} }
console.log(this.validateForm.value);
if (this.editFlag) { if (this.editFlag) {
this.validateForm.value.id = this.id; this.validateForm.value.id = this.id;
this.merchant.updateMerchant(this.validateForm.value, data => { this.merchant.updateMerchant(this.validateForm.value, data => {

@ -99,7 +99,7 @@
<nz-divider nzType="vertical"></nz-divider> <nz-divider nzType="vertical"></nz-divider>
<a (click)="getDetail(data.id)"><i nz-icon [nzIconfont]="'icon-dingdanxiangqing_icon'" nz-tooltip="商户详情"></i></a> <a (click)="getDetail(data.id)"><i nz-icon [nzIconfont]="'icon-dingdanxiangqing_icon'" nz-tooltip="商户详情"></i></a>
<nz-divider nzType="vertical"></nz-divider> <nz-divider nzType="vertical"></nz-divider>
<a (click)="getList(data.id)"><i nz-icon nzType="unordered-list" nzTheme="outline" nz-tooltip="门店列表"></i></a> <a (click)="getList(data.id , data.merchantName)"><i nz-icon nzType="unordered-list" nzTheme="outline" nz-tooltip="门店列表"></i></a>
<nz-divider nzType="vertical"></nz-divider> <nz-divider nzType="vertical"></nz-divider>
<a *ngIf="data.status === 1" (click)='disableMerchant(data.id)'><i nz-icon nzType="stop" nzTheme="outline" nz-tooltip="禁用"></i></a> <a *ngIf="data.status === 1" (click)='disableMerchant(data.id)'><i nz-icon nzType="stop" nzTheme="outline" nz-tooltip="禁用"></i></a>
<a *ngIf="data.status !== 1" (click)='enableMerchant(data.id)'><i nz-icon nzType="check-circle" nzTheme="outline" nz-tooltip="启用"></i></a> <a *ngIf="data.status !== 1" (click)='enableMerchant(data.id)'><i nz-icon nzType="check-circle" nzTheme="outline" nz-tooltip="启用"></i></a>

@ -123,10 +123,11 @@ export class MerchantListComponent implements OnInit {
} }
// 查看门店列表 // 查看门店列表
public getList(id: number): void { public getList(id: number , merchantName: string): void {
this.router.navigate(['/admin/merchant/merchant-detail'], { this.router.navigate(['/admin/merchantStore/store-list'], {
queryParams: { queryParams: {
merchantId: id merchantId: id,
name: merchantName,
} }
}).then(r => console.log(r)); }).then(r => console.log(r));
} }

@ -25,6 +25,18 @@ export class MerchantStoreService {
}); });
} }
/**
*
*
* @param paramsObject
* @param callBack
*/
public getStoreListByCompany(paramsObject: object, callBack) {
this.http.get(environment.baseUrl + 'highMerchantStore/getStoreListByCompany?' + this.common.getWhereCondition(paramsObject)).subscribe(data => {
callBack(data);
});
}
/** /**
* *
* *
@ -32,8 +44,8 @@ export class MerchantStoreService {
* @param callBack * @param callBack
* @return data * @return data
*/ */
public insertMerchant(params: object, callBack) { public insertMerchantStore(params: object, callBack) {
this.http.post(environment.baseUrl + 'highMerchant/insertMerchant', params).subscribe(data => { this.http.post(environment.baseUrl + 'highMerchantStore/insertMerchantStore', params).subscribe(data => {
callBack(data); callBack(data);
}); });
} }
@ -45,8 +57,8 @@ export class MerchantStoreService {
* @param callBack * @param callBack
* @return data * @return data
*/ */
public updateMerchant(params: object, callBack) { public updateMerchantStore(params: object, callBack) {
this.http.post(environment.baseUrl + 'highMerchant/updateMerchant', params).subscribe(data => { this.http.post(environment.baseUrl + 'highMerchantStore/updateMerchantStore', params).subscribe(data => {
callBack(data); callBack(data);
}); });
} }
@ -57,8 +69,8 @@ export class MerchantStoreService {
* @param merchantId id * @param merchantId id
* @param callBack * @param callBack
*/ */
public getMerchantById(merchantId: number, callBack) { public getMerchantStoreById(merchantId: number, callBack) {
this.http.get(environment.baseUrl + 'highMerchant/getMerchantById?id=' + merchantId).subscribe(data => { this.http.get(environment.baseUrl + 'highMerchantStore/getMerchantStoreById?id=' + merchantId).subscribe(data => {
callBack(data); callBack(data);
}); });
} }
@ -70,22 +82,11 @@ export class MerchantStoreService {
* @param id id * @param id id
* @param callBack * @param callBack
*/ */
public disableMerchant(id: number, callBack) { public deleteMerchantStore(id: number, callBack) {
this.http.get(environment.baseUrl + 'highMerchant/disableMerchant?id=' + id).subscribe(data => { this.http.get(environment.baseUrl + 'highMerchantStore/deleteMerchantStore?id=' + id).subscribe(data => {
callBack(data); callBack(data);
}); });
} }
/**
*
*
* @param id id
* @param callBack
*/
public enableMerchant(id: number, callBack) {
this.http.get(environment.baseUrl + 'highMerchant/enableMerchant?id=' + id).subscribe(data => {
callBack(data);
});
}
} }

@ -5,6 +5,8 @@
<title>嗨商城</title> <title>嗨商城</title>
<base href="/"> <base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://webapi.amap.com/maps?v=1.4.3&key=3a42e959c2a1e1d76e691bc1cc25a0b0&plugin=AMap.ToolBar,AMap.Autocomplete,AMap.PlaceSearch"></script>
<script src="//webapi.amap.com/ui/1.1/main.js"></script>
<link rel="icon" type="image/x-icon" href="favicon.ico"> <link rel="icon" type="image/x-icon" href="favicon.ico">
</head> </head>
<body> <body>

@ -17,7 +17,8 @@
"lib": [ "lib": [
"es2018", "es2018",
"dom" "dom"
] ],
"allowSyntheticDefaultImports": true
}, },
"angularCompilerOptions": { "angularCompilerOptions": {
"fullTemplateTypeCheck": true, "fullTemplateTypeCheck": true,

Loading…
Cancel
Save