예제 #1
0
파일: models.py 프로젝트: Yehnn/mall
class Seller(SurrogatePK, Model):

    __tablename__ = 'sellers'

    user_id = reference_col('users')

    #店铺名称
    name = Column(db.String(100))
    #店铺地址
    address = Column(db.String(255))
    #店铺LOGO
    logo = Column(db.String(255))
    #是否自营 1自营  默认0
    self_business = Column(db.Integer(), default=0)
    #评价总分数
    evaluate = Column(db.Integer())
    #评价总商品数量,得出平均店铺评分
    evaluate_count = Column(db.Integer())
    #店铺位置  地图坐标
    address_map = Column(db.String(100))
    #店铺状态,默认1
    status = Column(db.Integer(), default=1)
    #是否启用
    active = Column(db.Boolean(), default=True)
    #店铺备注
    note = Column(db.String(255))
    #创建时间
    created_at = Column(db.DateTime, nullable=False, default=dt.datetime.now)

    #联系方式
    contact = Column(db.String(255))

    seller_banner_id = relationship('SellerBanner', backref='seller')
    #订单
    user_order_id = relationship('UserOrder', backref='seller')
    #进货单
    receipt_id = relationship('Receipt', backref='seller')

    seller_info_id = relationship('SellerInfo', backref='seller')
    sale_id = relationship('Sale', backref='seller')
    #申请店铺默认不启用,管理员同意
    enable = Column(db.Boolean, default=False)

    #每日最大订单
    max_order = Column(db.Integer, default=10)
    #每日最大交易额
    max_price = Column(db.Integer, default=500)
    #最大仓库
    max_warehouse = Column(db.Integer, default=1)
    #最大货位
    max_goods_location = Column(db.Integer, default=2)
    #商品数量
    max_goods_count = Column(db.Integer, default=20)
    #level等级
    level = Column(db.String(20), default=u'免费会员')
예제 #2
0
class UserOrder(SurrogatePK,Model):

	__tablename__ = 'user_order'

	#购买者
	user_id = reference_col('users')
	#收货人地址
	receive = reference_col('user_address')

	#卖家
	seller_id = reference_col('sellers')

	#订单号
	number = db.Column(db.String(100)) 
	#下单时间
	buy_time = Column(db.DateTime,default=dt.datetime.now)
    
	#发货时间
	send_time =  db.Column(db.DateTime) 
	#配送费
	freight = db.Column(db.Numeric(15,2),default=0)

	#优惠金额
	discount = db.Column(db.Numeric(15,2))
	#支付金额
	pay_price = db.Column(db.Numeric(15,2))
	#支付时间
	pay_time =  db.Column(db.DateTime) 

	#积分
	integral = db.Column(db.Integer())
	#备注
	note = db.Column(db.String(255)) 

	#买家是否评价
	evaluate_buyers = Column(db.Boolean(),default=False)
	#买家评价时间
	evaluate_buyers_time = db.Column(db.DateTime) 
	#评价内容
	evaluate_buyers_note = db.Column(db.UnicodeText())

	#卖家是否评价
	evaluate_seller = Column(db.Boolean(),default=False)
	#评价时间
	evaluate_seller_time = db.Column(db.DateTime) 
	#评价内容
	evaluate_seller_note = db.Column(db.UnicodeText())
	
	#状态默认0
	order_state = db.Column(db.Integer(),default=0)

	#出售的商品
	sale_id = relationship('Sale', backref='user_order')
예제 #3
0
파일: models.py 프로젝트: anaf007/mall
class SellerInfo(SurrogatePK, Model):
    __tablename__ = 'sellers_info'

    seller_id = reference_col('sellers')
    #计算时间
    Date = Column(db.Date, default=time.strftime('%Y%m%d'))
    #访客
    visitor = Column(db.Integer(), default=1)
    #成交额
    price = Column(db.Numeric(15, 4))
    #订单数量
    order = Column(db.Integer(), default=0)
예제 #4
0
파일: models.py 프로젝트: anaf007/mall
class Goods(SurrogatePK, Model):

    __tablename__ = 'goodsed'

    #所属店铺
    sellers_id = reference_col('sellers')
    #产品分类
    category_id = reference_col('categorys')

    #商品名称
    title = Column(db.String(100))
    #销售价
    original_price = Column(db.Numeric(precision=10,scale=2,\
     asdecimal=True, decimal_return_scale=None))
    #优惠价进货价
    special_price = Column(db.Numeric(precision=10,scale=2,\
     asdecimal=True, decimal_return_scale=None))
    #详情
    note = Column(db.UnicodeText())
    # 附加字段
    attach_key = Column(db.String(500))
    #附加值
    attach_value = Column(db.String(500))
    #商品状态
    active = Column(db.Boolean(), default=True)
    #是否出售
    is_sell = Column(db.Boolean(), default=True)
    #热门 0 不热门 1热门
    hot = Column(db.Boolean(), default=True)
    #查看次数
    click_count = Column(db.Integer(), default=0)
    #累计购买总数
    buy_count = Column(db.Integer(), default=0)
    #条码
    ean = Column(db.String(50))
    #规格
    unit = Column(db.Integer, default=1)
    #创建时间
    created_at = Column(db.DateTime, nullable=False, default=dt.datetime.now)
    #首页展示图
    main_photo = Column(db.String(200))

    #出售记录
    # sale_id = relationship('Sale', backref='goodsed')
    #库存
    inventory_id = relationship('Inventory', backref='goodsed')
    #进货的商品
    # stock_id = relationship('Stock', backref='goodsed')
    #购物车中的商品
    buys_car_id = relationship('BuysCar', backref='goodsed')
