@@ -2,13 +2,13 @@
|
|||||||
<up-popup :show="show" mode="center" @close="close">
|
<up-popup :show="show" mode="center" @close="close">
|
||||||
<view class="renewal-popup">
|
<view class="renewal-popup">
|
||||||
<view class="popup-header">
|
<view class="popup-header">
|
||||||
<view class="popup-title">立即续费</view>
|
<view class="popup-title">{{ popupTitle }}</view>
|
||||||
<view class="popup-close" @tap="close">×</view>
|
<view class="popup-close" @tap="close">×</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="package-summary">
|
<view class="package-summary">
|
||||||
<view class="summary-label">续费套餐</view>
|
<view class="summary-label">{{ summaryLabel }}</view>
|
||||||
<view class="summary-name">{{ packageNamesText }}</view>
|
<view class="summary-name">{{ summaryName }}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="payment-methods">
|
<view class="payment-methods">
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<view class="popup-footer">
|
<view class="popup-footer">
|
||||||
<button class="btn-apple btn-secondary" @tap="close">取消</button>
|
<button class="btn-apple btn-secondary" @tap="close">取消</button>
|
||||||
<button class="btn-apple btn-primary" :disabled="submitting" @tap="confirmPay">
|
<button class="btn-apple btn-primary" :disabled="submitting" @tap="confirmPay">
|
||||||
{{ submitting ? '处理中...' : '确认续费' }}
|
{{ submitting ? '处理中...' : confirmText }}
|
||||||
</button>
|
</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -68,8 +68,16 @@
|
|||||||
const paymentMethod = ref('alipay');
|
const paymentMethod = ref('alipay');
|
||||||
const allowedPaymentMethods = ref([]);
|
const allowedPaymentMethods = ref([]);
|
||||||
const assetInfo = ref({});
|
const assetInfo = ref({});
|
||||||
|
const operationMode = ref('renewal');
|
||||||
|
const orderPaymentId = ref(null);
|
||||||
const paymentMethodOptions = computed(() => getPaymentMethodOptions(allowedPaymentMethods.value));
|
const paymentMethodOptions = computed(() => getPaymentMethodOptions(allowedPaymentMethods.value));
|
||||||
const packageNamesText = computed(() => packageNames.value.filter(Boolean).join('、') || '当前套餐');
|
const packageNamesText = computed(() => packageNames.value.filter(Boolean).join('、') || '当前套餐');
|
||||||
|
const popupTitle = computed(() => operationMode.value === 'order-payment' ? '立即支付' : '立即续费');
|
||||||
|
const summaryLabel = computed(() => operationMode.value === 'order-payment' ? '支付订单' : '续费套餐');
|
||||||
|
const summaryName = computed(() => operationMode.value === 'order-payment'
|
||||||
|
? packageNamesText.value.replace(/^当前套餐$/, '当前订单')
|
||||||
|
: packageNamesText.value);
|
||||||
|
const confirmText = computed(() => operationMode.value === 'order-payment' ? '确认支付' : '确认续费');
|
||||||
|
|
||||||
const hasPreparedPaymentData = (paymentData) => {
|
const hasPreparedPaymentData = (paymentData) => {
|
||||||
return isValidWechatPayConfig(paymentData?.pay_config) ||
|
return isValidWechatPayConfig(paymentData?.pay_config) ||
|
||||||
@@ -87,6 +95,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const open = async (ids, names = []) => {
|
const open = async (ids, names = []) => {
|
||||||
|
operationMode.value = 'renewal';
|
||||||
|
orderPaymentId.value = null;
|
||||||
const validIds = [...new Set((Array.isArray(ids) ? ids : [ids])
|
const validIds = [...new Set((Array.isArray(ids) ? ids : [ids])
|
||||||
.map((value) => Number(value))
|
.map((value) => Number(value))
|
||||||
.filter((value) => Number.isInteger(value) && value > 0))];
|
.filter((value) => Number.isInteger(value) && value > 0))];
|
||||||
@@ -130,6 +140,32 @@
|
|||||||
show.value = true;
|
show.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const openOrderPayment = async (orderId, names = []) => {
|
||||||
|
if (!orderId) return;
|
||||||
|
if (!props.identifier) {
|
||||||
|
uni.showToast({ title: '未找到当前资产', icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
operationMode.value = 'order-payment';
|
||||||
|
orderPaymentId.value = orderId;
|
||||||
|
packageIds.value = [];
|
||||||
|
packageNames.value = Array.isArray(names) ? names.filter(Boolean) : [];
|
||||||
|
try {
|
||||||
|
await loadAssetInfo();
|
||||||
|
} catch (error) {
|
||||||
|
console.error('加载订单支付方式失败', error);
|
||||||
|
uni.showToast({ title: error.msg || error.message || '加载支付方式失败', icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!paymentMethodOptions.value.length) {
|
||||||
|
uni.showToast({ title: '暂无可用支付方式', icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
show.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
const selectPaymentMethod = (method) => {
|
const selectPaymentMethod = (method) => {
|
||||||
if (paymentMethodOptions.value.some((item) => item.value === method)) {
|
if (paymentMethodOptions.value.some((item) => item.value === method)) {
|
||||||
paymentMethod.value = method;
|
paymentMethod.value = method;
|
||||||
@@ -143,7 +179,7 @@
|
|||||||
showPaymentToast(status === 2, status === 2 ? '支付成功' : '支付结果确认中');
|
showPaymentToast(status === 2, status === 2 ? '支付成功' : '支付结果确认中');
|
||||||
if (status === 2) emit('completed');
|
if (status === 2) emit('completed');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('确认续费订单状态失败', error);
|
console.error('确认订单支付状态失败', error);
|
||||||
showPaymentToast(false, '支付结果确认失败,请稍后查看订单');
|
showPaymentToast(false, '支付结果确认失败,请稍后查看订单');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -209,7 +245,12 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const confirmPay = async () => {
|
const confirmPay = async () => {
|
||||||
if (submitting.value || !packageIds.value.length) return;
|
if (submitting.value) return;
|
||||||
|
if (operationMode.value === 'order-payment') {
|
||||||
|
await confirmOrderPayment();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!packageIds.value.length) return;
|
||||||
submitting.value = true;
|
submitting.value = true;
|
||||||
uni.showLoading({ title: '创建订单...', mask: true });
|
uni.showLoading({ title: '创建订单...', mask: true });
|
||||||
|
|
||||||
@@ -250,7 +291,50 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
defineExpose({ open });
|
const confirmOrderPayment = async () => {
|
||||||
|
if (!orderPaymentId.value) return;
|
||||||
|
submitting.value = true;
|
||||||
|
uni.showLoading({ title: '准备支付...', mask: true });
|
||||||
|
|
||||||
|
try {
|
||||||
|
const payData = await orderApi.pay(orderPaymentId.value, paymentMethod.value);
|
||||||
|
uni.hideLoading();
|
||||||
|
show.value = false;
|
||||||
|
|
||||||
|
if (paymentMethod.value === 'wallet') {
|
||||||
|
await confirmOrderStatus(orderPaymentId.value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (paymentMethod.value === 'wechat') {
|
||||||
|
if (!isValidWechatPayConfig(payData?.pay_config)) {
|
||||||
|
uni.showToast({ title: '支付参数获取失败', icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await wechatH5Pay(payData.pay_config);
|
||||||
|
await confirmOrderStatus(orderPaymentId.value);
|
||||||
|
} catch (error) {
|
||||||
|
handlePaymentError(error);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isValidAlipayPaymentLink(payData?.payment_link)) {
|
||||||
|
uni.showToast({ title: '支付链接获取失败', icon: 'none' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await openAlipayPayment(payData.payment_link, props.paymentRefreshTarget);
|
||||||
|
} catch (error) {
|
||||||
|
uni.hideLoading();
|
||||||
|
console.error('订单支付失败', error);
|
||||||
|
uni.showToast({ title: error.msg || error.message || '支付失败,请稍后重试', icon: 'none' });
|
||||||
|
} finally {
|
||||||
|
submitting.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
defineExpose({ open, openOrderPayment });
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/order-list/order-list",
|
"path": "pages/order-list/order-list",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "我的订单"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,8 +6,6 @@
|
|||||||
<view class="card">
|
<view class="card">
|
||||||
<view class="card-title">订单信息</view>
|
<view class="card-title">订单信息</view>
|
||||||
<view class="info-row"><text>订单号</text><text>{{ order.order_no || '-' }}</text></view>
|
<view class="info-row"><text>订单号</text><text>{{ order.order_no || '-' }}</text></view>
|
||||||
<view class="info-row"><text>购买角色</text><text>{{ order.purchase_role || '-' }}</text></view>
|
|
||||||
<view class="info-row"><text>资产标识</text><text>{{ order.asset_identifier || '-' }}</text></view>
|
|
||||||
<view class="info-row"><text>支付方式</text><text>{{ formatPaymentMethod(order.payment_method) }}</text></view>
|
<view class="info-row"><text>支付方式</text><text>{{ formatPaymentMethod(order.payment_method) }}</text></view>
|
||||||
<view class="info-row"><text>支付状态</text><text>{{ order.payment_status_name || getStatusText(order.payment_status) }}</text></view>
|
<view class="info-row"><text>支付状态</text><text>{{ order.payment_status_name || getStatusText(order.payment_status) }}</text></view>
|
||||||
<view class="info-row"><text>订单金额</text><text class="amount">¥{{ formatMoney(order.total_amount) }}</text></view>
|
<view class="info-row"><text>订单金额</text><text class="amount">¥{{ formatMoney(order.total_amount) }}</text></view>
|
||||||
|
|||||||
@@ -1,5 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="container">
|
<view class="container">
|
||||||
|
<view class="page-navbar">
|
||||||
|
<view class="navbar-back" @tap="goBack">
|
||||||
|
<view class="back-chevron"></view>
|
||||||
|
</view>
|
||||||
|
<view class="navbar-title">我的订单</view>
|
||||||
|
<view class="navbar-tools">
|
||||||
|
<view class="navbar-search-icon"></view>
|
||||||
|
<view class="navbar-filter-icon">
|
||||||
|
<view class="filter-line filter-line-top"></view>
|
||||||
|
<view class="filter-line filter-line-middle"></view>
|
||||||
|
<view class="filter-line filter-line-bottom"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<view class="filter-tabs">
|
<view class="filter-tabs">
|
||||||
<view
|
<view
|
||||||
v-for="(item, index) in filterOptions"
|
v-for="(item, index) in filterOptions"
|
||||||
@@ -23,10 +38,12 @@
|
|||||||
<view v-else class="order-list">
|
<view v-else class="order-list">
|
||||||
<view class="order-card" v-for="item in orderList" :key="item.order_id" @tap="openOrderDetail(item)">
|
<view class="order-card" v-for="item in orderList" :key="item.order_id" @tap="openOrderDetail(item)">
|
||||||
<view class="card-header">
|
<view class="card-header">
|
||||||
<view class="header-left">
|
<view class="order-number" @tap.stop="copyOrderNo(item.order_no)">
|
||||||
<view class="header-row">
|
<text class="order-label">订单号:</text>
|
||||||
<text class="field-tag">订单号</text>
|
<text class="order-no">{{ item.order_no || '-' }}</text>
|
||||||
<text class="order-no">{{ item.order_no }}</text>
|
<view class="copy-icon">
|
||||||
|
<view class="copy-back"></view>
|
||||||
|
<view class="copy-front"></view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="status-badge" :class="getStatusClass(item.payment_status)">
|
<view class="status-badge" :class="getStatusClass(item.payment_status)">
|
||||||
@@ -35,32 +52,27 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="card-body">
|
<view class="card-body">
|
||||||
<view class="info-grid">
|
<view class="package-row">
|
||||||
<view class="info-item">
|
<view class="package-content">
|
||||||
<view class="info-label">套餐名称:</view>
|
<view class="package-name">{{ getPackageNamesText(item) }}</view>
|
||||||
<view class="info-value">{{ getPackageNamesText(item) }}</view>
|
|
||||||
</view>
|
|
||||||
<view class="info-item">
|
|
||||||
<view class="info-label">资产标识:</view>
|
|
||||||
<view class="info-value">{{ item.asset_identifier || '-' }}</view>
|
|
||||||
</view>
|
|
||||||
<view class="info-item">
|
|
||||||
<view class="info-label">订单金额:</view>
|
|
||||||
<view class="info-value amount">¥{{ formatMoney(item.total_amount) }}</view>
|
|
||||||
</view>
|
|
||||||
<view class="info-item">
|
|
||||||
<view class="info-label">下单时间:</view>
|
|
||||||
<view class="info-value">{{ item.created_at }}</view>
|
|
||||||
</view>
|
</view>
|
||||||
|
<view class="order-amount">¥{{ formatMoney(item.total_amount) }}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="card-footer">
|
<view class="card-divider"></view>
|
||||||
<button v-if="item.payment_status === 1" class="btn-pay" :disabled="orderPayingId !== null"
|
|
||||||
@tap.stop="showOrderPaymentMethods(item)">
|
<view class="card-footer">
|
||||||
{{ isOrderPaying(item) ? '处理中...' : '立即支付' }}
|
<view class="created-time">下单时间:{{ item.created_at || '-' }}</view>
|
||||||
</button>
|
<view class="order-actions">
|
||||||
<up-button class="btn-renew" type="primary" size="small"
|
<button class="order-action-button detail-action-button"
|
||||||
:disabled="orderPayingId !== null" @tap.stop="startOrderRenewal(item)">立即续费</up-button>
|
@tap.stop="openOrderDetail(item)">查看详情</button>
|
||||||
|
<button v-if="item.payment_status === 1" class="order-action-button primary-action-button"
|
||||||
|
@tap.stop="showOrderPaymentMethods(item)">
|
||||||
|
立即支付
|
||||||
|
</button>
|
||||||
|
<button v-if="item.payment_status !== 1" class="order-action-button primary-action-button"
|
||||||
|
@tap.stop="startOrderRenewal(item)">立即续费</button>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -79,23 +91,16 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, reactive, onMounted, computed } from 'vue';
|
import { ref, reactive, onMounted } from 'vue';
|
||||||
import { onShow } from '@dcloudio/uni-app';
|
import { onShow } from '@dcloudio/uni-app';
|
||||||
import { assetApi, orderApi } from '@/api/index.js';
|
import { orderApi } from '@/api/index.js';
|
||||||
import RenewalPaymentPopup from '@/components/RenewalPaymentPopup.vue';
|
import RenewalPaymentPopup from '@/components/RenewalPaymentPopup.vue';
|
||||||
import { useUserStore } from '@/store/index.js';
|
import { useUserStore } from '@/store/index.js';
|
||||||
import {
|
import {
|
||||||
consumePendingPaymentRefresh,
|
consumePendingPaymentRefresh,
|
||||||
handlePaymentError,
|
PAYMENT_REFRESH_TARGETS
|
||||||
isValidAlipayPaymentLink,
|
|
||||||
isValidWechatPayConfig,
|
|
||||||
openAlipayPayment,
|
|
||||||
PAYMENT_REFRESH_TARGETS,
|
|
||||||
showPaymentToast,
|
|
||||||
wechatH5Pay
|
|
||||||
} from '@/utils/payment.js';
|
} from '@/utils/payment.js';
|
||||||
import { formatMoney } from '@/utils/display.js';
|
import { formatMoney } from '@/utils/display.js';
|
||||||
import { getPaymentMethodOptions, normalizePaymentMethods } from '@/utils/payment-methods.js';
|
|
||||||
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
|
|
||||||
@@ -103,13 +108,9 @@
|
|||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
const noMore = ref(false);
|
const noMore = ref(false);
|
||||||
const page = ref(1);
|
const page = ref(1);
|
||||||
const orderPayingId = ref(null);
|
|
||||||
const renewalPopupRef = ref(null);
|
const renewalPopupRef = ref(null);
|
||||||
const pageSize = 10;
|
const pageSize = 10;
|
||||||
const filterIndex = ref(0);
|
const filterIndex = ref(0);
|
||||||
const allowedPaymentMethods = ref([]);
|
|
||||||
let assetTypePromise = null;
|
|
||||||
const paymentMethodOptions = computed(() => getPaymentMethodOptions(allowedPaymentMethods.value));
|
|
||||||
const filterOptions = [
|
const filterOptions = [
|
||||||
{ label: '全部', value: null },
|
{ label: '全部', value: null },
|
||||||
{ label: '待支付', value: 1 },
|
{ label: '待支付', value: 1 },
|
||||||
@@ -128,24 +129,6 @@
|
|||||||
return classMap[status] || '';
|
return classMap[status] || '';
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadAssetType = async () => {
|
|
||||||
if (!userStore.state.identifier) return;
|
|
||||||
if (assetTypePromise) return assetTypePromise;
|
|
||||||
|
|
||||||
assetTypePromise = assetApi.getInfo(userStore.state.identifier)
|
|
||||||
.then((data) => {
|
|
||||||
allowedPaymentMethods.value = normalizePaymentMethods(data.allowed_payment_methods);
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.error('加载资产类型失败', error);
|
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
assetTypePromise = null;
|
|
||||||
});
|
|
||||||
|
|
||||||
return assetTypePromise;
|
|
||||||
};
|
|
||||||
|
|
||||||
const resetOrderListAndLoad = () => {
|
const resetOrderListAndLoad = () => {
|
||||||
page.value = 1;
|
page.value = 1;
|
||||||
noMore.value = false;
|
noMore.value = false;
|
||||||
@@ -187,7 +170,6 @@
|
|||||||
|
|
||||||
const newData = (data.items || []).map((item) => ({
|
const newData = (data.items || []).map((item) => ({
|
||||||
...item,
|
...item,
|
||||||
asset_identifier: item.asset_identifier || item.virtual_no || item.VirtualNo || item.imei || '',
|
|
||||||
payment_status_name: item.payment_status === 1
|
payment_status_name: item.payment_status === 1
|
||||||
? '待支付'
|
? '待支付'
|
||||||
: item.payment_status === 2
|
: item.payment_status === 2
|
||||||
@@ -224,8 +206,6 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const isOrderPaying = (order) => orderPayingId.value === order.order_id;
|
|
||||||
|
|
||||||
const getPackageNamesText = (order) => {
|
const getPackageNamesText = (order) => {
|
||||||
const packageNames = Array.isArray(order?.package_names)
|
const packageNames = Array.isArray(order?.package_names)
|
||||||
? order.package_names.filter(Boolean)
|
? order.package_names.filter(Boolean)
|
||||||
@@ -233,8 +213,25 @@
|
|||||||
return packageNames.join('、') || '-';
|
return packageNames.join('、') || '-';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const copyOrderNo = (orderNo) => {
|
||||||
|
if (!orderNo) return;
|
||||||
|
uni.setClipboardData({
|
||||||
|
data: String(orderNo),
|
||||||
|
success: () => uni.showToast({ title: '订单号已复制', icon: 'success' })
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const goBack = () => {
|
||||||
|
const pages = getCurrentPages();
|
||||||
|
if (pages.length > 1) {
|
||||||
|
uni.navigateBack();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uni.reLaunch({ url: '/pages/index/index' });
|
||||||
|
};
|
||||||
|
|
||||||
const openOrderDetail = (order) => {
|
const openOrderDetail = (order) => {
|
||||||
if (!order?.order_id || orderPayingId.value !== null) return;
|
if (!order?.order_id) return;
|
||||||
uni.navigateTo({ url: `/pages/order-detail/order-detail?id=${order.order_id}` });
|
uni.navigateTo({ url: `/pages/order-detail/order-detail?id=${order.order_id}` });
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -248,98 +245,10 @@
|
|||||||
renewalPopupRef.value?.open(packageIds, packageNames);
|
renewalPopupRef.value?.open(packageIds, packageNames);
|
||||||
};
|
};
|
||||||
|
|
||||||
const showOrderPaymentMethods = async (order) => {
|
const showOrderPaymentMethods = (order) => {
|
||||||
if (orderPayingId.value !== null || !order?.order_id) return;
|
if (!order?.order_id) return;
|
||||||
await loadAssetType();
|
const packageNames = Array.isArray(order.package_names) ? order.package_names : [];
|
||||||
const options = paymentMethodOptions.value;
|
renewalPopupRef.value?.openOrderPayment(order.order_id, packageNames);
|
||||||
if (!options.length) {
|
|
||||||
uni.showToast({ title: '暂无可用支付方式', icon: 'none' });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
uni.showActionSheet({
|
|
||||||
itemList: options.map((item) => item.label),
|
|
||||||
success: ({ tapIndex }) => {
|
|
||||||
const selectedMethod = options[tapIndex]?.value;
|
|
||||||
if (selectedMethod) {
|
|
||||||
handleOrderPayment(order, selectedMethod);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleOrderPayment = async (order, paymentMethod) => {
|
|
||||||
if (orderPayingId.value !== null || !order?.order_id) return;
|
|
||||||
|
|
||||||
orderPayingId.value = order.order_id;
|
|
||||||
uni.showLoading({
|
|
||||||
title: '处理中...',
|
|
||||||
mask: true
|
|
||||||
});
|
|
||||||
|
|
||||||
try {
|
|
||||||
const payData = await orderApi.pay(order.order_id, paymentMethod);
|
|
||||||
uni.hideLoading();
|
|
||||||
|
|
||||||
if (paymentMethod === 'wallet') {
|
|
||||||
await confirmOrderStatus(order);
|
|
||||||
setTimeout(() => {
|
|
||||||
resetOrderListAndLoad();
|
|
||||||
}, 1500);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (paymentMethod === 'wechat') {
|
|
||||||
if (!isValidWechatPayConfig(payData?.pay_config)) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '支付参数获取失败',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
await wechatH5Pay(payData.pay_config);
|
|
||||||
await confirmOrderStatus(order);
|
|
||||||
setTimeout(() => {
|
|
||||||
resetOrderListAndLoad();
|
|
||||||
}, 1500);
|
|
||||||
} catch (error) {
|
|
||||||
handlePaymentError(error);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isValidAlipayPaymentLink(payData?.payment_link)) {
|
|
||||||
uni.showToast({
|
|
||||||
title: '支付链接获取失败',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await openAlipayPayment(payData.payment_link, PAYMENT_REFRESH_TARGETS.ORDER_LIST);
|
|
||||||
} catch (error) {
|
|
||||||
uni.hideLoading();
|
|
||||||
console.error('订单支付失败', error);
|
|
||||||
uni.showToast({
|
|
||||||
title: error.msg || error.message || '支付失败,请稍后重试',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
} finally {
|
|
||||||
orderPayingId.value = null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const confirmOrderStatus = async (order) => {
|
|
||||||
try {
|
|
||||||
const detail = await orderApi.getDetail(order.order_id);
|
|
||||||
const status = detail?.payment_status ?? detail?.order?.payment_status;
|
|
||||||
showPaymentToast(status === 2, status === 2 ? '支付成功' : '支付结果确认中');
|
|
||||||
} catch (error) {
|
|
||||||
console.error('确认订单支付状态失败', error);
|
|
||||||
showPaymentToast(false, '支付结果确认失败,请稍后查看订单');
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
@@ -351,7 +260,6 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
loadAssetType();
|
|
||||||
loadOrderList();
|
loadOrderList();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@@ -525,35 +433,24 @@
|
|||||||
padding-top: 24rpx;
|
padding-top: 24rpx;
|
||||||
border-top: 1rpx solid #f0f0f0;
|
border-top: 1rpx solid #f0f0f0;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
flex-direction: column;
|
||||||
gap: 16rpx;
|
gap: 16rpx;
|
||||||
|
|
||||||
.btn-pay {
|
.order-action-button {
|
||||||
background: #1890ff;
|
|
||||||
color: #fff;
|
|
||||||
border: none;
|
|
||||||
border-radius: 20rpx;
|
|
||||||
height: 64rpx;
|
|
||||||
padding: 0 28rpx;
|
|
||||||
font-size: 26rpx;
|
|
||||||
font-weight: 500;
|
|
||||||
width: auto;
|
|
||||||
min-width: 168rpx;
|
|
||||||
line-height: 64rpx;
|
|
||||||
|
|
||||||
&[disabled] {
|
|
||||||
opacity: 0.7;
|
|
||||||
}
|
|
||||||
|
|
||||||
&::after {
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-renew {
|
|
||||||
flex: 1;
|
|
||||||
width: 100%;
|
width: 100%;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.payment-action-buttons {
|
||||||
|
display: flex;
|
||||||
|
width: 100%;
|
||||||
|
gap: 16rpx;
|
||||||
|
|
||||||
|
.order-action-button {
|
||||||
|
flex: 1;
|
||||||
|
width: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -592,4 +489,330 @@
|
|||||||
color: #999;
|
color: #999;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Screenshot-aligned order list skin */
|
||||||
|
.container {
|
||||||
|
top: 0;
|
||||||
|
background: #f8f9fb;
|
||||||
|
padding-top: var(--status-bar-height, 0px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-navbar {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
flex-shrink: 0;
|
||||||
|
height: 88rpx;
|
||||||
|
padding: 0 32rpx;
|
||||||
|
background: #fff;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-back,
|
||||||
|
.navbar-tools {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-back {
|
||||||
|
width: 64rpx;
|
||||||
|
height: 64rpx;
|
||||||
|
justify-content: flex-start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.back-chevron {
|
||||||
|
width: 24rpx;
|
||||||
|
height: 24rpx;
|
||||||
|
margin-left: 8rpx;
|
||||||
|
border-left: 5rpx solid #111;
|
||||||
|
border-bottom: 5rpx solid #111;
|
||||||
|
transform: rotate(45deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-title {
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
color: #111;
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-tools {
|
||||||
|
gap: 36rpx;
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-search-icon {
|
||||||
|
position: relative;
|
||||||
|
width: 32rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
border: 4rpx solid #111;
|
||||||
|
border-radius: 50%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
right: -13rpx;
|
||||||
|
bottom: -9rpx;
|
||||||
|
width: 14rpx;
|
||||||
|
height: 4rpx;
|
||||||
|
background: #111;
|
||||||
|
border-radius: 4rpx;
|
||||||
|
transform: rotate(45deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-filter-icon {
|
||||||
|
position: relative;
|
||||||
|
width: 34rpx;
|
||||||
|
height: 34rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-line {
|
||||||
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
height: 4rpx;
|
||||||
|
width: 34rpx;
|
||||||
|
background: #111;
|
||||||
|
border-radius: 4rpx;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: -5rpx;
|
||||||
|
width: 14rpx;
|
||||||
|
height: 14rpx;
|
||||||
|
border: 4rpx solid #111;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-line-top { top: 7rpx; &::after { left: 6rpx; } }
|
||||||
|
.filter-line-middle { top: 16rpx; &::after { right: 5rpx; } }
|
||||||
|
.filter-line-bottom { top: 25rpx; &::after { left: 6rpx; } }
|
||||||
|
|
||||||
|
.filter-tabs {
|
||||||
|
display: flex;
|
||||||
|
align-items: stretch;
|
||||||
|
flex-shrink: 0;
|
||||||
|
margin-top: 0;
|
||||||
|
padding: 0 20rpx;
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 0;
|
||||||
|
border-bottom: 1rpx solid #f0f1f3;
|
||||||
|
box-shadow: none;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-tabs .tab-item {
|
||||||
|
position: relative;
|
||||||
|
flex: 1;
|
||||||
|
min-width: 128rpx;
|
||||||
|
padding: 28rpx 12rpx 24rpx;
|
||||||
|
color: #777b84;
|
||||||
|
font-size: 28rpx;
|
||||||
|
text-align: center;
|
||||||
|
white-space: nowrap;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-tabs .tab-item.active {
|
||||||
|
color: #18a765;
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-tabs .tab-line {
|
||||||
|
bottom: 0;
|
||||||
|
width: 42rpx;
|
||||||
|
height: 6rpx;
|
||||||
|
background: #18a765;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scroll-container {
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-list {
|
||||||
|
padding: 20rpx 24rpx 48rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-card {
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
padding: 0 32rpx;
|
||||||
|
background: #fff;
|
||||||
|
border: 1rpx solid #f0f1f3;
|
||||||
|
border-radius: 18rpx;
|
||||||
|
box-shadow: 0 6rpx 18rpx rgba(31, 35, 41, 0.04);
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-card .card-header {
|
||||||
|
align-items: center;
|
||||||
|
padding: 32rpx 0 24rpx;
|
||||||
|
border-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-number {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
min-width: 0;
|
||||||
|
color: #777b84;
|
||||||
|
font-size: 26rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-label { flex-shrink: 0; }
|
||||||
|
|
||||||
|
.order-no {
|
||||||
|
max-width: 410rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
color: #777b84;
|
||||||
|
font-size: 26rpx;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.copy-icon {
|
||||||
|
position: relative;
|
||||||
|
width: 30rpx;
|
||||||
|
height: 30rpx;
|
||||||
|
margin-left: 14rpx;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.copy-back,
|
||||||
|
.copy-front {
|
||||||
|
position: absolute;
|
||||||
|
width: 15rpx;
|
||||||
|
height: 15rpx;
|
||||||
|
border: 3rpx solid #717782;
|
||||||
|
border-radius: 4rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.copy-back { top: 3rpx; left: 3rpx; }
|
||||||
|
.copy-front { right: 2rpx; bottom: 2rpx; background: #fff; }
|
||||||
|
|
||||||
|
.order-card .card-body {
|
||||||
|
padding: 0 0 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.package-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
min-width: 0;
|
||||||
|
gap: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.package-content {
|
||||||
|
min-width: 0;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.package-name {
|
||||||
|
color: #16181c;
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
line-height: 1.25;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-amount {
|
||||||
|
align-self: center;
|
||||||
|
color: #ff302f;
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-divider {
|
||||||
|
height: 1rpx;
|
||||||
|
margin: 28rpx 0 20rpx;
|
||||||
|
background: #edf0f2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-card .card-footer {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 16rpx;
|
||||||
|
margin-top: 0;
|
||||||
|
padding: 0 0 28rpx;
|
||||||
|
border-top: 0;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
.created-time {
|
||||||
|
min-width: 0;
|
||||||
|
color: #777b84;
|
||||||
|
font-size: 24rpx;
|
||||||
|
line-height: 1.3;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 16rpx;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-card .order-action-button {
|
||||||
|
width: 180rpx;
|
||||||
|
height: 58rpx;
|
||||||
|
min-width: 0;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0 16rpx;
|
||||||
|
border: 1rpx solid transparent;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
font-size: 25rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 56rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
white-space: nowrap;
|
||||||
|
-webkit-tap-highlight-color: transparent;
|
||||||
|
|
||||||
|
&::after { border: none; }
|
||||||
|
}
|
||||||
|
|
||||||
|
.detail-action-button {
|
||||||
|
border-color: #d9dde2;
|
||||||
|
background: #fff;
|
||||||
|
color: #17191c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.primary-action-button {
|
||||||
|
border-color: #16ad63;
|
||||||
|
background: #16ad63;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-card .status-badge {
|
||||||
|
padding: 0 0 0 16rpx;
|
||||||
|
background: transparent;
|
||||||
|
border-radius: 0;
|
||||||
|
font-size: 25rpx;
|
||||||
|
font-weight: 500;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.order-card .status-badge.tag-warning { color: #f08a00; }
|
||||||
|
.order-card .status-badge.tag-success { color: #147de2; }
|
||||||
|
.order-card .status-badge.tag-secondary { color: #7d828b; }
|
||||||
|
.order-card .status-badge.tag-info { color: #666d78; }
|
||||||
|
|
||||||
|
.load-more {
|
||||||
|
padding: 24rpx 32rpx 40rpx;
|
||||||
|
color: #9aa0aa;
|
||||||
|
font-size: 23rpx;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="package-main">
|
<view class="package-main">
|
||||||
<view class="data-block">
|
<view class="data-block">
|
||||||
<view class="data-label">可用流量</view>
|
<view class="data-label">套餐流量</view>
|
||||||
<view class="package-data">{{ formatData(item.data_allowance, item.data_unit) }}</view>
|
<view class="package-data">{{ formatData(item.data_allowance, item.data_unit) }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="price-block">
|
<view class="price-block">
|
||||||
@@ -36,7 +36,6 @@
|
|||||||
<text class="package-price">{{ formatPackagePrice(item.retail_price) }}</text>
|
<text class="package-price">{{ formatPackagePrice(item.retail_price) }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="package-desc" v-if="item.description">{{ item.description }}</view>
|
|
||||||
<view class="package-footer">
|
<view class="package-footer">
|
||||||
<view class="btn">
|
<view class="btn">
|
||||||
<up-button type="primary" size="small" @click="buyPackage(item)">立即订购</up-button>
|
<up-button type="primary" size="small" @click="buyPackage(item)">立即订购</up-button>
|
||||||
@@ -56,7 +55,7 @@
|
|||||||
<view class="summary-price">¥{{ formatPackagePrice(currentPackage?.retail_price) }}</view>
|
<view class="summary-price">¥{{ formatPackagePrice(currentPackage?.retail_price) }}</view>
|
||||||
<view class="summary-details">
|
<view class="summary-details">
|
||||||
<view class="detail-item">
|
<view class="detail-item">
|
||||||
<text class="detail-label">可用流量</text>
|
<text class="detail-label">套餐流量</text>
|
||||||
<text class="detail-value">{{ formatData(currentPackage?.data_allowance, currentPackage?.data_unit) }}</text>
|
<text class="detail-value">{{ formatData(currentPackage?.data_allowance, currentPackage?.data_unit) }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="detail-divider"></view>
|
<view class="detail-divider"></view>
|
||||||
@@ -672,13 +671,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.package-desc {
|
|
||||||
font-size: 24rpx;
|
|
||||||
color: var(--text-secondary);
|
|
||||||
line-height: 1.5;
|
|
||||||
margin-bottom: 22rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.package-footer {
|
.package-footer {
|
||||||
display: block;
|
display: block;
|
||||||
padding-top: 22rpx;
|
padding-top: 22rpx;
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 148 KiB After Width: | Height: | Size: 8.8 KiB |
BIN
static/微信支付.png
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 9.2 KiB |
BIN
static/支付宝支付.png
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 9.0 KiB |
BIN
static/有效期.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
static/流量.png
Normal file
|
After Width: | Height: | Size: 7.3 KiB |