提交修改

pull/1/head
袁野 3 years ago
parent c5f351a67e
commit a9b4eaf54d
  1. 66
      src/app/admin/coupon/coupon-list/coupon-list.component.html
  2. 1
      src/app/admin/coupon/coupon-list/coupon-list.component.ts
  3. 22
      src/app/admin/merchant-store/store-edit/store-edit.component.html
  4. 39
      src/app/admin/merchant-store/store-edit/store-edit.component.ts

@ -7,7 +7,7 @@
<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="8">
<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">
@ -15,7 +15,21 @@
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</div> </div>
<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">
<nz-select nzPlaceHolder="请选择展示区域" [formControlName]="'displayArea'">
<nz-option nzValue="1" nzLabel="赠券专区"></nz-option>
<nz-option nzValue="2" nzLabel="金币专区"></nz-option>
<nz-option nzValue="3" nzLabel="银联专区"></nz-option>
<nz-option nzValue="4" nzLabel="优选商品"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col nzSpan="8">
<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">
@ -25,17 +39,17 @@
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</div> </div>
<div nz-col nzSpan="6"> <div nz-col nzSpan="8">
<nz-form-item> <nz-form-item>
<nz-form-label >品牌</nz-form-label> <nz-form-label [nzSpan]="6">品牌</nz-form-label>
<nz-form-control> <nz-form-control [nzSpan]="16">
<nz-select nzPlaceHolder="请选择品牌" [formControlName]="'brandId'"> <nz-select nzPlaceHolder="请选择品牌" [formControlName]="'brandId'">
<nz-option *ngFor="let item of brandData" nzValue="{{item.id}}" nzLabel="{{item.title}}"></nz-option> <nz-option *ngFor="let item of brandData" nzValue="{{item.id}}" nzLabel="{{item.title}}"></nz-option>
</nz-select> </nz-select>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</div> </div>
<div nz-col nzSpan="6"> <div nz-col nzSpan="8">
<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">
@ -57,7 +71,7 @@
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</div> </div>
<div nz-col nzSpan="6"> <div nz-col nzSpan="8">
<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">
@ -68,7 +82,7 @@
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</div> </div>
<div nz-col nzSpan="6"> <div nz-col nzSpan="8">
<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">
@ -125,13 +139,13 @@
<th nzWidth="100px">销售价格</th> <th nzWidth="100px">销售价格</th>
<th nzWidth="100px">折扣价格</th> <th nzWidth="100px">折扣价格</th>
<th nzWidth="100px">有效库存</th> <th nzWidth="100px">有效库存</th>
<th nzWidth="100px">展示区域</th>
<th nzWidth="100px">卡券类型</th> <th nzWidth="100px">卡券类型</th>
<th nzWidth="100px">是否赠券</th> <th nzWidth="100px">是否赠券</th>
<th nzWidth="120px">卡券状态</th>
<th nzWidth="150px">销售截止时间</th> <th nzWidth="150px">销售截止时间</th>
<th nzWidth="150px">创建时间</th> <th nzWidth="150px">创建时间</th>
<th nzWidth="150px" nzRight="0px">操作</th> <th nzWidth="100px" nzRight>展示区域</th>
<th nzWidth="120px" nzRight>卡券状态</th>
<th nzWidth="150px" nzRight>操作</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -142,22 +156,28 @@
<td>¥{{data.salesPrice}}</td> <td>¥{{data.salesPrice}}</td>
<td>¥{{data.discountPrice}}</td> <td>¥{{data.discountPrice}}</td>
<td>{{data.stockCount}}</td> <td>{{data.stockCount}}</td>
<td>{{data.displayArea | displayArea}}</td>
<td>{{data.couponType === 1 ? '内部卷' : '外部卷'}}</td> <td>{{data.couponType === 1 ? '内部卷' : '外部卷'}}</td>
<td>{{data.isPresent === true ? '赠券' : '无赠券'}}</td> <td>{{data.isPresent === true ? '赠券' : '无赠券'}}</td>
<td>{{data.status | couponStatus}}</td>
<td>{{data.salesEndTime | date: 'yyyy-MM-dd HH:mm'}}</td> <td>{{data.salesEndTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td> <td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td nzRight="0px" class="table-td-operation"> <td nzRight>{{data.displayArea | displayArea}}</td>
<a *ngIf="data.status !== 101" (click)="getEdit(data.id)"><i nz-icon nzType="form" nzTheme="outline" nz-tooltip="编辑"></i></a> <td nzRight>
<nz-divider nzType="vertical" *ngIf="data.status === 1 || data.status === 3 || data.status === 102"></nz-divider> <span *ngIf="data.status === 2" style="color: limegreen">{{data.status | couponStatus}}</span>
<a *ngIf="data.status === 1 || data.status === 3 || data.status === 102" (click)="enableMerchant(data.id)"> <i nz-icon [nzIconfont]="'icon-shangjia'" nz-tooltip="上架"></i></a> <span *ngIf="data.status === 3" style="color: red">{{data.status | couponStatus}}</span>
<nz-divider *ngIf="data.status === 2" nzType="vertical"></nz-divider> <span *ngIf="data.status === 1 || data.status === 102">{{data.status | couponStatus}}</span>
<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> </td>
<a (click)="getList(data.id , data.couponName , data.couponType)"><i nz-icon nzType="unordered-list" nzTheme="outline" nz-tooltip="销售码列表"></i></a> <td nzRight class="table-td-operation">
<!-- <nz-divider *ngIf="data.status !== 101" nzType="vertical"></nz-divider>--> <a *ngIf="data.status === 2" (click)="disableMerchant(data.id)">下架</a>
<!-- <a *ngIf="data.status !== 101" (click)="getDelete(data.id)"><i nz-icon nzType="delete" nzTheme="outline" nz-tooltip="删除"></i></a>--> <a *ngIf="data.status === 1 || data.status === 3 || data.status === 102" (click)="enableMerchant(data.id)">上架</a>
<nz-divider nzType="vertical" ></nz-divider>
<a nz-dropdown [nzDropdownMenu]="menu">更多</a>
<nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu nzSelectable>
<li class="li-a" *ngIf="data.status === 1 || data.status === 3 || data.status === 102" nz-menu-item> <a (click)="getEdit(data.id)">编辑</a></li>
<li class="li-a" nz-menu-item><a (click)="getList(data.id , data.couponName , data.couponType)">销售码列表</a></li>
</ul>
</nz-dropdown-menu>
</td> </td>
</tbody> </tbody>
</nz-table> </nz-table>

@ -81,6 +81,7 @@ export class CouponListComponent implements OnInit {
couponType: [null], couponType: [null],
goodsTypeId: [null], goodsTypeId: [null],
brandId: [null], brandId: [null],
displayArea: [null],
status: [null], status: [null],
}); });
this.getRequest(true, this.searchForm.value); this.getRequest(true, this.searchForm.value);

