using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using POSV.ThirdPartyOrderData; using POSV.Proxy.ThirdPartyOrder; using POSV.Component; namespace POSV.JwWeiXinOrder { public delegate void OrderOperationClick(JwWeiXinOrderDetail orderDetail, ProgramHandleOrderData programHandleOrderData, string type); public partial class JwWeiXinOrderDetail : BaseUserControl { public ProgramHandleOrderData _OrderData = null; public ProgramStoreDetailData _StoreData = null; public OrderOperationClick orderOperationClick = null; public JwWeiXinOrderDetail(ProgramHandleOrderData data, ProgramStoreDetailData store) { InitializeComponent(); _OrderData = data; //zhangy 2020-04-27 小程序门店数据 _StoreData = store; //zhangy 2020-04-27 物流配送按钮是否显示 this.touchButtonX6.Visible = (_StoreData != null && _StoreData.DiscomFlag == 1); this.touchButtonX6.Enabled = false; } protected override void OnLoad(EventArgs e) { base.OnLoad(e); DefaultGridStyle.setDefaultGridStyle(this.dgitemdata); this.InitializationInfor(); } private void InitializationInfor() { this.lblamount.Text = "¥" + (_OrderData.Amount + _OrderData.Packagefee).ToString(); this.lblbackCause.Text = _OrderData.Backcause; this.lbldiscountTotal.Text = "¥" + _OrderData.Discounttotal.ToString(); this.lblext2.Text = _OrderData.Ext2; this.lblmemberName.Text = _OrderData.TicketDeliver.FirstOrDefault()?.Name + " " + _OrderData.TicketDeliver.FirstOrDefault()?.Ordertel; this.lbladdress.Text = _OrderData.TicketDeliver.FirstOrDefault()?.Address; this.lblno.Text = _OrderData.No; this.lblpackageFee.Text = "¥" + _OrderData.Packagefee.ToString(); this.lblsaleDate.Text = _OrderData.Saledate; this.lblseqNo.Text = _OrderData.Seqno; this.lbltableNo.Text = _OrderData.Tablename; this.lblStatus.Text = _OrderData.ToStatusString; this.lblbusMode.Text = _OrderData.ToBusModeString; this.lblrefundStatus.Text = _OrderData.ToRefundStatusString; this.lbldeliverStatus.Text = _OrderData.ToDeliverStatus; //zhangy 2020-02-29 Add 预定取餐时间 //营业模式(0堂食1外带2预定3外卖) if (_OrderData.Busmode == 1) { this.labelX4.Text = "就餐时间:"; } else if ( _OrderData.Busmode == 2) { this.labelX4.Text = "到店时间:"; } else { this.labelX4.Text = "取餐时间:"; } this.lblReserveTime.Text = _OrderData.Reservetime; //zhangy 2020-04-28 Add 默认物流查询按钮不可用 this.touchButtonX6.Enabled = false; if (_OrderData.Busmode == 3) { this.touchButtonX6.Enabled = true; } if (_OrderData.Status == 0) { if (_OrderData.Refundstatus == 1) { touchButtonX2.Visible = true; touchButtonX1.Visible = true; } else { touchButtonX3.Visible = true; touchButtonX4.Visible = true; } } if (_OrderData.Status == 1) { if (_OrderData.Refundstatus == 1) { touchButtonX2.Visible = true; touchButtonX1.Visible = true; } } InitItemData(); } private void InitItemData() { List _viewData = new List(); int _row = 1; foreach (var item in _OrderData.OrderProduct) { OrderProductViewModel order = new OrderProductViewModel(); order.RowNo = _row++; order.Name = item.Productname; order.SpecName = item.Specname; order.MakeName = string.Join(",", _OrderData.MakeInfo.Where(f => f.Orderitemid == item.Clientid).Select(f => f.Makename).ToList()); order.Quantity = item.Count; order.TotalPrices = item.Receivabletotal; _viewData.Add(order); } dgitemdata.PrimaryGrid.DataSource = _viewData; } /// /// 操作订单状态 /// /// /// private void Btn_Click(object sender, EventArgs e) { var _btn = sender as Component.TouchButtonX; try { _btn.Enabled = false; if (this.orderOperationClick != null) { if (_btn == null) { return; } orderOperationClick(this, this._OrderData, _btn.Text); } } finally { _btn.Enabled = true; } } private void Btn_Touch_Click(object sender, TouchEventArgs e) { var _btn = sender as Component.TouchButtonX; try { _btn.Enabled = false; if (this.orderOperationClick != null) { if (_btn == null) { return; } orderOperationClick(this, this._OrderData, _btn.Text); } } finally { _btn.Enabled = true; } } } public class OrderProductViewModel { private int rowNo; private string name; private string specName; private string makeName; private decimal quantity; private decimal totalPrices; public int RowNo { get => rowNo; set => rowNo = value; } public string Name { get => name; set => name = value; } public string SpecName { get => specName; set => specName = value; } public string MakeName { get => makeName; set => makeName = value; } public decimal Quantity { get => quantity; set => quantity = value; } public decimal TotalPrices { get => totalPrices; set => totalPrices = value; } } }