pull/1/head
袁野 4 years ago
parent 0c87526fe8
commit 596ff57f2d
  1. 4
      src/app/admin/coupon/coupon-list/coupon-list.component.html
  2. 48
      src/app/admin/system/sinopec-config/sinopec-config.component.html
  3. 0
      src/app/admin/system/sinopec-config/sinopec-config.component.scss
  4. 90
      src/app/admin/system/sinopec-config/sinopec-config.component.ts
  5. 48
      src/app/admin/system/sinopec-edit/sinopec-edit.component.html
  6. 6
      src/app/admin/system/sinopec-edit/sinopec-edit.component.scss
  7. 99
      src/app/admin/system/sinopec-edit/sinopec-edit.component.ts
  8. 4
      src/app/admin/system/system-routing.module.ts
  9. 4
      src/app/admin/system/system.module.ts
  10. 59
      src/app/services/system.service.ts

@ -131,8 +131,8 @@
<a *ngIf="data.status === 2" (click)="disableMerchant(data.id)"> <i nz-icon [nzIconfont]="'icon-xiajia'" nz-tooltip="下架"></i></a>
<nz-divider *ngIf="data.status !== 101" nzType="vertical"></nz-divider>
<a (click)="getList(data.id , data.couponName , data.couponType)"><i nz-icon nzType="unordered-list" nzTheme="outline" nz-tooltip="销售码列表"></i></a>
<nz-divider *ngIf="data.status !== 101" nzType="vertical"></nz-divider>
<a *ngIf="data.status !== 101" (click)="getDelete(data.id)"><i nz-icon nzType="delete" nzTheme="outline" nz-tooltip="删除"></i></a>
<!-- <nz-divider *ngIf="data.status !== 101" nzType="vertical"></nz-divider>-->
<!-- <a *ngIf="data.status !== 101" (click)="getDelete(data.id)"><i nz-icon nzType="delete" nzTheme="outline" nz-tooltip="删除"></i></a>-->
</td>
</tbody>
</nz-table>

@ -0,0 +1,48 @@
<!-- start 面包屑 -->
<app-breadcrumb></app-breadcrumb>
<!-- end 面包屑 -->
<div class="inner-content">
<span>共计 {{total}} 条数据</span>
<div class="operating-button">
<button nz-button nzType="primary" class="right-btn" [routerLink]="['/admin/system/sinopec-edit']" ><i nz-icon nzType="plus" nzTheme="outline"></i>添加</button>
</div>
<nz-table
class="table"
#ajaxTable
nzShowSizeChanger
[nzFrontPagination]="false"
[nzData]="requestData"
[nzLoading]="loading"
[nzTotal]="total"
[(nzPageIndex)]="pageNum"
[(nzPageSize)]="pageSize"
[nzScroll]="{ x: '1200px' }"
(nzPageIndexChange)="getRequest(false , searchForm.value)"
(nzPageSizeChange)="getRequest(false , searchForm.value)">
<thead nzSingleSort>
<tr>
<th nzWidth="50px">编号</th>
<th nzWidth="80px">客户AppId</th>
<th nzWidth="80px">客户密码</th>
<th nzWidth="100px">客户编码</th>
<!-- <th nzWidth="100px">创建时间</th>-->
<th nzWidth="80px" nzRight="0px">操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of ajaxTable.data; let i = index">
<td>{{i+1}}</td>
<td>{{data.appId}}</td>
<td>{{data.appSecret}}</td>
<td>{{data.code}}</td>
<!-- <td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>-->
<td nzRight="0px" class="table-td-operation">
<a (click)="getEdit(data.id)"><i nz-icon nzType="form" nzTheme="outline" nz-tooltip="编辑"></i></a>
</td>
</tbody>
</nz-table>
</div>

