Commit a09f5a21 by chenwq

Merge branch 'v5.8.5' of http://192.168.3.233:8090/usedCarAuction/aus into v5.8.5

2 parents ff8f0844 ae5added
Showing 48 changed files with 1998 additions and 108 deletions
......@@ -2185,6 +2185,21 @@
]
},
{
"code": "platformContract",
"name": "平台合同管理",
"type": "MENU",
"enabled": true,
"value": "/business/platformContract",
"children": [
{
"code": "platformContract_1",
"name": "查看合同详情",
"type": "BUTTON",
"enabled": true
}
]
},
{
"code": "deposit_rule",
"name": "保证金规则设置",
"type": "MENU",
......
......@@ -15,9 +15,7 @@ import com.glsx.usedcar.web.AccountJwtProvider;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
import org.summerframework.orm.paging.Pagination;
import java.util.Objects;
......@@ -81,7 +79,10 @@ public class AccountController {
@GetMapping("getLoginAccount")
@JsonView(value = Account.Summary.class)
public Account getLoginAccount(@RequestAttribute(LOGIN_ACCOUNT) Account account) {
return accountService.getAccountById(account.getAccountId());
Account accountById = accountService.getAccountById(account.getAccountId());
// 设置签署截止时间(用于前端判断是否可以重新发起签署)
accountById.setSignDeadline(platformContractService.getSignDeadline(account.getAccountId()));
return accountById;
}
/**
......
......@@ -6,6 +6,8 @@ import com.glsx.usedcar.esign.comm.EsignHttpResponse;
import com.glsx.usedcar.esign.enums.EsignHeaderConstant;
import com.glsx.usedcar.esign.enums.EsignRequestType;
import com.glsx.usedcar.esign.exception.EsignDemoException;
import com.glsx.usedcar.module.account.entity.PlatformContract;
import com.glsx.usedcar.module.account.service.PlatformContractService;
import com.glsx.usedcar.module.auction.entity.Contract;
import com.glsx.usedcar.module.auction.service.ContractService;
import com.google.gson.Gson;
......@@ -16,6 +18,7 @@ import jakarta.annotation.Resource;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.summerframework.storage.FileStorageException;
......@@ -54,6 +57,9 @@ public class ESignService {
@Resource
private ContractService contractService;
@Resource
@Lazy
private PlatformContractService platformContractService;
@Resource
private StorageProperties storageProperties;
/**
......@@ -339,6 +345,78 @@ public class ESignService {
}
/**
* 下载平台合同签署完成后的PDF文件
*
* @param contract 平台合同
*/
@Async
public void downloadPlatformContractFile(PlatformContract contract) {
Gson gson = new Gson();
String signFlowId = contract.getSignFlowId();
List<FileInfo> fileInfos = new ArrayList<>();
try {
EsignHttpResponse fileDownloadUrl = fileDownloadUrl(signFlowId);
JsonObject fileDownloadUrlJsonObject = gson.fromJson(fileDownloadUrl.getBody(), JsonObject.class);
JsonObject fileDownloadUrlArray = fileDownloadUrlJsonObject.getAsJsonObject("data");
JsonArray files = fileDownloadUrlArray.getAsJsonArray("files");
if (Objects.nonNull(files)) {
for (JsonElement file : files) {
JsonObject fileJsonObject = (JsonObject) file;
String fileId = fileJsonObject.get("fileId").getAsString();
String downloadUrl = fileJsonObject.get("downloadUrl").getAsString();
String fileName = fileJsonObject.get("fileName").getAsString();
// 确保文件名有扩展名
fileName = ensureFileExtension(fileName, downloadUrl);
String storageDir = "platformContract/" + contract.getPlatformContractId();
log.info("下载平台合同文件: {}", downloadUrl);
try {
FileInfo fileInfo = downloadFile(fileName, downloadUrl, storageDir);
fileInfo.setUid(fileId);
fileInfos.add(fileInfo);
} catch (IOException e) {
log.error("下载平台合同文件失败", e);
}
}
platformContractService.updateContractFiles(contract.getPlatformContractId(), fileInfos);
log.info("平台合同文件下载完成, contractId: {}, fileCount: {}", contract.getPlatformContractId(), fileInfos.size());
}
} catch (EsignDemoException e) {
log.error("获取平台合同下载链接失败", e);
}
}
/**
* 确保文件名有扩展名
* <p>
* e签宝返回的文件名可能没有扩展名,需要从URL中提取或默认添加.pdf
* </p>
*
* @param fileName 原始文件名
* @param downloadUrl 下载URL
* @return 带扩展名的文件名
*/
private String ensureFileExtension(String fileName, String downloadUrl) {
if (fileName != null && fileName.contains(".")) {
return fileName;
}
// 尝试从URL中提取扩展名
String extension = ".pdf"; // 默认扩展名
if (downloadUrl != null) {
int queryIndex = downloadUrl.indexOf('?');
String path = queryIndex > 0 ? downloadUrl.substring(0, queryIndex) : downloadUrl;
int dotIndex = path.lastIndexOf('.');
if (dotIndex > 0 && dotIndex < path.length() - 1) {
String ext = path.substring(dotIndex);
// 验证是否为有效的扩展名(只取扩展名部分,不含查询参数)
if (ext.length() <= 5) {
extension = ext;
}
}
}
return fileName + extension;
}
private FileInfo downloadFile(String fileName, String fileUrl, String storageDir) throws IOException {
// 1. 转换URL为URI,获取远程文件输入流
URI uri = URI.create(fileUrl);
......
......@@ -227,12 +227,14 @@ public class Account extends AuditingTimeEntity implements Serializable {
/**
* 是否已签署平台合同
*/
@JsonView(value = Summary.class)
@Column(nullable = false)
private boolean platformContractSigned = false;
/**
* 平台合同签署时间
*/
@JsonView(value = Summary.class)
@Column
private LocalDateTime platformContractSignTime;
......@@ -298,6 +300,19 @@ public class Account extends AuditingTimeEntity implements Serializable {
@Transient
private BidStat bidStat;
/**
* 当前签署中合同的签署截止时间
* <p>
* 用于前端判断是否可以重新发起签署:
* - null:没有签署中的合同,可以发起新的
* - 大于当前时间:签署链接还有效,不需要重新发起
* - 小于等于当前时间:已过期,可以重新发起
* </p>
*/
@Transient
@JsonView(value = Summary.class)
private LocalDateTime signDeadline;
public Account(int accountId) {
this.accountId = accountId;
}
......
......@@ -8,10 +8,13 @@ import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.summerframework.orm.entity.AuditingTimeEntity;
import org.summerframework.storage.converter.FileInfosConverter;
import org.summerframework.storage.domain.FileInfo;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
import static jakarta.persistence.GenerationType.IDENTITY;
......@@ -111,12 +114,19 @@ public class PlatformContract extends AuditingTimeEntity implements Serializable
private LocalDateTime signDeadline;
/**
* 合同附件路径(本地临时文件路径)
* 合同路径
*/
@Column
private String filePath;
/**
* 合同附件(签署完成后的PDF文件)
*/
@Convert(converter = FileInfosConverter.class)
@Column(columnDefinition = "TEXT")
private List<FileInfo> contractFiles;
/**
* 合同状态枚举
*/
public enum ContractStatus {
......
......@@ -481,11 +481,27 @@ public class PlatformContractService {
account.setPlatformContractSignTime(LocalDateTime.now());
log.info("账户 {} 签署平台合同成功", account.getAccountId());
// 异步下载签署完成的合同文件
eSignService.downloadPlatformContractFile(contract);
}
return contract;
}
/**
* 更新平台合同附件
*
* @param platformContractId 平台合同ID
* @param fileInfos 文件列表
*/
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public void updateContractFiles(int platformContractId, List<org.summerframework.storage.domain.FileInfo> fileInfos) {
PlatformContract contract = platformContractDao.findById(platformContractId)
.orElseThrow(() -> new ObjectNotFoundException(platformContractId, PlatformContract.class.getSimpleName()));
contract.setContractFiles(fileInfos);
}
/**
* 重新发起签署(超时后)
*
* @param platformContractId 平台合同ID
......
......@@ -6,8 +6,10 @@ import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.summerframework.storage.domain.FileInfo;
import java.time.LocalDateTime;
import java.util.List;
/**
* 平台合同分页查询响应VO
......@@ -66,4 +68,10 @@ public class PlatformContractPageRespVO {
@Schema(description = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime createTime;
@Schema(description = "合同预览路径")
private String filePath;
@Schema(description = "合同附件(签署完成后的PDF文件)")
private List<FileInfo> contractFiles;
}
......@@ -219,6 +219,22 @@ public class AuctionOrder extends AuditingEntity implements Serializable {
private String cancelReason;
/**
* 取消前的订单状态
* <p>
* 当订单被取消时,记录取消前的状态,便于前端展示
* </p>
*/
@Enumerated(EnumType.STRING)
@Column(length = 32)
private OrderState previousOrderState;
/**
* 备注
*/
@Column(length = 500)
private String remark;
/**
* 优惠券名称(非持久化字段,用于展示)
*/
@Transient
......
......@@ -3,7 +3,6 @@ package com.glsx.usedcar.module.auction.entity.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.summerframework.storage.domain.FileInfo;
import java.io.Serial;
import java.io.Serializable;
......@@ -26,6 +25,9 @@ public class ProxyUploadPayVoucherVO implements Serializable {
@Schema(description = "订单ID", required = true, example = "1")
private Integer orderId;
@Schema(description = "付款凭证文件列表")
private List<FileInfo> payVouchers;
@Schema(description = "付款凭证URL列表")
private List<String> payVouchers;
@Schema(description = "备注")
private String remark;
}
......@@ -29,15 +29,15 @@ public class ProxyUploadTransferMaterialsVO implements Serializable {
@Schema(description = "新车牌号")
private String newPlateNumber;
@Schema(description = "机动车登记证书")
private List<FileInfo> registrationCertificate;
@Schema(description = "机动车登记证书URL列表")
private List<String> registrationCertificate;
@Schema(description = "机动车行驶证")
private List<FileInfo> vehicleLicense;
@Schema(description = "机动车行驶证URL列表")
private List<String> vehicleLicense;
@Schema(description = "过户发票")
@Schema(description = "过户发票文件列表(前端传 filePath 和 size)")
private List<FileInfo> transferInvoice;
@Schema(description = "新车主身份证")
private List<FileInfo> newOwnerIdCard;
@Schema(description = "新车主身份证URL列表")
private List<String> newOwnerIdCard;
}
......@@ -3,7 +3,6 @@ package com.glsx.usedcar.module.auction.entity.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.summerframework.storage.domain.FileInfo;
import java.io.Serial;
import java.io.Serializable;
......@@ -26,9 +25,9 @@ public class UpdateVehicleDocumentsVO implements Serializable {
@Schema(description = "订单ID", required = true, example = "1")
private Integer orderId;
@Schema(description = "机动车登记证书")
private List<FileInfo> registrationCertificate;
@Schema(description = "机动车登记证书URL列表")
private List<String> registrationCertificate;
@Schema(description = "机动车行驶证")
private List<FileInfo> vehicleLicense;
@Schema(description = "机动车行驶证URL列表")
private List<String> vehicleLicense;
}
......@@ -119,6 +119,8 @@ public class AppealService extends AbstractAuctionService {
auctionOrder.getAuction(), auctionOrder.getVehicle(), Deposit.DepositState.FREEZE, account);
switch (appealDb.getSolution()) {
case DEPOSIT:
// 记录取消前的状态
auctionOrder.setPreviousOrderState(auctionOrder.getOrderState());
auctionOrder.setOrderState(AuctionOrder.OrderState.CANCELED);
vehicleDao.updateVehicleState(Vehicle.VehicleState.PRICED, auctionOrder.getVehicle().getVehicleId());
if (Objects.nonNull(deposit)) {
......@@ -128,6 +130,8 @@ public class AppealService extends AbstractAuctionService {
break;
case COMPENSATION:
// 协商补偿
// 记录取消前的状态
auctionOrder.setPreviousOrderState(auctionOrder.getOrderState());
auctionOrder.setOrderState(AuctionOrder.OrderState.CANCELED);
vehicleDao.updateVehicleState(Vehicle.VehicleState.PRICED, auctionOrder.getVehicle().getVehicleId());
returnDeposit(deposit, "申诉完成,退还保证金,处理方式协商补偿,补偿金额¥" + appealDb.getCompensationAmount(), account);
......@@ -137,6 +141,8 @@ public class AppealService extends AbstractAuctionService {
}
break;
case RETURN:
// 记录取消前的状态
auctionOrder.setPreviousOrderState(auctionOrder.getOrderState());
auctionOrder.setOrderState(AuctionOrder.OrderState.CANCELED);
vehicleDao.updateVehicleState(Vehicle.VehicleState.PRICED, auctionOrder.getVehicle().getVehicleId());
returnDeposit(deposit, "申诉完成,处理方式退车,退还保证金 ", account);
......
......@@ -305,6 +305,8 @@ public class AuctionOrderService extends AbstractAuctionService {
returnDeposit(deposit, "订单取消,退还保证金,订单号:" + auctionOrder.getOrderCode(), auctionOrder.getAccount());
// 退回优惠券
couponVerificationService.returnCouponWhenOrderCancel(auctionOrder.getOrderId(), order.getCancelReason());
// 记录取消前的状态
auctionOrder.setPreviousOrderState(auctionOrder.getOrderState());
auctionOrder.setCancelReason(order.getCancelReason());
auctionOrder.resetOrderState(AuctionOrder.OrderState.CANCELED, Vehicle.VehicleState.PRICED);
AuctionVehicle auctionAndVehicle = auctionVehicleDao.findTopByAuctionAndVehicle(auctionOrder.getAuction(), auctionOrder.getVehicle());
......
......@@ -162,6 +162,62 @@ public class TransactionService extends AbstractAuctionService {
}
}
/**
* 后台代上传付款凭证保存
* <p>
* 创建OrderTransaction记录,状态为待审核,与小程序端上传逻辑一致
* </p>
*
* @param orderTransaction 订单交易实例对象
* @param remark 订单备注(同步保存到AuctionOrder)
* @return 订单交易实例对象
*/
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public OrderTransaction proxySaveOrderTransaction(OrderTransaction orderTransaction, String remark) {
// 重新查询订单并加载关联对象,避免懒加载异常
AuctionOrder auctionOrder = auctionOrderDao.findById(orderTransaction.getAuctionOrder().getOrderId()).orElseThrow();
// 触发懒加载
auctionOrder.getVehicle().getVehicleId();
auctionOrder.getAccount().getAccountId();
orderTransaction.setAuctionOrder(auctionOrder);
orderTransaction.setTransactionCode(CoderGenerator.generateCode(6));
orderTransaction.setAuditState(AuditState.UNAUDITED);
// 设置订单审核状态为待审核
auctionOrder.setAuditState(AuditState.UNAUDITED);
// 同步备注到订单
if (remark != null) {
auctionOrder.setRemark(remark);
}
// 发送通知消息
sendNoticeMessage(NoticeTemplate.TemplateType.ORDER_TRANSACTION, Map.of(
NoticeField.ORDER_CODE, auctionOrder.getOrderCode(),
NoticeField.VEHICLE_NAME, auctionOrder.getVehicle().toVehicleName(),
NoticeField.AMOUNT, auctionOrder.getOrderPrice() + auctionOrder.getCommissionPrice(),
NoticeField.ORDER_ACCOUNT_NAME, auctionOrder.getAccount().getAccountName(),
NoticeField.ORDER_TRANSACTION_TIME, auctionOrder.getCreateTime()));
return orderTransactionDao.save(orderTransaction);
}
/**
* 更新订单交易记录
*
* @param orderTransaction 订单交易实例对象
* @param remark 订单备注(同步保存到AuctionOrder)
* @return 订单交易实例对象
*/
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public OrderTransaction updateOrderTransaction(OrderTransaction orderTransaction, String remark) {
AuctionOrder auctionOrder = auctionOrderDao.findById(orderTransaction.getAuctionOrder().getOrderId()).orElseThrow();
if (remark != null) {
auctionOrder.setRemark(remark);
}
return orderTransactionDao.save(orderTransaction);
}
/**
* 修改订单交易
......
......@@ -458,6 +458,7 @@ public class VehicleService {
vehicleDb.setEvaluationTransaction(vehicle.getEvaluationTransaction());
vehicleDb.setCustodianInfo(vehicle.getCustodianInfo());
vehicleDb.setOwnerInfo(vehicle.getOwnerInfo());
vehicleDb.setTransferMaterials(vehicle.getTransferMaterials());
if (vehicleDb.getVehicleState() == Vehicle.VehicleState.INVENTORY) {
// 车辆状态设置为待维护场地
vehicleDb.setVehicleState(Vehicle.VehicleState.VENUE);
......
......@@ -141,4 +141,14 @@ export class ContractController{
// region 前端扩展代码区
// endregion
/**
* 分页查询平台合同列表
* @param pagination
* @return Page
*/
static pagePlatformContract(axios:AxiosStatic, pagination: Pagination<Contract>): Promise<AxiosResponse<Page<Contract>>> {
return axios.post('platformContract/page', pagination);
}
static PLATFORM_PAGE_CONTRACT = 'platformContract/page';
}
......@@ -133,4 +133,16 @@ export class TransactionController{
// region 前端扩展代码区
// endregion
/**
* 代上传付款凭证
*/
static proxyUploadPayVoucher(axios:AxiosStatic, params): Promise<AxiosResponse<OrderTransaction>> {
return axios.post('auctionOrder/proxyUploadPayVoucher', params);
}
/**
* 代上传过户资料
*/
static proxyUploadTransferMaterials(axios:AxiosStatic, params): Promise<AxiosResponse<OrderTransaction>> {
return axios.post('auctionOrder/proxyUploadTransferMaterials', params);
}
}
......@@ -57,7 +57,7 @@ export default {
},
"auctionOrder": {
"orderState": {
"CONTRACT_UNSIGNED": "待签署合同",
// "CONTRACT_UNSIGNED": "待签署合同",
"UNPAID": "待付车款",
"WAIT_PICKUP": "待提车",
"TRANSFERRING": "待过户",
......@@ -181,7 +181,9 @@ export default {
"COUPON_2": "优惠券协议2",
"COUPON_3": "优惠券协议3",
"COUPON_4": "优惠券协议4",
"COUPON_5": "优惠券协议5"
"COUPON_5": "优惠券协议5",
"PURCHASE_CONTRACT": "购车合同",
"PLATFORM_CONTRACT": "平台交易整体合同"
},
"agreementState": {
"DRAFT": "草稿",
......
......@@ -165,8 +165,6 @@ SecurityController.getUserAuthentication(axiosInstance as AxiosStatic, null).the
authService.setAuthentication(authenticity);
//将当前用户信息写入vuex的store中
store.commit('security/changeAuthenticity', authenticity);
//将用户的权限树写入到vuex的store中
store.commit('security/changePrivileges', authenticity.privileges ?? []);
app.mount('#app');
......
......@@ -38,6 +38,13 @@ export const businessRouter: Array<RouteRecordRaw> = [
}
},
{
path: '/business/platformContract',
component: () => import( '@/views/business/platformContract/platFormContractPage.vue'),
meta: {
breadcrumbs: [{name: '运营管理'}, {name: '平台合同管理'}]
}
},
{
path: '/business/deposit-rule',
component: () => import( '@/views/business/deposit-rule/DepositRulePage.vue'),
meta: {
......
......@@ -33,12 +33,13 @@
</router-link>
<!-- 审核过户资料-->
<a-button type="link" v-if="record.orderState==='TRANSFERRING'&&record.auditState==='UNAUDITED'" size="small" @click="auditAuctionOrder(record)">审核</a-button>
<a-button type="link" disabled v-if="record.orderState==='TRANSFERRING'&&!record.auditState" size="small">未提交过户资料</a-button>
<!-- <a-button type="link" disabled v-if="record.orderState==='TRANSFERRING'&&!record.auditState" size="small">未提交过户资料</a-button> -->
<a-button type="link" size="small" v-if="record.orderState === 'TRANSFERRING' || record.orderState === 'COMPLETED'" @click="uploadTransferring(record)">修改过户资料</a-button>
<a-button type="link" v-if="record.orderState==='COMPLETED'" size="small" @click="viewTransferring(record)">过户资料</a-button>
<router-link :to="{path:'/account/view',query:{accountId:record.account?.accountId}}">
<a-button type="link" size="small">联系买家</a-button>
</router-link>
<a-button type="link" v-if="record.orderState==='UNPAID' && record.auditState !== 'UNAUDITED'" size="small" @click="uploadPaymentVoucher(record)">上传付款凭证</a-button>
<order-transaction-audit-btn :auction-order="record"></order-transaction-audit-btn>
......@@ -66,7 +67,8 @@ import {Security} from "@/store";
import {Auction} from "lib/src/entity/auction/entity/Auction";
import OrderTransactionAuditBtn from "@/views/auction/order/OrderTransactionAuditBtn.vue";
import TransferAuctionOrder from "@/views/auction/order/TransferAuctionOrder.vue";
import UploadTransferringOrder from "@/views/auction/order/UploadTransferringOrder.vue";
import UploadPaymentVoucher from "@/views/auction/order/UploadPaymentVoucher.vue";
@Component({
components: {
OrderTransactionAuditBtn,
......@@ -75,11 +77,13 @@ import TransferAuctionOrder from "@/views/auction/order/TransferAuctionOrder.vue
SearchOutlined,
PlusSquareOutlined,
UndoOutlined,
EditFilled, DeleteFilled, TableOutlined, EyeFilled
EditFilled, DeleteFilled, TableOutlined, EyeFilled,
UploadTransferringOrder,
UploadPaymentVoucher
},
})
export default class AuctionOrderPage extends PaginationComponent<AuctionOrder> {
orderState: AuctionOrder_OrderState | '' = "CONTRACT_UNSIGNED";
orderState: AuctionOrder_OrderState | '' = "UNPAID";
exporting = false;
/**
* 表格列配置
......@@ -187,7 +191,7 @@ export default class AuctionOrderPage extends PaginationComponent<AuctionOrder>
const tabs = [];
if (this.hasPrivilege('auction_order_1')) tabs.push({key: "", tab: `全部(${this.orderStateCount?.total})`});
AUCTION_ORDER_ORDER_STATES.forEach(item => {
if (item === 'CONTRACT_UNSIGNED') tabs.push({key: item, tab: `${this.$t('enum.auctionOrder.orderState.' + item)}(${this.orderStateCount.contractUnsignedCount})`});
// if (item === 'CONTRACT_UNSIGNED') tabs.push({key: item, tab: `${this.$t('enum.auctionOrder.orderState.' + item)}(${this.orderStateCount.contractUnsignedCount})`});
if (item === 'UNPAID' && this.hasPrivilege('auction_order_3')) tabs.push({key: item, tab: `${this.$t('enum.auctionOrder.orderState.' + item)}(${this.orderStateCount.unpaidCount})`});
if (item === 'WAIT_PICKUP' && this.hasPrivilege('auction_order_4')) tabs.push({key: item, tab: `${this.$t('enum.auctionOrder.orderState.' + item)}(${this.orderStateCount.waitPickupCount})`});
if (item === 'TRANSFERRING' && this.hasPrivilege('auction_order_5')) tabs.push({key: item, tab: `${this.$t('enum.auctionOrder.orderState.' + item)}(${this.orderStateCount.transferringCount})`});
......@@ -269,6 +273,50 @@ export default class AuctionOrderPage extends PaginationComponent<AuctionOrder>
});
}
uploadTransferring(auctionOrder: AuctionOrder): void {
this.selectedAuctionOrder = auctionOrder;
const modal = ModalService.confirm({
title: "修改过户资料", component: UploadTransferringOrder, closable: true, appContext: this.$.appContext,
props: {
auctionOrder: auctionOrder
},
onOk: (component): void => {
component.submitForm();
},
emits: {
handleOk: (e) => {
modal.destroy();
this.reloadTabsCount();
this.pagination.refresh();
}
},
})
}
uploadPaymentVoucher(auctionOrder: AuctionOrder): void {
this.selectedAuctionOrder = auctionOrder;
const modal = ModalService.confirm({
title: '上传付款凭证',
component: UploadPaymentVoucher,
closable: true,
width: 800,
appContext: this.$.appContext,
props: {
auctionOrder: auctionOrder
},
onOk: (component): void => {
component.submitForm();
},
emits: {
handleOk: (e) => {
modal.destroy();
this.reloadTabsCount();
this.pagination.refresh();
}
}
});
}
downloadExcel(): void {
this.exporting = true;
AuctionOrderController.exportAuctionOrder(this.axios, this.pagination.requestParams, {responseType: 'blob'}).then(response => {
......
......@@ -9,8 +9,29 @@
<a-image-preview-group>
<a-image :width="120" v-for="image in auctionOrder.vehicleLicense" :src="image.url" :key="image.uid"/>
</a-image-preview-group>
<div class="mb-12"></div>
<title-divider title="过户发票"></title-divider>
<div v-if="auctionOrder.transferInvoice && auctionOrder.transferInvoice.length > 0" class="file-list">
<div v-for="file in auctionOrder.transferInvoice" :key="file.uid" class="file-card">
<div class="file-info">
<div class="file-meta">
<div class="file-name">文件名称:{{ file.name || '过户发票.pdf' }}</div>
<div class="file-extra">文件大小:{{ formatFileSize(file.size) || '' }}</div>
<div class="file-extra">上传日期 {{ file.lastModifiedDate || '' }}</div>
</div>
</div>
<div class="download-btn" @click="handlePreview(file)">下载</div>
</div>
</div>
<div class="mb-12"></div>
<title-divider title="新车主身份证照片"></title-divider>
<a-image-preview-group>
<a-image :width="120" v-for="image in auctionOrder.newOwnerIdCard" :src="image.url" :key="image.uid"/>
</a-image-preview-group>
<div class="mb-12"></div>
<title-divider title="新车牌号"></title-divider>
<a-descriptions v-if="auctionOrder" :column="3" size="small" class="mt-16">
<a-descriptions-item label="新车牌号" name="newPlateNumber">
<a-descriptions-item label="车牌号码" name="newPlateNumber">
{{ auctionOrder.newPlateNumber }}
</a-descriptions-item>
</a-descriptions>
......@@ -66,6 +87,31 @@ export default class AuditTransferAuctionOrder extends EnhanceFormComponent<Appr
mounted() {
}
handlePreview(file) {
if (!file || !file.url) return;
window.open(file.url, "_blank");
}
formatFileSize(bytes: number): string {
if (!bytes || bytes === 0) return "";
const kb = bytes / 1024;
const mb = bytes / 1024 / 1024;
// 小于 1KB,显示 B
if (bytes < 1024) {
return `${bytes} B`;
}
// 小于 1MB,显示 KB
else if (bytes < 1024 * 1024) {
return `${kb.toFixed(2)} KB`;
}
// 大于等于 1MB,显示 MB
else {
return `${mb.toFixed(2)} MB`;
}
}
onValidSuccess(formValue: ApproveHistory): void {
formValue.approveId = this.auctionOrder.orderId;
AuctionOrderController.auditTransferAuctionOrder(this.axios, formValue).then(response => {
......@@ -87,5 +133,69 @@ export default class AuditTransferAuctionOrder extends EnhanceFormComponent<Appr
</script>
<style lang="less" scoped>
.mb-12 {
margin-bottom: 12px;
}
.mt-16 {
margin-top: 16px;
}
.empty-text {
color: #999;
padding: 8px 0;
}
.file-list {
display: flex;
flex-direction: column;
gap: 12px;
margin-bottom: 16px;
background: #F7F8F9;
border-radius: 2px;
width: auto;
.file-card {
padding: 12px 16px;
.file-info {
display: flex;
align-items: center;
gap: 12px;
.file-icon {
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
background: #FFF2F0;
color: #FF4D4F;
border-radius: 6px;
font-size: 12px;
font-weight: 500;
}
.file-meta {
display: flex;
flex-direction: column;
gap: 4px;
.file-name {
color: #333;
font-size: 14px;
}
.file-extra {
color: #999;
font-size: 12px;
}
}
}
.download-btn {
margin-top: 20px;
cursor: pointer;
color: #1956FE;
}
}
}
</style>
......@@ -8,8 +8,29 @@
<a-image-preview-group>
<a-image :width="120" v-for="image in auctionOrder.vehicleLicense" :src="image.url" :key="image.uid"/>
</a-image-preview-group>
<div class="mb-12"></div>
<title-divider title="过户发票"></title-divider>
<div v-if="auctionOrder.transferInvoice && auctionOrder.transferInvoice.length > 0" class="file-list">
<div v-for="file in auctionOrder.transferInvoice" :key="file.uid" class="file-card">
<div class="file-info">
<div class="file-icon">PDF</div>
<div class="file-meta">
<div class="file-name">{{ file.name || '过户发票.pdf' }}</div>
<div class="file-extra">{{ file.size || '' }} · 上传时间 {{ file.uploadTime || '' }}</div>
</div>
</div>
<a-button type="default" size="small" @click="downloadFile(file)">下载</a-button>
</div>
</div>
<div class="mb-12"></div>
<title-divider title="新车主身份证照片"></title-divider>
<a-image-preview-group>
<a-image :width="120" v-for="image in auctionOrder.ownerIdCard" :src="image.url" :key="image.uid"/>
</a-image-preview-group>
<div class="mb-12"></div>
<title-divider title="新车牌号"></title-divider>
<a-descriptions v-if="auctionOrder" :column="3" size="small" class="mt-16">
<a-descriptions-item label="新车牌号" name="newPlateNumber">
<a-descriptions-item label="车牌号码" name="newPlateNumber">
{{ auctionOrder.newPlateNumber }}
</a-descriptions-item>
</a-descriptions>
......@@ -28,12 +49,106 @@ export default class TransferAuctionOrder extends Vue {
auctionOrder: AuctionOrder;
created(): void {
// TODO: 假数据,仅用于前端样式调试,接口通后删除以下代码
this.auctionOrder.transferInvoice = [
{
uid: 'mock-transfer-invoice-1',
url: 'https://example.com/transfer-invoice.pdf',
name: '过户发票_京A12345.pdf',
size: '2.1 MB',
uploadTime: '2026-07-28 14:32'
}
];
this.auctionOrder.ownerIdCard = [
{
uid: 'mock-owner-idcard-1',
url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png'
},
{
uid: 'mock-owner-idcard-2',
url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png'
}
];
// TODO: 假数据结束
}
downloadFile(file: any): void {
if (!file || !file.url) {
return;
}
const link = document.createElement('a');
link.href = file.url;
link.download = file.name || '过户发票.pdf';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
}
</script>
<style lang="less" scoped>
.mb-12 {
margin-bottom: 12px;
}
.mt-16 {
margin-top: 16px;
}
.empty-text {
color: #999;
padding: 8px 0;
}
.file-list {
display: flex;
flex-direction: column;
gap: 12px;
margin-bottom: 16px;
.file-card {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px 16px;
border: 1px solid #E1E3E6;
border-radius: 8px;
background: #fff;
.file-info {
display: flex;
align-items: center;
gap: 12px;
.file-icon {
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
background: #FFF2F0;
color: #FF4D4F;
border-radius: 6px;
font-size: 12px;
font-weight: 500;
}
.file-meta {
display: flex;
flex-direction: column;
gap: 4px;
.file-name {
color: #333;
font-size: 14px;
}
.file-extra {
color: #999;
font-size: 12px;
}
}
}
}
}
</style>
<template>
<a-form :model="formState" :label-col="labelCol" :wrapper-col="wrapperCol" ref="formRef">
<title-divider title="机动车登记证书"></title-divider>
<a-form-item label="">
<transfer-image-upload
v-model:value="formState.registrationCertificate"
:max-count="8"
:max-size="10"
upload-text="上传图片"
directory="auction/transfer"
@change="handleImageChange('registrationCertificate', $event)"
/>
</a-form-item>
<title-divider title="过户发票"></title-divider>
<a-form-item label="">
<transfer-pdf-upload
v-model:value="formState.transferInvoice"
:max-size="10"
directory="auction/transfer"
@change="handlePdfChange('transferInvoice', $event)"
/>
<div class="upload-hint">车商上传的二手车销售统一发票</div>
</a-form-item>
<div class="mb-12"></div>
<div class="mb-12"></div>
<title-divider title="新的机动车行驶证"></title-divider>
<a-form-item label="">
<transfer-image-upload
v-model:value="formState.vehicleLicense"
:max-count="2"
:max-size="10"
upload-text="上传图片"
directory="auction/transfer"
@change="handleImageChange('vehicleLicense', $event)"
/>
</a-form-item>
<div class="mb-12"></div>
<title-divider title="新车主身份证照片"></title-divider>
<a-form-item label="">
<transfer-image-upload
v-model:value="formState.newOwnerIdCard"
:max-count="2"
:max-size="10"
upload-text="上传图片"
directory="auction/transfer"
@change="handleImageChange('newOwnerIdCard', $event)"
/>
</a-form-item>
<div class="mb-12"></div>
<title-divider title="新车牌号"></title-divider>
<a-form-item label="车牌号码" name="newPlateNumber">
<a-input v-model:value="formState.newPlateNumber" placeholder="请输入新车牌号" style="width: 300px;" />
</a-form-item>
</a-form>
</template>
<script lang="ts">
import { Component, Prop, Vue } from "vue-facing-decorator";
import { reactive } from 'vue';
import { message } from 'ant-design-vue';
import TitleDivider from "@/components/TitleDivider.vue";
import TransferImageUpload from "./components/TransferImageUpload.vue";
import TransferPdfUpload from "./components/TransferPdfUpload.vue";
import { AuctionOrder } from "lib/src/entity/auction/entity/AuctionOrder";
import {TransactionController} from "@/api/TransactionController";
@Component({
components: { TitleDivider, TransferImageUpload, TransferPdfUpload }
})
export default class UploadTransferringOrder extends Vue {
@Prop({ required: true })
auctionOrder: AuctionOrder;
labelCol = { span: 4 };
wrapperCol = { span: 20 };
submitting = false;
formState = reactive({
registrationCertificate: [],
vehicleLicense: [],
transferInvoice: null,
newOwnerIdCard: [],
newPlateNumber: ''
});
created(): void {
// 初始化表单数据
if (this.auctionOrder) {
this.formState.registrationCertificate = this.auctionOrder.registrationCertificate || [];
this.formState.vehicleLicense = this.auctionOrder.vehicleLicense || [];
this.formState.transferInvoice = this.auctionOrder.transferInvoice || null;
this.formState.newOwnerIdCard = this.auctionOrder.newOwnerIdCard || [];
this.formState.newPlateNumber = this.auctionOrder.newPlateNumber || '';
}
}
handleImageChange(fieldName: string, fileList: any[]): void {
console.log(`${fieldName} changed:`, fileList);
}
handlePdfChange(fieldName: string, file: any): void {
console.log(`${fieldName} changed:`, file);
}
handleCancel(): void {
this.$emit('cancel');
}
submitForm(): void {
(this.$refs.formRef as any).validate().then(() => {
if (!this.formState.registrationCertificate || this.formState.registrationCertificate.length < 1) {
message.warning('请至少上传1张机动车登记证书图片');
return;
}
// 验证机动车行驶证(必须上传主页和副页)
if (!this.formState.vehicleLicense) {
message.warning('请至少上传一张机动车行驶证');
return;
}
const params = {
orderId: this.auctionOrder.orderId,
registrationCertificate: this.formState.registrationCertificate?.map(val => {return val.url}),
vehicleLicense: this.formState.vehicleLicense?.map(val => {return val.url}),
transferInvoice: this.formState.transferInvoice ? [{filePath: this.formState.transferInvoice.url, size: this.formState.transferInvoice.size}] : [],
newOwnerIdCard: this.formState.newOwnerIdCard?.map(val => {return val.url}),
newPlateNumber: this.formState.newPlateNumber
};
console.log(params)
TransactionController.proxyUploadTransferMaterials(this.axios, params).then(res => {
message.success('提交成功');
this.$emit('handleOk');
}).catch(err => {
console.error('提交失败:', err);
});
}).catch(err => {
});
}
// async handleSubmit(): Promise<void> {
// try {
// this.submitting = true;
// // 验证机动车登记证书(最少1张)
// if (!this.formState.registrationCertificate || this.formState.registrationCertificate.length < 1) {
// message.warning('请至少上传1张机动车登记证书图片');
// return;
// }
// // 验证机动车行驶证(必须上传主页和副页)
// if (!this.formState.vehicleLicense) {
// message.warning('请至少上传一张机动车行驶证');
// return;
// }
// const params = {
// orderId: this.auctionOrder.orderId,
// registrationCertificate: this.formState.registrationCertificate,
// vehicleLicense: this.formState.vehicleLicense,
// transferInvoice: this.formState.transferInvoice ? [this.formState.transferInvoice] : [],
// newOwnerIdCard: this.formState.newOwnerIdCard,
// newPlateNumber: this.formState.newPlateNumber
// };
// console.log(params, '2222')
// // await TransactionController.proxyUploadTransferMaterials(this.axios, params);
// message.success('提交成功');
// this.$emit('success');
// } catch (error) {
// message.error('提交失败,请重试');
// console.error('提交失败:', error);
// } finally {
// this.submitting = false;
// }
// }
}
</script>
<style lang="less" scoped>
.mb-12 {
margin-bottom: 12px;
}
.upload-hint {
color: #999;
font-size: 12px;
margin-top: 8px;
}
.form-footer {
margin-top: 24px;
text-align: right;
}
</style>
......@@ -32,6 +32,18 @@
<a-descriptions-item label="创建时间" name="createTime">
{{ auctionOrder.createTime }}
</a-descriptions-item>
<a-descriptions-item label="保留价" name="updateTime">
¥{{ auctionOrder.vehicle.reservePrice }}
</a-descriptions-item>
<a-descriptions-item label="预计经销差" name="updateTime">
¥{{ expectedProfitMargin }}
</a-descriptions-item>
<a-descriptions-item label="溢价金额" name="updateTime">
¥{{ premiumAmount }}
</a-descriptions-item>
<a-descriptions-item label="实际经销差" name="updateTime">
¥{{ actualProfitMargin }}
</a-descriptions-item>
</a-descriptions>
</a-card>
<a-card class="mt-10" :bordered="false" size="small">
......@@ -429,6 +441,69 @@ export default class ViewAuctionOrder extends Vue {
return this.auctionOrder?.account;
}
/**
* 预计经销差 = 保留价 + 佣金 - 成本价
* 使用 Math.round() 避免精度丢失
*/
get expectedProfitMargin(): string {
if (!this.auctionOrder) return '-';
const reservePrice = this.auctionOrder.vehicle?.reservePrice;
const commissionPrice = this.auctionOrder.commissionPrice;
const purchasePrice = this.auctionOrder.vehicle?.evaluationTransaction?.purchasePrice;
// 如果任一值为空,返回 '-'
if (!reservePrice || !commissionPrice || !purchasePrice) {
return '-';
}
// 使用 Math.round() 避免精度丢失,保留2位小数
const margin = Math.round((reservePrice + commissionPrice - purchasePrice) * 100) / 100;
return margin.toFixed(2);
}
/**
* 溢价金额 = 成交价 + 佣金 - 保留价
* 使用 Math.round() 避免精度丢失
*/
get premiumAmount(): string {
if (!this.auctionOrder) return '-';
const orderPrice = this.auctionOrder.orderPrice;
const commissionPrice = this.auctionOrder.commissionPrice;
const reservePrice = this.auctionOrder.vehicle?.reservePrice;
// 如果任一值为空,返回 '-'
if (!orderPrice || !commissionPrice || !reservePrice) {
return '-';
}
// 使用 Math.round() 避免精度丢失,保留2位小数
const premium = Math.round((orderPrice + commissionPrice - reservePrice) * 100) / 100;
return premium.toFixed(2);
}
/**
* 实际经销差 = 成交价 + 佣金 - 成本价
* 使用 Math.round() 避免精度丢失
*/
get actualProfitMargin(): string {
if (!this.auctionOrder) return '-';
const orderPrice = this.auctionOrder.orderPrice;
const commissionPrice = this.auctionOrder.commissionPrice;
const purchasePrice = this.auctionOrder.vehicle?.evaluationTransaction?.purchasePrice;
// 如果任一值为空,返回 '-'
if (!orderPrice || !commissionPrice || !purchasePrice) {
return '-';
}
// 使用 Math.round() 避免精度丢失,保留2位小数
const margin = Math.round((orderPrice + commissionPrice - purchasePrice) * 100) / 100;
return margin.toFixed(2);
}
viewContract(contract: Contract): void {
contract.auctionOrder = this.auctionOrder;
const modal = ModalService.confirm({
......
<template>
<div class="transfer-image-upload">
<!-- 隐藏的input -->
<input
ref="fileInputRef"
type="file"
accept="image/jpeg,image/jpg,image/png,image/jpeg"
multiple
class="hidden-input"
@change="onFileChange"
/>
<!-- 上传区域 -->
<div class="upload-list">
<!-- 已上传的图片 -->
<div
v-for="(url, index) in imageList"
:key="index"
class="upload-item"
>
<a-image :src="url" class="image-preview" />
<div class="delete-icon" @click="handleDelete(index)">
<CloseCircleOutlined />
</div>
</div>
<!-- 上传按钮 -->
<div
v-if="imageList.length < maxCount && !readonly"
class="upload-btn"
@click="handleUploadClick"
>
<PlusOutlined class="plus-icon" />
<div class="upload-text">{{ uploadText || '上传图片' }}</div>
</div>
</div>
<!-- 提示文字 -->
<div v-if="hint" class="upload-hint">{{ hint }}</div>
</div>
</template>
<script lang="ts">
import { Component, Prop, Vue, Watch } from "vue-facing-decorator";
import { PlusOutlined, CloseCircleOutlined } from "@ant-design/icons-vue";
import { message } from "ant-design-vue";
import { uploadFile, isLikelyImageFile } from "@/utils/upload.js";
@Component({
name: "TransferImageUpload",
components: { PlusOutlined, CloseCircleOutlined }
})
export default class TransferImageUpload extends Vue {
@Prop({ type: Array, default: () => [] })
value!: any[];
@Prop({ type: Number, default: 10 })
maxCount!: number;
@Prop({ type: Number, default: 10 })
maxSize!: number; // MB
@Prop({ type: String, default: "" })
uploadText!: string;
@Prop({ type: String, default: "" })
hint!: string;
@Prop({ type: Boolean, default: false })
readonly!: boolean;
@Prop({ type: String, default: "auction/transfer" })
directory!: string;
imageList: string[] = [];
uploading = false;
@Watch("value", { deep: true, immediate: true })
onValueChange(val: any[]) {
if (!val || val.length === 0) {
this.imageList = [];
} else {
this.imageList = val.map((item: any) => {
if (typeof item === "string") {
return item;
}
return item.url || item.aliyunAddress || "";
});
}
}
handleUploadClick() {
if (this.readonly || this.uploading) return;
(this.$refs.fileInputRef as HTMLInputElement)?.click();
}
async onFileChange(ev: Event) {
const input = ev.target as HTMLInputElement;
const files = Array.from(input.files || []);
input.value = "";
if (files.length === 0) return;
// 数量限制
if (this.imageList.length + files.length > this.maxCount) {
message.warning(`最多上传${this.maxCount}张图片`);
return;
}
// 验证文件
for (const file of files) {
if (!isLikelyImageFile(file)) {
message.error(`${file.name} 不是有效的图片文件`);
return;
}
if (file.size > this.maxSize * 1024 * 1024) {
message.error(`${file.name} 大小超过${this.maxSize}MB`);
return;
}
}
// 上传文件
try {
this.uploading = true;
const uploadPromises = files.map(file => uploadFile(file, { dir: this.directory }));
const results = await Promise.all(uploadPromises);
const newUrls = results.map(res => res.aliyunAddress || res.url || "");
this.imageList = [...this.imageList, ...newUrls];
this.emitChange();
message.success("上传成功");
} catch (error: any) {
message.error(`上传失败:${error.message || error}`);
} finally {
this.uploading = false;
}
}
handleDelete(index: number) {
if (this.readonly) return;
this.imageList.splice(index, 1);
this.emitChange();
}
emitChange() {
const fileList = this.imageList.map(url => ({
url,
uid: `${Date.now()}_${Math.random()}`,
name: url.split("/").pop() || "",
status: "done"
}));
this.$emit("update:value", fileList);
this.$emit("change", fileList);
}
}
</script>
<style scoped lang="less">
.transfer-image-upload {
width: 100%;
.hidden-input {
position: absolute;
width: 0;
height: 0;
pointer-events: none;
opacity: 0;
}
.upload-list {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
.upload-item {
position: relative;
width: 88px;
height: 88px;
border: 1px solid #e1e3e6;
border-radius: 6px;
overflow: hidden;
background: #f5f7fa;
.image-preview {
width: 100%;
height: 100%;
object-fit: cover;
}
.delete-icon {
position: absolute;
top: 2px;
right: 2px;
width: 20px;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
background: rgba(255, 255, 255, 0.9);
border-radius: 50%;
cursor: pointer;
z-index: 10;
&:hover {
color: #ff4d4f;
}
}
}
.upload-btn {
width: 88px;
height: 88px;
border: 1px dashed #d9d9d9;
border-radius: 6px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
cursor: pointer;
background: #fafafa;
transition: all 0.3s;
&:hover {
border-color: #1890ff;
}
.plus-icon {
font-size: 20px;
color: #8c8c8c;
margin-bottom: 4px;
}
.upload-text {
font-size: 12px;
color: #8c8c8c;
}
}
.upload-hint {
color: #999;
font-size: 12px;
margin-top: 8px;
}
}
</style>
<template>
<div class="transfer-pdf-upload">
<!-- 隐藏的input -->
<input
ref="fileInputRef"
type="file"
accept="application/pdf"
class="hidden-input"
@change="onFileChange"
/>
<!-- 已上传的PDF文件 -->
<div v-if="pdfFile" class="pdf-file-card">
<div class="pdf-icon">
<FilePdfOutlined style="font-size: 24px; color: #FF4D4F;" />
</div>
<div class="pdf-info">
<div class="pdf-name">{{ pdfFile.name || '过户发票.pdf' }}</div>
<div class="pdf-meta">文件大小:{{ pdfFile.formatSize || '' }}</div>
</div>
<div class="pdf-actions">
<a-button type="link" size="small" @click="handlePreview">预览</a-button>
<a-button v-if="!readonly" type="link" size="small" @click="handleDelete">删除</a-button>
</div>
</div>
<!-- 上传按钮 -->
<div v-else-if="!readonly" class="upload-btn" @click="handleUploadClick">
<a-button>
<UploadOutlined />
上传过户发票(PDF)
</a-button>
</div>
</div>
</template>
<script lang="ts">
import { Component, Prop, Vue, Watch } from "vue-facing-decorator";
import { UploadOutlined, FilePdfOutlined, CloseCircleOutlined } from "@ant-design/icons-vue";
import { message } from "ant-design-vue";
import { uploadFile } from "@/utils/upload.js";
@Component({
name: "TransferPdfUpload",
components: { UploadOutlined, FilePdfOutlined, CloseCircleOutlined }
})
export default class TransferPdfUpload extends Vue {
@Prop({ type: Object, default: null })
value!: any;
@Prop({ type: Number, default: 10 })
maxSize!: number; // MB
@Prop({ type: Boolean, default: false })
readonly!: boolean;
@Prop({ type: String, default: "auction/transfer" })
directory!: string;
pdfFile: any = null;
uploading = false;
@Watch("value", { deep: true, immediate: true })
onValueChange(val: any) {
if (!val) {
this.pdfFile = null;
} else {
// 处理不同数据格式
let pdfData: any = null;
// 情况1:数组格式(从后端返回的数据)
if (Array.isArray(val) && val.length > 0) {
const firstItem = val[0];
const fileSize = typeof firstItem === "string" ? 0 : (firstItem.size || 0);
pdfData = {
url: typeof firstItem === "string" ? firstItem : (firstItem.url || firstItem.aliyunAddress || ""),
name: typeof firstItem === "string" ? "过户发票.pdf" : (firstItem.name || firstItem.attachment || "过户发票.pdf"),
size: fileSize,
formatSize: this.formatFileSize(fileSize),
uid: typeof firstItem === "string" ? `${Date.now()}` : (firstItem.uid || `${Date.now()}`),
status: "done"
};
}
// 情况2:字符串格式(URL)
else if (typeof val === "string") {
pdfData = {
url: val,
name: "过户发票.pdf",
size: 0,
formatSize: "",
uid: `${Date.now()}`,
status: "done"
};
}
// 情况3:对象格式(FileInfo)
else if (typeof val === "object") {
const fileSize = val.size || 0;
pdfData = {
url: val.url || val.aliyunAddress || "",
name: val.name || val.attachment || "过户发票.pdf",
size: fileSize,
formatSize: this.formatFileSize(fileSize),
uid: val.uid || `${Date.now()}`,
status: "done"
};
}
this.pdfFile = pdfData;
}
}
handleUploadClick() {
if (this.readonly || this.uploading) return;
(this.$refs.fileInputRef as HTMLInputElement)?.click();
}
async onFileChange(ev: Event) {
const input = ev.target as HTMLInputElement;
const file = input.files?.[0];
input.value = "";
if (!file) return;
// 验证文件
if (file.type !== "application/pdf") {
message.error("只能上传PDF格式的文件");
return;
}
if (file.size > this.maxSize * 1024 * 1024) {
message.error(`文件大小不能超过${this.maxSize}MB`);
return;
}
// 上传文件
try {
this.uploading = true;
const result = await uploadFile(file, { dir: this.directory });
this.pdfFile = {
url: result.aliyunAddress || result.url || "",
name: result.attachment || file.name,
size: file.size,
formatSize: this.formatFileSize(file.size),
uid: result.uid || `${Date.now()}`,
status: "done"
};
this.emitChange();
message.success("上传成功");
} catch (error: any) {
message.error(`上传失败:${error.message || error}`);
} finally {
this.uploading = false;
}
}
handlePreview() {
if (!this.pdfFile || !this.pdfFile.url) return;
window.open(this.pdfFile.url, "_blank");
}
handleDelete() {
if (this.readonly) return;
this.pdfFile = null;
this.emitChange();
}
formatFileSize(bytes: number): string {
if (!bytes || bytes === 0) return "";
const kb = bytes / 1024;
const mb = bytes / 1024 / 1024;
// 小于 1KB,显示 B
if (bytes < 1024) {
return `${bytes} B`;
}
// 小于 1MB,显示 KB
else if (bytes < 1024 * 1024) {
return `${kb.toFixed(2)} KB`;
}
// 大于等于 1MB,显示 MB
else {
return `${mb.toFixed(2)} MB`;
}
}
emitChange() {
this.$emit("update:value", this.pdfFile);
this.$emit("change", this.pdfFile);
}
}
</script>
<style scoped lang="less">
.transfer-pdf-upload {
.hidden-input {
position: absolute;
width: 0;
height: 0;
pointer-events: none;
opacity: 0;
}
.pdf-file-card {
display: flex;
align-items: center;
padding: 12px 16px;
border-radius: 8px;
background: #F7F8F9;
.pdf-icon {
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
background: #FFF2F0;
border-radius: 6px;
margin-right: 12px;
}
.pdf-info {
flex: 1;
.pdf-name {
color: #333;
font-size: 14px;
margin-bottom: 4px;
}
.pdf-meta {
color: #999;
font-size: 12px;
}
}
.pdf-actions {
display: flex;
gap: 8px;
}
}
.upload-btn {
cursor: pointer;
}
}
</style>
<template>
<a-descriptions v-if="contract" :bordered="false" :column="2" size="small">
<template #title>
<title-tip-icon/>
合同基本信息
</template>
<a-descriptions-item label="合同编号" :span="2">
{{ contract.contractCode }}
</a-descriptions-item>
<a-descriptions-item label="合同名称" :span="2">
{{ contract.contractName }}
</a-descriptions-item>
<a-descriptions-item label="发起时间">
{{ contract.createTime || '-' }}
</a-descriptions-item>
<a-descriptions-item label="合同签署时间">
{{ contract.signTime || '-' }}
</a-descriptions-item>
<a-descriptions-item label="签署状态">
<a-tag :color="contract.contractStatus == '已签署' ? 'success' : 'orange'">{{contract.contractStatus}}</a-tag>
</a-descriptions-item>
<a-descriptions-item label="合同附件">
<template v-if="contract.contractFiles && contract.contractFiles.length > 0">
<a v-for="(file, index) in contract.contractFiles" :key="index" :href="file.url" target="_blank" style="margin-right: 8px;">
{{ file.name }}
</a>
</template>
<span v-else>-</span>
</a-descriptions-item>
</a-descriptions>
<a-card size="default" :bordered="false" style="margin-top: 16px;">
<template #title>
<title-tip-icon/>
合同内容预览
</template>
<iframe
v-if="contract.contractFiles && contract.contractFiles.length > 0"
:src="contract.contractFiles[0].url"
style="width: 100%; height: 400px; border: none;"
></iframe>
<a-empty v-else description="暂无合同附件" :image="simpleImage"></a-empty>
</a-card>
<a-descriptions :bordered="false" :column="4" size="small" style="margin-top: 16px;">
<template #title>
<title-tip-icon/>
签署方信息
</template>
<a-descriptions-item label="买受方" :span="2">
{{ contract.signerName || '-' }} (ID: {{ contract.signerIdCard || '-' }})
</a-descriptions-item>
<a-descriptions-item label="联系方式" :span="2">
{{ contract.signerMobile || '-' }}
</a-descriptions-item>
</a-descriptions>
</template>
<script lang="ts">
import { Component, Prop, Vue } from "vue-facing-decorator";
import { Contract } from "lib/src/entity/auction/entity/Contract";
import TitleTipIcon from "@/components/icons/TitleTipIcon.vue";
import { Empty } from "ant-design-vue";
@Component({
name: "ViewMasterContract",
components: { TitleTipIcon }
})
export default class ViewMasterContract extends Vue {
@Prop({ type: Object, required: true })
contract!: Contract;
simpleImage = Empty.PRESENTED_IMAGE_SIMPLE;
created(): void {
// 组件初始化逻辑
}
mounted(): void {
// 组件挂载完成
}
}
</script>
<style scoped lang="less">
// 可以在这里添加自定义样式
</style>
<template>
<!--查询栏-->
<m-pagination-query-render :fields="pagination.filterFields" :form="pagination.queryForm" @onSearch="pageReload" @onReset="pageReset" :simpleFieldNum="4"/>
<!--查询栏end-->
<!--合同列表start-->
<a-table :columns="columns" :data-source="pagination.content" :loading="loading" :bordered="false" @change="pageRefresh" @resizeColumn="this.$filters.tableResizeColumn"
size="small" :pagination="pageState" :row-key="record => record.contractId" :scroll="{y: 'calc(100vh - 310px)'}">
<template #customFilterDropdown="{setSelectedKeys, selectedKeys, confirm, clearFilters, column}">
<m-filter-text-render :pagination="pagination" :column="column" :confirm="confirm"></m-filter-text-render>
<m-filter-checkbox-group-render :pagination="pagination" :column="column" :confirm="confirm"></m-filter-checkbox-group-render>
</template>
<template #bodyCell="{column,record}">
<template v-if="column.key === 'action'">
<a-button type="link" @click="viewContract(record)" size="small">查看</a-button>
</template>
<template v-if="column.key === 'contractCode'">
<span>{{ record.contractCode }}</span>
<a-button type="link" size="small" @click="copyContractCode(record.contractCode)">
<CopyOutlined />
</a-button>
</template>
<template v-if="column.key === 'contractStatus'">
<a-tag :color="record.contractStatus == '已签署' ? 'success' : 'orange'">{{record.contractStatus}}</a-tag>
</template>
<template v-if="column.key === 'accountName'">
<span>{{ record.accountName || '—' }}</span>
</template>
<template v-if="column.key === 'signTime'">
<span>{{ (record.signTime || '—') }}</span>
</template>
<template v-if="column.key === 'createTime'">
<span>{{ record.createTime || '—' }}</span>
</template>
</template>
</a-table>
<!--合同列表end-->
</template>
<script lang="ts">
import {Operator, Order} from "lib/src/core/page/Pagination";
import {Component, Watch} from "vue-facing-decorator";
import {TableColumnsType} from 'ant-design-vue';
import {PaginationComponent} from '@/components/PaginationComponent';
import {DoubleRightOutlined, SearchOutlined, CopyOutlined} from '@ant-design/icons-vue';
import {CONTRACT_TEMPLATE_TEMPLATE_TYPES} from "lib/src/entity/auction/entity/ContractTemplate";
import {ModalService} from "@/components/ModalService";
import {ContractController} from "@/api/ContractController";
import {Contract} from "lib/src/entity/auction/entity/Contract";
import ViewPlatformContract from "./ViewPlatformContract.vue";
@Component({
components: {
DoubleRightOutlined,
SearchOutlined,
CopyOutlined,
ViewPlatformContract
}
})
export default class MasterContractPage extends PaginationComponent<Contract> {
/**
* 表格列配置
*/
columns: TableColumnsType = [];
/**
* 初始化配置
*/
created(): void {
// 初始化表格列
this.columns = [
{
title: '序号',
key: 'rowIndex',
width: 70,
align: 'center',
customRender: ({index}) => {
return (this.pageState.current - 1) * this.pageState.pageSize + index + 1;
}
},
{title: '合同编号', dataIndex: 'contractCode', key: 'contractCode', width: 180, resizable: true, ellipsis: true, sorter: true},
{title: '合同名称', dataIndex: 'contractName', key: 'contractName', resizable: true, ellipsis: true, sorter: true},
{
title: '签署状态', dataIndex: 'contractStatus', key: 'contractStatus', align: 'center', width: 100, resizable: true, ellipsis: true, sorter: true,
},
{title: '签署乙方姓名', dataIndex: 'signerName', key: 'signerName', width: 120, resizable: true, ellipsis: true, sorter: true},
{title: '创建时间', dataIndex: 'createTime', key: 'createTime', width: 170, align: 'center', resizable: true, ellipsis: true, sorter: true},
{title: '签署时间', dataIndex: 'signTime', key: 'signTime', width: 170, align: 'center', resizable: true, ellipsis: true, sorter: true},
{title: '操作', key: 'action', width: 80, align: 'center', fixed: 'right'},
];
const signedOptions = [
{label: '未签署', value: "SIGNING"},
{label: '已签署', value: "SIGNED"}
];
this.init(this.axios, ContractController.PLATFORM_PAGE_CONTRACT);
this.buildQueryForm({
contractCode: [null, {label: '合同编号', field: 'contractCode', operator: Operator.like, maxLength: 32}],
contractName: [null, {label: '合同名称', field: 'contractName', operator: Operator.like, maxLength: 50}],
contractStatus: [null, {label: '签署状态', field: 'contractStatus', type: 'select', optionItems: signedOptions, allowClear: true, operator: Operator.eq}],
signerName: [null, {label: '签署乙方姓名', field: 'signerName', operator: Operator.like, maxLength: 20}],
createTime: [null, {label: '创建时间', field: 'createTime', operator: Operator.dateBetween, type: 'date-range'}],
signTime: [null, {label: '签署时间', field: 'signTime', operator: Operator.dateBetween, type: 'date-range', disabled: true}],
});
this.pagination.setDefaultSort('createTime', Order.desc);
this.pageLoad();
}
/**
* 监听签署状态变化,控制签署时间字段的禁用状态
*/
@Watch('pagination.queryForm.contractStatus')
onSignedChange(newVal: boolean, oldVal: boolean): void {
// 获取签署时间字段的配置
const signTimeField = this.pagination.filterFields.find(field => field.fieldName === 'signTime');
if (signTimeField) {
// 当签署状态不为"已签署"时,禁用签署时间字段并清空值
signTimeField.disabled = newVal !== true;
if (newVal !== true && this.pagination.queryForm.signTime) {
this.pagination.queryForm.signTime = null;
}
}
}
i18n(text: string): string {
return this.$t(text);
}
/**
* 复制合同编号
*/
copyContractCode(contractCode: string): void {
// 创建一个临时的textarea元素
const textarea = document.createElement('textarea');
textarea.value = contractCode;
textarea.style.position = 'fixed';
textarea.style.left = '-9999px';
textarea.style.top = '-9999px';
document.body.appendChild(textarea);
textarea.select();
try {
// 执行复制命令
const successful = document.execCommand('copy');
if (successful) {
this.$message.success('合同编号已复制到剪贴板');
} else {
this.$message.error('复制失败,请手动复制');
}
} catch (err) {
this.$message.error('复制失败,请手动复制');
} finally {
// 移除临时元素
document.body.removeChild(textarea);
}
}
/**
* 查看合同详情
*/
viewContract(contract: Contract): void {
const modal = ModalService.confirm({
title: '合同详情',
component: ViewPlatformContract,
closable: true,
appContext: this.$.appContext,
props: {
contract: contract
},
emits: {
handleOk: (e) => {
modal.destroy();
}
}
});
}
}
</script>
<style scoped lang="less">
</style>
......@@ -22,6 +22,12 @@
<a-descriptions-item label="佣金金额" name="referencePrice">
¥{{ appraisePrice.fixedCommission || appraisePrice.fixedCommission == 0 ? appraisePrice.fixedCommission : '-' }}元
</a-descriptions-item>
<a-descriptions-item label="成本价" name="referencePrice">
¥{{ appraisePrice.vehicle?.evaluationTransaction?.purchasePrice || appraisePrice.vehicle?.evaluationTransaction?.purchasePrice == 0 ? appraisePrice.vehicle?.evaluationTransaction?.purchasePrice : '-' }}元
</a-descriptions-item>
<a-descriptions-item label="预计经销差" name="referencePrice">
¥{{ expectedProfitMargin }}元
</a-descriptions-item>
</a-descriptions>
<a-divider>审批记录</a-divider>
<approve-history-timeline approve-type="APPRAISE_PRICE" :approve-id="appraisePrice.appraiseId" :create-time="appraisePrice.createTime"
......@@ -70,6 +76,33 @@ export default class AppraisePriceAuditForm extends EnhanceFormComponent<Approve
this.formState = reactive<ApproveHistory>(approveHistory);
}
/**
* 预计经销差 = 保留价 + 佣金 - 成本价
* 使用 Math.round() 避免精度丢失
*/
get expectedProfitMargin(): string {
// 获取保留价
const reservePrice = this.appraisePrice?.reservePrice;
// 获取佣金
const commission = this.appraisePrice?.fixedCommission;
// 获取成本价
const purchasePrice = this.appraisePrice?.vehicle?.evaluationTransaction?.purchasePrice;
// 如果保留价或成本价为空,返回 '-'
if (!reservePrice || !purchasePrice) {
return '-';
}
// 佣金字段可能是0或空,需要特殊处理
const commissionPrice = commission || 0;
// 使用 Math.round() 避免精度丢失,保留2位小数
const margin = Math.round((reservePrice + commissionPrice - purchasePrice) * 100) / 100;
return margin.toFixed(2);
}
onValidSuccess(formValue: ApproveHistory): void {
formValue.approveId = this.appraisePrice.appraiseId;
AppraiseController.auditAppraisePrice(this.axios, formValue).then(res => {
......
......@@ -4,6 +4,7 @@
<a-descriptions-item label="车辆信息">{{ vehicle.baseInfo.carSeriesName }} {{ vehicle.baseInfo.carTypeName }}</a-descriptions-item>
<a-descriptions-item label="市场参考价">¥{{ vehicle.baseInfo.guidePrice }}元</a-descriptions-item>
<a-descriptions-item label="收车成本价">¥{{ vehicle.evaluationTransaction.purchasePrice }}元</a-descriptions-item>
<a-descriptions-item label="预计经销差">¥{{ difference }}元</a-descriptions-item>
</a-descriptions>
<a-alert v-if="(businessConfig&&!businessConfig?.specialPricingEnabled)&&formState.referencePrice <= 0" message="请配置有效的基础参考价规则"
type="error" show-icon class="mb-12"/>
......@@ -87,6 +88,31 @@ export default class AppraisePriceForm extends EnhanceFormComponent<AppraisePric
}
}
/**
* 预计经销差 = 手动输入的保留价 + 佣金 - 收车成本价
* 佣金取值:如果开启自定义佣金,取表单输入的固定佣金,否则按 0 处理
* 使用 Math.round() 避免精度丢失
*/
get difference(): string {
// 获取保留价(手动输入)
const reservePrice = this.formState.reservePrice;
// 获取佣金:如果开启自定义佣金,取表单输入的固定佣金,否则为 0
const commissionPrice = this.formState.fixedCommissionSwitch ? (this.formState.fixedCommission || 0) : 0;
// 获取收车成本价
const purchasePrice = this.vehicle?.evaluationTransaction?.purchasePrice;
// 如果保留价或成本价为空,返回 '-'
if (!reservePrice || !purchasePrice) {
return '-';
}
// 使用 Math.round() 避免精度丢失,保留2位小数
const margin = Math.round((reservePrice + commissionPrice - purchasePrice) * 100) / 100;
return margin.toFixed(2);
}
verifyReferencePrice(_rule: RuleObject, referencePrice: number) {
if (referencePrice <= 0) {
return Promise.reject('请配置有效的基础参考价规则!');
......
......@@ -29,7 +29,7 @@
type="link" size="small" @click="viewAuction(record)">关联拍场
</a-button>
<a-button v-sec="'vehicle_auction_12'"
v-if="record.vehicleState==='CONTRACT_UNSIGNED'||record.vehicleState==='UNPAID'||record.vehicleState==='WAIT_PICKUP'||record.vehicleState==='TRANSFERRING'||record.vehicleState==='COMPLETED'"
v-if="record.vehicleState==='UNPAID'||record.vehicleState==='WAIT_PICKUP'||record.vehicleState==='TRANSFERRING'||record.vehicleState==='COMPLETED'"
type="link" size="small" @click="viewOrder(record)">拍卖订单
</a-button>
</template>
......@@ -67,7 +67,7 @@ export default class AuctionVehiclePage extends PaginationComponent<Vehicle> {
currentTab: Vehicle_VehicleState | "" = "PENDING_AUCTION";
vehicleStates: Vehicle_VehicleState[] = ['PENDING_AUCTION', 'WAIT_AUCTION', 'PREVIEW', 'AUCTIONING', 'CONTRACT_UNSIGNED', 'UNPAID', 'WAIT_PICKUP', 'TRANSFERRING', 'COMPLETED', 'CANCELED'];
vehicleStates: Vehicle_VehicleState[] = ['PENDING_AUCTION', 'WAIT_AUCTION', 'PREVIEW', 'AUCTIONING', 'UNPAID', 'WAIT_PICKUP', 'TRANSFERRING', 'COMPLETED', 'CANCELED'];
exporting = false;
/**
* 表格列配置
......
......@@ -319,6 +319,95 @@
:rules="[{ required: true, message: '请输入车辆保管人联系方式!' },{ pattern: /^1(3|4|5|6|7|8|9)\d{9}$/, message: '手机号码格式不正确' }]">
<a-input v-model:value="formState.custodianInfo.custodianPhone" placeholder="请输入车辆保管人联系方式" :maxlength="11"/>
</a-form-item>
<!-- 过户资料 -->
<title-divider title="过户资料"></title-divider>
<div class="transfer-info-section">
<!-- 提示文案占满整行 -->
<a-alert
message='勾选=该资料"有",未勾选=该资料"无",车钥匙按套数录入,其他补充为自由文本。'
type="warning"
show-icon
style="width: 100%; margin-bottom: 16px"
/>
<!-- 字段列表 -->
<a-row :gutter="[16, 16]">
<a-col :span="12">
<div class="transfer-field-item">
<a-checkbox v-model:checked="formState.transferMaterials.registrationCertificate"></a-checkbox>
<span class="field-label">机动车登记本</span>
</div>
</a-col>
<a-col :span="12">
<div class="transfer-field-item">
<a-checkbox v-model:checked="formState.transferMaterials.vehicleLicense"></a-checkbox>
<span class="field-label">机动车行驶证</span>
</div>
</a-col>
<a-col :span="12">
<div class="transfer-field-item">
<a-checkbox v-model:checked="formState.transferMaterials.trafficAppScreenshot"></a-checkbox>
<span class="field-label">交管12123截图</span>
</div>
</a-col>
<a-col :span="12">
<div class="transfer-field-item">
<span class="field-label">车钥匙</span>
<a-input-number
v-model:value="formState.transferMaterials.carKeyCount"
:min="0"
:precision="0"
addon-after="套"
placeholder="请输入"
style="width: 120px; margin-left: 8px"
/>
</div>
</a-col>
<a-col :span="12">
<div class="transfer-field-item">
<a-checkbox v-model:checked="formState.transferMaterials.compulsoryInsurance"></a-checkbox>
<span class="field-label">交强险(保单或凭证)</span>
</div>
</a-col>
<a-col :span="12">
<div class="transfer-field-item">
<a-checkbox v-model:checked="formState.transferMaterials.transferAuthorizationPhoto"></a-checkbox>
<span class="field-label">过户授权委托书照片</span>
</div>
</a-col>
<a-col :span="12">
<div class="transfer-field-item">
<a-checkbox v-model:checked="formState.transferMaterials.purchaseTaxReceipt"></a-checkbox>
<span class="field-label">购置税证及收据</span>
</div>
</a-col>
<a-col :span="12">
<div class="transfer-field-item">
<a-checkbox v-model:checked="formState.transferMaterials.purchaseInvoice"></a-checkbox>
<span class="field-label">购车发票</span>
</div>
</a-col>
<a-col :span="12">
<div class="transfer-field-item">
<a-checkbox v-model:checked="formState.transferMaterials.commercialInsurance"></a-checkbox>
<span class="field-label">商业保险单或卡</span>
</div>
</a-col>
<a-col :span="24">
<div class="transfer-field-item transfer-field-input">
<span class="field-label" style="display: inline-block;width: 50px;margin-top: 8px;">其他</span>
<a-textarea
v-model:value="formState.transferMaterials.otherMaterialsNote"
placeholder="如有其他资料需交接,可在此处补充填写"
:rows="2"
:auto-size="{ minRows: 2, maxRows: 4 }"
style="margin-top: 8px"
/>
</div>
</a-col>
</a-row>
</div>
<a-form-item :wrapper-col="{ span: 19, offset: 6 }" class="footer-btns">
<a-button type="primary" class="mr-10" @click="submitForm">保存</a-button>
<a-button @click="handleBack(null)">返回</a-button>
......@@ -405,6 +494,7 @@ export default class VehicleForm extends FormComponent<Vehicle> {
vehicle.evaluationTransaction = new EvaluationTransaction();
vehicle.custodianInfo = new CustodianInfo();
vehicle.ownerInfo = new OwnerInfo();
vehicle.transferMaterials = {};
vehicle.registrationCertificate = "有";
vehicle.vehicleLicense = true;
this.formState = reactive<Vehicle>(vehicle);
......@@ -419,10 +509,12 @@ export default class VehicleForm extends FormComponent<Vehicle> {
const custodianInfo = vehicle.custodianInfo
const evaluationTransaction = vehicle.evaluationTransaction
const historyCondition = vehicle.historyCondition
const transferMaterials = vehicle.transferMaterials
if (!ownerInfo) vehicle.ownerInfo = new OwnerInfo()
if (!custodianInfo) vehicle.custodianInfo = new CustodianInfo()
if (!evaluationTransaction) vehicle.evaluationTransaction = new EvaluationTransaction()
if (!historyCondition) vehicle.historyCondition = new HistoryCondition()
if (!transferMaterials) vehicle.transferMaterials = {}
this.getCarTypeList(baseInfo.carSeriesId + "");
baseInfo.brandIds = [];
if (baseInfo.carBrandId) {
......@@ -557,6 +649,7 @@ export default class VehicleForm extends FormComponent<Vehicle> {
case 'edit':
formValue.vehicleId = this.formState.vehicleId;
delete this.formState._carModelData
if (this.formState?.transferMaterials?.otherMaterialsNote) this.formState.transferMaterials.otherMaterials = true
VehicleController.updateVehicle(this.axios, this.formState).then(response => {
message.success('修改成功');
this.handleBack(response.data);
......@@ -621,5 +714,28 @@ export default class VehicleForm extends FormComponent<Vehicle> {
</script>
<style lang="less" scoped>
// 过户资料区域
.transfer-info-section {
margin-bottom: 16px;
// 字段项样式
.transfer-field-item {
display: flex;
align-items: center;
.field-label {
margin-left: 8px;
color: #333;
font-size: 14px;
}
// 输入框字段(车钥匙、其他)特殊处理:标签在前,输入框在后
&.transfer-field-input {
align-items: flex-start;
.field-label {
margin-left: 0;
}
}
}
}
</style>
......@@ -10,7 +10,7 @@
</template>
编辑档案
</a-button>
<a-button type="default" style="margin-right: 8px;" v-if="editVehicle && Object.keys(vehicle._carModelData).length > 0 && vrAuditStatus" @click="changeCarModelData">替换为查博士信息</a-button>
<a-button type="default" style="margin-right: 8px;" v-if="editVehicle && vehicle._carModelData && Object.keys(vehicle._carModelData).length > 0 && vrAuditStatus" @click="changeCarModelData">替换为查博士信息</a-button>
<a-button type="default" v-if="editVehicle" :disabled="editVehicle" @click="editVehicleInfo">
<template #icon>
<EditOutlined class="mr-5"/>
......@@ -276,6 +276,53 @@
{{ vehicle.custodianInfo?.handoverAddress ?? '-' }}
</a-descriptions-item>
</a-descriptions>
<!-- 过户资料 -->
<a-descriptions v-if="vehicle" :bordered="false" :column="3" size="small" class="mt-10">
<template #title>
<title-tip-icon></title-tip-icon>
过户资料
</template>
<!-- 1. 机动车登记本 -->
<a-descriptions-item label="机动车登记本">
<span class="transfer-status">{{ vehicle.transferMaterials?.registrationCertificate ? '有' : '无' }}</span>
</a-descriptions-item>
<!-- 2. 机动车行驶证 -->
<a-descriptions-item label="机动车行驶证">
<span class="transfer-status">{{ vehicle.transferMaterials?.vehicleLicense ? '有' : '无' }}</span>
</a-descriptions-item>
<!-- 3. 交管12123截图 -->
<a-descriptions-item label="交管12123截图">
<span class="transfer-status">{{ vehicle.transferMaterials?.trafficAppScreenshot ? '有' : '无' }}</span>
</a-descriptions-item>
<!-- 4. 车钥匙 -->
<a-descriptions-item label="车钥匙">
{{ vehicle.transferMaterials?.carKeyCount ?? '-' }} 套
</a-descriptions-item>
<!-- 5. 交强险(保单或凭证) -->
<a-descriptions-item label="交强险(保单或凭证)">
<span class="transfer-status">{{ vehicle.transferMaterials?.compulsoryInsurance ? '有' : '无' }}</span>
</a-descriptions-item>
<!-- 6. 过户授权委托书照片 -->
<a-descriptions-item label="过户授权委托书照片">
<span class="transfer-status">{{ vehicle.transferMaterials?.transferAuthorizationPhoto ? '有' : '无' }}</span>
</a-descriptions-item>
<!-- 7. 购置税证及收据 -->
<a-descriptions-item label="购置税证及收据">
<span class="transfer-status">{{ vehicle.transferMaterials?.purchaseTaxReceipt ? '有' : '无' }}</span>
</a-descriptions-item>
<!-- 8. 购车发票 -->
<a-descriptions-item label="购车发票">
<span class="transfer-status">{{ vehicle.transferMaterials?.purchaseInvoice ? '有' : '无' }}</span>
</a-descriptions-item>
<!-- 9. 商业保险单或卡 -->
<a-descriptions-item label="商业保险单或卡">
<span class="transfer-status">{{ vehicle.transferMaterials?.commercialInsurance ? '有' : '无' }}</span>
</a-descriptions-item>
<!-- 10. 其他(占满整行,支持自动换行) -->
<a-descriptions-item label="其他" :span="2">
<div style="white-space: pre-wrap; word-break: break-all;">{{ vehicle.transferMaterials?.otherMaterialsNote || '-' }}</div>
</a-descriptions-item>
</a-descriptions>
</template>
<template v-else>
<vehicle-form ref="vehicleForm" :vehicle-id="vehicleId" :vr-audit-status="vrAuditStatus" @complete="editVehicleComplete"></vehicle-form>
......@@ -635,6 +682,11 @@ export default class ViewVehicle extends Vue {
padding-bottom: 4px;
}
// 过户资料状态文字样式
.transfer-status {
font-weight: 500;
margin-right: 8px;
}
.auditing-container {
border-radius: 8px;
......@@ -708,5 +760,4 @@ export default class ViewVehicle extends Vue {
color: #565D6B;
}
</style>
......@@ -31,6 +31,12 @@
<a-descriptions-item label="保留价">
¥{{ vehicle.reservePrice }}
</a-descriptions-item>
<a-descriptions-item label="成本价">
¥{{ vehicle.evaluationTransaction?.purchasePrice ?? '-' }}
</a-descriptions-item>
<a-descriptions-item label="预计经销差">
¥{{ expectedProfitMargin }}
</a-descriptions-item>
<a-descriptions-item label="延时规则">
最后{{ auctionVehicle.auction.beforeEndMinute }}分钟出价,延时{{ auctionVehicle.auction.delayMinute }}分钟
</a-descriptions-item>
......@@ -108,6 +114,24 @@ export default class AuctionVehicleHistory extends Vue {
}
}
/**
* 计算预计经销差(保留价 - 成本价)
* 使用 Math.round() 避免精度丢失
*/
get expectedProfitMargin(): string {
const reservePrice = this.vehicle.reservePrice;
const purchasePrice = this.vehicle.evaluationTransaction?.purchasePrice;
// 如果保留价或成本价为空,返回 '-'
if (!reservePrice || !purchasePrice) {
return '-';
}
// 使用 Math.round() 避免精度丢失,保留2位小数
const margin = Math.round((reservePrice - purchasePrice) * 100) / 100;
return margin.toFixed(2);
}
created() {
AuctionController.getAuctionVehiclesByVehicleId(this.axios, this.vehicle.vehicleId).then(response => {
this.auctionVehicles = response.data;
......
......@@ -83,4 +83,11 @@ export class AccountController {
// region 前端扩展代码区
// endregion
/**
* 发起平台合同签署
*/
static initiateSigningApi(axios: AxiosStatic): Promise<AxiosResponse<Account>> {
return axios.post('platformContract/initiateSigning');
}
}
......@@ -172,7 +172,9 @@ export default {
"COUPON_2": "优惠券协议2",
"COUPON_3": "优惠券协议3",
"COUPON_4": "优惠券协议4",
"COUPON_5": "优惠券协议5"
"COUPON_5": "优惠券协议5",
"PURCHASE_CONTRACT": "购车合同",
"PLATFORM_CONTRACT": "平台交易整体合同"
},
"agreementState": {
"DRAFT": "草稿",
......
......@@ -393,7 +393,9 @@
@close="closeBidSuccessDialog"></bid-success-dialog>
</van-dialog>
</view>
<van-dialog use-slot :show="showCertifyDialog" :show-cancel-button="false" :show-confirm-button="false">
<certification-dialog @close="onCertifyDialogClosed"></certification-dialog>
</van-dialog>
<coupon-home-benefit-popup v-if="!isSinglePageMode" :show="showCouponBenefitPopup" :payload="couponBenefitPayload"
@close="onCouponBenefitPopupClose" />
......@@ -429,7 +431,7 @@ import roundBidBottom from "@/module/auction/roundBidBottom.vue";
import RoundBidPopup from "@/components/RoundBidPopup.vue";
import customNav from "@/module/auction/customNav.vue";
import InspectionReport from "@/module/auction/InspectionReport.vue";
import CertificationDialog from "@/pages/tabbar/home/CertificationDialog.vue";
/**
* 检测是否处于微信朋友圈/短链「单页模式」。
* 必须在类字段初始化阶段同步调用:冷启动时 composable onLoad 可能尚未执行,
......@@ -468,7 +470,7 @@ function parseAucvehIdFromEnterOptions(): number | undefined {
}
@Component({
components: { BidSuccessDialog, roundBidBottom, RoundBidPopup, customNav, InspectionReport, CouponHomeBenefitPopup }
components: { CertificationDialog, BidSuccessDialog, roundBidBottom, RoundBidPopup, customNav, InspectionReport, CouponHomeBenefitPopup }
})
export default class AuctionVehiclePage extends Vue {
......@@ -573,7 +575,9 @@ export default class AuctionVehiclePage extends Vue {
lightBidPriceRange: LightBidPriceRange;
darkBidPriceRange: DarkBidPriceRange;
/** 认证弹窗延迟定时器(避免重复 onShow 叠加多个定时器) */
certifyDelayTimer: ReturnType<typeof setTimeout> | null = null;
showCertifyDialog = false;
change(e: any) {
// this.show = e.show
}
......@@ -892,7 +896,7 @@ export default class AuctionVehiclePage extends Vue {
// 代码请求优化
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
//this.auctionVehicle.auctionState === 'SOLD' &&
//this.auctionVehicle.auctionState === 'SOLD' &&
if (this.$auth.isLogin() && currentPage.route == 'module/auction/AuctionVehiclePage') {
this.intervalId = setInterval(() => {
AuctionOrderController.getAuctionOrderByVehicleId(this.axios, this.vehicle.vehicleId).then(res => {
......@@ -1088,6 +1092,10 @@ export default class AuctionVehiclePage extends Vue {
}
}
onCertifyDialogClosed(): void {
this.showCertifyDialog = false;
}
// 增加出价金额
addBidAmount(price: number) {
this.currentAddPrice = price;
......@@ -1157,6 +1165,15 @@ export default class AuctionVehiclePage extends Vue {
}
}
});
} else if (reason.data && reason.data.code === "platformContract") {
if (this.certifyDelayTimer != null) {
clearTimeout(this.certifyDelayTimer);
this.certifyDelayTimer = null;
}
this.certifyDelayTimer = setTimeout(() => {
this.certifyDelayTimer = null;
this.showCertifyDialog = true;
}, 1000);
}
}).finally(() => {
uni.hideLoading();
......
......@@ -335,7 +335,7 @@
{
"path": "CompanyCertificationPage",
"style": {
"navigationBarTitleText": "成为车商",
"navigationBarTitleText": "升级参拍权",
"enablePullDownRefresh": false
}
},
......
......@@ -32,8 +32,10 @@
</view>
<text class="agreement-text">
阅读并同意
<text class="agreement-link" @click="viewUserAgreement">《优加车拍二手车用户协议》</text>
<text class="agreement-link" @click="viewPrivacyAgreement">《优加车拍二手车隐私协议》</text>
<text class="agreement-link" @click="viewAgreement('ACCOUNT')">《用户协议》</text>
<text class="agreement-link" @click="viewAgreement('PRIVACY')">《隐私协议》</text>
<text class="agreement-link" @click="viewAgreement('PURCHASE_CONTRACT')">《购车合同》</text>
<text class="agreement-link" @click="viewAgreement('AUCTION')">《竞拍规则》</text>
未登录用户默认注册为平台会员
</text>
</view>
......@@ -139,14 +141,9 @@ export default class LoginPage extends Vue {
this.isAgreed = !this.isAgreed;
}
// 查看用户协议
viewUserAgreement() {
uni.navigateTo({url: '/module/profile/AgreementPage?key=ACCOUNT'});
}
// 查看隐私协议
viewPrivacyAgreement() {
uni.navigateTo({url: '/module/profile/AgreementPage?key=PRIVACY'});
// 查看协议
viewAgreement(key) {
uni.navigateTo({url: `/module/profile/AgreementPage?key=${key}`});
}
}
</script>
......
......@@ -332,10 +332,9 @@ export default class HomePage extends Vue {
return;
}
const accountInfo = authService.getAuthentication();
/** 仅未认证/认证失败的 COMMON 用户走认证引导;已认证用户直接进入权益弹窗链路 */
/** 仅未认证/认证失败的 COMMON 用户走认证引导 或者未签署平台合同;已认证用户直接进入权益弹窗链路 */
const cs = accountInfo?.certifiedState;
const needP1 = !!(accountInfo && accountInfo.accountType === 'COMMON' && cs !== 'CERTIFICATING' && cs !== 'CERTIFIED');
const needP1 = (!!(accountInfo && accountInfo.accountType === 'COMMON' && cs !== 'CERTIFICATING' && cs !== 'CERTIFIED') || (accountInfo && !accountInfo.platformContractSigned));
if (needP1) {
if (this.certifyDelayTimer != null) {
clearTimeout(this.certifyDelayTimer);
......
......@@ -54,39 +54,57 @@
<template v-if="accountInfo">
<template v-if="accountInfo.accountType === 'COMMON'">
<template v-if="accountInfo?.certifiedState === 'UNCERTIFIED'">
<account-auth-section title="获得参拍权" desc="让每一次拍得得心应手" button="立即开通"
<account-auth-section title="完成认证,解锁竞拍权限" desc="出价前需完成验证" button="去认证"
url="/module/account/PersonCertificationPage"></account-auth-section>
</template>
<template v-if="accountInfo?.certifiedState === 'CERTIFICATING'">
<account-auth-section title="认证资料审核中" desc="认证资料审核中" button="查看详情"
<account-auth-section title="认证资料审核中" desc="出价前需完成验证" button="去查看"
url="/module/account/CertificationResult"></account-auth-section>
</template>
<template v-if="accountInfo?.certifiedState === 'CERTIFY_FAILED'">
<account-auth-section title="认证失败" desc="让获得更专业的服务" button="查看详情"
<account-auth-section title="认证失败,请重新认证" desc="出价前需完成验证" button="去认证"
url="/module/account/CertificationResult"></account-auth-section>
</template>
</template>
<template v-if="accountInfo.accountType === 'PERSON'">
<!-- 个人未认证 -->
<template
v-if="accountInfo?.certifiedState === 'UNCERTIFIED' || accountInfo?.certifiedState === 'CERTIFIED'">
<account-auth-section title="升级参拍权" desc="让获得更专业的服务" button="立即升级"
url="/module/account/CompanyCertificationPage"></account-auth-section>
v-if="accountInfo?.certifiedState === 'UNCERTIFIED'">
<account-auth-section title="完成认证,解锁竞拍权限" desc="出价前需完成验证" button="去认证"
url="/module/account/PersonCertificationPage"></account-auth-section>
</template>
<!-- 个人认证中 -->
<template v-if="accountInfo?.certifiedState === 'CERTIFICATING'">
<account-auth-section title="认证资料审核中" desc="认证资料审核中" button="查看详情"
<account-auth-section title="认证资料审核中" desc="出价前需完成验证" button="去查看"
url="/module/account/CertificationResult"></account-auth-section>
</template>
<!-- 个人认证失败 -->
<template v-if="accountInfo?.certifiedState === 'CERTIFY_FAILED'">
<account-auth-section title="认证失败" desc="让获得更专业的服务" button="查看详情"
<account-auth-section title="认证失败,请重新认证" desc="出价前需完成验证" button="去认证"
url="/module/account/CertificationResult"></account-auth-section>
</template>
<!-- 个人认证成功未签署合同 -->
<template v-if="accountInfo?.certifiedState === 'CERTIFIED' && !accountInfo?.platformContractSigned && !accountInfo?.signDeadline">
<account-auth-section title="认证成功,待签署合同" desc="合同签署成功后即可参拍" button="去签署"
url="/module/account/CertificationResult"></account-auth-section>
</template>
<!-- 合同签署中 -->
<template v-if="accountInfo?.certifiedState === 'CERTIFIED' && isSignDeadline">
<account-auth-section title="合同签署中" desc="合同签署成功后即可参拍" button="去查看"
url="/module/account/CertificationResult"></account-auth-section>
</template>
<!-- 升级到车商参拍权 -->
<template v-if="accountInfo?.certifiedState === 'CERTIFIED' && accountInfo?.platformContractSigned && accountInfo?.platformContractSignTime">
<account-auth-section title="恭喜你,获得参拍资格" desc="点击查看按钮可继续升级参拍权" button="去查看"
url="/module/account/CompanyCertificationPage"></account-auth-section>
</template>
</template>
<template v-if="accountInfo.accountType === 'COMPANY'">
</template>
</template>
<template v-else>
<account-auth-section title="获得参拍权" desc="让每一次拍得得心应手" button="立即开通"
<account-auth-section title="完成认证,解锁竞拍权限" desc="出价前需完成验证" button="去认证"
url="/pages/LoginPage"></account-auth-section>
</template>
<!-- 常用工具 -->
......@@ -373,6 +391,25 @@ export default class ProfilePage extends Vue {
return couponImageUrl("ticket.png");
}
/**
* 判断签署截止时间是否大于当前时间
* 用于显示"合同签署中"状态
*/
get isSignDeadline(): boolean {
if (!this.accountInfo?.signDeadline) {
return false;
}
try {
const signDeadline = new Date(this.accountInfo.signDeadline);
const now = new Date();
return signDeadline > now;
} catch (error) {
console.error('签署截止时间解析失败:', error);
return false;
}
}
previewAvatar(): void {
if (this.accountInfo?.avatar && this.accountInfo.avatar?.url) {
uni.previewImage({ urls: [this.accountInfo.avatar.url], current: 0 });
......
<template>
<view class="dialog-container">
<view class="dialog-body">
<view class="dialog-close" @click="closeDialog">
<text class="close-icon">×</text>
</view>
<view class="dialog-icon">
<van-image width="80" height="88" fit="cover" src="/static/images/account/certifition/certifition.png"></van-image>
</view>
......@@ -8,97 +11,105 @@
完成本人认证
</view>
<view class="dialog-content">
<text>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;完成后,您将获得在我们平台上架车辆的权限,享受安全、高效的交易环境</text>
<text>认证完成后,您将解锁海量优质车源的竞拍购车权限,畅享透明、安全、高效的在线交易体验。</text>
</view>
<view class="dialog-footer">
<van-button type="primary" hairline round block @click="goCertification">立即认证</van-button>
<view @click="closeDialog" class="popup-button-text">稍后认证</view>
<van-button type="primary" round block @click="goCertification">立即认证</van-button>
</view>
</view>
</view>
</template>
<script lang="ts">
import {Component, Vue} from "vue-facing-decorator";
import { AuthService } from "@/common/AuthService";
@Component({
components: {}
})
export default class CertificationDialog extends Vue {
goCertification(): void {
const authService: AuthService = this.$auth
this.$emit('close');
uni.navigateTo({url: '/module/account/PersonCertificationPage'});
if (authService.accountInfo.certifiedState == 'UNCERTIFIED') {
uni.navigateTo({url: '/module/account/PersonCertificationPage'})
} else {
uni.navigateTo({url: '/module/account/CertificationResult'})
}
}
closeDialog(): void {
this.$emit('close');
}
}
</script>
<style lang="scss" scoped>
.dialog-container {
//height: 200px;
//min-height: 100vh;
/* 避免内容被顶部导航栏遮挡(可选) */
//padding-top: var(--status-bar-height);
//box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
}
.bg-image {
background-attachment: inherit; /* 将背景图固定不动 */
.dialog-body {
position: relative;
padding: 32px 24px 28px;
background: #fff;
border-radius: 16px;
box-sizing: border-box;
}
.dialog-body {
padding: 20px;
.dialog-close {
position: absolute;
top: 12px;
right: 12px;
width: 24px;
height: 24px;
display: flex;
align-items: center;
justify-content: center;
z-index: 1;
}
.close-icon {
font-size: 22px;
color: #999;
line-height: 1;
}
.dialog-icon {
text-align: center;
margin-bottom: 16px;
}
.dialog-header {
position: relative;
font-size: 22px;
font-weight: 400;
font-size: 20px;
font-weight: 500;
color: #141E34;
text-align: center;
margin-top: 20px;
margin-bottom: 10px;
margin-bottom: 12px;
}
.dialog-content {
position: relative;
padding: 4px 20px 12px 20px;
padding: 0 4px 24px;
text-align: center;
text {
text-indent: 2em;
font-size: 14px;
font-weight: 400;
line-height: 18.2px;
line-height: 1.6;
color: #676D7D;
text-justify: newspaper;
}
}
.dialog-footer {
margin-top: 20px;
position: relative;
display: flex;
flex-direction: column;
gap: 3px;;
}
.popup-button-text {
width: 100%;
height: 20px;
float: left;
line-height: 20px;
color: #666666;
font-size: 14px;
font-weight: 常规体;
font-family: "苹方-简";
text-align: center;
cursor: pointer;
margin-top: 16px;
.dialog-footer ::v-deep .van-button--primary {
background: #347BFF;
border-color: #347BFF;
height: 44px;
font-size: 16px;
font-weight: 500;
}
</style>
......@@ -50,8 +50,8 @@ export class Agreement extends AuditingEntity {
* ABOUT_US 关于我们
* COUPON_1 ~ COUPON_5 优惠券协议(多档活动可分别配置)
*/
export type Agreement_AgreementKey = 'AUCTION'|'TRANSACTION'|'VIOLATION'|'CONTRACT'|'ACCOUNT'|'PRIVACY'|'ABOUT_US'|'FAPAI_ACCOUNT'|'FAPAI_PRIVACY'|'COUPON_1'|'COUPON_2'|'COUPON_3'|'COUPON_4'|'COUPON_5';
export const AGREEMENT_AGREEMENT_KEYS = ['AUCTION','TRANSACTION','VIOLATION','CONTRACT','ACCOUNT','PRIVACY','ABOUT_US', 'FAPAI_ACCOUNT', 'FAPAI_PRIVACY', 'COUPON_1', 'COUPON_2', 'COUPON_3', 'COUPON_4', 'COUPON_5'];
export type Agreement_AgreementKey = 'AUCTION'|'TRANSACTION'|'VIOLATION'|'CONTRACT'|'ACCOUNT'|'PRIVACY'|'ABOUT_US'|'FAPAI_ACCOUNT'|'FAPAI_PRIVACY'|'COUPON_1'|'COUPON_2'|'COUPON_3'|'COUPON_4'|'COUPON_5'|'PURCHASE_CONTRACT'|'PLATFORM_CONTRACT';
export const AGREEMENT_AGREEMENT_KEYS = ['AUCTION','TRANSACTION','VIOLATION','CONTRACT','ACCOUNT','PRIVACY','ABOUT_US', 'FAPAI_ACCOUNT', 'FAPAI_PRIVACY', 'COUPON_1', 'COUPON_2', 'COUPON_3', 'COUPON_4', 'COUPON_5', 'PURCHASE_CONTRACT', 'PLATFORM_CONTRACT'];
/**
* DRAFT 草稿
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!