|
@@ -115,6 +115,27 @@ class OrderViewSet(CustomModelViewSet):
|
|
|
return response_error(str(e))
|
|
|
return response_ok()
|
|
|
|
|
|
+ @action(methods=['post'], detail=True)
|
|
|
+ def uncheck(self, request, pk):
|
|
|
+ # 撤销进度审核
|
|
|
+ try:
|
|
|
+ instance = Order.objects.filter(id=pk).first()
|
|
|
+ if not instance:
|
|
|
+ raise CustomError('订单不存在')
|
|
|
+ instance.status = Order.NORMAL
|
|
|
+ instance.save()
|
|
|
+ stage_progress = Option.objects.filter(type=instance.stage_progress.type,
|
|
|
+ sort__gt=instance.stage_progress.sort,
|
|
|
+ enable=True).order_by('sort').first()
|
|
|
+ user = request.user
|
|
|
+ operation = u'撤销【{0}】进度审核。'.format(stage_progress.name)
|
|
|
+ ProgressDetails.objects.create(order=instance, user=user, operation=operation)
|
|
|
+ except CustomError as e:
|
|
|
+ return response_error(e.get_error_msg())
|
|
|
+ except Exception as e:
|
|
|
+ return response_error(str(e))
|
|
|
+ return response_ok(u'撤销完成!')
|
|
|
+
|
|
|
|
|
|
class GetDetailsView(APIView):
|
|
|
permission_classes = [isLogin]
|