From 1540865447ef2154e77ecf9a65b423bc5c96d624 Mon Sep 17 00:00:00 2001 From: Sum1Dream <418471657@qq.com> Date: Tue, 30 Mar 2021 17:47:53 +0800 Subject: [PATCH] 1 --- .../coupon-edit/coupon-edit.component.html | 16 ++++++++- .../coupon-edit/coupon-edit.component.ts | 34 +++++++++++++++++-- src/app/pipes/system.pipe.ts | 4 ++- src/app/services/company.service.ts | 2 +- 4 files changed, 51 insertions(+), 5 deletions(-) diff --git a/src/app/admin/coupon/coupon-edit/coupon-edit.component.html b/src/app/admin/coupon/coupon-edit/coupon-edit.component.html index a9f9fd1..9122746 100644 --- a/src/app/admin/coupon/coupon-edit/coupon-edit.component.html +++ b/src/app/admin/coupon/coupon-edit/coupon-edit.component.html @@ -201,7 +201,21 @@ 卡券介紹 - + + +
上传图片
+
+ + + + +
diff --git a/src/app/admin/coupon/coupon-edit/coupon-edit.component.ts b/src/app/admin/coupon/coupon-edit/coupon-edit.component.ts index 885bae8..476298e 100644 --- a/src/app/admin/coupon/coupon-edit/coupon-edit.component.ts +++ b/src/app/admin/coupon/coupon-edit/coupon-edit.component.ts @@ -31,6 +31,7 @@ export class CouponEditComponent implements OnInit { id: number; couponImg = []; couponCarouselImg = []; + couponDescImg = []; WEB_SERVE_URL = environment.baseUrl; previewImage: string | undefined = ''; previewVisible = false; @@ -213,8 +214,23 @@ export class CouponEditComponent implements OnInit { this.message.error('请上传卡券轮播图'); return; } + const couponDescImg = []; + + if (this.couponDescImg.length !== 0) { + for (const i of this.couponDescImg) { + if (i['response'] != null) { + couponDescImg.push(i['response']['return_data'][0]); + } else { + couponDescImg.push(i.name); + } + } + } else { + this.message.error('请上传卡券详情图'); + return; + } + this.validateForm.value.couponCarouselImg = couponCarouselImg.join(','); - this.validateForm.value.couponDesc = this.content; + this.validateForm.value.couponDesc = couponDescImg.join(','); if (this.editFlag) { this.common.showConfirm('是否确定修改,确定将下架' , dataR => { if (dataR) { @@ -258,7 +274,6 @@ export class CouponEditComponent implements OnInit { data['return_data']['couponType'] = String(data['return_data']['couponType']); data['return_data']['displayArea'] = String(data['return_data']['displayArea']); data['return_data']['payType'] = String(data['return_data']['payType']); - this.content = data['return_data']['couponDesc']; if (data['return_data']['couponImg'] != null && data['return_data']['couponImg'] !== '') { const couponImg = String(data['return_data']['couponImg']); const couponArray = []; @@ -285,6 +300,21 @@ export class CouponEditComponent implements OnInit { } this.couponCarouselImg = couponCarouselArray; } + if (data['return_data']['couponDesc'] != null && data['return_data']['couponDesc'] !== '') { + const couponDescImg = data['return_data']['couponDesc'].split(','); + const couponDescArray = []; + for (const i of couponDescImg) { + couponDescArray.push( + { + uid: 1, + name: i, + status: 'done', + url: environment.imageUrl + i + }); + } + this.couponDescImg = couponDescArray; + } + this.validateForm.patchValue(data['return_data']); } else { this.message.create('error', data['return_msg']); diff --git a/src/app/pipes/system.pipe.ts b/src/app/pipes/system.pipe.ts index 8860468..fc258f5 100644 --- a/src/app/pipes/system.pipe.ts +++ b/src/app/pipes/system.pipe.ts @@ -10,13 +10,15 @@ export class SystemPipe implements PipeTransform { case 0: return '超级管理员'; case 1: - return '区域账号'; + return '运营中心账户'; case 2: return '商户账号'; case 3: return '门店账号'; case 4: return '代理商账号'; + case 5: + return '分公司账号'; } } diff --git a/src/app/services/company.service.ts b/src/app/services/company.service.ts index 2fbd83d..88a111e 100644 --- a/src/app/services/company.service.ts +++ b/src/app/services/company.service.ts @@ -26,7 +26,7 @@ export class CompanyService { } /** - * 新增卡券 + * 新增 * * @param params 上传对象 * @param callBack 回调