pull/1/head
袁野 3 years ago
parent 57d7abd3f5
commit e1334d2717
  1. 1
      src/app/admin/coupon/coupon-list/coupon-list.component.html
  2. 12
      src/app/admin/coupon/coupon-list/coupon-list.component.ts
  3. 42
      src/app/admin/order/order-coupons/order-coupons.component.html
  4. 48
      src/app/admin/order/order-coupons/order-coupons.component.ts
  5. 5
      src/app/services/agent.service.ts
  6. 7
      src/app/services/coupon.service.ts
  7. 8
      src/environments/environment.ts

@ -82,6 +82,7 @@
</span>
<div class="operating-button">
<button nz-button nzType="primary" class="right-btn" [routerLink]="['/admin/coupon/coupon-edit']" ><i nz-icon nzType="plus" nzTheme="outline"></i>添加</button>
<button nz-button nzType="primary" class="right-btn" (click)="getGuizhouSinopec()" ><i nz-icon nzType="redo" nzTheme="outline"></i>刷新中石化卡券</button>
</div>
<nz-table
class="table"

@ -204,4 +204,16 @@ export class CouponListComponent implements OnInit {
}).then(r => console.log(r));
}
// 刷新中石化
public getGuizhouSinopec(): void {
this.coupon.getGuizhouSinopec(data => {
if (data['return_code'] === '000000') {
this.message.success('操作成功');
this.getRequest(false , this.searchForm.value);
} else {
this.message.warning(data['return_msg']);
}
});
}
}

