/// <summary> /// 拒绝退款申请 /// </summary> /// <param name="context"></param> /// <returns></returns> private string RefuseApply(HttpContext context) { string orderDetailId = context.Request["order_detail_id"]; string refuseReason = context.Request["refuse_reason"]; if (string.IsNullOrEmpty(orderDetailId)) { resp.errcode = 1; resp.errmsg = "order_detail_id 参数不能为空"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } if (string.IsNullOrEmpty(refuseReason)) { resp.errcode = 1; resp.errmsg = "拒绝理由 不能为空"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } WXMallRefund model = bllMall.GetRefundInfoByOrderDetailId(int.Parse(orderDetailId)); model.Status = 2; model.RefuseReason = refuseReason; model.UpdateTime = DateTime.Now; WXMallOrderDetailsInfo orderDetail = bllMall.GetOrderDetail(model.OrderDetailId); orderDetail.RefundStatus = "2"; if (!bllMall.Update(orderDetail)) { resp.errcode = 1; resp.errmsg = "操作失败"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } if (bllMall.Update(model)) { resp.errmsg = "ok"; //插入维权记录 WXMallRefundLog log = new WXMallRefundLog(); log.OrderDetailId = model.OrderDetailId; log.Role = "商家"; log.Title = "拒绝退款申请"; log.LogContent = string.Format("拒绝原因:{0}", model.RefuseReason); log.InsertDate = DateTime.Now; log.WebSiteOwner = bllMall.WebsiteOwner; bllMall.Add(log); //插入维权记录 try { var result = yikeClient.UpdateRefundStatus(model); } catch (Exception) { } } else { resp.errcode = 1; resp.errmsg = "操作失败"; } return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); }
/// <summary> ///修改退款状态为重新打开 /// </summary> /// <param name="context"></param> /// <returns></returns> private string ReOpen(HttpContext context) { string orderDetailId = context.Request["order_detail_id"]; if (string.IsNullOrEmpty(orderDetailId)) { resp.errcode = 1; resp.errmsg = "order_detail_id 参数不能为空"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } WXMallRefund model = bllMall.GetRefundInfoByOrderDetailId(int.Parse(orderDetailId)); model.Status = 0; if (bllMall.Update(model)) { resp.errmsg = "ok"; WXMallRefundLog log = new WXMallRefundLog(); log.OrderDetailId = model.OrderDetailId; log.Role = "商家"; log.Title = "修改退款状态为重新打开"; log.LogContent = string.Format("修改退款状态为重新打开"); log.InsertDate = DateTime.Now; log.WebSiteOwner = model.WebSiteOwner; bllMall.Add(log); WXMallOrderDetailsInfo orderDetail = bllMall.GetOrderDetail(model.OrderDetailId); orderDetail.RefundStatus = "0"; bllMall.Update(orderDetail); WXMallOrderInfo orderInfo = bllMall.GetOrderInfo(orderDetail.OrderID); if (orderInfo.IsRefund == 0) { bllMall.Update(orderInfo, string.Format(" IsRefund=1"), string.Format(" OrderID='{0}'", orderInfo.OrderID)); } } else { resp.errcode = 1; resp.errmsg = "操作失败"; } return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); }
/// <summary> /// 关闭退款申请 /// </summary> /// <param name="context"></param> /// <returns></returns> private string Close(HttpContext context) { string orderDetailId = context.Request["order_detail_id"]; WXMallRefund model = bllMall.GetRefundInfoByOrderDetailId(int.Parse(orderDetailId)); model.Status = 7; WXMallOrderDetailsInfo orderDetail = bllMall.GetOrderDetail(model.OrderDetailId); orderDetail.RefundStatus = model.Status.ToString(); if (!bllMall.Update(orderDetail)) { resp.errcode = 1; resp.errmsg = "操作失败"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } if (bllMall.Update(model)) { resp.errmsg = "ok"; //插入维权记录 WXMallRefundLog log = new WXMallRefundLog(); log.OrderDetailId = model.OrderDetailId; log.Role = "买家"; log.Title = "关闭退款申请"; log.LogContent = string.Format("买家已经关闭退款申请"); log.InsertDate = DateTime.Now; log.WebSiteOwner = bllMall.WebsiteOwner; bllMall.Add(log); //插入维权记录 try { if (bllCommRelation.ExistRelation(BLLJIMP.Enums.CommRelationType.SyncYike, bllCommRelation.WebsiteOwner, "")) { var result = yikeClient.UpdateRefundStatus(model); } } catch (Exception) { } WXMallOrderInfo orderInfo = bllMall.GetOrderInfo(model.OrderId); orderInfo.IsRefund = 0; bllMall.Update(orderInfo); //查询订单是否还有退款,如果没有退款了,而且还有暂时取消的冻结积分记录,则反取消积分 var lockScoreModel = bllScore.GetLockScoreByOrder(orderInfo.OrderID); if (lockScoreModel != null) { if (lockScoreModel.LockStatus == 2 && bllOrder.GetOrderHasRefundCount(orderInfo.OrderID) == 0) { bllScore.UnCancelLockScoreByOrder(orderInfo.OrderID, DateTime.Now.ToString() + " 订单退款已全部关闭,恢复取消的即将到账积分 "); } } } else { resp.errcode = 1; resp.errmsg = ""; } return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); }
/// <summary> /// 买家发货 /// </summary> /// <param name="context"></param> /// <returns></returns> private string SubmitExpressInfo(HttpContext context) { string orderDetailId = context.Request["order_detail_id"]; string expressCompanyName = context.Request["express_company_name"]; string expressNumber = context.Request["express_number"]; if (string.IsNullOrEmpty(orderDetailId)) { resp.errcode = 1; resp.errmsg = "order_detail_id 参数不能为空"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } if (string.IsNullOrEmpty(expressCompanyName)) { resp.errcode = 1; resp.errmsg = "express_company_name 参数不能为空"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } if (string.IsNullOrEmpty(expressNumber)) { resp.errcode = 1; resp.errmsg = "express_number 参数不能为空"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } WXMallRefund model = bllMall.GetRefundInfoByOrderDetailId(int.Parse(orderDetailId)); model.ExpressCompanyName = expressCompanyName; model.ExpressNumber = expressNumber; model.Status = 3; WXMallOrderDetailsInfo orderDetail = bllMall.GetOrderDetail(model.OrderDetailId); orderDetail.RefundStatus = model.Status.ToString(); if (!bllMall.Update(orderDetail)) { resp.errcode = 1; resp.errmsg = "操作失败"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } if (bllMall.Update(model)) { resp.errmsg = "ok"; //插入维权记录 WXMallRefundLog log = new WXMallRefundLog(); log.OrderDetailId = model.OrderDetailId; log.Role = "买家"; log.Title = "已经发货"; log.LogContent = string.Format("物流公司:{0}<br/>物流单号:{1}", model.ExpressCompanyName, model.ExpressNumber); log.InsertDate = DateTime.Now; log.WebSiteOwner = bllMall.WebsiteOwner; bllMall.Add(log); //插入维权记录 try { if (bllCommRelation.ExistRelation(BLLJIMP.Enums.CommRelationType.SyncYike, bllCommRelation.WebsiteOwner, "")) { var result = yikeClient.UpdateRefundStatus(model); } if (bllPer.CheckPermissionKey(bllMall.WebsiteOwner, ZentCloud.BLLPermission.Enums.PermissionSysKey.PMS_TRANSFERSAUDIT)) { string tranInfo = string.Format("订单号:{0}<br/>退款金额:{1}<br/>{2}", model.OrderId, model.RefundAmount, log.LogContent); if (bllTran.Add("MallRefund", model.RefundId, tranInfo, model.RefundAmount)) { string title = string.Format("收到退款申请"); string content = string.Format("订单号:{0}退款金额:{1}", model.OrderId, model.RefundAmount); string url = string.Format("http://{0}/app/transfersaudit/list.aspx", System.Web.HttpContext.Current.Request.Url.Host); //发送微信模板消息 bllWeixin.SendTemplateMessageToKefuTranAuditPer(title, content, url); } else { resp.errcode = 1; resp.errmsg = "发货失败"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } } } catch (Exception) { } } else { resp.errcode = 1; resp.errmsg = "发货失败"; } return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); }
/// <summary> /// 申请退款 /// </summary> /// <param name="context"></param> /// <returns></returns> private string Add(HttpContext context) { string data = context.Request["data"]; RefundRequestModel refundRequest;//订单模型 try { refundRequest = ZentCloud.Common.JSONHelper.JsonToModel <RefundRequestModel>(data); //检查 if (refundRequest.order_detail_id == 0) { resp.errcode = 1; resp.errmsg = "order_detail_id 参数不能为空"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } if (string.IsNullOrEmpty(refundRequest.refund_reason)) { resp.errcode = 1; resp.errmsg = "请填写理由"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } //if (refundRequest.refund_amount <= 0) //{ // resp.errcode = 1; // resp.errmsg = "refund_amount 参数不能小于等于0"; // return ZentCloud.Common.JSONHelper.ObjectToJson(resp); //} if (string.IsNullOrEmpty(refundRequest.phone)) { resp.errcode = 1; resp.errmsg = "请填写手机号"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } if (bllMall.GetRefundInfoByOrderDetailId(refundRequest.order_detail_id) != null) { resp.errcode = 1; resp.errmsg = "重复提交"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } //检查 WXMallOrderDetailsInfo orderDetail = bllMall.GetOrderDetail(refundRequest.order_detail_id); if (orderDetail == null) { resp.errcode = 1; resp.errmsg = "订单详情不存在"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } var maxRefundInfo = GetMaxRefundInfoModel(refundRequest.order_detail_id.ToString()); if (refundRequest.refund_amount > maxRefundInfo.max_refund_amount) { resp.errcode = 1; resp.errmsg = "最大退款金额不能大于" + maxRefundInfo.max_refund_amount + "元"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } WXMallOrderInfo orderInfo = bllMall.GetOrderInfo(orderDetail.OrderID); if (orderInfo.Status == "已取消" || orderInfo.Status == "待付款") { resp.errcode = 1; resp.errmsg = "无权访问"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } if (orderInfo.OrderUserID != currentUserInfo.UserID) { resp.errcode = 1; resp.errmsg = "无权访问"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } if (bllMall.GetCount <WXMallOrderInfo>(string.Format("OrderType=0 And ParentOrderId='{0}'", orderInfo.OrderID)) > 0) { resp.errcode = 1; resp.errmsg = "主订单不能申请退款"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } //判断是否已参与分佣金,已分佣的订单不能申请退款 if (bllMall.HasOrderCommission(orderInfo.OrderID)) { resp.errcode = 1; resp.errmsg = "订单已参与分佣,不能退款"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } //判断是否已经分积分,已经分积分的不能申请退款 var lockScoreModel = bllScore.GetLockScoreByOrder(orderInfo.OrderID); if (lockScoreModel != null) { if (lockScoreModel.LockStatus == 1) { resp.errcode = 1; resp.errmsg = "订单已返积分到账,不能退款"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } } //拆单的判断父订单是否已经分积分,已经分积分的不能申请退款 if (!string.IsNullOrWhiteSpace(orderInfo.ParentOrderId)) { var lockScoreParentModel = bllScore.GetLockScoreByOrder(orderInfo.ParentOrderId); if (lockScoreParentModel != null) { if (lockScoreParentModel.LockStatus == 1) { resp.errcode = 1; resp.errmsg = "订单已返积分到账,不能退款"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } } } #region 礼品订单 if (orderInfo.OrderType == 1) { if (string.IsNullOrEmpty(orderInfo.ParentOrderId)) { //子订单已经发货,不能退款 if (bllMall.GetCount <WXMallOrderInfo>(string.Format(" ParentOrderId='{0}' And ExpressNumber!=''", orderInfo.OrderID)) > 0) { resp.errcode = 1; resp.errmsg = "礼品已经发货,不能退款"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } } else//子订单不能退款 { resp.errcode = 1; resp.errmsg = "礼品订单不能退款"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } } #endregion WXMallRefund model = new BLLJIMP.Model.WXMallRefund(); model.RefundId = string.Format("{0}{1}", DateTime.Now.ToString("yyyyMMddHHmm"), bllMall.GetGUID(BLLJIMP.TransacType.CommAdd)); model.OrderDetailId = refundRequest.order_detail_id; model.UserId = currentUserInfo.UserID; model.RefundReason = refundRequest.refund_reason; model.RefundAmount = refundRequest.refund_amount; model.Phone = refundRequest.phone; model.Remark = refundRequest.remark; model.IsReturnProduct = refundRequest.is_return_product; model.ProductStatus = refundRequest.product_status; model.ProductName = orderDetail.ProductName; model.UpdateTime = DateTime.Now; //ProductSku productSku = bllMall.GetProductSku((int)orderDetail.SkuId); //if (productSku == null) //{ // resp.errcode = 1; // resp.errmsg = "sku已被删除"; // return ZentCloud.Common.JSONHelper.ObjectToJson(resp); //} //model.SkuSn = productSku.SkuSN; if (refundRequest.imagelist != null && refundRequest.imagelist.Length > 0) { model.ImageList = string.Join(",", refundRequest.imagelist); } model.Status = 0; model.InsertDate = DateTime.Now; model.WebSiteOwner = bllMall.WebsiteOwner; model.OrderId = orderDetail.OrderID; model.OpenId = currentUserInfo.WXOpenId; model.RefundScore = refundRequest.refund_score; model.RefundAccountAmount = refundRequest.refund_account_amount; orderDetail.RefundStatus = model.Status.ToString(); if (refundRequest.refund_score > 0 || refundRequest.refund_account_amount > 0) { if (refundRequest.refund_score > maxRefundInfo.max_refund_score) { resp.errcode = 1; resp.errmsg = "最多退还积分不能大于" + maxRefundInfo.max_refund_score; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } if (refundRequest.refund_account_amount > maxRefundInfo.max_refund_account_amount) { resp.errcode = 1; resp.errmsg = "最多退还余额不能大于" + maxRefundInfo.max_refund_account_amount; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } } model.IsContainTransportFee = maxRefundInfo.is_contain_transport_fee; if (!bllMall.Update(orderDetail)) { resp.errcode = 1; resp.errmsg = "申请失败"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } if (bllMall.Add(model)) { string isReturnProduct = "并退货"; if (model.IsReturnProduct == 0) { isReturnProduct = "不退货"; } resp.errmsg = "ok"; //插入维权记录 WXMallRefundLog log = new WXMallRefundLog(); log.OrderDetailId = model.OrderDetailId; log.Role = "买家"; log.Title = "发起了退款申请,等待商家处理"; log.LogContent = string.Format("退款原因:{0}<br/>期望结果:我要退款,{1}<br/>退款金额:{2}元<br/>退还积分:{3}<br/>退还余额:{4}<br/>退款说明:{5}<br/>联系电话:{6},货物状态:{7}", model.RefundReason, isReturnProduct, model.RefundAmount, model.RefundScore, model.RefundAccountAmount, model.Remark, model.Phone, model.ProductStatus); log.InsertDate = DateTime.Now; log.WebSiteOwner = bllMall.WebsiteOwner; bllMall.Add(log); //插入维权记录 if (orderInfo.IsRefund == 0) { bllMall.Update(orderInfo, string.Format(" IsRefund=1"), string.Format(" OrderID='{0}'", orderInfo.OrderID)); } var websiteInfo = bllMall.GetWebsiteInfoModelFromDataBase(); if (websiteInfo.IsHaveUnReadRefundOrder == 0) { websiteInfo.IsHaveUnReadRefundOrder = 1; bllMall.Update(websiteInfo); } try { if (bllCommRelation.ExistRelation(BLLJIMP.Enums.CommRelationType.SyncYike, bllCommRelation.WebsiteOwner, "")) { var result = yikeClient.Refund(model); } } catch (Exception) { } //暂时取消积分 if (lockScoreModel != null) { if (lockScoreModel.LockStatus == 0) { bllScore.CancelLockScoreByOrder(orderInfo.OrderID, DateTime.Now.ToString() + " 申请退款暂时取消积分"); } } if (model.IsReturnProduct == 0)//不退货 { if (bllPer.CheckPermissionKey(orderInfo.WebsiteOwner, ZentCloud.BLLPermission.Enums.PermissionSysKey.PMS_TRANSFERSAUDIT)) { string tranInfo = string.Format("订单号:{0}<br/>退款金额:{1}<br/>{2}", model.OrderId, model.RefundAmount, log.LogContent); if (bllTran.Add("MallRefund", model.RefundId, tranInfo, model.RefundAmount)) { string title = string.Format("收到退款申请"); string content = string.Format("订单号:{0}退款金额:{1}", model.OrderId, model.RefundAmount); string url = string.Format("http://{0}/app/transfersaudit/list.aspx", System.Web.HttpContext.Current.Request.Url.Host); //发送微信模板消息 bllWeixin.SendTemplateMessageToKefuTranAuditPer(title, content, url); } else { resp.errcode = 1; resp.errmsg = "申请失败"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } } } } else { resp.errcode = 1; resp.errmsg = "申请失败"; } } catch (Exception ex) { resp.errcode = 1; resp.errmsg = "JSON格式错误,请检查。错误信息:" + ex.Message; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); }
/// <summary> /// 修改退款信息(重新提交退款申请) /// </summary> /// <param name="context"></param> /// <returns></returns> private string Update(HttpContext context) { string data = context.Request["data"]; RefundRequestModel refundRequest;//订单模型 try { refundRequest = ZentCloud.Common.JSONHelper.JsonToModel <RefundRequestModel>(data); //检查 if (refundRequest.order_detail_id == 0) { resp.errcode = 1; resp.errmsg = "order_detail_id 参数不能为空"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } if (string.IsNullOrEmpty(refundRequest.refund_reason)) { resp.errcode = 1; resp.errmsg = "请填写理由"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } //if (refundRequest.refund_amount <= 0) //{ // resp.errcode = 1; // resp.errmsg = "refund_amount 参数不能小于等于0"; // return ZentCloud.Common.JSONHelper.ObjectToJson(resp); //} if (string.IsNullOrEmpty(refundRequest.phone)) { resp.errcode = 1; resp.errmsg = "请填写手机号"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } var maxRefundInfo = GetMaxRefundInfoModel(refundRequest.order_detail_id.ToString()); if (refundRequest.refund_amount > maxRefundInfo.max_refund_amount) { resp.errcode = 1; resp.errmsg = "最大退款金额不能大于" + maxRefundInfo.max_refund_amount + "元"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } if (refundRequest.refund_score > 0 || refundRequest.refund_account_amount > 0) { if (refundRequest.refund_score > maxRefundInfo.max_refund_score) { resp.errcode = 1; resp.errmsg = "最多退还积分不能大于" + maxRefundInfo.max_refund_score; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } if (refundRequest.refund_account_amount > maxRefundInfo.max_refund_account_amount) { resp.errcode = 1; resp.errmsg = "最多退还余额不能大于" + maxRefundInfo.max_refund_account_amount; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } } //检查 WXMallRefund model = bllMall.GetRefundInfoByOrderDetailId(refundRequest.order_detail_id); model.OrderDetailId = refundRequest.order_detail_id; model.UserId = currentUserInfo.UserID; model.RefundReason = refundRequest.refund_reason; model.RefundAmount = refundRequest.refund_amount; model.RefundScore = refundRequest.refund_score; model.RefundAccountAmount = refundRequest.refund_account_amount; model.Phone = refundRequest.phone; model.Remark = refundRequest.remark; model.IsReturnProduct = refundRequest.is_return_product; if (refundRequest.imagelist != null && refundRequest.imagelist.Length > 0) { model.ImageList = string.Join(",", refundRequest.imagelist); } model.Status = 0; model.InsertDate = DateTime.Now; model.RefundAddress = ""; model.RefuseReason = ""; model.ExpressCompanyCode = ""; model.ExpressCompanyName = ""; model.ExpressNumber = ""; model.ProductStatus = refundRequest.product_status; model.UpdateTime = DateTime.Now; WXMallOrderDetailsInfo orderDetail = bllMall.GetOrderDetail(model.OrderDetailId); WXMallOrderInfo orderInfo = bllMall.GetOrderInfo(orderDetail.OrderID); orderDetail.RefundStatus = model.Status.ToString(); if (!bllMall.Update(orderDetail)) { resp.errcode = 1; resp.errmsg = "操作失败"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } if (bllMall.Update(model)) { string isReturnProduct = "并退货"; if (model.IsReturnProduct == 0) { isReturnProduct = "不退货"; } resp.errmsg = "ok"; //插入维权记录 WXMallRefundLog log = new WXMallRefundLog(); log.OrderDetailId = model.OrderDetailId; log.Role = "买家"; log.Title = "修改了退款申请,等待商家处理"; log.LogContent = string.Format("退款原因:{0}<br/>期望结果:我要退款,{1}<br/>退款金额:{2}元<br/>退还积分:{3}<br/>退还余额:{4}<br/>退款说明:{5}<br/>联系电话:{6},货物状态:{7}", model.RefundReason, isReturnProduct, model.RefundAmount, model.RefundScore, model.RefundAccountAmount, model.Remark, model.Phone, model.ProductStatus); log.InsertDate = DateTime.Now; log.WebSiteOwner = bllMall.WebsiteOwner; bllMall.Add(log); if (orderInfo.IsRefund == 0) { bllMall.Update(orderInfo, string.Format(" IsRefund=1"), string.Format(" OrderID='{0}'", orderInfo.OrderID)); } var websiteInfo = bllMall.GetWebsiteInfoModelFromDataBase(); if (websiteInfo.IsHaveUnReadRefundOrder == 0) { websiteInfo.IsHaveUnReadRefundOrder = 1; bllMall.Update(websiteInfo); } //插入维权记录 try { if (bllCommRelation.ExistRelation(BLLJIMP.Enums.CommRelationType.SyncYike, bllCommRelation.WebsiteOwner, "")) { var result = yikeClient.UpdateRefundStatus(model); } } catch (Exception) { } } else { resp.errcode = 1; resp.errmsg = "申请失败"; } } catch (Exception ex) { resp.errcode = 1; resp.errmsg = "JSON格式错误,请检查。错误信息:" + ex.Message; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); }
/// <summary> /// 同意退款申请,提交退货地址接口 /// </summary> /// <param name="context"></param> /// <returns></returns> private string AgreeAndSubmitRefundAddress(HttpContext context) { string orderDetailId = context.Request["order_detail_id"]; string refundAddress = context.Request["refund_address"]; if (string.IsNullOrEmpty(orderDetailId)) { resp.errcode = 1; resp.errmsg = "order_detail_id 参数不能为空"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } if (string.IsNullOrEmpty(refundAddress)) { resp.errcode = 1; resp.errmsg = "退货地址不能为空"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } WXMallRefund model = bllMall.GetRefundInfoByOrderDetailId(int.Parse(orderDetailId)); model.Status = 1; model.RefundAddress = refundAddress; WXMallOrderDetailsInfo orderDetail = bllMall.GetOrderDetail(model.OrderDetailId); orderDetail.RefundStatus = model.Status.ToString(); if (!bllMall.Update(orderDetail)) { resp.errcode = 1; resp.errmsg = "操作失败"; return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); } if (bllMall.Update(model)) { resp.errmsg = "ok"; //插入维权记录 WXMallRefundLog log = new WXMallRefundLog(); log.OrderDetailId = model.OrderDetailId; log.Role = "商家"; log.Title = "同意退款申请"; log.LogContent = string.Format("退货地址:{0}", model.RefundAddress); log.InsertDate = DateTime.Now; log.WebSiteOwner = bllMall.WebsiteOwner; bllMall.Add(log); //插入维权记录 try { var result = yikeClient.UpdateRefundStatus(model); } catch (Exception) { } //if (bllPer.CheckPermissionKey(bllMall.WebsiteOwner, ZentCloud.BLLPermission.Enums.PermissionSysKey.PMS_TRANSFERSAUDIT)) //{ // string tranInfo = string.Format("订单号:{0}<br/>退款金额:{1}<br/>{2}", model.OrderId, model.RefundAmount, log.LogContent); // if (bllTran.Add("MallRefund", model.RefundId, tranInfo, model.RefundAmount)) // { // string title = string.Format("收到退款申请"); // string content = string.Format("订单号:{0}退款金额:{1}", model.OrderId, model.RefundAmount); // string url = string.Format("http://{0}/app/transfersaudit/list.aspx", System.Web.HttpContext.Current.Request.Url.Host); // //发送微信模板消息 // bllWeixin.SendTemplateMessageToKefuTranAuditPer(title, content, url); // } // else // { // resp.errcode = 1; // resp.errmsg = "操作失败"; // return ZentCloud.Common.JSONHelper.ObjectToJson(resp); // } //} } else { resp.errcode = 1; resp.errmsg = "操作失败"; } return(ZentCloud.Common.JSONHelper.ObjectToJson(resp)); }