Ver código fonte

sku版本bug修改

yuwenjun1997 2 anos atrás
pai
commit
6bf63c4b59

+ 4 - 4
components/views/cm-cart-supplier-area/cm-cart-supplier-area.vue

@@ -15,12 +15,12 @@
                 <view class="checkbox">
                     <label
                         class="icon iconfont "
-                        :class="isChecked(item.productId) ? 'icon-xuanze' : 'icon-weixuanze'"
+                        :class="isChecked(item.skuId) ? 'icon-xuanze' : 'icon-weixuanze'"
                         :style="{ color: item.stock === 0 && !isDeleted ? '#ddd' : '' }"
                         @click="onLabelClick(item)"
                     >
                         <checkbox
-                            :value="item.productId"
+                            :value="item.skuId"
                             :checked="item.checked"
                             v-show="false"
                             :disabled="item.stock === 0 && !isDeleted"
@@ -83,12 +83,12 @@ export default {
             if (this.isCheckedAll) {
                 this.checkedList = []
             } else {
-                this.checkedList = this.selectProductList.map(item => item.productId.toString())
+                this.checkedList = this.selectProductList.map(item => item.skuId.toString())
             }
         },
         // 选中全部
         selectAll() {
-            this.checkedList = this.selectProductList.map(item => item.productId.toString())
+            this.checkedList = this.selectProductList.map(item => item.skuId.toString())
         },
         // 取消全选
         unSelectAll() {

+ 0 - 0
pages/views/goods/components/goods-activity-popup/goods-activity-popup.vue → components/views/cm-goods-activity-popup/cm-goods-activity-popup.vue


+ 1 - 1
components/views/cm-goods-buy-popup/cm-goods-buy-popup.vue

@@ -20,7 +20,7 @@
                         </template>
                         <template v-if="activityType === 'activity'">
                             <view class="tag-hd">活动价</view>
-                            <view class="tag-text">查看活动价</view>
+                            <view class="tag-text" @click="$emit('activityClick', currentSku)">查看活动价</view>
                         </template>
                         <template v-if="activityType === 'time-limit'">
                             <view class="tag-xs">限时特价</view>

+ 0 - 65
mixins/goodsDetail.js

@@ -1,65 +0,0 @@
-import { generateActivityType, generatePriceType } from '@/common/goods.helper.js'
-import { fetchProductDetail } from '@/services/api/goods.js'
-import { fetchCouponListByProductId } from '@/services/api/coupon.js'
-
-const goodsDetail = {
-    methods: {
-        // 获取商品详情
-        async fetchProductDetail(productId) {
-            try {
-                const userId = this.$store.getters.userId
-                const res = await fetchProductDetail({ productId, userId })
-                return this.generateProductInfo(res.data)
-            } catch (e) {
-                return e
-            }
-        },
-
-        // 处理商品信息
-        generateProductInfo(product) {
-            if (!product) return product
-            // 商品活动类型
-            product.activityType = generateActivityType(product)
-            product.priceType = generatePriceType(product)
-            product.skus = product.skus.map(sku => {
-                sku.activityType = generateActivityType(sku)
-                sku.priceType = generatePriceType(sku)
-                return sku
-            })
-            return product
-        },
-
-        // 获取商品可用优惠券
-        async fetchCouponListByProduct(productId) {
-            try {
-                const userId = this.$store.getters.userId
-                const res = await fetchCouponListByProductId({ productId, userId })
-                return res.data.map(coupon => this.generateCoupon(coupon))
-            } catch (e) {
-                return e
-            }
-        },
-
-        // 创建优惠券
-        generateCoupon(coupon) {
-            const obj = Object.assign({}, coupon)
-            // 添加标题
-            if (coupon.noThresholdFlag > 0) {
-                obj.couponTitle = `减¥${coupon.couponAmount}元`
-            } else {
-                obj.couponTitle = `满¥${coupon.touchPrice}元减¥${coupon.couponAmount}元`
-            }
-            // 添加优惠券状态
-            if (obj.useStatus === 0) {
-                obj.controlType = 'receive'
-            } else if (obj.useStatus === 1) {
-                obj.couponStatus = 'received'
-                obj.controlType = 'search'
-            }
-            return obj
-        },
-    }
-}
-
-
-export default goodsDetail

+ 21 - 3
pages/tabBar/cart/cart.vue

@@ -101,8 +101,17 @@
             :useType="useType"
             :buttonType="buttonType"
             @confirm="onSaveNewUnit"
+            @activityClick="handleShowActivity"
             v-if="productInfo"
         ></cm-goods-buy-popup>
+
+        <!-- 活动价 -->
+        <cm-goods-activity-popup
+            ref="activitypPopup"
+            :ladderList="ladderPriceList"
+            @open="$refs.receiveBuyPopup.close()"
+            @close="$refs.receiveBuyPopup.open()"
+        ></cm-goods-activity-popup>
     </view>
 </template>
 
@@ -154,7 +163,8 @@ const resetData = () => ({
     useType: 'cart',
     buttonType: 'left',
     goodsCouponList: [],
-    productInfo: null
+    productInfo: null,
+    ladderPriceList: []
 })
 
 export default {
@@ -211,7 +221,7 @@ export default {
                 this[key] = data[key]
             }
         },
-        
+
         // 确认清空失效商品
         async onConfirmRemoveExp(e) {
             if (!e.index) return
@@ -235,6 +245,7 @@ export default {
             params.allPrice = this.allPrice
             params.allCount = this.checkedProductList.length
             params.cartIds = this.checkedProductList.map(product => product.cartId)
+            // params.skuIds = this.checkedProductList.map(product => product.skuId)
             params.productIds = this.checkedProductList.map(product => product.productId)
             params.productCount = ''
             uni.setStorageSync('COMMIT_CART_INFO', params)
@@ -343,7 +354,7 @@ export default {
             const shopInfo = this.shopList.find(item => row.shopId === item.shopId)
             if (!shopInfo) return
             shopInfo.productList.forEach(item => {
-                if (row.checkedList.includes(item.productId.toString())) {
+                if (row.checkedList.includes(item.skuId.toString())) {
                     this.$set(item, 'checked', true)
                 } else {
                     this.$set(item, 'checked', false)
@@ -390,6 +401,13 @@ export default {
             }, 1000)
         },
 
+        // 活动价弹窗
+        handleShowActivity(current) {
+            if (!current.ladderPriceList) return
+            this.ladderPriceList = current.ladderPriceList
+            this.$refs.receiveBuyPopup.open()
+        },
+
         // 保存商品规格
         async onSaveNewUnit(e) {
             try {

+ 21 - 4
pages/views/cart/cart.vue

@@ -108,8 +108,17 @@
             :useType="useType"
             :buttonType="buttonType"
             @confirm="onSaveNewUnit"
+            @activityClick="handleShowActivity"
             v-if="productInfo"
         ></cm-goods-buy-popup>
+
+        <!-- 活动价 -->
+        <cm-goods-activity-popup
+            ref="activitypPopup"
+            :ladderList="ladderPriceList"
+            @open="$refs.receiveBuyPopup.close()"
+            @close="$refs.receiveBuyPopup.open()"
+        ></cm-goods-activity-popup>
     </view>
 </template>
 
@@ -172,7 +181,8 @@ const resetData = () => ({
     useType: 'cart',
     buttonType: 'left',
     goodsCouponList: [],
-    productInfo: null
+    productInfo: null,
+    ladderPriceList: []
 })
 
 export default {
@@ -266,7 +276,7 @@ export default {
         onCouponChange(index) {
             this.currentTab = index
         },
-        
+
         // 优惠券点击事件
         onCouponClick(coupon) {
             if (coupon.controlType === 'receive') {
@@ -275,7 +285,7 @@ export default {
                 this.visiable = false
             }
         },
-        
+
         // 设置couponTab数据
         makeCouponTabs() {
             return [
@@ -370,7 +380,7 @@ export default {
             const shopInfo = this.shopList.find(item => row.shopId === item.shopId)
             if (!shopInfo) return
             shopInfo.productList.forEach(item => {
-                if (row.checkedList.includes(item.productId.toString())) {
+                if (row.checkedList.includes(item.skuId.toString())) {
                     this.$set(item, 'checked', true)
                 } else {
                     this.$set(item, 'checked', false)
@@ -417,6 +427,13 @@ export default {
             }, 1000)
         },
 
+        // 活动价弹窗
+        handleShowActivity(current) {
+            if (!current.ladderPriceList) return
+            this.ladderPriceList = current.ladderPriceList
+            this.$refs.receiveBuyPopup.open()
+        },
+
         // 保存商品规格
         async onSaveNewUnit(e) {
             try {

+ 18 - 7
pages/views/goods/goods-detail.vue

@@ -88,12 +88,12 @@
         </goods-navbar>
 
         <!-- 活动价 -->
-        <goods-activity-popup
+        <cm-goods-activity-popup
             ref="activitypPopup"
-            :ladderList="ladderList"
+            :ladderList="ladderPriceList"
             @open="$refs.receiveBuyPopup.close()"
             @close="$refs.receiveBuyPopup.open()"
-        ></goods-activity-popup>
+        ></cm-goods-activity-popup>
 
         <!-- 分享弹窗 -->
         <cm-share-popup ref="sharePopup" :data="posterData" type="product"></cm-share-popup>
@@ -117,6 +117,7 @@
             :couponList="couponList"
             :useType="useType"
             :buttonType="buttonType"
+            @activityClick="handleShowActivity"
             @confirm="onSubmit"
             v-if="productInfo"
         ></cm-goods-buy-popup>
@@ -165,7 +166,8 @@ export default {
             // 购买商品弹窗
             goodsBuyPopup: false,
             useType: 'buy',
-            buttonType: 'left'
+            buttonType: 'left',
+            ladderPriceList: []
         }
     },
     computed: {
@@ -175,9 +177,9 @@ export default {
             return this.productInfo.imageList
         },
         // 活动价
-        ladderList() {
-            return this.productInfo.ladderList
-        },
+        // ladderList() {
+        //     return this.productInfo.ladderList
+        // },
         // 商品详情
         productDetail() {
             return this.productInfo.productDetail
@@ -244,6 +246,13 @@ export default {
             this.initNavbarButton()
         },
 
+        // 活动价弹窗
+        handleShowActivity(current) {
+            if (!current.ladderPriceList) return
+            this.ladderPriceList = current.ladderPriceList
+            this.$refs.receiveBuyPopup.open()
+        },
+
         // 商品提交
         onSubmit(detail) {
             // 用户未登录
@@ -266,6 +275,8 @@ export default {
                 this.goodsBuyPopup = false
                 return
             }
+            
+            console.log(detail);
 
             // 立即购买
             if (detail.type === 'buy') {

+ 2 - 0
pages/views/order/order-create.vue

@@ -100,6 +100,7 @@ export default {
             confirmParams: {
                 userId: '',
                 cartIds: '',
+                // skuIds: '',
                 productId: '',
                 productCount: '',
                 heUserId: '',
@@ -259,6 +260,7 @@ export default {
                 const cartInfo = uni.getStorageSync('COMMIT_CART_INFO')
                 this.submitParams.cartType = 1 // 从购物车提交(标识)
                 this.confirmParams.cartIds = cartInfo.cartIds.join()
+                // this.confirmParams.skuIds = cartInfo.skuIds.join()
                 this.allCount = cartInfo.allCount
             }
             this.initOrderInfo()

+ 1 - 1
pages/views/share-buy/share-buy-entry.vue

@@ -128,7 +128,7 @@ export default {
             // 提交订单信息
             let submitInfo = {
                 allCount: 1,
-                productId: this.collageData.productId,
+                skuId: this.collageData.skuId,
                 productCount: 1,
                 heUserId: this.userId,
                 collageFlag: 1,

+ 1 - 0
services/api/home.js

@@ -21,6 +21,7 @@ export function fetchHomeNavbar(params) {
 export function fetchHomeFloorData(params) {
     return request({
         url: '/product/home/init',
+        // url: '/commodity/hehe/home/init',
         method: 'GET',
         params
     })

+ 3 - 2
services/config.env.js

@@ -1,8 +1,9 @@
 export let APP_API_URI = ''
 if (process.env.NODE_ENV === 'development') {
     // 开发环境
-    APP_API_URI = 'http://192.168.2.67:8011'	 //本地联调地址
-    // APP_API_URI = 'https://mall2c-b.caimei365.com'
+    // APP_API_URI = 'http://192.168.2.67:8011'	 //本地联调地址
+    APP_API_URI = 'https://mall2c-b.caimei365.com'
+    // APP_API_URI = 'https://core-b.caimei365.com'
     // APP_API_URI = 'https://mall2c.caimei365.com'
 } else {
     // 生产环境