예제 #5
0
파일: models.py 프로젝트: anaf007/mall
class Sale(SurrogatePK, Model):

    __tablename__ = 'sales'
    #店铺
    seller_id = reference_col('sellers')
    #商品 2018-04-30修改不外键商品表否则更改价格以往的都会更改。
    # goods_id = reference_col('goodsed')
    #商品名称
    goods_id = Column(db.Integer())  #不做外键    出售记录只做快照浏览
    goods_title = Column(db.String(100))
    #销售价
    original_price = Column(db.Numeric(precision=10,scale=2,\
     asdecimal=True, decimal_return_scale=None))
    #优惠价进货价
    special_price = Column(db.Numeric(precision=10,scale=2,\
     asdecimal=True, decimal_return_scale=None))
    #首页展示图
    main_photo = Column(db.String(200))
    #货位
    goods_allocation_name = Column(db.String(100))

    #订单
    UserOrder_id = reference_col('user_order')
    #出售数量
    count = Column(db.Integer)
    #货位剩余数量
    residue_count = Column(db.Integer)

    #创建时间
    created_at = Column(db.DateTime, nullable=False, default=dt.datetime.now)
예제 #6
0
파일: models.py 프로젝트: anaf007/mall
class Stock(SurrogatePK, Model):

    __tablename__ = 'stocks'
    #用户
    user_id = reference_col('users')

    #商品名称
    goods_id = Column(db.Integer())
    goods_title = Column(db.String(100))
    #销售价
    original_price = Column(db.Numeric(precision=10,scale=2,\
     asdecimal=True, decimal_return_scale=None))
    #优惠价进货价
    special_price = Column(db.Numeric(precision=10,scale=2,\
     asdecimal=True, decimal_return_scale=None))
    #首页展示图
    main_photo = Column(db.String(200))
    #货位
    goods_allocation_name = Column(db.String(100))

    #订单
    receipts_id = reference_col('receipts')
    #进货数量
    stock_count = Column(db.Integer)
    #仓库数量
    residue_count = Column(db.Integer)

    #创建时间
    created_at = Column(db.DateTime, nullable=False, default=dt.datetime.now)
예제 #7
0
class Category(SurrogatePK, Model):

    __tablename__ = 'categorys'

    #:自身上级,引用自身无限级分类
    parent_id = reference_col('categorys')

    children = relationship("Category", lazy="joined", join_depth=2)
    goods_id = relationship('Goods', backref='category')

    #分类名称
    name = Column(db.String(100))
    #分类图标
    ico = Column(db.String(100))
    #排序
    sort = Column(db.Integer(), default=100)
    #状态
    status = Column(db.Integer(), default=1)
    #是否启用
    active = Column(db.Boolean, default=True)
예제 #8
0
class UserAddress(SurrogatePK, Model):

    __tablename__ = 'user_address'

    user_id = reference_col('users')

    #姓名
    name = Column(db.String(20))
    #地址
    address = Column(db.String(255))
    #电话
    phone = Column(db.String(20))
    #状态  0为默认收货地址  默认为1
    state = Column(db.Integer(), default=1)
예제 #9
0
파일: models.py 프로젝트: Yehnn/mall
class Goods(SurrogatePK, Model):
    __tablename__ = 'goodsed'

    sellers_id = reference_col('sellers')
    category_id = reference_col('categorys')

    #商品名称
    title = Column(db.String(100))
    #原价
    original_price = Column(db.Numeric(precision=10,scale=2,\
     asdecimal=True, decimal_return_scale=None))
    #优惠价
    special_price = Column(db.Numeric(precision=10,scale=2,\
     asdecimal=True, decimal_return_scale=None))
    #详情
    note = Column(db.UnicodeText())
    #数量
    count = Column(db.Integer(), default=0)
    #发布时间
    create_time = Column(db.DateTime, default=dt.datetime.now)
    #商品状态
    active = Column(db.Boolean(), default=True)
    #是否出售
    is_sell = Column(db.Boolean(), default=True)
    #热门 0 不热门 1热门
    hot = Column(db.Boolean(), default=True)
    #查看次数
    click_count = Column(db.Integer(), default=0)
    #购买总数
    buy_count = Column(db.Integer(), default=0)
    #排序
    sort = Column(db.Integer(), default=100)
    #创建时间
    created_at = Column(db.DateTime, nullable=False, default=dt.datetime.now)

    sale_id = relationship('Sale', backref='goodsed')
