| | |
| | | Number string `json:"number" gorm:"column:number;type:varchar(255);comment:退款单号"` |
| | | SourceType constvar.RefundSourceType `gorm:"column:source_type;type:int;not null;default 0;comment:来源类型(1销售退货)" json:"sourceType"` // 来源类型(1销售退货) |
| | | SourceId int `gorm:"column:source_id;type:int;not null;default 0;comment:源单id " json:"sourceId"` // 源单id |
| | | Source SalesReturn `gorm:"foreignKey:SourceId" json:"Source"` |
| | | MemberId int `json:"memberId" gorm:"column:member_id;type:int;comment:负责人id"` |
| | | Member User `json:"member" gorm:"foreignKey:MemberId"` |
| | | RefundDate string `json:"refundDate" gorm:"column:refund_date;type:varchar(255);comment:退款日期"` |
| | |
| | | Reason string `json:"reason" gorm:"column:reason;type:varchar(255);comment:退款原因"` |
| | | Products []*Product `json:"products" gorm:"many2many:salesRefund_product;"` |
| | | AmountTotal decimal.Decimal `gorm:"column:amount_total;type:decimal(12,2);comment:价税合计" json:"amountTotal"` // 价税合计 |
| | | CodeStandID string `json:"codeStandID" gorm:"column:code_stand_id;type:varchar(255);comment:编码id"` |
| | | CrmModel |
| | | } |
| | | |
| | |
| | | PageSize int |
| | | Preload bool |
| | | Ids []int |
| | | MemberIds []int |
| | | } |
| | | ) |
| | | |
| | |
| | | db = db.Preload("Client"). |
| | | Preload("PaymentType"). |
| | | Preload("BankAccount"). |
| | | Preload("Source"). |
| | | Preload("Products") |
| | | } |
| | | if slf.KeywordType != "" { |
| | |
| | | db = db.Where("amount_total like ?", fmt.Sprintf("%%%s%%", slf.Keyword)) |
| | | |
| | | } |
| | | } |
| | | |
| | | if len(slf.MemberIds) > 0 { |
| | | db = db.Where("sales_refund.member_id in ?", slf.MemberIds) |
| | | } |
| | | |
| | | return db |
| | |
| | | slf.OrderBy = order |
| | | return slf |
| | | } |
| | | |
| | | func (slf *SalesRefundSearch) UpdateByMap(data map[string]interface{}) error { |
| | | var db = slf.build() |
| | | return db.Updates(data).Error |
| | | } |
| | | |
| | | func (slf *SalesRefundSearch) SetMemberIds(memberIds []int) *SalesRefundSearch { |
| | | slf.MemberIds = memberIds |
| | | return slf |
| | | } |