zhangqian
2023-08-13 67c554b33cc0550929b6ec4855c52e7ca374ccee
完善商品退货单
2个文件已添加
9个文件已修改
644 ■■■■ 已修改文件
api/v1/salesReturn.go 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
constvar/salesReturn.go 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/docs.go 197 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.json 197 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
docs/swagger.yaml 139 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/model.go 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/request/salesReturn.go 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/salesDetails.go 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/salesReturn.go 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
model/salesReturnStatus.go 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service/salesReturn.go 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
api/v1/salesReturn.go
@@ -99,7 +99,6 @@
}
func checkSalesReturnParams(salesReturn request.SalesReturn) (errCode int, s model.SalesReturn) {
    //if salesReturn.Number == "" {
    //    return ecode.InvalidParams, s
@@ -113,17 +112,12 @@
    //    return ecode.InvalidParams, s
    //}
    t, err := checkTimeFormat(salesReturn.ReturnDate)
    if err != nil {
        return ecode.InvalidParams, s
    }
    s.ClientId = salesReturn.ClientId
    s.ReturnDate = t
    s.ReturnDate = salesReturn.ReturnDate
    s.Number = salesReturn.Number
    s.Repository = salesReturn.Repository
    s.MemberId = salesReturn.MemberId
    s.SalesReturnStatus = salesReturn.Status
    s.SalesReturnStatusId = salesReturn.SalesReturnStatusId
    s.Reason = salesReturn.Reason
    s.Products = salesReturn.Products
@@ -152,7 +146,7 @@
    }
    ctx.OkWithDetailed(response.SalesReturnResponse{
        List: salesReturns,
        List:  salesReturns,
        Count: int(total),
    })
}
}
constvar/salesReturn.go
New file
@@ -0,0 +1,7 @@
package constvar
type SalesReturnSourceType int
const (
    SalesReturnSourceTypeSaleDetails SalesReturnSourceType = 1 //销售明细
)
docs/docs.go
@@ -9841,18 +9841,36 @@
                "BankAccountQueryClassExpireLessThen60Days"
            ]
        },
        "constvar.CollectionStatus": {
        "constvar.CollectionSourceType": {
            "type": "integer",
            "enum": [
                1,
                2
            ],
            "x-enum-comments": {
                "CollectionSourceTypeSaleDetails": "销售明细",
                "CollectionSourceTypeServiceContract": "服务合同"
            },
            "x-enum-varnames": [
                "CollectionSourceTypeSaleDetails",
                "CollectionSourceTypeServiceContract"
            ]
        },
        "constvar.CollectionStatus": {
            "type": "integer",
            "enum": [
                1,
                2,
                3
            ],
            "x-enum-comments": {
                "CollectionStatusCollected": "已收款",
                "CollectionStatusSubCollected": "部分收款",
                "CollectionStatusUnCollected": "待收款"
            },
            "x-enum-varnames": [
                "CollectionStatusUnCollected",
                "CollectionStatusSubCollected",
                "CollectionStatusCollected"
            ]
        },
@@ -9993,6 +10011,23 @@
                "ReceiptQueryClassExpireLessThen60Days"
            ]
        },
        "constvar.ReceiptSourceType": {
            "type": "integer",
            "enum": [
                1,
                2,
                3,
                4,
                5
            ],
            "x-enum-varnames": [
                "ReceiptSourceTypeSalesDetails",
                "ReceiptSourceTypeServiceContract",
                "ReceiptSourceTypeInvoice",
                "ReceiptSourceTypeCollectionPlan",
                "ReceiptSourceTypeChuKuDan"
            ]
        },
        "constvar.SalesDetailsKeywordType": {
            "type": "string",
            "enum": [
@@ -10008,6 +10043,18 @@
                "SalesDetailsKeywordTypeSignTime",
                "SalesDetailsKeywordTypePrincipal",
                "SalesDetailsKeywordTypeProductName"
            ]
        },
        "constvar.SalesReturnSourceType": {
            "type": "integer",
            "enum": [
                1
            ],
            "x-enum-comments": {
                "SalesReturnSourceTypeSaleDetails": "销售明细"
            },
            "x-enum-varnames": [
                "SalesReturnSourceTypeSaleDetails"
            ]
        },
        "constvar.SalesStatus": {
@@ -11233,7 +11280,7 @@
            "properties": {
                "amount": {
                    "description": "收款金额",
                    "type": "string"
                    "type": "number"
                },
                "bankAccountId": {
                    "description": "账户id",
@@ -11276,7 +11323,11 @@
                },
                "sourceType": {
                    "description": "来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单)",
                    "type": "integer"
                    "allOf": [
                        {
                            "$ref": "#/definitions/constvar.ReceiptSourceType"
                        }
                    ]
                }
            }
        },