예제 #10
0
class UserAddress(SurrogatePK, Model):

	__tablename__ = 'user_address'

	user_id = reference_col('users')

	#姓名
	username = Column(db.String(20)) 
	#地址
	address = Column(db.String(255)) 
	#电话
	phone = Column(db.String(20)) 
	#状态  1为默认  默认0  
	state = Column(db.Integer())

	user_order_id = relationship('UserOrder', backref='users_address')
예제 #11
0
파일: models.py 프로젝트: anaf007/mall
class QuantityCheckGoods(SurrogatePK, Model):
    __tablename__ = 'quantity_check_goods'

    quantity_check_id = reference_col('quantity_check')
    #数量
    count = Column(db.Integer, default=0)
    #位置
    location = Column(db.String(50))
    #商品名称 ,不外键
    goods_name = Column(db.String(50))
    #库存id  不用外键
    inventory_id = Column(db.Integer())
    #是否已提交更改库存
    submit_change = Column(db.Boolean, default=False)
    #盘点后的数量
    count_check = Column(db.Integer, default=0)
예제 #12
0
파일: models.py 프로젝트: Yehnn/mall
class BaseProducts(SurrogatePK, Model):

	__tablename__ = 'base_products'

	#商品名称
	name = Column(db.String(255)) 
	#原价
	original_price = Column(db.Numeric(15,2))
	#优惠价
	special_price = Column(db.Numeric(15,2))
	#详情
	note =  Column(db.UnicodeText())
	#分类
	category_id = Column(db.Integer())
	#附加字段
	attach_key = Column(db.String(200))
	#附加值
	attach_value = Column(db.String(500))
예제 #13
0
파일: models.py 프로젝트: anaf007/mall
class Receipt(SurrogatePK, Model):
    __tablename__ = 'receipts'

    #供应商
    supplier = Column(db.String(100))

    #卖家
    user_id = reference_col('users')

    #订单号
    number = Column(db.String(100), unique=True)
    #下单时间
    buy_time = Column(db.DateTime, default=dt.datetime.now)

    #送货时间
    send_time = Column(db.DateTime)
    #配送费
    freight = Column(db.Numeric(15, 2), default=0)

    #优惠金额
    discount = Column(db.Numeric(15, 2))
    #支付金额
    pay_price = Column(db.Numeric(15, 2))
    #支付时间
    pay_time = Column(db.DateTime)
    #支付类型 微信 现金  银行卡 其他
    pay_type = Column(db.String(100))
    #备注
    note = Column(db.String(255))
    #状态默认0
    order_state = Column(db.Integer(), default=1)

    #商品种类
    variety = Column(db.Integer)
    #商品总数量
    goods_sum = Column(db.Integer)
    #总价
    price_sum = Column(db.Numeric(15, 2), default=0)

    #进货的商品
    stock_id = relationship('Stock', backref='receipts')
예제 #14
0
파일: models.py 프로젝트: Yehnn/mall
class Receipt(SurrogatePK, Model):
    __tablename__ = 'receipts'

    #供应商
    supplier = Column(db.String(100))

    #卖家
    seller_id = reference_col('sellers')

    #订单号
    number = db.Column(db.String(100))
    #下单时间
    buy_time = Column(db.DateTime, default=dt.datetime.now)

    #送货时间
    send_time = db.Column(db.DateTime)
    #配送费
    freight = db.Column(db.Numeric(15, 2), default=0)

    #优惠金额
    discount = db.Column(db.Numeric(15, 2))
    #支付金额
    pay_price = db.Column(db.Numeric(15, 2))
    #支付时间
    pay_time = db.Column(db.DateTime)
    #支付类型
    pay_type = db.Column(db.String(100))

    #备注
    note = db.Column(db.String(255))

    #状态默认0
    order_state = db.Column(db.Integer(), default=1)

    #进货的商品
    stock_id = relationship('Stock', backref='receipts')
예제 #15
0
class BaseProducts(SurrogatePK, Model):

    __tablename__ = 'base_products'

    #商品名称
    title = Column(db.String(255))
    #原价
    original_price = Column(db.Numeric(15, 2))
    #优惠价
    special_price = Column(db.Numeric(15, 2))
    #详情
    note = Column(db.UnicodeText())
    #分类
    category_id = Column(db.Integer())
    #附加字段
    attach_key = Column(db.String(200))
    #附加值
    attach_value = Column(db.String(500))
    #首页展示图
    main_photo = Column(db.String(200))
    #条码
    ean = Column(db.String(50))
    #规格
    unit = Column(db.Integer, default=1)
