2026-05-26 10:12:26 +08:00
|
|
|
<template>
|
|
|
|
|
<view class="manual-verify">
|
|
|
|
|
<CustomNavbar title="" backgroundColor="#FFFFFF"></CustomNavbar>
|
|
|
|
|
|
|
|
|
|
<view class="content">
|
|
|
|
|
<view class="tip">请输入6位核销码</view>
|
|
|
|
|
|
|
|
|
|
<view class="code-inputs" @tap="focusInput">
|
2026-06-05 18:20:19 +08:00
|
|
|
<view class="input-box" :class="{ filled: code[i - 1] }" v-for="i in 6" :key="i">
|
|
|
|
|
{{ code[i - 1] || '' }}
|
2026-05-26 10:12:26 +08:00
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
|
2026-06-05 18:20:19 +08:00
|
|
|
<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" />
|
2026-05-26 10:12:26 +08:00
|
|
|
|
2026-06-08 17:53:00 +08:00
|
|
|
<button class="confirm-btn" :class="{ active: code.length === 6 }" :disabled="code.length < 6" @tap="submitCode">
|
2026-05-26 10:12:26 +08:00
|
|
|
确认
|
|
|
|
|
</button>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import CustomNavbar from "@/components/custom-navbar/custom-navbar.vue";
|
|
|
|
|
import request from "@/utils/request";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
components: { CustomNavbar },
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
code: '',
|
2026-06-05 18:20:19 +08:00
|
|
|
inputFocus: true,
|
|
|
|
|
isBlurred: false
|
2026-05-26 10:12:26 +08:00
|
|
|
};
|
|
|
|
|
},
|
2026-06-05 18:20:19 +08:00
|
|
|
computed: {
|
|
|
|
|
// 光标永远定位在最后一位
|
|
|
|
|
cursorPos() {
|
|
|
|
|
return this.code.length;
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onReady() {
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.inputFocus = true;
|
|
|
|
|
});
|
|
|
|
|
},
|
2026-05-26 10:12:26 +08:00
|
|
|
methods: {
|
|
|
|
|
focusInput() {
|
2026-06-05 18:20:19 +08:00
|
|
|
// 核心修复:无论如何,重新聚焦时强制光标在最后
|
2026-05-26 10:12:26 +08:00
|
|
|
this.inputFocus = false;
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.inputFocus = true;
|
2026-06-05 18:20:19 +08:00
|
|
|
this.isBlurred = false;
|
2026-05-26 10:12:26 +08:00
|
|
|
});
|
|
|
|
|
},
|
2026-06-05 18:20:19 +08:00
|
|
|
onBlur() {
|
|
|
|
|
this.isBlurred = true;
|
2026-05-26 10:12:26 +08:00
|
|
|
},
|
|
|
|
|
onInput(e) {
|
|
|
|
|
let value = e.detail.value;
|
|
|
|
|
value = value.replace(/\D/g, '');
|
|
|
|
|
if (value.length > 6) value = value.slice(0, 6);
|
|
|
|
|
this.code = value;
|
|
|
|
|
},
|
|
|
|
|
submitCode() {
|
|
|
|
|
if (this.code.length !== 6) {
|
|
|
|
|
uni.showToast({ title: '请输入6位核销码', icon: 'none' });
|
2026-06-05 18:20:19 +08:00
|
|
|
this.focusInput();
|
2026-05-26 10:12:26 +08:00
|
|
|
return;
|
|
|
|
|
}
|
2026-06-05 18:20:19 +08:00
|
|
|
|
2026-05-26 13:58:25 +08:00
|
|
|
uni.showLoading({ title: '查询订单中...', mask: true });
|
2026-06-05 18:20:19 +08:00
|
|
|
|
2026-05-26 13:58:25 +08:00
|
|
|
request.post('/sj/poster/getOrderByCode', {
|
|
|
|
|
server_code: this.code
|
2026-05-26 10:12:26 +08:00
|
|
|
}).then(res => {
|
2026-05-26 13:58:25 +08:00
|
|
|
uni.hideLoading();
|
|
|
|
|
if (res.code === 200 && res.data) {
|
2026-06-03 16:37:31 +08:00
|
|
|
res.data.server_code = this.code;
|
2026-05-26 13:58:25 +08:00
|
|
|
const orderDataStr = encodeURIComponent(JSON.stringify(res.data));
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: `/pages/shop/verify/verify-order-detail?data=${orderDataStr}`
|
|
|
|
|
});
|
2026-05-26 10:12:26 +08:00
|
|
|
} else {
|
2026-05-26 13:58:25 +08:00
|
|
|
uni.navigateTo({ url: '/pages/shop/verify/verify-fail' });
|
2026-05-26 10:12:26 +08:00
|
|
|
}
|
|
|
|
|
}).catch(() => {
|
2026-05-26 13:58:25 +08:00
|
|
|
uni.hideLoading();
|
|
|
|
|
uni.navigateTo({ url: '/pages/shop/verify/verify-fail' });
|
2026-05-26 10:12:26 +08:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
.manual-verify {
|
|
|
|
|
padding-top: 150rpx;
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
min-height: 100vh;
|
|
|
|
|
|
|
|
|
|
.tip {
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
font-size: 46rpx;
|
|
|
|
|
color: #333333;
|
|
|
|
|
line-height: 65rpx;
|
|
|
|
|
text-align: left;
|
|
|
|
|
margin-bottom: 80rpx;
|
|
|
|
|
margin-left: 48rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.code-inputs {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
gap: 24rpx;
|
|
|
|
|
margin-bottom: 80rpx;
|
|
|
|
|
padding: 0 30rpx;
|
|
|
|
|
|
|
|
|
|
.input-box {
|
|
|
|
|
width: 88rpx;
|
|
|
|
|
height: 88rpx;
|
|
|
|
|
border-radius: 12rpx;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
font-size: 48rpx;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
color: #333;
|
|
|
|
|
background-color: #F3F3F3;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.confirm-btn {
|
|
|
|
|
margin: 0 49rpx;
|
|
|
|
|
background: #ff476685;
|
|
|
|
|
color: #fff;
|
|
|
|
|
border-radius: 88rpx;
|
|
|
|
|
height: 96rpx;
|
|
|
|
|
line-height: 96rpx;
|
|
|
|
|
font-size: 36rpx;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
box-shadow: 0 8rpx 20rpx rgba(255, 71, 103, 0.2);
|
|
|
|
|
transition: all 0.2s;
|
|
|
|
|
|
|
|
|
|
&.active {
|
|
|
|
|
background: #FF4767;
|
|
|
|
|
}
|
2026-06-08 17:53:00 +08:00
|
|
|
|
|
|
|
|
&[disabled] {
|
|
|
|
|
opacity: 1;
|
|
|
|
|
background: #ff476685;
|
|
|
|
|
color: #fff;
|
|
|
|
|
}
|
2026-05-26 10:12:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.hidden-input {
|
|
|
|
|
position: fixed;
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
width: 2px;
|
|
|
|
|
height: 2px;
|
|
|
|
|
opacity: 0;
|
|
|
|
|
background: transparent;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|