This commit is contained in:
parent
181a93e314
commit
a28cc75da8
|
|
@ -20,22 +20,32 @@
|
||||||
<view class="banner-section" v-if="bannerList && bannerList.length">
|
<view class="banner-section" v-if="bannerList && bannerList.length">
|
||||||
|
|
||||||
<!-- 轮播图区域 -->
|
<!-- 轮播图区域 -->
|
||||||
<swiper class="banner-swiper" circular @change="onSwiperChange" :autoplay="false" :current="currentBannerIndex">
|
<swiper class="banner-swiper" circular @change="onSwiperChange" :autoplay="true" :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-item v-for="(item, index) in bannerList" :key="index">
|
<swiper-item v-for="(item, index) in bannerList" :key="index">
|
||||||
<image class="banner-img" :src="item" mode="aspectFill"></image>
|
<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-item>
|
||||||
</swiper>
|
</swiper>
|
||||||
|
|
||||||
<!-- 指示器 -->
|
<!-- 指示器 -->
|
||||||
<view class="indicator" v-if="bannerList.length > 0">
|
<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>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
@ -216,6 +226,8 @@ export default {
|
||||||
phoneIconRight: 50, // 顶部电话图标初始Right
|
phoneIconRight: 50, // 顶部电话图标初始Right
|
||||||
|
|
||||||
currentBannerIndex: 0,
|
currentBannerIndex: 0,
|
||||||
|
showVideo: false,
|
||||||
|
isVideoPlaying: false,
|
||||||
isExpanded: false,
|
isExpanded: false,
|
||||||
activeTab: 0,
|
activeTab: 0,
|
||||||
|
|
||||||
|
|
@ -303,10 +315,7 @@ export default {
|
||||||
showTabSection() {
|
showTabSection() {
|
||||||
return this.availableTabs.length > 0;
|
return this.availableTabs.length > 0;
|
||||||
},
|
},
|
||||||
// 总轮播数(视频+图片)
|
|
||||||
totalSlides() {
|
|
||||||
return this.bannerList.length + (this.info.video ? 1 : 0);
|
|
||||||
},
|
|
||||||
canSubmit() {
|
canSubmit() {
|
||||||
const d = this.formData;
|
const d = this.formData;
|
||||||
const baseValid = d.contact_name && d.contact_phone && d.province_code && d.city_code && d.area_code && d.intention;
|
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 里面写的一样
|
// 每次进入页面时,根据 accessToken 刷新登录状态,就像 my-page 里面写的一样
|
||||||
this.isLogin = uni.getStorageSync("accessToken") ? true : false;
|
this.isLogin = uni.getStorageSync("accessToken") ? true : false;
|
||||||
},
|
},
|
||||||
|
onBackPress() {
|
||||||
|
if (this.showVideo) {
|
||||||
|
this.closeVideo();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 弹窗组件相关方法
|
// 弹窗组件相关方法
|
||||||
closePopup() {
|
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() {
|
onVideoPlay() {
|
||||||
console.log('视频开始播放');
|
this.isVideoPlaying = true;
|
||||||
},
|
},
|
||||||
onVideoPause() {
|
onVideoPause() {
|
||||||
console.log('视频暂停');
|
this.isVideoPlaying = false;
|
||||||
},
|
},
|
||||||
onVideoEnded() {
|
onVideoEnded() {
|
||||||
// 视频播放结束,切换到下一张图片
|
// 视频播放结束,关闭视频层
|
||||||
if (this.bannerList.length > 0) {
|
this.closeVideo();
|
||||||
this.currentBannerIndex = 1;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 悬浮按钮切换 Mock 数据
|
// 悬浮按钮切换 Mock 数据
|
||||||
|
|
@ -749,6 +772,10 @@ export default {
|
||||||
.banner-swiper {
|
.banner-swiper {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
|
swiper-item {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.banner-img {
|
.banner-img {
|
||||||
|
|
@ -756,19 +783,51 @@ export default {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.center-play-icon {
|
.video-play-overlay {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 0;
|
||||||
left: 50%;
|
left: 0;
|
||||||
transform: translate(-50%, -50%);
|
width: 100%;
|
||||||
width: 120rpx;
|
height: 100%;
|
||||||
height: 120rpx;
|
display: flex;
|
||||||
z-index: 20;
|
align-items: center;
|
||||||
transition: opacity 0.3s;
|
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 {
|
.album {
|
||||||
|
|
|
||||||
|
|
@ -444,7 +444,6 @@ export default {
|
||||||
border-radius: 27rpx;
|
border-radius: 27rpx;
|
||||||
margin-right: 40rpx;
|
margin-right: 40rpx;
|
||||||
padding: 9rpx 24rpx;
|
padding: 9rpx 24rpx;
|
||||||
transition: all 0.3s ease;
|
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
color: #FF4767;
|
color: #FF4767;
|
||||||
|
|
|
||||||
|
|
@ -6,26 +6,13 @@
|
||||||
<view class="tip">请输入6位核销码</view>
|
<view class="tip">请输入6位核销码</view>
|
||||||
|
|
||||||
<view class="code-inputs" @tap="focusInput">
|
<view class="code-inputs" @tap="focusInput">
|
||||||
<view
|
<view class="input-box" :class="{ filled: code[i - 1] }" v-for="i in 6" :key="i">
|
||||||
class="input-box"
|
{{ code[i - 1] || '' }}
|
||||||
:class="{ filled: code[i-1] }"
|
|
||||||
v-for="i in 6"
|
|
||||||
:key="i"
|
|
||||||
>
|
|
||||||
{{ code[i-1] || '' }}
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<input
|
<input class="hidden-input" type="text" maxlength="6" :value="code" :focus="inputFocus"
|
||||||
class="hidden-input"
|
:selection-start="cursorPos" :selection-end="cursorPos" @input="onInput" @blur="onBlur" confirm-type="done" />
|
||||||
type="number"
|
|
||||||
maxlength="6"
|
|
||||||
:value="code"
|
|
||||||
:focus="inputFocus"
|
|
||||||
@input="onInput"
|
|
||||||
@blur="resetFocus"
|
|
||||||
confirm-type="done"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<button class="confirm-btn" :class="{ active: code.length === 6 }" @tap="submitCode">
|
<button class="confirm-btn" :class="{ active: code.length === 6 }" @tap="submitCode">
|
||||||
确认
|
确认
|
||||||
|
|
@ -43,18 +30,32 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
code: '',
|
code: '',
|
||||||
inputFocus: false
|
inputFocus: true,
|
||||||
|
isBlurred: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
computed: {
|
||||||
focusInput() {
|
// 光标永远定位在最后一位
|
||||||
this.inputFocus = false;
|
cursorPos() {
|
||||||
|
return this.code.length;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onReady() {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.inputFocus = true;
|
this.inputFocus = true;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
resetFocus() {
|
methods: {
|
||||||
|
focusInput() {
|
||||||
|
// 核心修复:无论如何,重新聚焦时强制光标在最后
|
||||||
this.inputFocus = false;
|
this.inputFocus = false;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.inputFocus = true;
|
||||||
|
this.isBlurred = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onBlur() {
|
||||||
|
this.isBlurred = true;
|
||||||
},
|
},
|
||||||
onInput(e) {
|
onInput(e) {
|
||||||
let value = e.detail.value;
|
let value = e.detail.value;
|
||||||
|
|
@ -65,25 +66,23 @@ export default {
|
||||||
submitCode() {
|
submitCode() {
|
||||||
if (this.code.length !== 6) {
|
if (this.code.length !== 6) {
|
||||||
uni.showToast({ title: '请输入6位核销码', icon: 'none' });
|
uni.showToast({ title: '请输入6位核销码', icon: 'none' });
|
||||||
|
this.focusInput();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uni.showLoading({ title: '查询订单中...', mask: true });
|
uni.showLoading({ title: '查询订单中...', mask: true });
|
||||||
|
|
||||||
// 统一调用查询接口,不要在这里调用核销接口
|
|
||||||
request.post('/sj/poster/getOrderByCode', {
|
request.post('/sj/poster/getOrderByCode', {
|
||||||
server_code: this.code
|
server_code: this.code
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
if (res.code === 200 && res.data) {
|
if (res.code === 200 && res.data) {
|
||||||
res.data.server_code = this.code;
|
res.data.server_code = this.code;
|
||||||
// 查询成功,带上数据跳 detail 页
|
|
||||||
const orderDataStr = encodeURIComponent(JSON.stringify(res.data));
|
const orderDataStr = encodeURIComponent(JSON.stringify(res.data));
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: `/pages/shop/verify/verify-order-detail?data=${orderDataStr}`
|
url: `/pages/shop/verify/verify-order-detail?data=${orderDataStr}`
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// 查询不到,跳 fail 页
|
|
||||||
uni.navigateTo({ url: '/pages/shop/verify/verify-fail' });
|
uni.navigateTo({ url: '/pages/shop/verify/verify-fail' });
|
||||||
}
|
}
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,9 @@
|
||||||
|
|
||||||
<scroll-view class="scroll-content" scroll-y="true">
|
<scroll-view class="scroll-content" scroll-y="true">
|
||||||
<view class="page-header">
|
<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-text-box">
|
||||||
<view class="header-title">工时订单</view>
|
<view class="header-title">工时订单</view>
|
||||||
<view class="header-sub">请确认核销订单信息~</view>
|
<view class="header-sub">请确认核销订单信息~</view>
|
||||||
|
|
@ -165,9 +167,9 @@ export default {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
uni.showToast({ title: '核销成功', icon: 'success' });
|
uni.showToast({ title: '核销成功', icon: 'success' });
|
||||||
setTimeout(() => {
|
uni.navigateTo({
|
||||||
uni.navigateBack();
|
url:'/pages/order/userorder-detail?order_id='+this.orderData.orderId
|
||||||
}, 1500);
|
})
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({ title: res.msg || '核销失败,请重试', icon: 'none' });
|
uni.showToast({ title: res.msg || '核销失败,请重试', icon: 'none' });
|
||||||
this.isVerifying = false;
|
this.isVerifying = false;
|
||||||
|
|
@ -251,9 +253,11 @@ export default {
|
||||||
height: 95rpx;
|
height: 95rpx;
|
||||||
margin-right: 20rpx;
|
margin-right: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-text-box {
|
.header-text-box {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
||||||
.header-title {
|
.header-title {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-size: 36rpx;
|
font-size: 36rpx;
|
||||||
|
|
@ -261,6 +265,7 @@ export default {
|
||||||
line-height: 50rpx;
|
line-height: 50rpx;
|
||||||
margin-bottom: 12rpx;
|
margin-bottom: 12rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-sub {
|
.header-sub {
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
|
|
@ -293,6 +298,7 @@ export default {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
color: #666666;
|
color: #666666;
|
||||||
line-height: 40rpx;
|
line-height: 40rpx;
|
||||||
|
|
||||||
.ml-10 {
|
.ml-10 {
|
||||||
margin-left: 6rpx;
|
margin-left: 6rpx;
|
||||||
}
|
}
|
||||||
|
|
@ -332,6 +338,7 @@ export default {
|
||||||
line-height: 42rpx;
|
line-height: 42rpx;
|
||||||
max-width: 380rpx;
|
max-width: 380rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.goods-quantity {
|
.goods-quantity {
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
|
|
@ -346,6 +353,7 @@ export default {
|
||||||
color: #333333;
|
color: #333333;
|
||||||
line-height: 50rpx;
|
line-height: 50rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.money-symbol1 {
|
.money-symbol1 {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
}
|
}
|
||||||
|
|
@ -359,8 +367,13 @@ export default {
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: baseline;
|
align-items: baseline;
|
||||||
|
|
||||||
&.mt-10 { margin-top: 20rpx; }
|
&.mt-10 {
|
||||||
&.mt-15 { margin-top: 30rpx; }
|
margin-top: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.mt-15 {
|
||||||
|
margin-top: 30rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.label {
|
.label {
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
|
|
@ -421,6 +434,7 @@ export default {
|
||||||
color: #FF4767;
|
color: #FF4767;
|
||||||
line-height: 56rpx;
|
line-height: 56rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.money-symbol2 {
|
.money-symbol2 {
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
margin-right: 5rpx;
|
margin-right: 5rpx;
|
||||||
|
|
|
||||||
|
|
@ -80,13 +80,13 @@ export default {
|
||||||
this.isProcessing = false;
|
this.isProcessing = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
console.log('扫码结果:-----------', code)
|
||||||
uni.showLoading({ title: '查询订单中...' });
|
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();
|
uni.hideLoading();
|
||||||
|
if (result.code == 200) {
|
||||||
if (result.code === 200 && result.data) {
|
|
||||||
result.data.server_code = code;
|
result.data.server_code = code;
|
||||||
uni.showToast({ title: '扫码成功!', icon: 'none' });
|
uni.showToast({ title: '扫码成功!', icon: 'none' });
|
||||||
const orderDataStr = encodeURIComponent(JSON.stringify(result.data));
|
const orderDataStr = encodeURIComponent(JSON.stringify(result.data));
|
||||||
|
|
@ -96,11 +96,14 @@ export default {
|
||||||
// 延迟重置防抖,避免重复扫码跳转
|
// 延迟重置防抖,避免重复扫码跳转
|
||||||
setTimeout(() => { this.isProcessing = false; }, 1000);
|
setTimeout(() => { this.isProcessing = false; }, 1000);
|
||||||
} else {
|
} else {
|
||||||
|
console.log('失败1')
|
||||||
// 失败直接跳 fail 页
|
// 失败直接跳 fail 页
|
||||||
this.isProcessing = false; // 必须马上重置,保证退回该页时能继续扫
|
this.isProcessing = false; // 必须马上重置,保证退回该页时能继续扫
|
||||||
uni.navigateTo({ url: '/pages/shop/verify/verify-fail' });
|
uni.navigateTo({ url: '/pages/shop/verify/verify-fail' });
|
||||||
}
|
}
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
|
console.log('失败2')
|
||||||
|
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
this.isProcessing = false;
|
this.isProcessing = false;
|
||||||
uni.navigateTo({ url: '/pages/shop/verify/verify-fail' });
|
uni.navigateTo({ url: '/pages/shop/verify/verify-fail' });
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue