You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
143 lines
5.2 KiB
143 lines
5.2 KiB
package model
|
|
|
|
import (
|
|
"database/sql"
|
|
"github.com/shopspring/decimal"
|
|
"time"
|
|
)
|
|
|
|
const (
|
|
CarBaseTheUpperFalse = 1 // 未上架
|
|
CarBaseTheUpperTrue = 2 // 已上架
|
|
|
|
CarBaseStatusDealerAuditing = 1 // 待车商确认
|
|
CarBaseStatusAuditing = 2 // 待发布
|
|
CarBaseStatusRelease = 3 // 已发布
|
|
CarBaseStatusDealerReject = 11 // 车商审核未通过
|
|
CarBaseStatusReject = 12 // 后台审核未通过
|
|
|
|
CarBaseSourceConsignment = 1 // 车源个人寄售
|
|
CarBaseSourceDealerPurchase = 2 // 车源车商收购
|
|
|
|
CarBaseStockStatusOut = 1 // 外出
|
|
CarBaseStockStatusIn = 2 // 在厅
|
|
CarBaseStockStatusPrepare = 3 // 整备
|
|
)
|
|
|
|
type CarBase struct {
|
|
Id uint `gorm:"primaryKey"`
|
|
ModelId uint // 车型id
|
|
Model CarModel `gorm:"foreignKey:ModelId;references:ModelId"`
|
|
CarId uint // 车辆id
|
|
Car Car `gorm:"foreignKey:CarId"`
|
|
|
|
BrokerId uint // 经纪人id
|
|
Broker Broker `gorm:"foreignKey:BrokerId"`
|
|
DealerId uint // 挂载门店id
|
|
Dealer BrokerBusinessStore `gorm:"foreignKey:DealerId"`
|
|
Source uint // 车辆来源 1=个人直卖 2=车商
|
|
CustomerId uint // 来源个人寄卖时客户id
|
|
Customer Customer `gorm:"foreignKey:CustomerId"`
|
|
OrderId uint // 来源个人寄卖时订单id
|
|
Order *OrderConsignment `gorm:"foreignKey:OrderId"`
|
|
|
|
CarType uint // 车辆类型 1=二手车(中规) 2=二手车(平行进口) 3=一手车 4=新车(中规) 5=新车(平行进口)
|
|
Vin string // 车架号
|
|
EngineNo string // 发动机号
|
|
LicensingDate sql.NullTime // 上牌日期
|
|
Color string // 车身颜色
|
|
TemporaryLicensePlate string // 临时车牌
|
|
ParkingNo string // 车位编号
|
|
StockStatus uint // 库存状态 1=外出 2=在厅 3=整备
|
|
InteriorColor string // 内饰颜色
|
|
UseCharacter uint // 使用性质 1=非运营 2=运营 3=营转非 4=租赁非运营 5=租赁运营
|
|
LocationProvinceId uint // 车辆所在地-省
|
|
LocationCityId uint // 车辆所在地-市
|
|
LocationCity Area `gorm:"foreignKey:LocationCityId"`
|
|
AttributionProvinceId uint // 车辆归属地-省
|
|
AttributionCityId uint // 车辆归属地-市
|
|
AttributionCity Area `gorm:"foreignKey:AttributionCityId"`
|
|
Condition string // 车况
|
|
ConditionIn string // 车况(对内)
|
|
ConditionOut string // 车况(对外)
|
|
ShamMileage decimal.Decimal // 虚假里程
|
|
PurchaseTax decimal.Decimal // 购置税
|
|
InstallationCost decimal.Decimal // 加装费用
|
|
Remark string // 备注
|
|
InteriorPrice decimal.Decimal // 内部价格
|
|
ExteriorPrice decimal.Decimal // 外部价格
|
|
PurchasePrice decimal.Decimal // 采购价格
|
|
PurchaseDate sql.NullTime // 采购日期
|
|
PurchaseLiaison string // 采购人
|
|
Transfer uint // 过户次数
|
|
KeyCount uint // 钥匙数量
|
|
CompulsoryInsurance uint // 交强险
|
|
CompulsoryInsuranceDate sql.NullTime // 交强险到期日期
|
|
CommercialInsurance uint // 商业险
|
|
CommercialInsuranceDate sql.NullTime // 商业险到期日期
|
|
CommercialInsurancePrice decimal.Decimal // 商业险金额
|
|
MainPhoto string // 车辆主图
|
|
Photos []CarPhoto `gorm:"foreignKey:OrderId;References:Id"`
|
|
|
|
Status uint //
|
|
DealerAuditId uint // 车商审核
|
|
DealerAudit DealerAuditing `gorm:"foreignKey:DealerAuditId"`
|
|
AuditId uint // 审核id
|
|
Audit CarAudit `gorm:"foreignKey:AuditId"`
|
|
TheUpper uint // 上架 1=未上架 2=已上架
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
func (*CarBase) GetStatusName(status uint) (result string) {
|
|
switch status {
|
|
case CarBaseStatusDealerAuditing:
|
|
return "待车商确认"
|
|
case CarBaseStatusAuditing:
|
|
return "待发布"
|
|
case CarBaseStatusRelease:
|
|
return "已发布"
|
|
case CarBaseStatusDealerReject:
|
|
return "车商审核未通过"
|
|
case CarBaseStatusReject:
|
|
return "后台审核未通过"
|
|
default:
|
|
return "未知"
|
|
}
|
|
}
|
|
|
|
func (*CarBase) GetTheUpperName(up uint) (result string) {
|
|
switch up {
|
|
case CarBaseTheUpperFalse:
|
|
return "未上架"
|
|
case CarBaseTheUpperTrue:
|
|
return "已上架"
|
|
default:
|
|
return "未知"
|
|
}
|
|
}
|
|
|
|
func (*CarBase) GetSourceName(source uint) (result string) {
|
|
switch source {
|
|
case CarBaseSourceConsignment:
|
|
return "个人寄售"
|
|
case CarBaseSourceDealerPurchase:
|
|
return "车商"
|
|
default:
|
|
return "未知"
|
|
}
|
|
}
|
|
|
|
func (*CarBase) GetStockStatusName(status uint) (result string) {
|
|
switch status {
|
|
case CarBaseStockStatusOut:
|
|
return "外出"
|
|
case CarBaseStockStatusIn:
|
|
return "在厅"
|
|
case CarBaseStockStatusPrepare:
|
|
return "整备"
|
|
default:
|
|
return "未知"
|
|
}
|
|
}
|