ASP.NET MVC 实现页落网资源分享网站+充值管理+后台管理(14)之会员中心管理
源码下载地址:http://www.yealuo.com/Sccnn/Detail?KeyValue=c891ffae-7441-4afb-9a75-c5fe000e3d1c
会员中心,主要包含了会员的基本信息维护、充值管理,以及下载充值的日志管理和收藏等功能
首先我们需要在MemberCenterModule区域下的Controller文件中创建MemberSystemController.cs控制器:
using Bobo.Utilities; using Bobo.Utilities.Membership; using IA.Business; using IA.Entity; using IA.WebApp.SystemExtension; using System; using System.Collections.Generic; using System.Data; using System.IO; using System.Linq; using System.Web; using System.Web.Mvc; namespace IA.WebApp.Areas.MemberCenterModule.Controllers { [LoginAuthorize("~/MemberCenterModule/MemberRegLogin/login")] public class MemberSystemController : Controller { // // GET: /MemberCenterModule/MemberSystem/ /// <summary> /// 会员中心 /// </summary> /// <returns></returns> public ActionResult Index() { string MemeberID = ManageProvider.Provider.Current().UserId; Com_Member mentity = new Com_MemberBll().Factory.FindEntity(MemeberID); return View(mentity); } /// <summary> /// 充值中心 /// </summary> /// <returns></returns> public ActionResult RechargeView() { string MemeberID = ManageProvider.Provider.Current().UserId; Com_Member mentity = new Com_MemberBll().Factory.FindEntity(MemeberID); return View(mentity); } //支付凭证 public ActionResult SubPayForm() { return View(); } /// <summary> /// 获取凭证实体 /// </summary> /// <param name="KeyValue"></param> /// <returns></returns> public ActionResult GetPayInit(string KeyValue) { Com_PayFor mentity = new Com_PayForBll().Factory.FindEntity(KeyValue); return Content(mentity.ToJson()); } /// <summary> /// 支付凭证提交 /// </summary> /// <returns></returns> public ActionResult SubPayDataForm(Com_PayFor entity, string KeyValue) { HttpPostedFileBase FileUrl = Request.Files["PayForUrlFile"]; Com_PayForBll bll = new Com_PayForBll(); try { int IsOk = 0; string Message = "提交失败。"; List<string> fileType = ConfigHelper.GetSystemConfig("SystemConfig", "fileUploadPath", "ImageType").ToLower().Split('|').ToList(); string FileUrName = ""; bool FileHasUrl = FileUrl != null && FileUrl.ContentLength > 0; if (FileHasUrl) { FileUrName = Path.GetFileName(FileUrl.FileName); } if ((FileHasUrl && !fileType.Contains(Path.GetExtension(FileUrName).ToLower()))) { return Content(new JsonMessage { Code = "-1", Success = false, Message = "支付凭证只能上传" + ConfigHelper.GetSystemConfig("SystemConfig", "fileUploadPath", "ImageType").ToLower() + "类型的文件!" }.ToString()); } if (FileHasUrl && CommonHelper.GetInt(SizeHelper.CountSizeNum(FileUrl.ContentLength)) > CommonHelper.GetInt(ConfigHelper.GetSystemConfig("SystemConfig", "fileUploadPath", "ImageSize"))) { return Content(new JsonMessage { Code = "-1", Success = false, Message = "文件大小不能超过" + ConfigHelper.GetSystemConfig("SystemConfig", "fileUploadPath", "ImageSize") + "M!" }.ToString()); } string AllPath = "";//ConfigHelper.GetSystemConfig("SystemConfig", "fileUploadPath", "AllFilePath"); string PicPath = "/Resource/PayForUrl/"; DirFileHelper.CreateDirectory(Server.MapPath(AllPath + PicPath)); //上传凭证 if (FileUrl != null && FileUrl.ContentLength > 0) { string fileName = CommonHelper.GetGuidNotLine() + Path.GetFileName(FileUrl.FileName); FileUrl.SaveAs(Server.MapPath(AllPath + PicPath + fileName)); entity.PayForUrl = PicPath + fileName; } if (!StringHelper.IsNullOrEmpty(KeyValue)) { entity.Modify(KeyValue); IsOk = bll.Factory.Update(entity); if (IsOk > 0) { Message = "编辑成功。"; } } else { entity.Create(); IsOk = bll.Factory.Insert(entity); } if (IsOk > 0) { Message = "提交成功。"; string emailTit = "用户上传支付凭证通知"; string emailBody = "用户【" + ManageProvider.Provider.Current().UserName + "】已经上传支付凭证,请尽快前往处理!http://www.yealuo.com/BackstageModule/PayForMange/Index"; NetHelper.SendMailByWeb("470797533@qq.com", ConfigHelper.ReadAppConfig("FromEmail"), emailTit, emailBody, ConfigHelper.ReadAppConfig("EmailPwd"), ConfigHelper.ReadAppConfig("SmtpServer"));//发送邮件 } return Content(new JsonMessage { Success = true, Code = IsOk.ToString(), Message = Message }.ToString()); } catch (Exception ex) { return Content(new JsonMessage { Success = false, Code = "-1", Message = "操作失败:" + ex.Message }.ToString()); } } /// <summary> /// 提交用户信息 /// </summary> /// <param name="entity"></param> /// <param name="EmailCode"></param> /// <param name="NewEmailCode"></param> /// <param name="num"></param> /// <returns></returns> public ActionResult SubAccountInfo(Com_Member entity, string EmailCode, string NewEmailCode, int num = 0) { Com_MemberBll bll = new Com_MemberBll(); int IsOk = 0; string Message = "操作失败。"; bool Success = false; if (num > 0) { if (Session["EmailCode"].ToString() != Md5Helper.CreateMd5(EmailCode.ToLower(), 16)) { return Content(new JsonMessage { Success = false, Code = "-2", Message = "邮箱验证码不正确" }.ToString()); } if (num > 1) { if (Session["NewEmailCode"].ToString() != Md5Helper.CreateMd5(NewEmailCode.ToLower(), 16)) { return Content(new JsonMessage { Success = false, Code = "-2", Message = "新邮箱验证码不正确" }.ToString()); } } else { entity.Password = Md5Helper.CreateMd5(DESEncrypt.Encrypt(entity.Password, BaseFactory.BaseHelper().GetPwodKey()).ToLower(), 32).ToLower(); } } try { string MemeberID = ManageProvider.Provider.Current().UserId; entity.Modify(MemeberID); IsOk = bll.Factory.Update(entity); if (IsOk > 0) { Message = "修改成功。"; Success = true; } return Content(new JsonMessage { Success = Success, Code = IsOk.ToString(), Message = Message }.ToString()); } catch (Exception ex) { return Content(new JsonMessage { Success = false, Code = "-1", Message = "操作失败:" + ex.Message }.ToString()); } } /// <summary> /// 下载日志 /// </summary> /// <param name="jgp"></param> /// <returns></returns> public ActionResult GetDownTable(JqGridParam jgp) { Com_DownloadLogBll bll = new Com_DownloadLogBll(); string MemeberID = ManageProvider.Provider.Current().UserId; DataTable model = bll.GetTablePage(MemeberID, ref jgp); //构建分页数据 var JsonData = new { success = true, pageData = jgp, message = "", data = model }; return Content(JsonData.ToJson()); } /// <summary> /// 获取收藏记录 /// </summary> /// <param name="jgp"></param> /// <returns></returns> public ActionResult GetCollectionTable(JqGridParam jgp) { Com_ApproveBll bll = new Com_ApproveBll(); string MemeberID = ManageProvider.Provider.Current().UserId; DataTable model = bll.GetTablePage(MemeberID, "Collection", ref jgp); //构建分页数据 var JsonData = new { success = true, pageData = jgp, message = "", data = model }; return Content(JsonData.ToJson()); } /// <summary> /// 获取支付凭证记录 /// </summary> /// <param name="jgp"></param> /// <returns></returns> public ActionResult GetPayTable(JqGridParam jgp) { Com_PayForBll bll = new Com_PayForBll(); string MemeberID = ManageProvider.Provider.Current().UserId; DataTable model = bll.GetOtherTablePage(MemeberID, ref jgp); //构建分页数据 var JsonData = new { success = true, pageData = jgp, message = "", data = model }; return Content(JsonData.ToJson()); } /// <summary> /// 获取评论记录 /// </summary> /// <param name="jgp"></param> /// <returns></returns> public ActionResult GetMsgTable(JqGridParam jgp) { OND_MessageReplyBll bll = new OND_MessageReplyBll(); string MemeberID = ManageProvider.Provider.Current().UserId; DataTable model = bll.GetOtherTablePage(MemeberID, ref jgp); //构建分页数据 var JsonData = new { success = true, pageData = jgp, message = "", data = model }; return Content(JsonData.ToJson()); } /// <summary> /// 获取审批记录 /// </summary> /// <param name="DataId"></param> /// <returns></returns> public ActionResult GetApprove(string DataId) { Com_ApproveBll bll = new Com_ApproveBll(); if (!StringHelper.IsNullOrEmpty(DataId)) { List<Com_Approve> List = bll.GetApproveList(DataId, null, null); return Content(List.ToJson()); } else { return null; } } } }
然后创建对应的业务层方法:
(1)OND_MessageReplyBll.cs
using Bobo.DataAccess; using Bobo.Repository; using Bobo.Utilities; using IA.Entity; using System; using System.Collections.Generic; using System.Data; using System.Data.Common; using System.Linq; using System.Text; using System.Threading.Tasks; namespace IA.Business { // <summary> /// 评论信息表 /// <author> /// <name>YHB</name> /// <date>2018.10.18</date> /// </author> /// </summary> public class OND_MessageReplyBll : RepositoryFactory<OND_MessageReply> { /// <summary> /// 获取list分页数据 /// </summary> /// <param name="DataID"></param> /// <param name="jgp"></param> /// <returns></returns> public List<OND_MessageReply> GetListPage(string DataID,ref JqGridParam jgp) { StringBuilder Sql = new StringBuilder(); List<DbParameter> param = new List<DbParameter>(); Sql.Append(@"SELECT * FROM( SELECT y.[MessageReplyID] ,y.[DataID] ,y.[MessageReplyCenter] ,CASE ParentID WHEN '' THEN '' WHEN null THEN '' ELSE (SELECT '<p>引用'+x.CreateUserName +'发表于 '+CONVERT(nvarchar(50),x.CreateDate)+' 的回复:</p>' +'<span>'+x.MessageReplyCenter +'</span>' FROM OND_MessageReply x WHERE x.DeleteMark<>1 AND x.MessageReplyID=y.ParentID) END AS ParentID ,y.[DeleteMark] ,y.[GiveNum] ,y.[CreateDate] ,y.[CreateUserId] ,y.[CreateUserName] ,y.[ModifyDate] ,y.[ModifyUserId] ,y.[ModifyUserName] FROM [dbo].[OND_MessageReply] y WHERE y.DeleteMark<>1) T WHERE 1=1"); if (!StringHelper.IsNullOrEmpty(DataID)) { Sql.Append(@" AND DataID=@DataID"); param.Add(DbFactory.CreateDbParameter("@DataID", DataID)); } return Factory.FindListPageBySql(Sql.ToString(), param.ToArray(), ref jgp); } /// <summary> /// 获取会员评论信息 /// </summary> /// <param name="MemeberID"></param> /// <param name="jgp"></param> /// <returns></returns> public DataTable GetOtherTablePage(string MemeberID, ref JqGridParam jgp) { StringBuilder Sql = new StringBuilder(); List<DbParameter> param = new List<DbParameter>(); Sql.Append(@"SELECT * FROM( SELECT x2.ArticleTitle,x2.ArticleType ,(SELECT COUNT(*) FROM OND_MessageReply y1 WHERE y1.DeleteMark<>1 AND y1.ParentID=x1.MessageReplyID) AS ReplyNum ,x1.* FROM dbo.OND_MessageReply x1 INNER JOIN dbo.Com_Article x2 ON x1.DataID=x2.ArticleID AND x2.DeleteMark<>1 ) T WHERE DeleteMark<>1"); if (!StringHelper.IsNullOrEmpty(MemeberID)) { Sql.Append(@" AND CreateUserId=@CreateUserId"); param.Add(DbFactory.CreateDbParameter("@CreateUserId", MemeberID)); } return Factory.FindTablePageBySql(Sql.ToString(), param.ToArray(), ref jgp); } } } } }
(2)Com_PayForBll.cs:
using Bobo.DataAccess; using Bobo.Repository; using Bobo.Utilities; using IA.Entity; using System; using System.Collections.Generic; using System.Data; using System.Data.Common; using System.Linq; using System.Text; using System.Threading.Tasks; namespace IA.Business { // <summary> /// 支付流水表 /// <author> /// <name>YHB</name> /// <date>2018.10.18</date> /// </author> /// </summary> public class Com_PayForBll : RepositoryFactory<Com_PayFor> { /// <summary> /// 获取分页数据 /// </summary> /// <param name="jgp"></param> /// <returns></returns> public DataTable GetTablePage(string UserAccount, int? PayForState, ref JqGridParam jgp) { StringBuilder Sql = new StringBuilder(); List<DbParameter> param = new List<DbParameter>(); Sql.Append(@"SELECT * FROM (SELECT x2.RealName,x2.Integral AS HasIntegral,x2.MemberType, x1.* FROM Com_PayFor x1 LEFT JOIN Com_Member x2 ON x1.CreateUserId=x2.MemberID) T WHERE 1=1 AND DeleteMark<>1"); if (!StringHelper.IsNullOrEmpty(UserAccount)) { Sql.Append(@" AND RealName=@RealName"); param.Add(DbFactory.CreateDbParameter("@RealName", UserAccount)); } if (!StringHelper.IsNullOrEmpty(PayForState)) { Sql.Append(@" AND PayForState=@PayForState"); param.Add(DbFactory.CreateDbParameter("@PayForState", PayForState)); } return Factory.FindTablePageBySql(Sql.ToString(), param.ToArray(), ref jgp); } /// <summary> /// 获取充值记录 /// </summary> /// <param name="MemeberID"></param> /// <param name="jgp"></param> /// <returns></returns> public DataTable GetOtherTablePage(string MemeberID, ref JqGridParam jgp) { StringBuilder whereSql = new StringBuilder(); List<DbParameter> param = new List<DbParameter>(); whereSql.Append(@" AND DeleteMark<>1"); if (!StringHelper.IsNullOrEmpty(MemeberID)) { whereSql.Append(@" AND CreateUserId=@MemeberID"); param.Add(DbFactory.CreateDbParameter("@MemeberID", MemeberID)); } return Factory.FindTablePage(whereSql.ToString(), param.ToArray(), ref jgp); } } }
(3)Com_ApproveBll.cs
using Bobo.DataAccess; using Bobo.Repository; using Bobo.Utilities; using Bobo.Utilities.Membership; using IA.Entity; using System; using System.Collections.Generic; using System.Data; using System.Data.Common; using System.Linq; using System.Text; using System.Threading.Tasks; namespace IA.Business { // <summary> /// 审批记录表 /// <author> /// <name>YHB</name> /// <date>2018.10.18</date> /// </author> /// </summary> public class Com_ApproveBll : RepositoryFactory<Com_Approve> { /// <summary> /// 插入审批记录 /// </summary> /// <param name="DataId"></param> /// <param name="Action"></param> /// <param name="Idea"></param> /// <param name="transaction"></param> /// <returns></returns> public int SubmitApproveData(string DataId, string ActionCode, string Action, string Idea, DbTransaction transaction) { int IsOk = 0; Com_Approve entity = new Com_Approve(); try { entity.DataId = DataId; entity.ActionCode = ActionCode; entity.Action = Action; entity.Idea = Idea; entity.CreateUserId = ManageProvider.Provider.Current().UserId; entity.CreateUserName = ManageProvider.Provider.Current().UserName; entity.Create(); IsOk = Factory.Insert(entity, transaction); } catch { IsOk = -1; } return IsOk; } /// <summary> /// 获取审核记录 /// </summary> /// <param name="DataId"></param> /// <returns></returns> public List<Com_Approve> GetApproveList(string DataId, string ActionCode, string MemberID) { StringBuilder whereSql = new StringBuilder(); List<DbParameter> param = new List<DbParameter>(); whereSql.Append(@" AND DeleteMark<>1"); if (!StringHelper.IsNullOrEmpty(DataId)) { whereSql.Append(@" AND DataId=@DataId"); param.Add(DbFactory.CreateDbParameter("@DataId", DataId)); } if (!StringHelper.IsNullOrEmpty(ActionCode)) { whereSql.Append(@" AND ActionCode=@ActionCode"); param.Add(DbFactory.CreateDbParameter("@ActionCode", ActionCode)); } if (!StringHelper.IsNullOrEmpty(MemberID)) { whereSql.Append(@" AND CreateUserId=@CreateUserId"); param.Add(DbFactory.CreateDbParameter("@CreateUserId", MemberID)); } whereSql.Append(@" ORDER BY CreateDate DESC"); return Factory.FindList(whereSql.ToString(), param.ToArray()); } /// <summary> /// 获取记录 /// </summary> /// <param name="MemeberID"></param> /// <param name="ActionCode"></param> /// <param name="jgp"></param> /// <returns></returns> public DataTable GetTablePage(string MemeberID, string ActionCode, ref JqGridParam jgp) { StringBuilder Sql = new StringBuilder(); List<DbParameter> param = new List<DbParameter>(); Sql.Append(@"SELECT * FROM( SELECT x2.FileID,x2.FileTitle,x1.* FROM dbo.Com_Approve x1 INNER JOIN dbo.Com_Attachment x2 ON x2.FileID=x1.DataID AND x1.DeleteMark<>1 AND x2.DeleteMark<>1 ) T WHERE 1=1"); if (!StringHelper.IsNullOrEmpty(MemeberID)) { Sql.Append(@" AND CreateUserId=@MemeberID"); param.Add(DbFactory.CreateDbParameter("@MemeberID", MemeberID)); } if (!StringHelper.IsNullOrEmpty(ActionCode)) { Sql.Append(@" AND ActionCode=@ActionCode"); param.Add(DbFactory.CreateDbParameter("@ActionCode", ActionCode)); } return Factory.FindTablePageBySql(Sql.ToString(), param.ToArray(), ref jgp); } } }
最后我们需要创建三个视图(基本信息维护、支付套餐选择,支付凭证上传),都创建在同一个MemberSystem视图文件中:
(1)基本信息维护Index.cshtml
@using IA.Entity @using Bobo.Utilities @model Com_Member @{ ViewBag.Title ="会员中心- 页落素材网-页落网"; Layout = "~/Views/Shared/_LayoutMember.cshtml"; } <script src="~/Content/Scripts/jQuery.md5.js"></script> <script src="~/Content/Scripts/boboui-jshelp.js"></script> <script src="~/Content/Scripts/Juicer/juicer.js"></script> <script src="~/Content/Scripts/m_pager.js"></script> @*center S*@ <div id="center" style="padding-top:130px;"> <div class="member-main"> <div class="member-top"> <img src="~/Content/Images/slice/pht.png" class="member-photo L" width="100" height="125" alt="@Model.RealName"> <div class="member-txt R"> <div class="member-UserName">@Model.RealName</div> <div class="member-ico">普通会员 <a href="/MemberCenterModule/MemberSystem/RechargeView">成为VIP</a></div> <div class="member-Tip"> <b>@Model.Integral</b> 金币 <a href="/MemberCenterModule/MemberSystem/RechargeView">充值金币</a></div> </div> </div> <div class="member-tag-nav"> <a href="javascript:;" class="on tag-nav-item">我的资料</a> <a href="javascript:;" class="tag-nav-item">我的收藏</a> <a href="javascript:;" class="tag-nav-item">我的下载</a> <a href="javascript:;" class="tag-nav-item">我的充值</a> <a href="javascript:;" class="tag-nav-item">我的评论</a> </div> @* 我的资料*@ <div class="member-tag-com on"> <form id="formInfo" action="/MemberCenterModule/MemberSystem/SubAccountInfo" method="post" enctype="multipart/form-data" style="margin: 1px"> <div class="member-center-item"> <div class="member-center-title L">账号:</div> <div class="member-center-txt L">@Model.Account</div> <div class="member-center-tip L"><a href="javascript:;" onclick="AddEditBtn(1)">修改密码</a></div> </div> <div class="member-center-item"> <div class="member-center-title L">邮箱:</div> <div class="member-center-txt L">@Model.Email</div> <div class="member-center-tip L"><a href="javascript:;" onclick="AddEditBtn(2)">修改邮箱</a></div> </div> <div class="member-center-item"> <div class="member-center-title L">昵称:</div> <div class="member-center-txt L"> <input type="text" id="RealName" name="RealName" class="mc-text" value="@Model.RealName" /> </div> </div> <div class="member-center-item"> <div class="member-center-title L">手机号码:</div> <div class="member-center-txt L"> <input type="text" id="Mobile" name="Mobile" class="mc-text" value="@Model.Mobile" /> </div> </div> <div class="member-center-item"> <input type="button" class="submcBtn" onclick="SubAccountInfo(0)" value="提交修改" /> </div> </form> </div> @* 我的收藏*@ <div class="member-tag-com"> <ul class="member-list-box"> <li class="member-list-item member-list-title"> <span class="lst-item1 L">素材标题</span> <span class="lst-item2 R">收藏时间</span> </li> <div id="Collection-box"></div> </ul> <div id="CollectionPage" class="m_pageBar com_pageBar" style="padding:0 30px;"></div> </div> @* 我的下载*@ <div class="member-tag-com"> <ul class="member-list-box"> <li class="member-list-item member-list-title"> <span class="lst-item1 L">素材标题</span> <span class="lst-item2 R">下载时间</span> <span class="lst-item3 R">消费金币</span> </li> <div id="down-box"></div> </ul> <div id="downPage" class="m_pageBar com_pageBar" style="padding:0 30px;"></div> </div> @* 我的充值*@ <div class="member-tag-com"> <ul class="member-list-box"> <li class="member-list-item member-list-title"> <span class="lst-item1 L">充值套餐</span> <span class="lst-item2 R">操作</span> <span class="lst-item3 R">充值状态</span> <span class="lst-item2 R">充值时间</span> </li> <div id="Pay-box"></div> </ul> <div id="PayPage" class="m_pageBar com_pageBar" style="padding:0 30px;"></div> </div> @* 我的评论*@ <div class="member-tag-com"> <ul class="member-list-box"> <li class="member-list-item member-list-title"> <span class="lst-item1 L">文章标题</span> <span class="lst-item2 R">回复&点赞</span> <span class="lst-item2 R">评论时间</span> <span class="lst-item4 R">评论内容</span> </li> <div id="Msg-box"></div> </ul> <div id="MsgPage" class="m_pageBar com_pageBar" style="padding:0 30px;"></div> </div> </div> </div> @*center E*@ @*下载分页数据模版*@ <script id="downBody" type="text/template"> {#each data as item} <li class="member-list-item"> <a class="lst-item1 L" href="/Sccnn/Detail?KeyValue=!{item.FileID}" title="!{item.FileTitle}">!{subString(item.FileTitle,40)}</a> <span class="lst-item2 R">!{formatDate(item.CreateDate, "yyyy-MM-dd hh:mm:ss")}</span> <span class="lst-item3 R">!{item.Integral}</span> </li> {#/each} </script> @*收藏分页数据模版*@ <script id="CollectionBody" type="text/template"> {#each data as item} <li class="member-list-item"> <a class="lst-item1 L" href="/Sccnn/Detail?KeyValue=!{item.FileID}" title="!{item.FileTitle}">!{subString(item.FileTitle,40)}</a> <span class="lst-item2 R">!{formatDate(item.CreateDate, "yyyy-MM-dd hh:mm:ss")}</span> </li> {#/each} </script> @*充值分页数据模版*@ <script id="PayBody" type="text/template"> {#each data as item} <li class="member-list-item"> <a href="javascript:;" title="点击查看支付凭证" class="lst-item1 L" onclick="layer.full(layer.open({ content: $(this).find('.imgHid').html()}))"> <div style="display:none;" class="imgHid"> <img src="!{item.PayForUrl}"> </div> {#if item.PayForContent==5} <span> 5个金币/5元</span> {#else if item.PayForContent==10} <span> 10个金币/10元</span> {#else if item.PayForContent==22} <span> 22个金币/20元</span> {#else if item.PayForContent==33} <<span> 33个金币/30元</span> {#else if item.PayForContent==44} <span> 44个金币/40元</span> {#else if item.PayForContent==55} <span> 55个金币/50元</span> {#else if item.PayForContent==110} <span> 110个金币/100元</span> {#else if item.PayForContent==220} <span> 220个金币/200元</span> {#else if item.PayForContent==330} <span> 330个金币/300元</span> {#else if item.PayForContent==440} <span> 440个金币/400元</span> {#else if item.PayForContent==550} <span> 550个金币/500元</span> {#/if} </a> {#if item.PayForState>0} <span class="lst-item2 R" style="color:#999;"> 充值完成 </span> {#else} <span class="lst-item2 R"> <a href="/MemberCenterModule/MemberSystem/SubPayForm?KeyValue=!{item.PayForID}">编辑</a> </span> {#/if} {#if item.PayForState>0} <span class="lst-item3 R" style="color:#00ff21;"> 审核通过</span> {#else if item.PayForState==-1} <span class="lst-item3 R" style="color: #ff0000;"> 审核不通过 <a href="javascript:;" onclick="ApproveDetail($(this))" data-id="!{item.PayForID}">详情</a> </span> {#else} <span class="lst-item3 R" style="color:#ff6a00;">待审核 </span> {#/if} <span class="lst-item2 R">!{formatDate(item.CreateDate, "yyyy-MM-dd hh:mm:ss")}</span> </li> {#/each} </script> @*我的评论分页数据模版*@ <script id="MsgBody" type="text/template"> {#each data as item} <li class="member-list-item"> <a target="_blank" href="/WebArticle/Detail?KeyValue=!{item.DataID}&ArticleType=!{item.ArticleType}#msg-form" title="!{item.ArticleTitle}" class="lst-item1 L"> !{subString(item.ArticleTitle,21)} </a> <span class="lst-item2 R"> 回复(!{item.ReplyNum}) 点赞(!{item.GiveNum}) </span> <span class="lst-item2 R">!{formatDate(item.CreateDate, "yyyy-MM-dd hh:mm:ss")}</span> <span class="lst-item4 R" title="!{item.MessageReplyCenter}"> !{subString(item.MessageReplyCenter,21)}</span> </li> {#/each} </script> @*隐藏弹窗模版*@ <script id="PwdEdit" type="text/template"> <div style="margin:20px 20px;"> <form id="form1" action="/MemberCenterModule/MemberSystem/SubAccountInfo" method="post" enctype="multipart/form-data" style="margin: 1px"> <input type="hidden" id="KeyValue" name="KeyValue" /> <table class="layer-table-form"> <tr> <td><span class="layer-form-tit">新密码:</span><input type="password" name="Password" class="layer-form-txt" id="Password" datacol="yes" err="新密码" checkexpession="NotNull" /></td> </tr> <tr> <td><span class="layer-form-tit">确认新密码:</span><input type="password" name="truePassword" class="layer-form-txt" id="truePassword" datacol="yes" err="确认密码" checkexpession="NotNull" /></td> </tr> <tr> <td> <span class="layer-form-tit">邮箱验证码:</span><input type="text" name="EmailCode" class="layer-form-txt" id="EmailCode" datacol="yes" err="邮箱验证码" checkexpession="NotNull" /> <a href="javascript:;" class="PostEmail" onclick="PostEmail($(this),'@Model.Email', 'EmailCode')">发送邮箱验证</a> </td> </tr> </table> </form> </div> </script> <script id="EmailEdit" type="text/template"> <div style="margin:20px 20px;"> <form id="form1" action="/MemberCenterModule/MemberSystem/SubAccountInfo" method="post" enctype="multipart/form-data" style="margin: 1px"> <input type="hidden" id="KeyValue" name="KeyValue" /> <table class="layer-table-form"> <tr> <td> <span class="layer-form-tit">邮箱验证码:</span><input type="text" name="EmailCode" class="layer-form-txt" id="EmailCode" datacol="yes" err="邮箱验证码" checkexpession="NotNull" /> <a href="javascript:;" class="PostEmail" onclick="PostEmail($(this),'@Model.Email', 'EmailCode')">发送邮箱验证</a> </td> </tr> <tr> <td><span class="layer-form-tit">新邮箱:</span><input type="text" name="Email" class="layer-form-txt" id="Email" datacol="yes" err="新邮箱" checkexpession="Email" /></td> </tr> <tr> <td> <span class="layer-form-tit">新邮箱验证码:</span><input type="text" name="NewEmailCode" class="layer-form-txt" id="NewEmailCode" datacol="yes" err="新邮箱验证码" checkexpession="NotNull" /> <a href="javascript:;" class="PostEmail" onclick="PostEmail($(this), $(this).parents('table').find('#Email').val(), 'NewEmailCode')">发送新邮箱验证</a> </td> </tr> </table> </form> </div> </script> @*隐藏审批记录模版*@ <script id="DialogApprove" type="text/template"> <div class="Dialog-Box font-yahei"> <div class="Dialog-Com" style="display:block;"> <table class="Dialog-table"> <thead> <tr> <td class="Dialog-table-tit" style="text-align:center;">状态</td> <td class="Dialog-table-tit" style="text-align:center;">操作人</td> <td class="Dialog-table-tit" style="text-align:center;">操作时间</td> <td class="Dialog-table-tit" style="text-align:center;">原因</td> </tr> </thead> <tbody id="Approve"></tbody> </table> </div> </div> </script> <script type="text/javascript"> $(function () { juicer.register('formatDate', formatDate); juicer.register('subString', subString); getDownPageData(); getCollectionPageData(); getPayPageData(); getMsgPageData(); SetTagNav(); }) ///审核记录详情 function ApproveDetail(elem) { var dataId = elem.attr("data-id"); layer.open({ title: "审核记录", type: 1, skin: 'layui-layer-rim', //加上边框 area: ['700px', '500px'], //宽高 content: $("#DialogApprove").html(), }); AjaxJson("/MemberCenterModule/MemberSystem/GetApprove", { DataId: dataId }, function (data) { if (!!data) { var str = ""; for (var i = 0; i < data.length; i++) { str += "<tr>" str += "<td class=\"Dialog-table-tit\" style=\"text-align:center;\">" + data[i].Action + "</td>" str += "<td class=\"Dialog-table-tit\" style=\"text-align:center;\">" + data[i].CreateUserName + "</td>" str += "<td class=\"Dialog-table-tit\" style=\"text-align:center;\">" + formatDate(data[i].CreateDate, "yyyy-MM-dd") + "</td>" str += "<td class=\"Dialog-table-tit\" style=\"text-align:center;\">" + (!data[i].Idea ? '' : data[i].Idea) + "</td>" str += "</tr>"; } $("#Approve").html(str); } }); } //菜单切换 function SetTagNav() { $(".member-tag-nav .tag-nav-item").click(function () { if (!$(this).hasClass("on")) { $(this).addClass("on").siblings(".tag-nav-item").removeClass("on"); $(".member-tag-com").eq($(this).index()).addClass("on").siblings(".member-tag-com").removeClass("on"); } }); } //下载记录初始化分页函数 function getDownPageData() { var param = { rows: 10, url: "/MemberCenterModule/MemberSystem/GetDownTable", sidx: "CreateDate", sord: "DESC", searchForm: "", infoPanel: '#down-box', barPanel: '#downPage', template: '#downBody', callback: "" } Pager.init(param); } //收藏记录初始化分页函数 function getCollectionPageData() { var param = { rows: 10, url: "/MemberCenterModule/MemberSystem/GetCollectionTable", sidx: "CreateDate", sord: "DESC", searchForm: "", infoPanel: '#Collection-box', barPanel: '#CollectionPage', template: '#CollectionBody', callback: "" } Pager.init(param); } //充值记录初始化分页函数 function getPayPageData() { var param = { rows: 10, url: "/MemberCenterModule/MemberSystem/GetPayTable", sidx: "CreateDate", sord: "DESC", searchForm: "", infoPanel: '#Pay-box', barPanel: '#PayPage', template: '#PayBody', callback: "" } Pager.init(param); } //充值记录初始化分页函数 function getMsgPageData() { var param = { rows: 10, url: "/MemberCenterModule/MemberSystem/GetMsgTable", sidx: "CreateDate", sord: "DESC", searchForm: "", infoPanel: '#Msg-box', barPanel: '#MsgPage', template: '#MsgBody', callback: "" } Pager.init(param); } //编辑弹窗 function AddEditBtn(num) { var tem = $("#PwdEdit").html(); if (num > 1) { tem = $("#EmailEdit").html(); } layer.open({ title: "修改信息", type: 1, skin: 'layui-layer-rim', //加上边框 area: ['650px', '300px'], //宽高 content: tem, btn: ['保存', '取消'], //只是为了演示 yes: function () { SubAccountInfo(num); } }); } //提交用户信息 function SubAccountInfo(num) { var postData; if (num > 0) { if (!CheckDataValid('#form1', true)) { return false; } if ($("#Password").val() != $("#truePassword").val()) { layer.tips('两次输入的秘密不一致!', $("#truePassword")); $("#truePassword").focus(); return false; } postData = GetWebControls("#form1"); if (num == 1) { postData.Password = escape($.md5(postData.Password)); } } else { if (!CheckDataValid('#formInfo', true)) { return false; } postData = GetWebControls("#formInfo"); } AjaxJson("/MemberCenterModule/MemberSystem/SubAccountInfo?EmailCode=" + $("#EmailCode").val() + "&NewEmailCode=" + $("#NewEmailCode").val() + "&num=" + num, postData, function (data) { if (data.Code > 0) { layer.msg(data.Message, { icon: 1, time: 1000 }, function () { location.reload(); }); } else { layer.alert(data.Message, { icon: data.Code }); } } ); } //邮箱验证 function PostEmail(elem, Email, Type) { if (elem.hasClass("PostEmailActive")) { return false; } if (!isEmail(Email)) { layer.tips('请输入正确的邮箱!', $("#Email")); $("#Email").focus(); return false; } AjaxJson("/MemberCenterModule/MemberLogin/PostEmail?Type=" + Type + "&Email=" + Email,{}, function (data) { if (data.Code > 0) { layer.msg(data.Message, { icon: 1, time: 1000 }, function () { $(".PostEmail").text("发送邮箱验证").removeClass("PostEmailActive"); elem.addClass("PostEmailActive"); SetPostTime(elem, Type); }); } else { layer.alert(data.Message, { icon: data.Code }); } } ); } </script> @*发送倒计时*@ <script type="text/javascript"> function writeCookie(name, value, timeNum) {//把当前发送的时间写入cookie var expire = ""; if (timeNum != null) { expire = new Date((new Date()).getTime() + timeNum);//设置有效时间段(当前时间+设置的有效时间长度) expire = "; expires=" + expire.toGMTString();//这里分号是为与前面的拼接需要"name=xxx;expires=yyy" } document.cookie = name + "=" + escape(value) + expire + ";path=/"; } function readCookie(name) {//读取cookie中名称等于name的值 var cookieValue = ""; var search = name + "="; if (document.cookie.length > 0) { offset = document.cookie.indexOf(search); if (offset != -1) { offset += search.length; end = document.cookie.indexOf(";", offset); if (end == -1) end = document.cookie.length; cookieValue = (document.cookie.substring(offset, end)) } } return cookieValue; } var tipId; var TypeCode; var _elem; function SetPostTime(elem, Type) { TypeCode = Type; _elem = elem; writeCookie(TypeCode, (new Date()).getTime(), 60000) tipId = window.setInterval("startTiem()", 1000); } function startTiem() { var tt = parseInt(((new Date()).getTime() - readCookie(TypeCode)) / 1000); if (tt < 60) { var vv = "(" + parseInt(60 - tt) + ")秒后重新发送"; _elem.text(vv); } else { _elem.text("发送邮箱验证"); _elem.removeClass("PostEmailActive"); window.clearInterval(tipId); } } </script>
(2)充值套餐页面RechargeView.cshtml
@using IA.Entity @using Bobo.Utilities @model Com_Member @{ ViewBag.Title = "充值中心-页落素材网-页落网"; Layout = "~/Views/Shared/_LayoutMember.cshtml"; } <script src="~/Content/Scripts/layer/layer.js"></script> <div id="center" style="padding-top:130px;"> <div class="pay"> <!--主内容开始编辑--> <div class="tr_rechtext"> <p class="te_retit"><img src="~/Content/Web/img/coin.png" alt="">充值中心</p> <p>1.金币是页落素材网推出的专用于本站下载素材的虚拟货币。</p> <p>2.金币以套餐形式组合推出,你可以选择支付宝或者是微信的付款方式来进行充值,金币每次5个起充。</p> </div> <div class="tr_rechhead"> <img src="~/Content/Images/slice/pht.png"> <p> 充值帐号: <a>@Model.RealName</a> </p> <div class="tr_rechheadcion R"> <img src="~/Content/Web/img/coin.png" alt=""> <span>当前余额:<b>@Model.Integral 金币</b></span> </div> </div> <ul class="ui-choose am-form-group" id="uc_01"> <li class="ui-chli on" data-value="5">5个金币/5元</li> <li class="ui-chli" data-value="10">10个金币/10元</li> <li class="ui-chli" data-value="22">22个金币/20元</li> <li class="ui-chli" data-value="33">33个金币/30元</li> <li class="ui-chli" data-value="44">44个金币/40元</li> <li class="ui-chli" data-value="55">55个金币/50元</li> <li class="ui-chli" data-value="110">110个金币/100元</li> <li class="ui-chli" data-value="220">220个金币/200元</li> <li class="ui-chli" data-value="330">330个金币/300元</li> <li class="ui-chli" data-value="440">440个金币/400元</li> <li class="ui-chli" data-value="550">550个金币/500元</li> @*<li class="ui-choose-ling ui-chli">VIP1(23个任意下载/19元)</li> <li class="ui-choose-ling ui-chli">VIP2(50个任意下载/39元)</li> <li class="ui-choose-ling ui-chli">VIP3(100个任意下载/88元)</li> <li class="ui-choose-ling ui-chli">VIP4(一年任意下载/299元)</li>*@ <li class="chck-btn chck-btn2" onclick="PaySubData()"> 立即充值 </li> </ul> <div class="clear"></div> </div> </div> @*隐藏下载弹窗模版*@ <script id="PayTemp" type="text/template"> <div class="pay-nav"> <a href="javascript:;" class="pay-nav-item pay-wxnav on" data-type="1" onclick="setNavTag($(this))"><img src="/Content/Web/img/wxnav.png" />微信支付</a> <a href="javascript:;" class="pay-nav-item pay-zfbnav" data-type="2" onclick="setNavTag($(this))"><img src="/Content/Web/img/zfbnav.png" />支付宝支付</a> </div> <div class="pay-title">扫一扫输入套餐金额</div> <div class="pay-2vm pay-wx2vm on"><img src="/Content/Web/img/vxrm.png" /></div> <div class="pay-2vm pay-zfb2vm"><img src="/Content/Web/img/zfbrm.png" /></div> <div class="pay-tip"> <p>1.页落素材网属于个人运维网站,不支持在线接口支付。</p> <p>2.付款成功后点击完成支付跳转至上传支付凭证(支付截图),最快1分钟内即可完成支付充值,并以邮件形式通知您处理结果。</p> </div> </script> <script type="text/javascript"> $(function () { clickfun(); }); function clickfun() { $(".ui-chli").click(function () { if (!$(this).hasClass("on")) { $(this).addClass("on").siblings(".ui-chli").removeClass("on"); } }); } //支付弹窗 function PaySubData() { layer.open({ title: "充值支付", type: 1, skin: 'layui-layer-rim', //加上边框 area: ['500px', '560px'], //宽高 content: $("#PayTemp").html(), btn: ['完成支付', '取消支付'], yes: function (index) { location.href = "/MemberCenterModule/MemberSystem/SubPayForm?value=" + escape($(".ui-chli.on").attr("data-value")) + "&typev=" + escape($(".pay-nav-item.on").attr("data-type")); } }); $(".pay-title").text($(".ui-chli.on").text()); } //导航切换 function setNavTag(elem) { if (!elem.hasClass("on")) { elem.addClass("on").siblings(".pay-nav-item").removeClass("on"); $(".pay-2vm").eq(elem.index()).addClass("on").siblings(".pay-2vm").removeClass("on"); } } </script>
(3)支付凭证上传SubPayForm.cshtml
@{ ViewBag.Title = "凭证上传中心-页落素材网-页落网"; Layout = "~/Views/Shared/_LayoutMember.cshtml"; } <script src="~/Content/Scripts/layer/layer.js"></script> <div id="center" style="padding-top:130px;"> <form id="payForm" class="form" action="/MemberCenterModule/MemberSystem/SubPayDataForm" method="post" enctype="multipart/form-data" style="margin: 1px"> <div class="pay"> <div class="tr_rechtext otherretxt"> <p class="te_retit"><img src="~/Content/Web/img/up.png" alt="">凭证上传中心</p> <p>1.页落素材网属于个人运维网站,不支持在线接口支付。</p> <p>2.付款成功后可在这里上传支付凭证(支付截图),最快1分钟内即可完成支付充值。</p> </div> <div class="pay-item"> <span class="pay-tit">已购套餐类型:</span> <select class="pay-text" onchange="$('#Integral').val($(this).val());" id="PayForContent" name="PayForContent" datacol="yes" err="购买套餐" checkexpession="NotNull"> <option value="">==请选择==</option> <option value="5">5个金币/5元</option> <option value="10">10个金币/10元</option> <option value="22">22个金币/20元</option> <option value="33">33个金币/30元</option> <option value="44">44个金币/40元</option> <option value="55">55个金币/50元</option> <option value="110">110个金币/100元</option> <option value="220">220个金币/200元</option> <option value="330">330个金币/300元</option> <option value="440">440个金币/400元</option> <option value="550">550个金币/500元</option> @*<option value="VIP1(23个任意下载/19元)">VIP1(23个任意下载/19元)</option> <option value="VIP2(50个任意下载/39元)">VIP2(50个任意下载/39元)</option> <option value="VIP3(100个任意下载/88元)">VIP3(100个任意下载/88元)</option> <option value="VIP4(一年任意下载/299元)">VIP4(一年任意下载/299元)</option>*@ </select> <input type="hidden" id="Integral" name="Integral" /> </div> <div class="pay-item"> <span class="pay-tit">支付类型:</span> <select class="pay-text" id="PayForType" name="PayForType" datacol="yes" err="支付类型" checkexpession="NotNull"> <option value="">==请选择==</option> <option value="1">微信支付</option> <option value="2">支付宝支付</option> </select> </div> <div class="pay-item"> <span class="pay-tit">上传支付凭证(支付截图):</span> <input type="hidden" name="PayForUrl" id="PayForUrl" /> <input type="file" class="pay-file" name="PayForUrlFile" id="PayForUrlFile" datacol="yes" err="支付凭证" checkexpession="NotNull" /> <span style="color:#999;">格式为:.JPG|.JPEG|.PNG|.GIF|.BMP</span> </div> <input type="hidden" name="KeyValue" id="KeyValue" /> <div class="detail-czbtn" style="width:200px;"> <a href="javascript:;" onclick="SubPayData()" class="detail-btn detail-btn1">确认提交</a> </div> <div class="clear"></div> </div> </form> </div> <script type="text/javascript"> var value = GetQuery('value').replace("null", "5"); var typev = GetQuery('typev').replace("null", "1"); var KeyValue = GetQuery('KeyValue').replace("null", ""); $(function () { if (!!KeyValue) { InitControl(); $("#KeyValue").val(KeyValue); } else { $("#PayForContent").val(!!value ? value : 5); $("#Integral").val(!!value ? value : 5); $("#PayForType").val(!!typev ? typev : 1); } }); function InitControl() { AjaxJson("/MemberCenterModule/MemberSystem/GetPayInit", { KeyValue: KeyValue }, function (data) { SetWebControls(data, "#payForm"); }); } //提交支付凭证 function SubPayData() { if (!CheckDataValid('#payForm', true)) { return false; } //提交表单 $("#payForm").ajaxSubmit({ dataType: "json", beforeSubmit: function () { layer.msg('正在提交信息,请稍后…', { icon: 16, shade: 0.2, time: 0 }); }, success: function (data) { if (data.Success) { layer.msg(data.Message, { icon: data.Code, time: 1000 }, function () { window.location.href = "/MemberCenterModule/MemberSystem/Index"; }); } else { layer.alert(data.Message, { icon: data.Code }); } } }); } </script>
页面效果如下: