Browse Source

用户下单的时候显示可用余额

zjl 2 years ago
parent
commit
0f683045be
1 changed files with 7 additions and 1 deletions
  1. 7 1
      apps/web/user/views2.py

+ 7 - 1
apps/web/user/views2.py

@@ -12,7 +12,7 @@ from apps.web.constant import Const, START_DEVICE_STATUS
 from apps.web.core import ROLE
 from apps.web.core import ROLE
 from apps.web.core.exceptions import ServiceException
 from apps.web.core.exceptions import ServiceException
 from apps.web.core.services import wrapper_start_device, StartDeviceEngine
 from apps.web.core.services import wrapper_start_device, StartDeviceEngine
-from apps.web.core.utils import JsonOkResponse, JsonErrorResponse, async_operation_no_catch, DefaultJsonErrorResponse
+from apps.web.core.utils import JsonOkResponse, JsonErrorResponse, async_operation_no_catch
 from apps.web.device.models import DeviceType
 from apps.web.device.models import DeviceType
 from apps.web.exceptions import UnifiedConsumeOrderError
 from apps.web.exceptions import UnifiedConsumeOrderError
 from apps.web.user.models import ConsumeRecord, UserBalanceLog, Card, CardBalanceLog
 from apps.web.user.models import ConsumeRecord, UserBalanceLog, Card, CardBalanceLog
@@ -69,10 +69,16 @@ def getUnifiedOrder(request):
     if order.status != order.Status.WAIT_CONF:
     if order.status != order.Status.WAIT_CONF:
         return JsonErrorResponse(u"订单状态异常,请重新扫码下单")
         return JsonErrorResponse(u"订单状态异常,请重新扫码下单")
 
 
+    balance = order.user.calc_currency_balance(
+        dealer=order.owner,
+        group=order.group
+    )
+
     return JsonOkResponse(payload={
     return JsonOkResponse(payload={
         "orderNo": order.orderNo,
         "orderNo": order.orderNo,
         "price": order.price,
         "price": order.price,
         "isFree": order.isFree,
         "isFree": order.isFree,
+        "balance": balance,
         "isPostPaid": order.isPostPaid,
         "isPostPaid": order.isPostPaid,
         "logicalCode": order.logicalCode,
         "logicalCode": order.logicalCode,
         "package": order.package.showDict
         "package": order.package.showDict