Example #1
0
// 获取商品值
func (this *saleService) GetValueGoods(merchantId, goodsId int) *valueobject.Goods {
	sl := this._rep.GetSale(merchantId)
	var goods sale.IGoods = sl.GoodsManager().GetGoods(goodsId)
	if goods != nil {
		return goods.GetPackedValue()
	}
	return nil
}
Example #2
0
// 获取商品详情
func (this *saleService) GetGoodsDetails(mchId, goodsId, mLevel int) (*valueobject.Goods, map[string]string) {
	sl := this._rep.GetSale(mchId)
	var goods sale.IGoods = sl.GoodsManager().GetGoods(goodsId)
	gv := goods.GetPackedValue()
	proMap := goods.GetPromotionDescribe()
	if b, price := goods.GetLevelPrice(mLevel); b {
		gv.PromPrice = price
		proMap["会员专享"] = fmt.Sprintf("会员优惠,仅需<b>¥%s</b>",
			format.FormatFloat(price))
	}
	return gv, proMap
}
Example #3
0
// 取消商品
func (o *subOrderImpl) cancelGoods() error {
	for _, v := range o._value.Items {
		snapshot := o._goodsRep.GetSaleSnapshot(v.SnapshotId)
		if snapshot == nil {
			return goods.ErrNoSuchSnapshot
		}
		var gds sale.IGoods = o._saleRep.GetSale(o._value.VendorId).
			GoodsManager().GetGoods(snapshot.SkuId)
		if gds != nil {
			gds.CancelSale(v.Quantity, o._value.OrderNo)
		}
	}
	return nil
}
Example #4
0
// 根据SKU获取商品
func (this *saleService) GetGoodsBySku(merchantId int, itemId int, sku int) *valueobject.Goods {
	sl := this._rep.GetSale(merchantId)
	var goods sale.IGoods = sl.GoodsManager().GetGoodsBySku(itemId, sku)
	return goods.GetPackedValue()
}
Example #5
0
// 获取货品描述
func (this *saleService) GetItemDescriptionByGoodsId(merchantId, goodsId int) string {
	sl := this._rep.GetSale(merchantId)
	var goods sale.IGoods = sl.GoodsManager().GetGoods(goodsId)
	return goods.GetItem().GetValue().Description
}