@@ -11499,6 +11550,9 @@
        "model.SalesDetails": {
            "type": "object",
            "properties": {
                "Member": {
                    "$ref": "#/definitions/model.User"
                },
                "address": {
                    "type": "string"
                },
@@ -11517,6 +11571,10 @@
                    "description": "已收金额",
                    "type": "number"
                },
                "amountTotal": {
                    "description": "价税合计",
                    "type": "number"
                },
                "amountUnInvoiced": {
                    "description": "未开票金额",
                    "type": "number"
@@ -11528,6 +11586,15 @@
                    "type": "integer"
                },
                "conditions": {
                    "type": "string"
                },
                "createTime": {
                    "type": "string"
                },
                "creatorId": {
                    "type": "integer"
                },
                "creatorName": {
                    "type": "string"
                },
                "deliveryDate": {
@@ -11692,8 +11759,28 @@
        "model.SalesReturn": {
            "type": "object",
            "properties": {
                "Member": {
                    "$ref": "#/definitions/model.User"
                },
                "SalesReturnStatus": {
                    "description": "退货状态",
                    "allOf": [
                        {
                            "$ref": "#/definitions/model.SalesReturnStatus"
                        }
                    ]
                },
                "client": {
                    "$ref": "#/definitions/model.Client"
                },
                "clientId": {
                    "type": "integer"
                },
                "createTime": {
                    "type": "string"
                },
                "creatorName": {
                    "type": "string"
                },
                "id": {
                    "type": "integer"
@@ -11705,22 +11792,38 @@
                    "type": "string"
                },
                "products": {
                    "description": "退货产品",
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/model.Product"
                    }
                },
                "reason": {
                    "description": "退货原因",
                    "type": "string"
                },
                "repository": {
                    "type": "string"
                },
                "returnDate": {
                    "description": "退货日期",
                    "type": "string"
                },
                "salesReturnStatus": {
                "salesReturnStatusId": {
                    "description": "退货状态id",
                    "type": "integer"
                },
                "sourceId": {
                    "description": "源单id",
                    "type": "integer"
                },
                "sourceType": {
                    "description": "源单类型(1销售明细)",
                    "allOf": [
                        {
                            "$ref": "#/definitions/constvar.SalesReturnSourceType"
                        }
                    ]
                }
            }
        },
@@ -11764,6 +11867,18 @@
                    "description": "金额",
                    "type": "number"
                },
                "amountReceivable": {
                    "description": "应收金额",
                    "type": "number"
                },
                "amountReceived": {
                    "description": "已收金额",
                    "type": "number"
                },
                "amountTotal": {
                    "description": "总额",
                    "type": "number"
                },
                "collectionDate": {
                    "description": "计划收款日期",
                    "type": "string"
@@ -11801,10 +11916,14 @@
                },
                "sourceType": {
                    "description": "源单类型(1销售明细2服务合同3销售发票)",
                    "type": "integer"
                    "allOf": [
                        {
                            "$ref": "#/definitions/constvar.CollectionSourceType"
                        }
                    ]
                },
                "status": {
                    "description": "状态(1未收2已收)",
                    "description": "状态(1未收2部分已收3已收)",
                    "allOf": [
                        {
                            "$ref": "#/definitions/constvar.CollectionStatus"
@@ -11833,6 +11952,10 @@
                },
                "amountReceived": {
                    "description": "已收金额",
                    "type": "number"
                },
                "amountTotal": {
                    "description": "价税合计",
                    "type": "number"
                },
                "amountUnInvoiced": {
@@ -12150,6 +12273,10 @@
                "serviceOrderStatus": {
                    "$ref": "#/definitions/model.ServiceOrderStatus"
                },
                "serviceOrderStatusId": {
                    "description": "处理状态",
                    "type": "integer"
                },
                "serviceType": {
                    "$ref": "#/definitions/model.ServiceType"
                },
@@ -12167,10 +12294,6 @@
                "solutionRemark": {
                    "description": "内部备注",
                    "type": "string"
                },
                "status": {
                    "description": "处理状态",
                    "type": "integer"
                },
                "subject": {
                    "description": "主题",
@@ -13062,7 +13185,7 @@
            "properties": {
                "amount": {
                    "description": "收款金额",
                    "type": "string"
                    "type": "number"
                },
                "bankAccountId": {
                    "description": "账户id",
@@ -13105,7 +13228,11 @@
                },
                "sourceType": {
                    "description": "来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单)",
                    "type": "integer"
                    "allOf": [
                        {
                            "$ref": "#/definitions/constvar.ReceiptSourceType"
                        }
                    ]
                }
            }
        },
@@ -14851,22 +14978,38 @@
                    "type": "string"
                },
                "products": {
                    "description": "退货产品",
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/model.Product"
                    }
                },
                "reason": {
                    "description": "退货原因",
                    "type": "string"
                },
                "repository": {
                    "type": "string"
                },
                "returnDate": {
                    "description": "退货日期",
                    "type": "string"
                },
                "status": {
                "salesReturnStatusId": {
                    "description": "退货状态id",
                    "type": "integer"
                },
                "sourceId": {
                    "description": "源单id",
                    "type": "integer"
                },
                "sourceType": {
                    "description": "源单类型(1销售明细)",
                    "allOf": [
                        {
                            "$ref": "#/definitions/constvar.SalesReturnSourceType"
                        }
                    ]
                }
            }
        },
@@ -15922,7 +16065,7 @@
            "properties": {
                "amount": {
                    "description": "收款金额",
                    "type": "string"
                    "type": "number"
                },
                "bankAccountId": {
                    "description": "账户id",
@@ -15965,7 +16108,11 @@
                },
                "sourceType": {
                    "description": "来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单)",
                    "type": "integer"
                    "allOf": [
                        {
                            "$ref": "#/definitions/constvar.ReceiptSourceType"
                        }
                    ]
                }
            }
        },
