售价 |
@@ -316,7 +319,7 @@
{{data.jumpUrl}} |
{{data.appid}} |
-
+ |
修改
删除
diff --git a/src/app/pages/goods/goods-list/goods-list.component.ts b/src/app/pages/goods/goods-list/goods-list.component.ts
index 9aee5ce..2b6e325 100644
--- a/src/app/pages/goods/goods-list/goods-list.component.ts
+++ b/src/app/pages/goods/goods-list/goods-list.component.ts
@@ -234,25 +234,16 @@ export class GoodsListComponent {
handleEdit(): void {
if (this.editForm.valid) {
- if (this.listImg.length !== 0) {
- this.editForm.value.listImg = this.commonService.imgList(this.listImg);
- } else {
- this.msg.error("请上传列表图片");
- return;
- }
- if (this.bannerImg.length !== 0) {
- this.editForm.value.bannerImg = this.commonService.imgList(this.bannerImg);
- } else {
- this.msg.error("请上传轮播图片");
- return;
- }
- if (this.detailImg.length !== 0) {
- this.editForm.value.detailImg = this.commonService.imgList(this.detailImg);
- } else {
- this.msg.error("请上传详情图片");
+
+ if (this.listImg.length === 0 || this.bannerImg.length === 0 || this.detailImg.length === 0) {
+ this.msg.error('相关图片未上传!');
return;
}
+ this.editForm.value.listImg = this.commonService.postImg(this.listImg);
+ this.editForm.value.bannerImg = this.commonService.postImg(this.bannerImg);
+ this.editForm.value.detailImg = this.commonService.postImg(this.detailImg);
+
this.goodsService.editGoodsMsg(this.editForm.value , (data: any) => {
if (data['return_code'] === '000000') {
this.msg.success("成功!");
@@ -460,6 +451,22 @@ export class GoodsListComponent {
this.editSpecsForm.controls['appid'].updateValueAndValidity();
}
+ // 上下线
+ goodsAudit(id: number): void {
+ let params = {
+ id: id,
+ time: new Date().getTime()
+ }
+ this.goodsService.goodsAudit(params , (data: any) => {
+ if (data['return_code'] === '000000') {
+ this.msg.success("成功!");
+ this.getRequest();
+ } else {
+ this.msg.error(data['return_msg']);
+ }
+ });
+ }
+
}
diff --git a/src/app/pages/marketing/coupon-discount-list/coupon-discount-list.component.html b/src/app/pages/marketing/coupon-discount-list/coupon-discount-list.component.html
new file mode 100644
index 0000000..cf4390f
--- /dev/null
+++ b/src/app/pages/marketing/coupon-discount-list/coupon-discount-list.component.html
@@ -0,0 +1,166 @@
+
+
+
+
+
+ 编码 |
+ 名称 |
+ 库存(个) |
+ 有效期 |
+ 创建时间 |
+ 更新时间 |
+ 操作 |
+
+
+
+
+ {{data.key}} |
+ {{data.title}} |
+ {{data.surplusStock}} |
+ {{ data.effectiveTime | date: 'yyyy-MM-dd HH:mm'}} |
+ {{ data.createdTime | date: 'yyyy-MM-dd HH:mm'}} |
+ {{ data.updatedTime | date: 'yyyy-MM-dd HH:mm'}} |
+
+ 修改
+
+
+ 更多
+
+
+
+
+
+ |
+
+
+ 总计 {{ total }} 条
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 优惠券名称 |
+ 数量 |
+ 创建时间 |
+ 操作 |
+
+
+
+
+ {{data.discountName}} |
+ {{data.num}} |
+ {{data.createdTime}} |
+
+ 删除
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/app/pages/marketing/coupon-discount-list/coupon-discount-list.component.less b/src/app/pages/marketing/coupon-discount-list/coupon-discount-list.component.less
new file mode 100644
index 0000000..6d5c351
--- /dev/null
+++ b/src/app/pages/marketing/coupon-discount-list/coupon-discount-list.component.less
@@ -0,0 +1,12 @@
+[nz-form-label] {
+ overflow: visible;
+}
+button {
+ margin-left: 8px;
+}
+.submit-btn {
+ width: 150px;
+}
+.search-area {
+ margin-top: 30px;
+}
diff --git a/src/app/pages/marketing/coupon-discount-list/coupon-discount-list.component.ts b/src/app/pages/marketing/coupon-discount-list/coupon-discount-list.component.ts
new file mode 100644
index 0000000..ae8ab35
--- /dev/null
+++ b/src/app/pages/marketing/coupon-discount-list/coupon-discount-list.component.ts
@@ -0,0 +1,308 @@
+import { Component } from '@angular/core';
+import {DatePipe, NgForOf, NgIf, NgOptimizedImage, NgStyle} from "@angular/common";
+import {FormGroup,NonNullableFormBuilder, ReactiveFormsModule, Validators} from "@angular/forms";
+import {NzButtonComponent} from "ng-zorro-antd/button";
+import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid";
+import {NzDividerComponent} from "ng-zorro-antd/divider";
+import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
+import {NzIconDirective} from "ng-zorro-antd/icon";
+import {NzImageModule} from "ng-zorro-antd/image";
+import {NzInputDirective} from "ng-zorro-antd/input";
+import {NzModalComponent, NzModalContentDirective, NzModalModule} from "ng-zorro-antd/modal";
+import {NzPopconfirmDirective} from "ng-zorro-antd/popconfirm";
+import {
+ NzTableCellDirective,
+ NzTableComponent,
+ NzTbodyComponent,
+ NzTheadComponent,
+ NzThMeasureDirective, NzTrDirective
+} from "ng-zorro-antd/table";
+import {NzUploadComponent, NzUploadFile} from "ng-zorro-antd/upload";
+import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select";
+import {NzTreeSelectComponent} from "ng-zorro-antd/tree-select";
+import {environment} from "../../../../environments/environment";
+import {NzMessageService} from "ng-zorro-antd/message";
+import {CommonService} from "../../../services/common/common.service";
+import {GoodsService} from "../../../services/goods/goods.service";
+import {GoodsTypeData} from "../../../model/goods.interface";
+import {DiscountService} from "../../../services/marketing/discount.service";
+import {NzDatePickerComponent} from "ng-zorro-antd/date-picker";
+import {NzInputNumberComponent} from "ng-zorro-antd/input-number";
+import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown";
+import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu";
+import {MyValidators} from "../../../services/common/validators.service";
+
+@Component({
+ selector: 'app-coupon-discount-list',
+ standalone: true,
+ imports: [
+ NgForOf,
+ NzButtonComponent,
+ NzColDirective,
+ NzFormControlComponent,
+ NzFormDirective,
+ NzFormItemComponent,
+ NzFormLabelComponent,
+ NzInputDirective,
+ NzOptionComponent,
+ NzRowDirective,
+ NzModalModule,
+ NzSelectComponent,
+ ReactiveFormsModule,
+ NzIconDirective,
+ NzModalComponent,
+ NzTreeSelectComponent,
+ NzUploadComponent,
+ NzModalContentDirective,
+ NgStyle,
+ DatePipe,
+ NzDividerComponent,
+ NzTableCellDirective,
+ NzTableComponent,
+ NzTbodyComponent,
+ NzThMeasureDirective,
+ NzTheadComponent,
+ NzTrDirective,
+ NzPopconfirmDirective,
+ NzImageModule,
+ NgOptimizedImage,
+ NzDatePickerComponent,
+ NzInputNumberComponent,
+ NgIf,
+ NzDropDownADirective,
+ NzDropDownDirective,
+ NzDropdownMenuComponent,
+ NzMenuDirective,
+ NzMenuItemComponent
+ ],
+ templateUrl: './coupon-discount-list.component.html',
+ styleUrl: './coupon-discount-list.component.less'
+})
+export class CouponDiscountListComponent {
+ // 表单页数
+ tablePageNum = 1;
+ // 表单数据
+ tableData: any = {
+ total: 0,
+ loading: false,
+ list: [],
+ };
+ // 搜索表单
+ searchForm: FormGroup;
+
+ // 图片
+ imgUrl: NzUploadFile[] = []
+ baseUrl = environment.baseUrl;
+ imageUrl = environment.imageUrl;
+
+ isVisibleDetail = false;
+ isVisibleGive = false;
+
+ // 编辑产品类型表单
+ editForm: FormGroup;
+ detailForm: FormGroup;
+ giveForm: FormGroup;
+ // 编辑弹出框
+ isVisibleEdit = false;
+ isVisibleDetailEdit = false;
+ discountPackageId: number = 0;
+ discountPackage: any;
+ discountData: any;
+
+ constructor(private fb: NonNullableFormBuilder,
+ private msg: NzMessageService,
+ private commonService: CommonService,
+ private discountService: DiscountService) {
+ // 初始化搜索框
+ this.searchForm = this.fb.group({
+ title: [''],
+ });
+
+ let params = {
+ status: 1,
+ pageNum: 1,
+ pageSize: 100000,
+ time: new Date().getTime()
+ }
+
+ this.discountService.getListDiscount(params , (data: any)=>{
+ if (data['return_code'] == '000000') {
+ this.discountData = data['return_data'].list;
+ }
+ });
+ const { required, maxLength, minLength, email, mobile } = MyValidators;
+ // 初始化
+ this.editForm = this.fb.group({
+ title: ['' , [Validators.required]],
+ surplusStock: ['' , [Validators.required]],
+ effectiveTime: ['' , [Validators.required]],
+ id: [null],
+ });
+ this.detailForm = this.fb.group({
+ discountId: ['' , [Validators.required]],
+ num: ['' , [Validators.required]],
+ discountPackageId: [''],
+ id: [null],
+ });
+ this.giveForm = this.fb.group({
+ phone: ['' , [required, mobile]],
+ discountPackageId: [''],
+ });
+ this.getRequest();
+
+ }
+
+ // 查询列表
+ public getRequest(reset: boolean = false) {
+ this.tableData.loading = true;
+ if (reset) {
+ this.tablePageNum = 1;
+ }
+ this.searchForm.value.pageNum = this.tablePageNum;
+ this.searchForm.value.pageSize = 10;
+ this.searchForm.value.time = new Date().getTime();
+
+ this.discountService.getDiscountPackageList(this.searchForm.value , (data: any) => {
+ if (data['return_code'] == '000000') {
+ this.tableData = data['return_data'];
+ } else {
+ this.msg.error(data['return_msg']);
+ }
+ this.tableData.loading = false;
+ });
+ }
+
+
+ // 唤醒编辑表单
+ showEdit(item?: GoodsTypeData) {
+ if (item != null) {
+ this.editForm.patchValue(item);
+ } else {
+ this.editForm.reset();
+ }
+ this.isVisibleEdit = true;
+ }
+ // 编辑表单提交
+ handleEdit(): void {
+
+ if (this.editForm.valid) {
+
+ this.discountService.editCouponPackageInfo(this.editForm.value , (data: any) => {
+ if (data['return_code'] === '000000') {
+ this.msg.success("成功!");
+ this.isVisibleEdit = false;
+ this.getRequest();
+ } else {
+ this.msg.error(data['return_msg']);
+ }
+ });
+ } else {
+ Object.values(this.editForm.controls).forEach(control => {
+ if (control.invalid) {
+ control.markAsDirty();
+ control.updateValueAndValidity({ onlySelf: true });
+ }
+ });
+ }
+
+ }
+
+ // 删除
+ delete(id: number): void {
+ this.discountService.deleteCouponDiscount(id , (data: any) => {
+ if (data['return_code'] === '000000') {
+ this.msg.success("成功!");
+ this.getRequest();
+ } else {
+ this.msg.error(data['return_msg']);
+ }
+ });
+ }
+
+ // 删除券包详情
+ deleteDetail(id: number): void {
+ this.discountService.deleteDetail(id , (data: any) => {
+ if (data['return_code'] === '000000') {
+ this.msg.success("成功!");
+ this.getDetailList(this.discountPackageId);
+ } else {
+ this.msg.error(data['return_msg']);
+ }
+ });
+ }
+
+ // 查询券包详情
+ getDetailList(id: number): void {
+ this.discountPackageId = id;
+ this.isVisibleDetail = true;
+ let params = {
+ discountPackageId: id,
+ time: new Date().getTime()
+ }
+ this.discountService.getDetailList(params, (data: any) => {
+ if (data['return_code'] === '000000') {
+ this.discountPackage = data['return_data'];
+ } else {
+ this.msg.error(data['return_msg']);
+ }
+ });
+ }
+
+ giveDiscountPackageShow(id: number): void {
+ this.discountPackageId = id;
+ this.isVisibleGive = true;
+ }
+
+ giveDiscountPackage(): void {
+ this.giveForm.value.discountPackageId = this.discountPackageId;
+ if (this.giveForm.valid) {
+
+ this.discountService.giveDiscountPackage(this.giveForm.value , (data: any) => {
+ if (data['return_code'] === '000000') {
+ this.msg.success("成功!");
+ this.getRequest(false);
+ this.isVisibleGive = false;
+ } else {
+ this.msg.error(data['return_msg']);
+ }
+ });
+ } else {
+ Object.values(this.giveForm.controls).forEach(control => {
+ if (control.invalid) {
+ control.markAsDirty();
+ control.updateValueAndValidity({ onlySelf: true });
+ }
+ });
+ }
+ }
+
+ // 创建详情
+ showEditDetail(): void {
+ this.detailForm.reset();
+ this.isVisibleDetailEdit = true;
+ }
+
+ handleDetailEdit(): void {
+ this.detailForm.value.discountPackageId = this.discountPackageId;
+ if (this.detailForm.valid) {
+
+ this.discountService.insertCouponPackageDetail(this.detailForm.value , (data: any) => {
+ if (data['return_code'] === '000000') {
+ this.msg.success("成功!");
+ this.isVisibleDetailEdit = false;
+ this.getDetailList(this.discountPackageId);
+ } else {
+ this.msg.error(data['return_msg']);
+ }
+ });
+ } else {
+ Object.values(this.detailForm.controls).forEach(control => {
+ if (control.invalid) {
+ control.markAsDirty();
+ control.updateValueAndValidity({ onlySelf: true });
+ }
+ });
+ }
+ }
+
+}
diff --git a/src/app/pages/marketing/discount-list/discount-list.component.ts b/src/app/pages/marketing/discount-list/discount-list.component.ts
index be87945..1944114 100644
--- a/src/app/pages/marketing/discount-list/discount-list.component.ts
+++ b/src/app/pages/marketing/discount-list/discount-list.component.ts
@@ -315,6 +315,7 @@ export class DiscountListComponent {
});
}
+
handleOk(): void {
let params = {
discountId: this.discount?.id,
diff --git a/src/app/pages/marketing/marketing.routes.ts b/src/app/pages/marketing/marketing.routes.ts
index df3defb..9256445 100644
--- a/src/app/pages/marketing/marketing.routes.ts
+++ b/src/app/pages/marketing/marketing.routes.ts
@@ -1,9 +1,11 @@
import { Routes } from '@angular/router';
import {DiscountListComponent} from "./discount-list/discount-list.component";
+import {CouponDiscountListComponent} from "./coupon-discount-list/coupon-discount-list.component";
export const MARKETING_ROUTES: Routes = [
{ path: 'discount-list', component: DiscountListComponent},
+ { path: 'coupon-discount-list', component: CouponDiscountListComponent},
];
diff --git a/src/app/pipes/audit/audit-status.pipe.ts b/src/app/pipes/audit/audit-status.pipe.ts
new file mode 100644
index 0000000..d260261
--- /dev/null
+++ b/src/app/pipes/audit/audit-status.pipe.ts
@@ -0,0 +1,22 @@
+import { Pipe, PipeTransform } from '@angular/core';
+
+@Pipe({
+ name: 'auditStatus',
+ standalone: true
+})
+export class AuditStatusPipe implements PipeTransform {
+
+ transform(value: number): any {
+ switch (value) {
+ case 0:
+ return '驳回';
+ case 1:
+ return '通过';
+ case 2:
+ return '待审批';
+ default:
+ return '未知状态'
+ }
+ }
+
+}
diff --git a/src/app/services/audit/audit.service.ts b/src/app/services/audit/audit.service.ts
new file mode 100644
index 0000000..d48ffc7
--- /dev/null
+++ b/src/app/services/audit/audit.service.ts
@@ -0,0 +1,45 @@
+import { Injectable } from '@angular/core';
+import {environment} from "../../../environments/environment";
+import {ObjectData} from "../../utils/objectData.service";
+import {HttpClient} from "@angular/common/http";
+
+@Injectable({
+ providedIn: 'root'
+})
+export class AuditService {
+
+ constructor(private http: HttpClient) { }
+
+ /**
+ * 获取商品规格列表
+ * @param params
+ * @param callBack
+ */
+ public auditMsg(params: object, callBack:any) {
+ this.http.post(environment.baseUrl + 'audit/auditMsg', params).subscribe(data => {
+ callBack(data);
+ });
+ }
+
+ /**
+ * 查询商品审核列表
+ * @param params
+ * @param callBack
+ */
+ public getListGoodsAudit(params: object, callBack:any) {
+ this.http.get(environment.baseUrl + 'audit/getListGoodsAudit?' + ObjectData.objectByString(params)).subscribe(data => {
+ callBack(data);
+ });
+ }
+
+ /**
+ * 查询商品审核详情
+ * @param params
+ * @param callBack
+ */
+ public auditDetail(params: object, callBack:any) {
+ this.http.get(environment.baseUrl + 'audit/auditDetail?' + ObjectData.objectByString(params)).subscribe(data => {
+ callBack(data);
+ });
+ }
+}
diff --git a/src/app/services/common/validators.service.ts b/src/app/services/common/validators.service.ts
new file mode 100644
index 0000000..77d6c64
--- /dev/null
+++ b/src/app/services/common/validators.service.ts
@@ -0,0 +1,47 @@
+// current locale is key of the MyErrorsOptions
+import {AbstractControl, ValidatorFn, Validators} from "@angular/forms";
+import {NzSafeAny} from "ng-zorro-antd/core/types";
+
+export type MyErrorsOptions = { 'zh-cn': string; en: string } & Record;
+export type MyValidationErrors = Record;
+
+export class MyValidators extends Validators {
+
+ static override minLength(minLength: number): ValidatorFn {
+ return (control: AbstractControl): MyValidationErrors | null => {
+ if (Validators.minLength(minLength)(control) === null) {
+ return null;
+ }
+ return { minlength: { 'zh-cn': `最小长度为 ${minLength}`, en: `MinLength is ${minLength}` } };
+ };
+ }
+
+ static override maxLength(maxLength: number): ValidatorFn {
+ return (control: AbstractControl): MyValidationErrors | null => {
+ if (Validators.maxLength(maxLength)(control) === null) {
+ return null;
+ }
+ return { maxlength: { 'zh-cn': `最大长度为 ${maxLength}`, en: `MaxLength is ${maxLength}` } };
+ };
+ }
+
+ static mobile(control: AbstractControl): MyValidationErrors | null {
+ const value = control.value;
+
+ if (isEmptyInputValue(value)) {
+ return null;
+ }
+
+ return isMobile(value)
+ ? null
+ : { mobile: { 'zh-cn': `手机号码格式不正确`, en: `Mobile phone number is not valid` } };
+ }
+}
+
+function isEmptyInputValue(value: NzSafeAny): boolean {
+ return value == null || value.length === 0;
+}
+
+function isMobile(value: string): boolean {
+ return typeof value === 'string' && /(^1\d{10}$)/.test(value);
+}
diff --git a/src/app/services/goods/goods.service.ts b/src/app/services/goods/goods.service.ts
index 49a3e1a..bca9740 100644
--- a/src/app/services/goods/goods.service.ts
+++ b/src/app/services/goods/goods.service.ts
@@ -159,5 +159,16 @@ export class GoodsService {
});
}
+ /**
+ * 商品审批
+ * @param params
+ * @param callBack
+ */
+ public goodsAudit(params: object, callBack:any) {
+ this.http.get(environment.baseUrl + 'goods/goodsAudit?' + ObjectData.objectByString(params)).subscribe(data => {
+ callBack(data);
+ });
+ }
+
}
diff --git a/src/app/services/marketing/discount.service.ts b/src/app/services/marketing/discount.service.ts
index d36f1c2..a1e1ea3 100644
--- a/src/app/services/marketing/discount.service.ts
+++ b/src/app/services/marketing/discount.service.ts
@@ -66,4 +66,76 @@ export class DiscountService {
});
}
+ /**
+ * 查询列表
+ * @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);
+ });
+ }
+
}
|