/// <summary> /// 操作名称 /// </summary> /// <param name="model"></param> private void DrowList(ZJ_WithdrawOrderModel model) { var states = new Dictionary <int, string>(); if (model != null) { switch (model.WithdrawResult) { case 1: ViewData["WithdrawResult"] = new List <SelectListItem>() { new SelectListItem() { Selected = true, Text = "Review success", Value = "2" }, new SelectListItem() { Selected = false, Text = "Review failed", Value = "3" } }; break; case 2: ViewData["WithdrawResult"] = new List <SelectListItem>() { new SelectListItem() { Selected = true, Text = "Pay success", Value = "4" }, new SelectListItem() { Selected = false, Text = "Pay failed", Value = "5" } }; break; default: break; } } else { ViewData["WithdrawResult"] = new List <SelectListItem>() { new SelectListItem() { Selected = true, Text = "Review success", Value = "2" }, new SelectListItem() { Selected = false, Text = "Review failed", Value = "3" } }; } }
public ActionResult Create(ZJ_WithdrawOrderModel model) { var name = UserInfo.CurrentUserName; if (ModelState.IsValid) { var resultModel = new ResultModel(); if (!string.IsNullOrEmpty(model.OrderNO)) { switch (model.WithdrawResult) { case 2: case 3: //审核信息 model.Verifier = name; model.VerifyDT = DateTime.Now; break; case 4: case 5: //打款信息 model.Remitter = name; model.RemittanceDT = DateTime.Now; break; default: break; } var result = _zJ_WithdrawOrderService.Update(model); if (result.IsValid) { resultModel.IsValid = true; resultModel.Messages = new List <string> { "Success" }; } else { resultModel.IsValid = true; resultModel.Messages = new List <string> { result.Messages[0] }; } var opera = string.Format("审核提现信息:OrderNO={0},操作结果:{1}", model.OrderNO, resultModel.IsValid ? "成功" : "失败"); LogPackage.InserAC_OperateLog(opera, "订单业务--提现订单"); } return(Json(resultModel, JsonRequestBehavior.AllowGet)); } return(PartialView(model)); }
/// <summary> /// 加载数据 /// </summary> /// <param name="id">对象提现订单Id</param> /// <returns></returns> public ActionResult Create(string id) { ZJ_WithdrawOrderModel model = null; if (!string.IsNullOrEmpty(id)) { var result = _zJ_WithdrawOrderService.GetZJ_WithdrawOrderById(id); if (result.Data != null) { model = result.Data; } } else { model = new ZJ_WithdrawOrderModel(); } DrowList(model); return(PartialView(model)); }
/// <summary> /// 更新提现订单 /// </summary> /// <param name="model">提现订单对象</param> /// <returns>返回true时,表示更新成功;反之,表示更新失败</returns> /// <remarks>added by jimmy,2015-7-20</remarks> public ResultModel Update(ZJ_WithdrawOrderModel model) { var result = new ResultModel(); using (var bt = this._database.Db.BeginTransaction()) { try { //更新审核信息 dynamic record = new SimpleRecord(); record.OrderNO = model.OrderNO; record.Remark = model.Remark; record.WithdrawResult = model.WithdrawResult; if (!string.IsNullOrEmpty(model.Verifier)) { record.Verifier = model.Verifier; } if (model.VerifyDT != null) { record.VerifyDT = model.VerifyDT; } if (!string.IsNullOrEmpty(model.Remitter)) { record.Remitter = model.Remitter; } if (model.RemittanceDT != null) { record.RemittanceDT = model.RemittanceDT; } if (model.WithdrawCommission != null) { record.WithdrawCommission = model.WithdrawCommission; } var upWithdrawOrder = bt.ZJ_WithdrawOrder.UpdateByOrderNO(record); if (model.WithdrawResult == (int)IWithdrawResult.ApprovedMoney) { var wOrder = bt.ZJ_WithdrawOrder.FindByOrderNO(model.OrderNO); if (wOrder != null) { model.UserID = wOrder.UserID; model.WithdrawAmount = wOrder.WithdrawAmount; model.WithdrawCommission = wOrder.WithdrawCommission; } //判断用户余额是否存在数据 ZJ_UserBalanceModel zJUserBalanceModel = bt.ZJ_UserBalance.FindByUserID(model.UserID); if (zJUserBalanceModel == null) { bt.Rollback(); result.IsValid = false; result.Messages = new List <string>() { "系统中不存在用户余额信息" }; return(result); } if ((zJUserBalanceModel.ConsumeBalance - model.WithdrawAmount - model.WithdrawCommission) < 0) { bt.Rollback(); result.IsValid = false; result.Messages = new List <string>() { "手续费用不能大于用户提现后的余额" }; return(result); } //新增用户账户金额异动 ZJ_UserBalanceChangeLogModel ulogModel = new ZJ_UserBalanceChangeLogModel(); ulogModel.UserID = model.UserID; ulogModel.AddOrCutAmount = -(model.WithdrawAmount.Value + model.WithdrawCommission.Value);//变动金额 = 提现金额 + 手续费 ulogModel.IsAddOrCut = 0; ulogModel.OldAmount = zJUserBalanceModel.ConsumeBalance; ulogModel.NewAmount = zJUserBalanceModel.ConsumeBalance - model.WithdrawAmount.Value - model.WithdrawCommission.Value; ulogModel.AddOrCutType = 3; ulogModel.OrderNo = model.OrderNO; ulogModel.Remark = model.Remark; ulogModel.IsDisplay = 1; ulogModel.CreateBy = model.Verifier; ulogModel.CreateDT = DateTime.Now; new ZJ_UserBalanceServiceWeb().UpdateZJ_UserBalance(zJUserBalanceModel, ulogModel, bt); } bt.Commit(); result.Data = upWithdrawOrder; } catch (Exception ex) { //todo错误日志记录 bt.Rollback(); result.IsValid = false; result.Messages.Add(ex.Message); throw; } } return(result); }