fix:套餐状态判断套餐禁止办理
This commit is contained in:
@@ -564,6 +564,9 @@ const local: any = {
|
|||||||
uplimit:'Uplink rate',
|
uplimit:'Uplink rate',
|
||||||
downlimit:'Downlink rate',
|
downlimit:'Downlink rate',
|
||||||
client:'Client',
|
client:'Client',
|
||||||
|
packageStatus:'Status',
|
||||||
|
active:'Active',
|
||||||
|
inactive:'Inactive',
|
||||||
accountinfor:'Account information',
|
accountinfor:'Account information',
|
||||||
Remainingcredit:'Balance',
|
Remainingcredit:'Balance',
|
||||||
monthphonebill:'Month bill',
|
monthphonebill:'Month bill',
|
||||||
|
|||||||
@@ -562,6 +562,9 @@ const local:any = {
|
|||||||
packageinfo:'套餐信息',
|
packageinfo:'套餐信息',
|
||||||
packagename:'套餐名称',
|
packagename:'套餐名称',
|
||||||
price:'套餐费用',
|
price:'套餐费用',
|
||||||
|
packageStatus:'套餐状态',
|
||||||
|
active:'有效',
|
||||||
|
inactive:'无效',
|
||||||
uplimit:'上行速率',
|
uplimit:'上行速率',
|
||||||
downlimit:'下行速率',
|
downlimit:'下行速率',
|
||||||
client:'设备数',
|
client:'设备数',
|
||||||
|
|||||||
1
src/typings/api.d.ts
vendored
1
src/typings/api.d.ts
vendored
@@ -462,6 +462,7 @@ declare namespace Api {
|
|||||||
clientNumEnable:boolean;
|
clientNumEnable:boolean;
|
||||||
price:string;
|
price:string;
|
||||||
error?: any;
|
error?: any;
|
||||||
|
status:number;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -284,7 +284,8 @@ const packageInfo = ref({
|
|||||||
// packageName: '',
|
// packageName: '',
|
||||||
// price: '0.00'
|
// price: '0.00'
|
||||||
packageName: t('page.headerbanner.noPackage'),
|
packageName: t('page.headerbanner.noPackage'),
|
||||||
price: '-'
|
price: '-',
|
||||||
|
status:3,
|
||||||
});
|
});
|
||||||
|
|
||||||
// 修改数据更新函数,添加套餐信息的更新
|
// 修改数据更新函数,添加套餐信息的更新
|
||||||
@@ -295,7 +296,8 @@ async function mockDataUpdate() {
|
|||||||
// 更新套餐信息
|
// 更新套餐信息
|
||||||
packageInfo.value = {
|
packageInfo.value = {
|
||||||
packageName: response.packageName || t('page.headerbanner.nopackage'),
|
packageName: response.packageName || t('page.headerbanner.nopackage'),
|
||||||
price: response.packageName ? formatBalance(response.price) : '-' // 有套餐时才格式化价格
|
price: response.packageName ? formatBalance(response.price) : '-',// 有套餐时才格式化价格
|
||||||
|
status: response.status !== undefined ? Number(response.status) : 3,//有套餐时才判断状态
|
||||||
};
|
};
|
||||||
|
|
||||||
// 更新余额和设备数据
|
// 更新余额和设备数据
|
||||||
@@ -516,6 +518,10 @@ const getDeviceCount = (subTitle?: string, clientNumEnable?: boolean): string =>
|
|||||||
<span class="info-label">{{ t('page.headerbanner.downlimit') }}</span>
|
<span class="info-label">{{ t('page.headerbanner.downlimit') }}</span>
|
||||||
<span class="info-value">{{ speedLimits.downLimit }}</span>
|
<span class="info-value">{{ speedLimits.downLimit }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="info-item">
|
||||||
|
<span class="info-label">{{ t('page.headerbanner.packageStatus') }}</span>
|
||||||
|
<span class="info-value">{{ packageInfo.status === 0 ? t('page.headerbanner.inactive') : (packageInfo.status === 1 ? t('page.headerbanner.active') : '-') }}</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { ref, onMounted, computed } from 'vue';
|
import { ref, onMounted, computed } from 'vue';
|
||||||
import { fetchPackageList, submitOrder } from '@/service/api/auth';
|
import { fetchPackageList, submitOrder, fetchDashboardData } from '@/service/api/auth';
|
||||||
import { message } from 'ant-design-vue';
|
import { message } from 'ant-design-vue';
|
||||||
import OrderConfirmModal from '@/components/order-confirm/orderConfirmModal.vue';
|
import OrderConfirmModal from '@/components/order-confirm/orderConfirmModal.vue';
|
||||||
import { aliPayPcPay,aliPayWapPay, wxPayScanCode, payBalance } from '@/service/api/payment';
|
import { aliPayPcPay,aliPayWapPay, wxPayScanCode, payBalance } from '@/service/api/payment';
|
||||||
@@ -165,6 +165,8 @@ const canUseBalancePay = computed(() => {
|
|||||||
|
|
||||||
// 添加 loading 状态
|
// 添加 loading 状态
|
||||||
const paymentLoading = ref(false);
|
const paymentLoading = ref(false);
|
||||||
|
// 添加用户状态
|
||||||
|
const userPackageStatus = ref<number | null>(null); // 用于存储套餐状态
|
||||||
|
|
||||||
const fetchPackages = async () => {
|
const fetchPackages = async () => {
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
@@ -324,8 +326,24 @@ const fetchUserBalance = async () => {
|
|||||||
// console.error('Failed to fetch user balance:', error);
|
// console.error('Failed to fetch user balance:', error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
// 获取仪表盘数据
|
||||||
|
const fetchDashboardData = async () => {
|
||||||
|
try {
|
||||||
|
const response = await authStore.getDashboardData(); // 获取仪表盘数据
|
||||||
|
if (response && typeof response === 'object' && !response.error) {
|
||||||
|
userPackageStatus.value = response.status; // 获取套餐状态
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to fetch dashboard data:', error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// 计算属性,检查套餐状态
|
||||||
|
const isPackageActive = computed(() => {
|
||||||
|
return userPackageStatus.value === 1; // 如果状态为 1,则套餐有效
|
||||||
|
});
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
fetchDashboardData();
|
||||||
await fetchPackages();
|
await fetchPackages();
|
||||||
await fetchUserBalance();
|
await fetchUserBalance();
|
||||||
});
|
});
|
||||||
@@ -417,7 +435,7 @@ onMounted(async () => {
|
|||||||
<button
|
<button
|
||||||
class="btn-primary"
|
class="btn-primary"
|
||||||
@click="handleSubmitOrder"
|
@click="handleSubmitOrder"
|
||||||
:disabled="isLoading || !hasPackages"
|
:disabled="isLoading || !hasPackages || isPackageActive"
|
||||||
>
|
>
|
||||||
{{ isLoading ? t('page.common.loading') :
|
{{ isLoading ? t('page.common.loading') :
|
||||||
!hasPackages ? t('page.setmeal.noPackages') :
|
!hasPackages ? t('page.setmeal.noPackages') :
|
||||||
|
|||||||
Reference in New Issue
Block a user