feat: 客服平台/商家订单列表与详情返回自动结算倒计时并支持筛选
对齐小程序口径:eligible 才下发;auto_settle_pending=1 筛待自动结算。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -189,6 +189,10 @@ class KefuGetOrderListView(APIView):
|
||||
if clkf:
|
||||
q_conditions &= Q(AssignedCS__icontains=clkf)
|
||||
|
||||
from orders.services.merchant_order_list_filters import wants_auto_settle_pending
|
||||
if wants_auto_settle_pending(request.data):
|
||||
q_conditions &= Q(Status=8, AutoSettleEligible=True, AutoExpireAt__isnull=False)
|
||||
|
||||
from jituan.services.club_context import (
|
||||
count_order_status_buckets,
|
||||
order_scope_qs,
|
||||
@@ -230,12 +234,13 @@ class KefuGetOrderListView(APIView):
|
||||
for user in users:
|
||||
nickname_map[user.UserUID] = (user.BossProfile.nickname or '') if getattr(user, 'BossProfile', None) else ''
|
||||
|
||||
from jituan.services.order_deal import order_auto_settle_payload
|
||||
result_list = []
|
||||
for order in orders_page:
|
||||
ext = ext_map.get(order.OrderID)
|
||||
laoban_id = ext.BossID if ext else ''
|
||||
youxi_nicheng = nickname_map.get(laoban_id, order.Nickname or '')
|
||||
result_list.append({
|
||||
item = {
|
||||
'dingdan_id': order.OrderID or '',
|
||||
'jieshao': order.Description or '',
|
||||
'zhuangtai': order.Status,
|
||||
@@ -245,7 +250,9 @@ class KefuGetOrderListView(APIView):
|
||||
'tupian_url': order.ImageURL or '',
|
||||
'fadanshijian': order.CreateTime.strftime('%Y-%m-%d %H:%M:%S') if order.CreateTime else '',
|
||||
'youxi_nicheng': youxi_nicheng
|
||||
})
|
||||
}
|
||||
item.update(order_auto_settle_payload(order))
|
||||
result_list.append(item)
|
||||
|
||||
from jituan.services.club_user_access import list_response_meta
|
||||
|
||||
@@ -372,6 +379,10 @@ class KefuGetShangjiaOrderListView(APIView):
|
||||
ShopProfile__nicheng__icontains=shangjia_nicheng
|
||||
).values_list('UserUID', flat=True))
|
||||
|
||||
from orders.services.merchant_order_list_filters import wants_auto_settle_pending
|
||||
if wants_auto_settle_pending(request.data):
|
||||
q_conditions &= Q(Status=8, AutoSettleEligible=True, AutoExpireAt__isnull=False)
|
||||
|
||||
from jituan.services.club_context import (
|
||||
count_order_status_buckets,
|
||||
order_scope_qs,
|
||||
@@ -412,12 +423,13 @@ class KefuGetShangjiaOrderListView(APIView):
|
||||
for user in users:
|
||||
nickname_map[user.UserUID] = user.ShopProfile.nicheng or '' if hasattr(user, 'ShopProfile') else ''
|
||||
|
||||
from jituan.services.order_deal import order_auto_settle_payload
|
||||
result_list = []
|
||||
for order in orders_page:
|
||||
ext = ext_map.get(order.OrderID)
|
||||
shangjia_id = ext.MerchantID if ext else ''
|
||||
youxi_nicheng = order.Nickname or ''
|
||||
result_list.append({
|
||||
item = {
|
||||
'dingdan_id': order.OrderID or '',
|
||||
'jieshao': order.Description or '',
|
||||
'zhuangtai': order.Status,
|
||||
@@ -427,7 +439,9 @@ class KefuGetShangjiaOrderListView(APIView):
|
||||
'tupian_url': order.ImageURL or '',
|
||||
'fadanshijian': order.CreateTime.strftime('%Y-%m-%d %H:%M:%S') if order.CreateTime else '',
|
||||
'youxi_nicheng': youxi_nicheng
|
||||
})
|
||||
}
|
||||
item.update(order_auto_settle_payload(order))
|
||||
result_list.append(item)
|
||||
|
||||
from jituan.services.club_user_access import list_response_meta
|
||||
|
||||
@@ -1669,6 +1683,12 @@ class KefuGetOrderDetailView(APIView):
|
||||
response_data['fakuan_info'] = None
|
||||
response_data['is_fadaned'] = False
|
||||
|
||||
try:
|
||||
from jituan.services.order_deal import order_auto_settle_payload
|
||||
response_data.update(order_auto_settle_payload(dingdan_obj))
|
||||
except Exception as e:
|
||||
logger.warning('[kefuhqddxq] 自动结算字段附加失败 dingdan_id=%s: %s', dingdan_id, e)
|
||||
|
||||
return Response({'code': 0, 'data': response_data})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user