|
@@ -66,6 +66,7 @@
|
|
|
<article class="cl pd-20">
|
|
|
<form action="" method="post" class="form form-horizontal" id="form-article-add">
|
|
|
<input type="hidden" name="salesId" value="${order.salesId!''}" >
|
|
|
+ <input type="hidden" name="salesStoreId" id="salesStoreId" value="${order.salesStoreId!''}" >
|
|
|
|
|
|
<#--<div class="row cl">
|
|
|
<label class="form-label col-3">
|
|
@@ -119,6 +120,12 @@
|
|
|
<th width="20">手机号码:</th>
|
|
|
<td width="70" style="font-weight: normal;"><span>${order.salesAddressTel!''}</span></td>
|
|
|
</tr>
|
|
|
+ <tr>
|
|
|
+ <th width="20">销售公司:</th>
|
|
|
+ <td width="70" style="font-weight: normal;"><span>${order.companyName!''}</span></td>
|
|
|
+ <th width="20">销售渠道:</th>
|
|
|
+ <td width="70" style="font-weight: normal;"><span>${order.storeName!''}</span></td>
|
|
|
+ </tr>
|
|
|
<#-- <tr>
|
|
|
|
|
|
<th width="20">下单日期:</th>
|
|
@@ -264,6 +271,21 @@
|
|
|
</tbody>
|
|
|
</table>
|
|
|
|
|
|
+ <table class="table table-border table-bg table-bordered" style="margin-top: 10px;">
|
|
|
+ <thead>
|
|
|
+ <tr class="text-c">
|
|
|
+ <th>原订单总金额</th>
|
|
|
+ <th>现订单总金额</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody id="productStatistics">
|
|
|
+ <tr class="text-c">
|
|
|
+ <td id="originalOrderTotal">${((total/100)?string("0.##"))!''}</td>
|
|
|
+ <td id="nowOrderTotal"></td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+
|
|
|
<div class="row cl">
|
|
|
<label class="form-label col-3">
|
|
|
<div class="tit-2">
|
|
@@ -280,7 +302,9 @@
|
|
|
<th width="50">产品名称</th>
|
|
|
<th width="20">颜色</th>
|
|
|
<th width="100">产品编号</th>
|
|
|
+ <th width="10">售价</th>
|
|
|
<th width="10">产品数量</th>
|
|
|
+ <th width="10">总价</th>
|
|
|
<th width="50">修改/删除</th>
|
|
|
<th width="50">添加</th>
|
|
|
</tr>
|
|
@@ -305,11 +329,25 @@
|
|
|
<td class="itemColorBar">${orderItem.itemColorBar}</td>
|
|
|
<td>
|
|
|
<#if order.salesShippingStatus == 0>
|
|
|
+ <input type="text" style="width: 100%;text-align: center;" class="input-text input-number decimal_input input-itemProductDiscount" value="${((orderItem.itemProductDiscount/100)?string("0.##"))!''}" placeholder="产品售价" onkeyup="keyFunDecimal($(this),9999999,0),syncProductNumber()" myMinVal="0" myMaxVal="9999999">
|
|
|
+ <#else>
|
|
|
+ <input type="text" style="width: 100%;text-align: center;border: none" class="input-text input-number decimal_input input-itemProductDiscount" value="${((orderItem.itemProductDiscount/100)?string("0.##"))!''}" placeholder="产品售价" onkeyup="keyFunDecimal($(this),9999999,0),syncProductNumber()" myMinVal="0" myMaxVal="9999999" disabled="disabled">
|
|
|
+ </#if>
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ <#if order.salesShippingStatus == 0>
|
|
|
<input type="text" style="width: 100%;text-align: center;" class="input-text input-number input-itemNum" value="${orderItem.itemNum!"0"}" placeholder="产品数量" onkeyup="keyFun($(this),999,1),syncProductNumber()" onpaste="keyFun($(this),999,1),syncProductNumber()">
|
|
|
<#else>
|
|
|
<input type="text" style="width: 100%;text-align: center;border: none" class="input-text input-number input-itemNum" value="${orderItem.itemNum!"0"}" placeholder="产品数量" onkeyup="keyFun($(this),999,1),syncProductNumber()" onpaste="keyFun($(this),999,1),syncProductNumber()" disabled="disabled">
|
|
|
</#if>
|
|
|
</td>
|
|
|
+ <td>
|
|
|
+ <#if order.salesShippingStatus == 0>
|
|
|
+ <input type="text" style="width: 100%;text-align: center;" class="input-text input-number decimal_input input-itemTotal" value="${((orderItem.itemTotal/100)?string("0.##"))!''}" placeholder="总价" onkeyup="keyFunDecimal($(this),9999999,0),syncProductNumber()" myMinVal="0" myMaxVal="9999999">
|
|
|
+ <#else>
|
|
|
+ <input type="text" style="width: 100%;text-align: center;border: none" class="input-text input-number decimal_input input-itemTotal" value="${((orderItem.itemTotal/100)?string("0.##"))!''}" placeholder="总价" onkeyup="keyFunDecimal($(this),9999999,0),syncProductNumber()" myMinVal="0" myMaxVal="9999999" disabled="disabled">
|
|
|
+ </#if>
|
|
|
+ </td>
|
|
|
<td msg="${order.salesDealCode!''}">
|
|
|
<#if order.salesShippingStatus == 0>
|
|
|
<a href="javascript:void(0)" onclick="updateOrderItem(this)">修改</a>
|
|
@@ -348,11 +386,25 @@
|
|
|
<td class="itemColorBar">${orderItem.itemColorBar}</td>
|
|
|
<td>
|
|
|
<#if viceOr.salesShippingStatus == 0>
|
|
|
+ <input type="text" style="width: 100%;text-align: center;" class="input-text input-number decimal_input input-itemProductDiscount" value="${((orderItem.itemProductDiscount/100)?string("0.##"))!''}" placeholder="产品售价" onkeyup="keyFunDecimal($(this),9999999,0),syncProductNumber()" myMinVal="0" myMaxVal="9999999">
|
|
|
+ <#else>
|
|
|
+ <input type="text" style="width: 100%;text-align: center;border: none" class="input-text input-number decimal_input input-itemProductDiscount" value="${((orderItem.itemProductDiscount/100)?string("0.##"))!''}" placeholder="产品售价" onkeyup="keyFunDecimal($(this),9999999,0),syncProductNumber()" myMinVal="0" myMaxVal="9999999" disabled="disabled">
|
|
|
+ </#if>
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ <#if viceOr.salesShippingStatus == 0>
|
|
|
<input type="text" style="width: 100%;text-align: center;" class="input-text input-number input-itemNum" value="${orderItem.itemNum!"0"}" placeholder="产品数量" onkeyup="keyFun($(this),999,1),syncProductNumber()" onpaste="keyFun($(this),999,1),syncProductNumber()">
|
|
|
<#else>
|
|
|
<input type="text" style="width: 100%;text-align: center;border: none" class="input-text input-number input-itemNum" value="${orderItem.itemNum!"0"}" placeholder="产品数量" onkeyup="keyFun($(this),999,1),syncProductNumber()" onpaste="keyFun($(this),999,1),syncProductNumber()" disabled="disabled">
|
|
|
</#if>
|
|
|
</td>
|
|
|
+ <td>
|
|
|
+ <#if viceOr.salesShippingStatus == 0>
|
|
|
+ <input type="text" style="width: 100%;text-align: center;" class="input-text input-number decimal_input input-itemTotal" value="${((orderItem.itemTotal/100)?string("0.##"))!''}" placeholder="总价" onkeyup="keyFunDecimal($(this),9999999,0),syncProductNumber()" myMinVal="0" myMaxVal="9999999">
|
|
|
+ <#else>
|
|
|
+ <input type="text" style="width: 100%;text-align: center;border: none" class="input-text input-number decimal_input input-itemTotal" value="${((orderItem.itemTotal/100)?string("0.##"))!''}" placeholder="总价" onkeyup="keyFunDecimal($(this),9999999,0),syncProductNumber()" myMinVal="0" myMaxVal="9999999" disabled="disabled">
|
|
|
+ </#if>
|
|
|
+ </td>
|
|
|
<td msg="${viceOr.salesDealCode!''}">
|
|
|
<#if viceOr.salesShippingStatus == 0>
|
|
|
<a href="javascript:void(0)" onclick="updateOrderItem(this)">修改</a>
|
|
@@ -375,6 +427,7 @@
|
|
|
</tbody>
|
|
|
<div style="color: #c00;" >*已通知配货/已发货的订单不能进行更改</div>
|
|
|
</table>
|
|
|
+ <div style="color: #c00;" id="errorMsg"></div>
|
|
|
<button type="button" style=" margin-top: 10px; float: right;" class="btn btn-primary" onclick="addOrder()" >添加拆单</button>
|
|
|
|
|
|
<div class="row cl" style="margin-top: 50px;margin-bottom: 20px">
|
|
@@ -402,9 +455,11 @@
|
|
|
var $updateNode; //修改的tr元素
|
|
|
|
|
|
$(function(){
|
|
|
+ syncTotal(1);
|
|
|
+
|
|
|
//合并单元格
|
|
|
tableMana(0);
|
|
|
- tableMana(6);
|
|
|
+ tableMana(8);
|
|
|
|
|
|
$("#allDay").find("tr").each(function () {
|
|
|
var tdShow = $(this).find("td").eq(0).is(":visible");
|
|
@@ -449,6 +504,8 @@
|
|
|
shade: [0.5,'#fff'] //0.1透明度的白色背景
|
|
|
});
|
|
|
|
|
|
+ $("#errorMsg").html("");
|
|
|
+
|
|
|
var colorIdArray = colorIds.split("_");
|
|
|
for(var i=0;i<colorIdArray.length;i++){
|
|
|
var colorId = colorIdArray[i];
|
|
@@ -463,34 +520,47 @@
|
|
|
flag = false;
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
if(!flag){
|
|
|
continue;
|
|
|
}
|
|
|
+ var storeId = $("#salesStoreId").val();
|
|
|
+
|
|
|
$.ajax({
|
|
|
type: "POST",
|
|
|
- data: { colorId : colorId},
|
|
|
- url: url_path +"/admin/product/get_product",
|
|
|
+ data: {
|
|
|
+ colorId : colorId,
|
|
|
+ storeId : storeId,
|
|
|
+ salesOrderStatus : 1
|
|
|
+ },
|
|
|
+ url: url_path +"/admin/salesOrder/get_product",
|
|
|
success: function(data){
|
|
|
|
|
|
if (data.returnCode == 200 && data.returnMsg.productColorList.length > 0 ) {
|
|
|
if(isAddOrUpdate == "update"){
|
|
|
//修改
|
|
|
var productColor = data.returnMsg.productColorList[0];
|
|
|
+ var colorDiscount = accDiv(productColor.colorDiscount,100);
|
|
|
$updateNode.find("td").eq(1).html(cufte(productColor.productName));
|
|
|
$updateNode.find("td").eq(2).html(cufte(productColor.colorName));
|
|
|
$updateNode.find("td").eq(3).html(cufte(productColor.colorBar));
|
|
|
- $updateNode.find("td").eq(4).find(".input-itemNum").val(1);
|
|
|
+ $updateNode.find("td").eq(4).find(".input-itemProductDiscount").val(colorDiscount);
|
|
|
+ $updateNode.find("td").eq(5).find(".input-itemNum").val(1);
|
|
|
+ $updateNode.find("td").eq(6).find(".input-itemTotal").val(colorDiscount);
|
|
|
}else{
|
|
|
//添加
|
|
|
for(var i=0;i<data.returnMsg.productColorList.length;i++){
|
|
|
var productColor = data.returnMsg.productColorList[i];
|
|
|
+ var colorDiscount = accDiv(productColor.colorDiscount,100);
|
|
|
var html = "";
|
|
|
html += '<tr class="text-c '+ tr_node_msg +'">'
|
|
|
+ '<td msg="'+ tr_node_msg +'">'+ tr_node_msg +'</td>'
|
|
|
+ '<td>'+ cufte(productColor.productName) +'</td>'
|
|
|
+ '<td>'+ cufte(productColor.colorName) +'</td>'
|
|
|
+ '<td class="itemColorBar">'+ cufte(productColor.colorBar) +'</td>'
|
|
|
+ + '<td><input type="text" style="width: 100%;text-align: center;" class="input-text input-number decimal_input input-itemProductDiscount" value="'+ colorDiscount +'" placeholder="产品售价" onkeyup="keyFunDecimal($(this),9999999,0),syncProductNumber()" myMinVal="0" myMaxVal="9999999"></td>'
|
|
|
+ '<td><input type="text" style="width: 100%;text-align: center;" class="input-text input-number input-itemNum" value="1" placeholder="产品数量" onkeyup="keyFun($(this),999,1),syncProductNumber()" onpaste="keyFun($(this),999,1),syncProductNumber()"></td>'
|
|
|
+ + '<td><input type="text" style="width: 100%;text-align: center;" class="input-text input-number decimal_input input-itemTotal" value="'+ colorDiscount +'" placeholder="总价" onkeyup="keyFunDecimal($(this),9999999,0),syncProductNumber()" myMinVal="0" myMaxVal="9999999"></td>'
|
|
|
+ '<td msg="'+ tr_node_msg +'">'
|
|
|
+ '<a href="javascript:void(0)" onclick="updateOrderItem(this)">修改</a> '
|
|
|
+ '<a href="javascript:void(0)" onclick="deleteOrderItem(this)">删除</a>'
|
|
@@ -523,13 +593,15 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ syncProductNumber();
|
|
|
}else{
|
|
|
- layer.msg("查询商品失败", {icon: 5, time: 3000});
|
|
|
+ $("#errorMsg").append(data.resultMsg);
|
|
|
+// layer.msg("查询产品出错 { "+data.resultMsg+" } ", {icon: 5, time: 3000});
|
|
|
}
|
|
|
//合并单元格
|
|
|
tableMana(0);
|
|
|
- tableMana(6);
|
|
|
- syncProductNumber();
|
|
|
+ tableMana(8);
|
|
|
layer.close(index);
|
|
|
},
|
|
|
error:function (XMLHttpRequest, textStatus, errorThrown){
|
|
@@ -566,6 +638,8 @@
|
|
|
+ '<td>-</td>'
|
|
|
+ '<td>-</td>'
|
|
|
+ '<td>-</td>'
|
|
|
+ + '<td>-</td>'
|
|
|
+ + '<td>-</td>'
|
|
|
+ '<td msg="'+ newCode +'">'
|
|
|
+ '<a href="javascript:void(0)" onclick="deleteOrderItem(this)">删除</a>'
|
|
|
+ '</td>'
|
|
@@ -597,7 +671,7 @@
|
|
|
|
|
|
//合并单元格
|
|
|
tableMana(0);
|
|
|
- tableMana(6);
|
|
|
+ tableMana(8);
|
|
|
syncProductNumber();
|
|
|
}
|
|
|
|
|
@@ -613,9 +687,15 @@
|
|
|
flag = false;
|
|
|
}
|
|
|
});
|
|
|
+ var originalOrderTotal = Number($("#originalOrderTotal").html());
|
|
|
+ var nowOrderTotal = Number($("#nowOrderTotal").html());
|
|
|
+ if(originalOrderTotal != nowOrderTotal){
|
|
|
+ flag = false;
|
|
|
+ }
|
|
|
+
|
|
|
var msg = "确定拆单?";
|
|
|
if(!flag){
|
|
|
- msg = '产品数量出现变动,是否继续拆单?';
|
|
|
+ msg = '产品数量和金额出现变动,是否继续拆单?';
|
|
|
}
|
|
|
layer.confirm(msg,function(index){
|
|
|
toSubmitSplitOrder();
|
|
@@ -630,7 +710,16 @@
|
|
|
var salesOrderItem = new Object();
|
|
|
salesOrderItem.salesDealCode = $(this).find("td").eq(0).attr("msg");
|
|
|
salesOrderItem.itemColorBar = bar;
|
|
|
- salesOrderItem.itemNum = $(this).find("td").eq(4).find("input").val();
|
|
|
+ salesOrderItem.itemNum = $(this).find(".input-itemNum").val();
|
|
|
+
|
|
|
+ var itemProductDiscount = $(this).find(".input-itemProductDiscount").val();
|
|
|
+ itemProductDiscount = accMul(itemProductDiscount,100);
|
|
|
+ salesOrderItem.itemProductDiscount = itemProductDiscount;
|
|
|
+
|
|
|
+ var itemTotal = $(this).find(".input-itemTotal").val();
|
|
|
+ itemTotal = accMul(itemTotal,100);
|
|
|
+ salesOrderItem.itemTotal = itemTotal;
|
|
|
+
|
|
|
orderItemArray.push(salesOrderItem);
|
|
|
});
|
|
|
var orderItemJson = JSON.stringify(orderItemArray);
|
|
@@ -704,7 +793,7 @@
|
|
|
var code = $(this).find("td").eq(3).html();
|
|
|
var name = $(this).find("td").eq(1).html();
|
|
|
var colorName = $(this).find("td").eq(2).html();
|
|
|
- var number = $(this).find("td").eq(4).find("input").val();
|
|
|
+ var number = $(this).find("td").eq(5).find("input").val();
|
|
|
|
|
|
var flag = false;
|
|
|
for(var i=0;i<productArray.length;i++){
|
|
@@ -749,6 +838,36 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ syncTotal();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *同步金额
|
|
|
+ * type: 1.计算原价格 2.计算当前订单价格
|
|
|
+ */
|
|
|
+ function syncTotal(type) {
|
|
|
+ var totalAll = 0;
|
|
|
+ $("#allDay").find("tr").each(function() {
|
|
|
+ var discount = $(this).find(".input-itemProductDiscount").val();
|
|
|
+ var itemNum = $(this).find(".input-itemNum").val();
|
|
|
+ var total = accMul(discount,itemNum);
|
|
|
+
|
|
|
+ $(this).find(".input-itemTotal").val(total);
|
|
|
+ totalAll = accAdd(totalAll,total);
|
|
|
+ });
|
|
|
+ if(type == 1){
|
|
|
+ $("#nowOrderTotal").html(totalAll);
|
|
|
+ }
|
|
|
+ $("#nowOrderTotal").html(totalAll);
|
|
|
+
|
|
|
+ var originalOrderTotal = $("#originalOrderTotal").html();
|
|
|
+ if(Number(originalOrderTotal) != totalAll){
|
|
|
+ $("#nowOrderTotal").css("color","#c00");
|
|
|
+ $("#nowOrderTotal").css("font-weight","bold");
|
|
|
+ }else{
|
|
|
+ $("#nowOrderTotal").css("color","#000");
|
|
|
+ $("#nowOrderTotal").css("font-weight","normal");
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
</body>
|