diff --git a/docker/nginx.conf b/docker/nginx.conf
index d1667ad..7f9e4c7 100644
--- a/docker/nginx.conf
+++ b/docker/nginx.conf
@@ -17,8 +17,7 @@ server {
add_header Content-Type text/plain;
}
- # H5 部署到 /h5
- location /h5/ {
+ location / {
alias /usr/share/nginx/html/;
index index.html;
try_files $uri $uri/ /index.html;
diff --git a/manifest.json b/manifest.json
index 8a827a5..a138b66 100644
--- a/manifest.json
+++ b/manifest.json
@@ -85,7 +85,7 @@
"enable" : true
}
},
- "publicPath" : "/h5/",
+ "publicPath" : "./",
"devServer" : {
"proxy" : {
"/kyhl-weixin-1.0" : {
diff --git a/pages/auth/auth.vue b/pages/auth/auth.vue
index 50d117f..4977a97 100644
--- a/pages/auth/auth.vue
+++ b/pages/auth/auth.vue
@@ -14,7 +14,7 @@
ICCID: {{ item.iccid }}
运营商: {{ getCarrier(item.carrier_type).name }}
- 卡槽位: {{ item.slot_position || '-' }}
+ 卡槽位: {{ item.slot_position || '-' }}
@@ -81,13 +81,14 @@
iccid: card.iccid,
carrier_type: card.carrier_type,
slot_position: card.slot_position,
+ isDevice: true,
isRealName: card.real_name_status === 1
})));
- } else if (assetData.identifier) {
+ } else if (assetData.iccid) {
list.splice(0, list.length, {
- iccid: assetData.identifier,
+ iccid: assetData.iccid,
carrier_type: assetData.carrier_type,
- slot_position: 1,
+ isDevice: false,
isRealName: assetData.real_name_status === 1
});
} else {
diff --git a/pages/my-wallet/my-wallet.vue b/pages/my-wallet/my-wallet.vue
index 44fd1ce..f09f281 100644
--- a/pages/my-wallet/my-wallet.vue
+++ b/pages/my-wallet/my-wallet.vue
@@ -155,7 +155,7 @@
-
+
微信支付
@@ -163,7 +163,7 @@
-
+
支
支付宝支付
@@ -186,9 +186,9 @@
diff --git a/pages/package-order/package-order.vue b/pages/package-order/package-order.vue
index 2705774..5f118be 100644
--- a/pages/package-order/package-order.vue
+++ b/pages/package-order/package-order.vue
@@ -59,7 +59,7 @@
-
+
微信支付
@@ -67,7 +67,7 @@
-
+
支
支付宝支付
@@ -120,6 +120,8 @@
const paymentMethod = ref('wechat');
const walletBalance = ref(0);
const paySubmitting = ref(false);
+ const isDeviceAsset = ref(true);
+ let assetTypePromise = null;
const formatMoney = (amount) => {
if (!amount && amount !== 0) return '0.00';
@@ -133,6 +135,40 @@
return `${allowance} ${unit}`;
};
+ const getDefaultPaymentMethod = () => isDeviceAsset.value ? 'wechat' : 'alipay';
+
+ const isPaymentMethodAvailable = (method) => {
+ if (method === 'wallet') return true;
+ if (method === 'wechat') return isDeviceAsset.value;
+ if (method === 'alipay') return !isDeviceAsset.value;
+ return false;
+ };
+
+ const normalizePaymentMethod = () => {
+ if (!isPaymentMethodAvailable(paymentMethod.value)) {
+ paymentMethod.value = getDefaultPaymentMethod();
+ }
+ };
+
+ const loadAssetType = async () => {
+ if (!userStore.state.identifier) return;
+ if (assetTypePromise) return assetTypePromise;
+
+ assetTypePromise = assetApi.getInfo(userStore.state.identifier)
+ .then((data) => {
+ isDeviceAsset.value = data.asset_type === 'device';
+ normalizePaymentMethod();
+ })
+ .catch((error) => {
+ console.error('加载资产类型失败', error);
+ })
+ .finally(() => {
+ assetTypePromise = null;
+ });
+
+ return assetTypePromise;
+ };
+
const loadPackages = async () => {
loading.value = true;
try {
@@ -154,17 +190,20 @@
};
const syncPackagePageState = () => {
+ loadAssetType();
loadPackages();
loadWalletBalance();
};
- const buyPackage = (item) => {
+ const buyPackage = async (item) => {
+ await loadAssetType();
currentPackage.value = item;
- paymentMethod.value = 'wechat';
+ paymentMethod.value = getDefaultPaymentMethod();
showModal.value = true;
};
const selectPaymentMethod = (method) => {
+ if (!isPaymentMethodAvailable(method)) return;
paymentMethod.value = method;
};
@@ -203,7 +242,9 @@
};
const getCreateOrderPaymentMethod = () => {
- return paymentMethod.value === 'alipay' ? 'alipay' : undefined;
+ if (paymentMethod.value === 'alipay') return 'alipay';
+ if (paymentMethod.value === 'wallet' && !isDeviceAsset.value) return 'alipay';
+ return undefined;
};
const confirmPay = async () => {
diff --git a/vite.config.js b/vite.config.js
index bc40715..5234511 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -33,7 +33,6 @@ function copyMpVerifyFiles() {
}
export default defineConfig({
- base: '/h5/',
plugins: [uni(), copyMpVerifyFiles()],
root: process.cwd(),
css: {