308 lines
10 KiB
Plaintext
308 lines
10 KiB
Plaintext
@using WX.CRM.WebHelper;
|
|
@{
|
|
ViewBag.Title = "CreateProductOrder";
|
|
Layout = "~/Views/Shared/_Index_LayoutEdit.cshtml";
|
|
var selected = false;
|
|
}
|
|
<script src="~/Scripts/layui_ext/xm-select/xm-select.js?v=1"></script>
|
|
<style type="text/css">
|
|
.xm-option {
|
|
line-height: 30px;
|
|
}
|
|
|
|
.day-ul {
|
|
display: flex;
|
|
}
|
|
|
|
.day-ul li {
|
|
padding: 4px 8px;
|
|
border: solid 1px #d7d7d7;
|
|
border-radius: 4px;
|
|
margin: 0px 10px 0px 0px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.day-cli {
|
|
background-color: #1E9FFF;
|
|
}
|
|
|
|
#tb {
|
|
margin: 5px 35px;
|
|
}
|
|
|
|
#tb td {
|
|
padding: 5px;
|
|
}
|
|
|
|
.day-ul {
|
|
margin: 0px;
|
|
}
|
|
|
|
select[name='UserName'], select[name='deptcode'] {
|
|
width: 150px;
|
|
height: 30px;
|
|
padding: 4px;
|
|
border: solid 1px #d7d7d7;
|
|
border-radius: 2px;
|
|
}
|
|
</style>
|
|
<script type="text/javascript">
|
|
//var isOEM_Active = false;
|
|
var deptCode = '@ViewBag.DeptCode';
|
|
var hasMianOrderId = true;
|
|
$(function () {
|
|
var optionsChannel = {
|
|
el: '#ProductList',
|
|
name: 'ProductList',//表单的name属性
|
|
layVerify: '',
|
|
filterable: true,
|
|
tips: '请选择产品',
|
|
toolbar: {//工具条,全选,清空,反选,自定义
|
|
show: true,
|
|
list: [
|
|
'CLEAR'
|
|
]
|
|
},
|
|
data: [],
|
|
filterMethod: function (val, item, index, prop) {//重写搜索方法
|
|
//if (val == item.value) {//把value相同的搜索出来
|
|
// return true;
|
|
//}
|
|
if (item.name.indexOf(val) != -1) {//名称中包含的搜索出来
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
};
|
|
var selectChannel = xmSelect.render(optionsChannel);
|
|
var allChannel = @Html.Raw(ViewBag.ProductList);
|
|
selectChannel.update({ data: allChannel });
|
|
|
|
var $product = $("#ProductList");
|
|
var producntid = $product.val();
|
|
var producntname= $("#ProductList option:selected").text();
|
|
BindLevel2Module(producntid, producntname);
|
|
$product.bind("change", function () {
|
|
producntid = $(this).val();
|
|
producntname = $("#ProductList option:selected").text();
|
|
BindLevel2Module(producntid, producntname);
|
|
});
|
|
$('#saleDeptIdCombox1').combotree({
|
|
url: "/Base/InnerGroup/GetTreeList?type=4",
|
|
height: 28,
|
|
onSelect: function (node) {
|
|
$("#GID").val(node.id);
|
|
}
|
|
});
|
|
$("#btnSave").click(function () {
|
|
var username = $("#UserName").val();
|
|
var deptcode = $("#deptcode").val();
|
|
console.log(deptcode);
|
|
var days = 0;
|
|
//var price = $("#Price").val();
|
|
//if (!isOEM_Active) {
|
|
// if (days == "") {
|
|
// $.messageBox5s('提示', "开通天数不能为空");
|
|
// return;
|
|
// }
|
|
// if (price == "") {
|
|
// $.messageBox5s('提示', "支付金额不能为空");
|
|
// return;
|
|
// }
|
|
//}
|
|
//else {
|
|
// days = "0";
|
|
// price = "0";
|
|
//}
|
|
//if (deptCode == "SHZZ") {
|
|
days = $("#Days").val();
|
|
if (days == "") {
|
|
$.messager.alert("错误", "天数不能为空!", "error");
|
|
return;
|
|
}
|
|
if (isNaN(days)) {
|
|
$.messager.alert("错误", "天数只能是数字!", "error");
|
|
return;
|
|
}
|
|
var mainOrderId = $("#mainOrderId").val();
|
|
if (mainOrderId == "") {
|
|
$.messager.alert("错误", "订单号不能为空!", "error");
|
|
return;
|
|
}
|
|
if (!hasMianOrderId) {
|
|
$.messager.alert("错误", "订单号不存在!", "error");
|
|
return;
|
|
}
|
|
//}
|
|
//else {
|
|
// days = null;
|
|
//}
|
|
if (username) {
|
|
|
|
var prolists = selectChannel.getValue();
|
|
var productStr = "";
|
|
for (var i = 0; i < prolists.length; i++) {
|
|
productStr += prolists[i].value + ",";
|
|
}
|
|
var freeOrderType = '@ViewBag.freeOrderType';
|
|
var posturl = "/Level2/Leve2Order/CreateOrderNew";
|
|
if (freeOrderType == 'old') {
|
|
posturl = '/Level2/Leve2Order/CreateOrder';
|
|
}
|
|
$.r_ajax({
|
|
url: posturl,
|
|
type: "Post",
|
|
data: { UserName: username, ProductList: productStr, ResId: '@ViewBag.CustomerId', Days: days, mainOrderId: mainOrderId, deptcode: deptcode },
|
|
dataType: "json",
|
|
loading: true,
|
|
success: function (data) {
|
|
if (data.type === 0) {
|
|
//$.messageBox5s('提示', data.message);
|
|
$.messager.alert("警告", data.message, "error");
|
|
}
|
|
else {
|
|
//window.parent.parent.currenttabclose();
|
|
window.parent.$("#modalwindow").window('close');
|
|
window.parent.refreshLevel2Order();
|
|
window.parent.$.messager.alert("警告", data.message, "info");
|
|
//layui.use('layer', function () {
|
|
// var layer = layui.layer;
|
|
// layer.msg('开通成功!');
|
|
//});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
else {
|
|
$.messageBox5s('提示', "用户名不能为空!");
|
|
}
|
|
|
|
});
|
|
|
|
$("#mainOrderId").change(function () {
|
|
if (this.value != "") {
|
|
$.getJSON('/Level2/Leve2Order/MainOrderIsExists?mainOrderId=' + this.value, function (rsp) {
|
|
if (!rsp.ret) {
|
|
hasMianOrderId = false;
|
|
$.messager.alert("警告", "订单号不存在!", "error");
|
|
}
|
|
else {
|
|
hasMianOrderId = true;
|
|
}
|
|
});
|
|
}
|
|
});
|
|
$(".day-ul li").click(function () {
|
|
$(".day-ul li").removeClass('day-cli');
|
|
$(this).addClass('day-cli');
|
|
$("#Days").val($(this).attr('day'));
|
|
});
|
|
|
|
function BindLevel2Module(productId, producntName) {
|
|
//isOEM_Active = false;
|
|
if (deptCode == "SHZZ") {
|
|
$("#hidTr").show();
|
|
}
|
|
|
|
//if (producntName.indexOf("免费用户体验功能") > -1 || producntName.indexOf("付费用户特权功能") > -1 || producntName.indexOf("私人定制特权功能") > -1) {
|
|
//isOEM_Active = true;
|
|
//$("#tb tr td[name='setv']").each(function () {
|
|
// $(this).hide();
|
|
//});
|
|
//}
|
|
|
|
//$.r_ajax({
|
|
// url: "/Soft/Module/Level2Module",
|
|
// type: "Post",
|
|
// data: { productId: productId },
|
|
// dataType: "html",
|
|
// loading: true,
|
|
// success: function (data) {
|
|
// $("#module").html(data);
|
|
// }
|
|
//});
|
|
}
|
|
|
|
});
|
|
</script>
|
|
|
|
<div class="mvctool bgb">
|
|
@Html.ToolButtonPlain("btnSave", "icon-save", "保存", false, "")
|
|
</div>
|
|
<div style=" height:90%;width:100%; overflow-y:auto">
|
|
@Html.Action("CustomerInfo", "CustomerUC", new { CustomerId = ViewBag.CustomerId })
|
|
<br />
|
|
<table id="tb" style="border-collapse: separate;border-spacing: 10px;">
|
|
<tbody>
|
|
<tr>
|
|
<td>
|
|
部门归属
|
|
</td>
|
|
<td>
|
|
<select id="deptcode" name="deptcode">
|
|
<option value="">请选择...</option>
|
|
@foreach (var item in ViewBag.DeptList as List<SelectListItem>)
|
|
{
|
|
if (!selected && ViewBag.companyCode == "DNYY") /**/
|
|
{
|
|
<option value="@item.Value" selected>@item.Text</option>
|
|
selected = true;
|
|
}
|
|
else if (ViewBag.companyCode != null && item.Value.Contains(ViewBag.companyCode) && !selected)
|
|
{
|
|
<option value="@item.Value" selected>@item.Text</option>
|
|
selected = true;
|
|
}
|
|
else
|
|
{
|
|
<option value="@item.Value">@item.Text</option>
|
|
}
|
|
}
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
用 户 名
|
|
</td>
|
|
<td>
|
|
@Html.DropDownList("UserName", ViewBag.UserNameItems as IEnumerable<SelectListItem>)
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
开通天数
|
|
</td>
|
|
<td>
|
|
<ul class="day-ul">
|
|
<li day="3">3天</li>
|
|
<li day="7">7天</li>
|
|
<li day="15">15天</li>
|
|
<li day="30">30天</li>
|
|
</ul>
|
|
|
|
@Html.TextBox("Days", string.Empty, new { style = "width:50px;display:none" })
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
活动名称
|
|
</td>
|
|
<td>
|
|
<div id="ProductList" style="width:380px"></div>
|
|
</td>
|
|
</tr>
|
|
<tr id="hidTr" style="display:none;">
|
|
@*<td>
|
|
订单号
|
|
</td>
|
|
<td>
|
|
@Html.TextBox("mainOrderId")
|
|
</td>*@
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
<br />
|
|
<div id="module"></div>
|
|
</div> |