You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
116 lines
2.7 KiB
116 lines
2.7 KiB
import { Injectable } from '@angular/core';
|
|
import {HttpClient} from '@angular/common/http';
|
|
import {CommonsService} from './commons.service';
|
|
import {environment} from '../../environments/environment';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class CouponService {
|
|
constructor(
|
|
private http: HttpClient,
|
|
private common: CommonsService
|
|
) { }
|
|
|
|
/**
|
|
* 查询卡券列表
|
|
*
|
|
* @param paramsObject 对象
|
|
* @param callBack 回调
|
|
*/
|
|
public getCouponList(paramsObject: object, callBack) {
|
|
this.http.get(environment.baseUrl + 'coupon/getCouponList?' + this.common.getWhereCondition(paramsObject)).subscribe(data => {
|
|
callBack(data);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 查询卡券消费码列表
|
|
*
|
|
* @param paramsObject 对象
|
|
* @param callBack 回调
|
|
*/
|
|
public getCouponCodeList(paramsObject: object, callBack) {
|
|
this.http.get(environment.baseUrl + 'couponCode/getCouponCodeList?' + this.common.getWhereCondition(paramsObject)).subscribe(data => {
|
|
callBack(data);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 新增卡券
|
|
*
|
|
* @param params 上传对象
|
|
* @param callBack 回调
|
|
* @return data 返回结果
|
|
*/
|
|
public insertCoupon(params: object, callBack) {
|
|
this.http.post(environment.baseUrl + 'coupon/insertCoupon', params).subscribe(data => {
|
|
callBack(data);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 修改卡券
|
|
*
|
|
* @param params 上传对象
|
|
* @param callBack 回调
|
|
* @return data 返回结果
|
|
*/
|
|
public updateCoupon(params: object, callBack) {
|
|
this.http.post(environment.baseUrl + 'coupon/updateCoupon', params).subscribe(data => {
|
|
callBack(data);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 根据id查询详情
|
|
*
|
|
* @param couponId 卡券id
|
|
* @param callBack 回调
|
|
*/
|
|
public getCouponById(couponId: number, callBack) {
|
|
this.http.get(environment.baseUrl + 'coupon/getCouponById?id=' + couponId).subscribe(data => {
|
|
callBack(data);
|
|
});
|
|
}
|
|
|
|
|
|
/**
|
|
* 下架卡券
|
|
*
|
|
* @param id 用户id
|
|
* @param callBack 返回参数
|
|
*/
|
|
public ofShelfApprove(id: number, callBack) {
|
|
this.http.get(environment.baseUrl + 'coupon/ofShelfApprove?id=' + id).subscribe(data => {
|
|
callBack(data);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 上架卡券
|
|
*
|
|
* @param id 用户id
|
|
* @param callBack 返回参数
|
|
*/
|
|
public upShelfApprove(id: number, callBack) {
|
|
this.http.get(environment.baseUrl + 'coupon/upShelfApprove?id=' + id).subscribe(data => {
|
|
callBack(data);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 生成消费码
|
|
*
|
|
* @param params 上传对象
|
|
* @param callBack 回调
|
|
* @return data 返回结果
|
|
*/
|
|
public writeStock(params: object, callBack) {
|
|
this.http.post(environment.baseUrl + 'coupon/writeStock', params).subscribe(data => {
|
|
callBack(data);
|
|
});
|
|
}
|
|
|
|
|
|
}
|
|
|