This commit is contained in:
@@ -53,7 +53,7 @@
|
||||
<view class="info-label">支付方式</view>
|
||||
<view class="info-value">{{ item.payment_method || '-' }}</view>
|
||||
</view>
|
||||
<view class="info-row flex-row-sb">
|
||||
<view v-if="hasAutoPurchaseStatus(item)" class="info-row flex-row-sb">
|
||||
<view class="info-label">自动购包</view>
|
||||
<view class="info-value">
|
||||
{{ getAutoPurchaseStatusText(item.auto_purchase_status) }}</view>
|
||||
@@ -64,7 +64,9 @@
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="item.status === 0" class="record-actions">
|
||||
<button class="btn-pay" @tap="handleRechargePayment(item)">立即支付</button>
|
||||
<button class="btn-pay" :disabled="rechargeOrderSubmittingKey !== null" @tap="handleRechargePayment(item)">
|
||||
{{ isRechargeOrderSubmitting(item) ? '处理中...' : '立即支付' }}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -93,10 +95,6 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="record-info">
|
||||
<view class="info-row flex-row-sb">
|
||||
<view class="info-label">流水ID</view>
|
||||
<view class="info-value text-ellipsis">{{ item.transaction_id }}</view>
|
||||
</view>
|
||||
<view class="info-row flex-row-sb">
|
||||
<view class="info-label">变动后余额</view>
|
||||
<view class="info-value">¥{{ formatMoney(item.balance_after) }}</view>
|
||||
@@ -106,7 +104,7 @@
|
||||
<view class="info-value">{{ item.remark }}</view>
|
||||
</view>
|
||||
<view class="info-row flex-row-sb">
|
||||
<view class="info-label">创建时间</view>
|
||||
<view class="info-label">支付时间</view>
|
||||
<view class="info-value">{{ item.created_at }}</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -143,12 +141,14 @@
|
||||
|
||||
<view class="custom-input" v-if="isCustomAmount">
|
||||
<view class="input-label">请输入充值金额(元)</view>
|
||||
<up-input v-model="customAmount" type="number" placeholder="最低0.01元" border="surround" />
|
||||
<up-input v-model="customAmount" type="number" placeholder="最低1元" border="surround" />
|
||||
</view>
|
||||
|
||||
<view class="popup-footer">
|
||||
<button class="btn-apple btn-secondary" @tap="showRechargeModal=false">取消</button>
|
||||
<button class="btn-apple btn-primary" @tap="confirmRecharge">确认充值</button>
|
||||
<button class="btn-apple btn-primary" :disabled="rechargeSubmitting" @tap="confirmRecharge">
|
||||
{{ rechargeSubmitting ? '处理中...' : '确认充值' }}
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
</up-popup>
|
||||
@@ -228,6 +228,8 @@
|
||||
let selectedAmount = ref(null);
|
||||
let isCustomAmount = ref(false);
|
||||
let customAmount = ref('');
|
||||
let rechargeSubmitting = ref(false);
|
||||
let rechargeOrderSubmittingKey = ref(null);
|
||||
const rechargeAmounts = [{
|
||||
value: 1000,
|
||||
label: '10'
|
||||
@@ -266,13 +268,17 @@
|
||||
};
|
||||
|
||||
const confirmRecharge = async () => {
|
||||
if (rechargeSubmitting.value) return;
|
||||
rechargeSubmitting.value = true;
|
||||
|
||||
let amount = 0;
|
||||
|
||||
if (isCustomAmount.value) {
|
||||
// 自定义金额
|
||||
const customAmountNum = parseFloat(customAmount.value);
|
||||
if (!customAmountNum || customAmountNum < 0.01) {
|
||||
if (!customAmountNum || customAmountNum < 1) {
|
||||
showRechargeModal.value = false;
|
||||
rechargeSubmitting.value = false;
|
||||
setTimeout(() => {
|
||||
uni.showToast({
|
||||
title: '请输入正确的充值金额',
|
||||
@@ -287,6 +293,7 @@
|
||||
amount = selectedAmount.value;
|
||||
} else {
|
||||
showRechargeModal.value = false;
|
||||
rechargeSubmitting.value = false;
|
||||
setTimeout(() => {
|
||||
uni.showToast({
|
||||
title: '请选择充值金额',
|
||||
@@ -378,6 +385,8 @@
|
||||
icon: 'none'
|
||||
});
|
||||
}, 50);
|
||||
} finally {
|
||||
rechargeSubmitting.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -402,6 +411,20 @@
|
||||
return statusMap[status] || '未开启';
|
||||
};
|
||||
|
||||
const hasAutoPurchaseStatus = (item) => Object.prototype.hasOwnProperty.call(item, 'auto_purchase_status') &&
|
||||
item.auto_purchase_status !== null &&
|
||||
item.auto_purchase_status !== undefined &&
|
||||
item.auto_purchase_status !== '';
|
||||
|
||||
const getRechargeOrderSubmitKey = (rechargeOrder) => rechargeOrder.recharge_order_no ||
|
||||
rechargeOrder.recharge_no ||
|
||||
rechargeOrder.recharge_id ||
|
||||
rechargeOrder.order_id ||
|
||||
`${rechargeOrder.amount}-${rechargeOrder.created_at}`;
|
||||
|
||||
const isRechargeOrderSubmitting = (rechargeOrder) => rechargeOrderSubmittingKey.value ===
|
||||
getRechargeOrderSubmitKey(rechargeOrder);
|
||||
|
||||
const loadWalletDetail = async () => {
|
||||
try {
|
||||
const data = await walletApi.getDetail(userStore.state.identifier);
|
||||
@@ -480,6 +503,9 @@
|
||||
};
|
||||
|
||||
const handleRechargePayment = async (rechargeOrder) => {
|
||||
if (rechargeOrderSubmittingKey.value !== null) return;
|
||||
|
||||
rechargeOrderSubmittingKey.value = getRechargeOrderSubmitKey(rechargeOrder);
|
||||
uni.showLoading({
|
||||
title: '处理中...',
|
||||
mask: true
|
||||
@@ -528,6 +554,8 @@
|
||||
title: errorMsg,
|
||||
icon: 'none'
|
||||
});
|
||||
} finally {
|
||||
rechargeOrderSubmittingKey.value = null;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -787,9 +815,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
.record-actions {
|
||||
margin-top: 20rpx;
|
||||
padding-top: 20rpx;
|
||||
.record-actions {
|
||||
margin-top: 20rpx;
|
||||
padding-top: 20rpx;
|
||||
border-top: 1rpx solid var(--border-light);
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
@@ -800,12 +828,16 @@
|
||||
border: none;
|
||||
border-radius: 8rpx;
|
||||
padding: 12rpx 32rpx;
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
width:100%;
|
||||
font-size: 26rpx;
|
||||
font-weight: 500;
|
||||
width:100%;
|
||||
|
||||
&::after {
|
||||
border: none;
|
||||
&[disabled] {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
&::after {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -931,6 +963,10 @@
|
||||
font-weight: 500;
|
||||
border: none;
|
||||
|
||||
&[disabled] {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
&.btn-secondary {
|
||||
background: var(--gray-200);
|
||||
color: var(--text-primary);
|
||||
@@ -943,4 +979,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user