| | |
| | | AmountShouldRefund decimal.Decimal `gorm:"column:amount_should_refund;type:decimal(12,2);comment:应退款金额" json:"amountShouldRefund"` // 应退款金额 |
| | | AmountHasRefund decimal.Decimal `gorm:"column:amount_has_refund;type:decimal(12,2);comment:已退款金额" json:"amountHasRefund"` // 已退款金额 |
| | | AmountTotal decimal.Decimal `gorm:"column:amount_total;type:decimal(12,2);comment:退货产品总金额" json:"-"` |
| | | CodeStandID string `json:"codeStandID" gorm:"column:code_stand_id;type:varchar(255);comment:编码id"` |
| | | CrmModel |
| | | } |
| | | |
| | |
| | | PageSize int |
| | | Preload bool |
| | | Ids []int |
| | | MemberIds []int |
| | | } |
| | | ) |
| | | |
| | |
| | | if len(slf.Ids) != 0 { |
| | | db = db.Where("id in ?", slf.Ids) |
| | | } |
| | | |
| | | if slf.SourceType != 0 { |
| | | db = db.Where("source_type = ?", slf.SourceType) |
| | | } |
| | | if slf.SourceId != 0 { |
| | | db = db.Where("source_id = ?", slf.SourceId) |
| | | } |
| | | if slf.ClientId != 0 { |
| | | db = db.Where("client_id = ?", slf.ClientId) |
| | | } |
| | | if slf.Preload { |
| | | db = db.Preload("Client"). |
| | | Preload("Member"). |
| | |
| | | db = db.Where("amount_has_refund = ?", slf.Keyword) |
| | | |
| | | } |
| | | } |
| | | |
| | | if len(slf.MemberIds) > 0 { |
| | | db = db.Where("sales_return.member_id in ?", slf.MemberIds) |
| | | } |
| | | |
| | | return db |
| | |
| | | slf.Preload = preload |
| | | return slf |
| | | } |
| | | func (slf *SalesReturnSearch) SetSourceType(sourceType constvar.SalesReturnSourceType) *SalesReturnSearch { |
| | | slf.SourceType = sourceType |
| | | return slf |
| | | } |
| | | |
| | | func (slf *SalesReturnSearch) SetSourceId(sourceId int) *SalesReturnSearch { |
| | | slf.SourceId = sourceId |
| | | return slf |
| | | } |
| | | |
| | | func (slf *SalesReturnSearch) SetClientId(clientId int) *SalesReturnSearch { |
| | | slf.ClientId = clientId |
| | | return slf |
| | | } |
| | | |
| | | func (slf *SalesReturnSearch) UpdateByMap(data map[string]interface{}) error { |
| | | var db = slf.build() |
| | | return db.Updates(data).Error |
| | | } |
| | | |
| | | func (slf *SalesReturnSearch) SetMemberIds(memberIds []int) *SalesReturnSearch { |
| | | slf.MemberIds = memberIds |
| | | return slf |
| | | } |