|
@@ -309,6 +309,7 @@ func (*supplier) GetSupplierInvoiceList(ctx context.Context, req *http_model.Sup
|
|
|
return nil, incomeErr
|
|
|
}
|
|
|
sTaskInfo.ServiceCharge = currIncome.ServiceChargeSettle
|
|
|
+ supplierInvoiceInfo.Amount += currIncome.ServiceChargeSettle
|
|
|
if currIncome.IncomeType == 1 {
|
|
|
sTaskInfo.Id = currIncome.SProjectID
|
|
|
} else if currIncome.IncomeType == 3 {
|
|
@@ -346,6 +347,7 @@ func (*supplier) GetSupplierToWithdrawList(ctx context.Context, req *http_model.
|
|
|
// 2. 根据发票中的incomeIds去查找任务及其服务费收入
|
|
|
var supplierInvoiceInfo *http_model.SupplierToWithdrawInfo
|
|
|
supplierInvoiceInfo = &http_model.SupplierToWithdrawInfo{}
|
|
|
+ // supplierInvoiceInfo.Amount = 0.0
|
|
|
|
|
|
// 2.1. 基础信息填入
|
|
|
supplierInvoiceInfo.AgreeTime = supplierInvoice.AgreeTime
|
|
@@ -649,3 +651,160 @@ func (*supplier) GetSupplierWithdrawList(ctx context.Context, req *http_model.Su
|
|
|
func (*supplier) GetSupplierAmountBillList(ctx context.Context, req *http_model.SupplierAmountBillListRequest) (*http_model.SupplierAmountBillData, error) {
|
|
|
return nil, nil
|
|
|
}
|
|
|
+
|
|
|
+// GetManageInvoiceInfo 查找后台回票信息
|
|
|
+func (*supplier) GetManageInvoiceInfo(ctx context.Context, req *http_model.ManageInvoiceInfoRequest) (*http_model.ManageInvoiceInfoData, error) {
|
|
|
+
|
|
|
+ var invoiceInfo *http_model.ManageInvoiceInfoData
|
|
|
+ invoiceInfo = &http_model.ManageInvoiceInfoData{}
|
|
|
+ manageInvoiceInfo, mamageInvoiceErr := db.GetManageInvoice(ctx)
|
|
|
+ if mamageInvoiceErr != nil {
|
|
|
+ return nil, mamageInvoiceErr
|
|
|
+ }
|
|
|
+ if manageInvoiceInfo != nil {
|
|
|
+ invoiceInfo.InvoiceInfoID = manageInvoiceInfo.InvoiceInfoID
|
|
|
+ invoiceInfo.Address = manageInvoiceInfo.Address
|
|
|
+ invoiceInfo.Phone = manageInvoiceInfo.Phone
|
|
|
+ invoiceInfo.BankNumber = manageInvoiceInfo.BankNumber
|
|
|
+ invoiceInfo.EnterpriseName = manageInvoiceInfo.EnterpriseName
|
|
|
+ invoiceInfo.ProjectNameToChoose = manageInvoiceInfo.ProjectNameToChoose
|
|
|
+ invoiceInfo.BankName = manageInvoiceInfo.BankName
|
|
|
+ }
|
|
|
+ return invoiceInfo, nil
|
|
|
+}
|
|
|
+
|
|
|
+// GetWithdrawAmount 查找可提现、提现中、已提现金额
|
|
|
+func (*supplier) GetWithdrawAmount(ctx context.Context, req *http_model.WithdrawAmountRequest) (*http_model.WithdrawAmountData, error) {
|
|
|
+
|
|
|
+ var amountInfo *http_model.WithdrawAmountData
|
|
|
+ amountInfo = &http_model.WithdrawAmountData{}
|
|
|
+
|
|
|
+ amountInfo.WithdrawAble = 0.0
|
|
|
+ amountInfo.PendingWithdraw = 0.0
|
|
|
+ amountInfo.Withdrawn = 0.0
|
|
|
+
|
|
|
+ return amountInfo, nil
|
|
|
+}
|
|
|
+
|
|
|
+// GetSupplierBillAmount 服务商账单 总余额、可提现金额
|
|
|
+func (*supplier) GetSupplierBillAmount(ctx context.Context, req *http_model.SupplierAmountRequest) (*http_model.SupplierBillAmountData, error) {
|
|
|
+ var incomeData *http_model.SupplierBillAmountData
|
|
|
+ incomeData = &http_model.SupplierBillAmountData{}
|
|
|
+ incomeData.FullAmount = 0.0
|
|
|
+ incomeData.Settle = 0.0
|
|
|
+
|
|
|
+ // 1. 个人服务商
|
|
|
+ if req.SupplierType == 1 {
|
|
|
+ supplierIncome, supplierIncomeErr := db.GetFullSupplierIncomeList(ctx, req.SupplierId, 5)
|
|
|
+ if supplierIncomeErr != nil {
|
|
|
+ return nil, supplierIncomeErr
|
|
|
+ }
|
|
|
+ if supplierIncome != nil {
|
|
|
+ for _, income := range supplierIncome {
|
|
|
+ incomeData.FullAmount += income.ServiceChargeSettle
|
|
|
+ }
|
|
|
+ incomeData.Settle = incomeData.FullAmount
|
|
|
+ }
|
|
|
+ } else if req.SupplierType == 2 {
|
|
|
+ // 2. 企业服务商
|
|
|
+ // 可提现
|
|
|
+ supplierIncome, supplierIncomeErr := db.GetFullSupplierIncomeList(ctx, req.SupplierId, 5)
|
|
|
+ if supplierIncomeErr != nil {
|
|
|
+ return nil, supplierIncomeErr
|
|
|
+ }
|
|
|
+ if supplierIncome != nil {
|
|
|
+ for _, income := range supplierIncome {
|
|
|
+ incomeData.Settle += income.ServiceChargeSettle
|
|
|
+ }
|
|
|
+ incomeData.FullAmount = incomeData.Settle
|
|
|
+ }
|
|
|
+
|
|
|
+ // 可回票
|
|
|
+ supplierToInvoice, supplierToInvoiceErr := db.GetFullSupplierIncomeList(ctx, req.SupplierId, 1)
|
|
|
+ if supplierToInvoiceErr != nil {
|
|
|
+ return nil, supplierToInvoiceErr
|
|
|
+ }
|
|
|
+ if supplierToInvoice != nil {
|
|
|
+ for _, invoice := range supplierToInvoice {
|
|
|
+ incomeData.FullAmount += invoice.ServiceChargeSettle
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // fmt.Println(incomeData)
|
|
|
+ return incomeData, nil
|
|
|
+}
|
|
|
+
|
|
|
+// GetWithdrawPaymentInfo 提现收款信息
|
|
|
+func (*supplier) GetWithdrawPaymentInfo(ctx context.Context, req *http_model.WithdrawPaymentInfoRequest) (*http_model.WithdrawPaymentInfoData, error) {
|
|
|
+
|
|
|
+ var paymentInfo *http_model.WithdrawPaymentInfoData
|
|
|
+ paymentInfo = &http_model.WithdrawPaymentInfoData{}
|
|
|
+
|
|
|
+ // 1. 个人服务商
|
|
|
+ if req.SupplierType == 1 {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return paymentInfo, nil
|
|
|
+}
|
|
|
+
|
|
|
+// UpdateWithdrawPaymentInfo 提现收款信息
|
|
|
+func (*supplier) UpdateWithdrawPaymentInfo(ctx context.Context, req *http_model.UpdateWithdrawPaymentInfoRequest) error {
|
|
|
+
|
|
|
+ return nil
|
|
|
+}
|
|
|
+
|
|
|
+// GetSupplierInvoiceAmount 可回发票、待传发票、平台确认中、已回发票金额
|
|
|
+func (*supplier) GetSupplierInvoiceAmount(ctx context.Context, req *http_model.InvoiceAmountRequest) (*http_model.InvoiceAmountData, error) {
|
|
|
+ var invoiceAmount *http_model.InvoiceAmountData
|
|
|
+ invoiceAmount = &http_model.InvoiceAmountData{}
|
|
|
+ invoiceAmount.InvoiceReturned = 0.0
|
|
|
+ invoiceAmount.PendingUpload = 0.0
|
|
|
+ invoiceAmount.CanUpload = 0.0
|
|
|
+ invoiceAmount.PlatformConfirming = 0.0
|
|
|
+
|
|
|
+ // 可回发票
|
|
|
+ supplierIncome, supplierIncomeErr := db.GetFullSupplierIncomeList(ctx, req.SupplierId, 1)
|
|
|
+ if supplierIncomeErr != nil {
|
|
|
+ return nil, supplierIncomeErr
|
|
|
+ }
|
|
|
+ if supplierIncome != nil {
|
|
|
+ for _, income := range supplierIncome {
|
|
|
+ invoiceAmount.CanUpload += income.ServiceChargeSettle
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 待传发票
|
|
|
+ pendingUploadIncome, pendingUploadErr := db.GetFullSupplierIncomeList(ctx, req.SupplierId, 2)
|
|
|
+ if pendingUploadErr != nil {
|
|
|
+ return nil, pendingUploadErr
|
|
|
+ }
|
|
|
+ if pendingUploadIncome != nil {
|
|
|
+ for _, income := range pendingUploadIncome {
|
|
|
+ invoiceAmount.PendingUpload += income.ServiceChargeSettle
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 平台确认中
|
|
|
+ platformConfirmingIncome, platformConfirmingErr := db.GetFullSupplierIncomeList(ctx, req.SupplierId, 3)
|
|
|
+ if platformConfirmingErr != nil {
|
|
|
+ return nil, platformConfirmingErr
|
|
|
+ }
|
|
|
+ if platformConfirmingIncome != nil {
|
|
|
+ for _, income := range platformConfirmingIncome {
|
|
|
+ invoiceAmount.PlatformConfirming += income.ServiceChargeSettle
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 已回票
|
|
|
+ InvoiceReturnedIncome, InvoiceReturnedErr := db.GetFullSupplierIncomeList(ctx, req.SupplierId, 5)
|
|
|
+ if InvoiceReturnedErr != nil {
|
|
|
+ return nil, InvoiceReturnedErr
|
|
|
+ }
|
|
|
+ if InvoiceReturnedIncome != nil {
|
|
|
+ for _, income := range InvoiceReturnedIncome {
|
|
|
+ invoiceAmount.InvoiceReturned += income.ServiceChargeSettle
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return invoiceAmount, nil
|
|
|
+}
|