Преглед изворни кода

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

zjl пре 2 година
родитељ
комит
0f683045be
1 измењених фајлова са 7 додато и 1 уклоњено
  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