@ -0,0 +1,90 @@
import { Component, OnInit } from '@angular/core';
import {environment} from '../../../../environments/environment';
import {FormBuilder, FormGroup} from '@angular/forms';
import {MerchantService} from '../../../services/merchant.service';
import {IconService} from '../../../services/icon.service';
import {NzMessageService} from 'ng-zorro-antd';
import {Router} from '@angular/router';
import {SystemService} from '../../../services/system.service';
@Component({
selector: 'app-sinopec-config',
templateUrl: './sinopec-config.component.html',
styleUrls: ['./sinopec-config.component.scss']
})
export class SinopecConfigComponent implements OnInit {
WEB_SERVE_URL = environment.imageUrl;
searchForm: FormGroup; // 搜索框
requestData = []; // 列表数据
total: number; // 页码
pageNum = 1; // 页码
pageSize = 10; // 条码
loading = true;
constructor(
private form: FormBuilder,
private system: SystemService,
private iconService: IconService,
private message: NzMessageService,
private router: Router,
) {
}
ngOnInit(): void {
this.init();
}
public init(): void {
this.searchForm = this.form.group({
merchantKey: [null],
merchantName: [null],
telephone: [null],
status: [null],
});
this.getRequest(true, this.searchForm.value);
}
// 查询列表
public getRequest(reset: boolean = false, whereObject: object) {
this.loading = false;
if (reset) {
this.pageNum = 1;
}
whereObject['pageNum'] = this.pageNum;
whereObject['pageSize'] = this.pageSize;
this.system.getListSinopecConfig(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']);
}
});
}
// 重置
public resetForm(): void {
this.searchForm.reset();
}
// 修改
public getEdit(id: number): void {
this.router.navigate(['/admin/system/sinopec-edit'], {
queryParams: {
merchantId: id
}
}).then(r => console.log(r));
}
// 查看详情
public getDetail(id: number): void {
this.router.navigate(['/admin/system/sinopec-detail'], {
queryParams: {
merchantId: id
}
}).then(r => console.log(r));
}
}

@ -0,0 +1,48 @@
<!-- start 面包屑 -->
<nz-breadcrumb>
<nz-breadcrumb-item>
<a (click)="getBack()">系统管理</a>
</nz-breadcrumb-item>
<nz-breadcrumb-item>
编辑配置
</nz-breadcrumb-item>
</nz-breadcrumb>
<!-- end 面包屑 -->
<nz-content class="inner-content">
<form nz-form [formGroup]="validateForm" class="ant-advanced-search-form">
<div nz-row [nzGutter]="24">
<div nz-col [nzSpan]="8">
<nz-form-item>
<nz-form-label [nzFor]="'appId'" nzRequired>客户AppId</nz-form-label>
<nz-form-control nzErrorTip="请输入客户AppId!">
<input nz-input placeholder="请输入客户AppId..." [formControlName]="'appId'" id="'appId'" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="8">
<nz-form-item>
<nz-form-label [nzFor]="'appSecret'" nzRequired>客户密码</nz-form-label>
<nz-form-control nzErrorTip="请输入客户密码!">
<input nz-input placeholder="请输入客户密码..." [formControlName]="'appSecret'" id="'appSecret'" />
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="8">
<nz-form-item>
<nz-form-label [nzFor]="'code'" nzRequired>客户编码</nz-form-label>
<nz-form-control nzErrorTip="请输入客户编码!">
<input nz-input placeholder="请输入客户编码..." [formControlName]="'code'" id="'code'" />
</nz-form-control>
</nz-form-item>
</div>
</div>
<div nz-row>
<div nz-col [nzSpan]="24" class="search-area">
<button nz-button (click)="resetForm()">重置</button>
<button nz-button [nzType]="'primary'" (click)="getSave()">提交</button>
</div>
</div>
</form>
</nz-content>

@ -0,0 +1,6 @@
button {
margin-left: 8px;
}
:host ::ng-deep .ant-upload {
background-color: #ffffff;
}

@ -0,0 +1,99 @@
import { Component, OnInit } from '@angular/core';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {environment} from '../../../../environments/environment';
import {MerchantService} from '../../../services/merchant.service';
import {NzMessageService} from 'ng-zorro-antd';
import {ActivatedRoute} from '@angular/router';
import {SystemService} from '../../../services/system.service';
@Component({
selector: 'app-sinopec-edit',
templateUrl: './sinopec-edit.component.html',
styleUrls: ['./sinopec-edit.component.scss']
})
export class SinopecEditComponent implements OnInit {
validateForm!: FormGroup;
data: any;
editFlag = false;
id: number;
WEB_SERVE_URL = environment.baseUrl;
constructor(
private fb: FormBuilder,
private system: SystemService,
private message: NzMessageService, // 信息提示
private activatedRoute: ActivatedRoute,
) {
}
ngOnInit(): void {
this.activatedRoute.queryParams.subscribe(queryParams => {
if (queryParams.sinopecId != null) {
this.editFlag = true;
this.id = queryParams.sinopecId;
this.getDetails(queryParams.sinopecId);
}
});
this.validateForm = this.fb.group({
appId: [null, [Validators.required]],
appSecret: [null, [Validators.required]],
code: [null, [Validators.required]],
});
}
// 返回
getBack() {
history.back();
}
// 重置
public resetForm(): void {
this.validateForm.reset();
}
// 保存
public getSave(): void {
// tslint:disable-next-line:forin
for (const i in this.validateForm.controls) {
this.validateForm.controls[i].markAsDirty();
this.validateForm.controls[i].updateValueAndValidity();
if (this.validateForm.controls[i].errors != null) {
this.message.error('必填项不能为空');
return;
}
}
if (this.editFlag) {
this.validateForm.value.id = this.id;
this.system.updateMerchant(this.validateForm.value, data => {
if (data['return_code'] === '000000') {
this.getBack();
this.message.success('修改成功');
} else {
this.message.create('error', data['return_msg']);
}
});
} else {
this.system.insertMerchant(this.validateForm.value, data => {
if (data['return_code'] === '000000') {
this.getBack();
this.message.success('添加成功');
} else {
this.message.create('error', data['return_msg']);
}
});
}
}
public getDetails(id) {
this.system.findById(id, data => {
if (data['return_code'] === '000000') {
this.validateForm.patchValue(data['return_data']);
} else {
this.message.create('error', data['return_msg']);
}
});
}
}

