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.
68 lines
2.4 KiB
68 lines
2.4 KiB
package model
|
|
|
|
import (
|
|
"database/sql"
|
|
"github.com/shopspring/decimal"
|
|
"time"
|
|
)
|
|
|
|
const (
|
|
ContractPurchaseChannelBusiness = 1 // 收购渠道入驻商
|
|
ContractPurchaseChannelDealer = 2 // 收购渠道车商
|
|
)
|
|
|
|
type ContractPurchase struct {
|
|
Id uint `gorm:"primaryKey"`
|
|
BrokerId uint
|
|
Channel uint // 收购渠道 1=入驻商 2=车商
|
|
Broker Broker `gorm:"foreignKey:BrokerId"`
|
|
DealerId uint // 车商id
|
|
Dealer BrokerBusinessStore `gorm:"foreignKey:DealerId"`
|
|
CustomerId uint // 客户id
|
|
Customer Customer `gorm:"foreignKey:CustomerId"`
|
|
|
|
ContractSn string // 合同编码
|
|
EssFlow ThirdTencentEssFlow `gorm:"foreignKey:ContractId"`
|
|
Vin string // 车架号
|
|
ModelId uint // 车型id
|
|
Model CarModel `gorm:"foreignKey:ModelId;references:ModelId"`
|
|
LicensingDate sql.NullTime // 上牌日期
|
|
LicensePlate string // 车牌
|
|
Color string // 车身颜色
|
|
EngineNo string // 发动机号
|
|
UseCharacter uint // 使用性质
|
|
Mileage decimal.Decimal // 里程
|
|
CompulsoryInsuranceDate sql.NullTime // 交强险到期日期
|
|
Condition string // 车况
|
|
|
|
DealPrice decimal.Decimal // 成交金额
|
|
DownPayment decimal.Decimal // 首付
|
|
BalancePayment decimal.Decimal // 尾款
|
|
DownPaymentRate decimal.Decimal // 首付占比
|
|
BalancePaymentRate decimal.Decimal // 尾款占比
|
|
DeliverDate sql.NullTime // 交付日期
|
|
|
|
Photos []ContractPurchasePhoto `gorm:"foreignKey:OrderId;References:Id"`
|
|
|
|
DealerAuditId uint // 车商审核
|
|
DealerAudit DealerAuditing `gorm:"foreignKey:DealerAuditId"`
|
|
Status uint // 状态
|
|
MasterId uint
|
|
Master ContractMaster `gorm:"foreignKey:MasterId"`
|
|
SignAt sql.NullTime // 签订时间
|
|
CancelAt sql.NullTime // 取消时间
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
func (*ContractPurchase) GetChannelName(ch uint) (result string) {
|
|
switch ch {
|
|
case ContractPurchaseChannelBusiness:
|
|
return "入驻商"
|
|
case ContractPurchaseChannelDealer:
|
|
return "车商"
|
|
default:
|
|
return "未知"
|
|
}
|
|
}
|