新增订单状态
This commit is contained in:
parent
889a56b046
commit
4555360bbb
|
|
@ -113,20 +113,20 @@ func (p DefParty) carServiceProcess() web_iris.Party {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if carServiceProcessRequest.Type == 1 {
|
if carServiceProcessRequest.Type == 1 {
|
||||||
if subOrderInfo.Status == 3 || subOrderInfo.Status == 2 {
|
if subOrderInfo.OrderStatus == 3 || subOrderInfo.OrderStatus == 2 {
|
||||||
OrderError.Fail(ctx, carServiceProcessRequest)
|
OrderError.Fail(ctx, carServiceProcessRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
subOrderInfo.Status = 2
|
subOrderInfo.OrderStatus = 2
|
||||||
mainOrder.Status = 2
|
mainOrder.OrderStatus = 2
|
||||||
database.Instance().Save(&mainOrder)
|
database.Instance().Save(&mainOrder)
|
||||||
database.Instance().Save(&subOrderInfo)
|
database.Instance().Save(&subOrderInfo)
|
||||||
} else if carServiceProcessRequest.Type == 2 {
|
} else if carServiceProcessRequest.Type == 2 {
|
||||||
if subOrderInfo.Status == 3 {
|
if subOrderInfo.OrderStatus == 3 {
|
||||||
OrderError.Fail(ctx, carServiceProcessRequest)
|
OrderError.Fail(ctx, carServiceProcessRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
subOrderInfo.Status = 3
|
subOrderInfo.OrderStatus = 3
|
||||||
subOrderInfo.PayAmount = carServiceProcessRequest.PayAmount
|
subOrderInfo.PayAmount = carServiceProcessRequest.PayAmount
|
||||||
if subOrderInfo.PayAmount == 0 {
|
if subOrderInfo.PayAmount == 0 {
|
||||||
subOrderInfo.PayAmount = subOrderInfo.TotalAmount
|
subOrderInfo.PayAmount = subOrderInfo.TotalAmount
|
||||||
|
|
@ -138,7 +138,7 @@ func (p DefParty) carServiceProcess() web_iris.Party {
|
||||||
var countStatus int64
|
var countStatus int64
|
||||||
database.Instance().Model(&models.OrderSub{}).Where("main_order_id = ? and status = 3", subOrderInfo.MainOrderId).Count(&countStatus)
|
database.Instance().Model(&models.OrderSub{}).Where("main_order_id = ? and status = 3", subOrderInfo.MainOrderId).Count(&countStatus)
|
||||||
if count == countStatus {
|
if count == countStatus {
|
||||||
mainOrder.Status = 3
|
mainOrder.OrderStatus = 3
|
||||||
database.Instance().Save(&mainOrder)
|
database.Instance().Save(&mainOrder)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ func (p DefParty) orderCreate() web_iris.Party {
|
||||||
orderMain := models.OrderMain{
|
orderMain := models.OrderMain{
|
||||||
OrderId: orderId,
|
OrderId: orderId,
|
||||||
Uid: headerBaseInfo.Uid,
|
Uid: headerBaseInfo.Uid,
|
||||||
Status: 1,
|
OrderStatus: 1,
|
||||||
ServiceTime: orderCreateRequest.ServiceTime,
|
ServiceTime: orderCreateRequest.ServiceTime,
|
||||||
ServiceAddrId: orderCreateRequest.ServiceAddrId,
|
ServiceAddrId: orderCreateRequest.ServiceAddrId,
|
||||||
ServiceRemark: "",
|
ServiceRemark: "",
|
||||||
|
|
@ -87,7 +87,7 @@ func (p DefParty) orderCreate() web_iris.Party {
|
||||||
orderSub := models.OrderSub{
|
orderSub := models.OrderSub{
|
||||||
OrderId: subOrderId,
|
OrderId: subOrderId,
|
||||||
MainOrderId: orderMain.OrderId,
|
MainOrderId: orderMain.OrderId,
|
||||||
Status: 1,
|
OrderStatus: 1,
|
||||||
PetId: value.PetId,
|
PetId: value.PetId,
|
||||||
PayType: 1,
|
PayType: 1,
|
||||||
Discount: 100,
|
Discount: 100,
|
||||||
|
|
@ -122,7 +122,7 @@ func GetOrderDetail(orderId string) OrderDetail {
|
||||||
database.Instance().Model(&models.UserServiceAddr{}).Where("id = ?", orderMain.ServiceAddrId).Find(&findUserServiceAddr)
|
database.Instance().Model(&models.UserServiceAddr{}).Where("id = ?", orderMain.ServiceAddrId).Find(&findUserServiceAddr)
|
||||||
orderDetail := OrderDetail{
|
orderDetail := OrderDetail{
|
||||||
OrderId: orderMain.OrderId,
|
OrderId: orderMain.OrderId,
|
||||||
Status: orderMain.Status,
|
Status: orderMain.OrderStatus,
|
||||||
ServiceTime: orderMain.ServiceTime,
|
ServiceTime: orderMain.ServiceTime,
|
||||||
ServiceAddr: findUserServiceAddr,
|
ServiceAddr: findUserServiceAddr,
|
||||||
ServiceRemark: orderMain.ServiceRemark,
|
ServiceRemark: orderMain.ServiceRemark,
|
||||||
|
|
@ -141,7 +141,7 @@ func GetOrderDetail(orderId string) OrderDetail {
|
||||||
}
|
}
|
||||||
orderSub := SubOrder{
|
orderSub := SubOrder{
|
||||||
OrderId: orderSub.OrderId,
|
OrderId: orderSub.OrderId,
|
||||||
Status: orderSub.Status,
|
Status: orderSub.OrderStatus,
|
||||||
UserPetInfo: GetUserPet(orderMain.Uid, orderSub.PetId),
|
UserPetInfo: GetUserPet(orderMain.Uid, orderSub.PetId),
|
||||||
TotalAmount: orderSub.TotalAmount,
|
TotalAmount: orderSub.TotalAmount,
|
||||||
PayAmount: orderSub.PayAmount,
|
PayAmount: orderSub.PayAmount,
|
||||||
|
|
@ -231,7 +231,7 @@ func (p DefParty) orderList() web_iris.Party {
|
||||||
database.Instance().Model(&models.UserServiceAddr{}).Where("id = ? and uid = ?", value.ServiceAddrId, headerBaseInfo.Uid).Find(&findUserServiceAddr)
|
database.Instance().Model(&models.UserServiceAddr{}).Where("id = ? and uid = ?", value.ServiceAddrId, headerBaseInfo.Uid).Find(&findUserServiceAddr)
|
||||||
orderListResponse := OrderDetail{
|
orderListResponse := OrderDetail{
|
||||||
OrderId: value.OrderId,
|
OrderId: value.OrderId,
|
||||||
Status: value.Status,
|
Status: value.OrderStatus,
|
||||||
ServiceTime: value.ServiceTime,
|
ServiceTime: value.ServiceTime,
|
||||||
ServiceAddr: findUserServiceAddr,
|
ServiceAddr: findUserServiceAddr,
|
||||||
ServiceRemark: value.ServiceRemark,
|
ServiceRemark: value.ServiceRemark,
|
||||||
|
|
@ -250,7 +250,7 @@ func (p DefParty) orderList() web_iris.Party {
|
||||||
}
|
}
|
||||||
orderSub := SubOrder{
|
orderSub := SubOrder{
|
||||||
OrderId: orderSub.OrderId,
|
OrderId: orderSub.OrderId,
|
||||||
Status: orderSub.Status,
|
Status: orderSub.OrderStatus,
|
||||||
UserPetInfo: GetUserPet(headerBaseInfo.Uid, orderSub.PetId),
|
UserPetInfo: GetUserPet(headerBaseInfo.Uid, orderSub.PetId),
|
||||||
TotalAmount: orderSub.TotalAmount,
|
TotalAmount: orderSub.TotalAmount,
|
||||||
PayAmount: orderSub.PayAmount,
|
PayAmount: orderSub.PayAmount,
|
||||||
|
|
@ -342,13 +342,13 @@ func (p DefParty) orderEdit() web_iris.Party {
|
||||||
OrderError.Fail(ctx, orderEditRequest)
|
OrderError.Fail(ctx, orderEditRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if orderSub.Status > 0 || orderEditRequest.Status == 0 {
|
if orderSub.OrderStatus > 0 || orderEditRequest.Status == 0 {
|
||||||
OrderError.Fail(ctx, orderEditRequest)
|
OrderError.Fail(ctx, orderEditRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
orderSub.Status = orderEditRequest.Status
|
orderSub.OrderStatus = orderEditRequest.Status
|
||||||
updateValues := map[string]interface{}{
|
updateValues := map[string]interface{}{
|
||||||
"Status": orderSub.Status,
|
"OrderStatus": orderSub.OrderStatus,
|
||||||
}
|
}
|
||||||
database.Instance().Model(&orderSub).Updates(&updateValues)
|
database.Instance().Model(&orderSub).Updates(&updateValues)
|
||||||
Success(ctx, orderEditRequest, GetOrderDetail(orderMain.OrderId))
|
Success(ctx, orderEditRequest, GetOrderDetail(orderMain.OrderId))
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ type OrderMain struct {
|
||||||
Id int64 `gorm:"primaryKey;autoIncrement" json:"id"` //id
|
Id int64 `gorm:"primaryKey;autoIncrement" json:"id"` //id
|
||||||
OrderId string `gorm:"index;unique;not null" json:"orderId"` //主订单号
|
OrderId string `gorm:"index;unique;not null" json:"orderId"` //主订单号
|
||||||
Uid int64 `gorm:"index;not null" json:"uid"` //用户id
|
Uid int64 `gorm:"index;not null" json:"uid"` //用户id
|
||||||
Status int `json:"status"` //主订单状态 1待服务 2服务中 3已完成 4已派单 5已取消
|
OrderStatus int `json:"status"` //主订单状态 1待服务 2服务中 3已完成 4已派单 5已取消
|
||||||
ServiceTime string `json:"serviceTime"` //服务时间
|
ServiceTime string `json:"serviceTime"` //服务时间
|
||||||
ProjectionServiceTime int `json:"projectionServiceTime"` //服务预估时长
|
ProjectionServiceTime int `json:"projectionServiceTime"` //服务预估时长
|
||||||
ServiceAddrId int64 `json:"serviceAddrId"` //服务地址信息
|
ServiceAddrId int64 `json:"serviceAddrId"` //服务地址信息
|
||||||
|
|
@ -126,7 +126,7 @@ type OrderSub struct {
|
||||||
Id int64 `gorm:"primaryKey;autoIncrement" json:"id"` //id
|
Id int64 `gorm:"primaryKey;autoIncrement" json:"id"` //id
|
||||||
OrderId string `gorm:"index" json:"orderId"` //子订单ID
|
OrderId string `gorm:"index" json:"orderId"` //子订单ID
|
||||||
MainOrderId string `gorm:"index" json:"mainOrderId"` //主订单ID
|
MainOrderId string `gorm:"index" json:"mainOrderId"` //主订单ID
|
||||||
Status int `gorm:"not null" json:"status"` //子订单状态 1待服务 2服务中 3已完成 4已取消
|
OrderStatus int `gorm:"not null" json:"status"` //子订单状态 1待服务 2服务中 3已完成 4已取消
|
||||||
PetId int64 `gorm:"index" json:"petId"` //宠物ID
|
PetId int64 `gorm:"index" json:"petId"` //宠物ID
|
||||||
PayType int `gorm:"not null" json:"payType"` //支付方式 1线下 2线上
|
PayType int `gorm:"not null" json:"payType"` //支付方式 1线下 2线上
|
||||||
Discount int `json:"discount"` //折扣
|
Discount int `json:"discount"` //折扣
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue