zhangdehua vor 1 Jahr
Ursprung
Commit
eeb3ca058d

+ 41 - 1
app/index/view/index/productDetails.html

@@ -41,6 +41,7 @@
                     <!-- 口味 -->
                     <!-- 新增开始 -->
                     <div class="tasteContainer">
+                        <div class="tasteItem" data-id="0">Choose Flavors Here:</div>
                         <div class="tasteItem" data-id="1">
                             <div class="tasteNumberBox">
                                 <div class="tasteReduce">-</div>
@@ -380,7 +381,7 @@
             console.log("flavors Value:", flavors);
 
             if (totalValue !== needFlavorCnt  || totalValue != needFlavorCnt){
-                showToast('You should choose '+ needFlavorCnt +' flavor first')
+                showToast('You should choose '+ needFlavorCnt +' flavor first for one pack')
                 return
             }
             // 新增结束
@@ -390,6 +391,45 @@
         //悬浮模块的添加按钮
         $(".fPrAddToCart").on(tap, function () {
             const number = $('#fPrNumberInput').val();
+            // 新增开始
+            var totalValue = 0;
+
+            var STRAWBERRY_MANGO_Num = parseInt($('#STRAWBERRY-MANGO-NUM').val());
+            flavors["STRAWBERRY-MANGO"] = STRAWBERRY_MANGO_Num
+            totalValue += STRAWBERRY_MANGO_Num;
+
+            var BLUE_RAZZ_ICE_Num = parseInt($('#BLUE-RAZZ-ICE-NUM').val());
+            totalValue += BLUE_RAZZ_ICE_Num;
+            flavors["BLUE-RAZZ-ICE"] = BLUE_RAZZ_ICE_Num
+
+            var WATERMELON_Num = parseInt($('#WATERMELON-NUM').val());
+            totalValue += WATERMELON_Num;
+            flavors["WATERMELON"] = WATERMELON_Num
+
+            var KIWI_PASSION_Num = parseInt($('#KIWI-PASSION-FRUIT-GUAVA-NUM').val());
+            totalValue += KIWI_PASSION_Num;
+            flavors["KIWI-PASSION-FRUIT-GUAVA"] = KIWI_PASSION_Num
+
+            var JUICY_PEACH_Num = parseInt($('#JUICY-PEACH-NUM').val());
+            totalValue += JUICY_PEACH_Num;
+            flavors["JUICY-PEACH"] = JUICY_PEACH_Num
+
+            var GRAPE_Num = parseInt($('#GRAPE-NUM').val());
+            totalValue += GRAPE_Num;
+            flavors["GRAPE"] = GRAPE_Num
+
+            var BLUEBERRY_ICE_Num = parseInt($('#BLUEBERRY-ICE-NUM').val());
+            totalValue += BLUEBERRY_ICE_Num;
+            flavors["BLUEBERRY-ICE"] = BLUEBERRY_ICE_Num
+
+            console.log("Total Value:", totalValue);
+            console.log("flavors Value:", flavors);
+
+            if (totalValue !== needFlavorCnt  || totalValue != needFlavorCnt){
+                showToast('You should choose '+ needFlavorCnt +' flavor first for one pack')
+                return
+            }
+
             addCart(number, flavors)
         });
         initRichText()

+ 4 - 3
public/assets/index/css/productDetails.css

@@ -121,6 +121,7 @@ body{
 
 /* 新增开始 */
 .tasteContainer{
+  border-top: .01rem solid rgba(0, 0, 0, .1);
   padding-top: .32rem;
 }
 .tasteItem{
@@ -140,7 +141,7 @@ body{
 .tasteNumberBox{
   display: flex;
   align-items: center;
-  height: .4rem;
+  height: .3rem;
   box-sizing: border-box;
   border: .01rem solid rgba(0, 0, 0, .1);
   cursor: pointer;
@@ -665,7 +666,7 @@ body{
     }
     /* 新增开始 */
     .tasteNumberBox{
-      height: .5rem;
+      height: .4rem;
     }
     .tasteInput{
       width: .5rem;
@@ -715,7 +716,7 @@ body{
     }
     /* 新增开始 */
     .tasteNumberBox{
-      height: .6rem;
+      height: .5rem;
     }
     .tasteInput{
       width: .6rem;