1
0
Quellcode durchsuchen

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

wcq vor 3 Jahren
Ursprung
Commit
c93e52e66e

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

@@ -648,8 +648,15 @@
                 </div>
 
             </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>
+                    <h5>loading...</h5>
+                </div>
+            </div>
         </div>
     </div>
 </div>

+ 7 - 1
kmall-admin/src/main/webapp/js/sale/sale.js

@@ -808,6 +808,7 @@ let vm = new Vue({
             vm.calActivityFlag = false;
         },
         minus:function(value){
+
             // 减少数量
             for(var i = 0 ; i < this.goodsList.length ; i++){
                 if(this.goodsList[i].id == value){
@@ -2389,6 +2390,7 @@ calculateOrderPrice = function() {
  * @param type                  类型,add:加 minus:减
  */
 handleSellVolume = function (currentGoodsDetail, type) {
+    $("#loadingModal").modal('show');
     // console.log("处理前商品详情=====>" + JSON.stringify(currentGoodsDetail));
     // 当前未被处理的商品数量
     let number = currentGoodsDetail.sellVolume;
@@ -2420,9 +2422,12 @@ handleSellVolume = function (currentGoodsDetail, type) {
                 vm.totalCount += 1;
                 vm.totalPrice = currentTotalPrice.add(retailPrice).toString();
                 vm.actualPrice = currentActualPrice.add(singleActualPaymentAmount).toString();
+                $("#loadingModal").modal('hide');
             } else if (res.code === 500) {
+                $("#loadingModal").modal('hide');
                 alert(res.msg);
             } else {
+                $("#loadingModal").modal('hide');
                 alert("未知异常!请联系管理员!");
             }
         });
@@ -2433,6 +2438,7 @@ handleSellVolume = function (currentGoodsDetail, type) {
         vm.totalCount -= 1;
         vm.totalPrice = currentTotalPrice.subtract(retailPrice).toString();
         vm.actualPrice = currentActualPrice.subtract(singleActualPaymentAmount).toString();
+        $("#loadingModal").modal('hide');
     }
 
     for (let i = 0; i < vm.goodsList.length; i++) {
@@ -2442,7 +2448,7 @@ handleSellVolume = function (currentGoodsDetail, type) {
             // console.log("被删除的元素====>" + JSON.stringify(splice));
         }
     }
-
+    $("#loadingModal").modal('hide');
     // console.log("处理后商品详情=====>" + JSON.stringify(currentGoodsDetail));
 }