import { Injectable } from '@angular/core'; import {HttpClient} from "@angular/common/http"; import {environment} from "../../../environments/environment"; import {ObjectData} from "../../utils/objectData.service"; @Injectable({ providedIn: 'root' }) export class DiscountService { constructor(private http: HttpClient) { } /** * 查询列表 * @param params * @param callBack */ public getListDiscount(params: object, callBack:any) { this.http.get(environment.baseUrl + 'discount/getListDiscount?' + ObjectData.objectByString(params)).subscribe(data => { callBack(data); }); } /** * 编辑优惠券 * @param params * @param callBack */ public editDiscount(params: object, callBack:any) { this.http.post(environment.baseUrl + 'discount/editDiscount', params).subscribe(data => { callBack(data); }); } /** * 删除优惠券 * @param id * @param callBack */ public deleteDiscount(id: number, callBack:any) { this.http.get(environment.baseUrl + 'discount/delete?id=' + id ).subscribe(data => { callBack(data); }); } /** * 查询列表 * @param params * @param callBack */ public getListDiscountGoodsRel(params: object, callBack:any) { this.http.get(environment.baseUrl + 'discount/getListDiscountGoodsRel?' + ObjectData.objectByString(params)).subscribe(data => { callBack(data); }); } /** * 绑定优惠券规格 * @param params * @param callBack */ public bindDiscountSpecs(params: object, callBack:any) { this.http.post(environment.baseUrl + 'discount/bindDiscountSpecs', params).subscribe(data => { callBack(data); }); } /** * 查询列表 * @param params * @param callBack */ public getDiscountPackageList(params: object, callBack:any) { this.http.get(environment.baseUrl + 'discountPackage/getDiscountPackageList?' + ObjectData.objectByString(params)).subscribe(data => { callBack(data); }); } /** * 新增优惠券包基本信息 * @param params * @param callBack */ public editCouponPackageInfo(params: object, callBack:any) { this.http.post(environment.baseUrl + 'discountPackage/editCouponPackageInfo', params).subscribe(data => { callBack(data); }); } /** * 删除 * @param id * @param callBack */ public deleteCouponDiscount(id: number, callBack:any) { this.http.get(environment.baseUrl + 'discountPackage/delete?id=' + id ).subscribe(data => { callBack(data); }); } /** * 查询列表 * @param params * @param callBack */ public getDetailList(params: object, callBack:any) { this.http.get(environment.baseUrl + 'discountPackage/getDetailList?' + ObjectData.objectByString(params)).subscribe(data => { callBack(data); }); } /** * 删除 * @param id * @param callBack */ public deleteDetail(id: number, callBack:any) { this.http.get(environment.baseUrl + 'discountPackage/deleteDetail?detailId=' + id ).subscribe(data => { callBack(data); }); } /** * 新增优惠券包详情 * @param params * @param callBack */ public insertCouponPackageDetail(params: object, callBack:any) { this.http.post(environment.baseUrl + 'discountPackage/insertCouponPackageDetail', params).subscribe(data => { callBack(data); }); } public giveDiscountPackage(params: object, callBack:any) { this.http.post(environment.baseUrl + 'discountPackage/giveDiscountPackage', params).subscribe(data => { callBack(data); }); } }