예제 #1
0
def shoppingCart(request):
    isLogin, account = UserInfo.checkIsLogin(request);

    goodsList = [];
    totalPrice = 0;
    allSelect = 1;
    try:
        #先从购物车表获取goodsid,再获取商品
        condition = {
            'account' : account,
        }
        data = ShoppingCartInfo.getShoppingCartData(1, 2000, condition);
        if data:
            for obj in data:
                objList, pageResult = GoodsInfo.getGoodsData(1, 2000, {'goodsId' : obj['goodsId']});
                goods = objList[0];
                #从新计算价格,以最新的为准
                obj['sumPrice'] = str(float(goods['price'])*obj['count']);
                if obj['count'] > goods['inventoryCount']:
                    goods['isOverflow'] = 1;  #库存不足
                else:
                    goods['isOverflow'] = 0;
                goods['count'] = obj['count'];  #增加属性
                goods['sumPrice'] = obj['sumPrice'];
                goods['isSelect'] = obj['isSelect'];

                if not obj['isSelect']:
                    allSelect = 0;
                goodsList.append(goods);
                if obj['isSelect']:
                    totalPrice += float(goods['sumPrice']);
    except Exception, e:
        Responses.returnCheckLoginDrawPage(isLogin, 'goods/shoppingCart.html', 'data', None);
예제 #2
0
def userBackgroupAddress(request):
    #获取order信息
    isLogin, account = UserInfo.checkIsLogin(request);
    #获取地址
    addressList = AddressInfo.getAddressData(1, 2000, account, {'account' : account});
    data = {
        'addressList' : addressList,
        'superUser' : UserInfo.checkIsSuperUser(request)
    }

    return Responses.returnCheckLoginDrawPage(isLogin, 'myBackgroup/myAddress.html', 'data', data);
예제 #3
0
def userBackgroupUserInfo(request):
    #获取order信息
    isLogin, account = UserInfo.checkIsLogin(request);
    userInfo = UserInfo.getUserInfoData(account);
    data = [];
    if userInfo:
        userInfo=userInfo[0];
        data = {
            'userInfo' : userInfo,
            'superUser' : UserInfo.checkIsSuperUser(request)
        }
    return Responses.returnCheckLoginDrawPage(isLogin, 'myBackgroup/myPersonal.html', 'data', data);
예제 #4
0
def managerUploader(request):
    isLogin, account = UserInfo.checkIsLogin(request);
    data = {
        'superUser' : UserInfo.checkIsSuperUser(request)
    }
    return Responses.returnCheckLoginDrawPage(isLogin, 'managerBackgroup/uploadGoods.html', 'data', data);
예제 #5
0
                if not obj['isSelect']:
                    allSelect = 0;
                goodsList.append(goods);
                if obj['isSelect']:
                    totalPrice += float(goods['sumPrice']);
    except Exception, e:
        Responses.returnCheckLoginDrawPage(isLogin, 'goods/shoppingCart.html', 'data', None);


    order = {
        'goodsList' : goodsList,
        'totalPrice' : totalPrice,
        'allSelect' : allSelect,
    };

    return Responses.returnCheckLoginDrawPage(isLogin, 'goods/shoppingCart.html', 'order', order);
#结算页面
def orderCheckout(request):
    isLogin, account = UserInfo.checkIsLogin(request);
    try:
        goodsId = request.GET.get('goodsId', None);
        count = int(request.GET.get('count', '1'));
    except Exception, e:
        goodsId = request.GET.get('goodsId', None);
        count = 1;

    goodsList = [];
    addressList = [];
    freightCost = 0;
    totalPrice = 0;
    rowspan = 1;  #运费表格占用多少行