254 lines
9.5 KiB
C#
254 lines
9.5 KiB
C#
using Ninject;
|
|
using System.Collections.Generic;
|
|
using System.Data.SqlClient;
|
|
using System.Web.Mvc;
|
|
using WX.CRM.BLL;
|
|
using WX.CRM.Common;
|
|
using WX.CRM.IBLL.Wx;
|
|
using WX.CRM.Model.Entity;
|
|
using WX.CRM.WebHelper;
|
|
|
|
namespace WX.CRM.WEB.Controllers.WeiXin
|
|
{
|
|
public class SzzyOrder2Controller : BaseController
|
|
{
|
|
[Inject]
|
|
public IWX_SZZYPRODUCT wx_SzzyProduct_BL { get; set; }
|
|
|
|
[Inject]
|
|
public IWX_SZZYSUBPRODUCT wx_SzzySubProduct_BL { get; set; }
|
|
|
|
[Inject]
|
|
public IWX_SZZYORDER2 wx_SzzyOrder2_BL { get; set; }
|
|
|
|
[Inject]
|
|
public IWX_SZZYORDER wx_SzzyOrder_BL { get; set; }
|
|
|
|
|
|
[AuthorizeRedirect(Roles = InitRights.CONST_订单列表三部)]
|
|
public ActionResult OrderList()
|
|
{
|
|
//ToolBar
|
|
ToolBar tool = new ToolBar();
|
|
string[] toolbtn = new ToolButtonView().ToolButtonRight(InitRights.订单列表三部, userRightId);
|
|
tool.AllowButton(toolbtn);
|
|
tool.AddOtherButton("Other1", "登录三部查看工单", "icon-detail", "ShowMemo_Click", true);
|
|
ViewBag.ToolBar = tool;
|
|
//table
|
|
Pager pager = new Pager() { page = 1, rows = 20 };
|
|
string tableId = "tablist";
|
|
Table tab = new Table(tableId);
|
|
|
|
tab.AddHiddenHeadCol("ORDERID", "编号");
|
|
tab.AddHeadCol("RESID", "", "客户ID");
|
|
//tab.AddHeadCol("INNERUSERID", "", "工号");
|
|
tab.AddHeadCol("SUBPRODUCTNAME", "", "产品");
|
|
tab.AddHeadCol("NEEDPAY", "", "应付金额");
|
|
tab.AddHeadCol("FINALPAY", "", "实付金额");
|
|
tab.AddHeadCol("ARRIVALPAY", "", "到账金额");
|
|
tab.AddHeadCol("ARRIVALTIME", "", "到账时间");
|
|
tab.AddHeadCol("SZZYORDERID", "", "订单ID");
|
|
tab.AddHeadCol("CNAME", "", "客户姓名");
|
|
tab.AddHeadCol("ORDERTYPE", "", "订单类型");
|
|
tab.AddHeadCol("ORDERSTATUS", "", "订单状态");
|
|
tab.AddHeadCol("CTIME", "", "下单时间");
|
|
tab.AddHeadCol("OTIME", "", "开通时间");
|
|
tab.AddHeadCol("FCTEXT", "", "订单分成");
|
|
tab.AddHeadCol("SOURCE", "", "客户来源");
|
|
tab.AddHeadCol("CUSTOMERUSERNAME", "", "客户微信用户名");
|
|
tab.AddHeadCol("ISOPEN", "", "参与分成");
|
|
|
|
tab.AddHeadRow();
|
|
ViewBag.gridTable = tab.GetHead() + Pagination.GetPage(pager, tableId, "5,10,15,20");
|
|
ViewBag.productList = getAllProductList();
|
|
return View();
|
|
}
|
|
|
|
[HttpPost]
|
|
[AuthorizeRedirect(Roles = InitRights.CONST_订单列表三部)]
|
|
public JsonResult GetOrderList(Pager pager, string resId, string contractCode, string szzyOrderId, decimal productId, decimal subProductId, decimal orderType, string stime, string etime, string orderStatus, string ostime, string oetime, string fcText, string cname, string columns)
|
|
{
|
|
|
|
List<WX_SZZYORDER2> list = wx_SzzyOrder2_BL.GetList2(ref pager, resId, contractCode, szzyOrderId, productId, subProductId, orderType, stime, etime, orderStatus, ostime, oetime, fcText, cname);
|
|
Table table = new Table(columns, true);
|
|
table.gridPager = pager;
|
|
foreach (var model in list)
|
|
{
|
|
table.AddHiddenCol(model.ORDERID);
|
|
var linkUrl = string.Format("<a href=\"javascript:parent.ChildAddTab('{0}', '{1}', '')\">{2}</a>"
|
|
, "客户详细"
|
|
, "/Csvr/CustomerInfo/CustomerDetail?resid=" + model.RESID
|
|
, model.RESID);
|
|
if (model.RESID == "合计")
|
|
table.AddCol(model.RESID);
|
|
else
|
|
table.AddCol(linkUrl);
|
|
//table.AddCol(InnerUserHelper.Instance.GetEid(model.INNERUSERID));
|
|
table.AddCol(model.SUBPRODUCTNAME);
|
|
table.AddCol(model.NEEDPAY);
|
|
table.AddCol(model.FINALPAY);
|
|
table.AddCol(model.ARRIVALPAY);
|
|
table.AddCol(model.ARRIVALTIME);
|
|
table.AddCol(model.SZZYORDERID);
|
|
var subName = model.CNAME;
|
|
if (!string.IsNullOrEmpty(subName) && subName.Length > 3)
|
|
subName = string.Format("<span title=\"{0}\">{1}</span>", model.CNAME, model.CNAME.Substring(0, 3) + "...");
|
|
table.AddCol(subName);
|
|
//table.AddCol(model.ORDERID);
|
|
table.AddCol(getOrderTypeStr(model.ORDERTYPE.Value));
|
|
table.AddCol(getOrderStatusStr(model.ORDERSTATUS));
|
|
table.AddCol(model.CTIME);
|
|
table.AddCol(model.OTIME);
|
|
//var payInfoUrl = string.Format("<a href=\"javascript:GetWxPayInfo('{0}')\">获取二维码</a>", model.ORDERID);
|
|
//table.AddCol(payInfoUrl);
|
|
table.AddCol(model.FCTEXT);
|
|
table.AddCol(Utility.getSourceText(model.SOURCE));
|
|
table.AddCol(model.CUSTOMERUSERNAME);
|
|
table.AddCol(model.ISOPEN == 1 ? "是" : "");
|
|
table.AddRow();
|
|
}
|
|
var json = new
|
|
{
|
|
totalPages = pager.totalPages,
|
|
totalRows = pager.totalRows,
|
|
rowsList = table.GetRows()
|
|
};
|
|
return Json(json, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
private List<SelectListItem> getAllProductList()
|
|
{
|
|
List<SelectListItem> selectList = new List<SelectListItem>();
|
|
var where = PredicateExtensionses.True<WX_SZZYPRODUCT>();
|
|
Pager pager = new Pager() { page = 1, rows = int.MaxValue };
|
|
var list = wx_SzzyProduct_BL.GetList(where, m => m.PRODUCTID, pager, SortOrder.Ascending);
|
|
foreach (var szzyProduct in list)
|
|
{
|
|
selectList.Add(new SelectListItem() { Text = szzyProduct.PRODUCTNAME, Value = szzyProduct.PRODUCTID.ToString() });
|
|
}
|
|
return selectList;
|
|
}
|
|
|
|
private List<SelectListItem> getSubProductListByProductId(int productId, int isValid)
|
|
{
|
|
List<SelectListItem> selectList = new List<SelectListItem>();
|
|
var where = PredicateExtensionses.True<WX_SZZYSUBPRODUCT>();
|
|
if (productId > 0)
|
|
{
|
|
where = where.And(m => m.PRODUCTID == productId);
|
|
}
|
|
if (isValid == 1)
|
|
{
|
|
where = where.And(m => m.ISVALID == 1);
|
|
}
|
|
|
|
Pager pager = new Pager() { page = 1, rows = int.MaxValue };
|
|
var list = wx_SzzySubProduct_BL.GetList(where, m => m.SUBPRODUCTID, pager, SortOrder.Ascending);
|
|
foreach (var szzySubProduct in list)
|
|
{
|
|
selectList.Add(new SelectListItem() { Text = szzySubProduct.SUBPRODUCTNAME, Value = szzySubProduct.SUBPRODUCTID.ToString() });
|
|
}
|
|
return selectList;
|
|
}
|
|
|
|
private string getOrderTypeStr(decimal orderType)
|
|
{
|
|
if (orderType == 1)
|
|
{
|
|
return "普通订单";
|
|
}
|
|
else if (orderType == 2)
|
|
{
|
|
return "续费订单";
|
|
}
|
|
else if (orderType == 3)
|
|
{
|
|
return "升级订单";
|
|
}
|
|
else
|
|
{
|
|
return "";
|
|
}
|
|
}
|
|
|
|
private string getOrderStatusStr(string orderStatus)
|
|
{
|
|
if (orderStatus == "0")
|
|
{
|
|
return string.Format("<font style=\"color:red\">下单失败</span>");
|
|
}
|
|
else if (orderStatus == "1")
|
|
{
|
|
return "未开通";
|
|
}
|
|
else if (orderStatus == "2")
|
|
{
|
|
return "部分支付";
|
|
}
|
|
else if (orderStatus == "3")
|
|
{
|
|
return "已支付";
|
|
}
|
|
else if (orderStatus == "4")
|
|
{
|
|
return "已开通";
|
|
}
|
|
else if (orderStatus == "5")
|
|
{
|
|
return "已到期";
|
|
}
|
|
else if (orderStatus == "6")
|
|
{
|
|
return "已升级";
|
|
}
|
|
else if (orderStatus == "7")
|
|
{
|
|
return "已退款";
|
|
}
|
|
else if (orderStatus == "8")
|
|
{
|
|
return "已取消";
|
|
}
|
|
else if (orderStatus == "9")
|
|
{
|
|
return "已关闭";
|
|
}
|
|
else if (orderStatus == "10")
|
|
{
|
|
return "隐藏";
|
|
}
|
|
else
|
|
{
|
|
return "";
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public JsonResult GetSubProductList(int productId)
|
|
{
|
|
return Json(this.getSubProductListByProductId(productId, 1), JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
public JsonResult GetAllSubProductList(int productId)
|
|
{
|
|
return Json(this.getSubProductListByProductId(productId, 0), JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
public JsonResult GetSubProductPriceById(int subProductId)
|
|
{
|
|
var subProduct = wx_SzzySubProduct_BL.Get(m => m.SUBPRODUCTID == subProductId);
|
|
if (subProduct != null)
|
|
{
|
|
return Json(new { result = true, price = subProduct.PRICE }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
else
|
|
{
|
|
return Json(new { result = false, price = 0 }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|