修改门店发单和品牌发单是扣费问题
This commit is contained in:
@@ -23,7 +23,7 @@ func init() {
|
||||
partner.InitStoreAcctManager(FixedStoreAcctManager)
|
||||
}
|
||||
|
||||
func InsertStoreAcctIncome(ctx *jxcontext.Context, storeID, price, acctType int, vendorOrderID string, expendID int) (err error) {
|
||||
func InsertStoreAcctIncome(ctx *jxcontext.Context, storeID, price, acctType int, vendorOrderID, vendorWaybillId string, expendID int) (err error) {
|
||||
var (
|
||||
userID, userName string
|
||||
goodsVendorOrderID string
|
||||
@@ -44,11 +44,12 @@ func InsertStoreAcctIncome(ctx *jxcontext.Context, storeID, price, acctType int,
|
||||
}
|
||||
}
|
||||
storeAcctIncome := &model.StoreAcctIncome{
|
||||
StoreID: storeID,
|
||||
IncomePrice: price,
|
||||
Type: acctType,
|
||||
UserID: userID,
|
||||
VendorOrderID: goodsVendorOrderID,
|
||||
StoreID: storeID,
|
||||
IncomePrice: price,
|
||||
Type: acctType,
|
||||
UserID: userID,
|
||||
VendorOrderID: goodsVendorOrderID,
|
||||
VendorWaybillID: vendorWaybillId,
|
||||
}
|
||||
dao.WrapAddIDCULEntity(storeAcctIncome, userName)
|
||||
if expendID != 0 {
|
||||
@@ -58,7 +59,7 @@ func InsertStoreAcctIncome(ctx *jxcontext.Context, storeID, price, acctType int,
|
||||
return err
|
||||
}
|
||||
|
||||
func InsertStoreAcctExpend(ctx *jxcontext.Context, storeID, price, acctType int, vendorOrderID string, expendID int) (err error) {
|
||||
func InsertStoreAcctExpend(ctx *jxcontext.Context, storeID, price, acctType int, vendorOrderID, vendorWaybillId string, expendID int) (err error) {
|
||||
var (
|
||||
userID, userName string
|
||||
db = dao.GetDB()
|
||||
@@ -76,11 +77,12 @@ func InsertStoreAcctExpend(ctx *jxcontext.Context, storeID, price, acctType int,
|
||||
}
|
||||
}
|
||||
storeAcctExpend := &model.StoreAcctExpend{
|
||||
StoreID: storeID,
|
||||
ExpendPrice: price,
|
||||
Type: acctType,
|
||||
UserID: userID,
|
||||
VendorOrderID: vendorOrderID,
|
||||
StoreID: storeID,
|
||||
ExpendPrice: price,
|
||||
Type: acctType,
|
||||
UserID: userID,
|
||||
VendorOrderID: vendorOrderID,
|
||||
VendorWaybillID: vendorWaybillId,
|
||||
}
|
||||
dao.WrapAddIDCULEntity(storeAcctExpend, userName)
|
||||
if expendID != 0 {
|
||||
@@ -132,18 +134,18 @@ func (s *StoreAcctManager) UpdateStoreAcctBalance(ctx *jxcontext.Context, storeI
|
||||
}
|
||||
|
||||
// 门店到账(老版本,修改门店的交易记录)
|
||||
func (s *StoreAcctManager) InsertStoreAcctExpendAndUpdateStoreAcctBalance(ctx *jxcontext.Context, storeID, price, acctType int, vendorOrderID string, expendID int) (err error) {
|
||||
func (s *StoreAcctManager) InsertStoreAcctExpendAndUpdateStoreAcctBalance(ctx *jxcontext.Context, storeID, price, acctType int, vendorOrderID, vendorWaybillID string, expendID int) (err error) {
|
||||
utils.CallFuncAsync(func() {
|
||||
if err = InsertStoreAcctExpend(ctx, storeID, price, acctType, vendorOrderID, expendID); err == nil {
|
||||
if err = InsertStoreAcctExpend(ctx, storeID, price, acctType, vendorOrderID, vendorWaybillID, expendID); err == nil {
|
||||
s.UpdateStoreAcctBalance(ctx, storeID, price, false)
|
||||
}
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *StoreAcctManager) InsertStoreAcctIncomeAndUpdateStoreAcctBalance(ctx *jxcontext.Context, storeID, price, acctType int, vendorOrderID string, expendID int) (err error) {
|
||||
func (s *StoreAcctManager) InsertStoreAcctIncomeAndUpdateStoreAcctBalance(ctx *jxcontext.Context, storeID, price, acctType int, vendorOrderID, vendorWaybillID string, expendID int) (err error) {
|
||||
utils.CallFuncAsync(func() {
|
||||
if err = InsertStoreAcctIncome(ctx, storeID, price, acctType, vendorOrderID, expendID); err == nil {
|
||||
if err = InsertStoreAcctIncome(ctx, storeID, price, acctType, vendorOrderID, vendorWaybillID, expendID); err == nil {
|
||||
s.UpdateStoreAcctBalance(ctx, storeID, price, true)
|
||||
}
|
||||
})
|
||||
@@ -156,9 +158,9 @@ func (s *StoreAcctManager) CheckStoreAcctExpendExist(vendorOrderID string) (isEq
|
||||
expends, incomes int
|
||||
db = dao.GetDB()
|
||||
)
|
||||
// 发单扣除的临时运费
|
||||
expends, err = dao.GetStoreAcctExpendTotal(db, 0, []int{partner.StoreAcctTypeExpendCreateWaybillEx, partner.StoreAcctTypeRealFeeExpend}, vendorOrderID, utils.ZeroTimeValue, utils.ZeroTimeValue)
|
||||
// 真实运费 < 临时运费, 临时运费-真实运费的值
|
||||
// 当前订单的支出金额(临时运费+真实运费)[小费]
|
||||
expends, err = dao.GetStoreAcctExpendTotal(db, 0, []int{partner.StoreAcctTypeExpendCreateWaybillEx, partner.StoreAcctTypeExpendCreateWaybillTip, partner.StoreAcctTypeExpendCreateWaybill2ndMore, partner.StoreAcctTypeExpendCreateWaybillDeductFee, partner.StoreAcctTypeRealFeeExpend}, vendorOrderID, utils.ZeroTimeValue, utils.ZeroTimeValue)
|
||||
// 当前订单的退费金额()
|
||||
incomes, err = dao.GetStoreAcctIncomeTotal(db, 0, []int{partner.StoreAcctTypeRealFeeIncome, partner.StoreAcctTypeIncomeCancelTemp, partner.StoreAcctTypeIncomeCancelReal}, vendorOrderID, utils.ZeroTimeValue, utils.ZeroTimeValue)
|
||||
if expends != incomes {
|
||||
if expends > incomes {
|
||||
|
||||
Reference in New Issue
Block a user