@@ -16480,6 +16627,18 @@
                    "description": "金额",
                    "type": "number"
                },
                "amountReceivable": {
                    "description": "应收金额",
                    "type": "number"
                },
                "amountReceived": {
                    "description": "已收金额",
                    "type": "number"
                },
                "amountTotal": {
                    "description": "总额",
                    "type": "number"
                },
                "collectionDate": {
                    "description": "计划收款日期",
                    "type": "string"
@@ -16517,10 +16676,14 @@
                },
                "sourceType": {
                    "description": "源单类型(1销售明细2服务合同3销售发票)",
                    "type": "integer"
                    "allOf": [
                        {
                            "$ref": "#/definitions/constvar.CollectionSourceType"
                        }
                    ]
                },
                "status": {
                    "description": "状态(1未收2已收)",
                    "description": "状态(1未收2部分已收3已收)",
                    "allOf": [
                        {
                            "$ref": "#/definitions/constvar.CollectionStatus"
docs/swagger.json
@@ -9829,18 +9829,36 @@
                "BankAccountQueryClassExpireLessThen60Days"
            ]
        },
        "constvar.CollectionStatus": {
        "constvar.CollectionSourceType": {
            "type": "integer",
            "enum": [
                1,
                2
            ],
            "x-enum-comments": {
                "CollectionSourceTypeSaleDetails": "销售明细",
                "CollectionSourceTypeServiceContract": "服务合同"
            },
            "x-enum-varnames": [
                "CollectionSourceTypeSaleDetails",
                "CollectionSourceTypeServiceContract"
            ]
        },
        "constvar.CollectionStatus": {
            "type": "integer",
            "enum": [
                1,
                2,
                3
            ],
            "x-enum-comments": {
                "CollectionStatusCollected": "已收款",
                "CollectionStatusSubCollected": "部分收款",
                "CollectionStatusUnCollected": "待收款"
            },
            "x-enum-varnames": [
                "CollectionStatusUnCollected",
                "CollectionStatusSubCollected",
                "CollectionStatusCollected"
            ]
        },
@@ -9981,6 +9999,23 @@
                "ReceiptQueryClassExpireLessThen60Days"
            ]
        },
        "constvar.ReceiptSourceType": {
            "type": "integer",
            "enum": [
                1,
                2,
                3,
                4,
                5
            ],
            "x-enum-varnames": [
                "ReceiptSourceTypeSalesDetails",
                "ReceiptSourceTypeServiceContract",
                "ReceiptSourceTypeInvoice",
                "ReceiptSourceTypeCollectionPlan",
                "ReceiptSourceTypeChuKuDan"
            ]
        },
        "constvar.SalesDetailsKeywordType": {
            "type": "string",
            "enum": [
@@ -9996,6 +10031,18 @@
                "SalesDetailsKeywordTypeSignTime",
                "SalesDetailsKeywordTypePrincipal",
                "SalesDetailsKeywordTypeProductName"
            ]
        },
        "constvar.SalesReturnSourceType": {
            "type": "integer",
            "enum": [
                1
            ],
            "x-enum-comments": {
                "SalesReturnSourceTypeSaleDetails": "销售明细"
            },
            "x-enum-varnames": [
                "SalesReturnSourceTypeSaleDetails"
            ]
        },
        "constvar.SalesStatus": {
@@ -11221,7 +11268,7 @@
            "properties": {
                "amount": {
                    "description": "收款金额",
                    "type": "string"
                    "type": "number"
                },
                "bankAccountId": {
                    "description": "账户id",
@@ -11264,7 +11311,11 @@
                },
                "sourceType": {
                    "description": "来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单)",
                    "type": "integer"
                    "allOf": [
                        {
                            "$ref": "#/definitions/constvar.ReceiptSourceType"
                        }
                    ]
                }
            }
        },
