1.修改第二轮测试相关缺陷;
This commit is contained in:
parent
fcf0f41bcf
commit
7ed3a521c9
3
Makefile
3
Makefile
|
@ -23,3 +23,6 @@ dev-windows:
|
|||
dev:
|
||||
GOOS=linux GOARCH=amd64 go build -o dev_mh_goadmin_server main.go
|
||||
|
||||
|
||||
beta:
|
||||
GOOS=linux GOARCH=amd64 go build -o test_mh_goadmin_server main.go
|
||||
|
|
|
@ -307,7 +307,7 @@ func CategoryImport(c *gin.Context) {
|
|||
colsMap = colsMap[1:]
|
||||
}
|
||||
|
||||
err = models.ImportCategoryData(colsMap, (middleware.GetCooperativeBusinessId(c)))
|
||||
err = models.ImportCategoryData(colsMap, middleware.GetCooperativeBusinessId(c))
|
||||
if err != nil {
|
||||
//logger.Error("file excel reader err:", err)
|
||||
app.Error(c, http.StatusInternalServerError, err, err.Error())
|
||||
|
|
|
@ -20,10 +20,10 @@ type CommodityCreateRequest struct {
|
|||
ErpBarcode string `json:"erp_barcode"` // 商品条码
|
||||
IMEIType uint32 `json:"imei_type"` // 系统生成串码:2-是(系统生成) 3-否(手动添加)
|
||||
ErpSupplierId uint32 `json:"erp_supplier_id" binding:"required"` // 主供应商
|
||||
RetailPrice uint32 `json:"retail_price" binding:"required"` // 指导零售价
|
||||
MinRetailPrice uint32 `json:"min_retail_price" binding:"required"` // 最低零售价
|
||||
StaffCostPrice uint32 `json:"staff_cost_price" binding:"required"` // 员工成本价加价
|
||||
WholesalePrice uint32 `json:"wholesale_price" binding:"required"` // 指导采购价
|
||||
RetailPrice uint32 `json:"retail_price"` // 指导零售价
|
||||
MinRetailPrice uint32 `json:"min_retail_price"` // 最低零售价
|
||||
StaffCostPrice uint32 `json:"staff_cost_price"` // 员工成本价加价
|
||||
WholesalePrice uint32 `json:"wholesale_price"` // 指导采购价
|
||||
Brokerage1 float64 `json:"brokerage_1"` // 销售毛利提成
|
||||
Brokerage2 float64 `json:"brokerage_2"` // 员工毛利提成
|
||||
MemberDiscount float64 `json:"member_discount"` // 会员优惠
|
||||
|
@ -110,13 +110,14 @@ func CommodityCreate(c *gin.Context) {
|
|||
ErpSupplierName: "",
|
||||
RetailPrice: req.RetailPrice,
|
||||
MinRetailPrice: req.MinRetailPrice,
|
||||
StaffCostPrice: req.StaffCostPrice + req.WholesalePrice,
|
||||
WholesalePrice: req.WholesalePrice,
|
||||
Brokerage1: brokerage1Float,
|
||||
Brokerage2: brokerage2Float,
|
||||
MemberDiscount: memberDiscountFloat,
|
||||
Origin: req.Origin,
|
||||
Remark: req.Remark,
|
||||
//StaffCostPrice: req.StaffCostPrice + req.WholesalePrice,
|
||||
StaffCostPrice: req.StaffCostPrice,
|
||||
WholesalePrice: req.WholesalePrice,
|
||||
Brokerage1: brokerage1Float,
|
||||
Brokerage2: brokerage2Float,
|
||||
MemberDiscount: memberDiscountFloat,
|
||||
Origin: req.Origin,
|
||||
Remark: req.Remark,
|
||||
}
|
||||
err = commodity.SetErpCategory()
|
||||
if err != nil {
|
||||
|
@ -217,6 +218,16 @@ func CommodityDetail(c *gin.Context) {
|
|||
commodity.IsIMEI = 1 // 串码
|
||||
}
|
||||
|
||||
// 查询是否有库存
|
||||
var count int64
|
||||
err = orm.Eloquent.Table("erp_stock_commodity").Where("erp_commodity_id = ? and state = ?",
|
||||
commodity.ID, models.InStock).Count(&count).Error
|
||||
if err != nil {
|
||||
app.Error(c, http.StatusInternalServerError, err, "获取商品库存信息失败")
|
||||
return
|
||||
}
|
||||
commodity.StockCount = uint32(count)
|
||||
|
||||
app.OK(c, commodity, "")
|
||||
return
|
||||
}
|
||||
|
@ -226,12 +237,13 @@ type CommodityEditRequest struct {
|
|||
Name string `json:"name" binding:"required"` // 商品名称
|
||||
ErpCategoryId uint32 `json:"erp_category_id" binding:"required"` // 商品分类id
|
||||
ErpBarcode string `json:"erp_barcode"` // 商品条码
|
||||
IsIMEI uint32 `json:"is_imei" binding:"required"` // 是否串码:1-串码类 2-非串码
|
||||
IMEIType uint32 `json:"imei_type" binding:"required"` // 1-无串码 2-串码(系统生成) 3-串码(手动添加)
|
||||
ErpSupplierId uint32 `json:"erp_supplier_id" binding:"required"` // 主供应商id
|
||||
RetailPrice uint32 `json:"retail_price" binding:"required"` // 指导零售价
|
||||
MinRetailPrice uint32 `json:"min_retail_price" binding:"required"` // 最低零售价
|
||||
StaffCostPrice uint32 `json:"staff_cost_price" binding:"required"` // 员工成本价加价
|
||||
WholesalePrice uint32 `json:"wholesale_price" binding:"required"` // 指导采购价
|
||||
RetailPrice uint32 `json:"retail_price"` // 指导零售价
|
||||
MinRetailPrice uint32 `json:"min_retail_price"` // 最低零售价
|
||||
StaffCostPrice uint32 `json:"staff_cost_price"` // 员工成本价加价
|
||||
WholesalePrice uint32 `json:"wholesale_price"` // 指导采购价
|
||||
Brokerage1 float64 `json:"brokerage_1"` // 销售毛利提成
|
||||
Brokerage2 float64 `json:"brokerage_2"` // 员工毛利提成
|
||||
MemberDiscount float64 `json:"member_discount"` // 会员优惠
|
||||
|
@ -285,13 +297,14 @@ func CommodityEdit(c *gin.Context) {
|
|||
ErpSupplierName: "",
|
||||
RetailPrice: req.RetailPrice,
|
||||
MinRetailPrice: req.MinRetailPrice,
|
||||
StaffCostPrice: req.StaffCostPrice + req.WholesalePrice,
|
||||
WholesalePrice: req.WholesalePrice,
|
||||
Brokerage1: brokerage1Float,
|
||||
Brokerage2: brokerage2Float,
|
||||
MemberDiscount: memberDiscountFloat,
|
||||
Origin: req.Origin,
|
||||
Remark: req.Remark,
|
||||
//StaffCostPrice: req.StaffCostPrice + req.WholesalePrice,
|
||||
StaffCostPrice: req.StaffCostPrice,
|
||||
WholesalePrice: req.WholesalePrice,
|
||||
Brokerage1: brokerage1Float,
|
||||
Brokerage2: brokerage2Float,
|
||||
MemberDiscount: memberDiscountFloat,
|
||||
Origin: req.Origin,
|
||||
Remark: req.Remark,
|
||||
}
|
||||
commodity.ID = req.Id
|
||||
err = commodity.SetErpCategory()
|
||||
|
@ -312,6 +325,50 @@ func CommodityEdit(c *gin.Context) {
|
|||
commodity.Number = catCommodity.Number
|
||||
commodity.SerialNumber = catCommodity.SerialNumber
|
||||
|
||||
if commodity.ErpCategory != nil && commodity.ErpCategory.ID != 0 {
|
||||
if commodity.ErpCategory.ID != catCommodity.ErpCategoryId { // 编辑时更换了分类ID
|
||||
commodity.ErpCategoryId = commodity.ErpCategory.ID
|
||||
commodity.ErpCategoryName = commodity.ErpCategory.Name
|
||||
commodity.SerialNumber, err = models.GenerateSerialNumber(commodity.ErpCategoryId) // 更新商品编号
|
||||
if err != nil {
|
||||
app.Error(c, http.StatusInternalServerError, err, err.Error())
|
||||
return
|
||||
}
|
||||
} else {
|
||||
commodity.ErpCategory = nil
|
||||
}
|
||||
}
|
||||
|
||||
if req.IsIMEI == 2 { // 是否串码:1-串码类 2-非串码
|
||||
commodity.IMEIType = 1 // 系统生成串码:2-是(系统生成) 3-否(手动添加) 1表示非串码
|
||||
}
|
||||
|
||||
var sysIsIMEI uint32
|
||||
switch catCommodity.IMEIType {
|
||||
case 1:
|
||||
sysIsIMEI = 2 // 非串码
|
||||
case 2:
|
||||
fallthrough
|
||||
case 3:
|
||||
sysIsIMEI = 1 // 串码
|
||||
}
|
||||
|
||||
if req.IsIMEI != sysIsIMEI {
|
||||
// 查询是否有库存
|
||||
var count int64
|
||||
err = orm.Eloquent.Table("erp_stock_commodity").Where("erp_commodity_id = ? and state = ?",
|
||||
commodity.ID, models.InStock).Count(&count).Error
|
||||
if err != nil {
|
||||
app.Error(c, http.StatusInternalServerError, err, "获取商品库存信息失败")
|
||||
return
|
||||
}
|
||||
|
||||
if count > 0 {
|
||||
app.Error(c, http.StatusInternalServerError, err, "该商品已有库存,不能修改串码/非串码选项")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
begin := orm.Eloquent.Begin()
|
||||
err = begin.Save(commodity).Error
|
||||
if err != nil {
|
||||
|
@ -320,8 +377,8 @@ func CommodityEdit(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
// 同步更新库存表和库存商品表的"指导零售价"和"最低零售价";库存商品表的"商品条码"
|
||||
err = models.UpdateErpStockAmountInfo(begin, req.Id, req.RetailPrice, req.MinRetailPrice, barCode)
|
||||
// 同步更新库存表和库存商品表的"指导零售价"和"最低零售价"、"分类id"、"分类名称";库存商品表的"商品条码"
|
||||
err = models.UpdateErpStockAmountInfo(begin, req.Id, req.RetailPrice, req.MinRetailPrice, barCode, commodity.ErpCategory)
|
||||
if err != nil {
|
||||
begin.Rollback()
|
||||
logger.Error("UpdateErpStockAmountInfo err:", logger.Field("err", err))
|
||||
|
|
|
@ -185,7 +185,16 @@ func ErpOrderAudit(c *gin.Context) {
|
|||
stockState = model.OnSale // 库存-销售锁定
|
||||
case 2: // 取消审核
|
||||
orderState = model.ErpOrderStateUnAudit
|
||||
stockState = model.InStock // 库存-在库
|
||||
stockState = model.InStock // 库存-在库
|
||||
if erpOrder.RetailType == model.RetailTypeRejected { // 退货单反审核
|
||||
if erpOrder.State == model.ErpOrderStateUnAudit {
|
||||
app.OK(c, nil, "")
|
||||
return
|
||||
}
|
||||
|
||||
erpOrder.RetailType = model.RetailTypeSale // 订单改为销售,方便后面流程更新库存
|
||||
stockState = model.SoldOut // 状态为已售
|
||||
}
|
||||
default:
|
||||
logger.Error("req.State no in (1,2)", logger.Field("req.State", req.State))
|
||||
app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误,req.State no in (1,2)")
|
||||
|
@ -193,14 +202,15 @@ func ErpOrderAudit(c *gin.Context) {
|
|||
}
|
||||
|
||||
nPayStatus := model.NoCreatePayOrder
|
||||
if req.State == 1 { // 审核
|
||||
// 检查支付方式,如果没有线上支付则默认为支付已完成
|
||||
nPayStatus = model.WaitForPaying // 待支付
|
||||
if req.State == 1 && erpOrder.RetailType == model.RetailTypeSale { // 审核:销售订单才更新支付状态,退货订单不用更新
|
||||
var cashiers []model.ErpOrderCashier
|
||||
err = json.Unmarshal([]byte(erpOrder.CashierList), &cashiers)
|
||||
if err != nil {
|
||||
logger.Error("unmarshal CashierList err:", logger.Field("err", err))
|
||||
}
|
||||
|
||||
nPayStatus = model.WaitForPaying // 待支付
|
||||
// 检查支付方式,如果没有线上支付则默认为支付已完成
|
||||
if !model.CheckIsOnlinePay(cashiers) {
|
||||
nPayStatus = model.HavePaid // 已完成
|
||||
stockState = model.SoldOut // 库存-已售
|
||||
|
|
|
@ -9,6 +9,7 @@ import (
|
|||
"go-admin/logger"
|
||||
"go-admin/tools"
|
||||
"go-admin/tools/app"
|
||||
"math"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
@ -215,11 +216,26 @@ func ErpPurchaseDetail(c *gin.Context) {
|
|||
app.Error(c, http.StatusBadRequest, err, "获取失败")
|
||||
return
|
||||
}
|
||||
|
||||
v.ExecutionCount = result.TotalCount
|
||||
v.ExecutionAmount = result.TotalAmount
|
||||
v.ExecutionEmployeePrice = result.AvgEmployeePrice
|
||||
v.ExecutionPrice = result.AvgImplementationPrice
|
||||
|
||||
v.ExecutionAmount = math.Round(v.ExecutionAmount*100) / 100
|
||||
v.ExecutionEmployeePrice = math.Round(v.ExecutionEmployeePrice*100) / 100
|
||||
v.ExecutionPrice = math.Round(v.ExecutionPrice*100) / 100
|
||||
|
||||
// 查询入库商品实际库存详情处剩余有效数,不包含已出库的数量
|
||||
nCount, err := model.GetCommodityStockByPurchaseId(purchaseOrder.SerialNumber, v.ErpCommodityId)
|
||||
if err != nil {
|
||||
logger.Error("ErpPurchaseDetail GetCommodityStockByPurchaseId err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusBadRequest, err, "获取失败")
|
||||
return
|
||||
}
|
||||
v.EffectiveCount = nCount // 有效数量
|
||||
v.ErpCategoryID = erpCommodity.ErpCategoryId
|
||||
v.ErpCategoryName = erpCommodity.ErpCategoryName
|
||||
|
||||
commodityList = append(commodityList, v)
|
||||
}
|
||||
|
||||
|
@ -271,6 +287,7 @@ func ErpPurchaseAudit(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
begin := orm.Eloquent.Begin()
|
||||
// 判断入参state:1-审核,2-取消审核
|
||||
orderState := 0
|
||||
switch req.State {
|
||||
|
@ -289,16 +306,23 @@ func ErpPurchaseAudit(c *gin.Context) {
|
|||
app.OK(c, nil, "订单已审核")
|
||||
return
|
||||
}
|
||||
case 2: // 2-取消审核:2/3可以取消审核
|
||||
if erpPurchaseOrder.State == model.ErpPurchaseOrderWaitInventory || erpPurchaseOrder.State == model.ErpPurchaseOrderWaitReject {
|
||||
orderState = model.ErpPurchaseOrderUnAudit
|
||||
} else if erpPurchaseOrder.State == model.ErpPurchaseOrderUnAudit {
|
||||
case 2: // 2-取消审核:5-已终止不能取消,2/3/4其他正常取消,取消后对应的退库或入库
|
||||
if erpPurchaseOrder.State == model.ErpPurchaseOrderUnAudit {
|
||||
app.OK(c, nil, "订单已取消审核")
|
||||
return
|
||||
} else {
|
||||
} else if erpPurchaseOrder.State == model.ErpPurchaseOrderEnd {
|
||||
logger.Error("order err, erpPurchaseOrder.State is:", logger.Field("erpPurchaseOrder.State", erpPurchaseOrder.State))
|
||||
app.Error(c, http.StatusInternalServerError, err, "取消审核失败:[入库/退货中、已终止、已完成]订单不能取消")
|
||||
app.Error(c, http.StatusInternalServerError, err, "取消审核失败:[已终止]订单不能取消")
|
||||
return
|
||||
} else {
|
||||
orderState = model.ErpPurchaseOrderUnAudit
|
||||
// 更新库存信息
|
||||
err = model.CancelAuditUpdateStock(begin, erpPurchaseOrder)
|
||||
if err != nil {
|
||||
begin.Rollback()
|
||||
app.Error(c, http.StatusInternalServerError, err, "审核失败:"+err.Error())
|
||||
return
|
||||
}
|
||||
}
|
||||
default:
|
||||
logger.Error("order err, req.State is:", logger.Field("req.State", req.State))
|
||||
|
@ -306,7 +330,6 @@ func ErpPurchaseAudit(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
begin := orm.Eloquent.Begin()
|
||||
err = begin.Table("erp_purchase_order").Where("id = ?", erpPurchaseOrder.ID).Updates(map[string]interface{}{
|
||||
"state": orderState,
|
||||
"auditor_id": sysUser.UserId,
|
||||
|
@ -451,6 +474,16 @@ func ErpPurchaseInventory(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
if req.PurchaseType == model.ErpProcureOrder {
|
||||
if req.InventoryId == 0 {
|
||||
app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误,入库人id为0")
|
||||
return
|
||||
} else if req.InventoryName == "" {
|
||||
app.Error(c, http.StatusBadRequest, errors.New("para err"), "参数错误,入库人姓名为空")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
err := model.InventoryErpPurchase(req)
|
||||
if err != nil {
|
||||
logger.Error("InventoryErpPurchase err:", logger.Field("err", err))
|
||||
|
@ -504,9 +537,16 @@ func ErpPurchaseTerminate(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
updateRemark := ""
|
||||
if erpPurchaseOrder.Remark != "" {
|
||||
updateRemark = erpPurchaseOrder.Remark + "," + req.Remark
|
||||
} else {
|
||||
updateRemark = req.Remark
|
||||
}
|
||||
|
||||
err = orm.Eloquent.Table("erp_purchase_order").Where("id = ?", erpPurchaseOrder.ID).Updates(map[string]interface{}{
|
||||
"state": orderState,
|
||||
"remark": req.Remark,
|
||||
"remark": updateRemark,
|
||||
}).Error
|
||||
if err != nil {
|
||||
logger.Error("update erp_purchase_order err:", logger.Field("err", err))
|
||||
|
@ -689,6 +729,7 @@ func ErpPurchaseReportByCommodity(c *gin.Context) {
|
|||
app.Error(c, http.StatusInternalServerError, err, "查询失败:"+err.Error())
|
||||
return
|
||||
}
|
||||
fmt.Println(resp)
|
||||
|
||||
app.OK(c, resp, "查询成功")
|
||||
return
|
||||
|
|
|
@ -6,18 +6,26 @@ import (
|
|||
"github.com/gin-gonic/gin/binding"
|
||||
"github.com/google/uuid"
|
||||
"go-admin/app/admin/models"
|
||||
orm "go-admin/common/global"
|
||||
"go-admin/logger"
|
||||
"go-admin/tools"
|
||||
"go-admin/tools/app"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// GetSysUserList
|
||||
// @Summary 列表用户信息数据(update)
|
||||
// @Description 获取JSON
|
||||
// @Tags system/用户
|
||||
// @Param username query string false "username"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "抱歉未找到相关信息"}"
|
||||
// @Param username query string false "用户名称"
|
||||
// @Param status query int false "状态:0-正常,1-停用"
|
||||
// @Param phone query string false "手机号"
|
||||
// @Param pageIndex query string false "页码"
|
||||
// @Param pageSize query string false "页面条数"
|
||||
// @Param roleId query string false "角色id"
|
||||
// @Param nickName query string false "昵称"
|
||||
// @Param storeId query string false "门店id"
|
||||
// @Success 200 {object} models.SysUserListResp
|
||||
// @Router /api/v1/sysUserList [get]
|
||||
// @Security Bearer
|
||||
func GetSysUserList(c *gin.Context) {
|
||||
|
@ -36,9 +44,18 @@ func GetSysUserList(c *gin.Context) {
|
|||
pageIndex, err = tools.StringToInt(index)
|
||||
}
|
||||
|
||||
data.Username = c.Request.FormValue("username")
|
||||
data.Status = c.Request.FormValue("status")
|
||||
data.Phone = c.Request.FormValue("phone")
|
||||
data.Username = c.Request.FormValue("username") // 用户名称
|
||||
data.Status = c.Request.FormValue("status") // 状态
|
||||
data.Phone = c.Request.FormValue("phone") // 手机号
|
||||
|
||||
strRoleId := c.Request.FormValue("roleId") // 用户角色
|
||||
data.RoleId, _ = tools.StringToInt(strRoleId)
|
||||
|
||||
data.NickName = c.Request.FormValue("nickName") // 用户昵称
|
||||
|
||||
strStoreId := c.Request.FormValue("storeId") // 门店id
|
||||
nStoreId, _ := tools.StringToInt(strStoreId)
|
||||
data.StoreId = uint32(nStoreId)
|
||||
|
||||
postId := c.Request.FormValue("postId")
|
||||
data.PostId, _ = tools.StringToInt(postId)
|
||||
|
@ -53,6 +70,7 @@ func GetSysUserList(c *gin.Context) {
|
|||
app.PageOK(c, result, count, pageIndex, pageSize, "")
|
||||
}
|
||||
|
||||
// GetSysUser
|
||||
// @Summary 获取用户
|
||||
// @Description 获取JSON
|
||||
// @Tags system/用户
|
||||
|
@ -164,6 +182,26 @@ func InsertSysUser(c *gin.Context) {
|
|||
tools.HasError(err, "数据解析失败", 500)
|
||||
}
|
||||
|
||||
// 判断小程序账号ID是否正常
|
||||
if req.Uid != 0 {
|
||||
userInfo, err := models.GetUserInfoByUid(req.Uid)
|
||||
if err != nil {
|
||||
logger.Error("get user info err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusInternalServerError, err, "小程序账号ID有误,请检查")
|
||||
return
|
||||
}
|
||||
// 是否是真实id
|
||||
if userInfo.Uid != req.Uid {
|
||||
app.Error(c, http.StatusInternalServerError, err, "小程序账号ID有误,请检查")
|
||||
return
|
||||
}
|
||||
// 是否已经绑定过账号
|
||||
if userInfo.UserType == 2 {
|
||||
app.Error(c, http.StatusInternalServerError, err, "小程序账号ID重复,请检查")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
sysUser := models.SysUser{
|
||||
SysUserId: req.SysUserId,
|
||||
LoginM: req.LoginM,
|
||||
|
@ -195,9 +233,29 @@ func InsertSysUser(c *gin.Context) {
|
|||
}
|
||||
sysUser.StoreData = string(storeDataJSON)
|
||||
}
|
||||
|
||||
begin := orm.Eloquent.Begin()
|
||||
sysUser.CreateBy = tools.GetUserIdStr(c)
|
||||
id, err := sysUser.Insert()
|
||||
id, err := sysUser.Insert(begin)
|
||||
|
||||
// 如果添加了小程序id,则需要更新user表的user_type字段为2-店员
|
||||
if req.Uid != 0 {
|
||||
err = models.UpdateUserType(begin, req.Uid, 2)
|
||||
if err != nil {
|
||||
begin.Rollback()
|
||||
logger.Error("UpdateUserType err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusInternalServerError, err, "添加失败")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
err = begin.Commit().Error
|
||||
if err != nil {
|
||||
begin.Rollback()
|
||||
logger.Error("commit err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusInternalServerError, err, "添加失败")
|
||||
return
|
||||
}
|
||||
|
||||
tools.HasError(err, "添加失败", 500)
|
||||
app.OK(c, id, "添加成功")
|
||||
}
|
||||
|
@ -223,6 +281,26 @@ func UpdateSysUser(c *gin.Context) {
|
|||
tools.HasError(err, "数据解析失败", 500)
|
||||
}
|
||||
|
||||
// 判断小程序账号ID是否正常
|
||||
if req.Uid != 0 {
|
||||
userInfo, err := models.GetUserInfoByUid(req.Uid)
|
||||
if err != nil {
|
||||
logger.Error("get user info err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusInternalServerError, err, "小程序账号ID有误,请检查")
|
||||
return
|
||||
}
|
||||
// 是否是真实id
|
||||
if userInfo.Uid != req.Uid {
|
||||
app.Error(c, http.StatusInternalServerError, err, "小程序账号ID有误,请检查")
|
||||
return
|
||||
}
|
||||
// 是否已经绑定过账号
|
||||
if userInfo.UserType == 2 {
|
||||
app.Error(c, http.StatusInternalServerError, err, "小程序账号ID重复,请检查")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
data := models.SysUser{
|
||||
SysUserId: req.SysUserId,
|
||||
LoginM: req.LoginM,
|
||||
|
@ -255,9 +333,47 @@ func UpdateSysUser(c *gin.Context) {
|
|||
data.StoreData = string(storeDataJSON)
|
||||
}
|
||||
|
||||
begin := orm.Eloquent.Begin()
|
||||
data.UpdateBy = tools.GetUserIdStr(c)
|
||||
result, err := data.Update(data.UserId)
|
||||
result, err := data.Update(begin, data.UserId)
|
||||
tools.HasError(err, "修改失败", 500)
|
||||
|
||||
// 判断是否修改了uid
|
||||
sysInfo := models.GetUserById(uint32(req.UserId))
|
||||
if sysInfo.Uid == 0 && req.Uid != 0 { // 新增uid,直接更新为2即可
|
||||
err = models.UpdateUserType(begin, req.Uid, 2)
|
||||
} else if sysInfo.Uid != 0 {
|
||||
if sysInfo.Uid != req.Uid {
|
||||
if req.Uid != 0 {
|
||||
// 原uid的状态更新为1
|
||||
err = models.UpdateUserType(begin, sysInfo.Uid, 1)
|
||||
if err != nil {
|
||||
begin.Rollback()
|
||||
logger.Error("UpdateUserType err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusInternalServerError, err, "修改失败")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// 新uid状态更新为2
|
||||
err = models.UpdateUserType(begin, req.Uid, 2)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
begin.Rollback()
|
||||
logger.Error("UpdateUserType err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusInternalServerError, err, "修改失败")
|
||||
return
|
||||
}
|
||||
|
||||
err = begin.Commit().Error
|
||||
if err != nil {
|
||||
begin.Rollback()
|
||||
logger.Error("commit err:", logger.Field("err", err))
|
||||
app.Error(c, http.StatusInternalServerError, err, "修改失败")
|
||||
return
|
||||
}
|
||||
|
||||
app.OK(c, result, "修改成功")
|
||||
}
|
||||
|
||||
|
@ -299,7 +415,7 @@ func InsetSysUserAvatar(c *gin.Context) {
|
|||
sysuser.UserId = tools.GetUserId(c)
|
||||
sysuser.Avatar = "/" + filPath
|
||||
sysuser.UpdateBy = tools.GetUserIdStr(c)
|
||||
sysuser.Update(sysuser.UserId)
|
||||
sysuser.Update(nil, sysuser.UserId)
|
||||
app.OK(c, filPath, "修改成功")
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ type ErpCashierDetail struct {
|
|||
}
|
||||
|
||||
type ErpCashierListResp struct {
|
||||
Total int `json:"count"` // 数据总条数
|
||||
Total int `json:"total"` // 数据总条数
|
||||
PageIndex int `json:"pageIndex"` // 页码
|
||||
PageSize int `json:"pageSize"` // 每页展示条数
|
||||
List []ErpCashier `json:"list"`
|
||||
|
|
|
@ -67,20 +67,21 @@ type ErpStockCommodity struct {
|
|||
StockTime time.Time `json:"stock_time"` // 最近入库时间
|
||||
RetailPrice uint32 `json:"retail_price"` // 指导零售价
|
||||
MinRetailPrice uint32 `json:"min_retail_price"` // 最低零售价
|
||||
StaffCostPrice uint32 `json:"staff_cost_price"` // 员工成本价加价
|
||||
StaffCostPrice uint32 `json:"staff_cost_price"` // 员工成本价加价(如:加价50,不是加价后的价格)
|
||||
WholesalePrice uint32 `json:"wholesale_price"` // 指导采购价
|
||||
MemberDiscount float64 `json:"member_discount"` // 会员优惠
|
||||
State uint32 `json:"state"` // 状态:1-在库 2-已售 3-采购退货 4-调拨中 5-销售锁定中
|
||||
Count uint32 `json:"count"` // 数量
|
||||
StorageType uint32 `json:"storage_type"` // 入库方式:1-系统入库 2-采购入库
|
||||
FirstStockTime time.Time `json:"first_stock_time"` // 首次入库时间
|
||||
StockSn string `json:"stock_sn"` // 库存订单编号
|
||||
StockSn string `json:"stock_sn"` // 库存订单编号(跟采购入库的入库编号关联)
|
||||
OriginalSn string `json:"original_sn" gorm:"index"` // 首次入库订单编号(单据编号)
|
||||
StockStartTime time.Time `json:"stock_start_time" gorm:"-"` // 最近入库开始时间
|
||||
StockEndTime time.Time `json:"stock_end_time" gorm:"-"` // 最近入库结束时间
|
||||
Age uint32 `json:"age" gorm:"-"` // 最近库龄
|
||||
AllAge uint32 `json:"all_age" gorm:"-"` // 总库龄
|
||||
Remark string `json:"remark"` // 备注
|
||||
//ErpOrderCommodityId uint32 `json:"erp_order_commodity_id"` // 零售订单商品表的主键ID(后端使用,前端忽略)
|
||||
//Commodity ErpCommodity `json:"commodity" gorm:"-"`
|
||||
}
|
||||
|
||||
|
@ -101,13 +102,14 @@ type ErpCommodity struct {
|
|||
ErpSupplierName string `json:"erp_supplier_name"` // 主供应商名称
|
||||
RetailPrice uint32 `json:"retail_price"` // 指导零售价
|
||||
MinRetailPrice uint32 `json:"min_retail_price"` // 最低零售价
|
||||
StaffCostPrice uint32 `json:"staff_cost_price"` // 员工成本价加价
|
||||
StaffCostPrice uint32 `json:"staff_cost_price"` // 员工成本价加价(如:加价50,不是加价后的价格)
|
||||
WholesalePrice uint32 `json:"wholesale_price"` // 指导采购价
|
||||
Brokerage1 float64 `json:"brokerage_1"` // 销售毛利提成
|
||||
Brokerage2 float64 `json:"brokerage_2"` // 员工毛利提成
|
||||
MemberDiscount float64 `json:"member_discount"` // 会员优惠
|
||||
Origin string `json:"origin"` // 产地
|
||||
Remark string `json:"remark" gorm:"type:varchar(512)"` // 备注
|
||||
StockCount uint32 `json:"stock_count" gorm:"-"` // 库存数量
|
||||
|
||||
ErpCategory *ErpCategory `json:"erp_category" gorm:"-"`
|
||||
}
|
||||
|
@ -317,7 +319,11 @@ func (m *ErpCommodityListReq) List() (*ErpCommodityListResp, error) {
|
|||
qs = qs.Where("imei=?", m.IMEI)
|
||||
}
|
||||
if m.ErpCategoryId != 0 {
|
||||
qs = qs.Where("erp_category_id=?", m.ErpCategoryId)
|
||||
categoryInfo, err := GetErpCategory(m.ErpCategoryId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
qs = qs.Where("serial_number like ?", categoryInfo.Number+"%")
|
||||
}
|
||||
if m.ErpSupplierId != 0 {
|
||||
qs = qs.Where("erp_supplier_id=?", m.ErpSupplierId)
|
||||
|
@ -359,6 +365,15 @@ func (m *ErpCommodityListReq) List() (*ErpCommodityListResp, error) {
|
|||
} else {
|
||||
resp.List[i].IsIMEI = 1 // 串码
|
||||
}
|
||||
|
||||
// 查询库存数量
|
||||
var stockCount int64
|
||||
err = orm.Eloquent.Table("erp_stock_commodity").Where("erp_commodity_id = ? and state = ?",
|
||||
resp.List[i].ID, InStock).Count(&stockCount).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resp.List[i].StockCount = uint32(stockCount)
|
||||
}
|
||||
|
||||
//跟之前保持一致
|
||||
|
@ -777,8 +792,8 @@ func GenerateSerialCode(categoryID uint32) (string, error) {
|
|||
// 拼接串码
|
||||
serialCode := categoryStr + dateStr + randomStr
|
||||
|
||||
// 检查生成的串码是否已存在
|
||||
exist, err := QueryRecordExist(fmt.Sprintf("SELECT * FROM erp_stock_commodity WHERE FIND_IN_SET(%s, imei) > 0", serialCode))
|
||||
// 检查生成的串码是否已存在 todo 是否需要判断状态,采购退货的可以重复?
|
||||
exist, err := QueryRecordExist(fmt.Sprintf("SELECT * FROM erp_stock_commodity WHERE FIND_IN_SET(%s, imei) > 0 ", serialCode))
|
||||
if err != nil {
|
||||
logger.Error("exist sn err")
|
||||
}
|
||||
|
@ -1134,10 +1149,10 @@ func InventoryDetailListExport(list []ErpStockCommodity) (string, error) {
|
|||
list[rowId].ErpSupplierName,
|
||||
list[rowId].FirstStockTime,
|
||||
storageType,
|
||||
list[rowId].StockSn,
|
||||
list[rowId].OriginalSn,
|
||||
list[rowId].StockTime,
|
||||
list[rowId].WholesalePrice,
|
||||
list[rowId].StaffCostPrice,
|
||||
list[rowId].WholesalePrice + list[rowId].StaffCostPrice,
|
||||
list[rowId].Age,
|
||||
list[rowId].AllAge,
|
||||
state,
|
||||
|
@ -1395,7 +1410,7 @@ func (m *ErpStockListReq) stockIsEmptyList() (*ErpStockListResp, error) {
|
|||
stock.ErpCategoryId = commodity.ErpCategoryId
|
||||
stock.ErpCategoryName = commodity.ErpCategoryName
|
||||
stock.CommoditySerialNumber = commodity.SerialNumber
|
||||
stock.IMEIType = commodity.IsIMEI
|
||||
stock.IMEIType = commodity.IMEIType
|
||||
stock.RetailPrice = commodity.RetailPrice
|
||||
stock.MinRetailPrice = commodity.MinRetailPrice
|
||||
stock.Count = 0
|
||||
|
@ -1508,7 +1523,7 @@ func (m *ErpStockListReq) stockNoEmptyList() (*ErpStockListResp, error) {
|
|||
stock.ErpCategoryId = commodity.ErpCategoryId
|
||||
stock.ErpCategoryName = commodity.ErpCategoryName
|
||||
stock.CommoditySerialNumber = commodity.SerialNumber
|
||||
stock.IMEIType = commodity.IsIMEI
|
||||
stock.IMEIType = commodity.IMEIType
|
||||
stock.RetailPrice = commodity.RetailPrice
|
||||
stock.MinRetailPrice = commodity.MinRetailPrice
|
||||
stock.Count = uint32(commodity.TotalCount)
|
||||
|
@ -1626,7 +1641,7 @@ func (m *ErpStockListReq) allCommodityList() (*ErpStockListResp, error) {
|
|||
stock.ErpCategoryId = commodity.ErpCategoryId
|
||||
stock.ErpCategoryName = commodity.ErpCategoryName
|
||||
stock.CommoditySerialNumber = commodity.SerialNumber
|
||||
stock.IMEIType = commodity.IsIMEI
|
||||
stock.IMEIType = commodity.IMEIType
|
||||
stock.RetailPrice = commodity.RetailPrice
|
||||
stock.MinRetailPrice = commodity.MinRetailPrice
|
||||
stock.Count = uint32(commodity.TotalCount)
|
||||
|
@ -1737,7 +1752,7 @@ func (m *ErpStockCommodityListReq) GetDetailList() (*ErpStockCommodityListResp,
|
|||
//logger.Error("dailys err:", err)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
ErpStockCommodityListSetAge(commodities)
|
||||
listExport, err := InventoryDetailListExport(commodities)
|
||||
if err != nil {
|
||||
//logger.Error("list export err:", err)
|
||||
|
@ -1888,7 +1903,7 @@ func (m *ErpStockCommodityListReq) buildQueryConditions(qs *gorm.DB) {
|
|||
}
|
||||
|
||||
if m.Sn != "" { //首次入库订单编号
|
||||
qs = qs.Where("stock_sn=?", m.Sn)
|
||||
qs = qs.Where("original_sn=?", m.Sn)
|
||||
}
|
||||
|
||||
if m.StorageType != 0 { //首次入库方式
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -291,19 +291,99 @@ func checkCategoryExcel(sheetCols [][]string) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// 校验名称是否相同,有则false
|
||||
func hasDuplicateNames(sheetCols [][]string) (string, bool) {
|
||||
nameMap := make(map[string]struct{})
|
||||
//// 校验名称是否相同,有则false
|
||||
//func hasDuplicateNames(sheetCols [][]string) (string, bool) {
|
||||
// nameMap := make(map[string]struct{})
|
||||
//
|
||||
// for _, col := range sheetCols {
|
||||
// for _, name := range col {
|
||||
// if _, exists := nameMap[name]; exists && name != "" {
|
||||
// // 有重复的名称
|
||||
// return name, true
|
||||
// }
|
||||
// nameMap[name] = struct{}{}
|
||||
// }
|
||||
// }
|
||||
// // 没有重复的名称
|
||||
// return "", false
|
||||
//}
|
||||
|
||||
//// 校验名称是否相同,有则返回true和重复的名称,备注:只能校验不同的列中不能有重复数据,如:第一列的123,第二列不能有123
|
||||
//func hasDuplicateNames(sheetCols [][]string) (string, bool) {
|
||||
// globalMap := make(map[string]struct{})
|
||||
//
|
||||
// for _, col := range sheetCols {
|
||||
// colMap := make(map[string]struct{})
|
||||
// for _, name := range col {
|
||||
// // 忽略空名称
|
||||
// if name == "" {
|
||||
// continue
|
||||
// }
|
||||
//
|
||||
// // 检查全局map中是否已存在
|
||||
// if _, exists := globalMap[name]; exists {
|
||||
// return name, true
|
||||
// }
|
||||
//
|
||||
// // 将名称添加到当前列map中
|
||||
// colMap[name] = struct{}{}
|
||||
// }
|
||||
//
|
||||
// // 将当前列map中的元素添加到全局map中
|
||||
// for name := range colMap {
|
||||
// globalMap[name] = struct{}{}
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 没有重复的名称
|
||||
// return "", false
|
||||
//}
|
||||
|
||||
// 校验名称是否相同,有则返回true和重复的名称
|
||||
// 第二列数据如果重复,需要看第一列同一行的数据是否相同,如果不同则报错。
|
||||
// 第三列数据不能有重复的名称
|
||||
func hasDuplicateNames(sheetCols [][]string) (string, bool) {
|
||||
//firstColMap := make(map[string]bool)
|
||||
secondColMap := make(map[string]string) // Map记录第二列数据的重复情况,以及对应第一列的数据
|
||||
thirdColMap := make(map[string]bool)
|
||||
|
||||
// 确保每一列数据都有相同数量的行数
|
||||
rowsCount := len(sheetCols[0])
|
||||
for _, col := range sheetCols {
|
||||
for _, name := range col {
|
||||
if _, exists := nameMap[name]; exists && name != "" {
|
||||
// 有重复的名称
|
||||
return name, true
|
||||
}
|
||||
nameMap[name] = struct{}{}
|
||||
if len(col) != rowsCount {
|
||||
return "每列数据的行数不一致", true
|
||||
}
|
||||
}
|
||||
|
||||
for i := 0; i < rowsCount; i++ {
|
||||
//// 检查第一列
|
||||
//firstColName := sheetCols[0][i]
|
||||
//if firstColName != "" {
|
||||
// if _, exists := firstColMap[firstColName]; exists {
|
||||
// return firstColName, true
|
||||
// }
|
||||
// firstColMap[firstColName] = true
|
||||
//}
|
||||
|
||||
// 检查第二列
|
||||
secondColName := sheetCols[1][i]
|
||||
if secondColName != "" {
|
||||
if firstCol, exists := secondColMap[secondColName]; exists && firstCol != sheetCols[0][i] {
|
||||
return secondColName, true
|
||||
}
|
||||
secondColMap[secondColName] = sheetCols[0][i]
|
||||
}
|
||||
|
||||
// 检查第三列
|
||||
thirdColName := sheetCols[2][i]
|
||||
if thirdColName != "" {
|
||||
if _, exists := thirdColMap[thirdColName]; exists {
|
||||
return thirdColName, true
|
||||
}
|
||||
thirdColMap[thirdColName] = true
|
||||
}
|
||||
}
|
||||
|
||||
// 没有重复的名称
|
||||
return "", false
|
||||
}
|
||||
|
@ -753,16 +833,31 @@ func ImportCategoryData(colsMap []map[string]interface{}, businessId uint32) err
|
|||
// 判断是否存在重复数据
|
||||
func hasDuplicateInDb(data []CategoryExcel) (string, bool) {
|
||||
for _, item := range data {
|
||||
if exists := isCategoryExists(item.FirstCategory); exists {
|
||||
return item.FirstCategory, true
|
||||
// 判断是导入几级分类
|
||||
nType := 0
|
||||
if item.ThreeCategory != "" && item.SecondCategory != "" && item.FirstCategory != "" {
|
||||
nType = 3
|
||||
} else if item.ThreeCategory == "" && item.SecondCategory != "" && item.FirstCategory != "" {
|
||||
nType = 2
|
||||
} else if item.ThreeCategory == "" && item.SecondCategory == "" && item.FirstCategory != "" {
|
||||
nType = 1
|
||||
} else {
|
||||
return "", true
|
||||
}
|
||||
|
||||
if exists := isCategoryExists(item.SecondCategory); exists {
|
||||
return item.SecondCategory, true
|
||||
}
|
||||
|
||||
if exists := isCategoryExists(item.ThreeCategory); exists {
|
||||
return item.ThreeCategory, true
|
||||
switch nType {
|
||||
case 1: // 导入一级分类
|
||||
if exists := isCategoryExists(item.FirstCategory); exists {
|
||||
return item.FirstCategory, true
|
||||
}
|
||||
case 2: // 导入二级分类
|
||||
if exists := isCategoryExists(item.SecondCategory); exists {
|
||||
return item.SecondCategory, true
|
||||
}
|
||||
case 3: // 导入三级分类
|
||||
if exists := isCategoryExists(item.ThreeCategory); exists {
|
||||
return item.ThreeCategory, true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1068,28 +1163,57 @@ func GenerateSerialNumber(categoryId uint32) (string, error) {
|
|||
}
|
||||
|
||||
// UpdateErpStockAmountInfo 更新库存和库存商品表的金额:指导零售价、最低零售价
|
||||
func UpdateErpStockAmountInfo(begin *gorm.DB, commodityId, retailPrice, minRetailPrice uint32, barCode string) error {
|
||||
// 更新库存表
|
||||
err := begin.Table("erp_stock").Where("erp_commodity_id=?", commodityId).
|
||||
Updates(map[string]interface{}{
|
||||
"retail_price": retailPrice,
|
||||
"min_retail_price": minRetailPrice,
|
||||
}).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
func UpdateErpStockAmountInfo(begin *gorm.DB, commodityId, retailPrice, minRetailPrice uint32, barCode string,
|
||||
category *ErpCategory) error {
|
||||
if category != nil && category.ID != 0 { // 分类信息有值
|
||||
// 更新库存表
|
||||
err := begin.Table("erp_stock").Where("erp_commodity_id=?", commodityId).
|
||||
Updates(map[string]interface{}{
|
||||
"retail_price": retailPrice,
|
||||
"min_retail_price": minRetailPrice,
|
||||
"erp_category_id": category.ID,
|
||||
"erp_category_name": category.Name,
|
||||
}).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 更新库存商品表
|
||||
err = begin.Table("erp_stock_commodity").Where("erp_commodity_id=? and state not in (2,5)", commodityId).
|
||||
Updates(map[string]interface{}{
|
||||
"retail_price": retailPrice,
|
||||
"min_retail_price": minRetailPrice,
|
||||
"erp_barcode": barCode,
|
||||
}).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// 更新库存商品表
|
||||
err = begin.Table("erp_stock_commodity").Where("erp_commodity_id=? and state not in (2,5)", commodityId).
|
||||
Updates(map[string]interface{}{
|
||||
"retail_price": retailPrice,
|
||||
"min_retail_price": minRetailPrice,
|
||||
//"staff_cost_price": staffCostPrice,
|
||||
"erp_barcode": barCode,
|
||||
"erp_category_id": category.ID,
|
||||
"erp_category_name": category.Name,
|
||||
}).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
// 更新库存表
|
||||
err := begin.Table("erp_stock").Where("erp_commodity_id=?", commodityId).
|
||||
Updates(map[string]interface{}{
|
||||
"retail_price": retailPrice,
|
||||
"min_retail_price": minRetailPrice,
|
||||
}).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// 更新库存商品表
|
||||
err = begin.Table("erp_stock_commodity").Where("erp_commodity_id=? and state not in (2,5)", commodityId).
|
||||
Updates(map[string]interface{}{
|
||||
"retail_price": retailPrice,
|
||||
"min_retail_price": minRetailPrice,
|
||||
//"staff_cost_price": staffCostPrice,
|
||||
"erp_barcode": barCode,
|
||||
}).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -698,7 +698,7 @@ type MallUserVmRecordReq struct {
|
|||
}
|
||||
|
||||
type MallUserVmRecordResp struct {
|
||||
Count int64 `json:"count"`
|
||||
Count int64 `json:"total"`
|
||||
List []MallUserVmRecordData `json:"list"`
|
||||
PageIndex int `json:"page_index"`
|
||||
PageSize int `json:"page_size"`
|
||||
|
@ -752,7 +752,7 @@ func (m *MallUserVmRecordReq) MallUserVmRecordList() ([]MallUserVmRecordData, in
|
|||
|
||||
qs = qs.Select("user_vm_record.*, user.tel").
|
||||
Joins("Left JOIN user ON user_vm_record.uid = user.uid")
|
||||
err := qs.Offset(page * m.PageSize).Limit(m.PageSize).Find(&list).Error
|
||||
err := qs.Offset(page * m.PageSize).Limit(m.PageSize).Order("created_at desc").Find(&list).Error
|
||||
if err != nil {
|
||||
logger.Errorf("err:", err)
|
||||
return nil, 0, err
|
||||
|
|
|
@ -1703,7 +1703,7 @@ func GetUserExpiredCards(userId []uint32) (map[uint32][]OrderCard, error) {
|
|||
err := orm.Eloquent.Table("order_card").
|
||||
Preload("GameCard").
|
||||
Where("uid in (?)", userId).
|
||||
Where("pay_status = ?", 2).Where("card_status in ?", []int{1, 2, 3}).
|
||||
Where("pay_status = ?", HavePaid).Where("card_status in ?", []int{1, 2, 3}).
|
||||
Find(&oc).Error
|
||||
if err != nil {
|
||||
return m, err
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -3,6 +3,8 @@ package models
|
|||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"gorm.io/gorm"
|
||||
"log"
|
||||
"strings"
|
||||
|
||||
|
@ -61,7 +63,7 @@ type SysUserB struct {
|
|||
CooperativeName string `json:"cooperative_name"` // 合作商名称
|
||||
AccountType uint32 `json:"account_type"` // 账号类型:1-管理端
|
||||
StoreData string `gorm:"type:json" json:"store_data,omitempty"` // 有效门店
|
||||
StoreList []StoreInfo `gorm:"-" json:"store_list"` // 有效门店列表
|
||||
StoreList []StoreInfo `json:"store_list" gorm:"-" ` // 有效门店列表
|
||||
SalesCommRate float64 `json:"sales_comm_rate"` // 销售提成比例
|
||||
Uid uint32 `json:"uid" gorm:"column:uid;unique_index"` // 用户uid todo 待添加
|
||||
BaseModel
|
||||
|
@ -237,10 +239,17 @@ func (e *SysUser) GetList() (SysUserView []SysUserView, err error) {
|
|||
return
|
||||
}
|
||||
|
||||
type SysUserListResp struct {
|
||||
Total int `json:"count"` // 总条数
|
||||
PageIndex int `json:"pageIndex"` // 页码
|
||||
PageSize int `json:"pageSize"` // 页面条数
|
||||
List []SysUserPage `json:"list"` // 采购报表信息
|
||||
}
|
||||
|
||||
func (e *SysUser) GetPage(pageSize int, pageIndex int) ([]SysUserPage, int, error) {
|
||||
var doc []SysUserPage
|
||||
table := orm.Eloquent.Select("sys_user.*,sys_dept.dept_name").Table(e.TableName())
|
||||
table = table.Joins("left join sys_dept on sys_dept.dept_id = sys_user.dept_id")
|
||||
table = table.Joins("left join sys_dept on sys_dept.dept_id = sys_user.dept_id") //es := orm.Eloquent.Select("sys_user.*,sys_dept.dept_name").Table(e.TableName()) //es = table.Joins("left join sys_dept on sys_dept.dept_id = sys_user.dept_id")
|
||||
|
||||
if e.Username != "" {
|
||||
table = table.Where("username = ?", e.Username)
|
||||
|
@ -253,8 +262,20 @@ func (e *SysUser) GetPage(pageSize int, pageIndex int) ([]SysUserPage, int, erro
|
|||
table = table.Where("sys_user.phone = ?", e.Phone)
|
||||
}
|
||||
|
||||
if e.RoleId != 0 {
|
||||
table = table.Where("sys_user.role_id = ?", e.RoleId)
|
||||
}
|
||||
|
||||
if e.NickName != "" {
|
||||
table = table.Where("sys_user.nick_name = ?", e.NickName)
|
||||
}
|
||||
|
||||
if e.StoreId != 0 {
|
||||
table = table.Where("JSON_CONTAINS(store_data, ?)", fmt.Sprintf(`{"storeId":%d}`, e.StoreId))
|
||||
}
|
||||
|
||||
if e.DeptId != 0 {
|
||||
table = table.Where("sys_user.dept_id in (select dept_id from sys_dept where dept_path like ? )", "%"+tools.IntToString(e.DeptId)+"%")
|
||||
table = table.Where("sys_user.dept_id in (select dept_id from sys_dept where dept_path like ? )", "%"+tools.IntToString(e.DeptId)+"%") //es = table.Where("sys_user.dept_id in (select dept_id from sys_dept where dept_path like ? )", "%"+tools.IntToString(e.DeptId)+"%")
|
||||
}
|
||||
|
||||
// 数据权限控制(如果不需要数据权限请将此处去掉)
|
||||
|
@ -264,9 +285,20 @@ func (e *SysUser) GetPage(pageSize int, pageIndex int) ([]SysUserPage, int, erro
|
|||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
var count int64
|
||||
|
||||
if err := table.Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&doc).Offset(-1).Limit(-1).Count(&count).Error; err != nil {
|
||||
es := table
|
||||
var count int64
|
||||
err = es.Count(&count).Error
|
||||
if err != nil {
|
||||
//logger.Error("count err:", err)
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
//if err := table.Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&doc).Order("sys_user.created_at DESC").Offset(-1).Limit(-1).Count(&count).Error; err != nil {
|
||||
// return nil, 0, err
|
||||
//}
|
||||
|
||||
if err = table.Order("sys_user.user_id DESC").Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&doc).Error; err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
|
@ -307,7 +339,7 @@ func (e *SysUser) Encrypt() (err error) {
|
|||
}
|
||||
|
||||
// 添加
|
||||
func (e SysUser) Insert() (id int, err error) {
|
||||
func (e SysUser) Insert(begin *gorm.DB) (id int, err error) {
|
||||
if err = e.Encrypt(); err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -321,7 +353,7 @@ func (e SysUser) Insert() (id int, err error) {
|
|||
}
|
||||
|
||||
//添加数据
|
||||
if err = orm.Eloquent.Table(e.TableName()).Create(&e).Error; err != nil {
|
||||
if err = begin.Table(e.TableName()).Create(&e).Error; err != nil {
|
||||
return
|
||||
}
|
||||
id = e.UserId
|
||||
|
@ -329,7 +361,7 @@ func (e SysUser) Insert() (id int, err error) {
|
|||
}
|
||||
|
||||
// 修改
|
||||
func (e *SysUser) Update(id int) (update SysUser, err error) {
|
||||
func (e *SysUser) Update(begin *gorm.DB, id int) (update SysUser, err error) {
|
||||
if e.Password != "" {
|
||||
if err = e.Encrypt(); err != nil {
|
||||
return
|
||||
|
@ -351,9 +383,13 @@ func (e *SysUser) Update(id int) (update SysUser, err error) {
|
|||
e.StoreData = string(storeDataJSON)
|
||||
}
|
||||
|
||||
if begin == nil {
|
||||
begin = orm.Eloquent
|
||||
}
|
||||
|
||||
//参数1:是要修改的数据
|
||||
//参数2:是修改的数据
|
||||
if err = orm.Eloquent.Table(e.TableName()).Model(&update).Updates(&e).Error; err != nil {
|
||||
if err = begin.Table(e.TableName()).Model(&update).Updates(&e).Error; err != nil {
|
||||
return
|
||||
}
|
||||
return
|
||||
|
@ -381,7 +417,7 @@ func (e *SysUser) SetPwd(pwd SysUserPwd) (Result bool, err error) {
|
|||
return
|
||||
}
|
||||
e.Password = pwd.NewPassword
|
||||
_, err = e.Update(e.UserId)
|
||||
_, err = e.Update(nil, e.UserId)
|
||||
tools.HasError(err, "更新密码失败(代码202)", 500)
|
||||
return
|
||||
}
|
||||
|
@ -392,3 +428,17 @@ func GetUserById(id uint32) *SysUserB {
|
|||
|
||||
return u
|
||||
}
|
||||
|
||||
// UpdateUserType 更新uid的user_type为2
|
||||
func UpdateUserType(begin *gorm.DB, uid, nType uint32) error {
|
||||
// 更新库存表
|
||||
err := begin.Table("user").Where("uid = ?", uid).
|
||||
Updates(map[string]interface{}{
|
||||
"user_type": nType,
|
||||
}).Error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import (
|
|||
"net/http"
|
||||
"os"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
@ -48,6 +49,20 @@ const (
|
|||
UpgradePlatinumToBlackAuto // 20-白金→黑金(自动)
|
||||
)
|
||||
|
||||
const (
|
||||
MemberLevelConsumer = 10 // 普通用户
|
||||
MemberLevelUser = 1 // 普通会员
|
||||
MemberLevelGold = 2 // 黄金会员
|
||||
MemberLevelPeriod = 3 // 短期会员
|
||||
MemberLevelPlatinum = 4 // 白金会员
|
||||
MemberLevelBlackGold = 5 // 黑金会员
|
||||
)
|
||||
|
||||
const (
|
||||
UserTypeConsumer = 1 // 普通用户
|
||||
UserTypeShopAssistant = 2 // 店员
|
||||
)
|
||||
|
||||
// gen:qs
|
||||
//
|
||||
//go:generate goqueryset -in user.go
|
||||
|
@ -100,11 +115,6 @@ func (m *UserInfo) TableName() string {
|
|||
return "user"
|
||||
}
|
||||
|
||||
const (
|
||||
UserTypeConsumer = 1 // 普通用户
|
||||
UserTypeShopAssistant = 2 // 店员
|
||||
)
|
||||
|
||||
const (
|
||||
UNMARK = iota
|
||||
MARK
|
||||
|
@ -264,6 +274,8 @@ type NewUserListReq struct {
|
|||
OpenStartTime string `json:"open_startTime"` // 首次开通租卡会员-开始时间
|
||||
OpenEndTime string `json:"open_endTime"` // 首次开通租卡会员-结束时间
|
||||
Filter bool `json:"filter"` // 是否过滤无滞纳金已标记用户
|
||||
SortField string `json:"sort_field"` // 排序字段:滞纳金传"forfeit_penalty"
|
||||
SortType string `json:"sort_type"` // 排序类型:desc 降序、asc 升序
|
||||
IsExport uint32 `json:"is_export"` // 1-导出
|
||||
}
|
||||
|
||||
|
@ -280,20 +292,26 @@ func GetNewUserList(req *NewUserListReq) (*NewUserListResp, error) {
|
|||
PageIndex: req.PageIndex,
|
||||
PageSize: req.PageSize,
|
||||
}
|
||||
|
||||
users := make([]U, 0)
|
||||
sortFiled := "id"
|
||||
sortType := "DESC"
|
||||
req.PageIndex -= 1
|
||||
|
||||
if req.PageIndex < 0 {
|
||||
req.PageIndex = 0
|
||||
}
|
||||
|
||||
if req.PageSize == 0 {
|
||||
req.PageSize = 10
|
||||
}
|
||||
|
||||
if req.SortField == "forfeit_penalty" {
|
||||
return GetUserListByForfeitPenalty(req)
|
||||
}
|
||||
|
||||
users := make([]U, 0)
|
||||
if req.SortField == "" {
|
||||
req.SortField = "id"
|
||||
}
|
||||
if req.SortType == "" {
|
||||
req.SortType = "DESC"
|
||||
}
|
||||
|
||||
qs := orm.Eloquent.Model(&UserInfo{}).Debug()
|
||||
|
||||
if req.Tel != "" {
|
||||
|
@ -376,9 +394,15 @@ func GetNewUserList(req *NewUserListReq) (*NewUserListResp, error) {
|
|||
currentTime := time.Now()
|
||||
|
||||
// 子查询,查询消费次数和消费金额
|
||||
subQuery := fmt.Sprintf(`SELECT uid, COUNT(*) as order_count, SUM(amount) as order_amount
|
||||
FROM fund_record
|
||||
WHERE fund_type NOT IN ('deposit_refund', 'express_fee_refund', 'member_expire_delay', 'recycle_card')
|
||||
//subQuery := fmt.Sprintf(`SELECT uid, COUNT(*) as order_count, SUM(amount) as order_amount
|
||||
// FROM fund_record
|
||||
// WHERE fund_type NOT IN ('deposit_refund', 'express_fee_refund', 'member_expire_delay', 'recycle_card')
|
||||
// GROUP BY uid
|
||||
// HAVING COUNT(uid) > 0`)
|
||||
|
||||
subQuery := fmt.Sprintf(`SELECT uid, COUNT(*) as order_count, SUM(total_amount) as order_amount
|
||||
FROM erp_order
|
||||
WHERE pay_status = 2
|
||||
GROUP BY uid
|
||||
HAVING COUNT(uid) > 0`)
|
||||
|
||||
|
@ -392,7 +416,7 @@ func GetNewUserList(req *NewUserListReq) (*NewUserListResp, error) {
|
|||
qs = orm.Eloquent.Table("(?) as a", qs)
|
||||
qs = qs.Select("a.*").
|
||||
Joins("inner join order_card as oc on a.uid=oc.uid").
|
||||
Where("pay_status = ? AND card_status IN (?)", 2, []int{1, 2, 3}).
|
||||
Where("pay_status = ? AND card_status IN (?)", HavePaid, []int{1, 2, 3}).
|
||||
Group("oc.uid").
|
||||
Having("count(oc.uid) > 0")
|
||||
|
||||
|
@ -409,13 +433,13 @@ func GetNewUserList(req *NewUserListReq) (*NewUserListResp, error) {
|
|||
}
|
||||
|
||||
if req.IsExport == 1 { // 导出excel
|
||||
err = qs.Order(fmt.Sprintf("%s %s", sortFiled, sortType)).Find(&users).Error
|
||||
err = qs.Order(fmt.Sprintf("%s %s", req.SortField, req.SortType)).Find(&users).Error
|
||||
if err != nil && err != RecordNotFound {
|
||||
logger.Errorf("err:", logger.Field("err", err))
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
err = qs.Order(fmt.Sprintf("%s %s", sortFiled, sortType)).Offset(req.PageIndex * req.PageSize).Limit(req.PageSize).Find(&users).Error
|
||||
err = qs.Order(fmt.Sprintf("%s %s", req.SortField, req.SortType)).Offset(req.PageIndex * req.PageSize).Limit(req.PageSize).Find(&users).Error
|
||||
if err != nil && err != RecordNotFound {
|
||||
logger.Errorf("err:", logger.Field("err", err))
|
||||
return nil, err
|
||||
|
@ -436,6 +460,11 @@ func GetNewUserList(req *NewUserListReq) (*NewUserListResp, error) {
|
|||
logger.Errorf("err:", logger.Field("err", err))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 查询门店信息
|
||||
storeList := make(map[uint32]Store)
|
||||
storeList = GetStoreMap()
|
||||
|
||||
for i, u := range users {
|
||||
c, ok := cards[u.Uid]
|
||||
if ok {
|
||||
|
@ -445,31 +474,17 @@ func GetNewUserList(req *NewUserListReq) (*NewUserListResp, error) {
|
|||
}
|
||||
|
||||
// 添加门店信息
|
||||
users[i].Store, _ = setStore(u.StoreId)
|
||||
//users[i].Store, _ = setStore(u.StoreId)
|
||||
store := storeList[uint32(u.StoreId)]
|
||||
users[i].Store = &store
|
||||
|
||||
// 校验时间,如果为01-01-01 08:05,则赋值为空
|
||||
if u.MemberExpire != nil && u.MemberExpire.IsZero() {
|
||||
users[i].MemberExpire = nil
|
||||
}
|
||||
if u.OpenMemberTime != nil && u.OpenMemberTime.IsZero() {
|
||||
users[i].OpenMemberTime = nil
|
||||
}
|
||||
if u.MemberOpenTime != nil && u.MemberOpenTime.IsZero() {
|
||||
users[i].MemberOpenTime = nil
|
||||
}
|
||||
if u.LastLoginAt != nil && u.LastLoginAt.IsZero() {
|
||||
users[i].LastLoginAt = nil
|
||||
}
|
||||
if u.InviteTime != nil && u.InviteTime.IsZero() {
|
||||
users[i].InviteTime = nil
|
||||
}
|
||||
//if u.RenewalTime != nil && u.RenewalTime.IsZero() {
|
||||
// users[i].RenewalTime = nil
|
||||
//}
|
||||
if u.FirstRetailOrder != nil && u.FirstRetailOrder.IsZero() {
|
||||
users[i].FirstRetailOrder = nil
|
||||
}
|
||||
|
||||
validateZeroTime(&users[i].MemberExpire)
|
||||
validateZeroTime(&users[i].OpenMemberTime)
|
||||
validateZeroTime(&users[i].MemberOpenTime)
|
||||
validateZeroTime(&users[i].LastLoginAt)
|
||||
validateZeroTime(&users[i].InviteTime)
|
||||
validateZeroTime(&users[i].FirstRetailOrder)
|
||||
}
|
||||
|
||||
if req.IsExport == 1 {
|
||||
|
@ -481,13 +496,145 @@ func GetNewUserList(req *NewUserListReq) (*NewUserListResp, error) {
|
|||
resp.ExportUrl = exportFile
|
||||
} else {
|
||||
resp.List = users
|
||||
resp.PageIndex = req.PageIndex
|
||||
resp.PageSize = req.PageSize
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// GetUserListByForfeitPenalty 滞纳金排序
|
||||
func GetUserListByForfeitPenalty(req *NewUserListReq) (*NewUserListResp, error) {
|
||||
resp := &NewUserListResp{
|
||||
PageIndex: req.PageIndex + 1,
|
||||
PageSize: req.PageSize,
|
||||
}
|
||||
|
||||
allUsers := make([]U, 0)
|
||||
qs := orm.Eloquent.Model(&UserInfo{})
|
||||
|
||||
var count int64
|
||||
err := qs.Count(&count).Error
|
||||
if err != nil {
|
||||
logger.Errorf("err:", logger.Field("err", err))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
subQuery := fmt.Sprintf(`SELECT uid, COUNT(*) as order_count, SUM(total_amount) as order_amount
|
||||
FROM erp_order
|
||||
WHERE pay_status = 2
|
||||
GROUP BY uid
|
||||
HAVING COUNT(uid) > 0`)
|
||||
|
||||
currentTime := time.Now()
|
||||
// 查询用户数据,过期天数,消费次数,消费金额---20240308修改:过期会员等级会自动改成1普通会员,所以这里的范围改成,1,2,3, 4, 5
|
||||
qs = qs.Select("user.*, COALESCE(fr.order_count, 0) as order_count, COALESCE(fr.order_amount, 0) as "+
|
||||
"order_amount, CASE WHEN (user.member_level IN (1, 2, 3, 4, 5) AND user.member_expire < ?) "+
|
||||
"THEN DATEDIFF(?, user.member_expire) ELSE 0 END AS member_expire_days", currentTime, currentTime).
|
||||
Joins(fmt.Sprintf("LEFT JOIN (%s) fr ON user.uid = fr.uid", subQuery))
|
||||
|
||||
if req.Filter {
|
||||
qs = orm.Eloquent.Table("(?) as a", qs)
|
||||
qs = qs.Select("a.*").
|
||||
Joins("inner join order_card as oc on a.uid=oc.uid").
|
||||
Where("pay_status = ? AND card_status IN (?)", HavePaid, []int{1, 2, 3}).
|
||||
Group("oc.uid").
|
||||
Having("count(oc.uid) > 0")
|
||||
|
||||
qs = qs.Where("member_expire_days > 0").Where("mark = ?", UNMARK)
|
||||
|
||||
err := qs.Find(&allUsers).Error
|
||||
if err != nil && err != RecordNotFound {
|
||||
logger.Errorf("err:", logger.Field("err", err))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
count = int64(len(allUsers))
|
||||
allUsers = nil
|
||||
}
|
||||
|
||||
err = qs.Find(&allUsers).Error
|
||||
if err != nil && err != RecordNotFound {
|
||||
logger.Errorf("err:", logger.Field("err", err))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Fetch expired cards for users with positive MemberExpireDays
|
||||
var uids []uint32
|
||||
for _, u := range allUsers {
|
||||
if u.MemberExpireDays > 0 {
|
||||
uids = append(uids, u.Uid)
|
||||
}
|
||||
}
|
||||
cards, err := GetUserExpiredCards(uids)
|
||||
if err != nil {
|
||||
logger.Errorf("err:", logger.Field("err", err))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 查询门店信息
|
||||
storeList := make(map[uint32]Store)
|
||||
storeList = GetStoreMap()
|
||||
|
||||
// Calculate forfeit penalty and update user data
|
||||
for i, u := range allUsers {
|
||||
allUsers[i].OrderCards = cards[u.Uid]
|
||||
allUsers[i].ForfeitPenalty = calculateForfeitPenalty(allUsers[i])
|
||||
|
||||
store := storeList[uint32(u.StoreId)]
|
||||
allUsers[i].Store = &store
|
||||
|
||||
// Validate and adjust zero time values
|
||||
validateZeroTime(&allUsers[i].MemberExpire)
|
||||
validateZeroTime(&allUsers[i].OpenMemberTime)
|
||||
validateZeroTime(&allUsers[i].MemberOpenTime)
|
||||
validateZeroTime(&allUsers[i].LastLoginAt)
|
||||
validateZeroTime(&allUsers[i].InviteTime)
|
||||
validateZeroTime(&allUsers[i].FirstRetailOrder)
|
||||
}
|
||||
|
||||
// Sorting by forfeit penalty
|
||||
sort.Slice(allUsers, func(i, j int) bool {
|
||||
return allUsers[i].ForfeitPenalty < allUsers[j].ForfeitPenalty
|
||||
})
|
||||
if req.SortType == "DESC" || req.SortType == "desc" {
|
||||
reverseUsers(allUsers)
|
||||
}
|
||||
|
||||
// Paginate results
|
||||
startIndex := req.PageIndex * req.PageSize
|
||||
endIndex := startIndex + req.PageSize
|
||||
if endIndex > len(allUsers) {
|
||||
endIndex = len(allUsers)
|
||||
}
|
||||
|
||||
// Slice the users based on pagination
|
||||
pagedUsers := allUsers[startIndex:endIndex]
|
||||
|
||||
resp.Total = len(allUsers)
|
||||
resp.List = pagedUsers
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// Function to calculate forfeit penalty for a user
|
||||
func calculateForfeitPenalty(user U) int {
|
||||
return len(user.OrderCards) * 200 * int(user.MemberExpireDays)
|
||||
}
|
||||
|
||||
// Function to reverse a slice of users
|
||||
func reverseUsers(users []U) {
|
||||
for i := len(users)/2 - 1; i >= 0; i-- {
|
||||
opp := len(users) - 1 - i
|
||||
users[i], users[opp] = users[opp], users[i]
|
||||
}
|
||||
}
|
||||
|
||||
// Function to validate and adjust zero time values
|
||||
func validateZeroTime(t **time.Time) {
|
||||
if *t != nil && (*t).IsZero() {
|
||||
*t = nil
|
||||
}
|
||||
}
|
||||
|
||||
func setStore(storeId uint64) (*Store, error) {
|
||||
storeInfo := new(Store)
|
||||
err := orm.Eloquent.Table("store").Where("id=?", storeId).Find(storeInfo).Error
|
||||
|
@ -2447,6 +2594,30 @@ func GetSysUserInfoByUid(uid uint32) (SysUser, error) {
|
|||
return userInfo, nil
|
||||
}
|
||||
|
||||
func countDigits(n uint32) int {
|
||||
str := strconv.FormatUint(uint64(n), 10)
|
||||
return len(str)
|
||||
}
|
||||
|
||||
func GetSysUserInfoById(id uint32) (SysUser, error) {
|
||||
var userInfo SysUser
|
||||
if countDigits(id) == 8 { //历史数据为8位的uid
|
||||
err := orm.Eloquent.Debug().Table("sys_user").Where("uid = ?", id).Find(&userInfo).Error
|
||||
if err != nil {
|
||||
logger.Error("err:", logger.Field("err", err))
|
||||
return userInfo, err
|
||||
}
|
||||
} else {
|
||||
err := orm.Eloquent.Debug().Table("sys_user").Where("user_id = ?", id).Find(&userInfo).Error
|
||||
if err != nil {
|
||||
logger.Error("err:", logger.Field("err", err))
|
||||
return userInfo, err
|
||||
}
|
||||
}
|
||||
|
||||
return userInfo, nil
|
||||
}
|
||||
|
||||
type UserDepositRefundRecordListReq struct {
|
||||
//StoreId uint32 `json:"store_id"` // 门店id
|
||||
Uid uint32 `json:"uid"` // 用户id
|
||||
|
@ -3660,6 +3831,8 @@ func (m *TelListReq) GetTelList() (*TelListResp, error) {
|
|||
|
||||
var count int64
|
||||
qs := orm.Eloquent.Table("user").Where("tel like ?", "%"+m.PhoneNum+"%")
|
||||
qs = qs.Where("member_level in (?)",
|
||||
[]uint32{MemberLevelUser, MemberLevelGold, MemberLevelPeriod, MemberLevelPlatinum, MemberLevelBlackGold})
|
||||
err := qs.Count(&count).Error
|
||||
if err != nil {
|
||||
logger.Error("count err:", logger.Field("err", err))
|
||||
|
@ -3731,3 +3904,12 @@ func CreateUid() uint32 {
|
|||
return uid
|
||||
}
|
||||
}
|
||||
|
||||
// IsInMemberLevels 判断用户是不是会员
|
||||
func IsInMemberLevels(memberLevel uint32) bool {
|
||||
if memberLevel == MemberLevelUser || memberLevel == MemberLevelGold || memberLevel == MemberLevelPeriod ||
|
||||
memberLevel == MemberLevelPlatinum || memberLevel == MemberLevelBlackGold {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -55,6 +55,9 @@ func UserVmUpdate(gdb *gorm.DB, uid uint32, amount int, event, describe string)
|
|||
return err
|
||||
}
|
||||
|
||||
// 变动前的积分
|
||||
nBeforeVm := userVm.Vm
|
||||
|
||||
//flag := false
|
||||
begin := gdb
|
||||
if gdb == nil {
|
||||
|
@ -62,7 +65,7 @@ func UserVmUpdate(gdb *gorm.DB, uid uint32, amount int, event, describe string)
|
|||
begin = orm.Eloquent.Begin()
|
||||
}
|
||||
|
||||
if err == RecordNotFound {
|
||||
if userVm.Uid == 0 { // 没有积分记录
|
||||
if amount < 0 {
|
||||
begin.Rollback()
|
||||
logger.Error("amount lt 0")
|
||||
|
@ -80,11 +83,11 @@ func UserVmUpdate(gdb *gorm.DB, uid uint32, amount int, event, describe string)
|
|||
}
|
||||
} else {
|
||||
// 如果用户积分不够抵扣,则扣到0为止
|
||||
if userVm.Vm == 0 || int(userVm.Vm)+amount <= 0 {
|
||||
sql := fmt.Sprintf("UPDATE user_vm SET vm = ? WHERE uid=?;")
|
||||
if int(userVm.Vm)+amount <= 0 {
|
||||
sql := fmt.Sprintf("UPDATE user_vm SET vm = ? WHERE uid=?")
|
||||
err = begin.Exec(sql, 0, uid).Error
|
||||
} else {
|
||||
sql := fmt.Sprintf("UPDATE user_vm SET vm = vm+? WHERE uid=?;")
|
||||
sql := fmt.Sprintf("UPDATE user_vm SET vm = vm+? WHERE uid=?")
|
||||
err = begin.Exec(sql, amount, uid).Error
|
||||
}
|
||||
if err != nil {
|
||||
|
@ -96,7 +99,7 @@ func UserVmUpdate(gdb *gorm.DB, uid uint32, amount int, event, describe string)
|
|||
|
||||
vmRecord := &UserVmRecord{
|
||||
Uid: uid,
|
||||
BeforeVm: uint32(userVm.Vm),
|
||||
BeforeVm: uint32(nBeforeVm),
|
||||
AfterVm: 0, // 默认值为 0
|
||||
Alter: amount,
|
||||
Event: event,
|
||||
|
|
438
docs/docs.go
438
docs/docs.go
|
@ -4561,16 +4561,58 @@ const docTemplate = `{
|
|||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "username",
|
||||
"description": "用户名称",
|
||||
"name": "username",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "状态:0-正常,1-停用",
|
||||
"name": "status",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "手机号",
|
||||
"name": "phone",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "页码",
|
||||
"name": "pageIndex",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "页面条数",
|
||||
"name": "pageSize",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "角色id",
|
||||
"name": "roleId",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "昵称",
|
||||
"name": "nickName",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "门店id",
|
||||
"name": "storeId",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"code\": -1, \"message\": \"抱歉未找到相关信息\"}",
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
"$ref": "#/definitions/models.SysUserListResp"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5116,11 +5158,7 @@ const docTemplate = `{
|
|||
"erp_category_id",
|
||||
"erp_supplier_id",
|
||||
"is_imei",
|
||||
"min_retail_price",
|
||||
"name",
|
||||
"retail_price",
|
||||
"staff_cost_price",
|
||||
"wholesale_price"
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"brokerage_1": {
|
||||
|
@ -5217,11 +5255,8 @@ const docTemplate = `{
|
|||
"erp_supplier_id",
|
||||
"id",
|
||||
"imei_type",
|
||||
"min_retail_price",
|
||||
"name",
|
||||
"retail_price",
|
||||
"staff_cost_price",
|
||||
"wholesale_price"
|
||||
"is_imei",
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"brokerage_1": {
|
||||
|
@ -5252,6 +5287,10 @@ const docTemplate = `{
|
|||
"description": "1-无串码 2-串码(系统生成) 3-串码(手动添加)",
|
||||
"type": "integer"
|
||||
},
|
||||
"is_imei": {
|
||||
"description": "是否串码:1-串码类 2-非串码",
|
||||
"type": "integer"
|
||||
},
|
||||
"member_discount": {
|
||||
"description": "会员优惠",
|
||||
"type": "number"
|
||||
|
@ -6456,10 +6495,6 @@ const docTemplate = `{
|
|||
"models.ErpCashierListResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"count": {
|
||||
"description": "数据总条数",
|
||||
"type": "integer"
|
||||
},
|
||||
"list": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
@ -6473,6 +6508,10 @@ const docTemplate = `{
|
|||
"pageSize": {
|
||||
"description": "每页展示条数",
|
||||
"type": "integer"
|
||||
},
|
||||
"total": {
|
||||
"description": "数据总条数",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -6611,7 +6650,11 @@ const docTemplate = `{
|
|||
"type": "string"
|
||||
},
|
||||
"staff_cost_price": {
|
||||
"description": "员工成本价加价",
|
||||
"description": "员工成本价加价(如:加价50,不是加价后的价格)",
|
||||
"type": "integer"
|
||||
},
|
||||
"stock_count": {
|
||||
"description": "库存数量",
|
||||
"type": "integer"
|
||||
},
|
||||
"wholesale_price": {
|
||||
|
@ -7038,6 +7081,10 @@ const docTemplate = `{
|
|||
"description": "零售订单id(后端生成)",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_stock_commodity_id": {
|
||||
"description": "库存商品表主键id",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_supplier_id": {
|
||||
"description": "主供应商id",
|
||||
"type": "integer"
|
||||
|
@ -7111,7 +7158,7 @@ const docTemplate = `{
|
|||
"type": "number"
|
||||
},
|
||||
"staff_cost_price": {
|
||||
"description": "员工成本价加价",
|
||||
"description": "员工成本价加价(如:加价50,不是加价后的价格)",
|
||||
"type": "integer"
|
||||
},
|
||||
"staff_profit": {
|
||||
|
@ -7222,6 +7269,14 @@ const docTemplate = `{
|
|||
"models.ErpOrderListReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"audit_time_end": {
|
||||
"description": "审核结束时间",
|
||||
"type": "string"
|
||||
},
|
||||
"audit_time_start": {
|
||||
"description": "审核开始时间",
|
||||
"type": "string"
|
||||
},
|
||||
"bill_sn": {
|
||||
"description": "单据编号",
|
||||
"type": "string"
|
||||
|
@ -7230,8 +7285,12 @@ const docTemplate = `{
|
|||
"description": "商品名称",
|
||||
"type": "string"
|
||||
},
|
||||
"end_time": {
|
||||
"description": "结束时间",
|
||||
"make_time_end": {
|
||||
"description": "制单结束时间",
|
||||
"type": "string"
|
||||
},
|
||||
"make_time_start": {
|
||||
"description": "制单开始时间",
|
||||
"type": "string"
|
||||
},
|
||||
"pageIndex": {
|
||||
|
@ -7258,10 +7317,6 @@ const docTemplate = `{
|
|||
"description": "扫码枪扫码数据:串码",
|
||||
"type": "string"
|
||||
},
|
||||
"start_time": {
|
||||
"description": "开始时间",
|
||||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"description": "订单状态",
|
||||
"type": "string"
|
||||
|
@ -7613,7 +7668,7 @@ const docTemplate = `{
|
|||
"models.ErpOrderSales": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"uid"
|
||||
"userId"
|
||||
],
|
||||
"properties": {
|
||||
"createdAt": {
|
||||
|
@ -7644,8 +7699,8 @@ const docTemplate = `{
|
|||
"description": "员工毛利提成:每个商品员工毛利X其对应的提成比例后求和;如果是两个销售员参与则分别除以2 ,保留到小数后两位多余舍去",
|
||||
"type": "number"
|
||||
},
|
||||
"uid": {
|
||||
"description": "销售员用户ID",
|
||||
"userId": {
|
||||
"description": "销售员用户ID(20240322:更换为系统用户表主键id)",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
|
@ -7757,6 +7812,18 @@ const docTemplate = `{
|
|||
"description": "默认员工成本价",
|
||||
"type": "number"
|
||||
},
|
||||
"effective_count": {
|
||||
"description": "有效数量(该商品实际库存详情处剩余有效数,不包含已出库的数量)",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_category_id": {
|
||||
"description": "商品分类id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_category_name": {
|
||||
"description": "商品分类名称",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_commodity_id": {
|
||||
"description": "商品id",
|
||||
"type": "integer"
|
||||
|
@ -8119,6 +8186,10 @@ const docTemplate = `{
|
|||
"description": "商品采购订单id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_stock_commodity_id": {
|
||||
"description": "库存商品表主键id",
|
||||
"type": "integer"
|
||||
},
|
||||
"id": {
|
||||
"description": "数据库记录编号",
|
||||
"type": "integer"
|
||||
|
@ -8128,7 +8199,7 @@ const docTemplate = `{
|
|||
"type": "string"
|
||||
},
|
||||
"imei_type": {
|
||||
"description": "1-无串码 2-串码",
|
||||
"description": "1-无串码 2-串码(系统生成) 3-串码(手动添加)",
|
||||
"type": "integer"
|
||||
},
|
||||
"implementation_price": {
|
||||
|
@ -8158,8 +8229,6 @@ const docTemplate = `{
|
|||
"required": [
|
||||
"erp_purchase_order_id",
|
||||
"inventories",
|
||||
"inventory_id",
|
||||
"inventory_name",
|
||||
"purchase_type"
|
||||
],
|
||||
"properties": {
|
||||
|
@ -8298,7 +8367,7 @@ const docTemplate = `{
|
|||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"description": "1-待审核 2-待入库 3-待退货 4-已完成 5-已终止 6-入库中 7-退货中",
|
||||
"description": "1-待审核 2-待入库 3-待退货 4-已完成 5-已终止",
|
||||
"type": "integer"
|
||||
},
|
||||
"store_id": {
|
||||
|
@ -8315,7 +8384,7 @@ const docTemplate = `{
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"audit_flag": {
|
||||
"description": "审核标记(默认展示所有):ON-订单只展示已审核的采购入库订单,含待入库/已终止/已完成",
|
||||
"description": "审核标记(默认展示所有):ON-订单只展示已审核的采购入库订单,含待入库/已终止/已完成/入库中",
|
||||
"type": "string"
|
||||
},
|
||||
"audit_time_end": {
|
||||
|
@ -8352,7 +8421,10 @@ const docTemplate = `{
|
|||
},
|
||||
"state": {
|
||||
"description": "状态:1-待审核 2-待入库 3-待退货 4-已完成 5-已终止",
|
||||
"type": "integer"
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"store_id": {
|
||||
"description": "门店id",
|
||||
|
@ -8434,7 +8506,7 @@ const docTemplate = `{
|
|||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"description": "1-待审核 2-待入库 3-待退货 4-已完成 5-已终止",
|
||||
"description": "2-待入库 3-待退货 4-已完成 5-已终止",
|
||||
"type": "integer"
|
||||
},
|
||||
"store_id": {
|
||||
|
@ -8561,7 +8633,7 @@ const docTemplate = `{
|
|||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"description": "1-待审核 2-待入库 3-待退货 4-已完成 5-已终止",
|
||||
"description": "2-待入库 3-待退货 4-已完成 5-已终止",
|
||||
"type": "integer"
|
||||
},
|
||||
"store_id": {
|
||||
|
@ -8689,65 +8761,7 @@ const docTemplate = `{
|
|||
"description": "供应商采购汇总信息",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"amount": {
|
||||
"description": "采购金额",
|
||||
"type": "number"
|
||||
},
|
||||
"count": {
|
||||
"description": "采购数量",
|
||||
"type": "integer"
|
||||
},
|
||||
"difference": {
|
||||
"description": "差额",
|
||||
"type": "number"
|
||||
},
|
||||
"erp_category_id": {
|
||||
"description": "商品分类id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_category_name": {
|
||||
"description": "商品分类名称",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_commodity_id": {
|
||||
"description": "商品id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_commodity_name": {
|
||||
"description": "商品名称",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_purchase_order_id": {
|
||||
"description": "采购订单id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_supplier_id": {
|
||||
"description": "供应商id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_supplier_name": {
|
||||
"description": "供应商名称",
|
||||
"type": "string"
|
||||
},
|
||||
"purchase_type": {
|
||||
"description": "采购类型:procure-采购 reject-退货",
|
||||
"type": "string"
|
||||
},
|
||||
"reject_amount": {
|
||||
"description": "退货金额",
|
||||
"type": "number"
|
||||
},
|
||||
"store_id": {
|
||||
"description": "门店id",
|
||||
"type": "integer"
|
||||
},
|
||||
"store_name": {
|
||||
"description": "门店名称",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
"$ref": "#/definitions/models.PurchaseReportData"
|
||||
}
|
||||
},
|
||||
"pageIndex": {
|
||||
|
@ -8905,6 +8919,10 @@ const docTemplate = `{
|
|||
"description": "退货价",
|
||||
"type": "number"
|
||||
},
|
||||
"serial_number": {
|
||||
"description": "采购入库编号",
|
||||
"type": "string"
|
||||
},
|
||||
"store_id": {
|
||||
"description": "门店id",
|
||||
"type": "integer"
|
||||
|
@ -9114,7 +9132,7 @@ const docTemplate = `{
|
|||
"type": "integer"
|
||||
},
|
||||
"staff_cost_price": {
|
||||
"description": "员工成本价加价",
|
||||
"description": "员工成本价加价(如:加价50,不是加价后的价格)",
|
||||
"type": "integer"
|
||||
},
|
||||
"state": {
|
||||
|
@ -9126,7 +9144,7 @@ const docTemplate = `{
|
|||
"type": "string"
|
||||
},
|
||||
"stock_sn": {
|
||||
"description": "库存订单编号",
|
||||
"description": "库存订单编号(跟采购入库的入库编号关联)",
|
||||
"type": "string"
|
||||
},
|
||||
"stock_start_time": {
|
||||
|
@ -10020,9 +10038,6 @@ const docTemplate = `{
|
|||
"models.MallUserVmRecordResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"list": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
@ -10034,6 +10049,9 @@ const docTemplate = `{
|
|||
},
|
||||
"page_size": {
|
||||
"type": "integer"
|
||||
},
|
||||
"total": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -10245,6 +10263,14 @@ const docTemplate = `{
|
|||
"description": "页面条数",
|
||||
"type": "integer"
|
||||
},
|
||||
"sort_field": {
|
||||
"description": "排序字段:滞纳金传\"forfeit_penalty\"",
|
||||
"type": "string"
|
||||
},
|
||||
"sort_type": {
|
||||
"description": "排序类型:desc 降序、asc 升序",
|
||||
"type": "string"
|
||||
},
|
||||
"store_id": {
|
||||
"description": "门店id",
|
||||
"type": "integer"
|
||||
|
@ -10716,6 +10742,67 @@ const docTemplate = `{
|
|||
}
|
||||
}
|
||||
},
|
||||
"models.PurchaseReportData": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"amount": {
|
||||
"description": "采购金额",
|
||||
"type": "number"
|
||||
},
|
||||
"count": {
|
||||
"description": "采购数量",
|
||||
"type": "integer"
|
||||
},
|
||||
"difference": {
|
||||
"description": "差额",
|
||||
"type": "number"
|
||||
},
|
||||
"erp_category_id": {
|
||||
"description": "商品分类id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_category_name": {
|
||||
"description": "商品分类名称",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_commodity_id": {
|
||||
"description": "商品id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_commodity_name": {
|
||||
"description": "商品名称",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_purchase_order_id": {
|
||||
"description": "采购订单id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_supplier_id": {
|
||||
"description": "供应商id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_supplier_name": {
|
||||
"description": "供应商名称",
|
||||
"type": "string"
|
||||
},
|
||||
"purchase_type": {
|
||||
"description": "采购类型:procure-采购 reject-退货",
|
||||
"type": "string"
|
||||
},
|
||||
"reject_amount": {
|
||||
"description": "退货金额",
|
||||
"type": "number"
|
||||
},
|
||||
"store_id": {
|
||||
"description": "门店id",
|
||||
"type": "integer"
|
||||
},
|
||||
"store_name": {
|
||||
"description": "门店名称",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.QueryCodeReq": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
@ -11908,6 +11995,157 @@ const docTemplate = `{
|
|||
}
|
||||
}
|
||||
},
|
||||
"models.SysUserListResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"count": {
|
||||
"description": "总条数",
|
||||
"type": "integer"
|
||||
},
|
||||
"list": {
|
||||
"description": "采购报表信息",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.SysUserPage"
|
||||
}
|
||||
},
|
||||
"pageIndex": {
|
||||
"description": "页码",
|
||||
"type": "integer"
|
||||
},
|
||||
"pageSize": {
|
||||
"description": "页面条数",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.SysUserPage": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"account_type": {
|
||||
"description": "账号类型:1-管理端",
|
||||
"type": "integer"
|
||||
},
|
||||
"avatar": {
|
||||
"description": "头像",
|
||||
"type": "string"
|
||||
},
|
||||
"cooperative_business_id": {
|
||||
"description": "合作商id",
|
||||
"type": "integer"
|
||||
},
|
||||
"cooperative_name": {
|
||||
"description": "合作商名称",
|
||||
"type": "string"
|
||||
},
|
||||
"createBy": {
|
||||
"type": "string"
|
||||
},
|
||||
"createdAt": {
|
||||
"description": "创建时间",
|
||||
"type": "string"
|
||||
},
|
||||
"dataScope": {
|
||||
"type": "string"
|
||||
},
|
||||
"deletedAt": {
|
||||
"description": "删除时间",
|
||||
"type": "string"
|
||||
},
|
||||
"deptId": {
|
||||
"description": "部门编码",
|
||||
"type": "integer"
|
||||
},
|
||||
"deptName": {
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"description": "邮箱",
|
||||
"type": "string"
|
||||
},
|
||||
"nickName": {
|
||||
"description": "昵称",
|
||||
"type": "string"
|
||||
},
|
||||
"params": {
|
||||
"type": "string"
|
||||
},
|
||||
"password": {
|
||||
"description": "密码",
|
||||
"type": "string"
|
||||
},
|
||||
"phone": {
|
||||
"description": "手机号",
|
||||
"type": "string"
|
||||
},
|
||||
"postId": {
|
||||
"description": "职位编码",
|
||||
"type": "integer"
|
||||
},
|
||||
"remark": {
|
||||
"description": "备注",
|
||||
"type": "string"
|
||||
},
|
||||
"roleId": {
|
||||
"description": "角色编码",
|
||||
"type": "integer"
|
||||
},
|
||||
"sales_comm_rate": {
|
||||
"description": "销售提成比例",
|
||||
"type": "number"
|
||||
},
|
||||
"salt": {
|
||||
"description": "盐",
|
||||
"type": "string"
|
||||
},
|
||||
"sex": {
|
||||
"description": "性别",
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"description": "状态",
|
||||
"type": "string"
|
||||
},
|
||||
"store_data": {
|
||||
"description": "有效门店",
|
||||
"type": "string"
|
||||
},
|
||||
"store_id": {
|
||||
"description": "门店id",
|
||||
"type": "integer"
|
||||
},
|
||||
"store_list": {
|
||||
"description": "有效门店列表",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.StoreInfo"
|
||||
}
|
||||
},
|
||||
"store_name": {
|
||||
"description": "门店名称",
|
||||
"type": "string"
|
||||
},
|
||||
"uid": {
|
||||
"description": "用户uid todo 待添加",
|
||||
"type": "integer"
|
||||
},
|
||||
"updateBy": {
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"description": "更新时间",
|
||||
"type": "string"
|
||||
},
|
||||
"userId": {
|
||||
"description": "编码",
|
||||
"type": "integer"
|
||||
},
|
||||
"username": {
|
||||
"description": "用户名",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.TableData": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
|
@ -4550,16 +4550,58 @@
|
|||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "username",
|
||||
"description": "用户名称",
|
||||
"name": "username",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "状态:0-正常,1-停用",
|
||||
"name": "status",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "手机号",
|
||||
"name": "phone",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "页码",
|
||||
"name": "pageIndex",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "页面条数",
|
||||
"name": "pageSize",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "角色id",
|
||||
"name": "roleId",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "昵称",
|
||||
"name": "nickName",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "门店id",
|
||||
"name": "storeId",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "{\"code\": -1, \"message\": \"抱歉未找到相关信息\"}",
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
"$ref": "#/definitions/models.SysUserListResp"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5105,11 +5147,7 @@
|
|||
"erp_category_id",
|
||||
"erp_supplier_id",
|
||||
"is_imei",
|
||||
"min_retail_price",
|
||||
"name",
|
||||
"retail_price",
|
||||
"staff_cost_price",
|
||||
"wholesale_price"
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"brokerage_1": {
|
||||
|
@ -5206,11 +5244,8 @@
|
|||
"erp_supplier_id",
|
||||
"id",
|
||||
"imei_type",
|
||||
"min_retail_price",
|
||||
"name",
|
||||
"retail_price",
|
||||
"staff_cost_price",
|
||||
"wholesale_price"
|
||||
"is_imei",
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"brokerage_1": {
|
||||
|
@ -5241,6 +5276,10 @@
|
|||
"description": "1-无串码 2-串码(系统生成) 3-串码(手动添加)",
|
||||
"type": "integer"
|
||||
},
|
||||
"is_imei": {
|
||||
"description": "是否串码:1-串码类 2-非串码",
|
||||
"type": "integer"
|
||||
},
|
||||
"member_discount": {
|
||||
"description": "会员优惠",
|
||||
"type": "number"
|
||||
|
@ -6445,10 +6484,6 @@
|
|||
"models.ErpCashierListResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"count": {
|
||||
"description": "数据总条数",
|
||||
"type": "integer"
|
||||
},
|
||||
"list": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
@ -6462,6 +6497,10 @@
|
|||
"pageSize": {
|
||||
"description": "每页展示条数",
|
||||
"type": "integer"
|
||||
},
|
||||
"total": {
|
||||
"description": "数据总条数",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -6600,7 +6639,11 @@
|
|||
"type": "string"
|
||||
},
|
||||
"staff_cost_price": {
|
||||
"description": "员工成本价加价",
|
||||
"description": "员工成本价加价(如:加价50,不是加价后的价格)",
|
||||
"type": "integer"
|
||||
},
|
||||
"stock_count": {
|
||||
"description": "库存数量",
|
||||
"type": "integer"
|
||||
},
|
||||
"wholesale_price": {
|
||||
|
@ -7027,6 +7070,10 @@
|
|||
"description": "零售订单id(后端生成)",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_stock_commodity_id": {
|
||||
"description": "库存商品表主键id",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_supplier_id": {
|
||||
"description": "主供应商id",
|
||||
"type": "integer"
|
||||
|
@ -7100,7 +7147,7 @@
|
|||
"type": "number"
|
||||
},
|
||||
"staff_cost_price": {
|
||||
"description": "员工成本价加价",
|
||||
"description": "员工成本价加价(如:加价50,不是加价后的价格)",
|
||||
"type": "integer"
|
||||
},
|
||||
"staff_profit": {
|
||||
|
@ -7211,6 +7258,14 @@
|
|||
"models.ErpOrderListReq": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"audit_time_end": {
|
||||
"description": "审核结束时间",
|
||||
"type": "string"
|
||||
},
|
||||
"audit_time_start": {
|
||||
"description": "审核开始时间",
|
||||
"type": "string"
|
||||
},
|
||||
"bill_sn": {
|
||||
"description": "单据编号",
|
||||
"type": "string"
|
||||
|
@ -7219,8 +7274,12 @@
|
|||
"description": "商品名称",
|
||||
"type": "string"
|
||||
},
|
||||
"end_time": {
|
||||
"description": "结束时间",
|
||||
"make_time_end": {
|
||||
"description": "制单结束时间",
|
||||
"type": "string"
|
||||
},
|
||||
"make_time_start": {
|
||||
"description": "制单开始时间",
|
||||
"type": "string"
|
||||
},
|
||||
"pageIndex": {
|
||||
|
@ -7247,10 +7306,6 @@
|
|||
"description": "扫码枪扫码数据:串码",
|
||||
"type": "string"
|
||||
},
|
||||
"start_time": {
|
||||
"description": "开始时间",
|
||||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"description": "订单状态",
|
||||
"type": "string"
|
||||
|
@ -7602,7 +7657,7 @@
|
|||
"models.ErpOrderSales": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"uid"
|
||||
"userId"
|
||||
],
|
||||
"properties": {
|
||||
"createdAt": {
|
||||
|
@ -7633,8 +7688,8 @@
|
|||
"description": "员工毛利提成:每个商品员工毛利X其对应的提成比例后求和;如果是两个销售员参与则分别除以2 ,保留到小数后两位多余舍去",
|
||||
"type": "number"
|
||||
},
|
||||
"uid": {
|
||||
"description": "销售员用户ID",
|
||||
"userId": {
|
||||
"description": "销售员用户ID(20240322:更换为系统用户表主键id)",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
|
@ -7746,6 +7801,18 @@
|
|||
"description": "默认员工成本价",
|
||||
"type": "number"
|
||||
},
|
||||
"effective_count": {
|
||||
"description": "有效数量(该商品实际库存详情处剩余有效数,不包含已出库的数量)",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_category_id": {
|
||||
"description": "商品分类id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_category_name": {
|
||||
"description": "商品分类名称",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_commodity_id": {
|
||||
"description": "商品id",
|
||||
"type": "integer"
|
||||
|
@ -8108,6 +8175,10 @@
|
|||
"description": "商品采购订单id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_stock_commodity_id": {
|
||||
"description": "库存商品表主键id",
|
||||
"type": "integer"
|
||||
},
|
||||
"id": {
|
||||
"description": "数据库记录编号",
|
||||
"type": "integer"
|
||||
|
@ -8117,7 +8188,7 @@
|
|||
"type": "string"
|
||||
},
|
||||
"imei_type": {
|
||||
"description": "1-无串码 2-串码",
|
||||
"description": "1-无串码 2-串码(系统生成) 3-串码(手动添加)",
|
||||
"type": "integer"
|
||||
},
|
||||
"implementation_price": {
|
||||
|
@ -8147,8 +8218,6 @@
|
|||
"required": [
|
||||
"erp_purchase_order_id",
|
||||
"inventories",
|
||||
"inventory_id",
|
||||
"inventory_name",
|
||||
"purchase_type"
|
||||
],
|
||||
"properties": {
|
||||
|
@ -8287,7 +8356,7 @@
|
|||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"description": "1-待审核 2-待入库 3-待退货 4-已完成 5-已终止 6-入库中 7-退货中",
|
||||
"description": "1-待审核 2-待入库 3-待退货 4-已完成 5-已终止",
|
||||
"type": "integer"
|
||||
},
|
||||
"store_id": {
|
||||
|
@ -8304,7 +8373,7 @@
|
|||
"type": "object",
|
||||
"properties": {
|
||||
"audit_flag": {
|
||||
"description": "审核标记(默认展示所有):ON-订单只展示已审核的采购入库订单,含待入库/已终止/已完成",
|
||||
"description": "审核标记(默认展示所有):ON-订单只展示已审核的采购入库订单,含待入库/已终止/已完成/入库中",
|
||||
"type": "string"
|
||||
},
|
||||
"audit_time_end": {
|
||||
|
@ -8341,7 +8410,10 @@
|
|||
},
|
||||
"state": {
|
||||
"description": "状态:1-待审核 2-待入库 3-待退货 4-已完成 5-已终止",
|
||||
"type": "integer"
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"store_id": {
|
||||
"description": "门店id",
|
||||
|
@ -8423,7 +8495,7 @@
|
|||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"description": "1-待审核 2-待入库 3-待退货 4-已完成 5-已终止",
|
||||
"description": "2-待入库 3-待退货 4-已完成 5-已终止",
|
||||
"type": "integer"
|
||||
},
|
||||
"store_id": {
|
||||
|
@ -8550,7 +8622,7 @@
|
|||
"type": "string"
|
||||
},
|
||||
"state": {
|
||||
"description": "1-待审核 2-待入库 3-待退货 4-已完成 5-已终止",
|
||||
"description": "2-待入库 3-待退货 4-已完成 5-已终止",
|
||||
"type": "integer"
|
||||
},
|
||||
"store_id": {
|
||||
|
@ -8678,65 +8750,7 @@
|
|||
"description": "供应商采购汇总信息",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"amount": {
|
||||
"description": "采购金额",
|
||||
"type": "number"
|
||||
},
|
||||
"count": {
|
||||
"description": "采购数量",
|
||||
"type": "integer"
|
||||
},
|
||||
"difference": {
|
||||
"description": "差额",
|
||||
"type": "number"
|
||||
},
|
||||
"erp_category_id": {
|
||||
"description": "商品分类id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_category_name": {
|
||||
"description": "商品分类名称",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_commodity_id": {
|
||||
"description": "商品id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_commodity_name": {
|
||||
"description": "商品名称",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_purchase_order_id": {
|
||||
"description": "采购订单id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_supplier_id": {
|
||||
"description": "供应商id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_supplier_name": {
|
||||
"description": "供应商名称",
|
||||
"type": "string"
|
||||
},
|
||||
"purchase_type": {
|
||||
"description": "采购类型:procure-采购 reject-退货",
|
||||
"type": "string"
|
||||
},
|
||||
"reject_amount": {
|
||||
"description": "退货金额",
|
||||
"type": "number"
|
||||
},
|
||||
"store_id": {
|
||||
"description": "门店id",
|
||||
"type": "integer"
|
||||
},
|
||||
"store_name": {
|
||||
"description": "门店名称",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
"$ref": "#/definitions/models.PurchaseReportData"
|
||||
}
|
||||
},
|
||||
"pageIndex": {
|
||||
|
@ -8894,6 +8908,10 @@
|
|||
"description": "退货价",
|
||||
"type": "number"
|
||||
},
|
||||
"serial_number": {
|
||||
"description": "采购入库编号",
|
||||
"type": "string"
|
||||
},
|
||||
"store_id": {
|
||||
"description": "门店id",
|
||||
"type": "integer"
|
||||
|
@ -9103,7 +9121,7 @@
|
|||
"type": "integer"
|
||||
},
|
||||
"staff_cost_price": {
|
||||
"description": "员工成本价加价",
|
||||
"description": "员工成本价加价(如:加价50,不是加价后的价格)",
|
||||
"type": "integer"
|
||||
},
|
||||
"state": {
|
||||
|
@ -9115,7 +9133,7 @@
|
|||
"type": "string"
|
||||
},
|
||||
"stock_sn": {
|
||||
"description": "库存订单编号",
|
||||
"description": "库存订单编号(跟采购入库的入库编号关联)",
|
||||
"type": "string"
|
||||
},
|
||||
"stock_start_time": {
|
||||
|
@ -10009,9 +10027,6 @@
|
|||
"models.MallUserVmRecordResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"count": {
|
||||
"type": "integer"
|
||||
},
|
||||
"list": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
@ -10023,6 +10038,9 @@
|
|||
},
|
||||
"page_size": {
|
||||
"type": "integer"
|
||||
},
|
||||
"total": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -10234,6 +10252,14 @@
|
|||
"description": "页面条数",
|
||||
"type": "integer"
|
||||
},
|
||||
"sort_field": {
|
||||
"description": "排序字段:滞纳金传\"forfeit_penalty\"",
|
||||
"type": "string"
|
||||
},
|
||||
"sort_type": {
|
||||
"description": "排序类型:desc 降序、asc 升序",
|
||||
"type": "string"
|
||||
},
|
||||
"store_id": {
|
||||
"description": "门店id",
|
||||
"type": "integer"
|
||||
|
@ -10705,6 +10731,67 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"models.PurchaseReportData": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"amount": {
|
||||
"description": "采购金额",
|
||||
"type": "number"
|
||||
},
|
||||
"count": {
|
||||
"description": "采购数量",
|
||||
"type": "integer"
|
||||
},
|
||||
"difference": {
|
||||
"description": "差额",
|
||||
"type": "number"
|
||||
},
|
||||
"erp_category_id": {
|
||||
"description": "商品分类id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_category_name": {
|
||||
"description": "商品分类名称",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_commodity_id": {
|
||||
"description": "商品id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_commodity_name": {
|
||||
"description": "商品名称",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_purchase_order_id": {
|
||||
"description": "采购订单id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_supplier_id": {
|
||||
"description": "供应商id",
|
||||
"type": "integer"
|
||||
},
|
||||
"erp_supplier_name": {
|
||||
"description": "供应商名称",
|
||||
"type": "string"
|
||||
},
|
||||
"purchase_type": {
|
||||
"description": "采购类型:procure-采购 reject-退货",
|
||||
"type": "string"
|
||||
},
|
||||
"reject_amount": {
|
||||
"description": "退货金额",
|
||||
"type": "number"
|
||||
},
|
||||
"store_id": {
|
||||
"description": "门店id",
|
||||
"type": "integer"
|
||||
},
|
||||
"store_name": {
|
||||
"description": "门店名称",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.QueryCodeReq": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
|
@ -11897,6 +11984,157 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"models.SysUserListResp": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"count": {
|
||||
"description": "总条数",
|
||||
"type": "integer"
|
||||
},
|
||||
"list": {
|
||||
"description": "采购报表信息",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.SysUserPage"
|
||||
}
|
||||
},
|
||||
"pageIndex": {
|
||||
"description": "页码",
|
||||
"type": "integer"
|
||||
},
|
||||
"pageSize": {
|
||||
"description": "页面条数",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.SysUserPage": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"account_type": {
|
||||
"description": "账号类型:1-管理端",
|
||||
"type": "integer"
|
||||
},
|
||||
"avatar": {
|
||||
"description": "头像",
|
||||
"type": "string"
|
||||
},
|
||||
"cooperative_business_id": {
|
||||
"description": "合作商id",
|
||||
"type": "integer"
|
||||
},
|
||||
"cooperative_name": {
|
||||
"description": "合作商名称",
|
||||
"type": "string"
|
||||
},
|
||||
"createBy": {
|
||||
"type": "string"
|
||||
},
|
||||
"createdAt": {
|
||||
"description": "创建时间",
|
||||
"type": "string"
|
||||
},
|
||||
"dataScope": {
|
||||
"type": "string"
|
||||
},
|
||||
"deletedAt": {
|
||||
"description": "删除时间",
|
||||
"type": "string"
|
||||
},
|
||||
"deptId": {
|
||||
"description": "部门编码",
|
||||
"type": "integer"
|
||||
},
|
||||
"deptName": {
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"description": "邮箱",
|
||||
"type": "string"
|
||||
},
|
||||
"nickName": {
|
||||
"description": "昵称",
|
||||
"type": "string"
|
||||
},
|
||||
"params": {
|
||||
"type": "string"
|
||||
},
|
||||
"password": {
|
||||
"description": "密码",
|
||||
"type": "string"
|
||||
},
|
||||
"phone": {
|
||||
"description": "手机号",
|
||||
"type": "string"
|
||||
},
|
||||
"postId": {
|
||||
"description": "职位编码",
|
||||
"type": "integer"
|
||||
},
|
||||
"remark": {
|
||||
"description": "备注",
|
||||
"type": "string"
|
||||
},
|
||||
"roleId": {
|
||||
"description": "角色编码",
|
||||
"type": "integer"
|
||||
},
|
||||
"sales_comm_rate": {
|
||||
"description": "销售提成比例",
|
||||
"type": "number"
|
||||
},
|
||||
"salt": {
|
||||
"description": "盐",
|
||||
"type": "string"
|
||||
},
|
||||
"sex": {
|
||||
"description": "性别",
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"description": "状态",
|
||||
"type": "string"
|
||||
},
|
||||
"store_data": {
|
||||
"description": "有效门店",
|
||||
"type": "string"
|
||||
},
|
||||
"store_id": {
|
||||
"description": "门店id",
|
||||
"type": "integer"
|
||||
},
|
||||
"store_list": {
|
||||
"description": "有效门店列表",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.StoreInfo"
|
||||
}
|
||||
},
|
||||
"store_name": {
|
||||
"description": "门店名称",
|
||||
"type": "string"
|
||||
},
|
||||
"uid": {
|
||||
"description": "用户uid todo 待添加",
|
||||
"type": "integer"
|
||||
},
|
||||
"updateBy": {
|
||||
"type": "string"
|
||||
},
|
||||
"updatedAt": {
|
||||
"description": "更新时间",
|
||||
"type": "string"
|
||||
},
|
||||
"userId": {
|
||||
"description": "编码",
|
||||
"type": "integer"
|
||||
},
|
||||
"username": {
|
||||
"description": "用户名",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.TableData": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
|
|
@ -154,11 +154,7 @@ definitions:
|
|||
- erp_category_id
|
||||
- erp_supplier_id
|
||||
- is_imei
|
||||
- min_retail_price
|
||||
- name
|
||||
- retail_price
|
||||
- staff_cost_price
|
||||
- wholesale_price
|
||||
type: object
|
||||
basic.CommodityDelRequest:
|
||||
properties:
|
||||
|
@ -200,6 +196,9 @@ definitions:
|
|||
imei_type:
|
||||
description: 1-无串码 2-串码(系统生成) 3-串码(手动添加)
|
||||
type: integer
|
||||
is_imei:
|
||||
description: 是否串码:1-串码类 2-非串码
|
||||
type: integer
|
||||
member_discount:
|
||||
description: 会员优惠
|
||||
type: number
|
||||
|
@ -229,11 +228,8 @@ definitions:
|
|||
- erp_supplier_id
|
||||
- id
|
||||
- imei_type
|
||||
- min_retail_price
|
||||
- is_imei
|
||||
- name
|
||||
- retail_price
|
||||
- staff_cost_price
|
||||
- wholesale_price
|
||||
type: object
|
||||
basic.CreateCategoryRequest:
|
||||
properties:
|
||||
|
@ -1085,9 +1081,6 @@ definitions:
|
|||
type: object
|
||||
models.ErpCashierListResp:
|
||||
properties:
|
||||
count:
|
||||
description: 数据总条数
|
||||
type: integer
|
||||
list:
|
||||
items:
|
||||
$ref: '#/definitions/models.ErpCashier'
|
||||
|
@ -1098,6 +1091,9 @@ definitions:
|
|||
pageSize:
|
||||
description: 每页展示条数
|
||||
type: integer
|
||||
total:
|
||||
description: 数据总条数
|
||||
type: integer
|
||||
type: object
|
||||
models.ErpCategory:
|
||||
properties:
|
||||
|
@ -1198,7 +1194,10 @@ definitions:
|
|||
description: 商品编号
|
||||
type: string
|
||||
staff_cost_price:
|
||||
description: 员工成本价加价
|
||||
description: 员工成本价加价(如:加价50,不是加价后的价格)
|
||||
type: integer
|
||||
stock_count:
|
||||
description: 库存数量
|
||||
type: integer
|
||||
wholesale_price:
|
||||
description: 指导采购价
|
||||
|
@ -1511,6 +1510,9 @@ definitions:
|
|||
erp_order_id:
|
||||
description: 零售订单id(后端生成)
|
||||
type: integer
|
||||
erp_stock_commodity_id:
|
||||
description: 库存商品表主键id
|
||||
type: string
|
||||
erp_supplier_id:
|
||||
description: 主供应商id
|
||||
type: integer
|
||||
|
@ -1566,7 +1568,7 @@ definitions:
|
|||
description: 销售毛利:实际零售价-采购单价;如果为退货订单,则为实际退货价-采购单价
|
||||
type: number
|
||||
staff_cost_price:
|
||||
description: 员工成本价加价
|
||||
description: 员工成本价加价(如:加价50,不是加价后的价格)
|
||||
type: integer
|
||||
staff_profit:
|
||||
description: 员工毛利:实际零售价-员工成本价;如果为退货订单,则为实际退货价-员工成本价
|
||||
|
@ -1648,14 +1650,23 @@ definitions:
|
|||
type: object
|
||||
models.ErpOrderListReq:
|
||||
properties:
|
||||
audit_time_end:
|
||||
description: 审核结束时间
|
||||
type: string
|
||||
audit_time_start:
|
||||
description: 审核开始时间
|
||||
type: string
|
||||
bill_sn:
|
||||
description: 单据编号
|
||||
type: string
|
||||
commodity_name:
|
||||
description: 商品名称
|
||||
type: string
|
||||
end_time:
|
||||
description: 结束时间
|
||||
make_time_end:
|
||||
description: 制单结束时间
|
||||
type: string
|
||||
make_time_start:
|
||||
description: 制单开始时间
|
||||
type: string
|
||||
pageIndex:
|
||||
description: 页码
|
||||
|
@ -1675,9 +1686,6 @@ definitions:
|
|||
scan_code:
|
||||
description: 扫码枪扫码数据:串码
|
||||
type: string
|
||||
start_time:
|
||||
description: 开始时间
|
||||
type: string
|
||||
state:
|
||||
description: 订单状态
|
||||
type: string
|
||||
|
@ -1950,11 +1958,11 @@ definitions:
|
|||
staff_profit_per:
|
||||
description: 员工毛利提成:每个商品员工毛利X其对应的提成比例后求和;如果是两个销售员参与则分别除以2 ,保留到小数后两位多余舍去
|
||||
type: number
|
||||
uid:
|
||||
description: 销售员用户ID
|
||||
userId:
|
||||
description: 销售员用户ID(20240322:更换为系统用户表主键id)
|
||||
type: integer
|
||||
required:
|
||||
- uid
|
||||
- userId
|
||||
type: object
|
||||
models.ErpOrderShowConfig:
|
||||
properties:
|
||||
|
@ -2032,6 +2040,15 @@ definitions:
|
|||
default_employee_price:
|
||||
description: 默认员工成本价
|
||||
type: number
|
||||
effective_count:
|
||||
description: 有效数量(该商品实际库存详情处剩余有效数,不包含已出库的数量)
|
||||
type: integer
|
||||
erp_category_id:
|
||||
description: 商品分类id
|
||||
type: integer
|
||||
erp_category_name:
|
||||
description: 商品分类名称
|
||||
type: string
|
||||
erp_commodity_id:
|
||||
description: 商品id
|
||||
type: integer
|
||||
|
@ -2295,6 +2312,9 @@ definitions:
|
|||
erp_purchase_order_id:
|
||||
description: 商品采购订单id
|
||||
type: integer
|
||||
erp_stock_commodity_id:
|
||||
description: 库存商品表主键id
|
||||
type: integer
|
||||
id:
|
||||
description: 数据库记录编号
|
||||
type: integer
|
||||
|
@ -2302,7 +2322,7 @@ definitions:
|
|||
description: 商品串码
|
||||
type: string
|
||||
imei_type:
|
||||
description: 1-无串码 2-串码
|
||||
description: 1-无串码 2-串码(系统生成) 3-串码(手动添加)
|
||||
type: integer
|
||||
implementation_price:
|
||||
description: 执行单价
|
||||
|
@ -2344,8 +2364,6 @@ definitions:
|
|||
required:
|
||||
- erp_purchase_order_id
|
||||
- inventories
|
||||
- inventory_id
|
||||
- inventory_name
|
||||
- purchase_type
|
||||
type: object
|
||||
models.ErpPurchaseOrder:
|
||||
|
@ -2430,7 +2448,7 @@ definitions:
|
|||
description: 单据编号
|
||||
type: string
|
||||
state:
|
||||
description: 1-待审核 2-待入库 3-待退货 4-已完成 5-已终止 6-入库中 7-退货中
|
||||
description: 1-待审核 2-待入库 3-待退货 4-已完成 5-已终止
|
||||
type: integer
|
||||
store_id:
|
||||
description: 门店id
|
||||
|
@ -2442,7 +2460,7 @@ definitions:
|
|||
models.ErpPurchaseOrderListReq:
|
||||
properties:
|
||||
audit_flag:
|
||||
description: 审核标记(默认展示所有):ON-订单只展示已审核的采购入库订单,含待入库/已终止/已完成
|
||||
description: 审核标记(默认展示所有):ON-订单只展示已审核的采购入库订单,含待入库/已终止/已完成/入库中
|
||||
type: string
|
||||
audit_time_end:
|
||||
description: 审核结束时间
|
||||
|
@ -2470,7 +2488,9 @@ definitions:
|
|||
type: string
|
||||
state:
|
||||
description: 状态:1-待审核 2-待入库 3-待退货 4-已完成 5-已终止
|
||||
type: integer
|
||||
items:
|
||||
type: integer
|
||||
type: array
|
||||
store_id:
|
||||
description: 门店id
|
||||
type: integer
|
||||
|
@ -2529,7 +2549,7 @@ definitions:
|
|||
description: 单据编号
|
||||
type: string
|
||||
state:
|
||||
description: 1-待审核 2-待入库 3-待退货 4-已完成 5-已终止
|
||||
description: 2-待入库 3-待退货 4-已完成 5-已终止
|
||||
type: integer
|
||||
store_id:
|
||||
description: 门店id
|
||||
|
@ -2622,7 +2642,7 @@ definitions:
|
|||
description: 单据编号
|
||||
type: string
|
||||
state:
|
||||
description: 1-待审核 2-待入库 3-待退货 4-已完成 5-已终止
|
||||
description: 2-待入库 3-待退货 4-已完成 5-已终止
|
||||
type: integer
|
||||
store_id:
|
||||
description: 门店id
|
||||
|
@ -2714,50 +2734,7 @@ definitions:
|
|||
list:
|
||||
description: 供应商采购汇总信息
|
||||
items:
|
||||
properties:
|
||||
amount:
|
||||
description: 采购金额
|
||||
type: number
|
||||
count:
|
||||
description: 采购数量
|
||||
type: integer
|
||||
difference:
|
||||
description: 差额
|
||||
type: number
|
||||
erp_category_id:
|
||||
description: 商品分类id
|
||||
type: integer
|
||||
erp_category_name:
|
||||
description: 商品分类名称
|
||||
type: string
|
||||
erp_commodity_id:
|
||||
description: 商品id
|
||||
type: integer
|
||||
erp_commodity_name:
|
||||
description: 商品名称
|
||||
type: string
|
||||
erp_purchase_order_id:
|
||||
description: 采购订单id
|
||||
type: integer
|
||||
erp_supplier_id:
|
||||
description: 供应商id
|
||||
type: integer
|
||||
erp_supplier_name:
|
||||
description: 供应商名称
|
||||
type: string
|
||||
purchase_type:
|
||||
description: 采购类型:procure-采购 reject-退货
|
||||
type: string
|
||||
reject_amount:
|
||||
description: 退货金额
|
||||
type: number
|
||||
store_id:
|
||||
description: 门店id
|
||||
type: integer
|
||||
store_name:
|
||||
description: 门店名称
|
||||
type: string
|
||||
type: object
|
||||
$ref: '#/definitions/models.PurchaseReportData'
|
||||
type: array
|
||||
pageIndex:
|
||||
description: 页码
|
||||
|
@ -2873,6 +2850,9 @@ definitions:
|
|||
reject_price:
|
||||
description: 退货价
|
||||
type: number
|
||||
serial_number:
|
||||
description: 采购入库编号
|
||||
type: string
|
||||
store_id:
|
||||
description: 门店id
|
||||
type: integer
|
||||
|
@ -3027,7 +3007,7 @@ definitions:
|
|||
description: 指导零售价
|
||||
type: integer
|
||||
staff_cost_price:
|
||||
description: 员工成本价加价
|
||||
description: 员工成本价加价(如:加价50,不是加价后的价格)
|
||||
type: integer
|
||||
state:
|
||||
description: 状态:1-在库 2-已售 3-采购退货 4-调拨中 5-销售锁定中
|
||||
|
@ -3036,7 +3016,7 @@ definitions:
|
|||
description: 最近入库结束时间
|
||||
type: string
|
||||
stock_sn:
|
||||
description: 库存订单编号
|
||||
description: 库存订单编号(跟采购入库的入库编号关联)
|
||||
type: string
|
||||
stock_start_time:
|
||||
description: 最近入库开始时间
|
||||
|
@ -3682,8 +3662,6 @@ definitions:
|
|||
type: object
|
||||
models.MallUserVmRecordResp:
|
||||
properties:
|
||||
count:
|
||||
type: integer
|
||||
list:
|
||||
items:
|
||||
$ref: '#/definitions/models.MallUserVmRecordData'
|
||||
|
@ -3692,6 +3670,8 @@ definitions:
|
|||
type: integer
|
||||
page_size:
|
||||
type: integer
|
||||
total:
|
||||
type: integer
|
||||
type: object
|
||||
models.Menu:
|
||||
properties:
|
||||
|
@ -3841,6 +3821,12 @@ definitions:
|
|||
pageSize:
|
||||
description: 页面条数
|
||||
type: integer
|
||||
sort_field:
|
||||
description: 排序字段:滞纳金传"forfeit_penalty"
|
||||
type: string
|
||||
sort_type:
|
||||
description: 排序类型:desc 降序、asc 升序
|
||||
type: string
|
||||
store_id:
|
||||
description: 门店id
|
||||
type: integer
|
||||
|
@ -4175,6 +4161,51 @@ definitions:
|
|||
description: 更新时间
|
||||
type: string
|
||||
type: object
|
||||
models.PurchaseReportData:
|
||||
properties:
|
||||
amount:
|
||||
description: 采购金额
|
||||
type: number
|
||||
count:
|
||||
description: 采购数量
|
||||
type: integer
|
||||
difference:
|
||||
description: 差额
|
||||
type: number
|
||||
erp_category_id:
|
||||
description: 商品分类id
|
||||
type: integer
|
||||
erp_category_name:
|
||||
description: 商品分类名称
|
||||
type: string
|
||||
erp_commodity_id:
|
||||
description: 商品id
|
||||
type: integer
|
||||
erp_commodity_name:
|
||||
description: 商品名称
|
||||
type: string
|
||||
erp_purchase_order_id:
|
||||
description: 采购订单id
|
||||
type: integer
|
||||
erp_supplier_id:
|
||||
description: 供应商id
|
||||
type: integer
|
||||
erp_supplier_name:
|
||||
description: 供应商名称
|
||||
type: string
|
||||
purchase_type:
|
||||
description: 采购类型:procure-采购 reject-退货
|
||||
type: string
|
||||
reject_amount:
|
||||
description: 退货金额
|
||||
type: number
|
||||
store_id:
|
||||
description: 门店id
|
||||
type: integer
|
||||
store_name:
|
||||
description: 门店名称
|
||||
type: string
|
||||
type: object
|
||||
models.QueryCodeReq:
|
||||
properties:
|
||||
pageIndex:
|
||||
|
@ -5041,6 +5072,116 @@ definitions:
|
|||
description: 用户名
|
||||
type: string
|
||||
type: object
|
||||
models.SysUserListResp:
|
||||
properties:
|
||||
count:
|
||||
description: 总条数
|
||||
type: integer
|
||||
list:
|
||||
description: 采购报表信息
|
||||
items:
|
||||
$ref: '#/definitions/models.SysUserPage'
|
||||
type: array
|
||||
pageIndex:
|
||||
description: 页码
|
||||
type: integer
|
||||
pageSize:
|
||||
description: 页面条数
|
||||
type: integer
|
||||
type: object
|
||||
models.SysUserPage:
|
||||
properties:
|
||||
account_type:
|
||||
description: 账号类型:1-管理端
|
||||
type: integer
|
||||
avatar:
|
||||
description: 头像
|
||||
type: string
|
||||
cooperative_business_id:
|
||||
description: 合作商id
|
||||
type: integer
|
||||
cooperative_name:
|
||||
description: 合作商名称
|
||||
type: string
|
||||
createBy:
|
||||
type: string
|
||||
createdAt:
|
||||
description: 创建时间
|
||||
type: string
|
||||
dataScope:
|
||||
type: string
|
||||
deletedAt:
|
||||
description: 删除时间
|
||||
type: string
|
||||
deptId:
|
||||
description: 部门编码
|
||||
type: integer
|
||||
deptName:
|
||||
type: string
|
||||
email:
|
||||
description: 邮箱
|
||||
type: string
|
||||
nickName:
|
||||
description: 昵称
|
||||
type: string
|
||||
params:
|
||||
type: string
|
||||
password:
|
||||
description: 密码
|
||||
type: string
|
||||
phone:
|
||||
description: 手机号
|
||||
type: string
|
||||
postId:
|
||||
description: 职位编码
|
||||
type: integer
|
||||
remark:
|
||||
description: 备注
|
||||
type: string
|
||||
roleId:
|
||||
description: 角色编码
|
||||
type: integer
|
||||
sales_comm_rate:
|
||||
description: 销售提成比例
|
||||
type: number
|
||||
salt:
|
||||
description: 盐
|
||||
type: string
|
||||
sex:
|
||||
description: 性别
|
||||
type: string
|
||||
status:
|
||||
description: 状态
|
||||
type: string
|
||||
store_data:
|
||||
description: 有效门店
|
||||
type: string
|
||||
store_id:
|
||||
description: 门店id
|
||||
type: integer
|
||||
store_list:
|
||||
description: 有效门店列表
|
||||
items:
|
||||
$ref: '#/definitions/models.StoreInfo'
|
||||
type: array
|
||||
store_name:
|
||||
description: 门店名称
|
||||
type: string
|
||||
uid:
|
||||
description: 用户uid todo 待添加
|
||||
type: integer
|
||||
updateBy:
|
||||
type: string
|
||||
updatedAt:
|
||||
description: 更新时间
|
||||
type: string
|
||||
userId:
|
||||
description: 编码
|
||||
type: integer
|
||||
username:
|
||||
description: 用户名
|
||||
type: string
|
||||
type: object
|
||||
models.TableData:
|
||||
properties:
|
||||
DJ:
|
||||
|
@ -8409,15 +8550,43 @@ paths:
|
|||
get:
|
||||
description: 获取JSON
|
||||
parameters:
|
||||
- description: username
|
||||
- description: 用户名称
|
||||
in: query
|
||||
name: username
|
||||
type: string
|
||||
- description: 状态:0-正常,1-停用
|
||||
in: query
|
||||
name: status
|
||||
type: integer
|
||||
- description: 手机号
|
||||
in: query
|
||||
name: phone
|
||||
type: string
|
||||
- description: 页码
|
||||
in: query
|
||||
name: pageIndex
|
||||
type: string
|
||||
- description: 页面条数
|
||||
in: query
|
||||
name: pageSize
|
||||
type: string
|
||||
- description: 角色id
|
||||
in: query
|
||||
name: roleId
|
||||
type: string
|
||||
- description: 昵称
|
||||
in: query
|
||||
name: nickName
|
||||
type: string
|
||||
- description: 门店id
|
||||
in: query
|
||||
name: storeId
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: '{"code": -1, "message": "抱歉未找到相关信息"}'
|
||||
description: OK
|
||||
schema:
|
||||
type: string
|
||||
$ref: '#/definitions/models.SysUserListResp'
|
||||
security:
|
||||
- Bearer: []
|
||||
summary: 列表用户信息数据(update)
|
||||
|
|
Loading…
Reference in New Issue
Block a user