Sfoglia il codice sorgente

销售列表增加筛选项

xiexiaoyuan 2 anni fa
parent
commit
01fcf5ab77
2 ha cambiato i file con 40 aggiunte e 16 eliminazioni
  1. 27 5
      controller/census/seller.go
  2. 13 11
      models/fms/contract_invoice.go

+ 27 - 5
controller/census/seller.go

@@ -42,9 +42,20 @@ func (ct *SellerController) GroupInvoiceList(c *gin.Context) {
 		resp.FailData("参数解析失败", err.Translate(global.Trans), c)
 		return
 	}
-
+	var departmentId int
+	if req.SellerType == 1 {
+		departmentId = crm.SellerDepartmentId
+	}else if req.SellerType == 2 {
+		departmentId = crm.RaiSellerDepartmentId
+	}else if req.SellerType == 0 {
+		resp.Fail("请选择销售类型", c)
+		return
+	}else {
+		resp.Fail("请选择正确的销售类型", c)
+		return
+	}
 	outCond := ` department_id = %d AND parent_id = 0 `
-	outCond = fmt.Sprintf(outCond, crm.SellerDepartmentId)
+	outCond = fmt.Sprintf(outCond, departmentId)
 	cond := ` invoice_type = %d AND is_deleted = 0 AND seller_group_id != 0 `
 	cond = fmt.Sprintf(cond, fms.ContractInvoiceTypeMake)
 	pars := make([]interface{}, 0)
@@ -199,12 +210,23 @@ func (ct *SellerController) InvoiceList(c *gin.Context) {
 		resp.FailData("参数解析失败", err.Translate(global.Trans), c)
 		return
 	}
-
+	var departmentId int
+	if req.SellerType == 1 {
+		departmentId = crm.SellerDepartmentId
+	}else if req.SellerType == 2 {
+		departmentId = crm.RaiSellerDepartmentId
+	}else if req.SellerType == 0 {
+		resp.Fail("请选择销售类型", c)
+		return
+	}else {
+		resp.Fail("请选择正确的销售类型", c)
+		return
+	}
 	pars := make([]interface{}, 0)
 	outCond := ` a.department_id = %d AND a.enabled = 1 `
-	outCond = fmt.Sprintf(outCond, crm.SellerDepartmentId)
+	outCond = fmt.Sprintf(outCond, departmentId)
 	totalCond := ` department_id = %d AND enabled = 1 `
-	totalCond = fmt.Sprintf(totalCond, crm.SellerDepartmentId)
+	totalCond = fmt.Sprintf(totalCond, departmentId)
 	totalPars := make([]interface{}, 0)
 	if req.GroupId > 0 {
 		// 筛选组别时, 查询当前组别的下级组(因为admin表存的group_id, 有三级的存的是子ID, 只有二级的存的才是父ID =_=!)

+ 13 - 11
models/fms/contract_invoice.go

@@ -362,11 +362,12 @@ type UpdatePaymentPayTypeReq struct {
 
 // CensusSellerGroupInvoiceListReq 销售组开票统计列表请求体
 type CensusSellerGroupInvoiceListReq struct {
-	StartDate string `json:"start_date" form:"start_date" binding:"omitempty,datetime=2006-01-02" description:"开始日期"`
-	EndDate   string `json:"end_date" form:"end_date" binding:"omitempty,datetime=2006-01-02" description:"结束日期"`
-	SortField int    `json:"sort_field" form:"sort_field" description:"排序字段: 1-开票金额; 2-组别占比"`
-	SortType  int    `json:"sort_type" form:"sort_type" description:"排序方式: 1-正序; 2-倒序"`
-	IsExport  int    `json:"is_export" form:"is_export" description:"是否导出: 0-否; 1-是"`
+	StartDate  string `json:"start_date" form:"start_date" binding:"omitempty,datetime=2006-01-02" description:"开始日期"`
+	EndDate    string `json:"end_date" form:"end_date" binding:"omitempty,datetime=2006-01-02" description:"结束日期"`
+	SortField  int    `json:"sort_field" form:"sort_field" description:"排序字段: 1-开票金额; 2-组别占比"`
+	SortType   int    `json:"sort_type" form:"sort_type" description:"排序方式: 1-正序; 2-倒序"`
+	IsExport   int    `json:"is_export" form:"is_export" description:"是否导出: 0-否; 1-是"`
+	SellerType int    `json:"seller_type" form:"seller_type" description:"销售类型:1ficc销售,2权益销售"`
 	base.PageReq
 }
 
@@ -406,12 +407,13 @@ func GetCensusSellerGroupInvoicePageList(page base.IPage, condition, outCond str
 
 // CensusSellerInvoiceListReq 销售开票统计列表请求体
 type CensusSellerInvoiceListReq struct {
-	GroupId   int    `json:"group_id" form:"group_id" description:"销售组别ID"`
-	StartDate string `json:"start_date" form:"start_date" binding:"omitempty,datetime=2006-01-02" description:"开始日期"`
-	EndDate   string `json:"end_date" form:"end_date" binding:"omitempty,datetime=2006-01-02" description:"结束日期"`
-	SortField int    `json:"sort_field" form:"sort_field" description:"排序字段: 1-开票金额; 2-小组占比; 3-全员占比"`
-	SortType  int    `json:"sort_type" form:"sort_type" description:"排序方式: 1-正序; 2-倒序"`
-	IsExport  int    `json:"is_export" form:"is_export" description:"是否导出: 0-否; 1-是"`
+	GroupId    int    `json:"group_id" form:"group_id" description:"销售组别ID"`
+	StartDate  string `json:"start_date" form:"start_date" binding:"omitempty,datetime=2006-01-02" description:"开始日期"`
+	EndDate    string `json:"end_date" form:"end_date" binding:"omitempty,datetime=2006-01-02" description:"结束日期"`
+	SortField  int    `json:"sort_field" form:"sort_field" description:"排序字段: 1-开票金额; 2-小组占比; 3-全员占比"`
+	SortType   int    `json:"sort_type" form:"sort_type" description:"排序方式: 1-正序; 2-倒序"`
+	IsExport   int    `json:"is_export" form:"is_export" description:"是否导出: 0-否; 1-是"`
+	SellerType int    `json:"seller_type" form:"seller_type" description:"销售类型:1ficc销售,2权益销售"`
 	base.PageReq
 }