diff --git a/src/app/admin/coupon/coupon-list/coupon-list.component.html b/src/app/admin/coupon/coupon-list/coupon-list.component.html index a533fe9..0440f7c 100644 --- a/src/app/admin/coupon/coupon-list/coupon-list.component.html +++ b/src/app/admin/coupon/coupon-list/coupon-list.component.html @@ -82,6 +82,7 @@
+
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']); + } + }); + } + } diff --git a/src/app/admin/order/order-coupons/order-coupons.component.html b/src/app/admin/order/order-coupons/order-coupons.component.html index e2b3578..0d632aa 100644 --- a/src/app/admin/order/order-coupons/order-coupons.component.html +++ b/src/app/admin/order/order-coupons/order-coupons.component.html @@ -60,7 +60,7 @@ - +
@@ -86,6 +86,9 @@ 共计 {{totalCode}} 条数据 +
+ +
编号 优惠券名称 用户名称 + 使用门店 + 使用时间 二维码生成时间 状态 - {{i+1}} + {{data.id}} {{data['highDiscount'].discountName}} {{data['highUser'] == null ? '暂无': data['highUser'].name}} + {{data['highCouponCode']?.storeName}} + {{data['highCouponCode']?.useEndTime | date: 'yyyy-MM-dd HH:mm'}} {{data.createTime | date: 'yyyy-MM-dd HH:mm'}} {{data.status | discountCodeStatus}} - + + + + \ No newline at end of file diff --git a/src/app/admin/order/order-coupons/order-coupons.component.ts b/src/app/admin/order/order-coupons/order-coupons.component.ts index 0ad2de7..b33ebcd 100644 --- a/src/app/admin/order/order-coupons/order-coupons.component.ts +++ b/src/app/admin/order/order-coupons/order-coupons.component.ts @@ -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']); + } + + }); + } } diff --git a/src/app/services/agent.service.ts b/src/app/services/agent.service.ts index 5b754c5..0980aff 100644 --- a/src/app/services/agent.service.ts +++ b/src/app/services/agent.service.ts @@ -178,4 +178,9 @@ export class AgentService { }); } + public getDiscountStatus(params: object, callBack) { + this.http.post(environment.baseUrl + 'discountAgentRel/getDiscountStatus', params).subscribe(data => { + callBack(data); + }); + } } diff --git a/src/app/services/coupon.service.ts b/src/app/services/coupon.service.ts index a000286..6356ab3 100644 --- a/src/app/services/coupon.service.ts +++ b/src/app/services/coupon.service.ts @@ -99,6 +99,13 @@ export class CouponService { }); } + + public getGuizhouSinopec( callBack) { + this.http.get(environment.baseUrl + 'coupon/getGuizhouSinopec?merchantId=40').subscribe(data => { + callBack(data); + }); + } + /** * 生成消费码 * diff --git a/src/environments/environment.ts b/src/environments/environment.ts index a34b4c5..6506d77 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -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=', }; /*