@@ -11487,6 +11538,9 @@
        "model.SalesDetails": {
            "type": "object",
            "properties": {
                "Member": {
                    "$ref": "#/definitions/model.User"
                },
                "address": {
                    "type": "string"
                },
@@ -11505,6 +11559,10 @@
                    "description": "已收金额",
                    "type": "number"
                },
                "amountTotal": {
                    "description": "价税合计",
                    "type": "number"
                },
                "amountUnInvoiced": {
                    "description": "未开票金额",
                    "type": "number"
@@ -11516,6 +11574,15 @@
                    "type": "integer"
                },
                "conditions": {
                    "type": "string"
                },
                "createTime": {
                    "type": "string"
                },
                "creatorId": {
                    "type": "integer"
                },
                "creatorName": {
                    "type": "string"
                },
                "deliveryDate": {
@@ -11680,8 +11747,28 @@
        "model.SalesReturn": {
            "type": "object",
            "properties": {
                "Member": {
                    "$ref": "#/definitions/model.User"
                },
                "SalesReturnStatus": {
                    "description": "退货状态",
                    "allOf": [
                        {
                            "$ref": "#/definitions/model.SalesReturnStatus"
                        }
                    ]
                },
                "client": {
                    "$ref": "#/definitions/model.Client"
                },
                "clientId": {
                    "type": "integer"
                },
                "createTime": {
                    "type": "string"
                },
                "creatorName": {
                    "type": "string"
                },
                "id": {
                    "type": "integer"
@@ -11693,22 +11780,38 @@
                    "type": "string"
                },
                "products": {
                    "description": "退货产品",
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/model.Product"
                    }
                },
                "reason": {
                    "description": "退货原因",
                    "type": "string"
                },
                "repository": {
                    "type": "string"
                },
                "returnDate": {
                    "description": "退货日期",
                    "type": "string"
                },
                "salesReturnStatus": {
                "salesReturnStatusId": {
                    "description": "退货状态id",
                    "type": "integer"
                },
                "sourceId": {
                    "description": "源单id",
                    "type": "integer"
                },
                "sourceType": {
                    "description": "源单类型(1销售明细)",
                    "allOf": [
                        {
                            "$ref": "#/definitions/constvar.SalesReturnSourceType"
                        }
                    ]
                }
            }
        },
@@ -11752,6 +11855,18 @@
                    "description": "金额",
                    "type": "number"
                },
                "amountReceivable": {
                    "description": "应收金额",
                    "type": "number"
                },
                "amountReceived": {
                    "description": "已收金额",
                    "type": "number"
                },
                "amountTotal": {
                    "description": "总额",
                    "type": "number"
                },
                "collectionDate": {
                    "description": "计划收款日期",
                    "type": "string"
@@ -11789,10 +11904,14 @@
                },
                "sourceType": {
                    "description": "源单类型(1销售明细2服务合同3销售发票)",
                    "type": "integer"
                    "allOf": [
                        {
                            "$ref": "#/definitions/constvar.CollectionSourceType"
                        }
                    ]
                },
                "status": {
                    "description": "状态(1未收2已收)",
                    "description": "状态(1未收2部分已收3已收)",
                    "allOf": [
                        {
                            "$ref": "#/definitions/constvar.CollectionStatus"
@@ -11821,6 +11940,10 @@
                },
                "amountReceived": {
                    "description": "已收金额",
                    "type": "number"
                },
                "amountTotal": {
                    "description": "价税合计",
                    "type": "number"
                },
                "amountUnInvoiced": {
@@ -12138,6 +12261,10 @@
                "serviceOrderStatus": {
                    "$ref": "#/definitions/model.ServiceOrderStatus"
                },
                "serviceOrderStatusId": {
                    "description": "处理状态",
                    "type": "integer"
                },
                "serviceType": {
                    "$ref": "#/definitions/model.ServiceType"
                },
@@ -12155,10 +12282,6 @@
                "solutionRemark": {
                    "description": "内部备注",
                    "type": "string"
                },
                "status": {
                    "description": "处理状态",
                    "type": "integer"
                },
                "subject": {
                    "description": "主题",
@@ -13050,7 +13173,7 @@
            "properties": {
                "amount": {
                    "description": "收款金额",
                    "type": "string"
                    "type": "number"
                },
                "bankAccountId": {
                    "description": "账户id",
@@ -13093,7 +13216,11 @@
                },
                "sourceType": {
                    "description": "来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单)",
                    "type": "integer"
                    "allOf": [
                        {
                            "$ref": "#/definitions/constvar.ReceiptSourceType"
                        }
                    ]
                }
            }
        },
@@ -14839,22 +14966,38 @@
                    "type": "string"
                },
                "products": {
                    "description": "退货产品",
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/model.Product"
                    }
                },
                "reason": {
                    "description": "退货原因",
                    "type": "string"
                },
                "repository": {
                    "type": "string"
                },
                "returnDate": {
                    "description": "退货日期",
                    "type": "string"
                },
                "status": {
                "salesReturnStatusId": {
                    "description": "退货状态id",
                    "type": "integer"
                },
                "sourceId": {
                    "description": "源单id",
                    "type": "integer"
                },
                "sourceType": {
                    "description": "源单类型(1销售明细)",
                    "allOf": [
                        {
                            "$ref": "#/definitions/constvar.SalesReturnSourceType"
                        }
                    ]
                }
            }
        },
@@ -15910,7 +16053,7 @@
            "properties": {
                "amount": {
                    "description": "收款金额",
                    "type": "string"
                    "type": "number"
                },
                "bankAccountId": {
                    "description": "账户id",
@@ -15953,7 +16096,11 @@
                },
                "sourceType": {
                    "description": "来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单)",
                    "type": "integer"
                    "allOf": [
                        {
                            "$ref": "#/definitions/constvar.ReceiptSourceType"
                        }
                    ]
                }
            }
        },
