浏览代码

接口调用

喻文俊 3 年之前
父节点
当前提交
af54926d2e

+ 1 - 1
src/main/resources/static/css/shopping/shopping.css

@@ -2,7 +2,7 @@
 li{list-style:none}
 .addressWrap input[type=checkbox]:after{color:#1890f9;border-color:#1890f9;}
 .addressWrap input[type=checkbox]:checked:after{background:#1890f9;border-color:#1890f9;color:#FFF;}
-
+[v-cloak]{display: none}
 /**
  * PC端
  */

+ 34 - 29
src/main/resources/static/js/shopping/cart.js

@@ -31,7 +31,6 @@ var shoppingCart = new Vue({
         couponPrice:0,							// 优惠金额
         totalDiscountAmount:0,					// 总共减去金额
         isDiscount:false,						// 控制显示优惠明细
-
     },
     watch:{
         listData: {
@@ -80,6 +79,7 @@ var shoppingCart = new Vue({
                     _self.totalPrice = data.totalPrice;
                     _self.promotionsList = data.promotions;
                     _self.totalCouponList = data.couponList;
+                    _self.reducedPrice = data.reducedPrice;
                     // 默认全选
                     _self.listData.forEach(function(supplier){
                         supplier.isChecked = true;
@@ -178,60 +178,65 @@ var shoppingCart = new Vue({
                 });
             });
         },
-        computedPrice: function(){
+        computedPrice: function() {
             var _self = this;
-            this.$nextTick(function(){
+            this.$nextTick(function () {
                 var totalPrice = 0;
                 var reducedPrice = 0;
                 var originalPrice = 0;
                 var kindCount = 0;
                 var totalCount = 0;
-                _self.listData.forEach(function(supplier){
+                _self.listData.forEach(function (supplier) {
                     var supplierPrice = 0;
                     var supplierReducedPrice = 0;
-                    if(supplier.cartList.length>0){
-                        supplier.cartList.forEach(function(cart){
-                            if (_self.submitIds.includes(cart.productId*1)){
-                                supplierPrice += cart.price*cart.number;
+                    var svipSupplierPrice = 0;
+                    if (supplier.cartList.length > 0) {
+                        supplier.cartList.forEach(function (cart) {
+                            if (_self.submitIds.includes(cart.productId * 1)) {
+                                supplierPrice += cart.price * cart.number;
                                 kindCount += 1;
                                 totalCount += cart.number;
                                 // 单品满减
-                                if(cart.promotions && cart.promotions.type*1===1 && cart.promotions.mode*1===2){
+                                if (cart.promotions && cart.promotions.type * 1 === 1 && cart.promotions.mode * 1 === 2) {
                                     // 单品满减-重新计算供应商总价/满减金额
-                                    if(cart.price*cart.number >= cart.promotions.touchPrice){
+                                    if (cart.price * cart.number >= cart.promotions.touchPrice) {
                                         supplierPrice -= cart.promotions.reducedPrice;
                                         supplierReducedPrice += cart.promotions.reducedPrice;
                                     }
                                 }
+                                //sivp优惠价格
+                                if(cart.svipProductFlag === 1){
+                                    svipSupplierPrice += (cart.originalPrice - cart.svipPriceTag) * cart.number;
+                                }
                             }
                         });
                         // 店铺满减
-                        if(supplier.promotions && supplier.promotions.mode*1===2){
+                        if (supplier.promotions && supplier.promotions.mode * 1 === 2) {
                             // 店铺满减-计算供应商总价/满减金额
-                            if(supplierPrice >= supplier.promotions.touchPrice){
+                            if (supplierPrice >= supplier.promotions.touchPrice) {
                                 supplierPrice -= supplier.promotions.reducedPrice;
                                 supplierReducedPrice += supplier.promotions.reducedPrice;
                             }
                         }
                     }
                     supplier.totalPrice = supplierPrice;
-                    supplier.reducedPrice = supplierReducedPrice;
-                    supplier.originalPrice = (supplierPrice+supplierReducedPrice);
+                    supplier.reducedPrice = supplierReducedPrice + svipSupplierPrice; // 其他优惠价 + svip优惠价
+                    supplier.originalPrice = (supplierPrice + supplierReducedPrice);
                     totalPrice += supplier.totalPrice;
                     reducedPrice += supplier.reducedPrice;
                     originalPrice += supplier.originalPrice;
                 });
                 // 总促销计算
-                _self.promotionsList.forEach(function(promotions){
+                _self.promotionsList.forEach(function (promotions) {
                     // 凑单满减
-                    if(promotions.mode*1===2 && promotions.type*1===2){
+                    if (promotions.mode * 1 === 2 && promotions.type * 1 === 2) {
                         var total = 0;
-                        promotions.productList.forEach(function(product){
-                            if (_self.submitIds.includes(product.productId*1)){
+                        promotions.productList.forEach(function (product) {
+                            if (_self.submitIds.includes(product.productId * 1)) {
                                 total += product.number * product.price;
                             }
                         });
-                        if(total>=promotions.touchPrice){
+                        if (total >= promotions.touchPrice) {
                             totalPrice -= promotions.reducedPrice;
                             reducedPrice += promotions.reducedPrice;
                         }
@@ -243,26 +248,26 @@ var shoppingCart = new Vue({
                 _self.kindCount = kindCount;
                 _self.totalCount = totalCount;
                 // 计算优惠券
-                if(_self.totalCouponList.length>0){
+                if (_self.totalCouponList.length > 0) {
                     let eligibleCoupons = _self.calculationCoupon();
-                    if(eligibleCoupons.length>0){
-                        _self.eligibleCoupons.splice(0,_self.eligibleCoupons.length);
-                        _self.eligibleCoupons = eligibleCoupons.sort((a,b)=> b.couponAmount - a.couponAmount)
+                    if (eligibleCoupons.length > 0) {
+                        _self.eligibleCoupons.splice(0, _self.eligibleCoupons.length);
+                        _self.eligibleCoupons = eligibleCoupons.sort((a, b) => b.couponAmount - a.couponAmount)
                         _self.couponPrice = this.eligibleCoupons[0].couponAmount
-                    }else{
+                    } else {
                         _self.couponPrice = 0
                     }
                 }
                 // 最后满减金额 = 店铺减去金额 + 单品减去金额 + 凑单减去金额
                 _self.totalDiscountAmount = _self.reducedPrice + _self.couponPrice;
-                console.log('最终优惠金额',_self.totalDiscountAmount);
+                console.log('最终优惠金额', _self.totalDiscountAmount);
                 // 控制显示优惠明细
-                if(_self.totalDiscountAmount > 0 ){
+                if (_self.totalDiscountAmount > 0) {
                     _self.isDiscount = true;
-                }else{
+                } else {
                     _self.isDiscount = false;
                 }
-            });
+            })
         },
         calculationCoupon:function(){// 优惠券计算
             var _self = this;
@@ -321,7 +326,7 @@ var shoppingCart = new Vue({
                         return;
                     }
                 })
-            })
+            });
             return eligibleCoupons;
         },
         cartNumberSub: function(cart){

+ 1 - 0
src/main/resources/static/js/user-center/dashboard.js

@@ -46,6 +46,7 @@ var helpSuggestion = new Vue({
                 }
             })
         },
+        GetUserClubHome(){},
         uploadUserPuploadAvatar: function(event){//上传头像
             var _self = this;
             var inputDOM = _self.$refs.clubUseLogo;

+ 3 - 3
src/main/resources/templates/shopping/cart.html

@@ -34,7 +34,7 @@
             </div>
             <h1>我的购物车</h1>
         </div>
-        <div class="listWrap">
+        <div class="listWrap" v-cloak>
             <div v-if="isPC" class="cartTit clear">
                 <div class="c0"><input class="check" type="checkbox" @change="ckeckAll()" v-model="allChecked"></div>
                 <div class="c1">全选</div>
@@ -102,10 +102,10 @@
                                 <em> {{ cart.price | NumFormat }} </em>
                             </template>
                             <!-- 促销活动 -->
-                            <template v-if="true">
+                            <template v-if="cart.svipProductFlag == 1">
                                 <div class="priceTag">
                                     <!--超级会员价格标签-->
-                                    <div class="svip-tag" v-if="cart.svipProductFlag == 1">
+                                    <div class="svip-tag">
                                         <div class="svip-icon btr">SVIP</div>
                                         <div class="svip-price">
                                             <span v-html="cart.svipPriceTag"></span>

+ 2 - 2
src/main/resources/templates/shopping/confirm.html

@@ -146,14 +146,14 @@
                     </div>
                     <div class="c4">
                         <div class="price">
-                            <template v-if="true">
+                            <template v-if="cart.svipProductFlag == 1">
                                 <del v-text="'¥'+toFloat(cart.originalPrice)"></del>
                                 <div class="priceTag">
                                     <!--超级会员价格标签-->
                                     <div class="svip-tag">
                                         <div class="svip-icon btr">SVIP</div>
                                         <div class="svip-price">
-                                            <span>¥</span><span>9999999.00</span>
+                                            <span v-html="cart.svipPriceTag"></span>
                                         </div>
                                     </div>
                                 </div>