Bläddra i källkod

返佣订单屏蔽余额抵扣等选项

zhijiezhao 3 år sedan
förälder
incheckning
5e3ee72f9d

+ 2 - 0
src/main/webapp/WEB-INF/views/modules/order/orderForm.jsp

@@ -907,6 +907,8 @@
         obj.value = obj.value.replace("-", "$#$").replace(/\-/g, "").replace("$#$", "-");
         obj.value = obj.value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); //只能输入两个小数
     };
+
+
 </script>
 </body>
 </html>

+ 134 - 108
src/main/webapp/static/modules/bulkpurchase/orderForm.js

@@ -17,7 +17,7 @@ var couponPrice = 0;
 var initFlag = true;
 var orderStatus = 0;
 
-$(function() {
+$(function () {
     /**  发票信息 start * */
         // var invoiceTitle=$("#orderInvoice\\.invoiceTitle").val();
         // if(invoiceTitle !='' && invoiceTitle !=null && invoiceTitle !='null'){
@@ -64,11 +64,11 @@ $(function() {
     }
 
     //单存在输入时候默认为个人发票类型
-    $("#orderInvoice\\.invoiceTitle").on('change', function() {
+    $("#orderInvoice\\.invoiceTitle").on('change', function () {
         $("#orderInvoice\\.type").val("1"); //优化发票修改
     });
 
-    $(":radio[name='normalTitle_r']").click(function() {
+    $(":radio[name='normalTitle_r']").click(function () {
         var index = $(":radio[name='normalTitle_r']").index($(this));
         $("#orderInvoice\\.corporationTaxNum").attr('value', '');
         $("#orderInvoice\\.corporationTaxNum").attr('name', '');
@@ -96,7 +96,7 @@ $(function() {
         }
     });
 
-    $(":radio[name='invoice']").click(function() {
+    $(":radio[name='invoice']").click(function () {
         var index = $(":radio[name='invoice']").index($(this));
         if (index == 1) { //选中第2个时,div显示
             $("#invoiceTable").hide();
@@ -125,7 +125,7 @@ $(function() {
     });
     /**  发票信息 end * */
 
-    $("body").on('change', '.shopNote', function() {
+    $("body").on('change', '.shopNote', function () {
         var self = $(this);
         var shopID = self.attr('data-shopid');
         var val = self.val();
@@ -133,8 +133,8 @@ $(function() {
     });
 
     /** 修改订单初始化 */
-    var orderId = $("#orderID").val()*1;
-    orderStatus = $("#orderStatus").val()*1;
+    var orderId = $("#orderID").val() * 1;
+    orderStatus = $("#orderStatus").val() * 1;
     if (orderId && orderId > 0) {
         var userId = $("#inputForm").find("[name*='bpOrderUserinfo.userId']").val();
         // 获取用户总优惠券
@@ -143,7 +143,7 @@ $(function() {
         $('#product_index').val(0);
         product_index = 0;
         var productList = [];
-        $('.productTable tbody tr:not(.gift)').each(function(index, element) {
+        $('.productTable tbody tr:not(.gift)').each(function (index, element) {
             var data = JSON.parse($(this).attr("data-value"));
             data.shopId = data.shopID ? data.shopID : data.shopId;
             data.productId = data.productID ? data.productID : data.productId;
@@ -169,7 +169,7 @@ $(function() {
                 data.shopId = data.shopID;
                 var tempId = data.productPromotion.promotionsId;
                 if (promotionsIds.indexOf(tempId) >= 0) {
-                    totalPromotions.forEach(function(item) {
+                    totalPromotions.forEach(function (item) {
                         if (item.id * 1 === tempId) {
                             for (var i = 0; i < item.promotionProducts.length; i++) {
                                 if (item.promotionProducts[i].productId == data.productId) {
@@ -199,24 +199,24 @@ $(function() {
             data.productPromotion = null;
             productList.push(data);
         });
-        $('.productTable tbody tr.gift').each(function(index, element) {
+        $('.productTable tbody tr.gift').each(function (index, element) {
             var present = JSON.parse($(this).attr("data-value"));
             present.shopId = present.shopID ? present.shopID : present.shopId;
             present.productId = present.productID ? present.productID : present.productId;
             if (present.productType == 1) {
-                productList.forEach(function(data) {
+                productList.forEach(function (data) {
                     if (present.productId == data.productId) {
                         data.presentNum = present.num;
                     }
                 });
             }
         });
-        $('.productTable').each(function(index, element) {
+        $('.productTable').each(function (index, element) {
             $(this).prev('.order-rows').remove();
             $(this).remove();
         });
         initFlag = false;
-        productList.forEach(function(data) {
+        productList.forEach(function (data) {
             setProductList(data);
         });
         setOrderFee(); //设置底部订单金额
@@ -242,7 +242,7 @@ function showClubSelect(iframe) {
             "确定": '1',
             "关闭": '-1'
         },
-        submit: function(v, h, f) {
+        submit: function (v, h, f) {
             //确定
             var $jboxFrame = top.$('#jbox-iframe');
             var $mainFrame = top.$('#mainFrame');
@@ -289,9 +289,9 @@ function setSingleSelect(items) {
     $("#inputForm").find("[name*='bpOrderUserinfo.city']").select2("val", info.city);
     $("#inputForm").find("[name*='bpOrderUserinfo.town']").select2("val", info.town);
     $("#inputForm").find("[name*='bpOrderUserinfo.name']").val(info.name);
-    $("#inputForm").find("[name*='bpOrderUserinfo.shouHuoRen']").val(info.linkMan1?info.linkMan1:info.linkMan);
-    $("#inputForm").find("[name*='bpOrderUserinfo.phonee']").val(info.contractPhone1?info.contractPhone1:info.contractPhone);
-    $("#inputForm").find("[name*='bpOrderUserinfo.mobile']").val(info.contractMobile1?info.contractMobile1:info.contractMobile);
+    $("#inputForm").find("[name*='bpOrderUserinfo.shouHuoRen']").val(info.linkMan1 ? info.linkMan1 : info.linkMan);
+    $("#inputForm").find("[name*='bpOrderUserinfo.phonee']").val(info.contractPhone1 ? info.contractPhone1 : info.contractPhone);
+    $("#inputForm").find("[name*='bpOrderUserinfo.mobile']").val(info.contractMobile1 ? info.contractMobile1 : info.contractMobile);
     $("#svipFlagLabel").text(1 == info.svipFlag ? '(超级会员)' : '');
     $("#availableBalance").html(info.ableUserMoney);
 
@@ -308,7 +308,7 @@ function setSingleSelect(items) {
 
 function getUserCoupons(userId) {
     totalCoupons = [];
-    $.get($("#ctx").val() + "/order/clubCouponList?userId="+userId, function(data) {
+    $.get($("#ctx").val() + "/order/clubCouponList?userId=" + userId, function (data) {
         if (data.code * 1 === 0) {
             totalCoupons = data.couponList;
             // 展示可选优惠券列表
@@ -316,24 +316,28 @@ function getUserCoupons(userId) {
         }
     })
 }
+
 /************************添加会所 end**********************************************************/
 
 // 兑换优惠券
-$("#redeemCoupons").on("click",  function(){
+$("#redeemCoupons").on("click", function () {
     var userId = $("#inputForm").find("[name*='bpOrderUserinfo.userId']").val();
-    if (userId && userId*1 > 0) {
+    if (userId && userId * 1 > 0) {
         var html = '<div style="text-align:center;padding-top:12px;"><input id="couponsCode" name="couponsCode" type="text" maxlength="16" placeholder="请输入16位兑换码"></div>';
         var submit = function (v, h, f) {
             if (f.couponsCode == '' || isNaN(f.couponsCode)) {
-                $.jBox.tip("请输入兑换码!", 'error', { focusId: "couponsCode" });
+                $.jBox.tip("请输入兑换码!", 'error', {focusId: "couponsCode"});
             }
             var bool = new RegExp("^[A-Za-z0-9]{16}$").test(f.couponsCode);
             if (!bool) {
                 // 16位数字和字母
-                $.jBox.tip("请输入正确的兑换码!", 'error', { focusId: "couponsCode" });
-            }else{
-                $.post($("#ctx").val() + "/coupon/cmCouponClub/redeem", {'redemptionCode': f.couponsCode, 'userId': userId}, function (data) {
-                    if (0 === data.code*1) {
+                $.jBox.tip("请输入正确的兑换码!", 'error', {focusId: "couponsCode"});
+            } else {
+                $.post($("#ctx").val() + "/coupon/cmCouponClub/redeem", {
+                    'redemptionCode': f.couponsCode,
+                    'userId': userId
+                }, function (data) {
+                    if (0 === data.code * 1) {
                         $.jBox.tip(data.msg, 'info');
                         // 获取用户总优惠券
                         getUserCoupons(userId);
@@ -343,7 +347,7 @@ $("#redeemCoupons").on("click",  function(){
                 }, "JSON");
             }
         };
-        $.jBox(html, { title: "兑换优惠券", buttons: { '立即兑换': true }, submit: submit });
+        $.jBox(html, {title: "兑换优惠券", buttons: {'立即兑换': true}, submit: submit});
     } else {
         alertx('请您先选择会所!');
     }
@@ -380,7 +384,7 @@ function editShop(obj) {
             },
             //                    buttons:{"关闭":true},
             bottomText: "设置商品",
-            submit: function(v, h, f) {
+            submit: function (v, h, f) {
                 if (v == "ok") {
                     var $jboxFrame = $('#jbox-iframe');
                     var items = $jboxFrame[0].contentWindow.getCheckedItems();
@@ -395,34 +399,34 @@ function editShop(obj) {
                     return true;
                 }
             },
-            loaded: function(h) {
+            loaded: function (h) {
                 //$(".jbox-content", top.document).css("overflow-y","hidden");
             }
         });
 }
 
 // 展示可选优惠券列表
-function getShownCouponList(){
+function getShownCouponList() {
     selectCoupons = [];
     var couponProductIds = [];
     var couponProductList = [];
-    $('.productTable tbody tr:not(.gift)').each(function(index, element) {
+    $('.productTable tbody tr:not(.gift)').each(function (index, element) {
         var data = JSON.parse($(this).attr("data-value"));
         couponProductList.push(data);
         couponProductIds.push(data.productId);
     });
-    totalCoupons.forEach(function(coupon){
+    totalCoupons.forEach(function (coupon) {
         var totalAmount = 0;
-        var couponType = coupon.couponType*1;
-        couponProductList.forEach(function(item){
+        var couponType = coupon.couponType * 1;
+        couponProductList.forEach(function (item) {
             var productPrice = item.totalFee * 1;
             if (couponType === 0) {
-                if (coupon.productType*1 === 1) {
+                if (coupon.productType * 1 === 1) {
                     //活动券-全商城商品
                     totalAmount += productPrice;
-                } else if (coupon.productType*1 === 2) {
+                } else if (coupon.productType * 1 === 2) {
                     //活动券-指定商品
-                    if (coupon.productIdList.length > 0 && coupon.productIdList.indexOf(item.productId*1) >= 0) {
+                    if (coupon.productIdList.length > 0 && coupon.productIdList.indexOf(item.productId * 1) >= 0) {
                         totalAmount += productPrice;
                     }
                 }
@@ -450,24 +454,24 @@ function getShownCouponList(){
 
 // 设置页面显示
 function setPageCoupon() {
-    var clubCouponId = $("#clubCouponId").val()*1;
+    var clubCouponId = $("#clubCouponId").val() * 1;
     var html = '<li><label><input type="radio" name="clubCouponId" value="0"><span class="couponDesc none">不使用优惠券</span></label></li>';
-    selectCoupons.forEach(function(item){
+    selectCoupons.forEach(function (item) {
         var checked = '';
         var redemptionCode = '';
         if (clubCouponId === item.clubCouponId) {
             checked = 'checked="checked"';
         }
         if (!isNaN(item.redemptionCode)) {
-            redemptionCode = '<span>兑换码:'+item.redemptionCode+'</span>';
+            redemptionCode = '<span>兑换码:' + item.redemptionCode + '</span>';
         }
         html += '<li><label>';
-        html += '       <input type="radio" name="clubCouponId" value="'+item.clubCouponId +'" '+checked+'>';
+        html += '       <input type="radio" name="clubCouponId" value="' + item.clubCouponId + '" ' + checked + '>';
         html += '       <span class="couponDesc">';
-        html += '            <span>'+item.couponName+'</span>';
+        html += '            <span>' + item.couponName + '</span>';
         html += redemptionCode;
-        html += '            <span>'+item.couponDesc+'</span>';
-        html += '            <span>有效期:'+item.startDate+' - '+item.endDate+'</span>';
+        html += '            <span>' + item.couponDesc + '</span>';
+        html += '            <span>有效期:' + item.startDate + ' - ' + item.endDate + '</span>';
         html += '</span></label></li>';
     });
     $("#couponBox").find(".couponContent").html(html);
@@ -477,11 +481,11 @@ function setPageCoupon() {
 }
 
 // 勾选优惠券重新计算总价
-$("#couponBox").on("change", "input[name=clubCouponId]", function(){
+$("#couponBox").on("change", "input[name=clubCouponId]", function () {
     couponPrice = 0;
-    var clubCouponId = $(this).val()*1;
-    selectCoupons.forEach(function(item){
-        if(item.clubCouponId*1 === clubCouponId) {
+    var clubCouponId = $(this).val() * 1;
+    selectCoupons.forEach(function (item) {
+        if (item.clubCouponId * 1 === clubCouponId) {
             couponPrice = item.couponAmount;
             $("#clubCouponId").val(clubCouponId);
             $("#couponAmount").val(couponPrice);
@@ -511,7 +515,7 @@ function orderSecondHandEditShop(obj) {
                 "关闭": true
             },
             bottomText: "设置商品",
-            submit: function(v, h, f) {
+            submit: function (v, h, f) {
                 if (v == "ok") {
                     var $jboxFrame = $('#jbox-iframe');
                     var items = $jboxFrame[0].contentWindow.getCheckedItems();
@@ -525,20 +529,21 @@ function orderSecondHandEditShop(obj) {
                     return true;
                 }
             },
-            loaded: function(h) {}
+            loaded: function (h) {
+            }
         });
 }
 
 // 修改商品的时候统计下面的订单商品金额
 function setShopOrderFee(shopId) {
     var totalFee = 0;
-    $($('#pTable_' + shopId)).find('.totalFee').each(function(index, element) {
+    $($('#pTable_' + shopId)).find('.totalFee').each(function (index, element) {
         totalFee += Number($(this).html());
     });
-    totalPromotions.forEach(function(item) {
+    totalPromotions.forEach(function (item) {
         if (item.shopId == shopId && item.type == 3 && item.mode == 2) {
             var touchPrice = 0;
-            item.promotionProducts.forEach(function(product) { //计算促销包含税费
+            item.promotionProducts.forEach(function (product) { //计算促销包含税费
                 touchPrice += (product.number * product.price + product.totalTax * 1);
             });
             if (touchPrice >= item.touchPrice) {
@@ -556,24 +561,24 @@ function deleteShop(obj) {
     var $table = $tr.parents('table');
     // 协销赠品
     var productId = $tr.attr("id").split("_")[1];
-    $('.productTable tbody tr.gift_' + productId).each(function(index, element) {
+    $('.productTable tbody tr.gift_' + productId).each(function (index, element) {
         $(this).remove();
     });
     // 促销
     var promotionsId = $tr.find('.tag').attr("data-id");
     var thisTouchPrice = 0;
-    totalPromotions.forEach(function(item) {
+    totalPromotions.forEach(function (item) {
         if (item.id == promotionsId) {
             for (var i = 0; i < item.promotionProducts.length; i++) {
                 if (item.promotionProducts[i].productId == productId) {
                     item.promotionProducts.splice(i--, 1);
                 }
             }
-            item.promotionProducts.forEach(function(p) {
+            item.promotionProducts.forEach(function (p) {
                 thisTouchPrice += p.number * p.price;
             });
             if (thisTouchPrice < item.touchPrice) {
-                $('.productTable tbody tr.promotion_' + promotionsId).each(function(index, element) {
+                $('.productTable tbody tr.promotion_' + promotionsId).each(function (index, element) {
                     $(this).remove();
                 });
             }
@@ -597,12 +602,12 @@ function resetProductList(setData) {
     var productList = [];
     var productIdList = [];
     //var if (promotionsIds.indexOf(tempId)>=0) {
-    $('.productTable tbody tr:not(.gift)').each(function(index, element) {
+    $('.productTable tbody tr:not(.gift)').each(function (index, element) {
         var data = JSON.parse($(this).attr("data-value"));
         productList.push(data);
         productIdList.push(data.productId);
     });
-    $('.productTable').each(function(index, element) {
+    $('.productTable').each(function (index, element) {
         $(this).prev('.order-rows').remove();
         $(this).remove();
     });
@@ -610,13 +615,13 @@ function resetProductList(setData) {
     totalPromotions = [];
     giftPromotionsIds = [];
     if (!setData) { //删除
-        productList.forEach(function(data) {
+        productList.forEach(function (data) {
             setProductList(data, false);
         });
     } else {
         if (productIdList.indexOf(setData.productId) >= 0) {
             //设置
-            productList.forEach(function(data) {
+            productList.forEach(function (data) {
                 if (setData.productId == data.productId) {
                     setProductList(setData, false);
                 } else {
@@ -625,7 +630,7 @@ function resetProductList(setData) {
             });
         } else {
             //新增
-            productList.forEach(function(data) {
+            productList.forEach(function (data) {
                 setProductList(data, false);
             });
             setProductList(setData, false);
@@ -684,7 +689,7 @@ function editShopProduct(obj) {
                 "关闭": true
             },
             bottomText: "设置商品",
-            submit: function(v, h, f) {
+            submit: function (v, h, f) {
                 if (v == "ok") {
                     var $jboxFrame = $('#jbox-iframe');
                     var items = $jboxFrame[0].contentWindow.getCheckedItems();
@@ -697,7 +702,8 @@ function editShopProduct(obj) {
                     return true;
                 }
             },
-            loaded: function(h) {}
+            loaded: function (h) {
+            }
         });
 }
 
@@ -716,7 +722,7 @@ function showShopSelect(iframe) {
             "确定": '1',
             "关闭": '-1'
         },
-        submit: function(v, h, f) {
+        submit: function (v, h, f) {
             //确定
             var $jboxFrame = top.$('#jbox-iframe');
             var $mainFrame = top.$('#mainFrame');
@@ -736,6 +742,7 @@ function showShopSelect(iframe) {
         },
     });
 }
+
 // 展示优惠券详情
 function showCouponDetail(userId, productId) {
     var url = ctx + "/coupon/cmCoupon/productDetails?userId=" + userId + "&productId=" + productId;
@@ -767,7 +774,7 @@ function showSencondHandSelect(iframe) {
             "确定": '1',
             "关闭": '-1'
         },
-        submit: function(v, h, f) {
+        submit: function (v, h, f) {
             //确定
             var $jboxFrame = top.$('#jbox-iframe');
             var $mainFrame = top.$('#mainFrame');
@@ -799,7 +806,7 @@ function showSencondHandSelect(iframe) {
 function setProductList(data) {
     console.log("设置" + JSON.stringify(data));
     var userId = $("#inputForm").find("[name*='bpOrderUserinfo.userId']").val();
-    var orderStatus = $("#orderStatus").val() ? $("#orderStatus").val()*1 : 0;
+    var orderStatus = $("#orderStatus").val() ? $("#orderStatus").val() * 1 : 0;
     data.productType = 0;
     var shopFee = data.shopFee;
     var cmPromotion = '';
@@ -818,7 +825,7 @@ function setProductList(data) {
                 totalTax: data.totalAddedValueTax
             };
             if (promotionsIds.indexOf(tempId) >= 0) {
-                totalPromotions.forEach(function(item) {
+                totalPromotions.forEach(function (item) {
                     if (item.id * 1 === tempId) {
                         for (var i = 0; i < item.promotionProducts.length; i++) {
                             if (item.promotionProducts[i].productId == data.productId) {
@@ -873,8 +880,8 @@ function setProductList(data) {
     }
 
     var cmCouponBtn = '---';
-    if (data.couponsLogo*1 === 2) {
-        cmCouponBtn = '<a href="javascript:;" onclick="showCouponDetail('+ userId +','+ data.productId +')">查看</a>';
+    if (data.couponsLogo * 1 === 2) {
+        cmCouponBtn = '<a href="javascript:;" onclick="showCouponDetail(' + userId + ',' + data.productId + ')">查看</a>';
     }
     var str =
         "<tr id='product_" + data.productId + "' data-value='" + JSON.stringify(data) + "' data-index='" +
@@ -886,17 +893,17 @@ function setProductList(data) {
         "<td class='fix-width'>" + data.name + "</td><td hidden></td>" +
         (data.productCategory == 2 ? "" : ("<td>" + data.shopName + "</td>")) +
         "<td>" + data.num + (data.presentNum > 0 ? "(" + data.presentNum + ")" : "") + "</td>" +
-        (data.svipPriceFlag == 1?"<td>"+data.discountPrice:
-        (data.discount * 1 === 100 && data.cmPromotion && data.cmPromotion.mode == 1 ? ("<td><del>" + data.price +
-            "</del>") : ("<td>" + data.price))) +
-        ((data.svipPriceFlag == 1 || (data.includedTax != null && data.includedTax != '' && data.includedTax != 2))?"<label style='color: red'>(":"")+
-        (data.svipPriceFlag == 1?"超级会员价":"")+
-        ((data.svipPriceFlag == 1 && (data.includedTax != null && data.includedTax != '' && data.includedTax != 2))?",":"")+
+        (data.svipPriceFlag == 1 ? "<td>" + data.discountPrice :
+            (data.discount * 1 === 100 && data.cmPromotion && data.cmPromotion.mode == 1 ? ("<td><del>" + data.price +
+                "</del>") : ("<td>" + data.price))) +
+        ((data.svipPriceFlag == 1 || (data.includedTax != null && data.includedTax != '' && data.includedTax != 2)) ? "<label style='color: red'>(" : "") +
+        (data.svipPriceFlag == 1 ? "超级会员价" : "") +
+        ((data.svipPriceFlag == 1 && (data.includedTax != null && data.includedTax != '' && data.includedTax != 2)) ? "," : "") +
         (data.includedTax == 1 ? "含税" : data.includedTax == 0 && (data
             .invoiceType == 1 || data.invoiceType == 2) ? "不含税-能开票" : data
             .includedTax != '' && data.includedTax == 0 && data.invoiceType == 3 ?
             "不含税-不能开票" : "") +
-        ((data.svipPriceFlag == 1 || (data.includedTax != null && data.includedTax != '' && data.includedTax != 2))?")</label>":"")+
+        ((data.svipPriceFlag == 1 || (data.includedTax != null && data.includedTax != '' && data.includedTax != 2)) ? ")</label>" : "") +
         "</td>" +
         "<td>" + data.discount + "</td>" +
         (data.discount * 1 === 100 && data.cmPromotion && data.cmPromotion.mode == 1 ? ("<td><del>" + data
@@ -915,8 +922,8 @@ function setProductList(data) {
         ((data.productCategory == 2) ? "" : "<td>" + cmPromotion + "</td>") +
         ((data.productCategory == 2) ? "" : "<td>" + cmCouponBtn + "</td>") +
         "<td>" + (orderStatus != 0 ? "" : (data.productCategory == 2) ?
-            "<a href='javascript:void(0);' onclick='orderSecondHandEditShop($(this))'>设置</a>&nbsp;&nbsp;<a href='javascript:void(0);' onclick='deleteShopProduct($(this))'>删除商品</a>" :
-            "<a href='javascript:void(0);' onclick='editShopProduct($(this))'>设置</a>&nbsp;&nbsp;<a href='javascript:void(0);' onclick='deleteShopProduct($(this))'>删除商品</a>"
+                "<a href='javascript:void(0);' onclick='orderSecondHandEditShop($(this))'>设置</a>&nbsp;&nbsp;<a href='javascript:void(0);' onclick='deleteShopProduct($(this))'>删除商品</a>" :
+                "<a href='javascript:void(0);' onclick='editShopProduct($(this))'>设置</a>&nbsp;&nbsp;<a href='javascript:void(0);' onclick='deleteShopProduct($(this))'>删除商品</a>"
         ) +
         "</td>" +
         "</tr>";
@@ -927,7 +934,7 @@ function appendProductList(str, data, cmPromotion) {
     //把表中存在的删除
     var removeBeforeSoon = false; //是这一次移除
     var removeEle;
-    $('.productTable tbody tr:not(.gift)').each(function(index, element) {
+    $('.productTable tbody tr:not(.gift)').each(function (index, element) {
         if ($(this).find("td:nth-child(1)").html() == data.productId) {
             removeEle = $(this).parent();
             $(this).remove();
@@ -999,7 +1006,7 @@ function setGiftHtmlList(data, cmPromotion) {
     console.log("设置赠品" + JSON.stringify(data));
     if (data.presentNum > 0) {
         // 已经添加的,重新添加
-        $('.productTable tbody tr.gift_' + data.productId).each(function(index, element) {
+        $('.productTable tbody tr.gift_' + data.productId).each(function (index, element) {
             $(this).remove();
         });
         var present = JSON.parse(JSON.stringify(data));
@@ -1035,9 +1042,9 @@ function setGiftHtmlList(data, cmPromotion) {
     }
     if (data.cmPromotion && data.cmPromotion.mode == 3) {
         var thisTouchPrice = 0;
-        totalPromotions.forEach(function(item) {
+        totalPromotions.forEach(function (item) {
             if (data.cmPromotion.id == item.id) {
-                item.promotionProducts.forEach(function(p) {
+                item.promotionProducts.forEach(function (p) {
                     thisTouchPrice += (p.number * p.price + p.totalTax * 1);
                 });
             }
@@ -1045,7 +1052,7 @@ function setGiftHtmlList(data, cmPromotion) {
         if (thisTouchPrice >= data.cmPromotion.touchPrice) {
             if (giftPromotionsIds.indexOf(data.cmPromotion.id) < 0) {
                 // 已经添加的,重新添加
-                $('.productTable tbody tr.promotion_' + cmPromotion.id).each(function(index, element) {
+                $('.productTable tbody tr.promotion_' + cmPromotion.id).each(function (index, element) {
                     $(this).remove();
                 });
                 // 记录赠品促销
@@ -1054,9 +1061,9 @@ function setGiftHtmlList(data, cmPromotion) {
                 var getGiftPath = $('#ctx').val() + '/product/cmPromotions/getGifts';
                 $.getJSON(getGiftPath, {
                     id: data.cmPromotion.id
-                }, function(res) {
+                }, function (res) {
                     if (res && res.length > 0) {
-                        res.forEach(function(gift) {
+                        res.forEach(function (gift) {
                             gift.productType = 2;
                             gift.price = 0;
                             gift.discountPrice = 0;
@@ -1117,6 +1124,7 @@ function appendGiftsList(gift, giftStr, cmPromotion) {
     // 重新设置底部订单金额
     setOrderFee();
 }
+
 /**
  * 设置商品列表(二手商品)
  * @param items
@@ -1128,7 +1136,7 @@ function setSeondHandProductList(data) {
     //把表中存在的删除
     var removeBeforeSoon = false; //是这一次移除
     var removeEle;
-    $('.productTable tbody tr').each(function(index, element) {
+    $('.productTable tbody tr').each(function (index, element) {
         if ($(this).find("td:nth-child(1)").html() == productID) {
             removeEle = $(this).parent();
             $(this).remove();
@@ -1217,7 +1225,6 @@ function setSeondHandProductList(data) {
 }
 
 
-
 //设置订单金额信息
 function setOrderFee() { //不考虑经理折扣、运费,此时 商品总金额=订单总额=应付总额
     var productTotalFee = 0, //商品总金额
@@ -1227,9 +1234,9 @@ function setOrderFee() { //不考虑经理折扣、运费,此时 商品总金
         orderTotalFee = 0, //订单总额
         reducedPrice = 0, //促销满减
         payTotalFee = 0, //应付总额
-        svipFullReduction=0;   //超级会员优惠
-    var couponPrice = $("#couponAmount").val() ? $("#couponAmount").val()*1 : 0;
-    $('.productTable tbody tr:not(.gift)').each(function(index, element) {
+        svipFullReduction = 0;   //超级会员优惠
+    var couponPrice = $("#couponAmount").val() ? $("#couponAmount").val() * 1 : 0;
+    $('.productTable tbody tr:not(.gift)').each(function (index, element) {
         var obj = JSON.parse($(this).attr("data-value"));
         productTotalFee = ((Number(productTotalFee) * 100 + Number(obj.num * obj.price) * 100 + Number(obj
             .totalAddedValueTax) * 100) / 100 + Number(obj.svipTaxReduction)).toFixed(2);
@@ -1239,15 +1246,15 @@ function setOrderFee() { //不考虑经理折扣、运费,此时 商品总金
         payTotalFee = ((Number(payTotalFee) * 100 + Number(obj.totalFee) * 100) / 100).toFixed(2);
         svipFullReduction = ((Number(svipFullReduction) * 100 + Number(obj.svipReduction) * obj.num * 100) / 100).toFixed(2);
     });
-    $('.productTable tbody tr.promotions').each(function(index, element) {
+    $('.productTable tbody tr.promotions').each(function (index, element) {
         var obj = JSON.parse($(this).attr("data-value"));
         giftCount = Number(giftCount) + Number(obj.num);
     });
     // 计算促销折扣
-    totalPromotions.forEach(function(item) {
+    totalPromotions.forEach(function (item) {
         if (item.mode == 2) {
             var touchPrice = 0;
-            item.promotionProducts.forEach(function(product) {
+            item.promotionProducts.forEach(function (product) {
                 touchPrice += (product.number * product.price + product.totalTax * 1);
             });
             if (touchPrice >= item.touchPrice) {
@@ -1262,8 +1269,8 @@ function setOrderFee() { //不考虑经理折扣、运费,此时 商品总金
         payTotalFee -= couponPrice;
     }
     $(".productTotalFee").text((productTotalFee * 1).toFixed(2));
-    $(".promotionFullReduction").text((reducedPrice*1).toFixed(2));
-    $(".couponPrice").text((couponPrice*1).toFixed(2));
+    $(".promotionFullReduction").text((reducedPrice * 1).toFixed(2));
+    $(".couponPrice").text((couponPrice * 1).toFixed(2));
     $(".productCount").text(productCount);
     $(".presentCount").text(presentCount + giftCount);
     $(".presentCount1").text(presentCount + giftCount);
@@ -1279,7 +1286,6 @@ function setOrderFee() { //不考虑经理折扣、运费,此时 商品总金
 }
 
 
-
 // 修改数量
 function changenum(index) {
     var $num = $("#num" + index);
@@ -1287,7 +1293,7 @@ function changenum(index) {
     var $checkItem = $("#check-item" + index);
     var orderProductStr = $($checkItem).val();
     var obj = JSON.parse(orderProductStr);
-    if (numVal != null && numVal != "" && typeof(numVal) != "undefined") {
+    if (numVal != null && numVal != "" && typeof (numVal) != "undefined") {
         if (parseInt(numVal) + "" != numVal || parseInt(numVal) < 1) {
             alertx("数量必须大于0,并且是一个整数");
             $num.val(obj["num"]);
@@ -1304,11 +1310,12 @@ function changenum(index) {
         alertx("您输入的数量有误,请重新输入");
     }
 }
+
 //加减数量
 function presentNum(index, type) {
     var $num = $("#num" + index);
     var numVal = $num.val();
-    if (numVal != null && numVal != "" && typeof(numVal) != "undefined") {
+    if (numVal != null && numVal != "" && typeof (numVal) != "undefined") {
         if (type == 'del') {
             numVal = parseInt(numVal) - 1;
         } else if (type == 'add') {
@@ -1458,7 +1465,7 @@ function taxRateVal(index) {
     var totalNumVal = numVal * 1 + presentNum * 1; //统计赠品和购买商品数量
     var discountPrice = $("#discountPrice" + index).val(); //折后单价
     var $checkItem = eval('(' + $("#check-item" + index).val() + ')');
-    if ($checkItem["name"] == '' || $checkItem["name"] == null || $checkItem["name"] == 'null' || typeof($checkItem[
+    if ($checkItem["name"] == '' || $checkItem["name"] == null || $checkItem["name"] == 'null' || typeof ($checkItem[
         "name"]) == "undefined") {
         $checkItem["name"] = $checkItem.purchaseProductName + "";
     }
@@ -1568,7 +1575,7 @@ function taxRateVal(index) {
         $checkItem["costPrice"] = costPrice + ""; //重新设置成本
         $checkItem["svipReduction"] = svipReduction + ""; //重新设置超级会员优惠
         $("#svipReduction0").val(svipReduction);
-        $checkItem["svipTaxReduction"] = svipTaxReduction +""; //重新设置超级会员税费优惠
+        $checkItem["svipTaxReduction"] = svipTaxReduction + ""; //重新设置超级会员税费优惠
         $("#svipTaxReduction").val(svipTaxReduction);
         // console.log("data" + index + ":" + JSON.stringify($checkItem));
         $("#check-item" + index).val(JSON.stringify($checkItem));
@@ -1673,7 +1680,7 @@ function taxRateVal(index) {
             }
             $checkItem["svipReduction"] = svipReduction + ""; //重新设置超级会员优惠
             $("#svipReduction0").val(svipReduction);
-            $checkItem["svipTaxReduction"] = svipTaxReduction +""; //重新设置超级会员税费优惠
+            $checkItem["svipTaxReduction"] = svipTaxReduction + ""; //重新设置超级会员税费优惠
             $("#svipTaxReduction").val(svipTaxReduction);
             // console.log("data" + index + ":" + JSON.stringify($checkItem));
             $("#check-item" + index).val(JSON.stringify($checkItem));
@@ -1786,7 +1793,7 @@ function taxRateVal(index) {
                 }
                 $checkItem["svipReduction"] = svipReduction + ""; //重新设置超级会员优惠
                 $("#svipReduction0").val(svipReduction);
-                $checkItem["svipTaxReduction"] = svipTaxReduction +""; //重新设置超级会员税费优惠
+                $checkItem["svipTaxReduction"] = svipTaxReduction + ""; //重新设置超级会员税费优惠
                 $("#svipTaxReduction").val(svipTaxReduction);
 
                 $("#addedValueTax" + index).val(addedValueTax);
@@ -1934,6 +1941,7 @@ function buyAgain(i) {
     }
 
 }
+
 // 添加第三方应付商金额
 function otherFee(i) {
     var $otherFee = $("#otherFee1" + i).val();
@@ -1949,6 +1957,7 @@ function otherFee(i) {
         $("#otherFee1" + i).val($checkItem.otherFee1);
     }
 }
+
 // 添加采美应付金额
 function cmFee(i) {
     var discountPrice = $("#discountPrice" + i).val(); //折后单价
@@ -1983,7 +1992,7 @@ function setProductTotalFee() {
     if (isNaN(discount)) {
         discount = Number($("#discountFee").val());
     }
-    if ($('.productTable').length == 0){
+    if ($('.productTable').length == 0) {
         // 非添加订单页面
         $("#discount").val('0.00');
         $(".payableAmount").text(0);
@@ -2020,10 +2029,10 @@ function setProductTotalFee() {
     }
     payTotalFee = (Number(payTotalFee) + freight).toFixed(2);
     // 计算促销折扣
-    totalPromotions.forEach(function(item) {
+    totalPromotions.forEach(function (item) {
         if (item.mode == 2) {
             var touchPrice = 0;
-            item.promotionProducts.forEach(function(product) {
+            item.promotionProducts.forEach(function (product) {
                 touchPrice += (product.number * product.price + product.totalTax * 1);
             });
             if (touchPrice >= item.touchPrice) {
@@ -2058,7 +2067,7 @@ function setProductTotalFee() {
         balancePayFee = 0.00;
     }
 
-    trs.each(function(index, element) {
+    trs.each(function (index, element) {
         var obj = JSON.parse($(this).attr("data-value"));
 
         var _taxRate = Number(obj.taxRate); //税率
@@ -2103,7 +2112,7 @@ function setProductTotalFee() {
         obj["cmFee"] = _cmFee + "";
         obj["shouldPayFee"] = _payTotalFee + "";
         obj["presentNum"] = obj.presentNum + "";
-        if (obj["name"] == '' || obj["name"] == null || obj["name"] == 'null' || typeof(obj["name"]) ==
+        if (obj["name"] == '' || obj["name"] == null || obj["name"] == 'null' || typeof (obj["name"]) ==
             "undefined") {
             obj["name"] = obj.purchaseProductName + "";
         }
@@ -2152,7 +2161,7 @@ function showPromotionDetail(iframe, title) {
         buttons: {
             "关闭": '-1'
         },
-        submit: function(v, h, f) {
+        submit: function (v, h, f) {
             //确定
             var $jboxFrame = top.$('#jbox-iframe');
             var $mainFrame = top.$('#mainFrame');
@@ -2183,9 +2192,26 @@ function updateRebateFlag() {
     var rebateFlag = $("#rebateCheckBox").is(':checked');
     if (rebateFlag) {
         $("#rebateFlag").val(1);
+        //选中返佣订单后不可用优惠券
+        $("#couponBox").find("input[name=clubCouponId]").prop('checked', 'checked');
+        $("#freePostFlag").attr("value", "-1");
+        $("#freeDesc").find(".select2-chosen").text("到付");
+        $("#useBalancePayFee").prop('checked','');
+        setFreight();
+        $("#freePostFlag").attr("disabled",true);
+        $("#useBalancePayFee").attr("disabled",true);
     } else {
         $("#rebateFlag").val(0);
+        $("#couponBox").find("input[name=clubCouponId]").prop('checked', '');
+        $("#freePostFlag").attr("value", "0");
+        $("#freeDesc").find(".select2-chosen").text("包邮");
+        $("#useBalancePayFee").prop('checked','');
+        setFreight();
+        $("#freePostFlag").attr("disabled",false);
+        $("#useBalancePayFee").attr("disabled",false);
+        $(".freight")
     }
+
 }
 
 /**