fix: 只要任意一张实名了就可以不强制跳
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 59s
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 59s
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
export { authApi } from './modules/auth.js';
|
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 { deviceApi } from './modules/device.js';
|
||||||
export { exchangeApi } from './modules/exchange.js';
|
export { exchangeApi } from './modules/exchange.js';
|
||||||
export { orderApi } from './modules/order.js';
|
export { orderApi } from './modules/order.js';
|
||||||
|
|||||||
@@ -19,6 +19,14 @@ export const normalizeAssetInfo = (data = {}) => ({
|
|||||||
: data.is_expiring === true || data.is_expiring === 1
|
: 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 = {
|
export const assetApi = {
|
||||||
getInfo(identifier) {
|
getInfo(identifier) {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed } from 'vue';
|
||||||
import { assetApi, orderApi } from '@/api/index.js';
|
import { assetApi, isAssetRealNameCompleted, orderApi } from '@/api/index.js';
|
||||||
import {
|
import {
|
||||||
handlePaymentError,
|
handlePaymentError,
|
||||||
isValidAlipayPaymentLink,
|
isValidAlipayPaymentLink,
|
||||||
@@ -110,7 +110,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (assetInfo.value.effective_realname_policy === 'before_order' &&
|
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({
|
uni.showModal({
|
||||||
title: '需要实名认证',
|
title: '需要实名认证',
|
||||||
content: '当前资产下单前需要完成实名认证',
|
content: '当前资产下单前需要完成实名认证',
|
||||||
|
|||||||
@@ -18,14 +18,16 @@
|
|||||||
{{ networkStatus == 1 ? '正常' : '停机' }}
|
{{ networkStatus == 1 ? '正常' : '停机' }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<button class="renew-button" @tap.stop="emit('renew')">立即续费</button>
|
<button v-if="hasPackageName" class="renew-button" @tap.stop="emit('renew')">立即续费</button>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
|
import { computed } from 'vue';
|
||||||
|
|
||||||
const emit = defineEmits(['renew']);
|
const emit = defineEmits(['renew']);
|
||||||
|
|
||||||
defineProps({
|
const props = defineProps({
|
||||||
currentCardNo: { type: String, default: '' },
|
currentCardNo: { type: String, default: '' },
|
||||||
deviceInfo: { type: Object, default: () => ({}) },
|
deviceInfo: { type: Object, default: () => ({}) },
|
||||||
onlineStatus: { type: String, default: '离线' },
|
onlineStatus: { type: String, default: '离线' },
|
||||||
@@ -35,6 +37,11 @@
|
|||||||
expiryDays: { type: [Number, String], default: null }
|
expiryDays: { type: [Number, String], default: null }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const hasPackageName = computed(() => {
|
||||||
|
const packageName = String(props.deviceInfo?.packageName || '').trim();
|
||||||
|
return Boolean(packageName && packageName !== '-');
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
@@ -91,7 +91,9 @@
|
|||||||
<view class="form-label">收件人电话</view>
|
<view class="form-label">收件人电话</view>
|
||||||
<up-input
|
<up-input
|
||||||
v-model="form.recipient_phone"
|
v-model="form.recipient_phone"
|
||||||
placeholder="请输入收件人电话"
|
placeholder="请输入11位手机号"
|
||||||
|
type="number"
|
||||||
|
maxlength="11"
|
||||||
border="surround"
|
border="surround"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
@@ -188,6 +190,24 @@
|
|||||||
return String(time).split('T').join(' ').slice(0, 19);
|
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 syncAreaPickerState = (regionCodes = []) => {
|
||||||
const { columns, defaultIndex } = buildRegionColumns(regionCodes);
|
const { columns, defaultIndex } = buildRegionColumns(regionCodes);
|
||||||
areaPickerColumns.value = columns;
|
areaPickerColumns.value = columns;
|
||||||
@@ -307,15 +327,8 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!form.recipient_phone.trim()) {
|
const recipientPhone = validateRecipientPhone();
|
||||||
uni.showToast({ title: '请输入收件人电话', icon: 'none' });
|
if (!recipientPhone) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!PHONE_REG.test(form.recipient_phone.trim())) {
|
|
||||||
uni.showToast({ title: '请输入正确的手机号', icon: 'none' });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (form.recipient_region_codes.length !== 3) {
|
if (form.recipient_region_codes.length !== 3) {
|
||||||
uni.showToast({ title: '请选择省市区', icon: 'none' });
|
uni.showToast({ title: '请选择省市区', icon: 'none' });
|
||||||
@@ -336,7 +349,7 @@
|
|||||||
await exchangeApi.submitShippingInfo(
|
await exchangeApi.submitShippingInfo(
|
||||||
exchangeData.value.id,
|
exchangeData.value.id,
|
||||||
form.recipient_name.trim(),
|
form.recipient_name.trim(),
|
||||||
form.recipient_phone.trim(),
|
recipientPhone,
|
||||||
recipientAddress
|
recipientAddress
|
||||||
);
|
);
|
||||||
uni.showToast({ title: '提交成功', icon: 'success' });
|
uni.showToast({ title: '提交成功', icon: 'success' });
|
||||||
|
|||||||
@@ -360,12 +360,12 @@
|
|||||||
|
|
||||||
const startHomepageRenewal = () => {
|
const startHomepageRenewal = () => {
|
||||||
const packageId = Number(deviceInfo.currentPackageId || 0);
|
const packageId = Number(deviceInfo.currentPackageId || 0);
|
||||||
if (!packageId) {
|
const packageName = String(deviceInfo.packageName || '').trim();
|
||||||
|
if (!packageId || !packageName || packageName === '-') {
|
||||||
uni.showToast({ title: '当前资产暂无可续费套餐', icon: 'none' });
|
uni.showToast({ title: '当前资产暂无可续费套餐', icon: 'none' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const packageName = deviceInfo.packageName === '-' ? '' : deviceInfo.packageName;
|
|
||||||
renewalPopupRef.value?.open([packageId], [packageName]);
|
renewalPopupRef.value?.open([packageId], [packageName]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, onMounted, computed } from 'vue';
|
import { ref, reactive, onMounted, computed } from 'vue';
|
||||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
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 { useUserStore } from '@/store/index.js';
|
||||||
import {
|
import {
|
||||||
consumePendingPaymentRefresh,
|
consumePendingPaymentRefresh,
|
||||||
@@ -208,7 +208,7 @@
|
|||||||
const buyPackage = async (item) => {
|
const buyPackage = async (item) => {
|
||||||
await loadAssetType();
|
await loadAssetType();
|
||||||
if (assetInfo.value.effective_realname_policy === 'before_order' &&
|
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({
|
uni.showModal({
|
||||||
title: '需要实名认证',
|
title: '需要实名认证',
|
||||||
content: '当前资产下单前需要完成实名认证',
|
content: '当前资产下单前需要完成实名认证',
|
||||||
|
|||||||
Reference in New Issue
Block a user