Explorar o código

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

zjl %!s(int64=2) %!d(string=hai) anos
pai
achega
0f683045be
Modificáronse 1 ficheiros con 7 adicións e 1 borrados
  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.exceptions import ServiceException
 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.exceptions import UnifiedConsumeOrderError
 from apps.web.user.models import ConsumeRecord, UserBalanceLog, Card, CardBalanceLog
@@ -69,10 +69,16 @@ def getUnifiedOrder(request):
     if order.status != order.Status.WAIT_CONF:
         return JsonErrorResponse(u"订单状态异常,请重新扫码下单")
 
+    balance = order.user.calc_currency_balance(
+        dealer=order.owner,
+        group=order.group
+    )
+
     return JsonOkResponse(payload={
         "orderNo": order.orderNo,
         "price": order.price,
         "isFree": order.isFree,
+        "balance": balance,
         "isPostPaid": order.isPostPaid,
         "logicalCode": order.logicalCode,
         "package": order.package.showDict