public void SetVipCard(string code) { this.VipCustomer = _vipService.GetByCode(code); //刷新当前购物车折扣 // var discount = this.VipCustomer == null ? 1 : this.VipCustomer.Discount; this._currentShopCat = this._currentShopCat ?? new ShopCart(ContextService.StoreId, ContextService.PosId, ContextService.CurrentAccount.Id); foreach (var item in this._currentShopCat.Items) { //只取会员商品价,不按折扣计算 var realPrice = item.SalePrice; if (this.VipCustomer != null) { var vipProduct = _vipProductService.GetByProductId(item.ProductId); realPrice = vipProduct == null ? item.SalePrice : vipProduct.SalePrice; } item.ChangeRealPrice(realPrice); } // 重新绑定 this.ShowOrderInfo(); if (this.dgvData.CurrentCell != null) { this.dgvData.CurrentCell.Selected = true; } this.txtBarCode.Focus(); }
/// <summary> /// 清空订单明细 /// </summary> public void ClearItems() { ShowPreOrderInfo(); this.dgvData.DataSource = new List <ShopCartItem>(); this.VipCustomer = null; this._currentShopCat = null; }
public void SetVipCard(VipCard vip) { //设置vip对象 this.VipCustomer = vip; //刷新当前购物车折扣 // var discount = this.VipCustomer == null ? 1 : this.VipCustomer.Discount; this._currentShopCat = this._currentShopCat ?? new ShopCart(ContextService.StoreId, ContextService.PosId, ContextService.CurrentAccount.Id); this._currentShopCat.OrderLevel = Domain.ValueObject.SaleOrderLevel.Vip; if (this._currentShopCat.Items.Count == 0) { //如果当前还没刷商品,焦点返回输入框 this.txtBarCode.Focus(); return; } foreach (var item in this._currentShopCat.Items) { //只取会员商品价,不按折扣计算 var realPrice = item.SalePrice; var vipProduct = _vipProductService.GetByProductId(item.ProductId); realPrice = vipProduct == null ? item.SalePrice : vipProduct.SalePrice; item.ChangeRealPrice(realPrice); } // 重新绑定 this.ShowOrderInfo(); if (this.dgvData.CurrentCell != null) { this.dgvData.CurrentCell.Selected = true; } this.txtBarCode.Focus(); }
public void ClearAll() { this.dgvData.DataSource = new List <ShopCartItem>(); this.lblOrderTotal.Text = "总金额:0.00"; this.lblQuantityTotal.Text = "总件数:0"; this.lblOrderCode.Text = "订单号:"; this.lblDiscount.Text = "总优惠:0.00"; this.VipCustomer = null; this._currentShopCat = null; }