本文整理汇总了Python中sellcard.common.Method.getPayDiscDict方法的典型用法代码示例。如果您正苦于以下问题:Python Method.getPayDiscDict方法的具体用法?Python Method.getPayDiscDict怎么用?Python Method.getPayDiscDict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sellcard.common.Method
的用法示例。
在下文中一共展示了Method.getPayDiscDict方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: save
# 需要导入模块: from sellcard.common import Method [as 别名]
# 或者: from sellcard.common.Method import getPayDiscDict [as 别名]
def save(request):
operator = request.session.get('s_uid','')
shopCode = request.session.get('s_shopcode','')
depart = request.session.get('s_depart','')
#入卡列表
cardListInStr = request.POST.get('cardListIn','')
cardListIn = json.loads(cardListInStr)
#入卡合计
totalNumIn = request.POST.get('totalNumIn',0)
totalValIn = request.POST.get('totalValIn',0.00)
#出卡列表
cardListOutStr = request.POST.get('cardListOut','')
cardListOut = json.loads(cardListOutStr)
#出卡合计
totalNumOut = request.POST.get('totalNumOut',0)
totalValOut = request.POST.get('totalValOut',0.00)
#优惠卡列表
discListStr = request.POST.get('discList','')
discList = json.loads(discListStr)
#优惠返现
discCash = request.POST.get('discCash',0.00)
#优惠返点金额
disc = request.POST.get('disc',0.00)
# 优惠返点比率
disRate = request.POST.get('disRate',0.00)
#优惠补差
discPay = request.POST.get('discPay',0.00)
#折扣授权码
discCode = request.POST.get('discCode','')
# 支付方式
payStr = request.POST.get('payStr', '')
payList = json.loads(payStr)
hjsStr = request.POST.get('hjsStr', '')
# 黄金手卡号列表
hjsList = []
if len(hjsStr) > 0:
hjsStr = hjsStr[0:len(hjsStr) - 1]
hjsList = hjsStr.split(',')
#买卡人信息
buyerName = (request.POST.get('buyerName','')).strip()
buyerPhone = (request.POST.get('buyerPhone','')).strip()
order_sn = ''
res = {}
try:
# 检测session中Token值,判断用户提交动作是否合法
Token = request.session.get('postToken', default=None)
# 获取用户表单提交的Token值
userToken = request.POST.get('postToken', '')
if userToken != Token:
raise MyError('表单重复提交,刷新页面后,重试!')
with transaction.atomic():
order_sn = 'C'+mth.setOrderSn(OrderChangeCard)
created_time=datetime.datetime.today()
cardIsStoreList = []
cardCommonList = []
#1、更新cardInventory中入库卡数据
for card in cardListIn:
queryCard = CardInventory \
.objects \
.filter(card_status='2', card_action='0', card_no=card['cardId'], card_value=F('card_blance'))
cardInventory = queryCard.values('is_store').first()
is_store = 0
if cardInventory:
is_store = cardInventory['is_store']
if is_store:
cardIsStoreList.append(card)
status = '7'
action = '0'
else:
cardCommonList.append(card)
status = '1'
action = '1'
resUpdate = resSave = 0
#处理老卡换入
if not cardInventory:
obj = CardInventory \
.objects \
.create(card_no=card['cardId'], card_value=card['cardVal'], card_status='1', card_action='1',
card_addtime=datetime.datetime.now(), shop_code=shopCode,
is_store=0, card_blance=card['cardVal'])
resSave = obj.id
else:
resUpdate = queryCard.update(card_status=status, card_action=action, shop_code=shopCode)
if (resUpdate == 0 and resSave == 0):
raise MyError(card['cardId'] + '状态更新失败')
#2、保存支付信息
isThird = False
payDiscDict = mth.getPayDiscDict()
ChangePaymentList = []
for pay in payList:
#.........这里部分代码省略.........
示例2: saveOrder
# 需要导入模块: from sellcard.common import Method [as 别名]
# 或者: from sellcard.common.Method import getPayDiscDict [as 别名]
def saveOrder(request):
path = request.path
operator = request.session.get('s_uid','')
shopcode = request.session.get('s_shopcode','')
depart = request.session.get('s_depart','')
actionType = request.POST.get('actionType','')
#售卡列表
cardStr = request.POST.get('cardStr','')
cardList = json.loads(cardStr)
#赠卡列表
YcardStr = request.POST.get('YcardStr','')
YcardList = json.loads(YcardStr)
Ycash = request.POST.get('Ycash','')
#支付方式
payStr = request.POST.get('payStr','')
payList = json.loads(payStr)
# hjsStr = request.POST.get('hjsStr','')
#黄金手卡号列表
# hjsList=[]
# if len(hjsStr)>0:
# hjsStr = hjsStr[0:len(hjsStr)-1]
# hjsList = hjsStr.split(',')
#合计信息
totalVal = request.POST.get('totalVal',0.00)
discountRate = float(request.POST.get('discount',0.00))/100
disCode = request.POST.get('disCode','')
discountVal = float(request.POST.get('discountVal',''))
Ybalance = request.POST.get('Ybalance',0.00)
#买卡人信息
buyerName = request.POST.get('buyerName','')
buyerPhone = request.POST.get('buyerPhone','')
buyerCompany = request.POST.get('buyerCompany','')
res = {}
try:
# 检测session中Token值,判断用户提交动作是否合法
Token = request.session.get('postToken', default=None)
# 获取用户表单提交的Token值
userToken = request.POST.get('postToken', '')
if userToken != Token:
raise MyError('表单重复提交,刷新页面后,重试!')
with transaction.atomic():
order_sn = 'S'+mth.setOrderSn()
isThird = False
#保存OrderPaymentInfo
payDiscDict = mth.getPayDiscDict()
oderPaymentList = []
for pay in payList:
orderPay = OrderPaymentInfo()
orderPay.order_id = order_sn
orderPay.pay_id = pay['payId']
#处理混合支付的优惠
is_pay = 1
if pay['payId'] =='3':
is_pay = '0'
elif pay['payId'] =='4':
is_pay = '0'
orderPay.received_time = pay['received_time']
elif pay['payId'] == '6':
isThird = True
is_pay = '0'
discountRate = payDiscDict[pay['payId']]
discountVal = Ycash = float(pay['payVal']) * float(discountRate)
elif pay['payId'] in ('7','8','10','11'):
isThird = True
discountRate = payDiscDict[pay['payId']]
discountVal = Ycash = float(pay['payVal']) * float(discountRate)
# if pay['payId'] == '9':
# isThird = True
# mth.upChangeCode(hjsList,shopcode)
orderPay.is_pay = is_pay
orderPay.pay_value = pay['payVal']
orderPay.remarks = pay['payRmarks']
oderPaymentList.append(orderPay)
OrderPaymentInfo.objects.bulk_create(oderPaymentList)
# 保存OrderInfo
orderInfoList = []
for card in cardList:
orderInfo = OrderInfo()
orderInfo.order_id = order_sn
orderInfo.card_id = card['cardId'].strip()
orderInfo.card_balance = float(card['cardVal'])
orderInfo.card_action = '0'
orderInfo.card_attr = '1'
orderInfoList.append(orderInfo)
if not isThird:
for Ycard in YcardList:
YorderInfo = OrderInfo()
YorderInfo.order_id = order_sn
YorderInfo.card_id = Ycard['cardId'].strip()
YorderInfo.card_balance = float(Ycard['cardVal'])
#.........这里部分代码省略.........
示例3: save
# 需要导入模块: from sellcard.common import Method [as 别名]
# 或者: from sellcard.common.Method import getPayDiscDict [as 别名]
def save(request):
operator = request.session.get('s_uid','')
shopcode = request.session.get('s_shopcode','')
depart = request.session.get('s_depart','')
actionType = request.POST.get('actionType','')
#借卡单号列表
orderSnList = request.POST.get('orderSnList[]','')
orderBorrow = OrderBorrow.objects.filter(order_sn=orderSnList)
if not orderBorrow.count():
return {'status':0,'msg':'此订单不存在'}
buyer = orderBorrow.values('borrow_name', 'borrow_depart', 'borrow_phone').first()
#未退还卡列表
cardList = OrderBorrowInfo.objects.values('card_no','card_balance').filter(order_sn=orderSnList,is_back=None)
#赠卡列表
YcardStr = request.POST.get('YcardStr','')
YcardList = json.loads(YcardStr)
Ycash = request.POST.get('Ycash',0.00)
#支付方式
payStr = request.POST.get('payStr','')
payList = json.loads(payStr)
# 黄金手卡号列表
# hjsStr = request.POST.get('hjsStr','')
# hjsList=[]
# if len(hjsStr)>0:
# hjsStr = hjsStr[0:len(hjsStr)-1]
# hjsList = hjsStr.split(',')
#合计信息
totalVal = request.POST.get('totalVal',0.00)
discountRate = float(request.POST.get('discount',0.00))/100
disCode = request.POST.get('disCode','')
discountVal = float(request.POST.get('discountVal',''))
Ybalance = request.POST.get('Ybalance',0.00)
order_sn = ''
res = {}
try:
# 检测session中Token值,判断用户提交动作是否合法
Token = request.session.get('postToken', default=None)
# 获取用户表单提交的Token值
userToken = request.POST.get('postToken', '')
if userToken != Token:
raise MyError('表单重复提交,刷新页面后,重试!')
with transaction.atomic():
order_sn = 'S'+mth.setOrderSn()
payDiscDict = mth.getPayDiscDict()
isThird = False
paymentList = []
for pay in payList:
orderPay = OrderPaymentInfo()
orderPay.order_id = order_sn
orderPay.pay_id = pay['payId']
# 处理混合支付的优惠
is_pay = 1
if pay['payId'] =='3':
is_pay = '0'
elif pay['payId'] =='4':
is_pay = '0'
orderPay.received_time = pay['received_time']
elif pay['payId'] == '6':
isThird = True
is_pay = '0'
discountRate = payDiscDict[pay['payId']]
discountVal = Ycash = float(pay['payVal']) * float(discountRate)
elif pay['payId'] in ('7', '8', '10', '11'):
isThird = True
discountRate = payDiscDict[pay['payId']]
discountVal = Ycash = float(pay['payVal']) * float(discountRate)
orderPay.is_pay = is_pay
# if pay['payId']=='9':
# isThird = True
# mth.upChangeCode(hjsList,shopcode)
orderPay.pay_value = pay['payVal']
orderPay.remarks = pay['payRmarks']
paymentList.append(orderPay)
OrderPaymentInfo.objects.bulk_create(paymentList)
infoList = []
for card in cardList:
orderInfo = OrderInfo()
orderInfo.order_id = order_sn
orderInfo.card_id = card['card_no']
orderInfo.card_balance = float(card['card_balance'])
orderInfo.card_action = '0'
orderInfo.card_attr = '1'
infoList.append(orderInfo)
if not isThird:
for Ycard in YcardList:
YorderInfo = OrderInfo()
YorderInfo.order_id = order_sn
YorderInfo.card_id = Ycard['cardId']
YorderInfo.card_balance = float(Ycard['cardVal'])
#.........这里部分代码省略.........