- CaculateSkuPrice return UnitPrice when unit is 份
This commit is contained in:
@@ -47,6 +47,7 @@ type tStoreSkuBindAndSpec struct {
|
||||
SpecQuality float32
|
||||
SpecUnit string
|
||||
SkuNamePrice int
|
||||
SkuNameUnit string
|
||||
RealSkuID int `orm:"column(real_sku_id)"`
|
||||
}
|
||||
|
||||
@@ -241,7 +242,7 @@ func UpdateStoreSkus(storeID int, skuBindInfos []*StoreSkuBindInfo, userName str
|
||||
inSkuBinds := skuBindInfo.Skus
|
||||
var allBinds []*tStoreSkuBindAndSpec
|
||||
if err = dao.GetRows(db, &allBinds, `
|
||||
SELECT t2.*, t1.id real_sku_id, t1.spec_quality, t1.spec_unit, t3.price sku_name_price
|
||||
SELECT t2.*, t1.id real_sku_id, t1.spec_quality, t1.spec_unit, t3.price sku_name_price, t3.unit sku_name_unit
|
||||
FROM sku t1
|
||||
LEFT JOIN store_sku_bind t2 ON t2.sku_id = t1.id AND store_id = ?
|
||||
JOIN sku_name t3 ON t1.name_id = t3.id
|
||||
@@ -272,7 +273,7 @@ func UpdateStoreSkus(storeID int, skuBindInfos []*StoreSkuBindInfo, userName str
|
||||
SkuID: v.RealSkuID,
|
||||
SubStoreID: skuBindInfo.SubStoreID, // todo 这个应该从用户信息中自动获得
|
||||
UnitPrice: unitPrice,
|
||||
Price: jxutils.CaculateSkuPrice(unitPrice, v.SpecQuality, v.SpecUnit),
|
||||
Price: jxutils.CaculateSkuPrice(unitPrice, v.SpecQuality, v.SpecUnit, v.SkuNameUnit),
|
||||
Status: model.StoreSkuBindStatusDontSale, // 缺省不可售?
|
||||
}
|
||||
if inSkuBind != nil && inSkuBind.IsSale == 1 {
|
||||
@@ -318,7 +319,7 @@ func UpdateStoreSkus(storeID int, skuBindInfos []*StoreSkuBindInfo, userName str
|
||||
}
|
||||
if skuBindInfo.UnitPrice != 0 { // 这里是否需要加此条件限制
|
||||
skuBind.UnitPrice = unitPrice
|
||||
skuBind.Price = jxutils.CaculateSkuPrice(unitPrice, v.SpecQuality, v.SpecUnit)
|
||||
skuBind.Price = jxutils.CaculateSkuPrice(unitPrice, v.SpecQuality, v.SpecUnit, v.SkuNameUnit)
|
||||
setStoreSkuBindStatus(skuBind, model.SyncFlagPriceMask)
|
||||
needUpdate = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user