feat: 假单计入类型数量;按类型配置强制展示订单价格
This commit is contained in:
@@ -118,6 +118,37 @@ class ClubShangpinLeixingIconView(APIView):
|
||||
return Response({'code': 0, 'msg': '上传成功', 'data': data})
|
||||
|
||||
|
||||
class ClubShangpinLeixingShowPriceView(APIView):
|
||||
"""POST /jituan/houtai/club-leixing-show-price 开关该类型强制展示订单价格"""
|
||||
permission_classes = [IsAuthenticated]
|
||||
parser_classes = [JSONParser]
|
||||
|
||||
def post(self, request):
|
||||
phone = (request.data.get('phone') or request.data.get('username') or '').strip()
|
||||
leixing_id = request.data.get('leixing_id')
|
||||
if not phone or leixing_id in (None, ''):
|
||||
return Response({'code': 400, 'msg': '参数不完整'})
|
||||
kefu, permissions = verify_kefu_permission(request, phone)
|
||||
if kefu is None:
|
||||
return permissions
|
||||
if not _has_club_leixing_perm(permissions):
|
||||
return Response({'code': 403, 'msg': '无权限'})
|
||||
raw = request.data.get('show_price', request.data.get('enabled'))
|
||||
if isinstance(raw, str):
|
||||
show_price = raw.strip().lower() in ('1', 'true', 'yes', 'on')
|
||||
else:
|
||||
show_price = bool(raw)
|
||||
from jituan.services.club_shangpin_leixing import set_leixing_show_price
|
||||
data, err = set_leixing_show_price(request, int(leixing_id), show_price)
|
||||
if err:
|
||||
return Response({'code': 400, 'msg': err})
|
||||
return Response({
|
||||
'code': 0,
|
||||
'msg': '已开启价格展示' if data.get('show_price') else '已关闭价格展示',
|
||||
'data': data,
|
||||
})
|
||||
|
||||
|
||||
class ClubKaoheChenghaoListView(APIView):
|
||||
"""POST /jituan/houtai/club-kaohe-list"""
|
||||
permission_classes = [IsAuthenticated]
|
||||
|
||||
Reference in New Issue
Block a user