@ -60,7 +60,7 @@
</nz-table>
</div>
<nz-modal [(nzVisible)]="isVisible" nzTitle="使用情况" nzWidth="1000" (nzOnCancel)="handleCancel()" (nzOnOk)="handleOk()">
<nz-modal [(nzVisible)]="isVisible" nzTitle="使用情况" nzWidth="1000" (nzOnCancel)="handleCancel()" (nzOnOk)="handleCancel()">
<form nz-form [formGroup]="searchForm" (ngSubmit)="getRequestCode(true , searchForm.value)">
<div nz-row>
<div nz-col nzSpan="9">
@ -86,6 +86,9 @@
</form>
<span>共计 {{totalCode}} 条数据</span>
<div class="operating-button">
<button nz-button nzType="primary" class="right-btn" (click)="getEditStatus()" >修改优惠券状态</button>
</div>
<nz-table
class="table"
#ajaxTableCode
@ -103,21 +106,54 @@
<th nzWidth="50px">编号</th>
<th nzWidth="70px">优惠券名称</th>
<th nzWidth="70px">用户名称</th>
<th nzWidth="70px">使用门店</th>
<th nzWidth="70px">使用时间</th>
<th nzWidth="70px">二维码生成时间</th>
<th nzWidth="50px">状态</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of ajaxTableCode.data; let i = index">
<td>{{i+1}}</td>
<td>{{data.id}}</td>
<td>{{data['highDiscount'].discountName}}</td>
<td>
{{data['highUser'] == null ? '暂无': data['highUser'].name}}
</td>
<td>{{data['highCouponCode']?.storeName}}</td>
<td>{{data['highCouponCode']?.useEndTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>{{data.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>{{data.status | discountCodeStatus}}</td>
</tbody>
</nz-table>
</nz-modal>
<nz-modal [(nzVisible)]="isVisibleS" nzTitle="修改优惠券状态" nzWidth="800" [nzOkLoading]="loadingS" (nzOnCancel)="handleCancelS()" (nzOnOk)="handleOk()">
<form nz-form [formGroup]="validateFormPost" class="login-form">
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>优惠券状态</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="请选择优惠券状态!">
<nz-select nzShowSearch nzAllowClear formControlName="status" nzPlaceHolder="请选择优惠券状态">
<nz-option nzLabel="待领取" nzValue="1"></nz-option>
<nz-option nzLabel="已过期" nzValue="4"></nz-option>
</nz-select>
</nz-form-control>
</nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="6" nzRequired>编号区间</nz-form-label>
<nz-form-control [nzSpan]="16" nzErrorTip="分配优惠券数量!">
<nz-input-group nzCompact>
<input type="number" nz-input placeholder="开始编号" formControlName="minNumber" style="width:100px; text-align: center;" />
<input
type="text"
disabled
nz-input
placeholder="~"
style="width: 30px; border-left: 0px; pointer-events: none; background-color: rgb(255, 255, 255);"
/>
<input type="number" nz-input placeholder="结束编号" formControlName="maxNumber" style="width: 100px; text-align: center; border-left: 0px;" />
</nz-input-group>
</nz-form-control>
</nz-form-item>
</form>
</nz-modal>

@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';
import {environment} from '../../../../environments/environment';
import {FormBuilder, FormGroup} from '@angular/forms';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {IconService} from '../../../services/icon.service';
import {NzMessageService} from 'ng-zorro-antd';
import {AgentService} from '../../../services/agent.service';
@ -15,6 +15,7 @@ import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace';
export class OrderCouponsComponent implements OnInit {
searchForm: FormGroup; // 搜索框
validateFormPost: FormGroup; // 搜索框
requestData = []; // 列表数据
total: number; // 页码
pageNum = 1; // 页码
@ -27,7 +28,9 @@ export class OrderCouponsComponent implements OnInit {
pageSizeCode = 10; // 条码
loadingCode = true;
isVisible = false;
isVisibleS = false;
id: number;
loadingS = false;
constructor(
private form: FormBuilder,
private agent: AgentService,
@ -45,6 +48,11 @@ export class OrderCouponsComponent implements OnInit {
this.searchForm = this.form.group({
status: [null],
});
this.validateFormPost = this.form.group({
status: [null, [Validators.required]],
minNumber: [null, [Validators.required]],
maxNumber: [null, [Validators.required]],
});
this.getRequest(true, {});
}
@ -99,12 +107,44 @@ export class OrderCouponsComponent implements OnInit {
});
}
handleOk(): void {
this.isVisible = false;
}
handleCancel(): void {
this.searchForm.reset();
this.isVisible = false;
}
handleCancelS(): void {
this.isVisibleS = false;
}
getEditStatus() {
this.isVisibleS = true;
}
handleOk(): void {
// tslint:disable-next-line:forin
for (const i in this.validateFormPost.controls) {
this.validateFormPost.controls[i].markAsDirty();
this.validateFormPost.controls[i].updateValueAndValidity();
if (this.validateFormPost.controls[i].errors != null) {
this.message.error('必填项不能为空');
return;
}
}
const id = this.message.loading('正在提交中', { nzDuration: 0 }).messageId;
this.loadingS = true;
this.agent.getDiscountStatus(this.validateFormPost.value , data => {
if (data['return_code'] === '000000') {
this.isVisibleS = false;
this.loadingS = false;
this.getRequestCode(false , this.searchForm.value);
this.message.remove(id);
this.message.success('成功');
} else {
this.message.error(data['return_msg']);
}
});
}
}

@ -178,4 +178,9 @@ export class AgentService {
});
}
public getDiscountStatus(params: object, callBack) {
this.http.post(environment.baseUrl + 'discountAgentRel/getDiscountStatus', params).subscribe(data => {
callBack(data);
});
}
}

@ -99,6 +99,13 @@ export class CouponService {
});
}
public getGuizhouSinopec( callBack) {
this.http.get(environment.baseUrl + 'coupon/getGuizhouSinopec?merchantId=40').subscribe(data => {
callBack(data);
});
}
/**
*
*

@ -4,9 +4,11 @@
export const environment = {
production: false,
baseUrl: 'https://hsg.dctpay.com/brest/', // 正式环境服务器地址(请求数据地址)
imageUrl: 'https://hsg.dctpay.com/filesystem/',
key: 'https://hsg.dctpay.com/phone-recharge-H5/index.html?codeValue=',
// 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=',
};
/*

Loading…
Cancel
Save