|
@@ -668,7 +668,7 @@ func (*supplier) UpdateSupplierIncomeStatus(ctx context.Context, incomeIds strin
|
|
|
// GetSupplierInvoiceList 查找服务商发票列表
|
|
|
func (*supplier) GetSupplierInvoiceList(ctx context.Context, req *http_model.SupplierInvoiceListRequest) (*http_model.SupplierInvoiceListData, error) {
|
|
|
// 1. 查询服务商发票信息
|
|
|
- supplierInvoiceList, total, err := db.GetInvoiceListBySupplierId(ctx, req.SupplierId, req.InvoiceStatus, 4, req.PageSize, req.PageNum-1)
|
|
|
+ supplierInvoiceList, total, err := db.GetInvoiceListBySupplierId(ctx, req.SupplierId, req.InvoiceStatus, 0, req.PageSize, req.PageNum-1)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
@@ -1460,3 +1460,75 @@ func (*supplier) SendCodeT(ctx context.Context, phone string, code string) error
|
|
|
fmt.Printf("短信发送成功,响应: %v\n", resp)
|
|
|
return nil
|
|
|
}
|
|
|
+
|
|
|
+// GetSupplierInvoiceCount 可回发票、待传发票、平台确认中、已回发票、已驳回数量
|
|
|
+func (*supplier) GetSupplierInvoiceCount(ctx context.Context, req *http_model.InvoiceCountRequest) (*http_model.InvoiceCountData, error) {
|
|
|
+ var invoiceAmountCount *http_model.InvoiceCountData
|
|
|
+ invoiceAmountCount = &http_model.InvoiceCountData{}
|
|
|
+
|
|
|
+ // 可回发票
|
|
|
+ supplierIncomeCount, supplierIncomeErr := db.GetFullSupplierIncomeCount(ctx, req.SupplierId, 1)
|
|
|
+ if supplierIncomeErr != nil {
|
|
|
+ return nil, supplierIncomeErr
|
|
|
+ }
|
|
|
+ invoiceAmountCount.Stage1 = supplierIncomeCount
|
|
|
+
|
|
|
+ // 待传发票数量
|
|
|
+ Stage2, Stage2Err := db.GetInvoiceCountBySupplierId(ctx, req.SupplierId, 1, 0)
|
|
|
+ if Stage2Err != nil {
|
|
|
+ return nil, Stage2Err
|
|
|
+ }
|
|
|
+ invoiceAmountCount.Stage2 = Stage2
|
|
|
+
|
|
|
+ // 平台确认中数量
|
|
|
+ Stage3, Stage3Err := db.GetInvoiceCountBySupplierId(ctx, req.SupplierId, 2, 0)
|
|
|
+ if Stage3Err != nil {
|
|
|
+ return nil, Stage2Err
|
|
|
+ }
|
|
|
+ invoiceAmountCount.Stage3 = Stage3
|
|
|
+
|
|
|
+ // 平台已经确认数量
|
|
|
+ Stage4, Stage4Err := db.GetInvoiceCountBySupplierId(ctx, req.SupplierId, 3, 0)
|
|
|
+ if Stage4Err != nil {
|
|
|
+ return nil, Stage4Err
|
|
|
+ }
|
|
|
+ invoiceAmountCount.Stage4 = Stage4
|
|
|
+
|
|
|
+ // 平台已经驳回数量
|
|
|
+ Stage5, Stage5Err := db.GetInvoiceCountBySupplierId(ctx, req.SupplierId, 4, 0)
|
|
|
+ if Stage5Err != nil {
|
|
|
+ return nil, Stage5Err
|
|
|
+ }
|
|
|
+ invoiceAmountCount.Stage5 = Stage5
|
|
|
+
|
|
|
+ return invoiceAmountCount, nil
|
|
|
+}
|
|
|
+
|
|
|
+// GetSupplierWithdrawCount 提现列表数量
|
|
|
+func (*supplier) GetSupplierWithdrawCount(ctx context.Context, req *http_model.SupplierWithdrawCountRequest) (*http_model.SupplierWithdrawCountData, error) {
|
|
|
+ var WithdrawCount *http_model.SupplierWithdrawCountData
|
|
|
+ WithdrawCount = &http_model.SupplierWithdrawCountData{}
|
|
|
+
|
|
|
+ // 提现中
|
|
|
+ supplierIncomeCount, supplierIncomeErr := db.GetSupplierWithdrawCount(ctx, req.SupplierId, 2)
|
|
|
+ if supplierIncomeErr != nil {
|
|
|
+ return nil, supplierIncomeErr
|
|
|
+ }
|
|
|
+ WithdrawCount.Stage1 = supplierIncomeCount
|
|
|
+
|
|
|
+ // 已提现
|
|
|
+ Stage2, Stage2Err := db.GetSupplierWithdrawCount(ctx, req.SupplierId, 3)
|
|
|
+ if Stage2Err != nil {
|
|
|
+ return nil, Stage2Err
|
|
|
+ }
|
|
|
+ WithdrawCount.Stage2 = Stage2
|
|
|
+
|
|
|
+ // 已驳回
|
|
|
+ Stage3, Stage3Err := db.GetSupplierWithdrawCount(ctx, req.SupplierId, 4)
|
|
|
+ if Stage3Err != nil {
|
|
|
+ return nil, Stage2Err
|
|
|
+ }
|
|
|
+ WithdrawCount.Stage3 = Stage3
|
|
|
+
|
|
|
+ return WithdrawCount, nil
|
|
|
+}
|