diff --git a/pages/detail/detail.vue b/pages/detail/detail.vue index 7f5a583..b2d79a6 100755 --- a/pages/detail/detail.vue +++ b/pages/detail/detail.vue @@ -51,8 +51,11 @@ v-if="portfolioData.logicModel" :border="false" :shadow="false" + :show-head="false" + :show-foot="false" class="strategy-info-card" > + @@ -86,8 +90,11 @@ :key="item.id || index" :border="false" :shadow="false" + :show-head="false" + :show-foot="false" class="position-card" > + @@ -430,7 +438,7 @@ const fetchPortfolioData = async () => { } } catch (error) { console.error('获取投资组合数据失败:', error); - uni.$u.toast.error('加载失败,请重试'); + uni.showToast({ title: '加载失败,请重试', icon: 'none' }); } }; @@ -450,7 +458,7 @@ const fetchTransactions = async () => { } } catch (error) { console.error('获取交易记录失败:', error); - uni.$u.toast.error('加载交易记录失败'); + uni.showToast({ title: '加载交易记录失败', icon: 'none' }); } }; @@ -508,18 +516,18 @@ const resetTransactionForm = () => { const submitTransaction = async () => { // 表单验证 if (!transactionForm.value.stockCode) { - return uni.$u.toast.error(transactionType.value === 'sell' ? '请选择要卖出的持仓' : '请输入股票代码'); + return uni.showToast({ title: transactionType.value === 'sell' ? '请选择要卖出的持仓' : '请输入股票代码', icon: 'none' }); } const amount = parseFloat(transactionForm.value.amount); if (!amount || amount <= 0) { - return uni.$u.toast.error('请输入有效的数量'); + return uni.showToast({ title: '请输入有效的数量', icon: 'none' }); } // 卖出时校验数量不超过持仓 if (transactionType.value === 'sell' && amount > maxSellAmount.value) { - return uni.$u.toast.error(`卖出数量不能超过持仓数量 ${maxSellAmount.value}`); + return uni.showToast({ title: `卖出数量不能超过持仓数量 ${maxSellAmount.value}`, icon: 'none' }); } if (!transactionForm.value.price || parseFloat(transactionForm.value.price) <= 0) { - return uni.$u.toast.error('请输入有效的价格'); + return uni.showToast({ title: '请输入有效的价格', icon: 'none' }); } const transactionData = { @@ -533,12 +541,13 @@ const submitTransaction = async () => { remark: transactionForm.value.remark }; - uni.$u.toast.loading('提交中...'); + uni.showLoading({ title: '提交中...', mask: true }); try { const response = await api.assets.createTransaction(transactionData); if (response.code === 200) { - uni.$u.toast.success('交易提交成功'); + uni.hideLoading(); + uni.showToast({ title: '交易提交成功', icon: 'success' }); showTransactionForm.value = false; // 重新获取交易记录 @@ -548,20 +557,21 @@ const submitTransaction = async () => { } } catch (error) { console.error('创建交易失败:', error); - uni.$u.toast.error('提交失败,请重试'); + uni.hideLoading(); + uni.showToast({ title: '提交失败,请重试', icon: 'none' }); } }; // 删除组合 const deletePortfolio = async () => { - uni.$u.showModal({ + uni.showModal({ title: '确认删除', content: '删除后所有持仓和交易记录都会丢失,确定要删除这个组合吗?', confirmText: '删除', confirmColor: '#EF4444', success: async (res) => { if (res.confirm) { - uni.$u.toast.loading('删除中'); + uni.showLoading({ title: '删除中', mask: true }); try { // 调用删除组合接口 const response = await uni.request({ @@ -573,13 +583,15 @@ const deletePortfolio = async () => { }); if (response.statusCode === 200) { - uni.$u.toast.success('删除成功'); + uni.hideLoading(); + uni.showToast({ title: '删除成功', icon: 'success' }); setTimeout(() => uni.switchTab({ url: '/pages/index/index' }), 1500); } else { throw new Error('删除失败'); } } catch (error) { - uni.$u.toast.error('删除失败,请重试'); + uni.hideLoading(); + uni.showToast({ title: '删除失败,请重试', icon: 'none' }); } } }