|
@@ -87,6 +87,8 @@ func (*supplier) GetSupplierIncomeList(ctx context.Context, req *http_model.Full
|
|
|
sProjectInfo.ProjectPlatform = sProjectData.ProjectPlatform
|
|
|
sProjectInfo.ServiceCharge = sProjectData.ServiceCharge
|
|
|
sProjectInfo.ServiceChargeSettle = sProjectData.ServiceChargeSettle
|
|
|
+ sProjectInfo.RecruitNum = sProjectData.RecruitNum
|
|
|
+ sProjectInfo.SettleNum = sProjectData.SettleNum
|
|
|
sProjectInfo.FinishTime = conv.MustString(sProjectData.FinishTime)
|
|
|
|
|
|
// 2.2. 商品基本信息
|
|
@@ -135,6 +137,8 @@ func (*supplier) GetSupplierIncomeList(ctx context.Context, req *http_model.Full
|
|
|
sLocalInfo.LocalPlatform = sLocalData.LocalPlatform
|
|
|
sLocalInfo.ServiceCharge = sLocalData.ServiceCharge
|
|
|
sLocalInfo.ServiceChargeSettle = sLocalData.ServiceChargeSettle
|
|
|
+ sLocalInfo.RecruitNum = sLocalData.RecruitNum
|
|
|
+ sLocalInfo.SettleNum = sLocalData.SettleNum
|
|
|
sLocalInfo.FinishTime = conv.MustString(sLocalData.FinishTime)
|
|
|
|
|
|
// 2.2. 门店基本信息
|
|
@@ -657,9 +661,9 @@ func (*supplier) GetManageInvoiceInfo(ctx context.Context, req *http_model.Manag
|
|
|
|
|
|
var invoiceInfo *http_model.ManageInvoiceInfoData
|
|
|
invoiceInfo = &http_model.ManageInvoiceInfoData{}
|
|
|
- manageInvoiceInfo, mamageInvoiceErr := db.GetManageInvoice(ctx)
|
|
|
- if mamageInvoiceErr != nil {
|
|
|
- return nil, mamageInvoiceErr
|
|
|
+ manageInvoiceInfo, manageInvoiceErr := db.GetManageInvoice(ctx)
|
|
|
+ if manageInvoiceErr != nil {
|
|
|
+ return nil, manageInvoiceErr
|
|
|
}
|
|
|
if manageInvoiceInfo != nil {
|
|
|
invoiceInfo.InvoiceInfoID = manageInvoiceInfo.InvoiceInfoID
|
|
@@ -683,6 +687,39 @@ func (*supplier) GetWithdrawAmount(ctx context.Context, req *http_model.Withdraw
|
|
|
amountInfo.PendingWithdraw = 0.0
|
|
|
amountInfo.Withdrawn = 0.0
|
|
|
|
|
|
+ // 可提现
|
|
|
+ platformConfirmingIncome, platformConfirmingErr := db.GetFullSupplierIncomeList(ctx, req.SupplierId, 5)
|
|
|
+ if platformConfirmingErr != nil {
|
|
|
+ return nil, platformConfirmingErr
|
|
|
+ }
|
|
|
+ if platformConfirmingIncome != nil {
|
|
|
+ for _, income := range platformConfirmingIncome {
|
|
|
+ amountInfo.WithdrawAble += income.ServiceChargeSettle
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 提现中
|
|
|
+ pendingWithdrawIncome, pendingWithdrawErr := db.GetFullSupplierIncomeList(ctx, req.SupplierId, 7)
|
|
|
+ if pendingWithdrawErr != nil {
|
|
|
+ return nil, pendingWithdrawErr
|
|
|
+ }
|
|
|
+ if pendingWithdrawIncome != nil {
|
|
|
+ for _, income := range pendingWithdrawIncome {
|
|
|
+ amountInfo.PendingWithdraw += income.ServiceChargeSettle
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 已经提现
|
|
|
+ withdrawnIncome, withdrawnErr := db.GetFullSupplierIncomeList(ctx, req.SupplierId, 8)
|
|
|
+ if withdrawnErr != nil {
|
|
|
+ return nil, withdrawnErr
|
|
|
+ }
|
|
|
+ if withdrawnIncome != nil {
|
|
|
+ for _, income := range withdrawnIncome {
|
|
|
+ amountInfo.Withdrawn += income.ServiceChargeSettle
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
return amountInfo, nil
|
|
|
}
|
|
|
|
|
@@ -734,7 +771,7 @@ func (*supplier) GetSupplierBillAmount(ctx context.Context, req *http_model.Supp
|
|
|
return incomeData, nil
|
|
|
}
|
|
|
|
|
|
-// GetWithdrawPaymentInfo 提现收款信息
|
|
|
+// GetWithdrawPaymentInfo 查找提现收款信息
|
|
|
func (*supplier) GetWithdrawPaymentInfo(ctx context.Context, req *http_model.WithdrawPaymentInfoRequest) (*http_model.WithdrawPaymentInfoData, error) {
|
|
|
|
|
|
var paymentInfo *http_model.WithdrawPaymentInfoData
|
|
@@ -742,15 +779,113 @@ func (*supplier) GetWithdrawPaymentInfo(ctx context.Context, req *http_model.Wit
|
|
|
|
|
|
// 1. 个人服务商
|
|
|
if req.SupplierType == 1 {
|
|
|
+ // 1.1. 个人认证信息
|
|
|
+ supplierInfo, supplierErr := db.GetSupplierById(ctx, req.SupplierId)
|
|
|
+ if supplierErr != nil {
|
|
|
+ return nil, supplierErr
|
|
|
+ }
|
|
|
+ if supplierInfo != nil {
|
|
|
+ paymentInfo.Name = supplierInfo.Name
|
|
|
+ paymentInfo.IDNumber = supplierInfo.IdNumber
|
|
|
+ }
|
|
|
|
|
|
+ // 1.2. 提现收款信息查询
|
|
|
+ supplierPaymentInfo, supplierPaymentErr := db.GetSupplierPaymentInfoById(ctx, req.SupplierId)
|
|
|
+ if supplierPaymentErr != nil {
|
|
|
+ return nil, supplierPaymentErr
|
|
|
+ }
|
|
|
+ if supplierPaymentInfo != nil {
|
|
|
+ paymentInfo.Tag = 2
|
|
|
+ paymentInfo.Phone = supplierPaymentInfo.Phone
|
|
|
+ paymentInfo.SupplierType = supplierPaymentInfo.SupplierType
|
|
|
+ paymentInfo.BankName = supplierPaymentInfo.BankName
|
|
|
+ paymentInfo.BankNumber = supplierPaymentInfo.BankNumber
|
|
|
+ } else {
|
|
|
+ paymentInfo.Tag = 1
|
|
|
+ }
|
|
|
+ } else if req.SupplierType == 2 {
|
|
|
+ // 2. 机构服务商
|
|
|
+ // 2.1. 机构认证信息
|
|
|
+ supplierInfo, supplierErr := db.GetSupplierById(ctx, req.SupplierId)
|
|
|
+ if supplierErr != nil {
|
|
|
+ return nil, supplierErr
|
|
|
+ }
|
|
|
+ if supplierInfo != nil {
|
|
|
+ paymentInfo.Company = supplierInfo.CompanyName
|
|
|
+ }
|
|
|
+
|
|
|
+ // 2.2. 提现收款信息查询
|
|
|
+ supplierPaymentInfo, supplierPaymentErr := db.GetSupplierPaymentInfoById(ctx, req.SupplierId)
|
|
|
+ if supplierPaymentErr != nil {
|
|
|
+ return nil, supplierPaymentErr
|
|
|
+ }
|
|
|
+ if supplierPaymentInfo != nil {
|
|
|
+ paymentInfo.Tag = 2
|
|
|
+ paymentInfo.PaymentInfoID = supplierPaymentInfo.PaymentInfoID
|
|
|
+ paymentInfo.SupplierType = supplierPaymentInfo.SupplierType
|
|
|
+ paymentInfo.BankName = supplierPaymentInfo.BankName
|
|
|
+ paymentInfo.BankNumber = supplierPaymentInfo.BankNumber
|
|
|
+ } else {
|
|
|
+ paymentInfo.Tag = 1
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return paymentInfo, nil
|
|
|
}
|
|
|
|
|
|
-// UpdateWithdrawPaymentInfo 提现收款信息
|
|
|
+// UpdateWithdrawPaymentInfo 更新提现收款信息
|
|
|
func (*supplier) UpdateWithdrawPaymentInfo(ctx context.Context, req *http_model.UpdateWithdrawPaymentInfoRequest) error {
|
|
|
+ var paymentInfo *gorm_model.SupplierPaymentInfo
|
|
|
+ paymentInfo = &gorm_model.SupplierPaymentInfo{}
|
|
|
+ paymentInfo.PaymentInfoID = req.PaymentInfoId
|
|
|
+ paymentInfo.SupplierID = req.SupplierID
|
|
|
+ paymentInfo.Phone = req.Phone
|
|
|
+ paymentInfo.BankName = req.BankName
|
|
|
+ paymentInfo.BankNumber = req.BankNumber
|
|
|
+ paymentInfo.Name = req.Name
|
|
|
+ paymentInfo.IDNumber = req.IDNumber
|
|
|
+ paymentInfo.Company = req.Company
|
|
|
+ updatePaymentInfoErr := db.UpdateSupplierPayment(ctx, paymentInfo)
|
|
|
+ if updatePaymentInfoErr != nil {
|
|
|
+ return updatePaymentInfoErr
|
|
|
+ }
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+// CreateWithdrawPaymentInfo 创建提现收款信息
|
|
|
+func (*supplier) CreateWithdrawPaymentInfo(ctx context.Context, req *http_model.CreateWithdrawPaymentInfoRequest) error {
|
|
|
|
|
|
+ // 1. 个人服务商
|
|
|
+ if req.SupplierType == 1 {
|
|
|
+ var paymentInfo *gorm_model.SupplierPaymentInfo
|
|
|
+ paymentInfo = &gorm_model.SupplierPaymentInfo{}
|
|
|
+ paymentInfo.SupplierID = req.SupplierID
|
|
|
+ paymentInfo.Phone = req.Phone
|
|
|
+ paymentInfo.BankName = req.BankName
|
|
|
+ paymentInfo.BankNumber = req.BankNumber
|
|
|
+ paymentInfo.Name = req.Name
|
|
|
+ paymentInfo.IDNumber = req.IDNumber
|
|
|
+ paymentInfo.SupplierType = req.SupplierType
|
|
|
+ createPaymentInfoErr := db.CreateSupplierPayment(ctx, paymentInfo)
|
|
|
+ if createPaymentInfoErr != nil {
|
|
|
+ return createPaymentInfoErr
|
|
|
+ }
|
|
|
+ } else if req.SupplierType == 2 {
|
|
|
+ // 2. 机构服务商
|
|
|
+ var paymentInfo *gorm_model.SupplierPaymentInfo
|
|
|
+ paymentInfo = &gorm_model.SupplierPaymentInfo{}
|
|
|
+ paymentInfo.SupplierType = req.SupplierType
|
|
|
+ paymentInfo.SupplierID = req.SupplierID
|
|
|
+ paymentInfo.BankName = req.BankName
|
|
|
+ paymentInfo.BankNumber = req.BankNumber
|
|
|
+ paymentInfo.Name = req.Name
|
|
|
+ paymentInfo.IDNumber = req.IDNumber
|
|
|
+ paymentInfo.Company = req.Company
|
|
|
+ createPaymentInfoErr := db.CreateSupplierPayment(ctx, paymentInfo)
|
|
|
+ if createPaymentInfoErr != nil {
|
|
|
+ return createPaymentInfoErr
|
|
|
+ }
|
|
|
+ }
|
|
|
return nil
|
|
|
}
|
|
|
|