fix: 只要任意一张实名了就可以不强制跳
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 59s

This commit is contained in:
luo
2026-07-29 15:48:22 +08:00
parent 34ca1c5eca
commit 6c3cf15165
7 changed files with 48 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
export { authApi } from './modules/auth.js';
export { assetApi } from './modules/asset.js';
export { assetApi, isAssetRealNameCompleted } from './modules/asset.js';
export { deviceApi } from './modules/device.js';
export { exchangeApi } from './modules/exchange.js';
export { orderApi } from './modules/order.js';

View File

@@ -19,6 +19,14 @@ export const normalizeAssetInfo = (data = {}) => ({
: data.is_expiring === true || data.is_expiring === 1
});
export const isAssetRealNameCompleted = (assetInfo = {}) => {
if (assetInfo.asset_type === 'device') {
return (assetInfo.cards || []).some((card) => Number(card?.real_name_status) === 1);
}
return Number(assetInfo.real_name_status) === 1;
};
export const assetApi = {
getInfo(identifier) {
return request({

View File

@@ -42,7 +42,7 @@
<script setup>
import { ref, computed } from 'vue';
import { assetApi, orderApi } from '@/api/index.js';
import { assetApi, isAssetRealNameCompleted, orderApi } from '@/api/index.js';
import {
handlePaymentError,
isValidAlipayPaymentLink,
@@ -110,7 +110,7 @@
}
if (assetInfo.value.effective_realname_policy === 'before_order' &&
assetInfo.value.realname_required && Number(assetInfo.value.real_name_status) !== 1) {
assetInfo.value.realname_required && !isAssetRealNameCompleted(assetInfo.value)) {
uni.showModal({
title: '需要实名认证',
content: '当前资产下单前需要完成实名认证',

View File

@@ -18,14 +18,16 @@
{{ networkStatus == 1 ? '正常' : '停机' }}
</view>
</view>
<button class="renew-button" @tap.stop="emit('renew')">立即续费</button>
<button v-if="hasPackageName" class="renew-button" @tap.stop="emit('renew')">立即续费</button>
</view>
</template>
<script setup>
import { computed } from 'vue';
const emit = defineEmits(['renew']);
defineProps({
const props = defineProps({
currentCardNo: { type: String, default: '' },
deviceInfo: { type: Object, default: () => ({}) },
onlineStatus: { type: String, default: '离线' },
@@ -35,6 +37,11 @@
expiryDays: { type: [Number, String], default: null }
});
const hasPackageName = computed(() => {
const packageName = String(props.deviceInfo?.packageName || '').trim();
return Boolean(packageName && packageName !== '-');
});
</script>
<style scoped lang="scss">

View File

@@ -91,7 +91,9 @@
<view class="form-label">收件人电话</view>
<up-input
v-model="form.recipient_phone"
placeholder="请输入收件人电话"
placeholder="请输入11位手机号"
type="number"
maxlength="11"
border="surround"
/>
</view>
@@ -188,6 +190,24 @@
return String(time).split('T').join(' ').slice(0, 19);
};
const getRecipientPhone = () => String(form.recipient_phone || '').trim();
const validateRecipientPhone = () => {
const phone = getRecipientPhone();
if (!phone) {
uni.showToast({ title: '请输入收件人电话', icon: 'none' });
return '';
}
if (!PHONE_REG.test(phone)) {
uni.showToast({ title: '请输入正确的手机号', icon: 'none' });
return '';
}
return phone;
};
const syncAreaPickerState = (regionCodes = []) => {
const { columns, defaultIndex } = buildRegionColumns(regionCodes);
areaPickerColumns.value = columns;
@@ -307,15 +327,8 @@
return;
}
if (!form.recipient_phone.trim()) {
uni.showToast({ title: '请输入收件人电话', icon: 'none' });
return;
}
if (!PHONE_REG.test(form.recipient_phone.trim())) {
uni.showToast({ title: '请输入正确的手机号', icon: 'none' });
return;
}
const recipientPhone = validateRecipientPhone();
if (!recipientPhone) return;
if (form.recipient_region_codes.length !== 3) {
uni.showToast({ title: '请选择省市区', icon: 'none' });
@@ -336,7 +349,7 @@
await exchangeApi.submitShippingInfo(
exchangeData.value.id,
form.recipient_name.trim(),
form.recipient_phone.trim(),
recipientPhone,
recipientAddress
);
uni.showToast({ title: '提交成功', icon: 'success' });

View File

@@ -360,12 +360,12 @@
const startHomepageRenewal = () => {
const packageId = Number(deviceInfo.currentPackageId || 0);
if (!packageId) {
const packageName = String(deviceInfo.packageName || '').trim();
if (!packageId || !packageName || packageName === '-') {
uni.showToast({ title: '当前资产暂无可续费套餐', icon: 'none' });
return;
}
const packageName = deviceInfo.packageName === '-' ? '' : deviceInfo.packageName;
renewalPopupRef.value?.open([packageId], [packageName]);
};

View File

@@ -86,7 +86,7 @@
<script setup>
import { ref, reactive, onMounted, computed } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import { assetApi, orderApi, walletApi } from '@/api/index.js';
import { assetApi, isAssetRealNameCompleted, orderApi, walletApi } from '@/api/index.js';
import { useUserStore } from '@/store/index.js';
import {
consumePendingPaymentRefresh,
@@ -208,7 +208,7 @@
const buyPackage = async (item) => {
await loadAssetType();
if (assetInfo.value.effective_realname_policy === 'before_order' &&
assetInfo.value.realname_required && Number(assetInfo.value.real_name_status) !== 1) {
assetInfo.value.realname_required && !isAssetRealNameCompleted(assetInfo.value)) {
uni.showModal({
title: '需要实名认证',
content: '当前资产下单前需要完成实名认证',