修改门店发单和品牌发单是扣费问题

This commit is contained in:
邹宗楠
2023-05-11 10:58:50 +08:00
parent 85b2870a5e
commit 476f8c0943
26 changed files with 417 additions and 273 deletions

View File

@@ -1466,13 +1466,17 @@ func GetOrdersForJxPay(db *DaoDB, finishTimeBegin, finishTimeEnd time.Time) (goo
return goods, err
}
func GetWaybills(db *DaoDB, vendorOrderID string) (waybills []*model.Waybill, err error) {
func GetWaybills(db *DaoDB, vendorOrderID string, vendors []int64) (waybills []*model.Waybill, err error) {
sql := ` SELECT *
FROM waybill
WHERE vendor_order_id = ? ORDER BY waybill_created_at asc
WHERE vendor_order_id = ?
`
if len(vendors) > model.NO {
sql += " AND waybill_vendor_id IN (" + GenQuestionMarks(len(vendors)) + ")"
}
sql += ` ORDER BY waybill_created_at asc`
sqlParams := []interface{}{vendorOrderID}
sqlParams = append(sqlParams, vendors)
err = GetRows(db, &waybills, sql, sqlParams)
return waybills, err
}

View File

@@ -3,6 +3,7 @@ package dao
import (
"errors"
"fmt"
"git.rosy.net.cn/jx-callback/business/partner"
"sort"
"strings"
"time"
@@ -29,7 +30,7 @@ type StoreDetail struct {
PricePercentage int16 `orm:"default(100)" json:"pricePercentage"` // todo 厂商价格相对于本地价格的百分比,这个字段的修改会比较特殊,因为可能需要刷新厂商价格
PricePercentagePackStr string `orm:"size(4096)" json:"-"` //
PricePercentagePackObj model.PricePercentagePack `orm:"-" json:"-"`
CreateDeliveryType int `orm:"default(0)" json:"createDeliveryType"` //默认0系统发单1为门店发单
CreateDeliveryType int `orm:"default(0)" json:"createDeliveryType"` //默认0系统(品牌)发单1为门店发单
FreightDeductionPackStr string `orm:"size(4096)" json:"-"` //
FreightDeductionPackObj *model.FreightDeductionPack `orm:"-" json:"-"`
@@ -1162,11 +1163,11 @@ func GetStoreAcctExpendTotal(db *DaoDB, storeID int, expendTypes []int, vendorOr
type GetStoreAcctExpendLastCreateWayBillFeeResult struct {
ID int `orm:"column(id)" json:"id"`
ExpID int `orm:"column(exp_id)" json:"expID"` //少扣的钱
IncID int `orm:"column(inc_id)" json:"incID"` //多扣的钱
ExpendPrice int `json:"expendPrice"`
MulitExpendPrice int `json:"mulitExpendPrice"`
MulitIncomePrice int `json:"mulitIncomePrice"`
ExpID int `orm:"column(exp_id)" json:"expID"` // 支出记录id(金额补充)
IncID int `orm:"column(inc_id)" json:"incID"` // 退费记录id(金额退款)
ExpendPrice int `json:"expendPrice"` // 运单支出金额
MulitExpendPrice int `json:"mulitExpendPrice"` // 运单补充金额
MulitIncomePrice int `json:"mulitIncomePrice"` // 运单退还金额
}
func GetStoreAcctExpendLastCreateWayBillFee(db *DaoDB, vendorOrderID string) (expend *GetStoreAcctExpendLastCreateWayBillFeeResult, lastFee int, err error) {
@@ -1180,7 +1181,7 @@ func GetStoreAcctExpendLastCreateWayBillFee(db *DaoDB, vendorOrderID string) (ex
AND a.type = ?
`
sqlParams := []interface{}{
20,
partner.StoreAcctTypeExpendCreateWaybillEx,
}
if vendorOrderID != "" {
sql += " AND a.vendor_order_id = ?"

View File

@@ -20,6 +20,9 @@ const (
ErrCodeAccountBalanceNotEnough = "-201" //余额不足
ErrCodeNotAuthBindWeixin = "-202" //没有绑定微信认证方式
ErrCodeOnePayTipFeeMore = "10001" // 单次支付金额太多
ErrCodeIsPaySure = "10000" // 是否确认支付
)
var (

View File

@@ -29,6 +29,8 @@ const (
BrandBillFeeTypeVoice = 4 //语音费用
BrandBillFeeTypeDelivery = 5 //三方配送费
BrandBillFeeTypeSecretNumber = 6 //隐私号电话
BrandBillFeeTypeTipFee = 7 //小费
BrandBillFeeTypeDeductFee = 8 //取消三方配送违约金
BrandOpenMTPS = 1 //品牌开关标志, 美团配送
BrandOpenDaDa = 2 //达达
@@ -904,12 +906,13 @@ func (*BrandStore) TableUnique() [][]string {
type StoreAcctIncome struct {
ModelIDCUL
StoreID int `orm:"column(store_id)" json:"storeID"` //门店ID
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"`
UserID string `orm:"column(user_id)" json:"userID"` //用户ID (谁消费的)
ExpID int `orm:"column(exp_id)" json:"expID"` //用于关联多退少补的金额是对应哪一笔收入(支出
Type int `json:"type"` //收入类型
IncomePrice int `json:"incomePrice"` //收入金额
StoreID int `orm:"column(store_id)" json:"storeID"` //门店ID
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"`
VendorWaybillID string `orm:"column(vendor_waybill_id);size(48)" json:"vendorWaybillID"` // 运单id
UserID string `orm:"column(user_id)" json:"userID"` //用户ID (谁消费的
ExpID int `orm:"column(exp_id)" json:"expID"` //用于关联多退少补的金额是对应哪一笔收入(支出)
Type int `json:"type"` //收入类型
IncomePrice int `json:"incomePrice"` //收入金额
}
func (v *StoreAcctIncome) TableIndex() [][]string {
@@ -923,12 +926,13 @@ func (v *StoreAcctIncome) TableIndex() [][]string {
type StoreAcctExpend struct {
ModelIDCUL
StoreID int `orm:"column(store_id)" json:"storeID"` //门店ID
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"`
UserID string `orm:"column(user_id)" json:"userID"` //用户ID (谁消费的)
ExpID int `orm:"column(exp_id)" json:"expID"` //用于关联多退少补的金额是对应哪一笔收入(支出
Type int `json:"type"` //支出类型
ExpendPrice int `json:"expendPrice"` //支出金额
StoreID int `orm:"column(store_id)" json:"storeID"` //门店ID
VendorOrderID string `orm:"column(vendor_order_id);size(48)" json:"vendorOrderID"` // 订单id
VendorWaybillID string `orm:"column(vendor_waybill_id);size(48)" json:"vendorWaybillID"` // 运单id
UserID string `orm:"column(user_id)" json:"userID"` //用户ID (谁消费的
ExpID int `orm:"column(exp_id)" json:"expID"` //用于关联多退少补的金额是对应哪一笔收入(支出)
Type int `json:"type"` //支出类型
ExpendPrice int `json:"expendPrice"` //支出金额
}
func (v *StoreAcctExpend) TableIndex() [][]string {