|
|
|
@ -1,4 +1,4 @@ |
|
|
|
|
import { Component, OnInit } from '@angular/core'; |
|
|
|
|
import {Component, OnInit} from '@angular/core'; |
|
|
|
|
import {environment} from '../../../../environments/environment'; |
|
|
|
|
import {FormBuilder, FormGroup, Validators} from '@angular/forms'; |
|
|
|
|
import {CompanyService} from '../../../services/company.service'; |
|
|
|
@ -125,7 +125,7 @@ export class DiscountPackageListComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
// 活动开始
|
|
|
|
|
public upDiscountPackage(id: number): void { |
|
|
|
|
this.discountPackage.upDiscountPackage({discountPackageId : id}, data => { |
|
|
|
|
this.discountPackage.upDiscountPackage({discountPackageId: id}, data => { |
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
this.message.success('上架成功'); |
|
|
|
|
this.getRequest(true, this.searchForm.value); |
|
|
|
@ -137,7 +137,7 @@ export class DiscountPackageListComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
// 活动结束
|
|
|
|
|
public downDiscountPackage(id: number): void { |
|
|
|
|
this.discountPackage.downDiscountPackage({discountPackageId : id}, data => { |
|
|
|
|
this.discountPackage.downDiscountPackage({discountPackageId: id}, data => { |
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
this.message.success('下架成功'); |
|
|
|
|
this.getRequest(true, this.searchForm.value); |
|
|
|
@ -151,7 +151,7 @@ export class DiscountPackageListComponent implements OnInit { |
|
|
|
|
public deleteDiscountPackage(id: number): void { |
|
|
|
|
this.commonsService.showConfirm('是否确认删除', isDelete => { |
|
|
|
|
if (isDelete) { |
|
|
|
|
this.discountPackage.deleteDiscountPackage({discountPackageId : id}, data => { |
|
|
|
|
this.discountPackage.deleteDiscountPackage({discountPackageId: id}, data => { |
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
this.message.success('删除成功'); |
|
|
|
|
this.getRequest(true, this.searchForm.value); |
|
|
|
@ -178,7 +178,7 @@ export class DiscountPackageListComponent implements OnInit { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public getDetails(id: number): void { |
|
|
|
|
this.discountPackage.getDiscountPackageRuleById(id , data => { |
|
|
|
|
this.discountPackage.getDiscountPackageRuleById(id, data => { |
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
this.listOfData = data['return_data']; |
|
|
|
|
this.isVisible = true; |
|
|
|
@ -211,8 +211,8 @@ export class DiscountPackageListComponent implements OnInit { |
|
|
|
|
num: this.num, |
|
|
|
|
discountPackageId: this.id |
|
|
|
|
}; |
|
|
|
|
const id = this.message.loading('增加库存中..', { nzDuration: 0 }).messageId; |
|
|
|
|
this.discountPackage.addDiscountPackageStock(param , data => { |
|
|
|
|
const id = this.message.loading('增加库存中..', {nzDuration: 0}).messageId; |
|
|
|
|
this.discountPackage.addDiscountPackageStock(param, data => { |
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
this.isVisibleInventory = false; |
|
|
|
|
this.getRequest(true, this.searchForm.value); |
|
|
|
@ -226,16 +226,16 @@ export class DiscountPackageListComponent implements OnInit { |
|
|
|
|
|
|
|
|
|
// 打开 发送优惠券包给用户模态框
|
|
|
|
|
showDeliverUserModal(packageId: number, packageName: string) { |
|
|
|
|
this.discountPackage.getHandleByPackageId({ packageId: packageId}, data => { |
|
|
|
|
this.discountPackage.getHandleByPackageId({packageId: packageId}, data => { |
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
if (data['return_data'] != null) { |
|
|
|
|
this.modal.confirm({ |
|
|
|
|
nzTitle: '提示', |
|
|
|
|
nzContent: '当前卷包有赠送任务进行中,是否查看赠送进度?', |
|
|
|
|
nzOnOk: () => this.processRate(data['return_data']['serialNumber']) |
|
|
|
|
}) |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
this.deliverUserForm.patchValue({ packageId: packageId, packageName: packageName}); |
|
|
|
|
this.deliverUserForm.patchValue({packageId: packageId, packageName: packageName}); |
|
|
|
|
this.deliverUserModal = true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -269,9 +269,9 @@ export class DiscountPackageListComponent implements OnInit { |
|
|
|
|
// 提交赠送数据
|
|
|
|
|
submitDeliverUser() { |
|
|
|
|
if (this.deliverUserArray.length == 0) { |
|
|
|
|
this.modal.warning({ nzTitle: '提示', nzContent: '没有需要赠送的用户'}); |
|
|
|
|
this.modal.warning({nzTitle: '提示', nzContent: '没有需要赠送的用户'}); |
|
|
|
|
} |
|
|
|
|
this.deliverUserForm.patchValue({ phoneArray: this.deliverUserArray.filter(o => o.errorStatus == false)}); |
|
|
|
|
this.deliverUserForm.patchValue({phoneArray: this.deliverUserArray.filter(o => o.errorStatus == false)}); |
|
|
|
|
this.spinObject.status = true; |
|
|
|
|
this.spinObject.title = '处理中...'; |
|
|
|
|
const param = this.deliverUserForm.value; |
|
|
|
@ -307,7 +307,7 @@ export class DiscountPackageListComponent implements OnInit { |
|
|
|
|
submitExcelUser() { |
|
|
|
|
this.spinObject.title = '文件导入中... 数据太多会占用较长时间'; |
|
|
|
|
this.spinObject.status = true; |
|
|
|
|
this.discountPackage.getPhoneListByFileUrl({ fileUrl: this.excelUploadFile[0]['url']}, data => { |
|
|
|
|
this.discountPackage.getPhoneListByFileUrl({fileUrl: this.excelUploadFile[0]['url']}, data => { |
|
|
|
|
if (data['return_code'] === '000000') { |
|
|
|
|
this.deliverUserArray = data['return_data']['data']; |
|
|
|
|
this.closeExcelUserModal(); |
|
|
|
|