feat: 商家退款申请支持证据图片
新增 tuikuantupian 表;申请退款必传图片;打手详情与客服订单详情返回退款图。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -834,6 +834,33 @@ class DashouCOSZhengshuView(APIView):
|
||||
resolve_penalty_evidence_upload_auth(request, dingdan_id, fadan_id=fadan_id)
|
||||
except PenaltyEvidenceAuthError as e:
|
||||
return Response({'code': e.code, 'msg': e.msg}, status=403)
|
||||
elif yongtu == 'tuikuan_evidence':
|
||||
# 商家老板或能操作该订单的子客服上传退款证据图
|
||||
if not dingdan_id:
|
||||
return Response({'code': 400, 'msg': '缺少订单ID'}, status=400)
|
||||
uid = getattr(request.user, 'UserUID', None)
|
||||
allowed = False
|
||||
try:
|
||||
from orders.models import MerchantOrderExt
|
||||
sj = getattr(request.user, 'ShopProfile', None)
|
||||
if sj and getattr(sj, 'zhuangtai', None) == 1:
|
||||
if MerchantOrderExt.query.filter(
|
||||
Order__OrderID=dingdan_id, MerchantID=uid
|
||||
).exists():
|
||||
allowed = True
|
||||
except Exception:
|
||||
pass
|
||||
if not allowed:
|
||||
try:
|
||||
from merchant_ops.services.authz import get_active_staff_member, staff_can_access_order
|
||||
member = get_active_staff_member(request.user)
|
||||
if member:
|
||||
ok, _ = staff_can_access_order(member, dingdan_id)
|
||||
allowed = bool(ok)
|
||||
except Exception:
|
||||
pass
|
||||
if not allowed:
|
||||
return Response({'code': 403, 'msg': '无权上传退款图片'}, status=403)
|
||||
else:
|
||||
# 默认为订单相关,需要验证订单且打手必须接单
|
||||
try:
|
||||
@@ -881,6 +908,10 @@ class DashouCOSZhengshuView(APIView):
|
||||
resources.append(
|
||||
f"qcs::cos:{settings.COS_REGION}:uid/{settings.COS_APPID}:{settings.COS_BUCKET}/fakuan/shangjiafakuan/zhengju/*"
|
||||
)
|
||||
elif yongtu == 'tuikuan_evidence':
|
||||
resources.append(
|
||||
f"qcs::cos:{settings.COS_REGION}:uid/{settings.COS_APPID}:{settings.COS_BUCKET}/tuikuan/shangjiatuikuan/zhengju/*"
|
||||
)
|
||||
else:
|
||||
resources.append(
|
||||
f"qcs::cos:{settings.COS_REGION}:uid/{settings.COS_APPID}:{settings.COS_BUCKET}/order/{dingdan_id}/*"
|
||||
@@ -920,7 +951,8 @@ class DashouCOSZhengshuView(APIView):
|
||||
# 5. 构建响应
|
||||
current_time = int(time.time())
|
||||
upload_dir = (
|
||||
'fakuan/shangjiafakuan/zhengju/' if yongtu == 'fakuan_evidence' else
|
||||
'tuikuan/shangjiatuikuan/zhengju/' if yongtu == 'tuikuan_evidence' else
|
||||
'fakuan/shangjiafakuan/zhengju/' if yongtu in ('fakuan_evidence', 'fakuan_evidence_draft') else
|
||||
'fakuan/dashoufakuan/dashoufakuanshensu/' if yongtu == 'fakuan' else (
|
||||
'a_long/chfajltp/dssstp/' if yongtu == 'chufa' else f'order/{dingdan_id}/'
|
||||
)
|
||||
@@ -1325,6 +1357,16 @@ class DashouDingdanXiangqingView(APIView):
|
||||
'fuwudashou_id': dingdan.PlayerID or '',
|
||||
'fadanpingtai': dingdan.Platform or ''
|
||||
}
|
||||
try:
|
||||
from orders.models import RefundEvidenceImage
|
||||
dingdan_data['tuikuan_tupian'] = list(
|
||||
RefundEvidenceImage.query.filter(OrderID=dingdan.OrderID)
|
||||
.exclude(ImageURL__isnull=True)
|
||||
.exclude(ImageURL='')
|
||||
.values_list('ImageURL', flat=True)
|
||||
)
|
||||
except Exception:
|
||||
dingdan_data['tuikuan_tupian'] = []
|
||||
try:
|
||||
from jituan.services.order_deal import order_auto_settle_payload
|
||||
dingdan_data.update(order_auto_settle_payload(dingdan))
|
||||
|
||||
Reference in New Issue
Block a user