|
@@ -1062,7 +1062,69 @@ 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
|
|
|
+
|
|
|
+ var supplierAmountList *http_model.SupplierAmountBillData
|
|
|
+ supplierAmountList = &http_model.SupplierAmountBillData{}
|
|
|
+ var tag int
|
|
|
+ if req.Status == 2 {
|
|
|
+ tag = 10
|
|
|
+ }
|
|
|
+
|
|
|
+ // 1. 账单列表
|
|
|
+ sProjectList, sProjectTotal, sProjectListErr := db.GetUnifiedTaskList(ctx, req.SupplierId, req.PageSize, req.PageNum, tag, req.Condition)
|
|
|
+ if sProjectListErr != nil {
|
|
|
+ return nil, sProjectListErr
|
|
|
+ }
|
|
|
+ // 2. 拼接门店、商品信息
|
|
|
+ if sProjectList != nil {
|
|
|
+ supplierAmountList.Total = sProjectTotal
|
|
|
+ // supplierAmountList.SupplierAmountBillList = sProjectList
|
|
|
+
|
|
|
+ for _, billInfo := range sProjectList {
|
|
|
+ if billInfo.Type == 1 {
|
|
|
+ productInfo, productInfoErr := db.GetProductByID(ctx, int64(billInfo.ProductId))
|
|
|
+ if productInfoErr != nil {
|
|
|
+ return nil, productInfoErr
|
|
|
+ }
|
|
|
+ if productInfo != nil {
|
|
|
+ billInfo.Price = productInfo.ProductPrice
|
|
|
+ }
|
|
|
+ productPhotoInfo, productPhotoErr := db.GetProductPhotoByProductID(ctx, int64(billInfo.ProductId))
|
|
|
+ if productPhotoErr != nil {
|
|
|
+ return nil, productPhotoErr
|
|
|
+ }
|
|
|
+ if productPhotoInfo != nil {
|
|
|
+ for _, photoInfo := range productPhotoInfo {
|
|
|
+ if photoInfo.Symbol == 1 {
|
|
|
+ billInfo.MainPhotoUrl = photoInfo.PhotoUrl
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if billInfo.Type == 3 {
|
|
|
+ storeInfo, storeInfoErr := db.FindStoreById(ctx, billInfo.ProductId)
|
|
|
+ if storeInfoErr != nil {
|
|
|
+ return nil, storeInfoErr
|
|
|
+ }
|
|
|
+ if storeInfo != nil {
|
|
|
+ billInfo.Location = storeInfo.StoreLocation
|
|
|
+ }
|
|
|
+
|
|
|
+ storePhotoInfo, storePhotoErr := db.GetStorePhotoByStoreID(ctx, billInfo.ProductId)
|
|
|
+ if storePhotoErr != nil {
|
|
|
+ return nil, storePhotoErr
|
|
|
+ }
|
|
|
+ if storePhotoInfo != nil {
|
|
|
+ for _, photoInfo := range storePhotoInfo {
|
|
|
+ if photoInfo.Symbol == 1 {
|
|
|
+ billInfo.MainPhotoUrl = photoInfo.PhotoUrl
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ supplierAmountList.SupplierAmountBillList = sProjectList
|
|
|
+ }
|
|
|
+ return supplierAmountList, nil
|
|
|
}
|
|
|
|
|
|
// GetManageInvoiceInfo 查找后台回票信息
|