From 27d203810e3b9e01fe8edad6a3f6ec0796e27113 Mon Sep 17 00:00:00 2001 From: XingQue Date: Fri, 17 Jul 2026 01:57:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A2=E5=8D=95=E6=8A=BC=E9=87=91=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E8=AE=A1=E5=85=A5=E5=86=BB=E7=BB=93=E6=8A=BC=E9=87=91?= =?UTF-8?q?=E6=B1=A0=EF=BC=8C=E6=8F=90=E7=8E=B0=E7=AD=89=E5=85=B6=E5=AE=83?= =?UTF-8?q?=E5=9C=BA=E6=99=AF=E4=BB=8D=E5=8F=AA=E8=AE=A4=E6=9C=AA=E5=86=BB?= =?UTF-8?q?=E7=BB=93=E4=BD=99=E9=A2=9D=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- dingdan/views.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/dingdan/views.py b/dingdan/views.py index d3ab163..367d98f 100644 --- a/dingdan/views.py +++ b/dingdan/views.py @@ -4297,10 +4297,20 @@ class QiangdanView(APIView): return {'success': False, 'message': '未开通对应会员,无法抢此订单'} def _validate_yajin_requirement(self, order, dashou_profile): - yajin_required = order.yongjin or 0 - dashou_yajin = dashou_profile.yajin or 0 - if dashou_yajin < yajin_required: - return {'success': False, 'message': f'押金不足,需要{yajin_required}元,当前有{dashou_yajin}元'} + """抢单专用:冻结押金(dongjie_chi_yajin)也算可用,提现等其它场景仍只认未冻结余额。""" + from decimal import Decimal + yajin_required = Decimal(str(order.yongjin or 0)) + free_yajin = Decimal(str(dashou_profile.yajin or 0)) + frozen_yajin = Decimal(str(getattr(dashou_profile, 'dongjie_chi_yajin', 0) or 0)) + usable_yajin = free_yajin + frozen_yajin + if usable_yajin < yajin_required: + return { + 'success': False, + 'message': ( + f'押金不足,需要{yajin_required}元,' + f'当前可用{usable_yajin}元(含冻结{frozen_yajin}元)' + ), + } return {'success': True, 'message': '押金验证通过'} def _execute_qiangdan(self, order, dashou_profile, dashou_yonghuid):