@ -7,6 +7,8 @@ import {SystemUserComponent} from './system-user/system-user.component';
import {PermissionComponent} from './permission/permission.component';
import {MenuComponent} from './menu/menu.component';
import {PositionRelComponent} from './position-rel/position-rel.component';
import {SinopecConfigComponent} from './sinopec-config/sinopec-config.component';
import {SinopecEditComponent} from './sinopec-edit/sinopec-edit.component';
const routes: Routes = [
{ path: 'systemorganization', component: SystemOrganizationComponent},
@ -16,6 +18,8 @@ const routes: Routes = [
{ path: 'menu', component: MenuComponent },
{ path: 'permission', component: PermissionComponent },
{ path: 'positionrel', component: PositionRelComponent },
{ path: 'sinopec-config', component: SinopecConfigComponent },
{ path: 'sinopec-edit', component: SinopecEditComponent },
];
@NgModule({

@ -16,8 +16,10 @@ import {BreadcrumbModule} from '../../common/breadcrumb/breadcrumb.module';
import {RegionSelectorModule} from '../../common/region-selector/region-selector.module';
import { PositionRelComponent } from './position-rel/position-rel.component';
import {AppCommonModule} from '../../app-common.module';
import { SinopecConfigComponent } from './sinopec-config/sinopec-config.component';
import { SinopecEditComponent } from './sinopec-edit/sinopec-edit.component';
@NgModule({
declarations: [SystemOrganizationComponent, SystemRoleComponent, SystemRoleShowComponent, SystemUserComponent, MenuComponent, PermissionComponent, PositionRelComponent],
declarations: [SystemOrganizationComponent, SystemRoleComponent, SystemRoleShowComponent, SystemUserComponent, MenuComponent, PermissionComponent, PositionRelComponent, SinopecConfigComponent, SinopecEditComponent],
imports: [
CommonModule,
SystemRoutingModule,

@ -1,6 +1,7 @@
import {Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {environment} from '../../environments/environment';
import {CommonsService} from './commons.service';
/**
*
@ -11,7 +12,10 @@ import {environment} from '../../environments/environment';
})
export class SystemService {
constructor(private http: HttpClient) { }
constructor(
private http: HttpClient,
private common: CommonsService
) { }
/**
*
@ -110,4 +114,57 @@ export class SystemService {
callBack(data);
});
}
/**
*
*
* @param paramsObject
* @param callBack
*/
public getListSinopecConfig(paramsObject: object, callBack) {
this.http.get(environment.baseUrl + 'secSinopecConfig/getListSinopecConfig?' + this.common.getWhereCondition(paramsObject)).subscribe(data => {
callBack(data);
});
}
/**
*
*
* @param params
* @param callBack
* @return data
*/
public insertMerchant(params: object, callBack) {
this.http.post(environment.baseUrl + 'secSinopecConfig/insertSinopec', params).subscribe(data => {
callBack(data);
});
}
/**
*
*
* @param params
* @param callBack
* @return data
*/
public updateMerchant(params: object, callBack) {
this.http.post(environment.baseUrl + 'secSinopecConfig/updateSinopec', params).subscribe(data => {
callBack(data);
});
}
/**
* id查询详情
*
* @param sinopecId id
* @param callBack
*/
public findById(sinopecId: number, callBack) {
this.http.get(environment.baseUrl + 'secSinopecConfig/findById?sinopecId=' + sinopecId).subscribe(data => {
callBack(data);
});
}
}

Loading…
Cancel
Save