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> </span>
<div class="operating-button"> <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" [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> </div>
<nz-table <nz-table
class="table" class="table"

@ -204,4 +204,16 @@ export class CouponListComponent implements OnInit {
}).then(r => console.log(r)); }).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> </nz-table>
</div> </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)"> <form nz-form [formGroup]="searchForm" (ngSubmit)="getRequestCode(true , searchForm.value)">
<div nz-row> <div nz-row>
<div nz-col nzSpan="9"> <div nz-col nzSpan="9">
@ -86,6 +86,9 @@
</form> </form>
<span>共计 {{totalCode}} 条数据</span> <span>共计 {{totalCode}} 条数据</span>
<div class="operating-button">
<button nz-button nzType="primary" class="right-btn" (click)="getEditStatus()" >修改优惠券状态</button>
</div>
<nz-table <nz-table
class="table" class="table"
#ajaxTableCode #ajaxTableCode
@ -103,21 +106,54 @@
<th nzWidth="50px">编号</th> <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="70px">使用时间</th>
<th nzWidth="70px">二维码生成时间</th> <th nzWidth="70px">二维码生成时间</th>
<th nzWidth="50px">状态</th> <th nzWidth="50px">状态</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr *ngFor="let data of ajaxTableCode.data; let i = index"> <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['highDiscount'].discountName}}</td>
<td> <td>
{{data['highUser'] == null ? '暂无': data['highUser'].name}} {{data['highUser'] == null ? '暂无': data['highUser'].name}}
</td> </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.createTime | date: 'yyyy-MM-dd HH:mm'}}</td>
<td>{{data.status | discountCodeStatus}}</td> <td>{{data.status | discountCodeStatus}}</td>
</tbody> </tbody>
</nz-table> </nz-table>
</nz-modal> </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 { Component, OnInit } from '@angular/core';
import {environment} from '../../../../environments/environment'; 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 {IconService} from '../../../services/icon.service';
import {NzMessageService} from 'ng-zorro-antd'; import {NzMessageService} from 'ng-zorro-antd';
import {AgentService} from '../../../services/agent.service'; import {AgentService} from '../../../services/agent.service';
@ -15,6 +15,7 @@ import {ADMIN_INFO_OBJECT} from '../../../services/local-storage.namespace';
export class OrderCouponsComponent implements OnInit { export class OrderCouponsComponent implements OnInit {
searchForm: FormGroup; // 搜索框 searchForm: FormGroup; // 搜索框
validateFormPost: FormGroup; // 搜索框
requestData = []; // 列表数据 requestData = []; // 列表数据
total: number; // 页码 total: number; // 页码
pageNum = 1; // 页码 pageNum = 1; // 页码
@ -27,7 +28,9 @@ export class OrderCouponsComponent implements OnInit {
pageSizeCode = 10; // 条码 pageSizeCode = 10; // 条码
loadingCode = true; loadingCode = true;
isVisible = false; isVisible = false;
isVisibleS = false;
id: number; id: number;
loadingS = false;
constructor( constructor(
private form: FormBuilder, private form: FormBuilder,
private agent: AgentService, private agent: AgentService,
@ -45,6 +48,11 @@ export class OrderCouponsComponent implements OnInit {
this.searchForm = this.form.group({ this.searchForm = this.form.group({
status: [null], status: [null],
}); });
this.validateFormPost = this.form.group({
status: [null, [Validators.required]],
minNumber: [null, [Validators.required]],
maxNumber: [null, [Validators.required]],
});
this.getRequest(true, {}); this.getRequest(true, {});
} }
@ -99,12 +107,44 @@ export class OrderCouponsComponent implements OnInit {
}); });
} }
handleOk(): void {
this.isVisible = false;
}
handleCancel(): void { handleCancel(): void {
this.searchForm.reset();
this.isVisible = false; 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 = { export const environment = {
production: false, production: false,
baseUrl: 'https://hsg.dctpay.com/brest/', // 正式环境服务器地址(请求数据地址) // baseUrl: 'http://localhost:9302/brest/', // 测试环境服务器地址(请求数据地址)
imageUrl: 'https://hsg.dctpay.com/filesystem/', // imageUrl: 'http://localhost:9302/filesystem/',
key: 'https://hsg.dctpay.com/phone-recharge-H5/index.html?codeValue=', 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