Browse Source

待确认订单优惠券

chao 3 years ago
parent
commit
4ce1947d14
1 changed files with 27 additions and 28 deletions
  1. 27 28
      src/main/webapp/static/modules/bulkpurchase/orderForm.js

+ 27 - 28
src/main/webapp/static/modules/bulkpurchase/orderForm.js

@@ -15,7 +15,7 @@ var selectCoupons = [];
 var couponPrice = $("#couponAmount").val()*1;
 // 添加订单true,修改订单false
 var initFlag = true;
-var orderStatus = 0;
+var orderStatus = $("#orderStatus").val()*1;
 
 $(function() {
     /**  发票信息 start * */
@@ -133,8 +133,8 @@ $(function() {
     });
 
     /** 修改订单初始化 */
-    var orderId = $("#orderID").val();
-    orderStatus = $("#orderStatus").val();
+    var orderId = $("#orderID").val()*1;
+    orderStatus = $("#orderStatus").val()*1;
     if (orderId && orderId > 0) {
         var userId = $("#inputForm").find("[name*='bpOrderUserinfo.userId']").val();
         // 获取用户总优惠券
@@ -457,32 +457,31 @@ function getShownCouponList(){
 // 设置页面显示
 function setPageCoupon() {
     // 非待确认订单,不设置优惠券显示
-    if (orderStatus) {
-        return;
-    }
-    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){
-        var checked = '';
-        var redemptionCode = '';
-        if (clubCouponId === item.clubCouponId) {
-            checked = 'checked="checked"';
-        }
-        if (!isNaN(item.redemptionCode)) {
-            redemptionCode = '<span>兑换码:'+item.redemptionCode+'</span>';
+    if (!orderStatus) {
+        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){
+            var checked = '';
+            var redemptionCode = '';
+            if (clubCouponId === item.clubCouponId) {
+                checked = 'checked="checked"';
+            }
+            if (!isNaN(item.redemptionCode)) {
+                redemptionCode = '<span>兑换码:'+item.redemptionCode+'</span>';
+            }
+            html += '<li><label>';
+            html += '       <input type="radio" name="clubCouponId" value="'+item.clubCouponId +'" '+checked+'>';
+            html += '       <span class="couponDesc">';
+            html += '            <span>'+item.couponName+'</span>';
+            html += redemptionCode;
+            html += '            <span>'+item.couponDesc+'</span>';
+            html += '            <span>有效期:'+item.startDate+' - '+item.endDate+'</span>';
+            html += '</span></label></li>';
+        });
+        $("#couponBox").find(".couponContent").html(html);
+        if (clubCouponId > 0) {
+            $("#couponBox").find("input[name=clubCouponId][checked=checked]").trigger("change");
         }
-        html += '<li><label>';
-        html += '       <input type="radio" name="clubCouponId" value="'+item.clubCouponId +'" '+checked+'>';
-        html += '       <span class="couponDesc">';
-        html += '            <span>'+item.couponName+'</span>';
-        html += redemptionCode;
-        html += '            <span>'+item.couponDesc+'</span>';
-        html += '            <span>有效期:'+item.startDate+' - '+item.endDate+'</span>';
-        html += '</span></label></li>';
-    });
-    $("#couponBox").find(".couponContent").html(html);
-    if (clubCouponId > 0) {
-        $("#couponBox").find("input[name=clubCouponId][checked=checked]").trigger("change");
     }
 }