You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
170 lines
5.3 KiB
C#
170 lines
5.3 KiB
C#
using DevComponents.DotNetBar;
|
|
using DevComponents.DotNetBar.Metro;
|
|
using POS.Language.Language;
|
|
using POSV.Template;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace POSV.Report
|
|
{
|
|
public partial class RefundCauseSelectForm : BusinessForm
|
|
{
|
|
public RefundCauseSelectForm()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
|
|
protected override void OnLoad(EventArgs e)
|
|
{
|
|
base.OnLoad(e);
|
|
if (DesignMode) return;
|
|
|
|
InstallAllBackCause();
|
|
}
|
|
|
|
private void InstallAllBackCause()
|
|
{
|
|
ItemContainer ic = new ItemContainer();
|
|
ic.MultiLine = true;
|
|
ic.ItemSpacing = 0;
|
|
ic.LayoutOrientation = eOrientation.Horizontal;
|
|
|
|
//有异物
|
|
var item = GetItemTemplate();
|
|
item.Text = LangProxy.ToLang("有异物");
|
|
item.Checked = true;
|
|
ic.SubItems.Add(item);
|
|
|
|
//出品慢
|
|
item = GetItemTemplate();
|
|
item.Text = LangProxy.ToLang("出品慢");
|
|
ic.SubItems.Add(item);
|
|
|
|
//其他原因
|
|
item = GetItemTemplate();
|
|
item.Text = LangProxy.ToLang("其他原因");
|
|
ic.SubItems.Add(item);
|
|
|
|
this.itemPanel1.Items.Add(ic);
|
|
this.itemPanel1.Invalidate();
|
|
}
|
|
|
|
private MetroTileItem GetItemTemplate()
|
|
{
|
|
MetroTileItem template = new MetroTileItem();
|
|
|
|
template.TileStyle.PaddingLeft = template.TileStyle.PaddingRight = -2;
|
|
|
|
template.EnableMarkup = true;
|
|
template.OptionGroup = "refundCause";
|
|
|
|
template.TileStyle.Font = this.itemPanel1.Font;
|
|
|
|
//this.itemPanel1.ResizeItemsToFit = false;
|
|
this.itemPanel1.BackgroundStyle.Class = "MetroTileGroupTitle";//很关键
|
|
|
|
template.TileStyle.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center;
|
|
template.TileStyle.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center;
|
|
|
|
template.TileStyle.TextColor = Color.White;
|
|
template.TitleTextColor = Color.White;
|
|
|
|
template.TileStyle.BackColor = Color.DimGray;
|
|
template.TileStyle.BackColor2 = Color.DimGray;
|
|
template.TileStyle.BorderWidth = 1;
|
|
template.TileStyle.BorderColor = Color.DimGray;
|
|
template.TileStyle.BorderColor2 = Color.DimGray;
|
|
|
|
//显示大小
|
|
template.TileSize = new Size(100, 100);
|
|
|
|
//圆角
|
|
template.TileStyle.CornerType = DevComponents.DotNetBar.eCornerType.Rounded;
|
|
|
|
template.MouseDown += OnItemMouseDown;
|
|
|
|
return template;
|
|
}
|
|
|
|
private void OnItemMouseDown(object sender, MouseEventArgs e)
|
|
{
|
|
var tile = sender as MetroTileItem;
|
|
|
|
this.OnAcceptButtonClick(new TransparentEventArgs(TransparentAction.Accept, "printType", tile.Text));
|
|
|
|
OnCloseTouchClick(this, null);
|
|
|
|
}
|
|
|
|
private void OnCloseTouchClick(object sender, Component.TouchEventArgs e)
|
|
{
|
|
if (this.Owner != null)
|
|
{
|
|
this.Owner.DialogResult = this.DialogResult;
|
|
this.Owner.Close();
|
|
}
|
|
this.Close();
|
|
}
|
|
|
|
private void OnAcceptTouchClick(object sender, Component.TouchEventArgs e)
|
|
{
|
|
var other = txtOtherCause.Text;
|
|
if (string.IsNullOrEmpty(other))
|
|
{
|
|
var ic = this.itemPanel1.Items[0];
|
|
bool isCheck = false;
|
|
foreach(var obj in ic.SubItems)
|
|
{
|
|
var item = obj as MetroTileItem;
|
|
if (item.Checked)
|
|
{
|
|
isCheck = true;
|
|
this.OnAcceptButtonClick(new TransparentEventArgs(TransparentAction.Accept, LangProxy.ToLang("退款原因"), item.Text));
|
|
break;
|
|
}
|
|
}
|
|
if (!isCheck)
|
|
{
|
|
this.ShowToastNotify(this, LangProxy.ToLang("请选择退款原因!"));
|
|
}
|
|
else
|
|
{
|
|
OnCloseTouchClick(sender, e);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//其他退款原因
|
|
this.OnAcceptButtonClick(new TransparentEventArgs(TransparentAction.Accept, LangProxy.ToLang("退款原因"), other.Trim()));
|
|
OnCloseTouchClick(sender, e);
|
|
}
|
|
}
|
|
|
|
private void OnKeyboardCustomClick(object sender, EventArgs e)
|
|
{
|
|
TxtKeyboardForm txtForm = new TxtKeyboardForm(this.txtOtherCause.Text.Trim());
|
|
txtForm.NotifyChanged += (o, args) =>
|
|
{
|
|
switch (args.Action)
|
|
{
|
|
case NotifyAction.Accept:
|
|
{
|
|
var result = args.Data as string;
|
|
this.txtOtherCause.Text = result;
|
|
}
|
|
break;
|
|
}
|
|
};
|
|
|
|
txtForm.ShowDialog();
|
|
}
|
|
}
|
|
}
|