diff --git a/src/app/pages/trade/comp-order/comp-order.component.html b/src/app/pages/trade/comp-order/comp-order.component.html index 7b63dfe..ff4d955 100644 --- a/src/app/pages/trade/comp-order/comp-order.component.html +++ b/src/app/pages/trade/comp-order/comp-order.component.html @@ -1 +1,240 @@ -

comp-order works!

+
+
+
+ + 用户手机号 + + + + +
+
+ + 交易单号 + + + + +
+
+ + 支付方式 + + + + + + +
+
+ + 交易状态 + + + + + + +
+
+ + 创建时间 + + + + + + + +
+
+ + 商品名称 + + + + +
+
+ + 卡密订单 + + + + +
+
+ + 卡密 + + + + +
+
+ + 卡密状态 + + + + + + +
+ +
+ + + + 更多查询条件 + + +
+
+
+ + + + + 交易单号 + 子交易单号 + 用户手机号 + 商品key + 商品名称 + 商品规格 + 商品价格 + 购买数量 + 交易信息 + 卡密订单 + 卡密 + 过期时间 + 卡密状态 + 操作 + + + 订单金额 + 优惠券优惠 + 积分抵扣 + 实付金额 + 支付渠道 + 支付方式 + 交易状态 + 创建时间 + 支付时间 + + + + + {{data.orderNo}} + {{data.childOrderNo}} + {{data.userPhone}} + {{data.goodsKey}} + {{data.goodsName}} + {{data.goodsSpecsName}} + {{data.goodsPrice}} + {{data.goodsCount}} + {{data.totalPrice}} + {{data.couponDiscountPrice}} + {{data.integralDiscountPrice}} + {{data.payRealPrice}} + {{data.payChannel | dictionary: 'ORDER_PAY_CHANNEL'}} + {{data.payType | dictionary: 'ORDER_PAY_TYPE'}} + {{data.tradeStatus | dictionary: 'ORDER_CHILD_STATUS'}} + {{data.createTime | date: 'yyyy-MM-dd HH:mm:ss'}} + {{data.payTime | date: 'yyyy-MM-dd HH:mm:ss'}} + {{data.channelOrderNo}} + {{data.couNo}} + {{data.expireTime | date: 'yyyy-MM-dd HH:mm'}} + {{data.couStatus | dictionary: 'ORDER_COUPON_NO_STATUS'}} + + 详情 + + + 更多 + + + + + + + + + 总计 {{ total }} 条 + + + + + + + + + Zhou Maomao + 18100000000 + + + + + + + Empty + Empty + Empty + Empty + Empty + + + + + + + 商品key + 商品名称 + 商品规格 + 商品面值 + 卡密订单号 + 卡密 + 状态 + 过期时间 + 派发时间 + 过期时间 + 完成时间 + + + + + {{ data.goodsKey }} + {{ data.goodsName }} + {{ data.goodsSpecsName }} + {{ data.goodsPrice }} + {{ data.channelOrderNo }} + {{ data.couNo }} + {{ data.couStatus | dictionary: 'ORDER_COUPON_NO_STATUS'}} + {{ data.expireTime | date: 'yyyy-MM-dd HH:mm'}} + {{ data.createTime | date: 'yyyy-MM-dd HH:mm:ss'}} + {{ data.deliverTime | date: 'yyyy-MM-dd HH:mm:ss' }} + {{ data.finishTime | date: 'yyyy-MM-dd HH:mm:ss' }} + + + + + + + + diff --git a/src/app/pages/trade/comp-order/comp-order.component.less b/src/app/pages/trade/comp-order/comp-order.component.less index e69de29..4056a86 100644 --- a/src/app/pages/trade/comp-order/comp-order.component.less +++ b/src/app/pages/trade/comp-order/comp-order.component.less @@ -0,0 +1,6 @@ +.search-area { + margin-bottom: 10px; +} +.search-area button { + margin-right: 8px; +} diff --git a/src/app/pages/trade/comp-order/comp-order.component.ts b/src/app/pages/trade/comp-order/comp-order.component.ts index 77dbfe8..a912478 100644 --- a/src/app/pages/trade/comp-order/comp-order.component.ts +++ b/src/app/pages/trade/comp-order/comp-order.component.ts @@ -1,12 +1,202 @@ import { Component } from '@angular/core'; +import {DatePipe, NgForOf, NgIf, NgSwitch} from "@angular/common"; +import {DictionaryPipe} from "../../../pipes/common/dictionary.pipe"; +import {FormGroup, FormsModule, NonNullableFormBuilder, ReactiveFormsModule} from "@angular/forms"; +import {NzButtonComponent} from "ng-zorro-antd/button"; +import { + NzCellEllipsisDirective, + NzCellFixedDirective, + NzTableCellDirective, + NzTableComponent, + NzTbodyComponent, NzTheadComponent, + NzThMeasureDirective, NzTrDirective +} from "ng-zorro-antd/table"; +import {NzColDirective, NzRowDirective} from "ng-zorro-antd/grid"; +import {NzDividerComponent} from "ng-zorro-antd/divider"; +import {NzDropDownADirective, NzDropDownDirective, NzDropdownMenuComponent} from "ng-zorro-antd/dropdown"; +import {NzFlexDirective} from "ng-zorro-antd/flex"; +import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form"; +import {NzIconDirective} from "ng-zorro-antd/icon"; +import {NzInputDirective} from "ng-zorro-antd/input"; +import {NzMenuDirective, NzMenuItemComponent} from "ng-zorro-antd/menu"; +import {NzModalComponent, NzModalModule, NzModalService} from "ng-zorro-antd/modal"; +import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select"; +import {SysAccountService} from "../../../services/account/sys-account.service"; +import {RoleService} from "../../../services/role/role.service"; +import {NzMessageService} from "ng-zorro-antd/message"; +import {OrderService} from "../../../services/trade/order.service"; +import {NzDatePickerComponent, NzDatePickerModule, NzRangePickerComponent} from "ng-zorro-antd/date-picker"; +import {NzRadioButtonDirective, NzRadioComponent, NzRadioGroupComponent} from "ng-zorro-antd/radio"; +import {NzTooltipDirective} from "ng-zorro-antd/tooltip"; +import {DateSelectType, DateUtils} from "../../../utils/dateUtils.service"; +import {NzTreeComponent} from "ng-zorro-antd/tree"; +import {NzDescriptionsModule} from "ng-zorro-antd/descriptions"; +import {NzTabComponent, NzTabSetComponent, NzTabsModule} from "ng-zorro-antd/tabs"; @Component({ selector: 'app-comp-order', standalone: true, - imports: [], + imports: [ + DatePipe, + DictionaryPipe, + FormsModule, + NgForOf, + NgIf, + NzButtonComponent, + NzCellFixedDirective, + NzColDirective, + NzDividerComponent, + NzDropDownADirective, + NzDropDownDirective, + NzDropdownMenuComponent, + NzFlexDirective, + NzFormControlComponent, + NzFormDirective, + NzFormItemComponent, + NzFormLabelComponent, + NzIconDirective, + NzInputDirective, + NzMenuDirective, + NzMenuItemComponent, + NzModalComponent, + NzOptionComponent, + NzRowDirective, + NzSelectComponent, + NzTableCellDirective, + NzTableComponent, + NzTbodyComponent, + NzThMeasureDirective, + NzTheadComponent, + NzTrDirective, + ReactiveFormsModule, + NzModalModule, + NzRangePickerComponent, + NzDatePickerComponent, + NzDatePickerModule, + NzRadioButtonDirective, + NzRadioComponent, + NzRadioGroupComponent, + NgSwitch, + NzCellEllipsisDirective, + NzTooltipDirective, + NzTreeComponent, + NzDescriptionsModule, + NzTabSetComponent, + NzTabComponent, + NzTabsModule + ], templateUrl: './comp-order.component.html', styleUrl: './comp-order.component.less' }) export class CompOrderComponent { + // 表单页数 + tablePageNum = 1; + // 表单数据 + tableData: any = { + total: 0, + list: [], + }; + // 搜索表单 + searchForm: FormGroup; + // 更多查询条件 + isCollapse = false; + // 时间类型选择 + dateTypeSelect = DateSelectType; + // 订单支付类型 + orderPayTypeArray = new DictionaryPipe().getDictionaryList('ORDER_PAY_TYPE'); + // 订单状态 + orderStatusArray = new DictionaryPipe().getDictionaryList('ORDER_STATUS'); + // 卡密使用状态 + orderCouponNoStatus = new DictionaryPipe().getDictionaryList('ORDER_COUPON_NO_STATUS'); + // 订单详情模态框 + orderDetailVisible = false; + // 订单详情数据 + orderDetail: any = {}; + constructor(private fb: NonNullableFormBuilder, + private orderService : OrderService, + private message: NzMessageService, + private modal: NzModalService) { + // 初始化搜索框 + this.searchForm = this.fb.group({ + userPhone: [''], + orderNo: [''], + tradeStatus: [''], + payType: [''], + goodsName: [''], + channelOrderNo: [''], + couNo: [''], + couStatus: [''], + createTimeArray: [[]], + createTimeSelect: ['1'], + createTimeS: [''], + createTimeE: [''], + }); + this.createTimeInit(); + this.queryData(); + } + /** + * 获取数据 + */ + queryData() { + if (this.searchForm.controls['createTimeArray'].value != null + && this.searchForm.controls['createTimeArray'].value.length > 0) { + this.searchForm.controls['createTimeS'].setValue(this.searchForm.controls['createTimeArray'].value[0]); + this.searchForm.controls['createTimeE'].setValue(this.searchForm.controls['createTimeArray'].value[1]); + } else { + this.searchForm.controls['createTimeS'].setValue(null) + this.searchForm.controls['createTimeE'].setValue(null) + } + this.searchForm.value.pageNum = this.tablePageNum; + this.searchForm.value.pageSize = 10; + this.searchForm.value.objectType = 1; + this.searchForm.value.time = new Date().getTime(); + this.orderService.queryList(this.searchForm.value, (data: any) => { + if (data['return_code'] == '000000') { + this.tableData = data['return_data']; + } + }); + } + + /** + * 搜索表单提交 + */ + searchFormSubmit(): void { + this.tablePageNum = 1; + this.queryData(); + } + + /** + * 搜索表单重置 + */ + searchFormReset(): void { + this.searchForm.reset(); + } + + /** + * 创建时间初始化 + */ + createTimeInit() { + let createTimeSelect = this.searchForm.controls['createTimeSelect'].value; + if (createTimeSelect != null) { + let timeObj = DateUtils.getDate(new Date(), Number(createTimeSelect)); + this.searchForm.controls['createTimeArray'].setValue([timeObj.timeS, timeObj.timeE]); + } + } + + /** + * 展示详情 + * @param orderNo + */ + showDetail(childOrderNo: string) { + this.orderDetailVisible = true; + } + + /** + * 关闭详情 + */ + closeDetail() { + this.orderDetail = {}; + this.orderDetailVisible = false; + } } diff --git a/src/app/services/trade/order.service.ts b/src/app/services/trade/order.service.ts new file mode 100644 index 0000000..4a44771 --- /dev/null +++ b/src/app/services/trade/order.service.ts @@ -0,0 +1,34 @@ +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 OrderService { + + constructor(private http: HttpClient) { } + + /** + * 查询订单列表 + * @param param + * @param callBack + */ + public queryList(param: object, callBack:any) { + this.http.get(environment.orderUrl + 'coupon/queryList?'+ObjectData.objectByString(param)).subscribe(data => { + callBack(data); + }); + } + + /** + * 查询订单详情 + * @param param + * @param callBack + */ + public queryOrder(orderNo: string, callBack:any) { + this.http.get(environment.orderUrl + 'queryOrder?orderNo='+orderNo).subscribe(data => { + callBack(data); + }); + } +} diff --git a/src/app/utils/dateUtils.service.ts b/src/app/utils/dateUtils.service.ts new file mode 100644 index 0000000..7ef2e54 --- /dev/null +++ b/src/app/utils/dateUtils.service.ts @@ -0,0 +1,122 @@ +/** + * 选择类型 + */ +export const DateSelectType: any = [ + { value: 1, name: '今日'}, + { value: 2, name: '昨日'}, + { value: 3, name: '本周'}, + { value: 4, name: '上周'}, + { value: 5, name: '本月'}, + { value: 6, name: '上月'}, +]; + +/** + * 时间工具类 + */ +export class DateUtils { + + /** + * 获取时间 + * @param currentDate 当前时间 + * @param type 类型 1:今日 2:昨日 3:本周 4:上周 5:本月 6:上月 + */ + public static getDate(currentDate: Date, type: number): any { + const returnObj = { + timeS: 0, + timeE: 0, + } + + if (type === 1) { + currentDate.setHours(0); + currentDate.setMinutes(0); + currentDate.setSeconds(0); + returnObj.timeS = currentDate.getTime(); + currentDate.setHours(23); + currentDate.setMinutes(59); + currentDate.setSeconds(59); + returnObj.timeE = currentDate.getTime(); + + } else if (type === 2) { + currentDate.setDate(currentDate.getDate() - 1) + currentDate.setHours(0); + currentDate.setMinutes(0); + currentDate.setSeconds(0); + returnObj.timeS = currentDate.getTime(); + currentDate.setHours(23); + currentDate.setMinutes(59); + currentDate.setSeconds(59); + returnObj.timeE = currentDate.getTime(); + + } else if (type === 3) { + const dayOfWeek = currentDate.getDay(); + const dayOffset = dayOfWeek === 0 ? -6 : 1 - dayOfWeek; + + const start = new Date(currentDate); + start.setDate(start.getDate() + dayOffset) + start.setHours(0); + start.setMinutes(0); + start.setSeconds(0); + returnObj.timeS = start.getTime(); + + const end = new Date(currentDate); + end.setDate(end.getDate() + 6) + end.setHours(23); + end.setMinutes(59); + end.setSeconds(59); + returnObj.timeE = end.getTime(); + + } else if (type === 4) { + const startOfThisWeek = new Date(currentDate.getFullYear(),currentDate.getMonth(),currentDate.getDate() - currentDate.getDay() + 1); + const endOfLastWeek = new Date(startOfThisWeek.getTime() - 1); + const startOfLastWeek = new Date((endOfLastWeek.getTime() + 1) - (7 * 24 * 60 * 60 * 1000)); + + startOfLastWeek .setHours(0); + startOfLastWeek .setMinutes(0); + startOfLastWeek .setSeconds(0); + returnObj.timeS = startOfLastWeek .getTime(); + + endOfLastWeek.setHours(23); + endOfLastWeek.setMinutes(59); + endOfLastWeek.setSeconds(59); + returnObj.timeE = endOfLastWeek.getTime(); + + } else if (type === 5) { + var daysInMonth = new Date(currentDate.getFullYear(), currentDate.getMonth()+1, 0).getDate(); + + const start = new Date(currentDate); + start.setDate(1) + start.setHours(0); + start.setMinutes(0); + start.setSeconds(0); + returnObj.timeS = start.getTime(); + + const end = new Date(currentDate); + end.setDate(daysInMonth) + end.setHours(23); + end.setMinutes(59); + end.setSeconds(59); + returnObj.timeE = end.getTime(); + + } else if (type === 6) { + var daysInMonth = new Date(currentDate.getFullYear(), currentDate.getMonth(), 0).getDate(); + + const start = new Date(currentDate); + start.setMonth(currentDate.getMonth() - 1); + start.setDate(1) + start.setHours(0); + start.setMinutes(0); + start.setSeconds(0); + returnObj.timeS = start.getTime(); + + const end = new Date(currentDate); + end.setMonth(currentDate.getMonth() - 1); + end.setDate(daysInMonth) + end.setHours(23); + end.setMinutes(59); + end.setSeconds(59); + returnObj.timeE = end.getTime(); + } + + return returnObj; + } +} diff --git a/src/environments/environment.ts b/src/environments/environment.ts index de1db83..abca029 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -5,7 +5,8 @@ export const environment = { production: false, baseUrl: 'https://phgcs.dctpay.com/brest/', // 测试环境服务器地址(请求数据地址) - orderUrl: 'https://phgcs.dctpay.com/order/', // 测试环境服务器地址(请求数据地址) + // orderUrl: 'https://phgcs.dctpay.com/order/', // 测试环境服务器地址(请求数据地址) + orderUrl: 'http://localhost:9703/order/', // 测试环境服务器地址(请求数据地址) userUrl: 'https://phgcs.dctpay.com/user/', // 测试环境服务器地址(请求数据地址) imageUrl: 'https://phgcs.dctpay.com/filesystem/',