當前位置: 首頁>>代碼示例>>Python>>正文


Python Method.getPayDiscDict方法代碼示例

本文整理匯總了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:
#.........這裏部分代碼省略.........
開發者ID:KGPython,項目名稱:kggroup,代碼行數:103,代碼來源:card.py

示例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'])
#.........這裏部分代碼省略.........
開發者ID:KGPython,項目名稱:kggroup,代碼行數:103,代碼來源:card.py

示例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'])
#.........這裏部分代碼省略.........
開發者ID:KGPython,項目名稱:kggroup,代碼行數:103,代碼來源:pay.py


注:本文中的sellcard.common.Method.getPayDiscDict方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。