- save original price when accepted or rejected.
This commit is contained in:
@@ -1103,7 +1103,7 @@ func GetStoreOpRequests(ctx *jxcontext.Context, fromTime, toTime time.Time, keyw
|
||||
SELECT SQL_CALC_FOUND_ROWS
|
||||
t1.id, t1.created_at, t1.updated_at, t1.last_operator, t1.deleted_at,
|
||||
t1.type, t1.store_id, t1.item_id, t1.status, t1.user_id, t1.int_param1, t1.int_param2, t1.remark,
|
||||
t2.name store_name, t3.prefix sku_name_prefix, t3.name sku_name_name, MAX(t5.unit_price) unit_price
|
||||
t2.name store_name, t3.prefix sku_name_prefix, t3.name sku_name_name, MAX(IF(t1.status = ?, t5.unit_price, t1.int_param0)) unit_price
|
||||
FROM store_op_request t1
|
||||
JOIN store t2 ON t1.store_id = t2.id
|
||||
JOIN sku_name t3 ON t1.item_id = t3.id
|
||||
@@ -1111,6 +1111,7 @@ func GetStoreOpRequests(ctx *jxcontext.Context, fromTime, toTime time.Time, keyw
|
||||
LEFT JOIN store_sku_bind t5 ON t1.store_id = t5.store_id AND t4.id = t5.sku_id AND t5.deleted_at = ?
|
||||
WHERE 1 = 1`
|
||||
sqlParams := []interface{}{
|
||||
model.RequestStatusNew,
|
||||
utils.DefaultTimeValue,
|
||||
}
|
||||
if keyword != "" {
|
||||
@@ -1213,6 +1214,10 @@ func changeStoreOpStatus(ctx *jxcontext.Context, reqIDs []int, status int8, reje
|
||||
globals.SugarLogger.Debugf("changeStoreOpStatus, reqIDs:%v", reqIDs)
|
||||
if globals.EnablePendingChange {
|
||||
if len(reqIDs) > 0 {
|
||||
infoMap, err2 := getStoreOpRequestsInfo(reqIDs)
|
||||
if err = err2; err != nil {
|
||||
return err
|
||||
}
|
||||
db := dao.GetDB()
|
||||
dao.Begin(db)
|
||||
defer dao.Rollback(db)
|
||||
@@ -1220,11 +1225,14 @@ func changeStoreOpStatus(ctx *jxcontext.Context, reqIDs []int, status int8, reje
|
||||
op := &model.StoreOpRequest{}
|
||||
op.Remark = rejectReason
|
||||
op.Status = status
|
||||
if infoMap[reqID] != nil {
|
||||
op.IntParam0 = infoMap[reqID].UnitPrice
|
||||
}
|
||||
dao.WrapUpdateULEntity(op, ctx.GetUserName())
|
||||
op.DeletedAt = time.Now()
|
||||
op.ID = reqID
|
||||
// globals.SugarLogger.Debug(utils.Format4Output(op, false))
|
||||
if _, err = dao.UpdateEntity(db, op, "Remark", "Status", "DeletedAt", "LastOperator", "UpdatedAt"); err != nil {
|
||||
if _, err = dao.UpdateEntity(db, op, "IntParam0", "Remark", "Status", "DeletedAt", "LastOperator", "UpdatedAt"); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user