@ -42,6 +42,28 @@
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
</div> </div>
<div nz-col [nzSpan]="8">
<nz-form-item>
<nz-form-label>门店LOGO</nz-form-label>
<nz-form-control>
<nz-upload
nzAction="{{WEB_SERVE_URL}}/fileUpload/uploadfile"
nzListType="picture-card"
[(nzFileList)]="logoFile"
[nzShowButton]="logoFile.length < 1"
[nzPreview]="handlePreview"
>
<i nz-icon nzType="plus"></i>
<div class="ant-upload-text">上传LOGO</div>
</nz-upload>
<nz-modal [nzVisible]="previewVisible" [nzContent]="modalContent" [nzFooter]="null" (nzOnCancel)="previewVisible = false">
<ng-template #modalContent>
<img [src]="previewImage" [ngStyle]="{ width: '100%' }" />
</ng-template>
</nz-modal>
</nz-form-control>
</nz-form-item>
</div>
<div nz-col [nzSpan]="8"> <div nz-col [nzSpan]="8">
<nz-form-item> <nz-form-item>
<nz-form-label [nzFor]="'storeName'" nzRequired>门店名称</nz-form-label> <nz-form-label [nzFor]="'storeName'" nzRequired>门店名称</nz-form-label>

@ -2,7 +2,7 @@ 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} from 'ng-zorro-antd'; import {NzMessageService, NzUploadFile} 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'; import {MerchantStoreService} from '../../../services/merchant-store.service';
@ -10,6 +10,15 @@ import {MerchantStoreService} from '../../../services/merchant-store.service';
declare var AMap: any; // 一定要声明AMap,要不然报错找不到AMap declare var AMap: any; // 一定要声明AMap,要不然报错找不到AMap
declare var AMapUI: any; declare var AMapUI: any;
function getBase64(file: File): Promise<string | ArrayBuffer | null> {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = () => resolve(reader.result);
reader.onerror = error => reject(error);
});
}
@Component({ @Component({
selector: 'app-store-edit', selector: 'app-store-edit',
templateUrl: './store-edit.component.html', templateUrl: './store-edit.component.html',
@ -25,6 +34,7 @@ export class StoreEditComponent implements OnInit {
logoFile = []; logoFile = [];
WEB_SERVE_URL = environment.baseUrl; WEB_SERVE_URL = environment.baseUrl;
previewVisible = false; previewVisible = false;
previewImage: string | undefined = '';
constructor( constructor(
private fb: FormBuilder, private fb: FormBuilder,
@ -62,6 +72,16 @@ export class StoreEditComponent implements OnInit {
} }
// 图片查看
handlePreview = async (file: NzUploadFile) => {
if (!file.url && !file.preview) {
// tslint:disable-next-line:no-non-null-assertion
file.preview = await getBase64(file.originFileObj!);
}
this.previewImage = file.url || file.preview;
this.previewVisible = true;
}
// 返回 // 返回
getBack() { getBack() {
history.back(); history.back();
@ -83,14 +103,13 @@ export class StoreEditComponent implements OnInit {
return; return;
} }
} }
console.log(this.validateForm.value);
this.validateForm.value['secUser']['telephone'] = this.validateForm.value.telephone; 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) {
this.validateForm.value.merchantLogo = this.logoFile[0]['response']['return_data'][0]; this.validateForm.value.storeLogo = this.logoFile[0]['response']['return_data'][0];
} else { } else {
this.validateForm.value.merchantLogo = this.logoFile[0].name; this.validateForm.value.storeLogo = this.logoFile[0].name;
} }
} }
if (this.editFlag) { if (this.editFlag) {
@ -121,6 +140,18 @@ export class StoreEditComponent implements OnInit {
if (data['return_code'] === '000000') { if (data['return_code'] === '000000') {
data['return_data'].telephone = 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']['storeLogo'] != null && data['return_data']['storeLogo'] !== '') {
const logo = String(data['return_data']['storeLogo']);
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(); this.getMap();
} else { } else {

Loading…
Cancel
Save