diff --git a/src/app/admin/cms/cms-content/cms-content.component.ts b/src/app/admin/cms/cms-content/cms-content.component.ts index 3bd7192..6ef0cc3 100644 --- a/src/app/admin/cms/cms-content/cms-content.component.ts +++ b/src/app/admin/cms/cms-content/cms-content.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import {Component, OnInit} from '@angular/core'; import {FormBuilder, FormGroup, Validators} from '@angular/forms'; import {HttpClient, HttpEvent, HttpEventType, HttpRequest, HttpResponse} from '@angular/common/http'; import {NzMessageService, NzModalService, UploadXHRArgs} from 'ng-zorro-antd'; @@ -9,588 +9,624 @@ import {environment} from '../../../../environments/environment'; @Component({ - selector: 'app-cms-content', - templateUrl: './cms-content.component.html', - styleUrls: ['./cms-content.component.less'] + selector: 'app-cms-content', + templateUrl: './cms-content.component.html', + styleUrls: ['./cms-content.component.less'] }) export class CmsContentComponent implements OnInit { // 搜索按钮等待特效 - isLoadingSearch = false; - // 搜索内容标题 - searchTitle = ''; - // 状态搜索 - searchStatus = ''; - // 分类搜索 - searchCategoryId = ''; - // 公司id - searchCompanyId = ''; - // 查询数组 - requestData = []; - // 查询数组等待特效 - loading = true; - // 请求页码 - pageIndex = 1; - // 请求条数 - pageSize = 10; - // 查询总条数 - total = 0; - /** 分类树数据 **/ - nodes = []; - WEB_SERVE_URL; - // 选中的内容id - contentSelect = ''; - // 是否显示附件列表 - showPatch = 0; - // 根据内容查询附件列表 - patchList = []; - - // 添加附件相关 - // 提交等待 - isOkLoading = false; - // 附件类型 - patchTypeCheck = '0'; - // 附件返回地址 - patchPath = ''; - // 允许上传的文件类型 - annexForm: FormGroup; /** 定义附件表单 **/ - isVisible = false; /** 是否弹出添加 **/ - fileList = []; - // 上传的后缀名 - suffix = ''; - // 允许上传的文件类型 - imageSuffix = [ - 'jpg', - 'jpeg', - 'png', - 'jif', - 'dwg', - 'dxf', - 'jp2', - 'jpe', - 'svf', - 'tif', - 'tiff', - ]; - audioSuffix = [ - '3gpp', - 'ac3', - 'mp2', - 'mp3', - 'asf', - 'cda', - 'wav', - 'wma', - 'mid', - 'ra', - 'rma', - 'mod', - ]; - videoSuffix = [ - '3gpp', - 'mp2', - 'mp4', - 'mpeg', - 'mpg', - 'avi', - 'rmvb', - 'flv', - '3pg', - 'rm', - 'mov', - 'wmv', - 'mkv', - 'f4v', - 'm4v', - ]; - applicationSuffix = [ - 'asf', - 'doc', - 'dot', - 'dtd', - 'htm', - 'html', - 'css', - 'csv', - 'js', - 'json', - 'mpp', - 'ogg', - 'pdf', - 'pot', - 'pps', - 'ppt', - 'rtf', - 'txt', - 'wdb', - 'wps', - 'xhtml', - 'xlc', - 'xlm', - 'xls', - 'xlt', - 'xlw', - 'xml', - 'zip', - 'docx', - 'xlsx', - 'pptx', - 'sql' - ]; - - isPublish = false; - isPushOkLoading = false; - moduleId = ''; - pushId = ''; - pushForm: FormGroup; - // 可选择的模板列表 - selectModule = []; - /** 按钮数据权限 **/ - BTN_cmscontent_add = 0; - BTN_cmscontent_edit = 0; - BTN_cmscontent_delete = 0; - BTN_cmscontent_patch = 0; - BTN_cmscontent_up_down = 0; - constructor( - private fb: FormBuilder, - private http: HttpClient, // http请求 - private message: NzMessageService, // 信息提示 - private router: Router, - private modalService: NzModalService, // 对话框 - private store: LocalStorageService , // 请求缓存 - ) { - this.WEB_SERVE_URL = environment.imageUrl; - this.searchCompanyId = this.store.get(ADMIN_INFO_OBJECT)['secUser']['companyId']; - } - - ngOnInit() { - /** 循环查询 按钮权限 **/ - for (let i = 0; i < this.store.get(ADMIN_INFO_OBJECT)['buttonList'] .length; i++) { - if (this.store.get(ADMIN_INFO_OBJECT)['buttonList'][i].permissionCode === 'BTN_cmscontent_add' ) { - this.BTN_cmscontent_add = 1; - }if (this.store.get(ADMIN_INFO_OBJECT)['buttonList'][i].permissionCode === 'BTN_cmscontent_edit' ) { - this.BTN_cmscontent_edit = 1; - }if (this.store.get(ADMIN_INFO_OBJECT)['buttonList'][i].permissionCode === 'BTN_cmscontent_delete' ) { - this.BTN_cmscontent_delete = 1; - }if (this.store.get(ADMIN_INFO_OBJECT)['buttonList'][i].permissionCode === 'BTN_cmscontent_patch' ) { - this.BTN_cmscontent_patch = 1; - }if (this.store.get(ADMIN_INFO_OBJECT)['buttonList'][i].permissionCode === 'BTN_cmscontent_up_down' ) { - this.BTN_cmscontent_up_down = 1; - } - } - this.annexForm = this.fb.group({ - patchName: [null, [Validators.required]], - patchDesc: [null], - patchType: [null, [Validators.required]], - sort: [null, [Validators.required]], - }); - this.pushForm = this.fb.group({ - moduleId: [null] - }); - - // 获取登录人 角色类型,查询分类树 - console.log(this.store.get(ADMIN_INFO_OBJECT)); - let roleType = 1; - /* if (0 == this.store.get(ADMIN_INFO_OBJECT)['bsCompany']['companyType']) { - roleType = 1; - } else if (1 == this.store.get(ADMIN_INFO_OBJECT)['bsCompany']['companyType']) { - if (this.store.get(ADMIN_INFO_OBJECT)['bsCompany']['isService'] == true) { - roleType = 3; - } else { - roleType = 2; - } - } else if (2 == this.store.get(ADMIN_INFO_OBJECT)['bsCompany']['companyType']) { - roleType = 3; - }*/ - this.findCategoryTree(roleType); - this.getRequest(); - } - // 重置搜索 - resetSearch() { + isLoadingSearch = false; // 搜索内容标题 - this.searchTitle = ''; + searchTitle = ''; // 状态搜索 - this.searchStatus = ''; + searchStatus = ''; // 分类搜索 - this.searchCategoryId = ''; - } - // 请求列表 - getRequest(reset: boolean = false) { - this.showPatch = 0; - this.loading = false; - if (reset) { - this.pageIndex = 1; + searchCategoryId = ''; + // 公司id + searchCompanyId = ''; + // 查询数组 + requestData = []; + // 查询数组等待特效 + loading = true; + // 请求页码 + pageIndex = 1; + // 请求条数 + pageSize = 10; + // 查询总条数 + total = 0; + /** 分类树数据 **/ + nodes = []; + WEB_SERVE_URL; + // 选中的内容id + contentSelect = ''; + // 是否显示附件列表 + showPatch = 0; + // 根据内容查询附件列表 + patchList = []; + + // 添加附件相关 + // 提交等待 + isOkLoading = false; + // 附件类型 + patchTypeCheck = '0'; + // 附件返回地址 + patchPath = ''; + // 允许上传的文件类型 + annexForm: FormGroup; + /** 定义附件表单 **/ + isVisible = false; + /** 是否弹出添加 **/ + fileList = []; + // 上传的后缀名 + suffix = ''; + // 允许上传的文件类型 + imageSuffix = [ + 'jpg', + 'jpeg', + 'png', + 'jif', + 'dwg', + 'dxf', + 'jp2', + 'jpe', + 'svf', + 'tif', + 'tiff', + ]; + audioSuffix = [ + '3gpp', + 'ac3', + 'mp2', + 'mp3', + 'asf', + 'cda', + 'wav', + 'wma', + 'mid', + 'ra', + 'rma', + 'mod', + ]; + videoSuffix = [ + '3gpp', + 'mp2', + 'mp4', + 'mpeg', + 'mpg', + 'avi', + 'rmvb', + 'flv', + '3pg', + 'rm', + 'mov', + 'wmv', + 'mkv', + 'f4v', + 'm4v', + ]; + applicationSuffix = [ + 'asf', + 'doc', + 'dot', + 'dtd', + 'htm', + 'html', + 'css', + 'csv', + 'js', + 'json', + 'mpp', + 'ogg', + 'pdf', + 'pot', + 'pps', + 'ppt', + 'rtf', + 'txt', + 'wdb', + 'wps', + 'xhtml', + 'xlc', + 'xlm', + 'xls', + 'xlt', + 'xlw', + 'xml', + 'zip', + 'docx', + 'xlsx', + 'pptx', + 'sql' + ]; + + isPublish = false; + isPushOkLoading = false; + moduleId = ''; + pushId = ''; + pushForm: FormGroup; + // 可选择的模板列表 + selectModule = []; + /** 按钮数据权限 **/ + BTN_cmscontent_add = 0; + BTN_cmscontent_edit = 0; + BTN_cmscontent_delete = 0; + BTN_cmscontent_patch = 0; + BTN_cmscontent_up_down = 0; + + constructor( + private fb: FormBuilder, + private http: HttpClient, // http请求 + private message: NzMessageService, // 信息提示 + private router: Router, + private modalService: NzModalService, // 对话框 + private store: LocalStorageService, // 请求缓存 + ) { + this.WEB_SERVE_URL = environment.baseUrl; + this.searchCompanyId = this.store.get(ADMIN_INFO_OBJECT)['secUser']['companyId']; } - if (this.searchStatus == null) { - this.searchStatus = ''; + + ngOnInit() { + /** 循环查询 按钮权限 **/ + for (let i = 0; i < this.store.get(ADMIN_INFO_OBJECT)['buttonList'].length; i++) { + if (this.store.get(ADMIN_INFO_OBJECT)['buttonList'][i].permissionCode === 'BTN_cmscontent_add') { + this.BTN_cmscontent_add = 1; + } + if (this.store.get(ADMIN_INFO_OBJECT)['buttonList'][i].permissionCode === 'BTN_cmscontent_edit') { + this.BTN_cmscontent_edit = 1; + } + if (this.store.get(ADMIN_INFO_OBJECT)['buttonList'][i].permissionCode === 'BTN_cmscontent_delete') { + this.BTN_cmscontent_delete = 1; + } + if (this.store.get(ADMIN_INFO_OBJECT)['buttonList'][i].permissionCode === 'BTN_cmscontent_patch') { + this.BTN_cmscontent_patch = 1; + } + if (this.store.get(ADMIN_INFO_OBJECT)['buttonList'][i].permissionCode === 'BTN_cmscontent_up_down') { + this.BTN_cmscontent_up_down = 1; + } + } + this.annexForm = this.fb.group({ + patchName: [null, [Validators.required]], + patchDesc: [null], + patchType: [null, [Validators.required]], + sort: [null, [Validators.required]], + }); + this.pushForm = this.fb.group({ + moduleId: [null] + }); + + // 获取登录人 角色类型,查询分类树 + console.log(this.store.get(ADMIN_INFO_OBJECT)); + let roleType = 1; + /* if (0 == this.store.get(ADMIN_INFO_OBJECT)['bsCompany']['companyType']) { + roleType = 1; + } else if (1 == this.store.get(ADMIN_INFO_OBJECT)['bsCompany']['companyType']) { + if (this.store.get(ADMIN_INFO_OBJECT)['bsCompany']['isService'] == true) { + roleType = 3; + } else { + roleType = 2; + } + } else if (2 == this.store.get(ADMIN_INFO_OBJECT)['bsCompany']['companyType']) { + roleType = 3; + }*/ + this.findCategoryTree(roleType); + this.getRequest(); } - if (this.searchCategoryId == null) { - this.searchCategoryId = ''; + + // 重置搜索 + resetSearch() { + // 搜索内容标题 + this.searchTitle = ''; + // 状态搜索 + this.searchStatus = ''; + // 分类搜索 + this.searchCategoryId = ''; } - this.http.get(this.WEB_SERVE_URL + '/cmsContent/getListContent?pageNum=' + this.pageIndex + '&pageSize=' + this.pageSize + '&title=' + this.searchTitle + '&category=' + this.searchCategoryId + '&status=' + this.searchStatus + '&companyId=' + this.searchCompanyId).subscribe(data => { - console.log(data); - if (data['return_code'] === '000000') { - this.requestData = data['return_data'].list; - this.total = data['return_data'].total; - this.isLoadingSearch = false; - } else { - this.message.create('error', data['return_msg']); - } - }); - } - // 搜索 - getSearch() { - this.getRequest(); - } - // 查询分类树 - findCategoryTree (roleType) { - this.http.get(this.WEB_SERVE_URL + '/cmsCategory/getOwnCategoryTree?roleType=' + roleType).subscribe(data => { - if (data['return_code'] === '000000') { - this.nodes = data['return_data']; - if (this.nodes.length !== 0) { - this.generateComment(this.nodes); - } else { - this.nodes = []; + + // 请求列表 + getRequest(reset: boolean = false) { + this.showPatch = 0; + this.loading = false; + if (reset) { + this.pageIndex = 1; } - } else { - this.message.create('error', data['return_msg']); - } - }); - } - // 递归分类树 - generateComment (data) { - for (const i in data) { - if (data[i].nodes == null) { - const item = { /** 重新赋值 **/ - isLeaf: true, - title: data[i].text, - key: data[i].id, - children: data[i].nodes, - }; - data[i] = item; - } else { - const item = { /** 重新赋值 **/ - isLeaf: false, - title: data[i].text, - key: data[i].id, - children: data[i].nodes, - }; - data[i] = item; - this.generateComment(data[i].children); - } - } - this.nodes = data; - console.log(this.nodes); - } - // 跳转添加 - getAdd() { - this.router.navigate(['/admin/cms/cmscontentadd'], { - queryParams: { - editFlag: 0 - } - }); - } - // 跳转修改 - getEdit(id) { - this.router.navigate(['/admin/cms/cmscontentedit'], { - queryParams: { - id: id - } - }); - } - // 跳转详情 - getContentView(id) { - this.router.navigate(['/admin/cms/cmscontentview'], { - queryParams: { - id: id - } - }); - } - // 对话框删除 - showDeleteConfirmDelete(id): void { - this.modalService.confirm({ - nzTitle: '是否确定删除', - nzOkText: '是', - nzOnOk: () => this.deleteContent(id), - nzCancelText: '否', - }); - } - // 删除内容 - deleteContent(id) { - if (id === undefined) { - return; - }if (id === null) { - return; - }if (id === '') { - return; + if (this.searchStatus == null) { + this.searchStatus = ''; + } + if (this.searchCategoryId == null) { + this.searchCategoryId = ''; + } + this.http.get(this.WEB_SERVE_URL + '/cmsContent/getListContent?pageNum=' + this.pageIndex + '&pageSize=' + this.pageSize + '&title=' + this.searchTitle + '&category=' + this.searchCategoryId + '&status=' + this.searchStatus + '&companyId=' + this.searchCompanyId).subscribe(data => { + console.log(data); + if (data['return_code'] === '000000') { + this.requestData = data['return_data'].list; + this.total = data['return_data'].total; + this.isLoadingSearch = false; + } else { + this.message.create('error', data['return_msg']); + } + }); } - this.http.get(this.WEB_SERVE_URL + '/cmsContent/delContent?id=' + id).subscribe( data => { - if (data['return_code'] === '000000') { - this.message.create('success', `删除成功!`); + + // 搜索 + getSearch() { this.getRequest(); - } else { - this.message.create('warning', data['return_msg']); - } - }); - } - // 查询附件列表 - findPatchByContent(id) { - this.contentSelect = id; - this.http.get(this.WEB_SERVE_URL + '/cmsContent/getListPatches?pageNum=1&pageSize=100&contentId=' + id).subscribe( data => { - if (data['return_code'] === '000000') { - this.showPatch = 1; - this.patchList = data['return_data'].list; - console.log(this.patchList); - } else { - this.message.create('warning', data['return_msg']); - } - }); - } - // 弹出添加附件 - addPatch() { - this.isVisible = true; - } - // 删除附件确认 - showDeletePatch(id) { - this.modalService.confirm({ - nzTitle: '是否确定删除', - nzOkText: '是', - nzOnOk: () => this.deletePatch(id), - nzCancelText: '否', - }); - } - // 删除附件 - deletePatch(id) { - if (id === undefined || id === null || id === '') { - return; } - this.http.get(this.WEB_SERVE_URL + '/cmsPatch/delPatch?id=' + id).subscribe( data => { - if (data['return_code'] === '000000') { - this.message.create('success', `删除成功!`); - this.findPatchByContent(this.contentSelect); - } else { - this.message.create('warning', data['return_msg']); - } - }); - } - // 取消按钮 - handleCancel(): void { - this.isVisible = false; - this.patchPath = ''; - this.fileList = []; - /** 隐藏弹框 **/ - } - // 附件类型选择 - getChange(event) { - if (event != null) { - this.patchTypeCheck = event; - console.log(event); + + // 查询分类树 + findCategoryTree(roleType) { + this.http.get(this.WEB_SERVE_URL + '/cmsCategory/getOwnCategoryTree?roleType=' + roleType).subscribe(data => { + if (data['return_code'] === '000000') { + this.nodes = data['return_data']; + if (this.nodes.length !== 0) { + this.generateComment(this.nodes); + } else { + this.nodes = []; + } + } else { + this.message.create('error', data['return_msg']); + } + }); } - } - // 附件上传设置 - customReq = (item: UploadXHRArgs) => { - this.patchPath = ''; // 置空路径 - const formData = new FormData(); - formData.append('requestFile', item.file as any); - formData.append('uploadType', 'cmsPatch'); - console.log(item); - const req = new HttpRequest('POST', item.action!, formData, { - reportProgress: true, - }); - console.log(req); - return this.http.request(req).subscribe( - (event: HttpEvent) => { - console.log(event); - if (event.type === HttpEventType.UploadProgress) { - if (event.total! > 0) { - (event as any).percent = (event.loaded / event.total!) * 100; - } - item.onProgress!(event, item.file!); - } else if (event instanceof HttpResponse) { - item.onSuccess!(event.body, item.file!, event); - if (event.body.return_code === '000000') { - this.patchPath = event.body.return_data[item.file.name]; - this.suffix = this.patchPath.split('.')[this.patchPath.split('.').length - 1]; - } + + // 递归分类树 + generateComment(data) { + for (const i in data) { + if (data[i].nodes == null) { + const item = { + /** 重新赋值 **/ + isLeaf: true, + title: data[i].text, + key: data[i].id, + children: data[i].nodes, + }; + data[i] = item; + } else { + const item = { + /** 重新赋值 **/ + isLeaf: false, + title: data[i].text, + key: data[i].id, + children: data[i].nodes, + }; + data[i] = item; + this.generateComment(data[i].children); + } } - }, - err => { - item.onError!(err, item.file!); - } - ); - } - /** 清空 **/ - emptyForm(e: MouseEvent): void { - e.preventDefault(); - this.annexForm.reset(); - for (const key in this.annexForm.controls) { - this.annexForm.controls[key].markAsPristine(); - this.annexForm.controls[key].updateValueAndValidity(); + this.nodes = data; + console.log(this.nodes); } - } - // 附件弹窗确定添加按钮 - handlePatchOk(value: any): void { - // 校验类型选择与必填 - if (value.patchName == null || value.patchName == '') { - this.message.create('error', `请填写附件名称!`); - return; + + // 跳转添加 + getAdd() { + this.router.navigate(['/admin/cms/cmscontentadd'], { + queryParams: { + editFlag: 0 + } + }); + } + + // 跳转修改 + getEdit(id) { + this.router.navigate(['/admin/cms/cmscontentedit'], { + queryParams: { + id: id + } + }); + } + + // 跳转详情 + getContentView(id) { + this.router.navigate(['/admin/cms/cmscontentview'], { + queryParams: { + id: id + } + }); + } + + // 对话框删除 + showDeleteConfirmDelete(id): void { + this.modalService.confirm({ + nzTitle: '是否确定删除', + nzOkText: '是', + nzOnOk: () => this.deleteContent(id), + nzCancelText: '否', + }); + } + + // 删除内容 + deleteContent(id) { + if (id === undefined) { + return; + } + if (id === null) { + return; + } + if (id === '') { + return; + } + this.http.get(this.WEB_SERVE_URL + '/cmsContent/delContent?id=' + id).subscribe(data => { + if (data['return_code'] === '000000') { + this.message.create('success', `删除成功!`); + this.getRequest(); + } else { + this.message.create('warning', data['return_msg']); + } + }); } - if (value.sort == null || value.sort == '') { - this.message.create('error', `请填写附件排序,越小越靠前!`); - return; + + // 查询附件列表 + findPatchByContent(id) { + this.contentSelect = id; + this.http.get(this.WEB_SERVE_URL + '/cmsContent/getListPatches?pageNum=1&pageSize=100&contentId=' + id).subscribe(data => { + if (data['return_code'] === '000000') { + this.showPatch = 1; + this.patchList = data['return_data'].list; + console.log(this.patchList); + } else { + this.message.create('warning', data['return_msg']); + } + }); } - if (value.patchType == '1') { - if (this.imageSuffix.indexOf(this.suffix) == -1) { - this.message.create('error', `请上传图片类型的附件!`); - return; - } - } else if (value.patchType == '2') { - if (this.audioSuffix.indexOf(this.suffix) == -1) { - this.message.create('error', `请上传音频类型的附件!`); - return; - } - } else if (value.patchType == '3') { - if (this.videoSuffix.indexOf(this.suffix) == -1) { - this.message.create('error', `请上传视频类型的附件!`); - return; - } - } else if (value.patchType == '4') { - if (this.applicationSuffix.indexOf(this.suffix) == -1) { - this.message.create('error', `请上传文档类型的附件!`); - return; - } - } else if (value.patchType == '5') { - } else { - this.message.create('error', `请选择附件类型!`); - return; + + // 弹出添加附件 + addPatch() { + this.isVisible = true; } - if (this.patchPath == null || this.patchPath == '') { - this.message.create('error', `请上传附件!`); - return; + + // 删除附件确认 + showDeletePatch(id) { + this.modalService.confirm({ + nzTitle: '是否确定删除', + nzOkText: '是', + nzOnOk: () => this.deletePatch(id), + nzCancelText: '否', + }); + } + + // 删除附件 + deletePatch(id) { + if (id === undefined || id === null || id === '') { + return; + } + this.http.get(this.WEB_SERVE_URL + '/cmsPatch/delPatch?id=' + id).subscribe(data => { + if (data['return_code'] === '000000') { + this.message.create('success', `删除成功!`); + this.findPatchByContent(this.contentSelect); + } else { + this.message.create('warning', data['return_msg']); + } + }); } - // 定义附件数据 - const params = { - 'contentId': this.contentSelect, - 'patchName': value.patchName, - 'patchDesc': value.patchDesc, - 'patchType': value.patchType, - 'patchPath': this.patchPath, - 'source': 1, - 'sort': value.sort, - 'suffixName': this.suffix, - 'addTime': new Date() - }; - /** 确定等待 **/ - this.http.post(this.WEB_SERVE_URL + '/cmsPatch/addPatch', params).subscribe(data => { - if (data['return_code'] === '000000') { + + // 取消按钮 + handleCancel(): void { this.isVisible = false; - this.isOkLoading = false; + this.patchPath = ''; this.fileList = []; - this.patchTypeCheck = '0'; - this.findPatchByContent(this.contentSelect); - this.message.create('success', `新增成功!`); - } else { - this.message.create('warning', data['return_msg']); - } - }, error => { - this.message.create('error', `未知错误!`); - }); - } - // 弹出发布附件 - addPush(id, categoryId) { - this.findModuleByCategory(categoryId); - this.pushId = id; - // document.getElementById('resetPush').click(); - this.isPublish = true; - } - // 取消发布 - handleCancelPush(): void { - this.isPublish = false; - this.moduleId = ''; - this.pushId = ''; - /** 隐藏弹框 **/ - } - // 附件弹窗确定添加按钮 - handlePushOk(value: any): void { - console.log('发布'); - console.log(this.pushId); - console.log(this.moduleId); - console.log(value.moduleId); - if (this.pushId == null || this.pushId == '') { - this.message.create('error', '请重新选择发布的内容!'); - return; + /** 隐藏弹框 **/ + } + + // 附件类型选择 + getChange(event) { + if (event != null) { + this.patchTypeCheck = event; + console.log(event); + } + } + + // 附件上传设置 + customReq = (item: UploadXHRArgs) => { + this.patchPath = ''; // 置空路径 + const formData = new FormData(); + formData.append('requestFile', item.file as any); + formData.append('uploadType', 'cmsPatch'); + console.log(item); + const req = new HttpRequest('POST', item.action!, formData, { + reportProgress: true, + }); + console.log(req); + return this.http.request(req).subscribe( + (event: HttpEvent) => { + console.log(event); + if (event.type === HttpEventType.UploadProgress) { + if (event.total! > 0) { + (event as any).percent = (event.loaded / event.total!) * 100; + } + item.onProgress!(event, item.file!); + } else if (event instanceof HttpResponse) { + item.onSuccess!(event.body, item.file!, event); + if (event.body.return_code === '000000') { + this.patchPath = event.body.return_data[item.file.name]; + this.suffix = this.patchPath.split('.')[this.patchPath.split('.').length - 1]; + } + } + }, + err => { + item.onError!(err, item.file!); + } + ); + } + + /** 清空 **/ + emptyForm(e: MouseEvent): void { + e.preventDefault(); + this.annexForm.reset(); + for (const key in this.annexForm.controls) { + this.annexForm.controls[key].markAsPristine(); + this.annexForm.controls[key].updateValueAndValidity(); + } } - if (this.moduleId == null || this.moduleId == undefined) { - this.moduleId = ''; + + // 附件弹窗确定添加按钮 + handlePatchOk(value: any): void { + // 校验类型选择与必填 + if (value.patchName == null || value.patchName == '') { + this.message.create('error', `请填写附件名称!`); + return; + } + if (value.sort == null || value.sort == '') { + this.message.create('error', `请填写附件排序,越小越靠前!`); + return; + } + if (value.patchType == '1') { + if (this.imageSuffix.indexOf(this.suffix) == -1) { + this.message.create('error', `请上传图片类型的附件!`); + return; + } + } else if (value.patchType == '2') { + if (this.audioSuffix.indexOf(this.suffix) == -1) { + this.message.create('error', `请上传音频类型的附件!`); + return; + } + } else if (value.patchType == '3') { + if (this.videoSuffix.indexOf(this.suffix) == -1) { + this.message.create('error', `请上传视频类型的附件!`); + return; + } + } else if (value.patchType == '4') { + if (this.applicationSuffix.indexOf(this.suffix) == -1) { + this.message.create('error', `请上传文档类型的附件!`); + return; + } + } else if (value.patchType == '5') { + } else { + this.message.create('error', `请选择附件类型!`); + return; + } + if (this.patchPath == null || this.patchPath == '') { + this.message.create('error', `请上传附件!`); + return; + } + // 定义附件数据 + const params = { + 'contentId': this.contentSelect, + 'patchName': value.patchName, + 'patchDesc': value.patchDesc, + 'patchType': value.patchType, + 'patchPath': this.patchPath, + 'source': 1, + 'sort': value.sort, + 'suffixName': this.suffix, + 'addTime': new Date() + }; + /** 确定等待 **/ + this.http.post(this.WEB_SERVE_URL + '/cmsPatch/addPatch', params).subscribe(data => { + if (data['return_code'] === '000000') { + this.isVisible = false; + this.isOkLoading = false; + this.fileList = []; + this.patchTypeCheck = '0'; + this.findPatchByContent(this.contentSelect); + this.message.create('success', `新增成功!`); + } else { + this.message.create('warning', data['return_msg']); + } + }, error => { + this.message.create('error', `未知错误!`); + }); + } + + // 弹出发布附件 + addPush(id, categoryId) { + this.findModuleByCategory(categoryId); + this.pushId = id; + // document.getElementById('resetPush').click(); + this.isPublish = true; } - // 定义附件数据 - const params = { - 'id': this.pushId, - 'status': 2, - 'moduleId': this.moduleId - }; - /** 确定等待 **/ - this.http.post(this.WEB_SERVE_URL + '/cmsContent/updateStatusOfContent', params).subscribe(data => { - if (data['return_code'] === '000000') { + // 取消发布 + handleCancelPush(): void { this.isPublish = false; - this.isPushOkLoading = false; this.moduleId = ''; this.pushId = ''; - this.getRequest(); - this.message.create('success', `发布成功!`); - } else { - this.message.create('warning', data['return_msg']); - } - }, error => { - this.message.create('error', `未知错误!`); - }); - } - /** 清空模板 **/ - emptyPushForm(e: MouseEvent): void { - e.preventDefault(); - this.pushForm.reset(); - for (const key in this.pushForm.controls) { - this.pushForm.controls[key].markAsPristine(); - this.pushForm.controls[key].updateValueAndValidity(); + /** 隐藏弹框 **/ + } + + // 附件弹窗确定添加按钮 + handlePushOk(value: any): void { + console.log('发布'); + console.log(this.pushId); + console.log(this.moduleId); + console.log(value.moduleId); + if (this.pushId == null || this.pushId == '') { + this.message.create('error', '请重新选择发布的内容!'); + return; + } + if (this.moduleId == null || this.moduleId == undefined) { + this.moduleId = ''; + } + + // 定义附件数据 + const params = { + 'id': this.pushId, + 'status': 2, + 'moduleId': this.moduleId + }; + /** 确定等待 **/ + this.http.post(this.WEB_SERVE_URL + '/cmsContent/updateStatusOfContent', params).subscribe(data => { + if (data['return_code'] === '000000') { + this.isPublish = false; + this.isPushOkLoading = false; + this.moduleId = ''; + this.pushId = ''; + this.getRequest(); + this.message.create('success', `发布成功!`); + } else { + this.message.create('warning', data['return_msg']); + } + }, error => { + this.message.create('error', `未知错误!`); + }); + } + + /** 清空模板 **/ + emptyPushForm(e: MouseEvent): void { + e.preventDefault(); + this.pushForm.reset(); + for (const key in this.pushForm.controls) { + this.pushForm.controls[key].markAsPristine(); + this.pushForm.controls[key].updateValueAndValidity(); + } + } + + // 根据内容分类查询可使用的模板列表 + findModuleByCategory(categoryId) { + this.http.get(this.WEB_SERVE_URL + '/cmsCategoryModule/getModuleByCategoryId?categoryId=' + categoryId).subscribe(data => { + if (data['return_code'] === '000000') { + this.selectModule = data['return_data']; + console.log(this.selectModule); + } else { + this.message.create('error', data['return_msg']); + } + }); + } + + showDown(id): void { + this.modalService.confirm({ + nzTitle: '是否确定下线', + nzOkText: '是', + nzOnOk: () => this.DownContent(id), + nzCancelText: '否', + }); + } + + // 下线 + DownContent(id) { + // 定义附件数据 + const params = { + 'id': id, + 'status': 1 + }; + /** 确定等待 **/ + this.http.post(this.WEB_SERVE_URL + '/cmsContent/updateStatusOfContent', params).subscribe(data => { + if (data['return_code'] === '000000') { + this.getRequest(); + this.message.create('success', `下线成功!`); + } else { + this.message.create('warning', data['return_msg']); + } + }, error => { + this.message.create('error', `未知错误!`); + }); } - } - // 根据内容分类查询可使用的模板列表 - findModuleByCategory(categoryId) { - this.http.get(this.WEB_SERVE_URL + '/cmsCategoryModule/getModuleByCategoryId?categoryId=' + categoryId).subscribe(data => { - if (data['return_code'] === '000000') { - this.selectModule = data['return_data']; - console.log(this.selectModule); - } else { - this.message.create('error', data['return_msg']); - } - }); - } - - showDown(id): void { - this.modalService.confirm({ - nzTitle: '是否确定下线', - nzOkText: '是', - nzOnOk: () => this.DownContent(id), - nzCancelText: '否', - }); - } - // 下线 - DownContent(id) { - // 定义附件数据 - const params = { - 'id': id, - 'status': 1 - }; - /** 确定等待 **/ - this.http.post(this.WEB_SERVE_URL + '/cmsContent/updateStatusOfContent', params).subscribe(data => { - if (data['return_code'] === '000000') { - this.getRequest(); - this.message.create('success', `下线成功!`); - } else { - this.message.create('warning', data['return_msg']); - } - }, error => { - this.message.create('error', `未知错误!`); - }); - } } diff --git a/src/app/admin/order/order-c-list/order-c-list.component.html b/src/app/admin/order/order-c-list/order-c-list.component.html new file mode 100644 index 0000000..c0bb131 --- /dev/null +++ b/src/app/admin/order/order-c-list/order-c-list.component.html @@ -0,0 +1,177 @@ + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + +
+ + 订单号 + + + + +
+
+ + 订单流水号 + + + + +
+
+ + 支付模式 + + + + + + + + +
+
+ + 支付方式 + + + + + + + + +
+
+ + 状态 + + + + + + + + + + + + +
+
+ + 时间区间 + + + + +
+
+ +
+
+ + +
+
+
+
+ + +
+ 共计 {{total}} 条数据 + + + + + + + 编号 + 商品名称 + 订单来源 + 订单类型 + 订单号 + 支付流水号 + 客户名称 + 客户电话 + 支付模式 + 支付方式 + 支付金额 + 生成时间 + 支付时间 + 取消时间 + 状态 + + + + + + {{i+1}} + {{data.goodsName}} + {{data.giveawayType}} + {{data.goodsType}} + {{data.orderNo}} + {{data.paySerialNo}} + {{data.memName == null ? '暂无': data.memName}} + {{data.memPhone == null ? '暂无': data.memPhone}} + {{data.payModel}} + {{data.payType}} + {{data.payPrice}} + {{data.createTime | date: 'yyyy-MM-dd HH:mm:ss'}} + {{data.payTime | date: 'yyyy-MM-dd HH:mm:ss'}} + {{data.cancelTime | date: 'yyyy-MM-dd HH:mm:ss'}} + {{data.orderStatus}} + + + + + + +
+ + + + + 退款理由 + + + + + + diff --git a/src/app/admin/order/order-c-list/order-c-list.component.scss b/src/app/admin/order/order-c-list/order-c-list.component.scss new file mode 100644 index 0000000..8bee3fb --- /dev/null +++ b/src/app/admin/order/order-c-list/order-c-list.component.scss @@ -0,0 +1,4 @@ +.head_img { + height: 60px; + width: 60px; +} diff --git a/src/app/admin/order/order-c-list/order-c-list.component.ts b/src/app/admin/order/order-c-list/order-c-list.component.ts new file mode 100644 index 0000000..c16d2e2 --- /dev/null +++ b/src/app/admin/order/order-c-list/order-c-list.component.ts @@ -0,0 +1,186 @@ +import { Component, OnInit } from '@angular/core'; +import {environment} from '../../../../environments/environment'; +import {FormBuilder, FormGroup} from '_@angular_forms@9.0.7@@angular/forms'; +import {OrderService} from '../../../services/order.service'; +import {IconService} from '../../../services/icon.service'; +import {NzMessageService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; +import {Router} from '_@angular_router@9.0.7@@angular/router'; +import {CompanyService} from '../../../services/company.service'; +import {MerchantService} from '../../../services/merchant.service'; +import {CommonsService} from '../../../services/commons.service'; + +@Component({ + selector: 'app-order-c-list', + templateUrl: './order-c-list.component.html', + styleUrls: ['./order-c-list.component.scss'] +}) +export class OrderCListComponent implements OnInit { + + WEB_SERVE_URL = environment.baseUrl; + FILE_URL = environment.imageUrl; + searchForm: FormGroup; // 搜索框 + requestData = []; // 列表数据 + companyData = []; // 列表数据 + merchantData = []; // 列表数据 + total: number; // 页码 + pageNum = 1; // 页码 + pageSize = 10; // 条码 + loading = true; + id: number; // 订单ID + isVisible = false; + refundContent: string; + constructor( + private form: FormBuilder, + private order: OrderService, + private iconService: IconService, + private message: NzMessageService, + private router: Router, + private company: CompanyService, + private merchant: MerchantService, + private common: CommonsService + ) { + } + + ngOnInit(): void { + this.init(); + const whereObject = {}; + whereObject['pageNum'] = 1; + whereObject['pageSize'] = 10000; + this.company.selectCompanyList(whereObject, data => { + if (data['return_code'] === '000000') { + this.companyData = data['return_data'].list; + } else { + this.message.error(data['return_msg']); + } + }); + this.getMerchantListByCompany(this.searchForm.value.companyId); + } + + public init(): void { + this.searchForm = this.form.group({ + companyId: [null], + merchantId: [null], + orderNo: [null], + paySerialNo: [null], + payModel: [null], + payType: [null], + orderStatus: [null], + payTime: [null] + }); + this.getRequest(true, this.searchForm.value); + } + + // 查询列表 + public getRequest(reset: boolean = false, whereObject: object) { + + if (whereObject['payTime'] != null && whereObject['payTime'].length !== 0) { + whereObject['payTimeS'] = whereObject['payTime'][0].getTime(); + whereObject['payTimeE'] = whereObject['payTime'][1].getTime(); + } + + + this.loading = false; + if (reset) { + this.pageNum = 1; + } + whereObject['pageNum'] = this.pageNum; + whereObject['pageSize'] = this.pageSize; + this.order.getKfcOrderList(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 getMerchantListByCompany(companyId: number): void { + this.merchant.getMerchantListByCompany(companyId, data => { + if (data['return_code'] === '000000') { + if (data['return_code'] === '000000') { + this.merchantData = data['return_data']; + } else { + this.message.error(data['return_msg']); + } + } else { + this.message.error(data['return_msg']); + } + }); + } + + // 重置 + public resetForm(): void { + this.searchForm.reset(); + } + + + // 查看详情 + public getDetail(id: number): void { + this.router.navigate(['/admin/order/order-detail'], { + queryParams: { + merchantId: id + } + }).then(r => console.log(r)); + } + + // 下载模板 + downloadTemplate(whereObject) { + if (whereObject['payTime'] != null && whereObject['payTime'].length !== 0) { + whereObject['payTimeS'] = whereObject['payTime'][0].getTime(); + whereObject['payTimeE'] = whereObject['payTime'][1].getTime(); + } + this.order.exportGoodsOrderList(whereObject, data => { + if (data['return_code'] === '000000') { + window.location.href = this.FILE_URL + data['return_data']; + } else { + this.message.error(data['return_msg']); + } + }); + } + + provinceChange(e) { + console.log(e); + } + + // 退款 + public orderToRefund(id): void { + + } + + showModal(id): void { + console.log(id); + this.id = id; + this.isVisible = true; + } + + handleOk(): void { + if (this.refundContent == null || this.refundContent.length === 0) { + this.message.error('请输入退款原因'); + return; + } + this.common.showConfirm('确认订单是否退款', item => { + if (item) { + const params = { + orderId: this.id , + refundContent: this.refundContent + }; + this.order.refuelingOrderRefund(params, data => { + if (data['return_code'] === '000000') { + this.getRequest(false, this.searchForm.value); + this.isVisible = false; + this.message.success('申请退款中'); + } else { + this.message.error(data['return_msg']); + } + }); + } + }); + } + + handleCancel(): void { + this.isVisible = false; + } + +} diff --git a/src/app/admin/order/order-k-list/order-k-list.component.html b/src/app/admin/order/order-k-list/order-k-list.component.html new file mode 100644 index 0000000..1f9d1b3 --- /dev/null +++ b/src/app/admin/order/order-k-list/order-k-list.component.html @@ -0,0 +1,177 @@ + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + +
+ + 订单号 + + + + +
+
+ + 订单流水号 + + + + +
+
+ + 支付模式 + + + + + + + + +
+
+ + 支付方式 + + + + + + + + +
+
+ + 状态 + + + + + + + + + + + + +
+
+ + 时间区间 + + + + +
+
+ +
+
+ + +
+
+
+
+ + +
+ 共计 {{total}} 条数据 + + + + + + + 编号 + 商品名称 + 订单来源 + 订单类型 + 订单号 + 支付流水号 + 客户名称 + 客户电话 + 支付模式 + 支付方式 + 支付金额 + 生成时间 + 支付时间 + 取消时间 + 状态 + + + + + + {{i+1}} + {{data.goodsName}} + {{data.giveawayType}} + {{data.goodsType}} + {{data.orderNo}} + {{data.paySerialNo}} + {{data.memName == null ? '暂无': data.memName}} + {{data.memPhone == null ? '暂无': data.memPhone}} + {{data.payModel}} + {{data.payType}} + {{data.payPrice}} + {{data.createTime | date: 'yyyy-MM-dd HH:mm:ss'}} + {{data.payTime | date: 'yyyy-MM-dd HH:mm:ss'}} + {{data.cancelTime | date: 'yyyy-MM-dd HH:mm:ss'}} + {{data.orderStatus}} + + + + + + +
+ + + + + 退款理由 + + + + + + diff --git a/src/app/admin/order/order-k-list/order-k-list.component.scss b/src/app/admin/order/order-k-list/order-k-list.component.scss new file mode 100644 index 0000000..8bee3fb --- /dev/null +++ b/src/app/admin/order/order-k-list/order-k-list.component.scss @@ -0,0 +1,4 @@ +.head_img { + height: 60px; + width: 60px; +} diff --git a/src/app/admin/order/order-k-list/order-k-list.component.ts b/src/app/admin/order/order-k-list/order-k-list.component.ts new file mode 100644 index 0000000..acbb0aa --- /dev/null +++ b/src/app/admin/order/order-k-list/order-k-list.component.ts @@ -0,0 +1,186 @@ +import { Component, OnInit } from '@angular/core'; +import {environment} from '../../../../environments/environment'; +import {FormBuilder, FormGroup} from '_@angular_forms@9.0.7@@angular/forms'; +import {OrderService} from '../../../services/order.service'; +import {IconService} from '../../../services/icon.service'; +import {NzMessageService} from '_ng-zorro-antd@9.3.0@ng-zorro-antd'; +import {Router} from '_@angular_router@9.0.7@@angular/router'; +import {CompanyService} from '../../../services/company.service'; +import {MerchantService} from '../../../services/merchant.service'; +import {CommonsService} from '../../../services/commons.service'; + +@Component({ + selector: 'app-order-k-list', + templateUrl: './order-k-list.component.html', + styleUrls: ['./order-k-list.component.scss'] +}) +export class OrderKListComponent implements OnInit { + + WEB_SERVE_URL = environment.baseUrl; + FILE_URL = environment.imageUrl; + searchForm: FormGroup; // 搜索框 + requestData = []; // 列表数据 + companyData = []; // 列表数据 + merchantData = []; // 列表数据 + total: number; // 页码 + pageNum = 1; // 页码 + pageSize = 10; // 条码 + loading = true; + id: number; // 订单ID + isVisible = false; + refundContent: string; + constructor( + private form: FormBuilder, + private order: OrderService, + private iconService: IconService, + private message: NzMessageService, + private router: Router, + private company: CompanyService, + private merchant: MerchantService, + private common: CommonsService + ) { + } + + ngOnInit(): void { + this.init(); + const whereObject = {}; + whereObject['pageNum'] = 1; + whereObject['pageSize'] = 10000; + this.company.selectCompanyList(whereObject, data => { + if (data['return_code'] === '000000') { + this.companyData = data['return_data'].list; + } else { + this.message.error(data['return_msg']); + } + }); + this.getMerchantListByCompany(this.searchForm.value.companyId); + } + + public init(): void { + this.searchForm = this.form.group({ + companyId: [null], + merchantId: [null], + orderNo: [null], + paySerialNo: [null], + payModel: [null], + payType: [null], + orderStatus: [null], + payTime: [null] + }); + this.getRequest(true, this.searchForm.value); + } + + // 查询列表 + public getRequest(reset: boolean = false, whereObject: object) { + + if (whereObject['payTime'] != null && whereObject['payTime'].length !== 0) { + whereObject['payTimeS'] = whereObject['payTime'][0].getTime(); + whereObject['payTimeE'] = whereObject['payTime'][1].getTime(); + } + + + this.loading = false; + if (reset) { + this.pageNum = 1; + } + whereObject['pageNum'] = this.pageNum; + whereObject['pageSize'] = this.pageSize; + this.order.getCinemaOrderList(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 getMerchantListByCompany(companyId: number): void { + this.merchant.getMerchantListByCompany(companyId, data => { + if (data['return_code'] === '000000') { + if (data['return_code'] === '000000') { + this.merchantData = data['return_data']; + } else { + this.message.error(data['return_msg']); + } + } else { + this.message.error(data['return_msg']); + } + }); + } + + // 重置 + public resetForm(): void { + this.searchForm.reset(); + } + + + // 查看详情 + public getDetail(id: number): void { + this.router.navigate(['/admin/order/order-detail'], { + queryParams: { + merchantId: id + } + }).then(r => console.log(r)); + } + + // 下载模板 + downloadTemplate(whereObject) { + if (whereObject['payTime'] != null && whereObject['payTime'].length !== 0) { + whereObject['payTimeS'] = whereObject['payTime'][0].getTime(); + whereObject['payTimeE'] = whereObject['payTime'][1].getTime(); + } + this.order.exportGoodsOrderList(whereObject, data => { + if (data['return_code'] === '000000') { + window.location.href = this.FILE_URL + data['return_data']; + } else { + this.message.error(data['return_msg']); + } + }); + } + + provinceChange(e) { + console.log(e); + } + + // 退款 + public orderToRefund(id): void { + + } + + showModal(id): void { + console.log(id); + this.id = id; + this.isVisible = true; + } + + handleOk(): void { + if (this.refundContent == null || this.refundContent.length === 0) { + this.message.error('请输入退款原因'); + return; + } + this.common.showConfirm('确认订单是否退款', item => { + if (item) { + const params = { + orderId: this.id , + refundContent: this.refundContent + }; + this.order.refuelingOrderRefund(params, data => { + if (data['return_code'] === '000000') { + this.getRequest(false, this.searchForm.value); + this.isVisible = false; + this.message.success('申请退款中'); + } else { + this.message.error(data['return_msg']); + } + }); + } + }); + } + + handleCancel(): void { + this.isVisible = false; + } + +} diff --git a/src/app/admin/order/order-routing.module.ts b/src/app/admin/order/order-routing.module.ts index a6cebcb..ad3e432 100644 --- a/src/app/admin/order/order-routing.module.ts +++ b/src/app/admin/order/order-routing.module.ts @@ -5,6 +5,8 @@ import {OrderDetailComponent} from './order-detail/order-detail.component'; import {OrderCouponsComponent} from './order-coupons/order-coupons.component'; import {OrderCouponComponent} from './order-coupon/order-coupon.component'; import {OrderTListComponent} from './order-Tlist/order-Tlist.component'; +import {OrderCListComponent} from './order-c-list/order-c-list.component'; +import {OrderKListComponent} from './order-k-list/order-k-list.component'; const routes: Routes = [ @@ -13,6 +15,8 @@ const routes: Routes = [ { path: 'order-detail', component: OrderDetailComponent }, { path: 'order-coupons', component: OrderCouponsComponent }, { path: 'order-coupon', component: OrderCouponComponent }, + { path: 'order-c-list', component: OrderCListComponent }, + { path: 'order-k-list', component: OrderKListComponent }, ]; @NgModule({ diff --git a/src/app/admin/order/order.module.ts b/src/app/admin/order/order.module.ts index 706b9fe..c8e15f0 100644 --- a/src/app/admin/order/order.module.ts +++ b/src/app/admin/order/order.module.ts @@ -13,10 +13,12 @@ import { OrderDetailComponent } from './order-detail/order-detail.component'; import { OrderCouponsComponent } from './order-coupons/order-coupons.component'; import { OrderCouponComponent } from './order-coupon/order-coupon.component'; import {OrderTListComponent} from './order-Tlist/order-Tlist.component'; +import { OrderKListComponent } from './order-k-list/order-k-list.component'; +import {OrderCListComponent} from './order-c-list/order-c-list.component'; @NgModule({ - declarations: [OrderListComponent, OrderDetailComponent, OrderCouponsComponent, OrderCouponComponent , OrderTListComponent], + declarations: [OrderListComponent, OrderDetailComponent, OrderCouponsComponent, OrderCouponComponent , OrderTListComponent, OrderKListComponent , OrderCListComponent], imports: [ CommonModule, OrderRoutingModule, diff --git a/src/app/admin/recharge-order/price-list/price-list.component.html b/src/app/admin/recharge-order/price-list/price-list.component.html index f3f5ba6..0b903a4 100644 --- a/src/app/admin/recharge-order/price-list/price-list.component.html +++ b/src/app/admin/recharge-order/price-list/price-list.component.html @@ -37,8 +37,8 @@
共计 {{total}} 条数据
- + +
+ + + + + 商品ID + 渠道商标识符 + 折扣比例 + 商品名称 + 渠道商名称 + 状态 + + + + + {{data.goodsId}} + {{data.channelMark | channelMark}} + {{data.discountRatio}}% + {{data.goodsName}} + {{data.memberName}} + {{data.state == 1 ? '上架' : '下架'}} + + + + diff --git a/src/app/admin/recharge-order/price-list/price-list.component.ts b/src/app/admin/recharge-order/price-list/price-list.component.ts index 9f82506..a41a91a 100644 --- a/src/app/admin/recharge-order/price-list/price-list.component.ts +++ b/src/app/admin/recharge-order/price-list/price-list.component.ts @@ -27,6 +27,10 @@ export class PriceListComponent implements OnInit { isVisible = false; id: number; edit = false; + + isVisibleGoods = false; + + goodsArray; constructor( private form: FormBuilder, private recharge: RechargeService, @@ -92,6 +96,7 @@ export class PriceListComponent implements OnInit { } else { this.validateForm.reset(); this.isVisible = true; + this.edit = false; } } @@ -144,6 +149,9 @@ export class PriceListComponent implements OnInit { this.isVisible = false; } + handleCancelGoods(): void { + this.isVisibleGoods = false; + } public getForbiddenUser(id): void { this.common.showConfirm('是否删除', item => { @@ -160,4 +168,11 @@ export class PriceListComponent implements OnInit { }); } + public getMemberGoods(): void { + this.isVisibleGoods = true; + this.recharge.getMemberGoods(data => { + this.goodsArray = data['return_data']['data']; + }); + } + } diff --git a/src/app/app-common.module.ts b/src/app/app-common.module.ts index dc6e8a2..74d2699 100644 --- a/src/app/app-common.module.ts +++ b/src/app/app-common.module.ts @@ -25,7 +25,8 @@ import { DisplayAreaPipe, DiscountCodeStatusPipe, RechargePricePipe, - RechargeStatusPipe + RechargeStatusPipe, + ChannelMarkPipe } from './pipes'; @@ -45,7 +46,8 @@ const PIPES = [ DisplayAreaPipe, DiscountCodeStatusPipe, RechargePricePipe, - RechargeStatusPipe + RechargeStatusPipe, + ChannelMarkPipe ]; @@ -59,6 +61,7 @@ const PIPES = [ ], declarations: [ ...PIPES, + ChannelMarkPipe, ], exports: [ diff --git a/src/app/pipes/channel-mark.pipe.ts b/src/app/pipes/channel-mark.pipe.ts new file mode 100644 index 0000000..da8d2aa --- /dev/null +++ b/src/app/pipes/channel-mark.pipe.ts @@ -0,0 +1,23 @@ +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'channelMark' +}) +export class ChannelMarkPipe implements PipeTransform { + + transform(value: number): string { + switch (value) { + case 1: + return '中石油'; + case 2: + return '中石化'; + case 3: + return '移动'; + case 4: + return '联通'; + case 5: + return '电信'; + } + } + +} diff --git a/src/app/pipes/index.ts b/src/app/pipes/index.ts index 65bdb7a..d740f98 100644 --- a/src/app/pipes/index.ts +++ b/src/app/pipes/index.ts @@ -14,3 +14,4 @@ export * from './display-area.pipe'; export * from './discount-code-status.pipe'; export * from './recharge-price.pipe'; export * from './recharge-status.pipe'; +export * from './channel-mark.pipe'; diff --git a/src/app/services/order.service.ts b/src/app/services/order.service.ts index e4a000e..b5d022d 100644 --- a/src/app/services/order.service.ts +++ b/src/app/services/order.service.ts @@ -37,6 +37,30 @@ export class OrderService { }); } + /** + * 查询KFC订单列表 + * + * @param paramsObject 对象 + * @param callBack 回调 + */ + public getKfcOrderList(paramsObject: object, callBack) { + this.http.get(environment.baseUrl + 'highOrder/getKfcOrderList?' + this.common.getWhereCondition(paramsObject)).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询dianying订单列表 + * + * @param paramsObject 对象 + * @param callBack 回调 + */ + public getCinemaOrderList(paramsObject: object, callBack) { + this.http.get(environment.baseUrl + 'highOrder/getCinemaOrderList?' + this.common.getWhereCondition(paramsObject)).subscribe(data => { + callBack(data); + }); + } + /** * 查询订单列表 * diff --git a/src/app/services/recharge.service.ts b/src/app/services/recharge.service.ts index b387a9f..6ff82a2 100644 --- a/src/app/services/recharge.service.ts +++ b/src/app/services/recharge.service.ts @@ -196,6 +196,16 @@ export class RechargeService { }); } + /** + * 获取渠道商获取关联商品 + * + * @param callBack 回调 + */ + public getMemberGoods(callBack) { + this.http.get(environment.baseUrl + 'telApi/getMemberGoods').subscribe(data => { + callBack(data); + }); + } } diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 6506d77..350d219 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -4,10 +4,10 @@ export const environment = { production: false, - // baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址) - // imageUrl: 'http://localhost:9302/filesystem/', - baseUrl: 'https://hsgcs.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) - imageUrl: 'https://hsgcs.dctpay.com/filesystem/', + baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址) + imageUrl: 'http://localhost:9302/filesystem/', + // baseUrl: 'https://hsgcs.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) + // imageUrl: 'https://hsgcs.dctpay.com/filesystem/', key: 'https://hsgcs.dctpay.com/phone-recharge-H5/index.html?codeValue=', };