Commit 16e918ae by yancanhua Committed by 章家宝

fix:前端轮询出价功能开发

1 parent f95dcca5
......@@ -106,10 +106,12 @@
</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="延时规则" name="beforeEndMinute" :rules="[{ required: true, message: '请输入延时规则!' }]" :label-col="{span: 3}" :wrapper-col="{span: 19}" class="row-item">
<a-form-item v-if="formState.auctionMode == '1'" label="延时规则" name="beforeEndMinute" :rules="[{ required: true, message: '请输入延时规则!' }]" :label-col="{span: 3}" :wrapper-col="{span: 19}" class="row-item">
<a-input-number v-model:value="formState.beforeEndMinute" addon-before="最后" :min="0" :step="1" :max="9999" :maxlength="4" addon-after="分钟内的出价" placeholder="请输入"/>
<a-input-number v-model:value="formState.delayMinute" addon-before="自动延时" :min="0" :step="1" :max="9999" :maxlength="4" addon-after="分钟" placeholder="请输入"/>
</a-form-item>
<a-form-item label="可参拍城市" name="cities" :rules="[{ required: true, message: '请输入可参拍城市!' },{validator: verifyCities,message: '参拍城市不能超过20个'}]" :label-col="{span: 3}"
:wrapper-col="{span: 19}" class="row-item">
<a-cascader v-model:value="formState.cities" :options="areaData" multiple placeholder="请选择" :show-checked-strategy="'SHOW_CHILD'" @change="handleCitiesChange"/>
......
......@@ -32,6 +32,8 @@
<vehicle-browser-history-page :aucveh-id="auctionVehicle.aucvehId"></vehicle-browser-history-page>
</a-tab-pane>
</a-tabs>
</div>
</template>
<script lang="ts">
......@@ -99,11 +101,15 @@ export default class ViewAuctionVehicle extends Vue {
const data = response.data || {};
const itemData = data.data || {};
that.auctionState = itemData.auctionState || '';
that.formatTime(600);
that.formatTime(itemData.remainSecond || 0);
if (that.auctionVehicle.auctionMode == 2 && itemData.auctionState == 'AUCTIONING' && itemData.remainSecond) {
setTimeout(() => {
that.getBidRemainSecData();
}, 1000);
//判断该组件是否销毁
// setTimeout(() => {
// that.getBidRemainSecData();
// }, 1000);
}
});
}
......
......@@ -34,7 +34,7 @@
</template>
<a-button v-else v-sec="'control_7'" type="link" size="small" @click="cancelAuctionVehicle(record)">中止</a-button>
</template>
<a-button type="link" v-if="auction.auctionMode == '2'" size="small" @click="handlePriceAdd(record)" >加价设置</a-button>
<a-button type="link" v-if="auction.auctionMode == '2' && record.auctionState == 'AUCTIONING'" size="small" @click="handlePriceAdd(record)" >加价设置</a-button>
</template>
</template>
<!--拍卖车辆列表end-->
......
......@@ -89,6 +89,30 @@ export class AuctionOrderController {
return axios.post('order/uploadTransferAuctionOrder', auctionOrder);
}
static checkDeposit(axios: AxiosStatic, signOrder: SignOrder): Promise<AxiosResponse<Contract>> {
return axios.post('auction/checkDeposit', signOrder);
}
static getBidRemainSec(axios: AxiosStatic, signOrder: SignOrder): Promise<AxiosResponse<Contract>> {
return axios.post('auction/lightPolling/getBidRemainSec', signOrder);
}
static realCalcCommissionPrice(axios: AxiosStatic, signOrder: SignOrder): Promise<AxiosResponse<Contract>> {
return axios.post('auction/realCalcCommissionPrice', signOrder);
}
static getAccountBidResult(axios: AxiosStatic, signOrder: SignOrder): Promise<AxiosResponse<Contract>> {
return axios.post('auction/getAccountBidResult', signOrder);
}
static getNextAucVeh(axios: AxiosStatic, signOrder: SignOrder): Promise<AxiosResponse<Contract>> {
return axios.post('auction/lightPolling/getNextAucVeh', signOrder);
}
// static checkDeposit(axios: AxiosStatic, signOrder: SignOrder): Promise<AxiosResponse<Contract>> {
// return axios.post('auction/checkDeposit', signOrder);
// }
// region 前端扩展代码区
// endregion
}
......@@ -14,7 +14,7 @@
<text class="feature-item" v-if="vehicle.coreSpecs.rlxs==='纯电动'">新能源</text>
</view>
<view class="car-price-container">
<image src="/static/images/auction/auction-tool.png" class="auction-icon" mode="aspectFit"></image>
<image src="https://img02.glsx.com.cn/aus/images/auction/auction-tool.png" class="auction-icon" mode="aspectFit"></image>
<text class="car-price" v-if="hasBidPrivilege">{{ $filters.formatNumber(vehicle.startingBidPrice / 10000) }}</text>
<text class="car-price" v-else>{{ maskBidPrice }}</text>
<text class="car-price car-price-unit">万</text>
......@@ -24,8 +24,8 @@
</view>
</view>
<view class="favorite-button" v-if="showFavorite" @click.stop="toggleFavorite()">
<van-image v-if="auctionVehicle.favorite" use-error-slot width="26" fit="cover" height="26" src="/static/images/auction/favorite.png"></van-image>
<van-image v-else use-error-slot width="26" fit="cover" height="26" src="/static/images/auction/un_favorite.png"></van-image>
<van-image v-if="auctionVehicle.favorite" use-error-slot width="26" fit="cover" height="26" src="https://img02.glsx.com.cn/aus/images/auction/favorite.png"></van-image>
<van-image v-else use-error-slot width="26" fit="cover" height="26" src="https://img02.glsx.com.cn/aus/images/auction/un_favorite.png"></van-image>
</view>
</view>
</template>
......
<template>
<view>
<uni-popup ref="popupRef" type="center" background-color="#fff" border-radius="24px" z-index="10000"
:show-close="false" :mask-click="false">
<view class="wrapper" v-if="endState == '1'">
<view class="top-bg">
<view class="top-icon">
<image src="https://img02.glsx.com.cn/aus/images/roundBid/pop_icon1.png"
class="top-icon-image" />
</view>
<view class="title">竞拍结束</view>
<view class="content">本场全部拍卖已结束</view>
<view class="popup-primary" @click="closePopup()">好的</view>
</view>
</view>
<view class="wrapper" v-if="endState == '2'">
<view class="top-bg">
<view class="top-icon">
<image src="https://img02.glsx.com.cn/aus/images/roundBid/pop_icon1.png"
class="top-icon-image" />
</view>
<view class="title">竞拍已结束</view>
<view class="content">{{ nextAucVehData.remainSecond || 0 }}s后将自动切换到下一台车</view>
<view class="operation_but">
<view class="operation_but_primary operation_but_2" @click="closePopup()">取消</view>
<view class="operation_but_primary operation_but_1" @click="toNextAucVeh()">
确认({{ nextAucVehData.remainSecond || 0 }}s)
</view>
</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script lang="ts">
import { Ref, Component, Vue } from "vue-facing-decorator";
@Component({})
export default class RoundBidPopup extends Vue {
@Ref popupRef: any;
nextAucVehData = {}; // 下一辆车数据
endState = '1'; // 1 已结束没有下一辆车 2 已结束有下一辆车
isClose = false;
created(): void {
}
//初始化数据
initData(data: any) {
this.nextAucVehData = data || {};
if (this.nextAucVehData.aucvehId) {
this.endState = '2';
this.isClose = false;
} else {
this.endState = '1';
this.isClose = true;
}
setTimeout(() => {
this.popupRef.open('center');
this.setTimeoutSecond();
}, 1000);
}
setTimeoutSecond() {
if (this.nextAucVehData.remainSecond) {
setTimeout(() => {
this.nextAucVehData.remainSecond = Number(this.nextAucVehData.remainSecond) - 1;
this.setTimeoutSecond();
}, 1000);
} else {
this.nextAucVehData.remainSecond = 0;
if (!this.isClose) {
this.toNextAucVeh();
}
}
}
//跳转到下一辆车
toNextAucVeh() {
this.popupRef.close('center');
uni.navigateTo({ url: '/module/auction/AuctionVehiclePage?aucvehId=' + this.nextAucVehData.aucvehId });
}
closePopup() {
this.isClose = true;
this.popupRef.close('center');
}
}
</script>
<style scoped lang="scss">
.wrapper {
width: 310px;
border-radius: 24px;
background: #ffffff;
}
.top-bg {
width: 100%;
height: 300px;
background-image: url("https://img02.glsx.com.cn/aus/images/preference/top-bg.png");
background-repeat: no-repeat;
background-size: 100%;
border-radius: 24px;
}
.top-icon {
width: 100px;
height: 100px;
float: left;
margin-top: 32px;
margin-left: 105px;
}
.top-icon-image {
width: 100px;
height: 100px;
z-index: -1;
}
.title {
width: 100%;
height: 26px;
float: left;
line-height: 26px;
color: #141e34;
font-size: 22px;
font-weight: 500;
font-family: "HarmonyOSSansSC";
text-align: center;
margin-top: 24px;
}
.content {
width: 100%;
height: 22px;
float: left;
color: #676d7d;
font-size: 14px;
font-weight: 常规体;
font-family: "苹方-简";
line-height: 22px;
text-align: center;
margin-top: 12px;
}
.popup-primary {
width: 262px;
height: 40px;
float: left;
line-height: 40px;
border-radius: 66px;
background: #185efe;
cursor: pointer;
text-align: center;
color: #ffffff;
font-size: 16px;
font-weight: 中黑体;
font-family: "苹方-简";
margin-top: 24px;
margin-left: 24px;
margin-right: 24px;
}
.operation_but {
width: 262px;
height: 40px;
float: left;
margin-top: 24px;
margin-left: 24px;
margin-right: 24px;
}
.operation_but_primary {
width: -webkit-calc(50% - 6px);
width: -moz-calc(50% - 6px);
width: calc(50% - 6px);
height: 40px;
float: left;
line-height: 40px;
border-radius: 66px;
cursor: pointer;
text-align: center;
font-size: 16px;
font-weight: 中黑体;
font-family: "苹方-简";
}
.operation_but_1 {
background: #185efe;
color: #ffffff;
margin-left: 12px;
}
.operation_but_2 {
background: #f2f3f5;
color: #666666;
}
</style>
......@@ -54,7 +54,7 @@
<text class="tag" v-if="vehicle.coreSpecs.rlxs==='纯电动'">新能源</text>
</view>
<view class="car-price">
<image src="/static/images/auction/auction-tool.png" class="auction-icon" mode="aspectFit"></image>
<image src="https://img02.glsx.com.cn/aus/images/auction/auction-tool.png" class="auction-icon" mode="aspectFit"></image>
<text class="price-value" v-if="hasBidPrivilege">{{ $filters.formatNumber(this.vehicle.startingBidPrice / 10000) }}</text>
<text class="price-value" v-else>{{ maskBidPrice }}</text>
<text class="price-unit">万</text>
......@@ -161,24 +161,37 @@
<uni-icons type="right" size="14" color="#999"/>
</view>
</view>
<view style="height: 60px">
<!-- 协议规则 -->
<view class="protocolBox" >
<view class="protocolBox-title">协议规则</view>
<view class="protocolBox-content" >
参拍默认遵守
<text class="protocolBox-rule" @click="navigateToAgreement('AUCTION')" >《竞拍规则》</text>
<text class="protocolBox-rule" @click="navigateToAgreement('VIOLATION')">《违约扣款规则》</text>
</view>
</view>
</view>
<view :style="{ height: auctionVehicle.auction.auctionMode == 2 ? '146px' : '60px' }"></view>
</view>
<!-- 底部操作栏 -->
<!-- <view class="bottom-action-bar">
<template v-if="auctionVehicle.auctionState==='AUCTIONING'">
<view class="bottom-action-bar" v-if="auctionVehicle.auction.auctionMode != 2">
<template v-if="auctionVehicle.auctionState === 'AUCTIONING'">
<van-button type="primary" hairline round block @click="showBidPopup">参与竞拍</van-button>
</template>
<template v-if="auctionVehicle.auctionState==='PREVIEW'">
<template v-if="auctionVehicle.auctionState === 'PREVIEW'">
<van-button type="default" hairline round block>预展中</van-button>
</template>
<van-button v-else type="default" hairline round block>竞拍已结束</van-button>
</view> -->
<!-- 轮询出价底部操作栏 -->
<roundBidBottom ref="roundBidBottomRef" :auctionVehicle="auctionVehicle" />
</view>
<!-- 轮询出价底部操作栏 -->
<view v-if="auctionVehicle.auction.auctionMode == 2">
<roundBidBottom ref="roundBidBottomRef" :auctionVehicle="auctionVehicle" @nextAucVehData="nextAucVeh" />
</view>
<!-- 轮询出价确认弹窗 -->
<RoundBidPopup ref="roundBidPopupRef" />
<uni-popup class="popup-modal" v-if="auctionVehicle&&(auctionVehicle.auctionState==='PREVIEW'||auctionVehicle.auctionState==='AUCTIONING')" ref="bidPopup" type="bottom"
background-color="#fff" @change="change">
......@@ -279,7 +292,7 @@
<!-- <van-dialog id="van-dialog"/>-->
<van-dialog use-slot :show="showBidSuccessDialog" :show-cancel-button="false" :show-confirm-button="false">
<bid-success-dialog :order-id="orderId" @close="closeBidSuccessDialog"></bid-success-dialog>
<bid-success-dialog :order-id="orderId" :auctionVehicle="auctionVehicle" @close="closeBidSuccessDialog"></bid-success-dialog>
</van-dialog>
</view>
</template>
......@@ -305,9 +318,10 @@ import {Recharge} from "lib/src/entity/finance/entity/Recharge";
import {DepositController} from "@/api/DepositController";
import roundBidBottom from "@/module/auction/roundBidBottom.vue";
import RoundBidPopup from "@/components/RoundBidPopup.vue";
@Component({
components: {BidSuccessDialog, roundBidBottom}
components: {BidSuccessDialog, roundBidBottom, RoundBidPopup}
})
export default class AuctionVehiclePage extends Vue {
amountStyle = {'font-size': '20px'};
......@@ -544,7 +558,10 @@ export default class AuctionVehiclePage extends Vue {
* 竞价结束回调
*/
noticeBidEnd() {
if (this.auctionVehicle.auctionState === 'SOLD' && this.$auth.isLogin()) {
// 代码请求优化
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
if (this.auctionVehicle.auctionState === 'SOLD' && this.$auth.isLogin() && currentPage.route == 'module/auction/AuctionVehiclePage') {
this.intervalId = setInterval(() => {
AuctionOrderController.getAuctionOrderByVehicleId(this.axios, this.vehicle.vehicleId).then(res => {
if (res.data > 0) {
......@@ -806,10 +823,14 @@ export default class AuctionVehiclePage extends Vue {
uni.navigateTo({url: url});
}
navigateToAgreement(event: any) {
navigateToAgreement(value: string) {
// 手动阻止事件冒泡
event.stopPropagation();
uni.navigateTo({url: '/module/profile/AgreementPage?key=AUCTION'});
// event.stopPropagation();
uni.navigateTo({url: '/module/profile/AgreementPage?key='+value});
}
nextAucVeh(data: any) {
this.$refs.roundBidPopupRef.initData(data);
}
// 定义分享内容(必写)
......@@ -839,6 +860,50 @@ export default class AuctionVehiclePage extends Vue {
</script>
<style lang="scss" scoped>
.protocolBox {
width: -webkit-calc(100% - 20px);
width: -moz-calc(100% - 20px);
width: calc(100% - 20px);
height: 90px;
border-radius: 10px;
background: #ffffff;
margin-left: 10px;
}
.protocolBox-title {
height: 26px;
line-height: 26px;
color: #333333;
font-size: 18px;
font-weight: 中黑体;
font-family: "苹方-简";
margin-top: 16px;
margin-left: 12px;
float: left;
}
.protocolBox-content {
width: -webkit-calc(100% - 24px);
width: -moz-calc(100% - 24px);
width: calc(100% - 24px);
height: 22px;
float: left;
color: #666666;
font-size: 14px;
font-weight: 常规体;
font-family: "苹方-简";
line-height: 22px;
margin-top: 10px;
margin-left: 12px;
}
.protocolBox-rule {
color: #2c66f7;
font-size: 14px;
cursor: pointer;
}
.car-detail-container {
//min-height: 100vh;
background-color: #f5f5f5;
......
......@@ -6,15 +6,26 @@
<van-image width="100" height="100" fit="cover" src="https://img02.glsx.com.cn/aus/images/order/payment.png"></van-image>
</view>
<view class="dialog-header">
恭喜你中拍成功
恭喜你中拍成功!
</view>
<view class="dialog-content">
<view v-if="auctionVehicle.auction.auctionMode != 2" class="dialog-content">
<text>请尽快签署购车协议,并支付款项以锁定车辆</text>
</view>
<view class="dialog-footer">
<van-button type="default" round block style="margin-bottom: 10px" @click="$emit('close')">知道了</van-button>
<van-button type="primary" hairline round block @click="signContract">去签署购车协议</van-button>
<view v-if="auctionVehicle.auction.auctionMode == 2" class="dialog-auctionMode" >
<view class="auctionMode-img">
<van-image width="28" height="28" style="margin: 6px;float: left;" fit="cover" src="https://img02.glsx.com.cn/aus/images/roundBid/title_icon.png"></van-image>
</view>
<view class="auctionMode-text">
已中拍车辆可在【我的-购车订单】中进行付款与确认购车 <text style="color: #185EFE;" @click="signContract" >前往购车确认</text>
</view>
</view>
<view class="dialog-footer">
<van-button class="dialog-footer_but" type="default" round block @click="$emit('close')">知道了</van-button>
<van-button class="dialog-footer_but" type="primary" style="margin-left: 12px;" hairline round block @click="signContract">去签署购车协议</van-button>
</view>
</view>
</view>
......@@ -32,6 +43,9 @@ export default class BidSuccessDialog extends Vue {
@Prop({type: Number, required: true})
orderId: number;
@Prop({ type: Object, required: true })
auctionVehicle: any;
signContract(): void {
this.$emit('close');
uni.navigateTo({
......@@ -82,10 +96,46 @@ export default class BidSuccessDialog extends Vue {
}
.dialog-footer {
margin-top: 20px;
position: relative;
display: flex;
flex-direction: column;
gap: 3px;;
width: 100%;
margin-top: 24px;
margin-bottom: 24px;
float: left;
}
.dialog-footer_but{
width: -webkit-calc(50% - 6px);
width: -moz-calc(50% - 6px);
width: calc(50% - 6px);
float: left;
}
.dialog-auctionMode {
width: 100%;
height: 56px;
border-radius: 4px;
background: linear-gradient(0deg, #edf6ff 0%, #f7fbff 100%);
margin-top: 16px;
float: left;
}
.auctionMode-img {
width: 40px;
height: 40px;
background: linear-gradient(0deg, #cce5ff 0%, #e6f4fe00 100%);
border-radius: 50%;
margin: 8px;
float: left;
}
.auctionMode-text{
width: -webkit-calc(100% - 64px);
width: -webkit-calc(100% - 64px);
width: -webkit-calc(100% - 64px);
float: left;
color: #676d7d;
font-size: 12px;
font-family: "苹方-简";
line-height: 20px;
margin: 8px 0;
}
</style>
......@@ -27,8 +27,8 @@
<text class="car-specs">出价时间:{{ bid.createTime }}</text>
</view>
<view class="favorite-button" @click.stop="toggleFavorite(bid)">
<van-image v-if="bid.auctionVehicle.favorite" use-error-slot width="26" fit="cover" height="26" src="/static/images/auction/favorite.png"></van-image>
<van-image v-else use-error-slot width="26" fit="cover" height="26" src="/static/images/auction/un_favorite.png"></van-image>
<van-image v-if="bid.auctionVehicle.favorite" use-error-slot width="26" fit="cover" height="26" src="https://img02.glsx.com.cn/aus/images/auction/favorite.png"></van-image>
<van-image v-else use-error-slot width="26" fit="cover" height="26" src="https://img02.glsx.com.cn/aus/images/auction/un_favorite.png"></van-image>
</view>
</view>
</template>
......
......@@ -11,7 +11,7 @@
<uni-search-bar v-else v-model="searchText" placeholder="搜索车型名称" radius="60" @clear="onDarkCancel" @confirm="onDarkSearch"
cancelButton="none" @cancel="onDarkCancel" bgColor="#fff" class="search-bar"/>
<view class="favorite-icon" @click="navigateTo('/module/profile/FavoritePage')">
<image src="/static/images/common/favorite.png"></image>
<image src="https://img02.glsx.com.cn/aus/images/auction/favorite.png"></image>
</view>
</view>
<!-- 拍卖类型切换 -->
......@@ -446,7 +446,7 @@ export default class AuctionPage extends PaginationComponent<Auction> {
.auction-left {
width: 120px;
margin-right: 20rpx;
background-image: url("../../static/images/auction/auction_cover.png");
background-image: url("https://img02.glsx.com.cn/aus/images/auction/auction_cover.png");
background-repeat: no-repeat;
background-size: 100%;
padding: 14px 12px 12px 12px;
......
......@@ -95,7 +95,7 @@
</view>
<view class="tool-item" @click="navigateTo('/module/profile/FavoritePage')">
<view class="tool-icon">
<image src="/static/images/profile/favorite.png" mode="aspectFill" class="tools-image"/>
<image src="https://img02.glsx.com.cn/aus/images/auction/favorite.png" mode="aspectFill" class="tools-image"/>
</view>
<text class="tool-name">我的收藏</text>
</view>
......
......@@ -38,7 +38,7 @@
</view>
<view class="car-price">
<image src="/static/images/auction/auction-tool.png" class="auction-icon" mode="aspectFit"></image>
<image src="https://img02.glsx.com.cn/aus/images/auction/auction-tool.png" class="auction-icon" mode="aspectFit"></image>
<text class="price-text">
<template v-if="hasBidPrivilege">
{{ $filters.formatNumber(this.vehicle.startingBidPrice / 10000) }}
......
......@@ -131,6 +131,7 @@ export class Auction extends AuditingEntity {
resetDelayDuration: string;
resetDelayDurationUnit: string;
extraJson:string;
aucvehDuration: string;
}
/**
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!