Parcourir la source

author:wcq
update:处理界面点击过快上下数量会不一致的问题

wcq il y a 3 ans
Parent
commit
dc2280a12b

+ 7 - 7
kmall-admin/src/main/webapp/WEB-INF/page/sale/sale.html

@@ -267,9 +267,9 @@
                                 <td> {{item.goodstaxes}}</td>
                                 <td> {{item.actualPaymentAmount}}</td>
                                 <td>
-                                    <i class="glyphicon glyphicon-minus" aria-hidden="true" @click="minus(item.id)"></i>
+                                    <i class="glyphicon glyphicon-minus" name="minusButton" aria-hidden="true" @click="minus(item.id)"></i>
                                     {{item.sellVolume}}
-                                    <i class="glyphicon glyphicon-plus" aria-hidden="true" @click="add(item.id)"></i>
+                                    <i class="glyphicon glyphicon-plus" name="addButton" aria-hidden="true" @click="add(item.id)"></i>
                                 </td>
                                 <td>
                                     {{item.activity}}
@@ -649,11 +649,11 @@
 
             </div>
             <!--遮罩-->
-            <div class="modal fade" id="loadingModal">
-                <div style="width: 200px;height:20px; z-index: 20000; position: absolute; text-align: center; left: 50%; top: 50%;margin-left:-100px;margin-top:-10px">
-                    <div class="progress progress-striped active" style="margin-bottom: 0;">
-                        <div class="progress-bar" style="width: 100%;"></div>
-                    </div>
+            <div class="fade" id="loadingModal" style="opacity: 0">
+                <div style="width: 200px;height:20px;opacity: 0; z-index: 20000; position: absolute; text-align: center; left: 50%; top: 50%;margin-left:-100px;margin-top:-10px">
+<!--                    <div class="progress progress-striped active" style="margin-bottom: 0;">-->
+<!--&lt;!&ndash;                        <div class="progress-bar" style="width: 100%;"></div>&ndash;&gt;-->
+<!--                    </div>-->
                     <h5>loading...</h5>
                 </div>
             </div>

+ 14 - 5
kmall-admin/src/main/webapp/js/sale/sale.js

@@ -799,7 +799,7 @@ let vm = new Vue({
                     calculateGoodsByMysy(goodsDetails,"add");
                     calculateGoodsByHalfPrice(goodsDetails,"add");*/
                     // calculateGoodsByMz(goodsDetails,"add");
-                    handleSellVolume(goodsDetails, "add");
+                    handleSellVolume(goodsDetails, "add",i);
                     // handle(goodsDetails,"add");
                     break;
                 }
@@ -840,7 +840,7 @@ let vm = new Vue({
                         goodsDetails.goodstaxes = - goodsDetails.goodstaxes;
                         goodsDetails.retailPrice = - goodsDetails.retailPrice;
                     }*/
-                    handleSellVolume(goodsDetails, "minus");
+                    handleSellVolume(goodsDetails, "minus",i);
                     // handle(goodsDetails,"minus");
                     break;
                 }
@@ -2389,8 +2389,10 @@ calculateOrderPrice = function() {
  * @param currentGoodsDetail    当前操作的商品详情
  * @param type                  类型,add:加 minus:减
  */
-handleSellVolume = function (currentGoodsDetail, type) {
-    $("#loadingModal").modal('show');
+handleSellVolume = function (currentGoodsDetail, type,index) {
+    //$("#loadingModal").modal('show');
+    document.getElementsByName("minusButton")[index].style.pointerEvents = "none";
+    document.getElementsByName("addButton")[index].style.pointerEvents = "none";
     // console.log("处理前商品详情=====>" + JSON.stringify(currentGoodsDetail));
     // 当前未被处理的商品数量
     let number = currentGoodsDetail.sellVolume;
@@ -2423,11 +2425,17 @@ handleSellVolume = function (currentGoodsDetail, type) {
                 vm.totalPrice = currentTotalPrice.add(retailPrice).toString();
                 vm.actualPrice = currentActualPrice.add(singleActualPaymentAmount).toString();
                 $("#loadingModal").modal('hide');
+                document.getElementsByName("addButton")[index].style.pointerEvents = "auto";
+                document.getElementsByName("minusButton")[index].style.pointerEvents = "auto";
             } else if (res.code === 500) {
                 $("#loadingModal").modal('hide');
+                document.getElementsByName("addButton")[index].style.pointerEvents = "auto";
+                document.getElementsByName("minusButton")[index].style.pointerEvents = "auto";
                 alert(res.msg);
             } else {
                 $("#loadingModal").modal('hide');
+                document.getElementsByName("addButton")[index].style.pointerEvents = "auto";
+                document.getElementsByName("minusButton")[index].style.pointerEvents = "auto";
                 alert("未知异常!请联系管理员!");
             }
         });
@@ -2439,6 +2447,8 @@ handleSellVolume = function (currentGoodsDetail, type) {
         vm.totalPrice = currentTotalPrice.subtract(retailPrice).toString();
         vm.actualPrice = currentActualPrice.subtract(singleActualPaymentAmount).toString();
         $("#loadingModal").modal('hide');
+        document.getElementsByName("minusButton")[index].style.pointerEvents = "auto";
+        document.getElementsByName("addButton")[index].style.pointerEvents = "auto";
     }
 
     for (let i = 0; i < vm.goodsList.length; i++) {
@@ -2448,7 +2458,6 @@ handleSellVolume = function (currentGoodsDetail, type) {
             // console.log("被删除的元素====>" + JSON.stringify(splice));
         }
     }
-    $("#loadingModal").modal('hide');
     // console.log("处理后商品详情=====>" + JSON.stringify(currentGoodsDetail));
 }