소스 검색

提交~~~~

喻文俊 3 년 전
부모
커밋
da170c6690

+ 15 - 3
components/cm-module/cm-cart-product/number-box.vue

@@ -18,6 +18,10 @@ export default {
         value: {
             type: Number,
             default: 0
+        },
+        max: {
+            type:Number,
+            default: 99999999
         }
     },
     created() {
@@ -25,13 +29,21 @@ export default {
     },
     watch:{
         value(val){
-            this.number = val
+            if(val > this.max) {
+                this.number = this.max
+            }else{
+                this.number = val
+            }
         }
     },
     methods: {
         add() {
-            this.number++
-            this.$emit('change', this.number)
+            if(this.number < this.max) {
+                this.number++
+                this.$emit('change', this.number)
+            }else{
+                this.$util.msg(`最多购买${this.max}件`, 2000)
+            } 
         },
         sub() {
             if (this.number > 1) {

+ 5 - 2
components/cm-module/cm-goods-nav/cm-goods-nav.vue

@@ -18,7 +18,7 @@
                     <view class="right">
                         <view class="number">
                             <text>数量:</text>
-                            <number-box :value="count" @change="countChange"></number-box>
+                            <number-box :value="count" @change="countChange" :max="collageProduct.limitedNum || 99999999"></number-box>
                         </view>
                         <view class="single-price">
                             <text>单价:¥</text> <text class="price">{{ buyRetailPrice | formatPrice }}</text>
@@ -95,6 +95,9 @@ export default {
         },
         buyRetailPrice() {
             return this.processActivityPrice()
+        },
+        collageProduct(){
+            return this.productInfo.collageProduct || {}
         }
     },
     watch: {
@@ -105,13 +108,13 @@ export default {
             deep: true,
             handler: function(nVal) {
                 console.log(nVal)
+                this.navType = this.productInfo.collageStatus === 1 ? 2 : 1
                 this.resetButtonInfo()
             }
         }
     },
     created() {
         this.options[2].info = this.kindCount
-        this.navType = this.productInfo.collageStatus ? 2 : 1
         // this.initBuyPrice()
     },
     methods: {

+ 12 - 7
components/cm-module/cm-product-price/cm-product-price.vue

@@ -2,17 +2,16 @@
     <!-- 价格区域 -->
     <view class="cm-product-price">
         <view class="price">
-            <text class="small">¥</text>
-            <text class="big">{{ bigPrice }}</text>
+            <text class="small">¥</text> <text class="big">{{ bigPrice }}</text>
             <text class="small">{{ smallPrice }}</text>
-            <text class="delete" v-if="showDeletedPrice">{{ productInfo.price }}</text>
+            <text class="delete" v-if="showDeletedPrice">{{ productInfo.normalPrice }}</text>
         </view>
         <view class="tags">
             <view class="tag type1" v-if="productInfo.heUserId !== 0">促销</view>
             <template v-if="productInfo.activeStatus === 1 && productInfo.collageStatus === 0">
                 <view class="tag type2" v-if="productInfo.ladderList" @click="drawerVisible = true">活动价</view>
             </template>
-            <view class="tag type1" v-if="productInfo.collageStatus === 1">2人拼团</view>
+            <view class="tag type1" v-if="productInfo.collageStatus === 1">{{ collageProduct.memberNum }}人拼团</view>
         </view>
 
         <cm-drawer :visible="drawerVisible" position="bottom" @close="drawerClose">
@@ -55,8 +54,14 @@ export default {
         smallPrice() {
             return '.' + this.price.split('.')[1]
         },
-        showDeletedPrice(){
-            return this.productInfo.activeStatus === 1 || this.productInfo.collageStatus === 1
+        showDeletedPrice() {
+            return (
+                this.productInfo.normalPrice &&
+                (this.productInfo.activeStatus === 1 || this.productInfo.collageStatus === 1)
+            )
+        },
+        collageProduct(){
+            return this.productInfo.collageProduct || {}
         }
     },
     methods: {
@@ -83,7 +88,7 @@ export default {
         .big {
             font-size: 48rpx;
         }
-        .delete{
+        .delete {
             font-size: 26rpx;
             color: #999999;
             text-decoration: line-through;

+ 1 - 1
components/cm-module/cm-product/cm-product.vue

@@ -18,7 +18,7 @@
                 <!-- 价格 -->
                 <view class="price">
                     <text>¥{{ data.price | formatPrice }}</text>
-                    <text class="delete">¥{{ data.price | formatPrice }}</text>
+                    <text class="delete" v-if="data.normalPrice">¥{{ data.normalPrice | formatPrice }}</text>
                 </view>
                 <!-- 加入购物车 --> 
                 <view class="add-cart iconfont icon-gouwuche" @click.stop="addCart"></view>

+ 7 - 1
components/uni-components/uni-goods-nav/uni-goods-nav.vue

@@ -79,7 +79,7 @@
                         class="flex uni-tab__cart-button-right"
                         @click="buttonClick(index, item)"
                     >
-                        <text :style="{ color: item.color }" class="uni-tab__cart-button-right-text has-price">{{ item.price }}</text>
+                        <text :style="{ color: item.color }" class="uni-tab__cart-button-right-text has-price">{{ item.price | formatPrice}}</text>
                         <text :style="{ color: item.color }" class="uni-tab__cart-button-right-text has-price">{{ item.text }}</text>
                     </view>
                 </template>
@@ -148,6 +148,12 @@ export default {
             default: false
         }
     },
+    filters:{
+        formatPrice(price){
+            if (!price) return '0.00'
+            return Number(price).toFixed(2)
+        }
+    },
     methods: {
         onClick(index, item) {
             this.$emit('click', {

+ 48 - 16
pages/goods/cart.vue

@@ -9,15 +9,17 @@
         ></header-cart>
         <template v-if="!isEmpty">
             <template v-if="!isshowDelbtn">
-                <!-- 商品统计 / 批量删除商品 -->
-                <view class="cart-top" :class="{ fixed: cartTopFixed }" :style="[cartTop]">
-                    <view class="count">共{{ kindCount }}件商品</view>
-                    <view class="btn" @click="showDelManager">删除</view>
-                </view>
-                <!-- TODO -->
-                <view class="receive-coupon">
-                    <view class="tip-text">{{ couponTipText }}</view>
-                    <view class="btn" @click="receiveCoupon">领券</view>
+                <view :class="{ fixed: cartTopFixed }" :style="[cartTop]">
+                    <!-- 商品统计 / 批量删除商品 -->
+                    <view class="cart-top">
+                        <view class="count">共{{ kindCount }}件商品</view>
+                        <view class="btn" @click="showDelManager">删除</view>
+                    </view>
+                    <!-- TODO -->
+                    <view class="receive-coupon" v-if="showReceiveCouponButton">
+                        <view class="tip-text">{{ couponTipText }}</view>
+                        <view class="btn" @click="receiveCoupon">领券</view>
+                    </view>
                 </view>
             </template>
             <!-- 购物车列表 -->
@@ -51,7 +53,10 @@
                 <template v-if="!isshowDelbtn">
                     <view class="center">
                         <view class="row">
-                            <text>总价:</text> <text class="total-price">¥{{ allPrice | formatPrice }}</text>
+                            <text>总价:</text> <text class="total-price">
+                                <text>¥{{ allPrice | formatPrice }}</text>
+                                <text class="delete">¥9999.99</text>
+                            </text>
                         </view>
                         <!-- TODO -->
                         <view class="row" v-if="currentCouponIndex > -1 && currentCoupon">
@@ -108,7 +113,9 @@
                         <text>优惠券</text> <text class="red">-¥{{ currentCoupon.couponAmount | formatPrice }}</text>
                     </view>
                     <view class="row total">
-                        <text>总计</text> <text>¥{{ finallyPrice | formatPrice }}</text>
+                        <text>总计</text> 
+                        <text>¥{{ finallyPrice | formatPrice }}</text>
+                        <text class="delete">9999.99</text>
                     </view>
                     <view class="tip"> 实际订单金额以结算页为准 </view>
                 </view>
@@ -230,7 +237,11 @@ export default {
             let paddingTop = this.CustomBar
             let paddingBottom = 100
             if (this.cartTopFixed) {
-                paddingTop += 40
+                if(this.showReceiveCouponButton){
+                    paddingTop += 85
+                }else{
+                    paddingTop += 40
+                }
             }
             if (this.isIphoneX) {
                 paddingBottom += 40
@@ -294,6 +305,10 @@ export default {
                 tabs.push({ name: '可领取优惠券' })
             }
             return tabs
+        },
+        showReceiveCouponButton(){
+            // return this.ableCouponList.length > 0 || this.receiveCouponList.length > 0
+            return true
         }
     },
     filters: {
@@ -576,6 +591,12 @@ export default {
     &.hasPaddingTop {
         padding-top: 80rpx;
     }
+    
+    .fixed {
+        position: fixed;
+        z-index: 9999;
+    }
+    
     .cart-top {
         flex: 0;
         display: flex;
@@ -586,10 +607,7 @@ export default {
         height: 80rpx;
         background: #f7f7f7;
         box-sizing: border-box;
-        &.fixed {
-            position: fixed;
-            z-index: 9999;
-        }
+        
         .count {
             font-size: 30rpx;
             color: #333333;
@@ -664,6 +682,13 @@ export default {
                 color: #333333;
                 .total-price {
                     color: #ff457b;
+                    .delete{
+                        font-size: 20rpx;
+                        color: #999999;
+                        text-decoration: line-through;
+                        font-weight: normal;
+                        margin-left: 10rpx;
+                    }
                 }
             }
             &:nth-child(2) {
@@ -757,6 +782,13 @@ export default {
             &.total {
                 font-size: 30rpx;
                 font-weight: 600;
+                .delete{
+                    font-size: 20rpx;
+                    color: #999999;
+                    text-decoration: line-through;
+                    font-weight: normal;
+                    margin-left: 10rpx;
+                }
             }
         }
         .tip {

+ 0 - 1
pages/tabBar/cart/index.vue

@@ -110,7 +110,6 @@
                         <text>总计</text> 
                         <text class="price"> 
                             <text>¥{{ finallyPrice | formatPrice }}</text>
-                            <text class="delete">9999.99</text>
                         </text>
                     </view>
                     <view class="tip"> 实际订单金额以结算页为准 </view>

+ 7 - 0
pages/tabBar/index/index.vue

@@ -101,6 +101,13 @@ export default {
             this.getCouponActivity()
         }
     },
+    onShareTimeline() {
+        return {
+            title: '分享标题',
+            query: '',
+            imageUrl: 'https://picsum.photos/40/40'
+        }
+    },
     computed: {
         ...mapGetters(['hasLogin', 'activePopupType', 'userId', 'otherCouponFlag', 'showCouponPopup']),
         couponActivityIcon() {