Commit 8234ec4f by yancanhua

fix: 轮询出价前端开发

1 parent 16644dfc
...@@ -69,9 +69,10 @@ export default class RoundBidPopup extends Vue { ...@@ -69,9 +69,10 @@ export default class RoundBidPopup extends Vue {
} }
setTimeoutSecond() { setTimeoutSecond() {
if (this.nextAucVehData.remainSecond) { if (this.nextAucVehData.remainSecond && Number(this.nextAucVehData.remainSecond) > 0) {
setTimeout(() => { setTimeout(() => {
this.nextAucVehData.remainSecond = Number(this.nextAucVehData.remainSecond) - 1; //取整数部分
this.nextAucVehData.remainSecond = Math.floor(Number(this.nextAucVehData.remainSecond)) - 1;
this.setTimeoutSecond(); this.setTimeoutSecond();
}, 1000); }, 1000);
} else { } else {
......
...@@ -61,8 +61,10 @@ ...@@ -61,8 +61,10 @@
</view> </view>
<view class="upBox_add"> <view class="upBox_add">
<view class="upBox_second">{{ pageData.remainSecond }}秒</view> <view class="upBox_second">{{ pageData.remainSecond }}秒</view>
<view class="border_solid"> <view @click="handleAddBid()" class="progress-circle-up" style="--progress: {{ progressValue }}%">
<view class="border_but" @click="handleAddBid()">{{ addPrice ? '+' : '' }}{{ addPrice }}</view> <view class="progress-inner-up">
<text class="progress-value" style="font-size: 12px;">+{{ addPrice }}</text>
</view>
</view> </view>
</view> </view>
</view> </view>
...@@ -95,9 +97,9 @@ ...@@ -95,9 +97,9 @@
</view> </view>
<view class="downBox_right"> <view class="downBox_right">
<view class="downBox_second">{{ pageData.remainSecond }}秒</view> <view class="downBox_second">{{ pageData.remainSecond }}秒</view>
<view class="downBox_border_solid"> <view @click="handleAddBid()" class="progress-circle" style="--progress: {{ progressValue }}%">
<view class="downBox_border_but" @click="handleAddBid()"> <view class="progress-inner">
{{ addPrice ? '+' : '' }}{{ addPrice }} <text class="progress-value">+{{ addPrice }}</text>
</view> </view>
</view> </view>
</view> </view>
...@@ -116,7 +118,10 @@ ...@@ -116,7 +118,10 @@
<view class="downBox_custom_hand"> <view class="downBox_custom_hand">
<view class="downBox_custom_input"> <view class="downBox_custom_input">
<view class="downBox_custom_unit">¥</view> <view class="downBox_custom_unit">¥</view>
<van-field :value="customBid" style="height: 36px;" placeholder="最低100" /> <view style="margin-top: 4px;">
<uni-easyinput v-model="customBid" type="number" :inputBorder="false" maxlength="6"
:clearable="false" placeholder="最低100"></uni-easyinput>
</view>
</view> </view>
<view class="downBox_custom_but" @click="handleCustomBidConfirm()">确认</view> <view class="downBox_custom_but" @click="handleCustomBidConfirm()">确认</view>
</view> </view>
...@@ -188,12 +193,9 @@ export default class roundBidBottom extends Vue { ...@@ -188,12 +193,9 @@ export default class roundBidBottom extends Vue {
@Prop({ type: Object, required: true }) @Prop({ type: Object, required: true })
auctionVehicle: any; auctionVehicle: any;
//页面状态 认证 COMMON 充值 NOTOPUP 等待开始 PREVIEW 进行中 AUCTIONING 结束 END 结束自动跳转 JUMP //页面状态 认证 COMMON 充值 NOTOPUP 等待开始 PREVIEW 进行中 AUCTIONING 结束 END 结束自动跳转 JUMP
pageState = 'COMMON'; pageState = 'COMMON';
endState = '1'; // 1 未成交 2 已中拍 3 未中拍 endState = '1'; // 1 未成交 2 已中拍 3 未中拍
//页面显示数据 //页面显示数据
pageData = { pageData = {
accountBidPrice: 0, // 用户出价 价格 accountBidPrice: 0, // 用户出价 价格
...@@ -206,19 +208,16 @@ export default class roundBidBottom extends Vue { ...@@ -206,19 +208,16 @@ export default class roundBidBottom extends Vue {
reservePriceType: 0, reservePriceType: 0,
bidPriceType: 0, bidPriceType: 0,
}; };
foldState = 'UP'; //展开 UP 收起 DOWN foldState = 'UP'; //展开 UP 收起 DOWN
addPrice = '100';//加价金额 addPrice = '100';//加价金额
remainingTime = '5';//剩余时间 remainingTime = '5';//剩余时间
isShowCustom = false; //是否显示自定义输入框 isShowCustom = false; //是否显示自定义输入框
customBid = ''; //自定义出价 customBid = ''; //自定义出价
resultPrice = 0; // 最终成交价 resultPrice = 0; // 最终成交价
orderId = ''; progressValue = 0; // 进度值
isAudio = false; // 是否是语音出价
//自定义金额 //自定义金额
operationButList = [{ value: '100', }, { value: '300', }, { value: '500', }, { value: '1000', }, { value: '自定义', }]; operationButList = [{ value: '100', }, { value: '300', }, { value: '500', }, { value: '1000', }, { value: '自定义', }];
...@@ -303,6 +302,7 @@ export default class roundBidBottom extends Vue { ...@@ -303,6 +302,7 @@ export default class roundBidBottom extends Vue {
//价格改变重新获取佣金 //价格改变重新获取佣金
if (this.pageData.price != data.price) { if (this.pageData.price != data.price) {
this.realCalcCommissionPriceData(); this.realCalcCommissionPriceData();
this.handleAudio();
} }
this.pageData = { ...this.pageData, ...data, remainSecond: Math.floor(data.remainSecond || 0) }; this.pageData = { ...this.pageData, ...data, remainSecond: Math.floor(data.remainSecond || 0) };
...@@ -313,7 +313,9 @@ export default class roundBidBottom extends Vue { ...@@ -313,7 +313,9 @@ export default class roundBidBottom extends Vue {
//拍卖结束后获取下一辆车及拍卖状态 //拍卖结束后获取下一辆车及拍卖状态
if (this.pageData.over) { if (this.pageData.over) {
this.pageState = 'END'; this.pageState = 'END';
this.getAccountBidResultData(); setTimeout(() => {
this.getAccountBidResultData();
}, 1000);
} }
// 获取当前路由地址 // 获取当前路由地址
...@@ -325,14 +327,22 @@ export default class roundBidBottom extends Vue { ...@@ -325,14 +327,22 @@ export default class roundBidBottom extends Vue {
this.getBidRemainSecData(); this.getBidRemainSecData();
}, 1000); }, 1000);
} }
this.calcProgress();
}); });
} }
//计算进度
calcProgress() {
const aucvehDuration = JSON.parse(this.auctionVehicle?.auction?.extraJson || '{}')?.aucvehDuration || 0;
const progress = (this.pageData.remainSecond || 0) / Number(aucvehDuration || 0);
this.progressValue = Math.floor(progress * 100);
}
//获取拍卖佣金 //获取拍卖佣金
realCalcCommissionPriceData() { realCalcCommissionPriceData() {
AuctionOrderController.realCalcCommissionPrice(this.axios, { aucvehId: this.auctionVehicle.aucvehId }).then(res => { AuctionOrderController.realCalcCommissionPrice(this.axios, { aucvehId: this.auctionVehicle.aucvehId }).then(res => {
const data = res.data?.data || {}; const data = res.data?.data || {};
this.pageData.commissionPrice = (Number(data.commissionPrice || 0)) / 10000; this.pageData.commissionPrice = Number(data.commissionPrice || 0);
}); });
} }
...@@ -345,7 +355,6 @@ export default class roundBidBottom extends Vue { ...@@ -345,7 +355,6 @@ export default class roundBidBottom extends Vue {
BidController.addBid(this.axios, bidRequest).then(res => { BidController.addBid(this.axios, bidRequest).then(res => {
setTimeout(() => { setTimeout(() => {
uni.showToast({ title: '出价成功', icon: 'success' }); uni.showToast({ title: '出价成功', icon: 'success' });
this.handleAudio();
}, 300); }, 300);
}).finally(() => { }).finally(() => {
uni.hideLoading(); uni.hideLoading();
...@@ -353,14 +362,19 @@ export default class roundBidBottom extends Vue { ...@@ -353,14 +362,19 @@ export default class roundBidBottom extends Vue {
} }
handleAudio() { handleAudio() {
console.log('播放音频'); const that = this;
const innerAudioContext = uni.createInnerAudioContext(); if (!that.isAudio) {
innerAudioContext.autoplay = true; console.log('播放音频isAudio', that.isAudio);
innerAudioContext.src = 'https://img02.glsx.com.cn/aus/images/roundBid/notice.mp3'; that.isAudio = true;
innerAudioContext.onEnded(() => { const innerAudioContext = uni.createInnerAudioContext();
innerAudioContext.destroy(); innerAudioContext.autoplay = true;
console.log('音频播放完成'); innerAudioContext.src = 'https://img02.glsx.com.cn/aus/images/roundBid/notice.mp3';
}); innerAudioContext.onEnded(() => {
innerAudioContext.destroy();
that.isAudio = false;
console.log('音频播放完成isAudio', that.isAudio);
});
}
} }
//获取拍卖结果 //获取拍卖结果
...@@ -371,27 +385,19 @@ export default class roundBidBottom extends Vue { ...@@ -371,27 +385,19 @@ export default class roundBidBottom extends Vue {
this.resultPrice = (Number(data.price || 0)) / 10000; this.resultPrice = (Number(data.price || 0)) / 10000;
if (this.endState != '2') { if (this.endState != '2') {
this.getNextAucVehData(); this.getNextAucVehData();
if(this.pageState == 'END'){
this.noticeBidEnd();
}
} }
}); });
} }
//获取拍卖订单号 //签署购车合同
noticeBidEnd() { signContract() {
AuctionOrderController.getAuctionOrderByVehicleId(this.axios, this.auctionVehicle.vehicle.vehicleId).then(res => { AuctionOrderController.getAuctionOrderByVehicleId(this.axios, this.auctionVehicle.vehicle.vehicleId).then(res => {
if (res.data > 0) { if (res.data > 0 && res.data) {
this.orderId = res.data; uni.navigateTo({ url: '/module/order/contract/ContractPage?orderId=' + res.data });
} }
}); });
} }
//签署购车合同
signContract() {
uni.navigateTo({ url: '/module/order/contract/ContractPage?orderId=' + this.orderId });
}
//获取下一辆车 //获取下一辆车
getNextAucVehData() { getNextAucVehData() {
AuctionOrderController.getNextAucVeh(this.axios, { aucvehId: this.auctionVehicle.aucvehId }).then(res => { AuctionOrderController.getNextAucVeh(this.axios, { aucvehId: this.auctionVehicle.aucvehId }).then(res => {
...@@ -414,7 +420,6 @@ export default class roundBidBottom extends Vue { ...@@ -414,7 +420,6 @@ export default class roundBidBottom extends Vue {
this.isShowCustom = false; this.isShowCustom = false;
this.handleAddBid(); this.handleAddBid();
} else { } else {
// this.addPrice = '';
this.customBid = ''; this.customBid = '';
this.isShowCustom = true; this.isShowCustom = true;
} }
...@@ -423,25 +428,32 @@ export default class roundBidBottom extends Vue { ...@@ -423,25 +428,32 @@ export default class roundBidBottom extends Vue {
//自定义确认出价 //自定义确认出价
handleCustomBidConfirm() { handleCustomBidConfirm() {
if (!this.customBid) { if (!this.customBid) {
uni.showToast({ title: '请输入自定义加价金额', icon: 'none' }) return uni.showToast({ title: '请输入自定义加价金额', icon: 'none' })
} else { }
// this.addPrice = this.customBid; // 校验自定义加价金额是否为数字
this.handleAddBid(); if (isNaN(Number(this.customBid))) {
return uni.showToast({ title: '请输入正确的加价金额', icon: 'none' })
}
// 校验自定义加价金额是否符合规则
if (Number(this.customBid) < 100) {
return uni.showToast({ title: '自定义加价金额不能小于100', icon: 'none' })
} }
//校验加价金额必须是100的倍数
if (Number(this.customBid) % 100 != 0) {
return uni.showToast({ title: '自定义加价金额必须是100的倍数', icon: 'none' })
}
const bidPrice = Number(this.pageData.price || 0) + Number(this.customBid);
const bidRequest = { aucvehId: this.auctionVehicle.aucvehId, bidPrice: bidPrice };
uni.showLoading({ title: '正在提交竞价信息...', mask: true });
BidController.addBid(this.axios, bidRequest).then(res => {
setTimeout(() => {
uni.showToast({ title: '出价成功', icon: 'success' });
}, 300);
}).finally(() => {
uni.hideLoading();
});
} }
//自定义金额输入框
// handleCustomBidInput(value: any) {
// let numStr = String(value?.detail?.value || '').replace(/\D/g, '');
// let num = parseInt(numStr, 10);
// if (num > 0) {
// num = Math.floor(num / 100) * 100;
// if (num < 100) num = 100;
// this.customBid = num.toString();
// } else {
// this.customBid = '100';
// }
// }
} }
</script> </script>
...@@ -664,35 +676,6 @@ export default class roundBidBottom extends Vue { ...@@ -664,35 +676,6 @@ export default class roundBidBottom extends Vue {
font-family: "D-DIN-PRO"; font-family: "D-DIN-PRO";
} }
.border_solid {
width: 58px;
height: 58px;
float: left;
border: 3px solid #e3ebf4;
background: #f4f8ff;
border-radius: 50%;
margin-top: 8px;
margin-left: 8px;
margin-bottom: 8px;
}
.border_but {
width: 48px;
height: 48px;
float: left;
margin: 5px;
line-height: 48px;
text-align: center;
background: linear-gradient(148.6deg, #7aa3fe 0%, #185efe 100%);
box-shadow: 0 2px 4px 0 #8ab5e640;
border-radius: 50%;
color: #ffffff;
font-size: 14px;
font-weight: 700;
font-family: "D DIN PRO";
cursor: pointer;
}
.downBox { .downBox {
width: 100%; width: 100%;
min-height: 80px; min-height: 80px;
...@@ -734,33 +717,6 @@ export default class roundBidBottom extends Vue { ...@@ -734,33 +717,6 @@ export default class roundBidBottom extends Vue {
margin-right: 4px; margin-right: 4px;
} }
.downBox_border_solid {
width: 100px;
height: 100px;
float: left;
border: 4px solid #e3ebf4;
background: #f4f8ff;
border-radius: 50%;
margin-right: 40px;
margin-top: 16px;
}
.downBox_border_but {
width: 76px;
height: 76px;
float: left;
margin: 12px;
line-height: 76px;
text-align: center;
background: linear-gradient(148.6deg, #7aa3fe 0%, #185efe 100%);
box-shadow: 0 2px 4px 0 #8ab5e640;
border-radius: 50%;
color: #ffffff;
font-size: 18px;
font-weight: 500;
font-family: "D DIN PRO";
}
.downBox_list { .downBox_list {
width: 100%; width: 100%;
height: 20px; height: 20px;
...@@ -945,4 +901,64 @@ export default class roundBidBottom extends Vue { ...@@ -945,4 +901,64 @@ export default class roundBidBottom extends Vue {
.color3 { .color3 {
color: #F15662 !important; color: #F15662 !important;
} }
.progress-circle {
width: 108px;
height: 108px;
border-radius: 50%;
background: conic-gradient(#185efe 0% var(--progress), #e3ebf4 var(--progress) 100%);
display: flex;
align-items: center;
justify-content: center;
position: relative;
float: left;
margin-right: 40px;
margin-top: 16px;
}
.progress-inner {
width: 76px;
height: 76px;
background: linear-gradient(148.6deg, #7aa3fe 0%, #185efe 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
border: 10px solid #ffffff;
}
.progress-circle-up {
width: 58px;
height: 58px;
border-radius: 50%;
background: conic-gradient(#185efe 0% var(--progress), #e3ebf4 var(--progress) 100%);
display: flex;
align-items: center;
justify-content: center;
position: relative;
float: left;
margin-top: 8px;
margin-left: 8px;
margin-bottom: 8px;
}
.progress-inner-up {
width: 48px;
height: 48px;
background: linear-gradient(148.6deg, #7aa3fe 0%, #185efe 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
border: 5px solid #ffffff;
}
.progress-value {
width: 100%;
text-align: center;
color: #ffffff;
font-size: 18px;
font-weight: 500;
font-family: "D DIN PRO";
}
</style> </style>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!