Files
yunzerwebsiteallinone/go/models/tenant_crm_payback.go
T

48 lines
3.8 KiB
Go

package models
import "time"
// TenantCrmPayback 回款计划表: yz_backend_crm_payback
//
// 说明:
// - 回款计划针对于合同创建,contract_id 为关联合同(yz_backend_crm_contract.id);
// - plan_type 回款周期:1=月度 2=季度 3=年度 4=进度 5=自定义;
// - pay_method 回款方式:1=对公转账 2=网银转账 3=现金 4=支票 5=支付宝 6=微信 7=其他;
// - items 计划明细以 JSON 文本存储,结构随 plan_type 变化:
// 月度/季度/年度:{seq, name, amount, plan_date} —— 期数 + 支付金额 + 计划回款日期
// 进度: {seq, name, percent, amount, plan_date} —— 进度名称 + 进度百分比 + 进度金额 + 计划回款日期
// 自定义: {seq, name, plan_date, amount} —— 名称 + 计划日期 + 金额
// 每行另带 received_amount / received_date / status,用于「回款进度」登记实收。
// - plan_date 计划回款日期随各 plan_type 的明细行一并存储于 items JSON,无需独立列。
// - total_amount 计划回款总额;received_amount 已回款金额,均由 items 汇总。
type TenantCrmPayback struct {
ID uint64 `orm:"column(id);pk;auto" json:"id"`
TenantID string `orm:"column(tenant_id);size(64)" json:"tenant_id"`
ContractID *uint64 `orm:"column(contract_id);null" json:"contract_id"` // 关联合同ID
ContractNo string `orm:"column(contract_no);size(50)" json:"contract_no"`
ContractName string `orm:"column(contract_name);size(100)" json:"contract_name"`
CustomerID *uint64 `orm:"column(customer_id);null" json:"customer_id"`
CustomerName string `orm:"column(customer_name);size(128)" json:"customer_name"`
PlanType int8 `orm:"column(plan_type);default(1)" json:"plan_type"` // 回款周期:1月度/2季度/3年度/4进度/5自定义
PayMethod int8 `orm:"column(pay_method);default(1)" json:"pay_method"` // 回款方式:1对公/2网银/3现金/4支票/5支付宝/6微信/7其他
RemindDays int `orm:"column(remind_days);default(0)" json:"remind_days"` // 提前几天提醒
OwnerUserID string `orm:"column(owner_user_id);size(64)" json:"owner_user_id"`
OwnerUserName string `orm:"column(owner_user_name);size(128)" json:"owner_user_name"`
ContractAmount float64 `orm:"column(contract_amount);digits(14);decimals(2);default(0)" json:"contract_amount"` // 合同总金额
TotalAmount float64 `orm:"column(total_amount);digits(14);decimals(2);default(0)" json:"total_amount"` // 计划回款总额
ReceivedAmount float64 `orm:"column(received_amount);digits(14);decimals(2);default(0)" json:"received_amount"` // 已回款金额
Status int8 `orm:"column(status);default(1)" json:"status"` // 1进行中/2已完成
Items string `orm:"column(items);type(text);null" json:"-"` // 计划明细 JSON 数组
Remark string `orm:"column(remark);type(text);null" json:"remark"`
ReceiptURL string `orm:"column(receipt_url);size(512);null" json:"receipt_url"` // 流水回执文件地址(选填)
ReceiptName string `orm:"column(receipt_name);size(255);null" json:"receipt_name"` // 流水回执文件名(选填)
CreateUserID string `orm:"column(create_user_id);size(64)" json:"create_user_id"`
CreateTime time.Time `orm:"column(create_time);auto_now_add;type(datetime)" json:"create_time"`
UpdateTime time.Time `orm:"column(update_time);auto_now;type(datetime)" json:"update_time"`
DeleteTime *time.Time `orm:"column(delete_time);type(datetime);null" json:"delete_time"`
}
func (m *TenantCrmPayback) TableName() string {
return "yz_backend_crm_payback"
}