商家罚款增加平台审核:新增状态5、证据图、审核API;审核通过前不影响抢单,提现仍拦截未结案罚单

This commit is contained in:
XingQue
2026-07-02 01:53:25 +08:00
parent 9fe03727c5
commit c21168ad2d
8 changed files with 194 additions and 26 deletions

View File

@@ -12,7 +12,7 @@ from .view import (GetRolePermissionView,
ShopModifyView, ShopPublicTypeAndAuditView, ShopListForProductView, ShopProductModifyView,
ShopProductTypeMappingView, ProductListView, ProductModifyView, KefuChatPermissionsView,
FineApplyView, PunishDashouView,
FaKuanTongJiView, FaKuanLieBiaoView, FaKuanChuLiView, FaKuanChuangJianView,
FaKuanTongJiView, FaKuanLieBiaoView, FaKuanChuLiView, FaKuanChuangJianView, FaKuanPingTaiShenHeView,
HqbkxxView,BkxgView,CaiwuView,CwhybkhqView, HybkjtsjView, SzxxView, CwddhqlxView, CwhqjtddsjView,
CwqtczhqView, KhpzhqView, ChzsgcView,KhgglView, ShgxgsjView, KhjlglView, KhjlczView, ZxkfghdsView)
from config.views import MiniappScriptHoutaiListView, MiniappScriptHoutaiModifyView
@@ -89,6 +89,7 @@ urlpatterns = [
path('htglyhqcfsltj', FaKuanTongJiView.as_view(),name='后台罚单统计图片'), # 罚款统计
path('hthqfklb', FaKuanLieBiaoView.as_view(),name='后台罚单列表'), # 罚款列表
path('glyclfk', FaKuanChuLiView.as_view(),name='后台罚单操作'), # 处理罚款
path('glyptshfk', FaKuanPingTaiShenHeView.as_view(), name='后台罚款平台审核'),
path('htfksc', FaKuanChuangJianView.as_view(),name='后台生成罚单'), # 创建罚款
path('kffkdssq', FineApplyView.as_view(), name='客服罚款申请'), # 客服罚款申请
path('kpcf', PunishDashouView.as_view(), name='客服处罚打手'), # 客服处罚打手

View File

@@ -6609,6 +6609,72 @@ class FaKuanChuLiView(APIView):
return Response({'code': 500, 'msg': '系统繁忙'})
class FaKuanPingTaiShenHeView(APIView):
"""
平台审核商家提交的罚款(同意/驳回)
POST /houtai/glyptshfk
action: platform_approve | platform_reject
"""
permission_classes = [IsAuthenticated]
parser_classes = [MultiPartParser, FormParser, JSONParser]
def post(self, request):
try:
from utils.penalty_status import (
PENALTY_PLATFORM_AUDIT, PENALTY_PENDING_PAY, PENALTY_APPEALING, PENALTY_REJECTED,
)
username = request.data.get('username', '').strip()
penalty_id = request.data.get('penalty_id') or request.data.get('fadan_id')
action = request.data.get('action', '').strip()
chuli_liyou = request.data.get('chuli_liyou', '').strip()
if not all([username, penalty_id, action]):
return Response({'code': 400, 'msg': '参数不完整'})
kefu, permissions = verify_kefu_permission(request, username)
if kefu is None:
return permissions
with transaction.atomic():
try:
penalty = Penalty.objects.select_for_update().get(id=penalty_id)
except Penalty.DoesNotExist:
return Response({'code': 404, 'msg': '罚单不存在'})
deny = forbid_penalty_out_of_scope(request, penalty)
if deny:
return deny
if penalty.Status != PENALTY_PLATFORM_AUDIT:
return Response({'code': 400, 'msg': '当前状态不可平台审核'})
if not check_fadan_permission(permissions, penalty.Identity):
return Response({'code': 403, 'msg': '无权限处理该类罚单'})
if action == 'platform_approve':
if penalty.AppealReason:
penalty.Status = PENALTY_APPEALING
else:
penalty.Status = PENALTY_PENDING_PAY
penalty.ApproveReason = chuli_liyou or penalty.ApproveReason or ''
elif action == 'platform_reject':
penalty.Status = PENALTY_REJECTED
penalty.RejectReason = chuli_liyou or '平台审核驳回'
else:
return Response({'code': 400, 'msg': '无效的操作类型'})
penalty.ProcessorID = request.user.Phone
penalty.ProcessorIdentity = 3
penalty.save()
logger.info(f"罚款平台审核成功: {penalty_id}, 操作: {action}")
return Response({'code': 0, 'msg': '平台审核完成'})
except Exception as e:
logger.error(f"罚款平台审核异常: {traceback.format_exc()}")
return Response({'code': 500, 'msg': '系统繁忙'})
class FaKuanChuangJianView(APIView):
"""
管理员创建罚款