@@ -16468,6 +16615,18 @@
                    "description": "金额",
                    "type": "number"
                },
                "amountReceivable": {
                    "description": "应收金额",
                    "type": "number"
                },
                "amountReceived": {
                    "description": "已收金额",
                    "type": "number"
                },
                "amountTotal": {
                    "description": "总额",
                    "type": "number"
                },
                "collectionDate": {
                    "description": "计划收款日期",
                    "type": "string"
@@ -16505,10 +16664,14 @@
                },
                "sourceType": {
                    "description": "源单类型(1销售明细2服务合同3销售发票)",
                    "type": "integer"
                    "allOf": [
                        {
                            "$ref": "#/definitions/constvar.CollectionSourceType"
                        }
                    ]
                },
                "status": {
                    "description": "状态(1未收2已收)",
                    "description": "状态(1未收2部分已收3已收)",
                    "allOf": [
                        {
                            "$ref": "#/definitions/constvar.CollectionStatus"
docs/swagger.yaml
@@ -11,16 +11,30 @@
    type: string
    x-enum-varnames:
    - BankAccountQueryClassExpireLessThen60Days
  constvar.CollectionStatus:
  constvar.CollectionSourceType:
    enum:
    - 1
    - 2
    type: integer
    x-enum-comments:
      CollectionSourceTypeSaleDetails: 销售明细
      CollectionSourceTypeServiceContract: 服务合同
    x-enum-varnames:
    - CollectionSourceTypeSaleDetails
    - CollectionSourceTypeServiceContract
  constvar.CollectionStatus:
    enum:
    - 1
    - 2
    - 3
    type: integer
    x-enum-comments:
      CollectionStatusCollected: 已收款
      CollectionStatusSubCollected: 部分收款
      CollectionStatusUnCollected: 待收款
    x-enum-varnames:
    - CollectionStatusUnCollected
    - CollectionStatusSubCollected
    - CollectionStatusCollected
  constvar.CourierCompanyKeywordType:
    enum:
@@ -114,6 +128,20 @@
    type: string
    x-enum-varnames:
    - ReceiptQueryClassExpireLessThen60Days
  constvar.ReceiptSourceType:
    enum:
    - 1
    - 2
    - 3
    - 4
    - 5
    type: integer
    x-enum-varnames:
    - ReceiptSourceTypeSalesDetails
    - ReceiptSourceTypeServiceContract
    - ReceiptSourceTypeInvoice
    - ReceiptSourceTypeCollectionPlan
    - ReceiptSourceTypeChuKuDan
  constvar.SalesDetailsKeywordType:
    enum:
    - 客户名称
@@ -128,6 +156,14 @@
    - SalesDetailsKeywordTypeSignTime
    - SalesDetailsKeywordTypePrincipal
    - SalesDetailsKeywordTypeProductName
  constvar.SalesReturnSourceType:
    enum:
    - 1
    type: integer
    x-enum-comments:
      SalesReturnSourceTypeSaleDetails: 销售明细
    x-enum-varnames:
    - SalesReturnSourceTypeSaleDetails
  constvar.SalesStatus:
    enum:
    - 0
@@ -965,7 +1001,7 @@
    properties:
      amount:
        description: 收款金额
        type: string
        type: number
      bankAccountId:
        description: 账户id
        type: integer
@@ -996,8 +1032,9 @@
        description: 源单id
        type: integer
      sourceType:
        allOf:
        - $ref: '#/definitions/constvar.ReceiptSourceType'
        description: 来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单)
        type: integer
    type: object
  model.RefundMethod:
    properties:
@@ -1142,6 +1179,8 @@
    type: object
  model.SalesDetails:
    properties:
      Member:
        $ref: '#/definitions/model.User'
      address:
        type: string
      addressee:
@@ -1155,6 +1194,9 @@
      amountReceived:
        description: 已收金额
        type: number
      amountTotal:
        description: 价税合计
        type: number
      amountUnInvoiced:
        description: 未开票金额
        type: number
@@ -1163,6 +1205,12 @@
      clientId:
        type: integer
      conditions:
        type: string
      createTime:
        type: string
      creatorId:
        type: integer
      creatorName:
        type: string
      deliveryDate:
        type: string
@@ -1271,8 +1319,20 @@
    type: object
  model.SalesReturn:
    properties:
      Member:
        $ref: '#/definitions/model.User'
      SalesReturnStatus:
        allOf:
        - $ref: '#/definitions/model.SalesReturnStatus'
        description: 退货状态
      client:
        $ref: '#/definitions/model.Client'
      clientId:
        type: integer
      createTime:
        type: string
      creatorName:
        type: string
      id:
        type: integer
      memberId:
@@ -1280,17 +1340,28 @@
      number:
        type: string
      products:
        description: 退货产品
        items:
          $ref: '#/definitions/model.Product'
        type: array
      reason:
        description: 退货原因
        type: string
      repository:
        type: string
      returnDate:
        description: 退货日期
        type: string
      salesReturnStatus:
      salesReturnStatusId:
        description: 退货状态id
        type: integer
      sourceId:
        description: 源单id
        type: integer
      sourceType:
        allOf:
        - $ref: '#/definitions/constvar.SalesReturnSourceType'
        description: 源单类型(1销售明细)
    type: object
  model.SalesReturnStatus:
    properties:
@@ -1317,6 +1388,15 @@
    properties:
      amount:
        description: 金额
        type: number
      amountReceivable:
        description: 应收金额
        type: number
      amountReceived:
        description: 已收金额
        type: number
      amountTotal:
        description: 总额
        type: number
      collectionDate:
        description: 计划收款日期
@@ -1345,12 +1425,13 @@
        description: 源单id
        type: integer
      sourceType:
        allOf:
        - $ref: '#/definitions/constvar.CollectionSourceType'
        description: 源单类型(1销售明细2服务合同3销售发票)
        type: integer
      status:
        allOf:
        - $ref: '#/definitions/constvar.CollectionStatus'
        description: 状态(1未收2已收)
        description: 状态(1未收2部分已收3已收)
      term:
        description: 期次
        type: integer
@@ -1367,6 +1448,9 @@
        type: number
      amountReceived:
        description: 已收金额
        type: number
      amountTotal:
        description: 价税合计
        type: number
      amountUnInvoiced:
        description: 未开票金额
@@ -1585,6 +1669,9 @@
        type: string
      serviceOrderStatus:
        $ref: '#/definitions/model.ServiceOrderStatus'
      serviceOrderStatusId:
        description: 处理状态
        type: integer
      serviceType:
        $ref: '#/definitions/model.ServiceType'
      serviceTypeId:
@@ -1598,9 +1685,6 @@
      solutionRemark:
        description: 内部备注
        type: string
      status:
        description: 处理状态
        type: integer
      subject:
        description: 主题
        type: string
@@ -2198,7 +2282,7 @@
    properties:
      amount:
        description: 收款金额
        type: string
        type: number
      bankAccountId:
        description: 账户id
        type: integer
@@ -2229,8 +2313,9 @@
        description: 源单id
        type: integer
      sourceType:
        allOf:
        - $ref: '#/definitions/constvar.ReceiptSourceType'
        description: 来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单)
        type: integer
    type: object
  request.AddRefundMethod:
    properties:
@@ -3427,17 +3512,28 @@
      number:
        type: string
      products:
        description: 退货产品
        items:
          $ref: '#/definitions/model.Product'
        type: array
      reason:
        description: 退货原因
        type: string
      repository:
        type: string
      returnDate:
        description: 退货日期
        type: string
      status:
      salesReturnStatusId:
        description: 退货状态id
        type: integer
      sourceId:
        description: 源单id
        type: integer
      sourceType:
        allOf:
        - $ref: '#/definitions/constvar.SalesReturnSourceType'
        description: 源单类型(1销售明细)
    type: object
  request.SetAuthorityMenu:
    properties:
@@ -4148,7 +4244,7 @@
    properties:
      amount:
        description: 收款金额
        type: string
        type: number
      bankAccountId:
        description: 账户id
        type: integer
@@ -4179,8 +4275,9 @@
        description: 源单id
        type: integer
      sourceType:
        allOf:
        - $ref: '#/definitions/constvar.ReceiptSourceType'
        description: 来源类型(1销售明细单2服务合同3销售发票4收款计划5出库单)
        type: integer
    type: object
  request.UpdateRefundMethod:
    properties:
@@ -4521,6 +4618,15 @@
      amount:
        description: 金额
        type: number
      amountReceivable:
        description: 应收金额
        type: number
      amountReceived:
        description: 已收金额
        type: number
      amountTotal:
        description: 总额
        type: number
      collectionDate:
        description: 计划收款日期
        type: string
@@ -4548,12 +4654,13 @@
        description: 源单id
        type: integer
      sourceType:
        allOf:
        - $ref: '#/definitions/constvar.CollectionSourceType'
        description: 源单类型(1销售明细2服务合同3销售发票)
        type: integer
      status:
        allOf:
        - $ref: '#/definitions/constvar.CollectionStatus'
        description: 状态(1未收2已收)
        description: 状态(1未收2部分已收3已收)
      term:
        description: 期次
        type: integer
model/model.go
New file
@@ -0,0 +1,20 @@
package model
import (
    "gorm.io/gorm"
    "time"
)
type CrmModel struct {
    gorm.Model  `json:"-"`
    CreatorId   int       `json:"-" gorm:"column:creator_id;type:int;comment:创建人id"`
    Creator     User      `json:"-"  gorm:"foreignKey:CreatorId"`
    CreateTime  time.Time `json:"createTime"  gorm:"-"`
    CreatorName string    `json:"creatorName" gorm:"-"`
}
func (slf *CrmModel) AfterFind(tx *gorm.DB) (err error) {
    slf.CreatorName = slf.Creator.Username
    slf.CreateTime = slf.CreatedAt
    return nil
}
model/request/salesReturn.go
@@ -1,20 +1,27 @@
package request
import "aps_crm/model"
import (
    "aps_crm/constvar"
    "aps_crm/model"
)
type AddSalesReturnRequest struct {
    SalesReturn SalesReturn
}
type SalesReturn struct {
    ClientId   int             `json:"clientId" gorm:"column:client_id;type:int;comment:客户id"`
    Number     string          `json:"number" gorm:"column:number;type:varchar(255);comment:退货单号"`
    Repository string          `json:"repository" gorm:"column:repository;type:varchar(255);comment:仓库"`
    MemberId   int             `json:"memberId" gorm:"column:member_id;type:int;comment:负责人id"`
    ReturnDate string          `json:"returnDate" gorm:"column:return_date;type:datetime;comment:退货日期"`
    Status     int             `json:"status" gorm:"column:status;type:int;comment:退货状态"`
    Reason     string          `json:"reason" gorm:"column:reason;type:varchar(255);comment:退货原因"`
    Products   []model.Product `json:"products" gorm:"many2many:salesReturn_product;"`
    ClientId            int                            `json:"clientId" gorm:"column:client_id;type:int;comment:客户id"`
    SourceType          constvar.SalesReturnSourceType `gorm:"source_type" json:"sourceType"` // 源单类型(1销售明细)
    SourceId            int                            `gorm:"source_id" json:"sourceId"`     // 源单id
    Number              string                         `json:"number" gorm:"column:number;type:varchar(255);comment:退货单号"`
    Repository          string                         `json:"repository" gorm:"column:repository;type:varchar(255);comment:仓库"`
    MemberId            int                            `json:"memberId" gorm:"column:member_id;type:int;comment:负责人id"`
    ReturnDate          string                         `json:"returnDate" gorm:"column:return_date;type:datetime(3);comment:退货日期"`          //退货日期
    SalesReturnStatusId int                            `json:"salesReturnStatusId" gorm:"column:sales_return_status;type:int;comment:退货状态"` //退货状态id
    CreatorId           int                            `json:"-" gorm:"column:creator_id;type:int;comment:创建人id"`                           //创建人ID
    Creator             User                           `json:"-"  gorm:"foreignKey:CreatorId"`                                              //创建人信息
    Reason              string                         `json:"reason" gorm:"column:reason;type:varchar(255);comment:退货原因"`                  //退货原因
    Products            []*model.Product               `json:"products" gorm:"many2many:salesReturn_product;"`                              //退货产品
}
type UpdateSalesReturnRequest struct {
model/salesDetails.go
@@ -20,6 +20,7 @@
        SaleType            int               `json:"saleType" gorm:"column:sale_type;type:int;comment:销售类型"`
        SignTime            string            `json:"signTime" gorm:"column:sign_time;type:varchar(255);comment:签单时间"`
        MemberId            int               `json:"memberId" gorm:"column:member_id;type:int;comment:负责人id"`
        Member              User              `json:"Member"  gorm:"foreignKey:MemberId"`
        DeliveryDate        string            `json:"deliveryDate" gorm:"column:delivery_date;type:varchar(255);comment:交货日期"`
        WechatOrderStatusId int               `json:"wechatOrderStatusId" gorm:"column:wechat_order_status;type:int;comment:微信订单状态"`
        WechatOrderStatus   WechatOrderStatus `json:"wechatOrderStatus" gorm:"foreignKey:WechatOrderStatusId"`
@@ -27,6 +28,7 @@
        Phone               string            `json:"phone" gorm:"column:phone;type:varchar(255);comment:电话"`
        Addressee           string            `json:"addressee" gorm:"column:addressee;type:varchar(255);comment:收件人"`
        Conditions          string            `json:"conditions" gorm:"column:conditions;type:text;comment:条件"`
        CreatorId           int               `json:"creatorId" gorm:"column:creator_id;type:int;comment:创建人id"`
        Remark              string            `json:"remark" gorm:"column:remark;type:text;comment:备注"`
        Products            []*Product        `json:"products" gorm:"many2many:sales_details_product;"`
        LogisticCompany     string            `json:"logisticCompany" gorm:"column:logistic_company;type:varchar(255);comment:物流公司"`
@@ -37,7 +39,7 @@
        AmountInvoiced      decimal.Decimal   `gorm:"column:amount_invoiced;type:decimal(12,2);comment:已开票金额" json:"amountInvoiced"`       // 已开票金额
        AmountUnInvoiced    decimal.Decimal   `gorm:"column:amount_not_invoiced;type:decimal(12,2);comment:未开票金额" json:"amountUnInvoiced"` // 未开票金额
        AmountTotal         decimal.Decimal   `gorm:"column:amount_total;type:decimal(12,2);comment:价税合计" json:"amountTotal"`              // 价税合计
        gorm.Model          `json:"-"`
        CrmModel
    }
    SalesDetailsSearch struct {
model/salesReturn.go
@@ -1,22 +1,30 @@
package model
import (
    "aps_crm/constvar"
    "aps_crm/pkg/mysqlx"
    "gorm.io/gorm"
    "time"
)
type (
    SalesReturn struct {
        Id                int       `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
        ClientId          int       `json:"clientId" gorm:"column:client_id;type:int;comment:客户id"`
        Number            string    `json:"number" gorm:"column:number;type:varchar(255);comment:退货单号"`
        Repository        string    `json:"repository" gorm:"column:repository;type:varchar(255);comment:仓库"`
        MemberId          int       `json:"memberId" gorm:"column:member_id;type:int;comment:负责人id"`
        ReturnDate        time.Time `json:"returnDate" gorm:"column:return_date;type:datetime;comment:退货日期"`
        SalesReturnStatus int       `json:"salesReturnStatus" gorm:"column:sales_return_status;type:int;comment:退货状态"`
        Reason            string    `json:"reason" gorm:"column:reason;type:varchar(255);comment:退货原因"`
        Products          []Product `json:"products" gorm:"many2many:salesReturn_product;"`
        Id                  int                            `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
        ClientId            int                            `json:"clientId" gorm:"column:client_id;type:int;comment:客户id"`
        Client              Client                         `json:"client" gorm:"foreignKey:ClientId"`
        SourceType          constvar.SalesReturnSourceType `gorm:"source_type" json:"sourceType"` // 源单类型(1销售明细)
        SourceId            int                            `gorm:"source_id" json:"sourceId"`     // 源单id
        Number              string                         `json:"number" gorm:"column:number;type:varchar(255);comment:退货单号"`
        Repository          string                         `json:"repository" gorm:"column:repository;type:varchar(255);comment:仓库"`
        MemberId            int                            `json:"memberId" gorm:"column:member_id;type:int;comment:负责人id"`
        Member              User                           `json:"Member"  gorm:"foreignKey:MemberId"`
        ReturnDate          string                         `json:"returnDate" gorm:"column:return_date;type:datetime(3);comment:退货日期"`          //退货日期
        SalesReturnStatusId int                            `json:"salesReturnStatusId" gorm:"column:sales_return_status;type:int;comment:退货状态"` //退货状态id
        SalesReturnStatus   SalesReturnStatus              `json:"SalesReturnStatus" gorm:"foreignKey:SalesReturnStatusId"`                     //退货状态
        CreatorId           int                            `json:"-" gorm:"column:creator_id;type:int;comment:创建人id"`                           //创建人ID
        Creator             User                           `json:"-"  gorm:"foreignKey:CreatorId"`                                              //创建人信息
        Reason              string                         `json:"reason" gorm:"column:reason;type:varchar(255);comment:退货原因"`                  //退货原因
        Products            []*Product                     `json:"products" gorm:"many2many:salesReturn_product;"`                              //退货产品
        CrmModel
    }
    SalesReturnSearch struct {
@@ -30,10 +38,9 @@
    }
)
func (SalesReturn) TableName() string {
func (*SalesReturn) TableName() string {
    return "sales_return"
}
func NewSalesReturnSearch() *SalesReturnSearch {
    return &SalesReturnSearch{
        Orm: mysqlx.GetDB(),
@@ -107,4 +114,4 @@
func (slf *SalesReturnSearch) SetOrder(order string) *SalesReturnSearch {
    slf.OrderBy = order
    return slf
}
}
model/salesReturnStatus.go
@@ -6,12 +6,12 @@
)
type (
    // SalesReturnStatus 商机阶段
    // SalesReturnStatus 退货状态
    SalesReturnStatus struct {
        Id   int    `json:"id" gorm:"column:id;primary_key;AUTO_INCREMENT"`
        Name string `json:"name" gorm:"column:name;type:varchar(255);comment:商机阶段名称"`
        Name string `json:"name" gorm:"column:name;type:varchar(255);comment:退货状态名称"`
    }
    SalesReturnStatusSearch struct {
        SalesReturnStatus
        Orm *gorm.DB
service/salesReturn.go
@@ -7,7 +7,7 @@
type SalesReturnService struct{}
func (SalesReturnService) AddSalesReturn(salesReturn *model.SalesReturn) int {
func (slf SalesReturnService) AddSalesReturn(salesReturn *model.SalesReturn) int {
    err := model.NewSalesReturnSearch().Create(salesReturn)
    if err != nil {
        return ecode.SalesReturnExist