using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
using NPoco;
using POSV.Entity;
using POSV.Utils;
namespace POSV.ShoppingCart
{
///
/// 订单支付明细
///
[Serializable]
[JsonObject(MemberSerialization.OptIn)]
[TableName("pos_order_pay")]
[PrimaryKey(new string[] { "id" } , AutoIncrement = false)]
public class PayItem : BaseEntity
{
public PayItem()
{
}
///
/// 租户ID
///
[JsonProperty(PropertyName = "tenantId")]
[Column("tenantId")]
public string TenantId { get; set; }
///
/// 随机单号
///
[JsonProperty(PropertyName = "orderId")]
[Column("orderId")]
public string OrderId { get; set;}
///
/// 序号
///
[JsonProperty(PropertyName = "order")]
[Column("order")]
public int Order { get; set; }
///
/// 单据编号
///
[JsonProperty(PropertyName = "tradeNo")]
[Column("tradeNo")]
public string TradeNo { get; set; }
///
/// 单据编号
///
[JsonProperty(PropertyName = "outTradeNo")]
[Column("outTradeNo")]
public string OutTradeNo { get; set; }
///
/// 支付单编号
///
[JsonProperty(PropertyName = "payNo")]
[Column("payNo")]
public string PayNo { get; set; }
///
/// 原单号,退款单使用
///
[JsonProperty(PropertyName = "orgPayId")]
[Ignore]
public string OrgPayId { get; set; } = string.Empty;
///
/// 班次编号
///
[JsonProperty(PropertyName = "shiftNo")]
[Column("shiftNo")]
public string ShiftNo { get; set; }
///
/// 班次名称
///
[JsonProperty(PropertyName = "shiftName")]
[Column("shiftName")]
public string ShiftName { get; set; }
///
/// 交易参考号(凭证号)
///
[JsonProperty(PropertyName = "voucherNo")]
[Column("tradeVoucherNo")]
public string TradeVoucherNo { get; set; }
///
/// 会员卡预支付编码
///
[JsonProperty(PropertyName = "prePayNo")]
[Column("prePayNo")]
public string PrePayNo { get; set; }
///
/// 付款方式名称
///
[JsonProperty(PropertyName = "payType")]
[Column("name")]
public string Name { get; set; }
///
/// 付款方式编号
///
[JsonProperty(PropertyName = "payTypeNo")]
[Column("no")]
public string No { get; set; }
///
/// 支付渠道 区分各种聚合支付、原生支付
///
[JsonProperty(PropertyName = "payChannel")]
[Column("payChannel")]
public PayChannelEnum PayChannel { get; set; } = PayChannelEnum.无;
///
/// 是否参与积分(0否1是)
///
[JsonProperty(PropertyName = "pointFlag")]
[Column("pointFlag")]
public int PointFlag { get; set; }
///
/// 已收金额 = 实收 - 找零
///
[JsonProperty(PropertyName = "money")]
[Column("amount")]
public decimal Amount { get; set; }
///
/// 实收金额
///
[JsonProperty(PropertyName = "paid")]
[Column("paidAmount")]
public decimal PaidAmount { get; set; }
///
/// 退款金额
///
[JsonProperty(PropertyName = "ramount")]
[Column("ramount")]
public decimal RefundAmount { get; set; }
///
/// 溢出金额
///
[JsonProperty(PropertyName = "overAmount")]
[Column("overAmount")]
public decimal OverAmount { get; set; }
///
/// 找零金额
///
[JsonProperty(PropertyName = "rchange")]
[Column("changeAmount")]
public decimal ChangeAmount { get; set; }
///
/// 付款卡号
///
[JsonProperty(PropertyName = "cardno")]
[Column("cardNo")]
public string CardNo { get; set; }
///
/// 卡面号
///
[JsonProperty(PropertyName = "cardFaceNo")]
[Column("cardFaceNo")]
public string CardFaceNo { get; set; }
///
/// 手机号
///
[JsonProperty(PropertyName = "memberMobileNo")]
[Column("memberMobileNo")]
public string MemberMobileNo { get; set; }
///
/// 卡支付前余额
///
[JsonProperty(PropertyName = "cardYe")]
[Column("balance")]
public decimal CardBeforeBalance { get; set; }
///
/// 刷卡后金额
///
[JsonProperty(PropertyName = "cardAftAmount")]
[Column("cardAftAmount")]
public decimal CardAftAmount { get; set; }
///
/// 卡支付前积分
///
[JsonProperty(PropertyName = "cardJf")]
[Column("point")]
public decimal CardBeforePoint { get; set; }
///
/// 用户是否确认输入密码
///
[JsonProperty(PropertyName = "useConfirmed")]
[Column("useConfirmed")]
public bool UseConfirmed { get; set; }
///
/// 会员卡密码加密
///
[JsonIgnore]
[Ignore]
public string Passwd { get; set; }
///
/// 备注说明
///
[JsonProperty(PropertyName = "memo")]
[Column("memo")]
public string Memo { get; set; }
///
/// 支付状态
///
[JsonProperty(PropertyName = "status")]
[Column("status")]
public int Status { get; set; }
///
/// 是否订阅微信公众号
///
public string Subscribe { get; set; }
///
/// 支付状态描述
///
[JsonProperty(PropertyName = "statusDesc")]
[Column("statusDesc")]
public string StatusDesc { get; set; }
///
/// 支付时间(格式:yyyy-MM-dd HH:mm:ss)
///
[JsonProperty(PropertyName = "payTime")]
[Column("payTime")]
public string PayTime { get; set; } = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
///
/// 订单完成时间(格式:yyyy-MM-dd HH:mm:ss)
///
[JsonProperty(PropertyName = "finishDate")]
[Column("finishDate")]
public string FinishDate { get; set; } = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
///
/// 是否实收(0-否;1-是;)
///
[JsonProperty(PropertyName = "incomeFlag")]
[Column("incomeFlag")]
public int IncomeFlag { get; set; }
///
/// 第三方扣费类型
///
[JsonProperty(PropertyName = "otherRateType")]
[Column("otherRateType")]
public int OtherRateType { get; set; }
///
/// 第三方扣费值
///
[JsonProperty(PropertyName = "otherRateValue")]
[Column("otherRateValue")]
public decimal OtherRateValue { get; set; }
private decimal _otherRate = 0;
///
/// 第三方扣费
///
[JsonProperty(PropertyName = "otherRate")]
[Column("otherRate")]
public decimal OtherRate
{
get
{
//金额合计不包含套餐明细
if (this.OtherRateType == 0)
{
this._otherRate = 0;
}
else if (this.OtherRateType == 1)
{
this._otherRate = this.OtherRateValue;
}
else if (this.OtherRateType == 2)
{
//add by yangaming 除100
this._otherRate = this.Amount* this.OtherRateValue / 100M;
}
else {
this._otherRate = 0;
}
return OrderUtils.ToRound(this._otherRate);
}
set
{
this._otherRate = value;
}
}
///
/// 扩展字段1- zhangy Add 2020-02-18启用,支付方式扣率
///
[JsonProperty(PropertyName = "ext1")]
[Column("ext1")]
public string Ext1 { get; set; }
///
/// 扩展字段2- zhangy Add 2020-02-18启用,支付方式扣率计算的扣款
///
[JsonProperty(PropertyName = "ext2")]
[Column("ext2")]
public string Ext2 { get; set; }
///
/// 扩展字段3
///
[JsonProperty(PropertyName = "ext3")]
[Column("ext3")]
public string Ext3 { get; set; }
public override string ToString()
{
return string.Format("[{0},{1}]",this.Name,string.IsNullOrEmpty(this.CardNo) ? "" : this.CardNo);
}
#region subin 20230916 新增,用于本地小程序订单退款。
///
/// 小程序付款的PayuserId
///
public string OpenId { get; set; }
#endregion
}
}