From 6e87a1f6795af50133b10fa853fd6c2d14bb698c Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期日, 13 八月 2023 15:20:27 +0800
Subject: [PATCH] 完善退款单

---
 model/salesRefund.go |   34 +++++++++++++++++++---------------
 1 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/model/salesRefund.go b/model/salesRefund.go
index e34be5b..0874372 100644
--- a/model/salesRefund.go
+++ b/model/salesRefund.go
@@ -1,35 +1,39 @@
 package model
 
 import (
+	"aps_crm/constvar"
 	"aps_crm/pkg/mysqlx"
 	"gorm.io/gorm"
-	"time"
 )
 
 type (
 	SalesRefund struct {
-		Id           int       `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
-		ClientId     int       `json:"clientId" gorm:"column:client_id;type:int;comment:瀹㈡埛id"`
-		Number       string    `json:"number" gorm:"column:number;type:varchar(255);comment:閫�娆惧崟鍙�"`
-		MemberId     int       `json:"memberId" gorm:"column:member_id;type:int;comment:璐熻矗浜篿d"`
-		RefundDate   time.Time `json:"refundDate" gorm:"column:refund_date;type:datetime;comment:閫�娆炬棩鏈�"`
-		RefundMethod string    `json:"refundMethod" gorm:"column:refund_method;type:varchar(255);comment:閫�娆炬柟寮�"`
-		AccountId    int       `json:"accountId" gorm:"column:account_id;type:int;comment:璐︽埛"`
-		IsInvoice    int       `json:"isInvoice" gorm:"column:is_invoice;type:int;comment:鏄惁寮�绁�"`
-		Reason       string    `json:"reason" gorm:"column:reason;type:varchar(255);comment:閫�娆惧師鍥�"`
-		Products     []Product `json:"products" gorm:"many2many:salesRefund_product;"`
-		gorm.Model   `json:"-"`
+		Id            int                       `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
+		ClientId      int                       `json:"clientId" gorm:"column:client_id;type:int;comment:瀹㈡埛id"`
+		Client        Client                    `json:"client" gorm:"foreignKey:ClientId"`
+		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閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級" json:"sourceType"` // 鏉ユ簮绫诲瀷锛�1閿�鍞槑缁嗗崟2鏈嶅姟鍚堝悓3閿�鍞彂绁�4鏀舵璁″垝5鍑哄簱鍗曪級
+		SourceId      int                       `gorm:"column:source_id;type:int;not null;default 0;comment:婧愬崟id " json:"sourceId"`                               // 婧愬崟id
+		MemberId      int                       `json:"memberId" gorm:"column:member_id;type:int;comment:璐熻矗浜篿d"`
+		RefundDate    string                    `json:"refundDate" gorm:"column:refund_date;type:datetime;comment:閫�娆炬棩鏈�"`
+		PaymentTypeId int                       `gorm:"column:payment_type_id;type:int;not null;default 0;comment:鏀舵鏂瑰紡ID" json:"paymentTypeId"` // 鏀舵鏂瑰紡ID
+		PaymentType   PaymentType               `gorm:"foreignKey:PaymentTypeId" json:"paymentType"`
+		BankAccountId int                       `gorm:"column:bank_account_id;type:int;not null;default 0;comment:璐︽埛id" json:"bankAccountId"` // 璐︽埛id
+		BankAccount   BankAccount               `gorm:"foreignKey:BankAccountId" json:"bankAccount"`
+		IsInvoice     int                       `json:"isInvoice" gorm:"column:is_invoice;type:int;comment:鏄惁寮�绁�"`
+		Reason        string                    `json:"reason" gorm:"column:reason;type:varchar(255);comment:閫�娆惧師鍥�"`
+		Products      []*Product                `json:"products" gorm:"many2many:salesRefund_product;"`
+		gorm.Model    `json:"-"`
 	}
 
 	SalesRefundSearch struct {
 		SalesRefund
 
-				Orm      *gorm.DB
+		Orm      *gorm.DB
 		Keyword  string
 		OrderBy  string
 		PageNum  int
 		PageSize int
-
 	}
 )
 
@@ -114,4 +118,4 @@
 func (slf *SalesRefundSearch) SetOrder(order string) *SalesRefundSearch {
 	slf.OrderBy = order
 	return slf
-}
\ No newline at end of file
+}

--
Gitblit v1.8.0