Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sale refund modual api and views #167 #180

Merged
merged 5 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,11 @@
package com.wansenai.api.receipt;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wansenai.dto.receipt.sale.QuerySaleOrderDTO;
import com.wansenai.dto.receipt.sale.QuerySaleShipmentsDTO;
import com.wansenai.dto.receipt.sale.SaleOrderDTO;
import com.wansenai.dto.receipt.sale.SaleShipmentsDTO;
import com.wansenai.dto.receipt.sale.*;
import com.wansenai.service.receipt.ReceiptRetailService;
import com.wansenai.service.receipt.ReceiptSaleService;
import com.wansenai.utils.response.Response;
import com.wansenai.vo.receipt.sale.SaleOrderDetailVO;
import com.wansenai.vo.receipt.sale.SaleOrderVO;
import com.wansenai.vo.receipt.sale.SaleShipmentsDetailVO;
import com.wansenai.vo.receipt.sale.SaleShipmentsVO;
import com.wansenai.vo.receipt.sale.*;
import org.springframework.web.bind.annotation.*;

import java.util.List;
Expand Down Expand Up @@ -87,4 +81,29 @@ public Response<String> updateShipmentsStatus(@PathVariable("ids") List<Long> id
public Response<String> deleteShipments(@PathVariable("ids") List<Long> ids) {
return receiptSaleService.deleteSaleShipments(ids);
}

@GetMapping("/refund/pageList")
public Response<Page<SaleRefundVO>> refundPageList(@ModelAttribute QuerySaleRefundDTO refundDTO) {
return receiptSaleService.getSaleRefundPage(refundDTO);
}

@PostMapping("/refund/addOrUpdate")
public Response<String> addOrUpdateRefund(@RequestBody SaleRefundDTO refundDTO) {
return receiptSaleService.addOrUpdateSaleRefund(refundDTO);
}

@GetMapping("/refund/detail/{id}")
public Response<SaleRefundDetailVO> refundDetail(@PathVariable("id") Long id) {
return receiptSaleService.getSaleRefundDetail(id);
}

@PutMapping("/refund/updateStatus/{ids}/{status}")
public Response<String> updateRefundStatus(@PathVariable("ids") List<Long> ids, @PathVariable("status") Integer status) {
return receiptSaleService.updateSaleRefundStatus(ids, status);
}

@PutMapping("/refund/delete/{ids}")
public Response<String> deleteRefund(@PathVariable("ids") List<Long> ids) {
return receiptSaleService.deleteSaleRefund(ids);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

@Data
Expand All @@ -37,7 +38,7 @@ public class SaleRefundDetailVO {
private String receiptNumber;

@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private String receiptDate;
private LocalDateTime receiptDate;

private String otherReceipt;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ public class SaleRefundVO {
private Integer productNumber;

@JsonSerialize(using = BigDecimalSerializerBO.class)
private BigDecimal totalPrice;
private BigDecimal totalAmount;

@JsonSerialize(using = BigDecimalSerializerBO.class)
private BigDecimal taxRateTotalPrice;
private BigDecimal taxIncludedAmount;

@JsonSerialize(using = BigDecimalSerializerBO.class)
private BigDecimal refundTotalPrice;
private BigDecimal refundTotalAmount;

@JsonSerialize(using = BigDecimalSerializerBO.class)
private BigDecimal thisRefundAmount;
Expand Down

Large diffs are not rendered by default.

70 changes: 70 additions & 0 deletions web/src/api/sale/model/refundModel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import {FileData} from '/@/api/retail/model/shipmentsModel';

export interface QuerySaleRefundReq {
receiptNumber: string;
productInfo: string;
customerId: number | string;
operatorId: number | string;
otherReceipt: string;
arrearsStatus: number;
status: number;
remark: string;
}

export interface SaleRefundTableData {
warehouseId: number | string;
productId: number | string;
barCode: number | string;
productName: string;
productUnit: string;
productStandard: string;
stock: number;
productNumber: number;
unitPrice: number;
amount: number;
taxRate: number;
taxAmount: number;
taxTotalPrice: number;
remark: string;
}

export interface AddOrUpdateReceiptSaleRefundReq {
id: number | string | undefined;
customerId: string;
receiptNumber: string;
receiptDate: string;
otherReceipt: string;
operatorIds: number[];
refundOfferRate: number;
refundOfferAmount: number;
refundLastAmount: number;
otherAmount: number;
thisRefundAmount: number;
thisArrearsAmount: number;
accountId: number | string;
multipleAccountIds: number[];
multipleAccountAmounts: number[];
status: number;
remark: string;
tableData: SaleRefundTableData[];
files: FileData[];
}

export interface SaleRefundDetailData {
customerId: number | string;
receiptDate: string;
receiptNumber: string;
operatorIds: number[];
refundOfferRate: number;
refundOfferAmount: number;
refundLastAmount: number;
otherAmount: number;
thisRefundAmount: number;
thisArrearsAmount: number;
accountIds: number;
multipleAccountAmounts: number[];
multipleAccountIds: number[];
remark: string;
tableData: SaleRefundTableData[];
files: FileData[];
}
57 changes: 57 additions & 0 deletions web/src/api/sale/refund.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import {defHttp} from '/@/utils/http/axios';
import {BaseDataResp, BaseResp} from "@/api/model/baseModel";
import {
QuerySaleRefundReq,
AddOrUpdateReceiptSaleRefundReq,
SaleRefundDetailData
} from "@/api/sale/model/refundModel"

enum API {
PageList = '/sale/refund/pageList',
AddOrUpdate = '/sale/refund/addOrUpdate',
GetDetail = '/sale/refund/detail',
UpdateStatus = '/sale/refund/updateStatus',
Delete = '/sale/refund/delete',
}

export function getSaleRefundPageList(params: QuerySaleRefundReq) {
return defHttp.get<BaseDataResp<SaleRefundDetailData>>(
{
url: API.PageList,
params,
}
);
}

export function addOrUpdateSaleRefund(params: AddOrUpdateReceiptSaleRefundReq) {
return defHttp.post<BaseResp>(
{
url: API.AddOrUpdate,
params,
}
);
}

export function getSaleRefundDetail(id: string) {
return defHttp.get<BaseDataResp<AddOrUpdateReceiptSaleRefundReq>>(
{
url: `${API.GetDetail}/${id}`,
}
);
}

export function updateSaleRefundStatus(ids: number[], status: number ) {
return defHttp.put<BaseResp>(
{
url: `${API.UpdateStatus}/${ids}/${status}`,
}
);
}

export function deleteSaleRefund(ids: number[]) {
return defHttp.put<BaseResp>(
{
url: `${API.Delete}/${ids}`,
}
);
}
43 changes: 43 additions & 0 deletions web/src/views/sales/model/addEditModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,27 @@ interface SaleShipmentsFormState {
multipleAccountAmounts: number[] | undefined;
}

interface SaleRefundFormState {
id: number | string | undefined;
customerId: string;
accountId: number | string | undefined;
receiptNumber: string;
receiptDate: string | undefined | Dayjs;
otherReceipt: string;
refundOfferRate: number;
refundOfferAmount: number;
refundLastAmount: number | string;
otherAmount: number;
thisRefundAmount: number;
thisArrearsAmount: number;
remark: string;
status: number | undefined;
operatorIds: number[] | undefined;
warehouseId: number | string;
multipleAccountIds: number[] | undefined;
multipleAccountAmounts: number[] | undefined;
}

const xGrid = ref<VxeGridInstance<RowVO>>()
const tableData = ref<RowVO[]>([])
const gridOptions = reactive<VxeGridProps<RowVO>>({
Expand Down Expand Up @@ -275,12 +296,34 @@ const saleShipmentsFormState = reactive<SaleShipmentsFormState>({
multipleAccountAmounts: undefined,
});

const saleRefundFormState = reactive<SaleRefundFormState>({
id: undefined,
customerId: '',
receiptNumber: '',
otherReceipt: '',
remark: '',
refundOfferRate: 0,
refundOfferAmount: 0,
refundLastAmount: 0,
otherAmount: 0,
thisRefundAmount: 0,
thisArrearsAmount: 0,
status: undefined,
accountId: undefined,
operatorIds: undefined,
receiptDate: '',
warehouseId: '',
multipleAccountIds: undefined,
multipleAccountAmounts: undefined,
});

export {
xGrid,
sumNum,
tableData,
gridOptions,
formState,
saleShipmentsFormState,
saleRefundFormState,
getTaxTotalPrice,
}
Loading