This commit is contained in:
丁杰 2026-06-05 18:20:19 +08:00
parent 181a93e314
commit a28cc75da8
5 changed files with 143 additions and 69 deletions

View File

@ -20,22 +20,32 @@
<view class="banner-section" v-if="bannerList && bannerList.length">
<!-- 轮播图区域 -->
<swiper class="banner-swiper" circular @change="onSwiperChange" :autoplay="false" :current="currentBannerIndex">
<!-- 视频作为第一项 -->
<swiper-item v-if="info.video">
<video id="myVideo" class="banner-video" :src="info.video" :autoplay="currentBannerIndex === 0" controls
object-fit="cover" :show-center-play-btn="false" :show-play-btn="false" @play="onVideoPlay"
@pause="onVideoPause" @ended="onVideoEnded"></video>
</swiper-item>
<!-- 图片轮播 -->
<swiper class="banner-swiper" circular @change="onSwiperChange" :autoplay="true" :current="currentBannerIndex">
<swiper-item v-for="(item, index) in bannerList" :key="index">
<image class="banner-img" :src="item" mode="aspectFill"></image>
<!-- 第一张图上显示视频播放按钮 -->
<view v-if="index === 0 && info.video" class="video-play-overlay" @click="playVideo">
<image class="video-play-icon"
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/107eb3d6-cb8f-4857-aaf0-8654203c1c52.png"
mode="aspectFit"></image>
</view>
</swiper-item>
</swiper>
<!-- 指示器 -->
<view class="indicator" v-if="bannerList.length > 0">
<text>{{ currentBannerIndex + 1 }} / {{ totalSlides }}</text>
<text>{{ currentBannerIndex + 1 }} / {{ bannerList.length }}</text>
</view>
<!-- 视频播放层 -->
<view v-if="showVideo" class="video-fullscreen-mask">
<video id="myVideo" class="fullscreen-video" :src="info.video" :autoplay="true" :controls="true"
object-fit="contain" :show-center-play-btn="true" :show-play-btn="true" @play="onVideoPlay"
@pause="onVideoPause" @ended="onVideoEnded">
<cover-view class="video-close-btn" @click.stop="closeVideo">
<cover-view class="video-close-icon" @click.stop="closeVideo">关闭</cover-view>
</cover-view>
</video>
</view>
</view>
@ -216,6 +226,8 @@ export default {
phoneIconRight: 50, // Right
currentBannerIndex: 0,
showVideo: false,
isVideoPlaying: false,
isExpanded: false,
activeTab: 0,
@ -303,10 +315,7 @@ export default {
showTabSection() {
return this.availableTabs.length > 0;
},
// +
totalSlides() {
return this.bannerList.length + (this.info.video ? 1 : 0);
},
canSubmit() {
const d = this.formData;
const baseValid = d.contact_name && d.contact_phone && d.province_code && d.city_code && d.area_code && d.intention;
@ -336,6 +345,13 @@ export default {
// accessToken my-page
this.isLogin = uni.getStorageSync("accessToken") ? true : false;
},
onBackPress() {
if (this.showVideo) {
this.closeVideo();
return true;
}
return false;
},
methods: {
//
closePopup() {
@ -502,17 +518,24 @@ export default {
},
//
playVideo() {
this.showVideo = true;
},
closeVideo() {
const videoContext = uni.createVideoContext('myVideo', this);
videoContext.stop();
this.showVideo = false;
this.isVideoPlaying = false;
},
onVideoPlay() {
console.log('视频开始播放');
this.isVideoPlaying = true;
},
onVideoPause() {
console.log('视频暂停');
this.isVideoPlaying = false;
},
onVideoEnded() {
//
if (this.bannerList.length > 0) {
this.currentBannerIndex = 1;
}
//
this.closeVideo();
},
// Mock
@ -749,6 +772,10 @@ export default {
.banner-swiper {
width: 100%;
height: 100%;
swiper-item {
position: relative;
}
}
.banner-img {
@ -756,19 +783,51 @@ export default {
height: 100%;
}
.center-play-icon {
.video-play-overlay {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 120rpx;
height: 120rpx;
z-index: 20;
transition: opacity 0.3s;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
z-index: 10;
}
&:active {
opacity: 0.8;
}
.video-play-icon {
width: 100rpx;
height: 100rpx;
}
.video-fullscreen-mask {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #000;
z-index: 9999;
display: flex;
align-items: center;
justify-content: center;
}
.video-close-btn {
position: absolute;
top: 140rpx;
right: 60rpx;
z-index: 10000;
}
.video-close-icon {
color: #fff;
font-size: 40rpx;
}
.fullscreen-video {
width: 100%;
height: 100%;
}
.album {

View File

@ -444,7 +444,6 @@ export default {
border-radius: 27rpx;
margin-right: 40rpx;
padding: 9rpx 24rpx;
transition: all 0.3s ease;
&.active {
color: #FF4767;

View File

@ -6,26 +6,13 @@
<view class="tip">请输入6位核销码</view>
<view class="code-inputs" @tap="focusInput">
<view
class="input-box"
:class="{ filled: code[i-1] }"
v-for="i in 6"
:key="i"
>
{{ code[i-1] || '' }}
<view class="input-box" :class="{ filled: code[i - 1] }" v-for="i in 6" :key="i">
{{ code[i - 1] || '' }}
</view>
</view>
<input
class="hidden-input"
type="number"
maxlength="6"
:value="code"
:focus="inputFocus"
@input="onInput"
@blur="resetFocus"
confirm-type="done"
/>
<input class="hidden-input" type="text" maxlength="6" :value="code" :focus="inputFocus"
:selection-start="cursorPos" :selection-end="cursorPos" @input="onInput" @blur="onBlur" confirm-type="done" />
<button class="confirm-btn" :class="{ active: code.length === 6 }" @tap="submitCode">
确认
@ -43,18 +30,32 @@ export default {
data() {
return {
code: '',
inputFocus: false
inputFocus: true,
isBlurred: false
};
},
computed: {
//
cursorPos() {
return this.code.length;
}
},
onReady() {
this.$nextTick(() => {
this.inputFocus = true;
});
},
methods: {
focusInput() {
//
this.inputFocus = false;
this.$nextTick(() => {
this.inputFocus = true;
this.isBlurred = false;
});
},
resetFocus() {
this.inputFocus = false;
onBlur() {
this.isBlurred = true;
},
onInput(e) {
let value = e.detail.value;
@ -65,25 +66,23 @@ export default {
submitCode() {
if (this.code.length !== 6) {
uni.showToast({ title: '请输入6位核销码', icon: 'none' });
this.focusInput();
return;
}
uni.showLoading({ title: '查询订单中...', mask: true });
//
request.post('/sj/poster/getOrderByCode', {
server_code: this.code
}).then(res => {
uni.hideLoading();
if (res.code === 200 && res.data) {
res.data.server_code = this.code;
// detail
const orderDataStr = encodeURIComponent(JSON.stringify(res.data));
uni.navigateTo({
url: `/pages/shop/verify/verify-order-detail?data=${orderDataStr}`
});
} else {
// fail
uni.navigateTo({ url: '/pages/shop/verify/verify-fail' });
}
}).catch(() => {

View File

@ -5,7 +5,9 @@
<scroll-view class="scroll-content" scroll-y="true">
<view class="page-header">
<image class="header-icon" src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/be13b4f4-c0db-4f39-b9fc-0e69c13b72ee.png" mode="aspectFit"></image>
<image class="header-icon"
src="https://mrrplus.oss-cn-beijing.aliyuncs.com/photo/system/be13b4f4-c0db-4f39-b9fc-0e69c13b72ee.png"
mode="aspectFit"></image>
<view class="header-text-box">
<view class="header-title">工时订单</view>
<view class="header-sub">请确认核销订单信息</view>
@ -165,9 +167,9 @@ export default {
uni.hideLoading();
if (res.code === 200) {
uni.showToast({ title: '核销成功', icon: 'success' });
setTimeout(() => {
uni.navigateBack();
}, 1500);
uni.navigateTo({
url:'/pages/order/userorder-detail?order_id='+this.orderData.orderId
})
} else {
uni.showToast({ title: res.msg || '核销失败,请重试', icon: 'none' });
this.isVerifying = false;
@ -251,9 +253,11 @@ export default {
height: 95rpx;
margin-right: 20rpx;
}
.header-text-box {
display: flex;
flex-direction: column;
.header-title {
font-weight: 500;
font-size: 36rpx;
@ -261,6 +265,7 @@ export default {
line-height: 50rpx;
margin-bottom: 12rpx;
}
.header-sub {
font-weight: 400;
font-size: 24rpx;
@ -293,6 +298,7 @@ export default {
font-size: 28rpx;
color: #666666;
line-height: 40rpx;
.ml-10 {
margin-left: 6rpx;
}
@ -332,6 +338,7 @@ export default {
line-height: 42rpx;
max-width: 380rpx;
}
.goods-quantity {
font-weight: 400;
font-size: 28rpx;
@ -346,6 +353,7 @@ export default {
color: #333333;
line-height: 50rpx;
}
.money-symbol1 {
font-size: 24rpx;
}
@ -359,8 +367,13 @@ export default {
justify-content: space-between;
align-items: baseline;
&.mt-10 { margin-top: 20rpx; }
&.mt-15 { margin-top: 30rpx; }
&.mt-10 {
margin-top: 20rpx;
}
&.mt-15 {
margin-top: 30rpx;
}
.label {
font-weight: 400;
@ -421,6 +434,7 @@ export default {
color: #FF4767;
line-height: 56rpx;
}
.money-symbol2 {
font-size: 26rpx;
margin-right: 5rpx;

View File

@ -80,13 +80,13 @@ export default {
this.isProcessing = false;
return;
}
console.log('扫码结果:-----------', code)
uni.showLoading({ title: '查询订单中...' });
request.post('/sj/poster/getOrderByCode', { server_code: code }).then(result => {
request.post('/sj/poster/getOrderByCode', { encrypted: code }).then(result => {
console.log(result,'resultresultresultresult0.0.0.0.0.0')
uni.hideLoading();
if (result.code === 200 && result.data) {
if (result.code == 200) {
result.data.server_code = code;
uni.showToast({ title: '扫码成功!', icon: 'none' });
const orderDataStr = encodeURIComponent(JSON.stringify(result.data));
@ -96,11 +96,14 @@ export default {
// 延迟重置防抖,避免重复扫码跳转
setTimeout(() => { this.isProcessing = false; }, 1000);
} else {
console.log('失败1')
// 失败直接跳 fail 页
this.isProcessing = false; // 必须马上重置,保证退回该页时能继续扫
uni.navigateTo({ url: '/pages/shop/verify/verify-fail' });
}
}).catch((err) => {
console.log('失败2')
uni.hideLoading();
this.isProcessing = false;
uni.navigateTo({ url: '/pages/shop/verify/verify-fail' });