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.
196 lines
6.5 KiB
C#
196 lines
6.5 KiB
C#
using DevComponents.DotNetBar.Controls;
|
|
using POSV.Card;
|
|
using POSV.Component;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace POSV.Member
|
|
{
|
|
public partial class CouponConsumeRecordForm : BusinessForm
|
|
{
|
|
|
|
public string CouponType = string.Empty;//状态
|
|
|
|
public CouponConsumeRecordForm()
|
|
{
|
|
InitializeComponent();
|
|
this.controlBox.Text = "卡券核销记录";
|
|
this.controlBox.ShowApplicationVersion = false;
|
|
}
|
|
|
|
protected override void OnLoad(EventArgs e)
|
|
{
|
|
base.OnLoad(e);
|
|
if (this.DesignMode) return;
|
|
this.startPicker.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 00:00:00"));
|
|
this.endPicker.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd 23:59:59"));
|
|
this.Focus();
|
|
this.txtInput.Focus();
|
|
this.txtInput.SelectAll();
|
|
this.ActiveControl = this.txtInput;
|
|
}
|
|
|
|
private void BtnQueryClick(object sender, EventArgs e)
|
|
{
|
|
DoQuery();
|
|
}
|
|
|
|
public void DoQuery()
|
|
{
|
|
//获得当前页
|
|
int cur = pagerControl1.CurrentPage;
|
|
//获得每页显示的记录数
|
|
int rows = pagerControl1.RowsPerPage;
|
|
CouponConsumeRecordList(cur, rows);
|
|
}
|
|
private void BtnExitClick(object sender, EventArgs e)
|
|
{
|
|
//先关闭父窗体
|
|
if (this.Owner != null)
|
|
{
|
|
this.Owner.Close();
|
|
}
|
|
//再关闭当前窗体
|
|
this.Close();
|
|
}
|
|
|
|
private void OnCloseTouchClick(object sender, EventArgs e)
|
|
{
|
|
//先关闭父窗体
|
|
if (this.Owner != null)
|
|
{
|
|
this.Owner.Close();
|
|
}
|
|
//再关闭当前窗体
|
|
this.Close();
|
|
}
|
|
|
|
private void OnControlBoxKeyboardClick(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
KeyboardType keyboardType = KeyboardType.数字;
|
|
Type type = this.ActiveControl.GetType();
|
|
PropertyInfo pinfo = type.GetProperty("Keyboard");
|
|
if (pinfo != null)
|
|
{
|
|
keyboardType = (KeyboardType)pinfo.GetValue(this.ActiveControl, null);
|
|
}
|
|
|
|
var keyboard = Application.OpenForms["VirtualKeyboard"];
|
|
if (keyboard == null)
|
|
{
|
|
keyboard = new VirtualKeyboard(keyboardType);
|
|
}
|
|
|
|
((VirtualKeyboard)keyboard).ShowVirtualKeyboard(this, keyboardType);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LOGGER.Error(ex, "打开屏幕键盘异常");
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 卡券类型筛选
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void CbChangeClick(object sender, EventArgs e)
|
|
{
|
|
var obj = sender as CheckBoxX;
|
|
var indexT = obj.Tag as string;
|
|
if ("全部".Equals(indexT) && obj.Checked)
|
|
{
|
|
CouponType = string.Empty;
|
|
}
|
|
if ("代金券".Equals(indexT) && obj.Checked)
|
|
{
|
|
CouponType = "CASH";
|
|
}
|
|
if ("折扣券".Equals(indexT) && obj.Checked)
|
|
{
|
|
CouponType = "DISCOUNT";
|
|
}
|
|
if ("兑换券".Equals(indexT) && obj.Checked)
|
|
{
|
|
CouponType = "GIFT";
|
|
}
|
|
//获得当前页
|
|
int cur = pagerControl1.CurrentPage;
|
|
//获得每页显示的记录数
|
|
int rows = pagerControl1.RowsPerPage;
|
|
CouponConsumeRecordList(cur, rows);
|
|
}
|
|
|
|
private void OnQueryPageChangeWithObject(object obj)
|
|
{
|
|
//获得当前页
|
|
int cur = pagerControl1.CurrentPage;
|
|
//获得每页显示的记录数
|
|
int rows = pagerControl1.RowsPerPage;
|
|
|
|
PagerControl pager = obj as PagerControl;
|
|
if (pager != null)
|
|
{
|
|
CouponConsumeRecordList(cur, rows);
|
|
}
|
|
}
|
|
|
|
public void CouponConsumeRecordList(int PageNum, int pageSize) {
|
|
try
|
|
{
|
|
string startTime = this.startPicker.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
|
string endTime = this.endPicker.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
var request = new CouponConsumeRecordRequest();
|
|
request.StartTime = startTime;
|
|
request.EndTime = endTime;
|
|
request.Keyword = this.txtInput.Text;
|
|
request.Property = "mobile";
|
|
request.PageNum = PageNum;
|
|
request.PageSize = pageSize;
|
|
request.CouponType = CouponType;
|
|
request.ShopNo = Global.Instance.Authc.StoreNo;
|
|
var response = CardUtils.CouponConsumeRecord(request);
|
|
//成功
|
|
if (response.Item1)
|
|
{
|
|
|
|
this.ShowToastNotify(this, response.Item2);
|
|
List<CouponConsumeRecordResponse> couponConsumeRecordResponse = response.Item3.List;
|
|
this.pagerControl1.TotalPage = response.Item3.PageCount;
|
|
this.pagerControl1.CurrentPage = response.Item3.PageNum;
|
|
this.pagerControl1.RecordCount = response.Item3.TotalCount;
|
|
this.pagerControl1.RowsPerPage = response.Item3.PageSize;
|
|
couponConsumeListTable.PrimaryGrid.DataSource = couponConsumeRecordResponse;
|
|
}
|
|
else
|
|
{
|
|
List<CouponConsumeRecordResponse> list = new List<CouponConsumeRecordResponse>();
|
|
couponConsumeListTable.PrimaryGrid.DataSource = list;
|
|
this.ShowToastNotify(this, response.Item2);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
this.ShowToastNotify(this, "优惠券核销记录查询异常");
|
|
|
|
LOGGER.Error(ex, "优惠券核销记录查询异常");
|
|
}
|
|
}
|
|
|
|
private void OnEnterClick(object sender, EnterEventArg e)
|
|
{
|
|
DoQuery();
|
|
}
|
|
}
|
|
}
|