提交商品添加

2.0-dev
袁野 2 years ago
parent 3435e0f028
commit 0110ded77d
  1. 2
      src/app/admin/activate/activate-list/activate-list.component.ts
  2. 8
      src/app/admin/activate/activate-lottery-record/activate-lottery-record.component.ts
  3. 18
      src/app/admin/config-manage/brand/brand.component.html
  4. 1
      src/app/admin/config-manage/brand/brand.component.ts
  5. 4
      src/app/admin/config-manage/config-manage.module.ts
  6. 83
      src/app/admin/config-manage/goods-type/goods-type.component.html
  7. 4
      src/app/admin/config-manage/goods-type/goods-type.component.scss
  8. 85
      src/app/admin/config-manage/goods-type/goods-type.component.ts
  9. 3
      src/app/admin/index/index/index.component.ts
  10. 1
      src/app/admin/login/login/login.component.ts
  11. 5
      src/app/app-routing.module.ts
  12. 26
      src/app/services/commons.service.ts
  13. 14
      src/app/services/config.service.ts
  14. 2
      src/app/services/icon.service.ts
  15. 2
      src/environments/environment.ts

@ -6,7 +6,7 @@ import {NzMessageService} from 'ng-zorro-antd';
import {CommonsService} from '../../../services/commons.service';
import {FormBuilder, FormGroup} from '@angular/forms';
import {Router} from '@angular/router';
import {ActivateService} from "../../../services/activate.service";
import {ActivateService} from '../../../services/activate.service';
@Component({
selector: 'app-activate-list',

@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';
import {ActivateService} from "../../../services/activate.service";
import {IconService} from "../../../services/icon.service";
import {ActivateService} from '../../../services/activate.service';
import {IconService} from '../../../services/icon.service';
import { Params, ActivatedRoute } from '@angular/router';
import {FormBuilder, FormGroup} from '@angular/forms';
import {NzMessageService} from 'ng-zorro-antd';
@ -98,10 +98,10 @@ export class ActivateLotteryRecordComponent implements OnInit {
this.message.error('请输入新增数量!');
return;
}
let post = {
const post = {
activityAwardId: this.id ,
num: this.num
}
};
this.activate.numberOfNewRewards(post , data => {
if (data['return_code'] === '000000') {
this.isVisible = false;

@ -69,7 +69,7 @@
<td>{{i+1}}</td>
<td>{{data.title}}</td>
<td>
<img class="head_img" src="{{imageUrl + data.img}}" onerror="this.src='../../../../assets/admin/navigation/icon.png'" alt="">
<app-preview-image [previewImage] = data.img ></app-preview-image>
</td>
<td>{{data.createdTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>{{data.updatedTime | date: 'yyyy-MM-dd HH:mm'}}</td>
@ -90,14 +90,14 @@
<input nz-input placeholder="请输入标题..." [formControlName]="'title'" />
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired>商品类别</nz-form-label>
<nz-form-control [nzSpan]="12" nzErrorTip="请选择商品类别!">
<nz-select nzShowSearch nzAllowClear formControlName="goodTypeId" nzPlaceHolder="请选择商品类别">
<nz-option *ngFor="let item of goodTypData" nzLabel="{{item.title}}" nzValue="{{item.id}}"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<!-- <nz-form-item>-->
<!-- <nz-form-label [nzSpan]="4" nzRequired>商品类别</nz-form-label>-->
<!-- <nz-form-control [nzSpan]="12" nzErrorTip="请选择商品类别!">-->
<!-- <nz-select nzShowSearch nzAllowClear formControlName="goodTypeId" nzPlaceHolder="请选择商品类别">-->
<!-- <nz-option *ngFor="let item of goodTypData" nzLabel="{{item.title}}" nzValue="{{item.id}}"></nz-option>-->
<!-- </nz-select>-->
<!-- </nz-form-control>-->
<!-- </nz-form-item>-->
<nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired>图片</nz-form-label>
<nz-form-control [nzSpan]="20" nzErrorTip="请上传图片!">

@ -61,7 +61,6 @@ export class BrandComponent implements OnInit {
});
this.validateForm = this.fb.group({
title: [null, [Validators.required]],
goodTypeId: [null, [Validators.required]],
});
this.getRequest(true, this.searchForm.value);

@ -13,6 +13,7 @@ import { ThirdProductComponent } from './third-product/third-product.component';
import {AppCommonModule} from '../../app-common.module';
import { MemberProductComponent } from './member-product/member-product.component';
import { IntegralRebateComponent } from './integral-rebate/integral-rebate.component';
import {PreviewImageModule} from "../../common/preview-image/preview-image.module";
@NgModule({
@ -26,7 +27,8 @@ import { IntegralRebateComponent } from './integral-rebate/integral-rebate.compo
FormsModule,
BreadcrumbModule,
RegionSelectorModule,
AppCommonModule
AppCommonModule,
PreviewImageModule
]
})
export class ConfigManageModule { }

@ -6,7 +6,7 @@
<div class="inner-content">
<form nz-form [formGroup]="searchForm" (ngSubmit)="getRequest(true , searchForm.value)">
<div nz-row>
<div nz-col nzSpan="6">
<div nz-col nzSpan="8">
<nz-form-item>
<nz-form-label [nzSpan]="6">标题</nz-form-label>
<nz-form-control [nzSpan]="16">
@ -14,6 +14,26 @@
</nz-form-control>
</nz-form-item>
</div>
<!-- <div nz-col [nzSpan]="8">-->
<!-- <nz-form-item>-->
<!-- <nz-form-label [nzFor]="'businessType'" >一级分类</nz-form-label>-->
<!-- <nz-form-control>-->
<!-- <nz-select nzPlaceHolder="请选择一级分类" nzShowSearch [formControlName]="'parentId'">-->
<!-- <nz-option *ngFor="let item of goodsTypeData" nzValue="{{item.id}}" nzLabel="{{item.title}}"></nz-option>-->
<!-- </nz-select>-->
<!-- </nz-form-control>-->
<!-- </nz-form-item>-->
<!-- </div>-->
<div nz-col [nzSpan]="8">
<nz-form-item>
<nz-form-label [nzFor]="'businessType'" >业务类型</nz-form-label>
<nz-form-control>
<nz-select nzPlaceHolder="请选择业务类型" nzShowSearch [formControlName]="'businessType'">
<nz-option *ngFor="let item of businessTypeS" nzValue="{{item.codeValue}}" nzLabel="{{item.codeName}}"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
</div>
<div nz-row>
@ -25,7 +45,6 @@
</form>
</div>
<div class="inner-content">
<span>共计 {{total}} 条数据</span>
<div class="operating-button">
@ -35,6 +54,7 @@
class="table"
#ajaxTable
nzShowSizeChanger
nzBordered
[nzFrontPagination]="false"
[nzData]="requestData"
[nzLoading]="loading"
@ -51,7 +71,7 @@
<th nzWidth="80px">图片</th>
<th nzWidth="100px">创建时间</th>
<th nzWidth="100px">更新时间</th>
<th nzWidth="80px" nzRight="0px">操作</th>
<th nzWidth="70px" nzRight="0px">操作</th>
</tr>
</thead>
<tbody>
@ -59,20 +79,28 @@
<td>{{i+1}}</td>
<td>{{data.title}}</td>
<td>
<img class="head_img" src="{{imageUrl + data.img}}" onerror="this.src='../../../../assets/admin/navigation/icon.png'" alt="">
<app-preview-image [previewImage] = data.img ></app-preview-image>
</td>
<td>{{data.createdTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>{{data.updatedTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td nzRight="0px" class="table-td-operation">
<a (click)="getEdit(data.id)">编辑</a>
<nz-divider nzType="vertical"></nz-divider>
<a (click)="showDeleteConfirm(data.id)">删除</a>
<a nz-dropdown [nzDropdownMenu]="menu">更多操作<i nz-icon nzType="down"></i></a>
<nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu nzSelectable>
<li nz-menu-item> <a (click)="getGoodsTypesChild(data.id)">查看子类</a></li>
<li nz-menu-item> <a (click)="getEdit(data.id , data.id , data.title)">添加子类</a></li>
<li nz-menu-item> <a (click)="showDeleteConfirm(data.id)">删除</a></li>
</ul>
</nz-dropdown-menu>
</td>
</tbody>
</nz-table>
</div>
<nz-modal [(nzVisible)]="isVisible" nzTitle="编辑" (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()">
<nz-modal [(nzVisible)]="isVisible" nzTitle="{{editTitle}}" (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()">
<form nz-form [formGroup]="validateForm">
<nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired>标题</nz-form-label>
@ -81,15 +109,17 @@
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="4">使用业务</nz-form-label>
<nz-form-label [nzSpan]="4" nzRequired>业务类型</nz-form-label>
<nz-form-control [nzSpan]="12">
<input nz-input placeholder="请输入使用业务..." [formControlName]="'userService'" />
<nz-select nzPlaceHolder="请选择业务类型" [formControlName]="'businessType'">
<nz-option *ngFor="let item of businessTypeS" [nzValue]="item.codeValue" nzLabel="{{item.codeName}}"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="4" nzRequired>图片</nz-form-label>
<nz-form-control [nzSpan]="20" nzErrorTip="请上传图片!">
<nz-form-control [nzSpan]="20" nzErrorTip="请!">
<nz-upload
nzAction="{{WEB_SERVE_URL}}/fileUpload/uploadfile"
nzListType="picture-card"
@ -109,3 +139,36 @@
</nz-form-item>
</form>
</nz-modal>
<nz-modal [(nzVisible)]="listModal" nzTitle="子类列表" (nzOnCancel)="listModal = false" [nzFooter]="null"
nzWidth="1000px" [nzBodyStyle]=" { padding: '20px 20px 30px 20px'}">
<nz-spin [nzSpinning]="listModalLoading">
<nz-table nzBordered #childOrder [nzData]="goodsTypeDataChild" [nzHideOnSinglePage]="true">
<thead>
<tr>
<th nzWidth="80px">标题</th>
<th nzWidth="80px">图片</th>
<th nzWidth="100px">创建时间</th>
<th nzWidth="100px">更新时间</th>
<th nzWidth="70px" nzRight="0px">操作</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of childOrder.data">
<td>{{data.title}}</td>
<td>
<app-preview-image [previewImage] = data.img ></app-preview-image>
</td>
<td>{{data.createdTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>{{data.updatedTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td nzRight="0px" class="table-td-operation">
<a (click)="getEdit(data.id)">编辑</a>
<nz-divider nzType="vertical"></nz-divider>
<a (click)="showDeleteConfirm(data.id)">删除</a>
</td>
</tr>
</tbody>
</nz-table>
</nz-spin>
</nz-modal>

@ -1,4 +0,0 @@
.head_img {
height: 60px;
width: 60px;
}

@ -5,6 +5,7 @@ import {IconService} from '../../../services/icon.service';
import {NzMessageService, NzModalService, NzUploadFile} from 'ng-zorro-antd';
import {ConfigService} from '../../../services/config.service';
import {Router} from '@angular/router';
import {CommonsService} from "../../../services/commons.service";
function getBase64(file: File): Promise<string | ArrayBuffer | null> {
return new Promise((resolve, reject) => {
@ -37,7 +38,14 @@ export class GoodsTypeComponent implements OnInit {
imgFile = [];
previewImage: string | undefined = '';
previewVisible = false;
businessTypeS;
goodsTypeData;
goodsTypeDataChild;
parentIdIsShow = false;
listModal = false;
listModalLoading = false;
editTitle = '编辑';
parentId;
constructor(
private form: FormBuilder,
private config: ConfigService,
@ -45,6 +53,7 @@ export class GoodsTypeComponent implements OnInit {
private message: NzMessageService,
private router: Router,
private modalService: NzModalService,
private commonsService: CommonsService,
private fb: FormBuilder,
) {
}
@ -56,12 +65,20 @@ export class GoodsTypeComponent implements OnInit {
public init(): void {
this.searchForm = this.form.group({
title: [null],
businessType: [null],
parentId: [null],
});
this.validateForm = this.fb.group({
title: [null, [Validators.required]],
userService: [null],
businessType: [null , [Validators.required]],
parentId: [null],
});
this.getRequest(true, this.searchForm.value);
this.getListGoodsTypeByParentId();
this.commonsService.getDictionary('BUSINESS_TYPE', data => {
this.businessTypeS = data['return_data'];
});
}
// 图片查看
@ -74,6 +91,16 @@ export class GoodsTypeComponent implements OnInit {
this.previewVisible = true;
}
public getListGoodsTypeByParentId(parentId?: number): void {
this.config.getListGoodsTypeByParentId(parentId , data => {
if (data['return_code'] === '000000') {
parentId == null ? this.goodsTypeData = data['return_data'] : this.goodsTypeDataChild = data['return_data'];
} else {
this.message.error(data['return_msg']);
}
});
}
// 查询列表
public getRequest(reset: boolean = false, whereObject: object) {
@ -100,23 +127,20 @@ export class GoodsTypeComponent implements OnInit {
// 修改
public getEdit(id?: number): void {
public getEdit(id?: number , parentId?: number , title?: string): void {
this.id = id;
if (id != null) {
this.parentId = parentId;
if (title != null) {
this.editTitle = title + '添加子类';
}
if (id != null && parentId == null) {
this.editFlag = true;
this.config.getGoodsTypeById(id, data => {
if (data['return_data']['img'] != null && data['return_data']['img'] !== '') {
const img = String(data['return_data']['img']);
const imgArray = [];
imgArray.push(
{
uid: 1,
name: img,
status: 'done',
url: environment.imageUrl + img
});
this.imgFile = imgArray;
if (!this.commonsService.whetherStringIsNull(data['return_data']['img'])) {
this.imgFile = this.commonsService.stitchImg(data['return_data']['img']);
}
data['return_data']['businessType'] = String(data['return_data']['businessType']);
this.validateForm.patchValue(data['return_data']);
});
} else {
@ -137,12 +161,10 @@ export class GoodsTypeComponent implements OnInit {
}
handleOk(): 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;
}
}
@ -154,13 +176,20 @@ export class GoodsTypeComponent implements OnInit {
this.validateForm.value.img = this.imgFile[0].name;
}
}
if (this.validateForm.value['parentId'] == null) {
this.validateForm.value['parentId'] = this.parentId;
}
if (this.editFlag) {
this.validateForm.value.id = this.id;
this.config.updateGoodsType(this.validateForm.value, data => {
if (data['return_code'] === '000000') {
this.message.success('修改成功');
this.isVisible = false;
this.getRequest(true, this.searchForm.value);
this.getListGoodsTypeByParentId(this.validateForm.value['parentId']);
} else {
this.message.create('error', data['return_msg']);
}
@ -171,39 +200,47 @@ export class GoodsTypeComponent implements OnInit {
this.message.success('添加成功');
this.isVisible = false;
this.getRequest(true, this.searchForm.value);
this.getListGoodsTypeByParentId(this.validateForm.value['parentId']);
} else {
this.message.create('error', data['return_msg']);
}
});
}
}
handleCancel(): void {
this.isVisible = false;
}
// 查看子类列表
public getGoodsTypesChild(parentId: number) {
this.listModal = true;
this.getListGoodsTypeByParentId(parentId);
}
// 對話框删除
showDeleteConfirm(id): void {
this.modalService.confirm({
nzTitle: '确定删除',
nzOkText: '是',
nzOnOk: () => this.onDelete(id),
nzCancelText: '否',
});
}
onDelete(ids) {
nzOnOk: () => {
this.config.getGoodsTypeByDelete({
id: ids
id: id
}, data => {
if (data['return_code'] === '000000') {
this.message.create('success', `删除成功!`);
this.getRequest(true, this.searchForm.value);
this.getListGoodsTypeByParentId(this.parentId);
} else {
this.message.create('error', data['return_msg']);
}
});
},
nzCancelText: '否',
});
}
}

@ -5,7 +5,7 @@ import {IndexService} from '../../../services/index.service';
import {environment} from '../../../../environments/environment';
import {NzMessageService} from 'ng-zorro-antd';
import {Router} from '@angular/router';
import {CommonsService} from "../../../services/commons.service";
import {CommonsService} from '../../../services/commons.service';
import {HttpClient , HttpClientJsonpModule} from '@angular/common/http';
@ -64,7 +64,6 @@ export class IndexComponent implements OnInit {
this.adminInfoObject = this.store.get(ADMIN_INFO_OBJECT);
this.roleType = this.store.get(ADMIN_INFO_OBJECT)['secRole'].roleType;
console.log(this.roleType);
if (this.roleType === 1) {
this.getIndexCount();
this.getLineCount();

@ -51,7 +51,6 @@ export class LoginComponent implements OnInit {
return;
}
this.loginService.userLogin(this.loginForm.value, data => {
if (data['return_code'] === '000000') {
data['return_data']['object']['menuList'] = data['return_data']['object']['menuList'].filter(o => o.showOnMobile === 0);

@ -167,6 +167,11 @@ const routes: Routes = [
loadChildren: () => import('./admin/api-order/api-order.module').then(m => m.ApiOrderModule),
canActivate: [InitGuardService]
},
{
path: 'goods',
loadChildren: () => import('./admin/goods/goods.module').then(m => m.GoodsModule),
canActivate: [InitGuardService]
},
],
},
];

@ -378,7 +378,7 @@ export class CommonsService {
case 7:
return '优惠券包';
case 8:
return '汇联通充值';
return 'HLT充值';
case 9:
return '话费充值';
default:
@ -402,4 +402,28 @@ export class CommonsService {
}
}
// 判断字符串是否为空
public whetherStringIsNull(s: string): boolean {
if (s != null && s !== '') {
return false;
} else {
return true;
}
}
// 拼接图片内容
public stitchImg(imgUrl: string): any {
const img = imgUrl;
const imgArray = [];
imgArray.push(
{
uid: 1,
name: img,
status: 'done',
url: environment.imageUrl + img
});
return imgArray;
}
}

@ -24,6 +24,20 @@ export class ConfigService {
});
}
/**
*
*
* @param parentId
* @param callBack
*/
public getListGoodsTypeByParentId(parentId: number, callBack) {
this.http.get(environment.baseUrl + 'highGoodsType/getListGoodsTypeByParentId?parentId=' + parentId ).subscribe(data => {
callBack(data);
});
}
/**
* @Author Sum1Dream
* @methodName insertGoodsType

@ -12,7 +12,7 @@ export class IconService {
constructor(private iconService: NzIconService) {
this.iconService.fetchFromIconfont({
scriptUrl: 'https://at.alicdn.com/t/font_2424521_tjuuaif43i.js'
scriptUrl: 'https://at.alicdn.com/t/c/font_2424521_u0r4ucawuek.js'
});
}
}

@ -4,7 +4,7 @@
export const environment = {
production: false,
baseUrl: 'https://hsgcs.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址)
baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址)
orderUrl: 'https://hsgcs.dctpay.com/order/', // 测试环境服务器地址(请求数据地址)
imageUrl: 'https://hsgcs.dctpay.com/filesystem/',
key: 'https://hsgcs.dctpay.com/phone-recharge-H5/index.html?codeValue=',

Loading…
Cancel
Save