예제 #16
0
파일: models.py 프로젝트: anaf007/mall
class Seller(SurrogatePK, Model):

    __tablename__ = 'sellers'

    user_id = reference_col('users')

    #店铺名称
    name = Column(db.String(100))
    #店铺地址
    address = Column(db.String(255))
    #店铺LOGO
    logo = Column(db.String(255))
    #是否自营 1自营  默认0
    self_business = Column(db.Integer(), default=0)
    #评价总分数
    evaluate = Column(db.Integer())
    #评价总商品数量,得出平均店铺评分
    evaluate_count = Column(db.Integer())
    #店铺位置  地图坐标
    address_map = Column(db.String(100))
    #店铺状态,默认1
    status = Column(db.Integer(), default=1)
    #是否启用
    active = Column(db.Boolean(), default=True)
    #店铺备注
    note = Column(db.String(255))
    #创建时间
    created_at = Column(db.DateTime, nullable=False, default=dt.datetime.now)
    #联系方式
    contact = Column(db.String(255))
    #申请店铺默认不启用,管理员同意
    enable = Column(db.Boolean, default=False)

    #每日最大订单
    max_order = Column(db.Integer, default=10)
    #每日最大交易额
    max_price = Column(db.Integer, default=500)
    #最大仓库
    max_warehouse = Column(db.Integer, default=1)
    #最大货位
    max_goods_location = Column(db.Integer, default=2)
    #商品数量
    max_goods_count = Column(db.Integer, default=20)
    #level等级
    level = Column(db.String(20), default=u'免费会员')

    email = Column(db.String(100), index=True, unique=True)

    #运费
    freight = Column(db.Numeric(precision=10,scale=2,\
     asdecimal=True, decimal_return_scale=None),default=0)
    #满多少免运费
    max_price_no_freight = Column(db.Numeric(precision=10,scale=2,\
     asdecimal=True, decimal_return_scale=None),default=0)

    #店铺横幅
    seller_banner_id = relationship('SellerBanner', backref='seller')
    #店铺记录
    seller_msg_id = relationship('SellerMsg', backref='seller')
    #仓库
    warehouse_id = relationship('Warehouse', backref='seller')

    #订单
    user_order_id = relationship('UserOrder', backref='seller')
    goods_id = relationship('Goods', backref='seller')

    seller_info_id = relationship('SellerInfo', backref='seller')
    sale_id = relationship('Sale', backref='seller')
    follow_id = relationship('Follow', backref='seller')
    #盘点表
    quantity_check_id = relationship('QuantityCheck', backref='seller')
예제 #17
0
class UserOrder(SurrogatePK, Model):

    __tablename__ = 'user_order'

    #购买者
    user_id = reference_col('users')
    #收货人地址
    # receive = reference_col('user_address')

    #卖家
    seller_id = reference_col('sellers')
    #收货人信息
    receive_name = Column(db.String(100))
    receive_phone = Column(db.String(100))
    receive_address = Column(db.String(100))

    #订单号
    number = Column(db.String(100), unique=True)
    #下单时间
    buy_time = Column(db.DateTime, default=dt.datetime.now)

    #发货时间
    send_time = Column(db.DateTime)
    #配送费
    freight = Column(db.Numeric(15, 2), default=0)

    #优惠金额
    discount = Column(db.Numeric(15, 2))
    #支付金额
    pay_price = Column(db.Numeric(15, 2))
    #支付时间
    pay_time = Column(db.DateTime)
    #支付类型
    pay_type = Column(db.String(100))

    #积分
    integral = Column(db.Integer())
    #备注
    note = Column(db.String(255))

    #买家是否评价
    evaluate_buyers = Column(db.Boolean(), default=False)
    #买家评价时间
    evaluate_buyers_time = Column(db.DateTime)
    #评价内容
    evaluate_buyers_note = Column(db.UnicodeText())

    #卖家是否评价
    evaluate_seller = Column(db.Boolean(), default=False)
    #评价时间
    evaluate_seller_time = Column(db.DateTime)
    #评价内容
    evaluate_seller_note = Column(db.UnicodeText())
    #商品总类数量
    goods_number = Column(db.Integer())

    #状态默认0 0提交 1已查看开始送货 2完成 3关闭
    order_state = Column(db.Integer(), default=0)

    #是否已经查看 用于微信通知 初次查看微信客服通知
    is_see = Column(db.Boolean, default=False)
    #是否已付款
    is_pay = Column(db.Boolean, default=False)

    #出售的商品
    sale_id = relationship('Sale', backref='user_order')